@idm-plugin/geo 1.4.9 → 1.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1706,11 +1706,16 @@ class V {
1706
1706
  static mergeCoordinateToWaypoints(M, z, p = !0) {
1707
1707
  M.lng = d.convertToStdLng(M.lng, 8);
1708
1708
  let O = Number.MAX_VALUE, A = 0, b = 0, W = 0;
1709
- for (let q = 0; q < z.length - 1; q++) {
1710
- const a = { lng: z[q].lng, lat: z[q].lat }, R = { lng: z[q + 1].lng, lat: z[q + 1].lat }, X = this.calculatePointToLineDistance(M, a, R);
1711
- O >= X && (O = X, A = q, b = this.calculateDistance(a, M, !1, 6), W = this.calculateDistance(R, M, !1, 6));
1709
+ if (z.length < 2)
1710
+ z.push(M);
1711
+ else {
1712
+ for (let q = 0; q < z.length - 1; q++) {
1713
+ const a = { lng: z[q].lng, lat: z[q].lat }, R = { lng: z[q + 1].lng, lat: z[q + 1].lat }, X = this.calculatePointToLineDistance(M, a, R);
1714
+ O >= X && (O = X, A = q, b = this.calculateDistance(a, M, !1, 6), W = this.calculateDistance(R, M, !1, 6));
1715
+ }
1716
+ b !== 0 && W !== 0 ? b < O || b === O && A === 0 ? z.unshift(M) : W < O || W === O && A === z.length - 2 ? z.push(M) : z.splice(A + 1, 0, M) : b === 0 ? p && z.splice(A, 1, M) : W === 0 && p && z.splice(A + 1, 1, M);
1712
1717
  }
1713
- return b !== 0 && W !== 0 ? b < O || b === O && A === 0 ? z.unshift(M) : W < O || W === O && A === z.length - 2 ? z.push(M) : z.splice(A + 1, 0, M) : b === 0 ? p && z.splice(A, 1, M) : W === 0 && p && z.splice(A + 1, 1, M), z.map((q) => (q.lng = d.convertToStdLng(q.lng), q));
1718
+ return z.map((q) => (q.lng = d.convertToStdLng(q.lng), q));
1714
1719
  }
1715
1720
  /**
1716
1721
  * 生成航线(基于途经点生成大圆/横向航线,并根据是否跨180度分组)
@@ -1970,6 +1975,7 @@ class l0 {
1970
1975
  for (const O of M) {
1971
1976
  if (O.forecasts) {
1972
1977
  const A = (p = O.history) == null ? void 0 : p[0];
1978
+ A && A.wind && (A.wind.spd = A.spd, A.wind.kts = A.kts);
1973
1979
  for (const b of O.forecasts) {
1974
1980
  const W = [], q = g(b.date).utc(), a = `${O.name}-${b.model}`;
1975
1981
  if (A) {