function transformlat(lonx, laty) {
  /* 略 */
}
function transformlng(lonx, laty) {
  /* 略 */
}
// WGS-84 转 GCJ-02 坐标
export function wgs84ToGcj02(lon, lat) {
  const PI = 3.1415926535897932384626
  const a = 6378245.0
  const ee = 0.00669342162296594323

  //   if (outOfChina(lon, lat)) {
  //     return [lon, lat]
  //   }
  let dlat = transformlat(lon - 105.0, lat - 35.0)
  let dlon = transformlng(lon - 105.0, lat - 35.0)
  const radlat = (lat / 180.0) * PI
  let magic = Math.sin(radlat)
  magic = 1 - ee * magic * magic
  const sqrtmagic = Math.sqrt(magic)
  dlat = (dlat * 180.0) / (((a * (1 - ee)) / (magic * sqrtmagic)) * PI)
  dlon = (dlon * 180.0) / ((a / sqrtmagic) * Math.cos(radlat) * PI)
  const mglat = lat + dlat
  const mglon = lon + dlon
  return [mglon, mglat]
}

// // 辅助函数保持原样...
// function outOfChina(lon, lat) {
//   /* 略 */
// }
