@idm-plugin/geo 2.0.1 → 2.0.2
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 +84 -85
- package/dist/index.umd.cjs +3 -3
- package/dist/lane/src/index.d.ts +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -24,12 +24,12 @@ var x = { exports: {} };
|
|
|
24
24
|
return o > 96 ? o - 87 : o > 64 ? o - 29 : o - 48;
|
|
25
25
|
}
|
|
26
26
|
function T(o) {
|
|
27
|
-
var n = 0, X = o.split("."), L = X[0], e = X[1] || "", U = 1, E, t = 0,
|
|
28
|
-
for (o.charCodeAt(0) === 45 && (n = 1,
|
|
27
|
+
var n = 0, X = o.split("."), L = X[0], e = X[1] || "", U = 1, E, t = 0, Z = 1;
|
|
28
|
+
for (o.charCodeAt(0) === 45 && (n = 1, Z = -1), n; n < L.length; n++)
|
|
29
29
|
E = R(L.charCodeAt(n)), t = 60 * t + E;
|
|
30
30
|
for (n = 0; n < e.length; n++)
|
|
31
31
|
U = U / 60, E = R(e.charCodeAt(n)), t += E * U;
|
|
32
|
-
return t *
|
|
32
|
+
return t * Z;
|
|
33
33
|
}
|
|
34
34
|
function f(o) {
|
|
35
35
|
for (var n = 0; n < o.length; n++)
|
|
@@ -56,10 +56,10 @@ var x = { exports: {} };
|
|
|
56
56
|
population: n[5] | 0
|
|
57
57
|
};
|
|
58
58
|
}
|
|
59
|
-
function
|
|
59
|
+
function P(o) {
|
|
60
60
|
o && this._set(s(o));
|
|
61
61
|
}
|
|
62
|
-
function
|
|
62
|
+
function l(o, n) {
|
|
63
63
|
var X = n.length;
|
|
64
64
|
if (o < n[0])
|
|
65
65
|
return 0;
|
|
@@ -71,13 +71,13 @@ var x = { exports: {} };
|
|
|
71
71
|
L = Math.floor((e + U) / 2), n[L] <= o ? e = L : U = L;
|
|
72
72
|
return U;
|
|
73
73
|
}
|
|
74
|
-
|
|
74
|
+
P.prototype = {
|
|
75
75
|
_set: function(o) {
|
|
76
76
|
this.name = o.name, this.abbrs = o.abbrs, this.untils = o.untils, this.offsets = o.offsets, this.population = o.population;
|
|
77
77
|
},
|
|
78
78
|
_index: function(o) {
|
|
79
79
|
var n = +o, X = this.untils, L;
|
|
80
|
-
if (L =
|
|
80
|
+
if (L = l(n, X), L >= 0)
|
|
81
81
|
return L;
|
|
82
82
|
},
|
|
83
83
|
countries: function() {
|
|
@@ -87,10 +87,10 @@ var x = { exports: {} };
|
|
|
87
87
|
});
|
|
88
88
|
},
|
|
89
89
|
parse: function(o) {
|
|
90
|
-
var n = +o, X = this.offsets, L = this.untils, e = L.length - 1, U, E, t,
|
|
91
|
-
for (
|
|
92
|
-
if (U = X[
|
|
93
|
-
return X[
|
|
90
|
+
var n = +o, X = this.offsets, L = this.untils, e = L.length - 1, U, E, t, Z;
|
|
91
|
+
for (Z = 0; Z < e; Z++)
|
|
92
|
+
if (U = X[Z], E = X[Z + 1], t = X[Z && Z - 1], U < E && V.moveAmbiguousForward ? U = E : U > t && V.moveInvalidForward && (U = t), n < L[Z] - U * 6e4)
|
|
93
|
+
return X[Z];
|
|
94
94
|
return X[e];
|
|
95
95
|
},
|
|
96
96
|
abbr: function(o) {
|
|
@@ -103,17 +103,17 @@ var x = { exports: {} };
|
|
|
103
103
|
return this.offsets[this._index(o)];
|
|
104
104
|
}
|
|
105
105
|
};
|
|
106
|
-
function
|
|
106
|
+
function B(o, n) {
|
|
107
107
|
this.name = o, this.zones = n;
|
|
108
108
|
}
|
|
109
109
|
function G(o) {
|
|
110
110
|
var n = o.toTimeString(), X = n.match(/\([a-z ]+\)/i);
|
|
111
111
|
X && X[0] ? (X = X[0].match(/[A-Z]/g), X = X ? X.join("") : void 0) : (X = n.match(/[A-Z]{3,5}/g), X = X ? X[0] : void 0), X === "GMT" && (X = void 0), this.at = +o, this.abbr = X, this.offset = o.getTimezoneOffset();
|
|
112
112
|
}
|
|
113
|
-
function
|
|
113
|
+
function H(o) {
|
|
114
114
|
this.zone = o, this.offsetScore = 0, this.abbrScore = 0;
|
|
115
115
|
}
|
|
116
|
-
|
|
116
|
+
H.prototype.scoreOffsetAt = function(o) {
|
|
117
117
|
this.offsetScore += Math.abs(this.zone.utcOffset(o.at) - o.offset), this.zone.abbr(o.at).replace(/[^A-Z]/g, "") !== o.abbr && this.abbrScore++;
|
|
118
118
|
};
|
|
119
119
|
function F(o, n) {
|
|
@@ -138,12 +138,12 @@ var x = { exports: {} };
|
|
|
138
138
|
L = n[X], A[L] = A[L] || {}, A[L][o] = !0;
|
|
139
139
|
}
|
|
140
140
|
function p0(o) {
|
|
141
|
-
var n = o.length, X = {}, L = [], e = {}, U, E, t,
|
|
141
|
+
var n = o.length, X = {}, L = [], e = {}, U, E, t, Z;
|
|
142
142
|
for (U = 0; U < n; U++)
|
|
143
143
|
if (t = o[U].offset, !e.hasOwnProperty(t)) {
|
|
144
|
-
|
|
145
|
-
for (E in
|
|
146
|
-
|
|
144
|
+
Z = A[t] || {};
|
|
145
|
+
for (E in Z)
|
|
146
|
+
Z.hasOwnProperty(E) && (X[E] = !0);
|
|
147
147
|
e[t] = !0;
|
|
148
148
|
}
|
|
149
149
|
for (U in X)
|
|
@@ -154,17 +154,17 @@ var x = { exports: {} };
|
|
|
154
154
|
try {
|
|
155
155
|
var o = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
156
156
|
if (o && o.length > 3) {
|
|
157
|
-
var n = O[
|
|
157
|
+
var n = O[h(o)];
|
|
158
158
|
if (n)
|
|
159
159
|
return n;
|
|
160
160
|
D("Moment Timezone found " + o + " from the Intl api, but did not have that data loaded.");
|
|
161
161
|
}
|
|
162
162
|
} catch {
|
|
163
163
|
}
|
|
164
|
-
var X = $(), L = X.length, e = p0(X), U = [], E, t,
|
|
164
|
+
var X = $(), L = X.length, e = p0(X), U = [], E, t, Z;
|
|
165
165
|
for (t = 0; t < e.length; t++) {
|
|
166
|
-
for (E = new
|
|
167
|
-
E.scoreOffsetAt(X[
|
|
166
|
+
for (E = new H(g(e[t])), Z = 0; Z < L; Z++)
|
|
167
|
+
E.scoreOffsetAt(X[Z]);
|
|
168
168
|
U.push(E);
|
|
169
169
|
}
|
|
170
170
|
return U.sort(z0), U.length > 0 ? U[0].zone.name : void 0;
|
|
@@ -172,18 +172,18 @@ var x = { exports: {} };
|
|
|
172
172
|
function A0(o) {
|
|
173
173
|
return (!W || o) && (W = O0()), W;
|
|
174
174
|
}
|
|
175
|
-
function
|
|
175
|
+
function h(o) {
|
|
176
176
|
return (o || "").toLowerCase().replace(/\//g, "_");
|
|
177
177
|
}
|
|
178
178
|
function k(o) {
|
|
179
179
|
var n, X, L, e;
|
|
180
180
|
for (typeof o == "string" && (o = [o]), n = 0; n < o.length; n++)
|
|
181
|
-
L = o[n].split("|"), X = L[0], e =
|
|
181
|
+
L = o[n].split("|"), X = L[0], e = h(X), b[e] = o[n], O[e] = X, b0(e, L[2].split(" "));
|
|
182
182
|
}
|
|
183
183
|
function g(o, n) {
|
|
184
|
-
o =
|
|
184
|
+
o = h(o);
|
|
185
185
|
var X = b[o], L;
|
|
186
|
-
return X instanceof
|
|
186
|
+
return X instanceof P ? X : typeof X == "string" ? (X = new P(X), b[o] = X, X) : p[o] && n !== g && (L = g(p[o], g)) ? (X = b[o] = new P(), X._set(L), X.name = O[o], X) : null;
|
|
187
187
|
}
|
|
188
188
|
function c0() {
|
|
189
189
|
var o, n = [];
|
|
@@ -197,13 +197,13 @@ var x = { exports: {} };
|
|
|
197
197
|
function y(o) {
|
|
198
198
|
var n, X, L, e;
|
|
199
199
|
for (typeof o == "string" && (o = [o]), n = 0; n < o.length; n++)
|
|
200
|
-
X = o[n].split("|"), L =
|
|
200
|
+
X = o[n].split("|"), L = h(X[0]), e = h(X[1]), p[L] = e, O[L] = X[0], p[e] = L, O[e] = X[1];
|
|
201
201
|
}
|
|
202
202
|
function o0(o) {
|
|
203
203
|
var n, X, L, e;
|
|
204
204
|
if (!(!o || !o.length))
|
|
205
205
|
for (n = 0; n < o.length; n++)
|
|
206
|
-
e = o[n].split("|"), X = e[0].toUpperCase(), L = e[1].split(" "), c[X] = new
|
|
206
|
+
e = o[n].split("|"), X = e[0].toUpperCase(), L = e[1].split(" "), c[X] = new B(
|
|
207
207
|
X,
|
|
208
208
|
L
|
|
209
209
|
);
|
|
@@ -240,7 +240,7 @@ var x = { exports: {} };
|
|
|
240
240
|
var n = Array.prototype.slice.call(arguments, 0, -1), X = arguments[arguments.length - 1], L = M.utc.apply(null, n), e;
|
|
241
241
|
return !M.isMoment(o) && v(L) && (e = g(X)) && L.add(e.parse(L), "minutes"), L.tz(X), L;
|
|
242
242
|
}
|
|
243
|
-
V.version = z, V.dataVersion = "", V._zones = b, V._links = p, V._names = O, V._countries = c, V.add = k, V.link = y, V.load = d0, V.zone = g, V.zoneExists = J, V.guess = A0, V.names = c0, V.Zone =
|
|
243
|
+
V.version = z, V.dataVersion = "", V._zones = b, V._links = p, V._names = O, V._countries = c, V.add = k, V.link = y, V.load = d0, V.zone = g, V.zoneExists = J, V.guess = A0, V.names = c0, V.Zone = P, V.unpack = s, V.unpackBase60 = T, V.needsOffset = v, V.moveInvalidForward = !0, V.moveAmbiguousForward = !1, V.countries = W0, V.zonesForCountry = Y0;
|
|
244
244
|
var C = M.fn;
|
|
245
245
|
M.tz = V, M.defaultZone = null, M.updateOffset = function(o, n) {
|
|
246
246
|
var X = M.defaultZone, L;
|
|
@@ -277,8 +277,8 @@ var x = { exports: {} };
|
|
|
277
277
|
C.zoneName = w(C.zoneName), C.zoneAbbr = w(C.zoneAbbr), C.utc = _(C.utc), C.local = _(C.local), C.utcOffset = a0(C.utcOffset), M.tz.setDefault = function(o) {
|
|
278
278
|
return (Y < 2 || Y === 2 && d < 9) && D("Moment Timezone setDefault() requires Moment.js >= 2.9.0. You are using Moment.js " + M.version + "."), M.defaultZone = o ? g(o) : null, M;
|
|
279
279
|
};
|
|
280
|
-
var
|
|
281
|
-
return Object.prototype.toString.call(
|
|
280
|
+
var K = M.momentProperties;
|
|
281
|
+
return Object.prototype.toString.call(K) === "[object Array]" ? (K.push("_z"), K.push("_a")) : K && (K._z = null), M;
|
|
282
282
|
});
|
|
283
283
|
})(x);
|
|
284
284
|
var R0 = x.exports;
|
|
@@ -1314,7 +1314,7 @@ try {
|
|
|
1314
1314
|
} catch {
|
|
1315
1315
|
} finally {
|
|
1316
1316
|
}
|
|
1317
|
-
class
|
|
1317
|
+
class r {
|
|
1318
1318
|
/**
|
|
1319
1319
|
* 计算方位角
|
|
1320
1320
|
* @param from 坐标 {lng, lat}
|
|
@@ -1513,8 +1513,8 @@ class B {
|
|
|
1513
1513
|
*/
|
|
1514
1514
|
static appendCoordinateToRoute(M, z) {
|
|
1515
1515
|
M.lng = a.convertToStdLng(M.lng, 8);
|
|
1516
|
-
const b =
|
|
1517
|
-
return b.push(M),
|
|
1516
|
+
const b = r.convertRouteToCoordinates(z);
|
|
1517
|
+
return b.push(M), r.divideAccordingToLng(b);
|
|
1518
1518
|
}
|
|
1519
1519
|
/**
|
|
1520
1520
|
* 向route头加1个坐标
|
|
@@ -1522,8 +1522,8 @@ class B {
|
|
|
1522
1522
|
* @param route
|
|
1523
1523
|
*/
|
|
1524
1524
|
static unshiftCoordinateToRoute(M, z) {
|
|
1525
|
-
const b =
|
|
1526
|
-
return b.unshift(M),
|
|
1525
|
+
const b = r.convertRouteToCoordinates(z);
|
|
1526
|
+
return b.unshift(M), r.divideAccordingToLng(b);
|
|
1527
1527
|
}
|
|
1528
1528
|
/**
|
|
1529
1529
|
* 合并多个waypoints进航线
|
|
@@ -1597,8 +1597,8 @@ class B {
|
|
|
1597
1597
|
* @return [[[lng, lat]]]
|
|
1598
1598
|
*/
|
|
1599
1599
|
static calculateSubRoute(M, z) {
|
|
1600
|
-
const b =
|
|
1601
|
-
|
|
1600
|
+
const b = r.convertRouteToCoordinates(z);
|
|
1601
|
+
r.mergeCoordinateToWaypoints(M, b, !0), z = r.divideAccordingToLng(b);
|
|
1602
1602
|
const { segIndex: p, minIndex: c } = this.calculateMinDistanceToRoute({ ...M }, z);
|
|
1603
1603
|
M.lng = a.convertToStdLng(M.lng);
|
|
1604
1604
|
const O = [];
|
|
@@ -1764,7 +1764,7 @@ class B {
|
|
|
1764
1764
|
* 计算下一个距离单位的坐标及其子航线
|
|
1765
1765
|
* @param from 起点坐标 {lng, lat}
|
|
1766
1766
|
* @param distance 航行距离
|
|
1767
|
-
* @param route
|
|
1767
|
+
* @param route
|
|
1768
1768
|
* @param units
|
|
1769
1769
|
* @return { coordinate: {lng, lat}, route: [[[lng, lat]]]}
|
|
1770
1770
|
*/
|
|
@@ -1783,15 +1783,15 @@ class B {
|
|
|
1783
1783
|
i.push(T[s]);
|
|
1784
1784
|
else {
|
|
1785
1785
|
S = { lng: T[s][0], lat: T[s][1] };
|
|
1786
|
-
const
|
|
1787
|
-
if (q +=
|
|
1788
|
-
Y +=
|
|
1786
|
+
const P = this.calculateDistance(M, S, !0, 8, p);
|
|
1787
|
+
if (q += P, q < z)
|
|
1788
|
+
Y += P, P && O.push(S), M = S;
|
|
1789
1789
|
else {
|
|
1790
1790
|
if (Y = z, q === z)
|
|
1791
1791
|
d = S, i.push([d.lng, d.lat]);
|
|
1792
1792
|
else {
|
|
1793
|
-
const
|
|
1794
|
-
d = this.calculateCoordinate(S,
|
|
1793
|
+
const l = q - z, B = this.calculateBearing(S, M);
|
|
1794
|
+
d = this.calculateCoordinate(S, B, l, p), i.push([d.lng, d.lat]), i.push([S.lng, S.lat]);
|
|
1795
1795
|
}
|
|
1796
1796
|
W = !0;
|
|
1797
1797
|
}
|
|
@@ -1931,7 +1931,7 @@ class B {
|
|
|
1931
1931
|
const O = M[c - 1], A = M[c], W = M[c + 1];
|
|
1932
1932
|
let q = !1, Y = !1;
|
|
1933
1933
|
if ((O.velocity || O.suspend || O.important || O.pilot || c === 1) && (q = !0, p.push(O)), A.gcToPrevious && (q || (q = !0, p.push(O)), Y = !0, p.push(A), c++), W) {
|
|
1934
|
-
const d =
|
|
1934
|
+
const d = r.calculateDistance(O, A, !0), R = r.calculateDistance(A, W, !0), T = r.calculateDistance(O, W, !0), f = (Math.pow(d, 2) + Math.pow(R, 2) - Math.pow(T, 2)) / (2 * d * R);
|
|
1935
1935
|
Math.round(Math.acos(f) * 180 / Math.PI) < b && T > z && !Y && (p.push(A), c++);
|
|
1936
1936
|
}
|
|
1937
1937
|
if (c >= M.length - 1) {
|
|
@@ -1966,8 +1966,8 @@ class B {
|
|
|
1966
1966
|
if (!p) {
|
|
1967
1967
|
const q = (O = (c = z.filter((d) => (d == null ? void 0 : d.positionTime) < b.unix())) == null ? void 0 : c.sort((d, R) => (d.positionTime || 0) - (R.positionTime || 0))) == null ? void 0 : O.at(-1), Y = (W = (A = z.filter((d) => (d == null ? void 0 : d.positionTime) > b.unix())) == null ? void 0 : A.sort((d, R) => (d.positionTime || 0) - (R.positionTime || 0))) == null ? void 0 : W.at(0);
|
|
1968
1968
|
if (q && Y) {
|
|
1969
|
-
const d =
|
|
1970
|
-
p =
|
|
1969
|
+
const d = r.calculateBearing(q, Y, !0), R = r.calculateDistance(q, Y), T = (b.unix() - q.positionTime) / (Y.positionTime - q.positionTime);
|
|
1970
|
+
p = r.calculateCoordinate(q, d, R * T), p.positionTime = b.unix(), p.utc = b.utc().format(), p.cog = d, p.sog = Math.round(R / ((Y.positionTime - q.positionTime) / 3600) * 100) / 100;
|
|
1971
1971
|
} else
|
|
1972
1972
|
p = q || Y, p && (p.utc = u.unix(p == null ? void 0 : p.positionTime).utc().format());
|
|
1973
1973
|
}
|
|
@@ -1982,16 +1982,16 @@ class B {
|
|
|
1982
1982
|
z = JSON.parse(JSON.stringify(z)), z.sort((q, Y) => (q.positionTime || 0) - (Y.positionTime || 0));
|
|
1983
1983
|
let b = Number.MAX_SAFE_INTEGER, p = Number.MAX_SAFE_INTEGER;
|
|
1984
1984
|
for (let q = 0; q < z.length - 1; q++) {
|
|
1985
|
-
const Y = z[q], d = z[q + 1], R =
|
|
1985
|
+
const Y = z[q], d = z[q + 1], R = r.calculatePointToLineDistance(M, Y, d);
|
|
1986
1986
|
R < b && (b = R, p = q);
|
|
1987
1987
|
}
|
|
1988
|
-
const c = z[p], O = z[p + 1], A =
|
|
1988
|
+
const c = z[p], O = z[p + 1], A = r.calculateDistance(c, M), W = r.calculateDistance(O, M);
|
|
1989
1989
|
if (A === 0)
|
|
1990
1990
|
M = c;
|
|
1991
1991
|
else if (W === 0)
|
|
1992
1992
|
M = O;
|
|
1993
1993
|
else {
|
|
1994
|
-
const q = c.positionTime || 0, Y = O.positionTime || 0, d =
|
|
1994
|
+
const q = c.positionTime || 0, Y = O.positionTime || 0, d = r.calculateDistance(c, O);
|
|
1995
1995
|
M.positionTime = Math.round(q + (Y - q) * (A / d));
|
|
1996
1996
|
}
|
|
1997
1997
|
return M.utc = M.positionTime ? u.unix(M.positionTime).utc().format() : void 0, M.positionTime ? M : void 0;
|
|
@@ -2074,18 +2074,17 @@ class B {
|
|
|
2074
2074
|
const b = z.sample.hours.at(0), p = u.utc(M), c = u.utc(z.eta), O = p.isAfter(c) ? c : p;
|
|
2075
2075
|
let A = z.sample.hours.find((T) => T.eta === O.format());
|
|
2076
2076
|
if (!A) {
|
|
2077
|
-
const T = z.sample.hours.filter((
|
|
2077
|
+
const T = z.sample.hours.filter((G) => u.utc(G.eta).isBefore(O)).at(-1), f = this.calculateSubRoute(T, z.route);
|
|
2078
2078
|
A = (R = this.calculateNextCoordinateAlongRoute(T, T.speed * O.diff(u(T.etd), "hours", !0), f)) == null ? void 0 : R.coordinate;
|
|
2079
|
-
const {
|
|
2079
|
+
const { cFactor: i, cog: S, wxFactor: s, meteo: P } = T, l = Math.round(A.distanceFromPrevious * 1e4) / 1e4, B = Math.round((l + T.distanceFromStart) * 1e4) / 1e4;
|
|
2080
2080
|
A = {
|
|
2081
2081
|
...A,
|
|
2082
|
-
cFactor:
|
|
2083
|
-
|
|
2084
|
-
cog: s,
|
|
2082
|
+
cFactor: i,
|
|
2083
|
+
cog: S,
|
|
2085
2084
|
speed: T.speed,
|
|
2086
|
-
wxFactor:
|
|
2087
|
-
distanceFromStart:
|
|
2088
|
-
distanceFromPrevious:
|
|
2085
|
+
wxFactor: s,
|
|
2086
|
+
distanceFromStart: B,
|
|
2087
|
+
distanceFromPrevious: l,
|
|
2089
2088
|
meteo: P,
|
|
2090
2089
|
eta: O.format(),
|
|
2091
2090
|
etd: O.format()
|
|
@@ -2155,7 +2154,7 @@ class t0 {
|
|
|
2155
2154
|
for (const i in W == null ? void 0 : W.hours) {
|
|
2156
2155
|
const S = W.hours[i];
|
|
2157
2156
|
q = q || S;
|
|
2158
|
-
const s = R.clone().add(Number(i), "hour"),
|
|
2157
|
+
const s = R.clone().add(Number(i), "hour"), P = N.point([S.lng, S.lat], {
|
|
2159
2158
|
model: W.model,
|
|
2160
2159
|
name: O.name,
|
|
2161
2160
|
nameCn: O.nameCn,
|
|
@@ -2169,7 +2168,7 @@ class t0 {
|
|
|
2169
2168
|
category: T,
|
|
2170
2169
|
type: "forecast"
|
|
2171
2170
|
});
|
|
2172
|
-
d.push(
|
|
2171
|
+
d.push(P), Y.push(P.geometry.coordinates);
|
|
2173
2172
|
}
|
|
2174
2173
|
const f = {
|
|
2175
2174
|
kts: void 0,
|
|
@@ -2178,8 +2177,8 @@ class t0 {
|
|
|
2178
2177
|
if (A) {
|
|
2179
2178
|
const i = u(A.updated).utc();
|
|
2180
2179
|
if (q) {
|
|
2181
|
-
const s =
|
|
2182
|
-
f.kts = Math.round(s /
|
|
2180
|
+
const s = r.calculateDistance(A, q), P = u(q.utc || q.updated).diff(i, "h", !0);
|
|
2181
|
+
f.kts = Math.round(s / P * 100) / 100, f.deg = r.calculateBearing(A, q, !0, 0);
|
|
2183
2182
|
}
|
|
2184
2183
|
const S = N.point([A.lng, A.lat], {
|
|
2185
2184
|
model: W.model,
|
|
@@ -2260,29 +2259,29 @@ class t0 {
|
|
|
2260
2259
|
const Y = q.properties.name, d = q.properties.model, R = q.properties.showCircle, T = q.properties.disabled, f = u(q.properties.date).utc();
|
|
2261
2260
|
let i = z * 60;
|
|
2262
2261
|
const S = (O = M == null ? void 0 : M.data) == null ? void 0 : O.features.filter(
|
|
2263
|
-
(
|
|
2262
|
+
(l) => l.geometry.type === "Point" && l.properties.type === "forecast" && l.properties.category === `${Y}-${d}`
|
|
2264
2263
|
);
|
|
2265
|
-
let s,
|
|
2266
|
-
for (; s = this.pickIndex(S,
|
|
2264
|
+
let s, P = f.clone().add(i, "minute").set({ minute: 0, second: 0, millisecond: 0 });
|
|
2265
|
+
for (; s = this.pickIndex(S, P), s <= S.length - 1; ) {
|
|
2267
2266
|
if (s > 0) {
|
|
2268
|
-
const
|
|
2267
|
+
const l = S[s], B = s === 0 ? void 0 : S[s - 1], G = (i / 60 - ((A = B == null ? void 0 : B.properties) == null ? void 0 : A.hour)) / (l.properties.hour - ((W = B == null ? void 0 : B.properties) == null ? void 0 : W.hour)), H = this.computeNumber(B == null ? void 0 : B.geometry.coordinates[0], l.geometry.coordinates[0], G), F = this.computeNumber(B == null ? void 0 : B.geometry.coordinates[1], l.geometry.coordinates[1], G), $ = N.point([H, F], {
|
|
2269
2268
|
name: Y,
|
|
2270
2269
|
model: d,
|
|
2271
|
-
category:
|
|
2272
|
-
date:
|
|
2273
|
-
format:
|
|
2274
|
-
gusts: this.computeNumber(
|
|
2275
|
-
hour: this.computeNumber(
|
|
2276
|
-
movement: this.computeNumber(
|
|
2277
|
-
pressure: this.computeNumber(
|
|
2278
|
-
wind: this.computeNumber(
|
|
2270
|
+
category: l == null ? void 0 : l.properties.category,
|
|
2271
|
+
date: P.format(),
|
|
2272
|
+
format: P.format("MMM-DD/HHmm[Z]"),
|
|
2273
|
+
gusts: this.computeNumber(B == null ? void 0 : B.properties.gusts, l.properties.gusts, G),
|
|
2274
|
+
hour: this.computeNumber(B == null ? void 0 : B.properties.hour, l.properties.hour, G),
|
|
2275
|
+
movement: this.computeNumber(B == null ? void 0 : B.properties.movement, l.properties.movement, G),
|
|
2276
|
+
pressure: this.computeNumber(B == null ? void 0 : B.properties.pressure, l.properties.pressure, G),
|
|
2277
|
+
wind: this.computeNumber(B == null ? void 0 : B.properties.wind, l.properties.wind, G),
|
|
2279
2278
|
type: "forecast",
|
|
2280
2279
|
disabled: T,
|
|
2281
2280
|
showCircle: R
|
|
2282
2281
|
});
|
|
2283
2282
|
p.push($);
|
|
2284
2283
|
}
|
|
2285
|
-
i += z * 60,
|
|
2284
|
+
i += z * 60, P = f.clone().add(i, "minute").set({ minute: 0, second: 0, millisecond: 0 });
|
|
2286
2285
|
}
|
|
2287
2286
|
}
|
|
2288
2287
|
return p;
|
|
@@ -2312,7 +2311,7 @@ class t0 {
|
|
|
2312
2311
|
const { t1: c, t2: O, hr: A, hours: W } = this.tropicalCenterTwin(z, 24, p);
|
|
2313
2312
|
if (c && O) {
|
|
2314
2313
|
if (!p.debug) {
|
|
2315
|
-
const f =
|
|
2314
|
+
const f = r.calculateDistance(M, c), i = r.calculateDistance(M, O);
|
|
2316
2315
|
if (f > 2 * b && i > 2 * b)
|
|
2317
2316
|
return I == null || I.info("[%s] the distance between from and t1(%d) and t2(%d) is enough, no need diversion: %j", p.requestId, f, i, {
|
|
2318
2317
|
from: M,
|
|
@@ -2321,10 +2320,10 @@ class t0 {
|
|
|
2321
2320
|
hr: A
|
|
2322
2321
|
}), {};
|
|
2323
2322
|
}
|
|
2324
|
-
const q =
|
|
2323
|
+
const q = r.calculateBearing(M, c), Y = r.calculateBearing(c, O), d = Math.abs(q - Y);
|
|
2325
2324
|
let R = 0;
|
|
2326
2325
|
d < 180 ? R = d + 90 : d >= 180 && (R = d - 90);
|
|
2327
|
-
const T =
|
|
2326
|
+
const T = r.calculateCoordinate(c, R, b);
|
|
2328
2327
|
return I == null || I.info("[%s] the right tangent position: %j", p.requestId, {
|
|
2329
2328
|
from: M,
|
|
2330
2329
|
t1: c,
|
|
@@ -2351,7 +2350,7 @@ class t0 {
|
|
|
2351
2350
|
const { t1: c, t2: O, hr: A, hours: W } = this.tropicalCenterTwin(z, 24, p);
|
|
2352
2351
|
if (c && O) {
|
|
2353
2352
|
if (!p.debug) {
|
|
2354
|
-
const T =
|
|
2353
|
+
const T = r.calculateDistance(M, c), f = r.calculateDistance(M, O);
|
|
2355
2354
|
if (T > 2 * b && f > 2 * b)
|
|
2356
2355
|
return I == null || I.info("[%s] the distance between from and t1(%d) and t2(%d) is enough, no need drifting: %j", p.requestId, T, f, {
|
|
2357
2356
|
from: M,
|
|
@@ -2360,8 +2359,8 @@ class t0 {
|
|
|
2360
2359
|
hr: A
|
|
2361
2360
|
}), {};
|
|
2362
2361
|
}
|
|
2363
|
-
const q =
|
|
2364
|
-
return { at:
|
|
2362
|
+
const q = r.calculateBearing(M, c), Y = r.calculateBearing(c, O), d = r.calculateDistance(M, c);
|
|
2363
|
+
return { at: r.calculateCoordinate(c, q - Y + 180, b < d ? b : d), t1: c, t2: O, hr: Number(A), hours: W };
|
|
2365
2364
|
} else
|
|
2366
2365
|
return I == null || I.info("[%s] no need drift: %j", p.requestId, { from: M, t1: c, t2: O, hr: A }), {};
|
|
2367
2366
|
}
|
|
@@ -2451,7 +2450,7 @@ class V0 {
|
|
|
2451
2450
|
if (b && ["N", "B", "E", "NOON", "BOSP", "EOSP"].includes(q.type))
|
|
2452
2451
|
continue;
|
|
2453
2452
|
const T = R.positionTime - d.positionTime;
|
|
2454
|
-
if (
|
|
2453
|
+
if (r.calculateDistance(R, d, !0, 4) / (T / 3600) < z)
|
|
2455
2454
|
O || (O = q), Y === M.length - 1 && (A = R, W = Y);
|
|
2456
2455
|
else {
|
|
2457
2456
|
O && (A = M[Y - 1], W = Y);
|
|
@@ -2475,8 +2474,8 @@ class V0 {
|
|
|
2475
2474
|
utc: u.unix(A.positionTime).utc().format()
|
|
2476
2475
|
},
|
|
2477
2476
|
duration: A.positionTime - O.positionTime
|
|
2478
|
-
}, d = M.filter((T) => T.positionTime >= Y.start.positionTime && T.positionTime <= Y.end.positionTime), R =
|
|
2479
|
-
Y.distance =
|
|
2477
|
+
}, d = M.filter((T) => T.positionTime >= Y.start.positionTime && T.positionTime <= Y.end.positionTime), R = r.divideAccordingToLng(d);
|
|
2478
|
+
Y.distance = r.calculateRouteDistance(R), Y.hours = Math.round(Y.duration / 3600 * 10) / 10, Y.avgSog = Math.round(Y.distance / Y.hours * 10) / 10, c.push(Y);
|
|
2480
2479
|
}
|
|
2481
2480
|
O = void 0, A = void 0;
|
|
2482
2481
|
}
|
|
@@ -2486,7 +2485,7 @@ class V0 {
|
|
|
2486
2485
|
}
|
|
2487
2486
|
export {
|
|
2488
2487
|
V0 as AisHelper,
|
|
2489
|
-
|
|
2488
|
+
r as LaneHelper,
|
|
2490
2489
|
a as LngLatHelper,
|
|
2491
2490
|
t0 as TropicalHelper
|
|
2492
2491
|
};
|