@idm-plugin/geo 1.4.9 → 1.5.0
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/README.md +1 -1
- package/dist/index.js +9 -4
- package/dist/index.umd.cjs +1 -1
- package/package.json +69 -69
package/README.md
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
## Geo Plugin
|
|
1
|
+
## Geo Plugin
|
|
2
2
|
Geo插件
|
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
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
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
|
|
1718
|
+
return z.map((q) => (q.lng = d.convertToStdLng(q.lng), q));
|
|
1714
1719
|
}
|
|
1715
1720
|
/**
|
|
1716
1721
|
* 生成航线(基于途经点生成大圆/横向航线,并根据是否跨180度分组)
|