@idm-plugin/geo 1.7.5 → 1.7.6
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 +150 -142
- package/dist/index.umd.cjs +1 -1
- package/dist/lane/src/index.d.ts +1 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -24,34 +24,34 @@ var j = { exports: {} };
|
|
|
24
24
|
return W > 96 ? W - 87 : W > 64 ? W - 29 : W - 48;
|
|
25
25
|
}
|
|
26
26
|
function T(W) {
|
|
27
|
-
var a = 0,
|
|
28
|
-
for (W.charCodeAt(0) === 45 && (a = 1,
|
|
29
|
-
|
|
27
|
+
var a = 0, n = W.split("."), R = n[0], i = n[1] || "", S = 1, V, B = 0, t = 1;
|
|
28
|
+
for (W.charCodeAt(0) === 45 && (a = 1, t = -1), a; a < R.length; a++)
|
|
29
|
+
V = L(R.charCodeAt(a)), B = 60 * B + V;
|
|
30
30
|
for (a = 0; a < i.length; a++)
|
|
31
|
-
S = S / 60,
|
|
32
|
-
return B *
|
|
31
|
+
S = S / 60, V = L(i.charCodeAt(a)), B += V * S;
|
|
32
|
+
return B * t;
|
|
33
33
|
}
|
|
34
34
|
function U(W) {
|
|
35
35
|
for (var a = 0; a < W.length; a++)
|
|
36
36
|
W[a] = T(W[a]);
|
|
37
37
|
}
|
|
38
38
|
function r(W, a) {
|
|
39
|
-
for (var
|
|
40
|
-
W[
|
|
39
|
+
for (var n = 0; n < a; n++)
|
|
40
|
+
W[n] = Math.round((W[n - 1] || 0) + W[n] * 6e4);
|
|
41
41
|
W[a - 1] = 1 / 0;
|
|
42
42
|
}
|
|
43
43
|
function s(W, a) {
|
|
44
|
-
var
|
|
45
|
-
for (
|
|
46
|
-
|
|
47
|
-
return
|
|
44
|
+
var n = [], R;
|
|
45
|
+
for (R = 0; R < a.length; R++)
|
|
46
|
+
n[R] = W[a[R]];
|
|
47
|
+
return n;
|
|
48
48
|
}
|
|
49
49
|
function P(W) {
|
|
50
|
-
var a = W.split("|"),
|
|
51
|
-
return U(
|
|
50
|
+
var a = W.split("|"), n = a[2].split(" "), R = a[3].split(""), i = a[4].split(" ");
|
|
51
|
+
return U(n), U(R), U(i), r(i, R.length), {
|
|
52
52
|
name: a[0],
|
|
53
|
-
abbrs: s(a[1].split(" "),
|
|
54
|
-
offsets: s(
|
|
53
|
+
abbrs: s(a[1].split(" "), R),
|
|
54
|
+
offsets: s(n, R),
|
|
55
55
|
untils: i,
|
|
56
56
|
population: a[5] | 0
|
|
57
57
|
};
|
|
@@ -60,15 +60,15 @@ var j = { exports: {} };
|
|
|
60
60
|
W && this._set(P(W));
|
|
61
61
|
}
|
|
62
62
|
function l(W, a) {
|
|
63
|
-
var
|
|
63
|
+
var n = a.length;
|
|
64
64
|
if (W < a[0])
|
|
65
65
|
return 0;
|
|
66
|
-
if (
|
|
67
|
-
return
|
|
68
|
-
if (W >= a[
|
|
66
|
+
if (n > 1 && a[n - 1] === 1 / 0 && W >= a[n - 2])
|
|
67
|
+
return n - 1;
|
|
68
|
+
if (W >= a[n - 1])
|
|
69
69
|
return -1;
|
|
70
|
-
for (var
|
|
71
|
-
|
|
70
|
+
for (var R, i = 0, S = n - 1; S - i > 1; )
|
|
71
|
+
R = Math.floor((i + S) / 2), a[R] <= W ? i = R : S = R;
|
|
72
72
|
return S;
|
|
73
73
|
}
|
|
74
74
|
I.prototype = {
|
|
@@ -76,9 +76,9 @@ var j = { exports: {} };
|
|
|
76
76
|
this.name = W.name, this.abbrs = W.abbrs, this.untils = W.untils, this.offsets = W.offsets, this.population = W.population;
|
|
77
77
|
},
|
|
78
78
|
_index: function(W) {
|
|
79
|
-
var a = +W,
|
|
80
|
-
if (
|
|
81
|
-
return
|
|
79
|
+
var a = +W, n = this.untils, R;
|
|
80
|
+
if (R = l(a, n), R >= 0)
|
|
81
|
+
return R;
|
|
82
82
|
},
|
|
83
83
|
countries: function() {
|
|
84
84
|
var W = this.name;
|
|
@@ -87,11 +87,11 @@ var j = { exports: {} };
|
|
|
87
87
|
});
|
|
88
88
|
},
|
|
89
89
|
parse: function(W) {
|
|
90
|
-
var a = +W,
|
|
91
|
-
for (
|
|
92
|
-
if (S =
|
|
93
|
-
return
|
|
94
|
-
return
|
|
90
|
+
var a = +W, n = this.offsets, R = this.untils, i = R.length - 1, S, V, B, t;
|
|
91
|
+
for (t = 0; t < i; t++)
|
|
92
|
+
if (S = n[t], V = n[t + 1], B = n[t && t - 1], S < V && u.moveAmbiguousForward ? S = V : S > B && u.moveInvalidForward && (S = B), a < R[t] - S * 6e4)
|
|
93
|
+
return n[t];
|
|
94
|
+
return n[i];
|
|
95
95
|
},
|
|
96
96
|
abbr: function(W) {
|
|
97
97
|
return this.abbrs[this._index(W)];
|
|
@@ -107,8 +107,8 @@ var j = { exports: {} };
|
|
|
107
107
|
this.name = W, this.zones = a;
|
|
108
108
|
}
|
|
109
109
|
function G(W) {
|
|
110
|
-
var a = W.toTimeString(),
|
|
111
|
-
|
|
110
|
+
var a = W.toTimeString(), n = a.match(/\([a-z ]+\)/i);
|
|
111
|
+
n && n[0] ? (n = n[0].match(/[A-Z]/g), n = n ? n.join("") : void 0) : (n = a.match(/[A-Z]{3,5}/g), n = n ? n[0] : void 0), n === "GMT" && (n = void 0), this.at = +W, this.abbr = n, this.offset = W.getTimezoneOffset();
|
|
112
112
|
}
|
|
113
113
|
function H(W) {
|
|
114
114
|
this.zone = W, this.offsetScore = 0, this.abbrScore = 0;
|
|
@@ -117,38 +117,38 @@ var j = { exports: {} };
|
|
|
117
117
|
this.offsetScore += Math.abs(this.zone.utcOffset(W.at) - W.offset), this.zone.abbr(W.at).replace(/[^A-Z]/g, "") !== W.abbr && this.abbrScore++;
|
|
118
118
|
};
|
|
119
119
|
function Q(W, a) {
|
|
120
|
-
for (var
|
|
121
|
-
|
|
120
|
+
for (var n, R; R = ((a.at - W.at) / 12e4 | 0) * 6e4; )
|
|
121
|
+
n = new G(new Date(W.at + R)), n.offset === W.offset ? W = n : a = n;
|
|
122
122
|
return W;
|
|
123
123
|
}
|
|
124
124
|
function F() {
|
|
125
|
-
var W = (/* @__PURE__ */ new Date()).getFullYear() - 2, a = new G(new Date(W, 0, 1)),
|
|
125
|
+
var W = (/* @__PURE__ */ new Date()).getFullYear() - 2, a = new G(new Date(W, 0, 1)), n = a.offset, R = [a], i, S, V, B;
|
|
126
126
|
for (B = 1; B < 48; B++)
|
|
127
|
-
|
|
127
|
+
V = new Date(W, B, 1).getTimezoneOffset(), V !== n && (S = new G(new Date(W, B, 1)), i = Q(a, S), R.push(i), R.push(new G(new Date(i.at + 6e4))), a = S, n = V);
|
|
128
128
|
for (B = 0; B < 4; B++)
|
|
129
|
-
|
|
130
|
-
return
|
|
129
|
+
R.push(new G(new Date(W + B, 0, 1))), R.push(new G(new Date(W + B, 6, 1)));
|
|
130
|
+
return R;
|
|
131
131
|
}
|
|
132
132
|
function M0(W, a) {
|
|
133
133
|
return W.offsetScore !== a.offsetScore ? W.offsetScore - a.offsetScore : W.abbrScore !== a.abbrScore ? W.abbrScore - a.abbrScore : W.zone.population !== a.zone.population ? a.zone.population - W.zone.population : a.zone.name.localeCompare(W.zone.name);
|
|
134
134
|
}
|
|
135
135
|
function z0(W, a) {
|
|
136
|
-
var
|
|
137
|
-
for (U(a),
|
|
138
|
-
|
|
136
|
+
var n, R;
|
|
137
|
+
for (U(a), n = 0; n < a.length; n++)
|
|
138
|
+
R = a[n], c[R] = c[R] || {}, c[R][W] = !0;
|
|
139
139
|
}
|
|
140
140
|
function b0(W) {
|
|
141
|
-
var a = W.length,
|
|
141
|
+
var a = W.length, n = {}, R = [], i = {}, S, V, B, t;
|
|
142
142
|
for (S = 0; S < a; S++)
|
|
143
143
|
if (B = W[S].offset, !i.hasOwnProperty(B)) {
|
|
144
|
-
|
|
145
|
-
for (
|
|
146
|
-
|
|
144
|
+
t = c[B] || {};
|
|
145
|
+
for (V in t)
|
|
146
|
+
t.hasOwnProperty(V) && (n[V] = !0);
|
|
147
147
|
i[B] = !0;
|
|
148
148
|
}
|
|
149
|
-
for (S in
|
|
150
|
-
|
|
151
|
-
return
|
|
149
|
+
for (S in n)
|
|
150
|
+
n.hasOwnProperty(S) && R.push(b[S]);
|
|
151
|
+
return R;
|
|
152
152
|
}
|
|
153
153
|
function p0() {
|
|
154
154
|
try {
|
|
@@ -161,11 +161,11 @@ var j = { exports: {} };
|
|
|
161
161
|
}
|
|
162
162
|
} catch {
|
|
163
163
|
}
|
|
164
|
-
var
|
|
164
|
+
var n = F(), R = n.length, i = b0(n), S = [], V, B, t;
|
|
165
165
|
for (B = 0; B < i.length; B++) {
|
|
166
|
-
for (
|
|
167
|
-
|
|
168
|
-
S.push(
|
|
166
|
+
for (V = new H(g(i[B])), t = 0; t < R; t++)
|
|
167
|
+
V.scoreOffsetAt(n[t]);
|
|
168
|
+
S.push(V);
|
|
169
169
|
}
|
|
170
170
|
return S.sort(M0), S.length > 0 ? S[0].zone.name : void 0;
|
|
171
171
|
}
|
|
@@ -176,14 +176,14 @@ var j = { exports: {} };
|
|
|
176
176
|
return (W || "").toLowerCase().replace(/\//g, "_");
|
|
177
177
|
}
|
|
178
178
|
function k(W) {
|
|
179
|
-
var a,
|
|
179
|
+
var a, n, R, i;
|
|
180
180
|
for (typeof W == "string" && (W = [W]), a = 0; a < W.length; a++)
|
|
181
|
-
|
|
181
|
+
R = W[a].split("|"), n = R[0], i = K(n), p[i] = W[a], b[i] = n, z0(i, R[2].split(" "));
|
|
182
182
|
}
|
|
183
183
|
function g(W, a) {
|
|
184
184
|
W = K(W);
|
|
185
|
-
var
|
|
186
|
-
return
|
|
185
|
+
var n = p[W], R;
|
|
186
|
+
return n instanceof I ? n : typeof n == "string" ? (n = new I(n), p[W] = n, n) : O[W] && a !== g && (R = g(O[W], g)) ? (n = p[W] = new I(), n._set(R), n.name = b[W], n) : null;
|
|
187
187
|
}
|
|
188
188
|
function A0() {
|
|
189
189
|
var W, a = [];
|
|
@@ -195,17 +195,17 @@ var j = { exports: {} };
|
|
|
195
195
|
return Object.keys(A);
|
|
196
196
|
}
|
|
197
197
|
function v(W) {
|
|
198
|
-
var a,
|
|
198
|
+
var a, n, R, i;
|
|
199
199
|
for (typeof W == "string" && (W = [W]), a = 0; a < W.length; a++)
|
|
200
|
-
|
|
200
|
+
n = W[a].split("|"), R = K(n[0]), i = K(n[1]), O[R] = i, b[R] = n[0], O[i] = R, b[i] = n[1];
|
|
201
201
|
}
|
|
202
202
|
function W0(W) {
|
|
203
|
-
var a,
|
|
203
|
+
var a, n, R, i;
|
|
204
204
|
if (!(!W || !W.length))
|
|
205
205
|
for (a = 0; a < W.length; a++)
|
|
206
|
-
i = W[a].split("|"),
|
|
207
|
-
|
|
208
|
-
|
|
206
|
+
i = W[a].split("|"), n = i[0].toUpperCase(), R = i[1].split(" "), A[n] = new f(
|
|
207
|
+
n,
|
|
208
|
+
R
|
|
209
209
|
);
|
|
210
210
|
}
|
|
211
211
|
function o0(W) {
|
|
@@ -214,14 +214,14 @@ var j = { exports: {} };
|
|
|
214
214
|
function q0(W, a) {
|
|
215
215
|
if (W = o0(W), !W)
|
|
216
216
|
return null;
|
|
217
|
-
var
|
|
218
|
-
return a ?
|
|
219
|
-
var i = g(
|
|
217
|
+
var n = W.zones.sort();
|
|
218
|
+
return a ? n.map(function(R) {
|
|
219
|
+
var i = g(R);
|
|
220
220
|
return {
|
|
221
|
-
name:
|
|
221
|
+
name: R,
|
|
222
222
|
offset: i.utcOffset(/* @__PURE__ */ new Date())
|
|
223
223
|
};
|
|
224
|
-
}) :
|
|
224
|
+
}) : n;
|
|
225
225
|
}
|
|
226
226
|
function Y0(W) {
|
|
227
227
|
k(W.zones), v(W.links), W0(W.countries), u.dataVersion = W.version;
|
|
@@ -237,19 +237,19 @@ var j = { exports: {} };
|
|
|
237
237
|
typeof console < "u" && typeof console.error == "function" && console.error(W);
|
|
238
238
|
}
|
|
239
239
|
function u(W) {
|
|
240
|
-
var a = Array.prototype.slice.call(arguments, 0, -1),
|
|
241
|
-
return !M.isMoment(W) && J(
|
|
240
|
+
var a = Array.prototype.slice.call(arguments, 0, -1), n = arguments[arguments.length - 1], R = M.utc.apply(null, a), i;
|
|
241
|
+
return !M.isMoment(W) && J(R) && (i = g(n)) && R.add(i.parse(R), "minutes"), R.tz(n), R;
|
|
242
242
|
}
|
|
243
243
|
u.version = z, u.dataVersion = "", u._zones = p, u._links = O, u._names = b, u._countries = A, u.add = k, u.link = v, u.load = Y0, u.zone = g, u.zoneExists = $, u.guess = O0, u.names = A0, u.Zone = I, u.unpack = P, u.unpackBase60 = T, u.needsOffset = J, u.moveInvalidForward = !0, u.moveAmbiguousForward = !1, u.countries = c0, u.zonesForCountry = q0;
|
|
244
244
|
var m = M.fn;
|
|
245
245
|
M.tz = u, M.defaultZone = null, M.updateOffset = function(W, a) {
|
|
246
|
-
var
|
|
247
|
-
if (W._z === void 0 && (
|
|
248
|
-
if (
|
|
246
|
+
var n = M.defaultZone, R;
|
|
247
|
+
if (W._z === void 0 && (n && J(W) && !W._isUTC && W.isValid() && (W._d = M.utc(W._a)._d, W.utc().add(n.parse(W), "minutes")), W._z = n), W._z)
|
|
248
|
+
if (R = W._z.utcOffset(W), Math.abs(R) < 16 && (R = R / 60), W.utcOffset !== void 0) {
|
|
249
249
|
var i = W._z;
|
|
250
|
-
W.utcOffset(-
|
|
250
|
+
W.utcOffset(-R, a), W._z = i;
|
|
251
251
|
} else
|
|
252
|
-
W.zone(
|
|
252
|
+
W.zone(R, a);
|
|
253
253
|
}, m.tz = function(W, a) {
|
|
254
254
|
if (W) {
|
|
255
255
|
if (typeof W != "string")
|
|
@@ -281,8 +281,8 @@ var j = { exports: {} };
|
|
|
281
281
|
return Object.prototype.toString.call(h) === "[object Array]" ? (h.push("_z"), h.push("_a")) : h && (h._z = null), M;
|
|
282
282
|
});
|
|
283
283
|
})(j);
|
|
284
|
-
var
|
|
285
|
-
const
|
|
284
|
+
var n0 = j.exports;
|
|
285
|
+
const R0 = "2025a", L0 = [
|
|
286
286
|
"Africa/Abidjan|LMT GMT|g.8 0|01|-2ldXH.Q|48e5",
|
|
287
287
|
"Africa/Nairobi|LMT +0230 EAT +0245|-2r.g -2u -30 -2J|012132|-2ua2r.g N6nV.g 3Fbu h1cu dzbJ|47e5",
|
|
288
288
|
"Africa/Algiers|LMT PMT WET WEST CET CEST|-c.c -9.l 0 -10 -10 -20|01232323232323232454542423234542324|-3bQ0c.c MDA2.P cNb9.l HA0 19A0 1iM0 11c0 1oo0 Wo0 1rc0 QM0 1EM0 UM0 DA0 Imo0 rd0 De0 9Xz0 1fb0 1ap0 16K0 2yo0 mEp0 hwL0 jxA0 11A0 dDd0 17b0 11B0 1cN0 2Dy0 1cN0 1fB0 1cL0|26e5",
|
|
@@ -1129,12 +1129,12 @@ const n0 = "2025a", L0 = [
|
|
|
1129
1129
|
"ZM|Africa/Maputo Africa/Lusaka",
|
|
1130
1130
|
"ZW|Africa/Maputo Africa/Harare"
|
|
1131
1131
|
], e0 = {
|
|
1132
|
-
version:
|
|
1132
|
+
version: R0,
|
|
1133
1133
|
zones: L0,
|
|
1134
1134
|
links: T0,
|
|
1135
1135
|
countries: i0
|
|
1136
1136
|
};
|
|
1137
|
-
var N0 =
|
|
1137
|
+
var N0 = n0;
|
|
1138
1138
|
N0.tz.load(e0);
|
|
1139
1139
|
var x = { exports: {} };
|
|
1140
1140
|
(function(E) {
|
|
@@ -1153,7 +1153,7 @@ var x = { exports: {} };
|
|
|
1153
1153
|
})(x);
|
|
1154
1154
|
var S0 = x.exports;
|
|
1155
1155
|
const f0 = /* @__PURE__ */ X0(S0);
|
|
1156
|
-
class
|
|
1156
|
+
class X {
|
|
1157
1157
|
/**
|
|
1158
1158
|
* 基于输入的经度,计算出时区
|
|
1159
1159
|
* @param lng
|
|
@@ -1173,17 +1173,17 @@ class R {
|
|
|
1173
1173
|
return p = p > 9 ? p : `0${p}`, z = z > 9 ? z : `0${z}`, M > 0 ? `+${z}:${p}` : `-${z}:${p}`;
|
|
1174
1174
|
}
|
|
1175
1175
|
static lng2pretty(M, z = 6, p = "H°M′") {
|
|
1176
|
-
z = z < 6 ? 6 : z, M =
|
|
1176
|
+
z = z < 6 ? 6 : z, M = X.convertToStdLng(M, z);
|
|
1177
1177
|
let O = "E";
|
|
1178
1178
|
M < 0 && (O = "W"), M = Math.abs(M), p = p.toUpperCase();
|
|
1179
1179
|
let A = M * 3600, b, c, o, q, d, Y;
|
|
1180
|
-
b = A % 3600 % 60, p.indexOf("S") !== -1 && (A = A - b, c =
|
|
1180
|
+
b = A % 3600 % 60, p.indexOf("S") !== -1 && (A = A - b, c = X.padNumber(b, 2, 2)), o = A / 60 % 60, p.indexOf("M") !== -1 && (p.indexOf("S") !== -1 ? q = X.roundPrecision(o, z).toString().padStart(2, "0") : q = X.padNumber(o, 2, 2), A = A - o * 60), d = A / 3600, p.indexOf("M") !== -1 ? Y = X.roundPrecision(d, z).toString().padStart(3, "0") : Y = X.padNumber(d, 3, 2), Number(c) >= 60 && (q = Number(q) + 1, c = 0), Number(q) >= 60 && (Y = Number(Y) + 1, q = 0);
|
|
1181
1181
|
const L = `${p.replace(/S+/gi, c).replace(/M+/gi, q).replace(/H+/gi, Y)}${O}`;
|
|
1182
1182
|
return {
|
|
1183
1183
|
direction: O,
|
|
1184
|
-
degree:
|
|
1185
|
-
minute:
|
|
1186
|
-
second:
|
|
1184
|
+
degree: X.roundPrecision(d, z),
|
|
1185
|
+
minute: X.roundPrecision(o, z),
|
|
1186
|
+
second: X.roundPrecision(b, z),
|
|
1187
1187
|
pretty: L
|
|
1188
1188
|
};
|
|
1189
1189
|
}
|
|
@@ -1198,20 +1198,20 @@ class R {
|
|
|
1198
1198
|
let O = "N";
|
|
1199
1199
|
M < 0 && (O = "S"), M = Math.abs(M), p = p.toUpperCase();
|
|
1200
1200
|
let A = M * 3600, b, c, o, q, d, Y;
|
|
1201
|
-
b = A % 3600 % 60, p.indexOf("S") !== -1 && (A = A - b, c =
|
|
1201
|
+
b = A % 3600 % 60, p.indexOf("S") !== -1 && (A = A - b, c = X.padNumber(b, 2, 2)), o = A / 60 % 60, p.indexOf("M") !== -1 && (p.indexOf("S") !== -1 ? q = X.roundPrecision(o, z).toString().padStart(2, "0") : q = X.padNumber(o, 2, 2), A = A - o * 60), d = A / 3600, p.indexOf("M") !== -1 ? Y = X.roundPrecision(d, z).toString().padStart(2, "0") : Y = X.padNumber(d, 2, 2), Number(c) >= 60 && (q = Number(q) + 1, c = 0), Number(q) >= 60 && (Y = Number(Y) + 1, q = 0);
|
|
1202
1202
|
const L = `${p.replace(/S+/gi, c).replace(/M+/gi, q).replace(/H+/gi, Y)}${O}`;
|
|
1203
1203
|
return {
|
|
1204
1204
|
direction: O,
|
|
1205
|
-
degree:
|
|
1206
|
-
minute:
|
|
1207
|
-
second:
|
|
1205
|
+
degree: X.roundPrecision(d, z),
|
|
1206
|
+
minute: X.roundPrecision(o, z),
|
|
1207
|
+
second: X.roundPrecision(b, z),
|
|
1208
1208
|
pretty: L
|
|
1209
1209
|
};
|
|
1210
1210
|
}
|
|
1211
1211
|
static str2Lng(M, z = 6) {
|
|
1212
1212
|
let p;
|
|
1213
1213
|
if (isNaN(M)) {
|
|
1214
|
-
M =
|
|
1214
|
+
M = X.strReplace(M, "LNG");
|
|
1215
1215
|
const O = M[M.length - 1].toUpperCase();
|
|
1216
1216
|
M = M.substring(0, M.length - 1).trim();
|
|
1217
1217
|
const A = M.split(" ").filter((o) => o !== "").map((o) => Math.abs(Number(o)));
|
|
@@ -1223,12 +1223,12 @@ class R {
|
|
|
1223
1223
|
p = b + (c ?? 0) / 60, O === "W" && (p = p * -1);
|
|
1224
1224
|
} else
|
|
1225
1225
|
p = Number(M);
|
|
1226
|
-
return
|
|
1226
|
+
return X.convertToStdLng(p, z);
|
|
1227
1227
|
}
|
|
1228
1228
|
static str2Lat(M, z = 6) {
|
|
1229
1229
|
let p;
|
|
1230
1230
|
if (isNaN(M)) {
|
|
1231
|
-
M =
|
|
1231
|
+
M = X.strReplace(M, "LAT");
|
|
1232
1232
|
const O = M[M.length - 1].toUpperCase();
|
|
1233
1233
|
M = M.substring(0, M.length - 1).trim();
|
|
1234
1234
|
const A = M.split(" ").filter((o) => o !== "").map((o) => Math.abs(Number(o)));
|
|
@@ -1242,19 +1242,19 @@ class R {
|
|
|
1242
1242
|
O === "S" && (p = p * -1);
|
|
1243
1243
|
} else
|
|
1244
1244
|
p = Number(M);
|
|
1245
|
-
return
|
|
1245
|
+
return X.roundPrecision(p, z);
|
|
1246
1246
|
}
|
|
1247
1247
|
static str2LngOrLat(M, z = 6, p = "LAT") {
|
|
1248
|
-
M =
|
|
1248
|
+
M = X.strReplace(M, p);
|
|
1249
1249
|
const O = M[M.length - 1].toUpperCase();
|
|
1250
1250
|
return ["N", "S"].includes(O) ? {
|
|
1251
|
-
lat:
|
|
1251
|
+
lat: X.str2Lat(M, z)
|
|
1252
1252
|
} : {
|
|
1253
|
-
lng:
|
|
1253
|
+
lng: X.str2Lng(M, z)
|
|
1254
1254
|
};
|
|
1255
1255
|
}
|
|
1256
1256
|
static convertToStdLng(M, z = 6) {
|
|
1257
|
-
return M > 180 ? (M = M % 360, M = M > 180 ? M - 360 : M) : M < -180 && (M = M % 360, M = M < -180 ? M + 360 : M),
|
|
1257
|
+
return M > 180 ? (M = M % 360, M = M > 180 ? M - 360 : M) : M < -180 && (M = M % 360, M = M < -180 ? M + 360 : M), X.roundPrecision(M, z);
|
|
1258
1258
|
}
|
|
1259
1259
|
static roundPrecision(M, z = 4) {
|
|
1260
1260
|
if (typeof M == "number") {
|
|
@@ -1300,7 +1300,7 @@ class R {
|
|
|
1300
1300
|
* @param dcmPrecision 小数位数
|
|
1301
1301
|
*/
|
|
1302
1302
|
static padNumber(M, z = 2, p = 2) {
|
|
1303
|
-
const O =
|
|
1303
|
+
const O = X.roundPrecision(M - Math.trunc(M), p), A = O >= 1 ? Math.trunc(M + 1).toString().padStart(z, "0") : Math.trunc(M).toString().padStart(z, "0");
|
|
1304
1304
|
return O >= 1 ? A : `${A}.${Math.trunc(O * Math.pow(10, p)).toString().padStart(p, "0")}`;
|
|
1305
1305
|
}
|
|
1306
1306
|
}
|
|
@@ -1325,7 +1325,7 @@ class N {
|
|
|
1325
1325
|
[z.lng, z.lat]
|
|
1326
1326
|
]);
|
|
1327
1327
|
let b;
|
|
1328
|
-
return p ? b = e.rhumbBearing(A.features[0], A.features[1]) : b = e.bearing(A.features[0], A.features[1]), b < 0 && (b += 360),
|
|
1328
|
+
return p ? b = e.rhumbBearing(A.features[0], A.features[1]) : b = e.bearing(A.features[0], A.features[1]), b < 0 && (b += 360), X.roundPrecision(b, O);
|
|
1329
1329
|
}
|
|
1330
1330
|
/**
|
|
1331
1331
|
* 计算两点间距离
|
|
@@ -1337,13 +1337,13 @@ class N {
|
|
|
1337
1337
|
* @returns {number}
|
|
1338
1338
|
*/
|
|
1339
1339
|
static calculateDistance(M, z, p = !0, O = 4, A = "nauticalmiles") {
|
|
1340
|
-
M = { ...M }, z = { ...z }, M.lng =
|
|
1340
|
+
M = { ...M }, z = { ...z }, M.lng = X.convertToStdLng(M.lng, O), z.lng = X.convertToStdLng(z.lng, O);
|
|
1341
1341
|
const b = e.points([
|
|
1342
1342
|
[M.lng, M.lat],
|
|
1343
1343
|
[z.lng, z.lat]
|
|
1344
1344
|
]);
|
|
1345
1345
|
let c;
|
|
1346
|
-
return p ? c = e.rhumbDistance(b.features[0], b.features[1], { units: A }) : c = e.distance(b.features[0], b.features[1], { units: A }),
|
|
1346
|
+
return p ? c = e.rhumbDistance(b.features[0], b.features[1], { units: A }) : c = e.distance(b.features[0], b.features[1], { units: A }), X.roundPrecision(c, O);
|
|
1347
1347
|
}
|
|
1348
1348
|
/**
|
|
1349
1349
|
* 计算航线距离
|
|
@@ -1360,7 +1360,7 @@ class N {
|
|
|
1360
1360
|
const q = { lng: b[c + 1][0], lat: b[c + 1][1] };
|
|
1361
1361
|
O += this.calculateDistance(o, q, !0, z, p), A = q;
|
|
1362
1362
|
}
|
|
1363
|
-
return
|
|
1363
|
+
return X.roundPrecision(O, z);
|
|
1364
1364
|
}
|
|
1365
1365
|
/**
|
|
1366
1366
|
* 计算坐标(基于方位角和距离)
|
|
@@ -1375,7 +1375,7 @@ class N {
|
|
|
1375
1375
|
let c;
|
|
1376
1376
|
A ? c = e.rhumbDestination(b, p, z, { units: O }) : c = e.destination(b, p, z, { units: O });
|
|
1377
1377
|
const o = c.geometry.coordinates;
|
|
1378
|
-
return { lng:
|
|
1378
|
+
return { lng: X.convertToStdLng(o[0], 8), lat: X.roundPrecision(o[1], 8) };
|
|
1379
1379
|
}
|
|
1380
1380
|
/**
|
|
1381
1381
|
* 插值大圆坐标(基于两点方位角和间距)
|
|
@@ -1413,10 +1413,10 @@ class N {
|
|
|
1413
1413
|
const O = [];
|
|
1414
1414
|
let A, b;
|
|
1415
1415
|
for (let c = 0; c < M.length - 1; c++) {
|
|
1416
|
-
A =
|
|
1416
|
+
A = X.convertToStdLng(M[c].lng, 8), b = X.convertToStdLng(M[c + 1].lng, 8), M[c].lat = X.roundPrecision(M[c].lat, 8), M[c + 1].lat = X.roundPrecision(M[c + 1].lat, 8), p.push([A, M[c].lat]);
|
|
1417
1417
|
const o = A - b;
|
|
1418
1418
|
if (Math.abs(o) > 180) {
|
|
1419
|
-
const q =
|
|
1419
|
+
const q = X.convertToMonotonicLng2([
|
|
1420
1420
|
[A, M[c].lat],
|
|
1421
1421
|
[b, M[c + 1].lat]
|
|
1422
1422
|
]);
|
|
@@ -1429,7 +1429,7 @@ class N {
|
|
|
1429
1429
|
let T;
|
|
1430
1430
|
if (L.features.length) {
|
|
1431
1431
|
const U = e.getCoord(L.features[0]);
|
|
1432
|
-
T =
|
|
1432
|
+
T = X.roundPrecision(U[1], 8);
|
|
1433
1433
|
} else
|
|
1434
1434
|
T = M[c].lat;
|
|
1435
1435
|
o > 0 ? (p.push([180 - 1e-6, T]), O.push([...p]), p = [], p.push([-(180 - 1e-6), T])) : (p.push([-(180 - 1e-6), T]), O.push([...p]), p = [], p.push([180 - 1e-6, T]));
|
|
@@ -1463,10 +1463,10 @@ class N {
|
|
|
1463
1463
|
* @param route 航线[[[lng, lat],[lng, lat]]]
|
|
1464
1464
|
*/
|
|
1465
1465
|
static removeCoordinateFromRoute(M, z) {
|
|
1466
|
-
M.lng =
|
|
1466
|
+
M.lng = X.convertToStdLng(M.lng, 8);
|
|
1467
1467
|
for (const p of z)
|
|
1468
1468
|
for (let O = p.length - 1; O >= 0; O--)
|
|
1469
|
-
|
|
1469
|
+
X.roundPrecision(p[O][0], 8) === M.lng && X.roundPrecision(p[O][1], 8) === X.roundPrecision(M.lat, 8) && p.splice(O, 1);
|
|
1470
1470
|
return z;
|
|
1471
1471
|
}
|
|
1472
1472
|
/**
|
|
@@ -1475,9 +1475,9 @@ class N {
|
|
|
1475
1475
|
* @param waypoints [{lat, lng}, {lat, lng}]
|
|
1476
1476
|
*/
|
|
1477
1477
|
static removeCoordinateFromWaypoints(M, z) {
|
|
1478
|
-
M.lng =
|
|
1478
|
+
M.lng = X.convertToStdLng(M.lng, 8);
|
|
1479
1479
|
for (let p = z.length - 1; p >= 0; p--)
|
|
1480
|
-
|
|
1480
|
+
X.roundPrecision(z[p].lng, 8) === M.lng && X.roundPrecision(z[p].lat, 8) === X.roundPrecision(M.lat, 8) && z.splice(p, 1);
|
|
1481
1481
|
return z;
|
|
1482
1482
|
}
|
|
1483
1483
|
/**
|
|
@@ -1492,7 +1492,7 @@ class N {
|
|
|
1492
1492
|
* [[[120, 30], [120, 35], [125,40], [130, 37]], [[-150, 40], [-130, 30]]]
|
|
1493
1493
|
*/
|
|
1494
1494
|
static mergeCoordinateToRoute(M, z) {
|
|
1495
|
-
M.lng =
|
|
1495
|
+
M.lng = X.convertToStdLng(M.lng, 8);
|
|
1496
1496
|
let p = Number.MAX_VALUE, O = 0, A = 0, b, c;
|
|
1497
1497
|
return z.forEach((o, q) => {
|
|
1498
1498
|
for (let d = 0; d < o.length - 1; d++) {
|
|
@@ -1507,7 +1507,7 @@ class N {
|
|
|
1507
1507
|
* @param route
|
|
1508
1508
|
*/
|
|
1509
1509
|
static appendCoordinateToRoute(M, z) {
|
|
1510
|
-
M.lng =
|
|
1510
|
+
M.lng = X.convertToStdLng(M.lng, 8);
|
|
1511
1511
|
const p = N.convertRouteToCoordinates(z);
|
|
1512
1512
|
return p.push(M), N.divideAccordingToLng(p);
|
|
1513
1513
|
}
|
|
@@ -1546,11 +1546,11 @@ class N {
|
|
|
1546
1546
|
return;
|
|
1547
1547
|
const c = [];
|
|
1548
1548
|
for (const o of b) {
|
|
1549
|
-
if (
|
|
1549
|
+
if (X.roundPrecision(z.lng, 8) === X.roundPrecision(o[0], 8) && X.roundPrecision(z.lat, 8) === X.roundPrecision(o[1], 8)) {
|
|
1550
1550
|
c.push(o), A === 0 && c.push([M.lng, M.lat]), A = 2;
|
|
1551
1551
|
break;
|
|
1552
1552
|
}
|
|
1553
|
-
A === 1 ? c.push(o) :
|
|
1553
|
+
A === 1 ? c.push(o) : X.roundPrecision(M.lng, 8) === X.roundPrecision(o[0], 8) && X.roundPrecision(M.lat, 8) === X.roundPrecision(o[1], 8) && (A = 1, c.push(o));
|
|
1554
1554
|
}
|
|
1555
1555
|
c.length && O.push(c);
|
|
1556
1556
|
}), O;
|
|
@@ -1565,9 +1565,9 @@ class N {
|
|
|
1565
1565
|
*/
|
|
1566
1566
|
static calculateRangeWaypoints(M, z, p, O = []) {
|
|
1567
1567
|
const A = this.convertRouteToCoordinates(p, 0), b = this.mergeCoordinatesToWaypoints([M, z], A.length ? A : O), c = b.findIndex(
|
|
1568
|
-
(d) =>
|
|
1568
|
+
(d) => X.roundPrecision(M.lng, 8) === X.roundPrecision(d.lng, 8) && X.roundPrecision(M.lat, 8) === X.roundPrecision(d.lat, 8)
|
|
1569
1569
|
), o = b.findIndex(
|
|
1570
|
-
(d) =>
|
|
1570
|
+
(d) => X.roundPrecision(z.lng, 8) === X.roundPrecision(d.lng, 8) && X.roundPrecision(z.lat, 8) === X.roundPrecision(d.lat, 8)
|
|
1571
1571
|
);
|
|
1572
1572
|
return b.filter((d, Y) => Y >= c && Y <= o);
|
|
1573
1573
|
}
|
|
@@ -1595,7 +1595,7 @@ class N {
|
|
|
1595
1595
|
const p = N.convertRouteToCoordinates(z);
|
|
1596
1596
|
N.mergeCoordinateToWaypoints(M, p, !0), z = N.divideAccordingToLng(p);
|
|
1597
1597
|
const { segIndex: O, minIndex: A } = this.calculateMinDistanceToRoute({ ...M }, z);
|
|
1598
|
-
M.lng =
|
|
1598
|
+
M.lng = X.convertToStdLng(M.lng);
|
|
1599
1599
|
const b = [];
|
|
1600
1600
|
let c = !0;
|
|
1601
1601
|
for (let o = O; o < z.length; o++)
|
|
@@ -1626,7 +1626,7 @@ class N {
|
|
|
1626
1626
|
const q = this.calculatePointToLineDistance(M, c, o);
|
|
1627
1627
|
p > q && (p = q, O = b);
|
|
1628
1628
|
}
|
|
1629
|
-
M.lng =
|
|
1629
|
+
M.lng = X.convertToStdLng(M.lng);
|
|
1630
1630
|
const A = [M];
|
|
1631
1631
|
for (let b = O + 1; b < z.length; b++)
|
|
1632
1632
|
A.push(z[b]);
|
|
@@ -1640,14 +1640,14 @@ class N {
|
|
|
1640
1640
|
* @param options
|
|
1641
1641
|
*/
|
|
1642
1642
|
static calculatePointToLineDistance(M, z, p, O = { units: "nauticalmiles", method: "geodesic" }) {
|
|
1643
|
-
M.lng =
|
|
1644
|
-
const A =
|
|
1643
|
+
M.lng = X.convertToStdLng(M.lng, 8), z = { ...z }, p = { ...p }, z.lng = X.convertToStdLng(z.lng, 8), p.lng = X.convertToStdLng(p.lng, 8);
|
|
1644
|
+
const A = X.convertToMonotonicLng([z, p]);
|
|
1645
1645
|
z = A[0], p = A[1];
|
|
1646
1646
|
const b = e.lineString([
|
|
1647
1647
|
[z.lng, z.lat],
|
|
1648
1648
|
[p.lng, p.lat]
|
|
1649
1649
|
]), c = e.pointToLineDistance(e.point([M.lng, M.lat]), b, O), o = e.pointToLineDistance(e.point([M.lng > 0 ? M.lng - 360 : M.lng + 360, M.lat]), b, O);
|
|
1650
|
-
return
|
|
1650
|
+
return X.roundPrecision(Math.min(c, o), 6);
|
|
1651
1651
|
}
|
|
1652
1652
|
/**
|
|
1653
1653
|
* 计算途经点的COG, Distance等属性
|
|
@@ -1658,7 +1658,7 @@ class N {
|
|
|
1658
1658
|
z = this.mergeWaypointsToRoute(M, z);
|
|
1659
1659
|
for (let p = 0; p < M.length - 1; p++) {
|
|
1660
1660
|
const O = M[p], A = M[p + 1], b = this.calculateRangeRoute(O, A, z);
|
|
1661
|
-
p === 0 && (O.distanceFromPrevious = 0, O.distanceFromStart = 0), A.distanceFromPrevious = this.calculateRouteDistance(b), A.distanceFromStart =
|
|
1661
|
+
p === 0 && (O.distanceFromPrevious = 0, O.distanceFromStart = 0), A.distanceFromPrevious = this.calculateRouteDistance(b), A.distanceFromStart = X.roundPrecision((O.distanceFromStart || 0) + A.distanceFromPrevious);
|
|
1662
1662
|
}
|
|
1663
1663
|
return M;
|
|
1664
1664
|
}
|
|
@@ -1685,7 +1685,7 @@ class N {
|
|
|
1685
1685
|
* [{ lng: 160, lat: 30}, { lng: 170, lat: 40}, {lng: 179, lat: 50}, {lng: -170, lat: 40}, {lng: -160, lat: 30}]
|
|
1686
1686
|
*/
|
|
1687
1687
|
static mergeCoordinateToWaypoints(M, z, p = !0) {
|
|
1688
|
-
M.lng =
|
|
1688
|
+
M.lng = X.convertToStdLng(M.lng, 8);
|
|
1689
1689
|
let O = Number.MAX_VALUE, A = 0, b = 0, c = 0;
|
|
1690
1690
|
if (z.length < 2)
|
|
1691
1691
|
z.push(M);
|
|
@@ -1696,7 +1696,15 @@ class N {
|
|
|
1696
1696
|
}
|
|
1697
1697
|
b !== 0 && c !== 0 ? b < O || b === O && A === 0 ? z.unshift(M) : c < O || c === O && A === z.length - 2 ? z.push(M) : z.splice(A + 1, 0, M) : b === 0 ? p ? z.splice(A, 1, M) : z.splice(A + 1, 0, M) : c === 0 && (p ? z.splice(A + 1, 1, M) : z.splice(A + 1, 0, M));
|
|
1698
1698
|
}
|
|
1699
|
-
return z.map((o) =>
|
|
1699
|
+
return z.map((o, q) => {
|
|
1700
|
+
o.lng = X.convertToStdLng(o.lng);
|
|
1701
|
+
const d = z[q + 1];
|
|
1702
|
+
if (d && (o.bearing || (o.bearing = this.calculateBearing(o, d, !0)), o.cog = o.cog || o.bearing, !o.sog && o.positionTime && d.positionTime)) {
|
|
1703
|
+
const Y = this.calculateDistance(o, d, !0), L = Math.abs(d.positionTime - o.positionTime) / 3600;
|
|
1704
|
+
o.sog = X.roundPrecision(Y / L, 2);
|
|
1705
|
+
}
|
|
1706
|
+
return o;
|
|
1707
|
+
});
|
|
1700
1708
|
}
|
|
1701
1709
|
/**
|
|
1702
1710
|
* 生成航线(基于途经点生成大圆/横向航线,并根据是否跨180度分组)
|
|
@@ -1722,7 +1730,7 @@ class N {
|
|
|
1722
1730
|
*/
|
|
1723
1731
|
static nearestCoordinateInRoute(M, z) {
|
|
1724
1732
|
const p = e.point([M.lng, M.lat]), A = this.convertRouteToCoordinates(z).map((q) => [q.lng, q.lat]), b = e.lineString(A), c = e.nearestPointOnLine(b, p), o = e.getCoord(c);
|
|
1725
|
-
return { lng:
|
|
1733
|
+
return { lng: X.roundPrecision(o[0], 8), lat: X.roundPrecision(o[1], 8) };
|
|
1726
1734
|
}
|
|
1727
1735
|
/**
|
|
1728
1736
|
* 计算经过方向上的最后一个waypoint
|
|
@@ -1798,10 +1806,10 @@ class N {
|
|
|
1798
1806
|
* @param to {lng, lat}
|
|
1799
1807
|
*/
|
|
1800
1808
|
static nearestCoordinateInLine(M, z, p) {
|
|
1801
|
-
const O =
|
|
1809
|
+
const O = X.convertToStdLng(M.lng, 6), A = e.point([O, M.lat]), b = X.convertToStdLng(z.lng, 6), c = X.convertToStdLng(p.lng, 6), o = e.lineString([
|
|
1802
1810
|
[b, z.lat],
|
|
1803
1811
|
[c, p.lat]
|
|
1804
|
-
]), q = e.nearestPointOnLine(o, A), d = e.getCoord(q), Y =
|
|
1812
|
+
]), q = e.nearestPointOnLine(o, A), d = e.getCoord(q), Y = X.roundPrecision(d[0], 6), L = X.roundPrecision(d[1], 6);
|
|
1805
1813
|
return { lng: Y, lat: L, inline: !(Y === b && L === z.lat) && !(Y === c && L === p.lat) };
|
|
1806
1814
|
}
|
|
1807
1815
|
/**
|
|
@@ -1814,7 +1822,7 @@ class N {
|
|
|
1814
1822
|
let O, A;
|
|
1815
1823
|
return M.forEach((b) => {
|
|
1816
1824
|
b.forEach((c) => {
|
|
1817
|
-
const o = { lng:
|
|
1825
|
+
const o = { lng: X.roundPrecision(c[0], 8), lat: X.roundPrecision(c[1], 8) };
|
|
1818
1826
|
if (!A)
|
|
1819
1827
|
p.push(o), A = o;
|
|
1820
1828
|
else if (A.bearing === void 0)
|
|
@@ -1857,9 +1865,9 @@ class N {
|
|
|
1857
1865
|
let p = 0;
|
|
1858
1866
|
for (let O = 1; O < M.length; O++) {
|
|
1859
1867
|
const A = M[O - 1], b = M[O];
|
|
1860
|
-
b.gcToPrevious ? (A.bearing = this.calculateBearing(A, b, !1), b.distanceFromPrevious = this.calculateDistance(A, b, !1)) : (A.bearing = this.calculateBearing(A, b, !0), b.distanceFromPrevious = this.calculateDistance(A, b, !0)), p =
|
|
1868
|
+
b.gcToPrevious ? (A.bearing = this.calculateBearing(A, b, !1), b.distanceFromPrevious = this.calculateDistance(A, b, !1)) : (A.bearing = this.calculateBearing(A, b, !0), b.distanceFromPrevious = this.calculateDistance(A, b, !0)), p = X.roundPrecision(p + b.distanceFromPrevious), b.distanceFromStart = p;
|
|
1861
1869
|
}
|
|
1862
|
-
return M.map((O) => (O.lng =
|
|
1870
|
+
return M.map((O) => (O.lng = X.convertToStdLng(O.lng), O));
|
|
1863
1871
|
}
|
|
1864
1872
|
/**
|
|
1865
1873
|
* 计算轨迹中心点
|
|
@@ -1870,11 +1878,11 @@ class N {
|
|
|
1870
1878
|
for (const c of M)
|
|
1871
1879
|
for (const o of c)
|
|
1872
1880
|
z.push(o);
|
|
1873
|
-
const p = e.featureCollection([]), O =
|
|
1881
|
+
const p = e.featureCollection([]), O = X.convertToMonotonicLng2(z);
|
|
1874
1882
|
for (const c of O)
|
|
1875
1883
|
p.features.push(e.point(c));
|
|
1876
1884
|
const b = e.center(p).geometry.coordinates;
|
|
1877
|
-
return { lng:
|
|
1885
|
+
return { lng: X.convertToStdLng(b[0], 8), lat: X.roundPrecision(b[1], 8) };
|
|
1878
1886
|
}
|
|
1879
1887
|
/**
|
|
1880
1888
|
* 计算中心点
|
|
@@ -1893,7 +1901,7 @@ class N {
|
|
|
1893
1901
|
for (const A of M)
|
|
1894
1902
|
for (const b of A)
|
|
1895
1903
|
z.push(b);
|
|
1896
|
-
const p =
|
|
1904
|
+
const p = X.convertToMonotonicLng2(z), O = e.lineString(p);
|
|
1897
1905
|
return e.bbox(O);
|
|
1898
1906
|
}
|
|
1899
1907
|
/**
|
|
@@ -2001,7 +2009,7 @@ try {
|
|
|
2001
2009
|
} catch {
|
|
2002
2010
|
} finally {
|
|
2003
2011
|
}
|
|
2004
|
-
class
|
|
2012
|
+
class t0 {
|
|
2005
2013
|
/**
|
|
2006
2014
|
* 将原始数据转换为geojson
|
|
2007
2015
|
* @param raw
|
|
@@ -2022,7 +2030,7 @@ class V0 {
|
|
|
2022
2030
|
date: d.format(),
|
|
2023
2031
|
hour: 0,
|
|
2024
2032
|
format: d.format("MMM-DD/HHmm[Z]"),
|
|
2025
|
-
pressure: A.pressure > 1e4 ?
|
|
2033
|
+
pressure: A.pressure > 1e4 ? X.roundPrecision(A.pressure / 100, 0) : X.roundPrecision(A.pressure, 0),
|
|
2026
2034
|
wind: A == null ? void 0 : A.wind,
|
|
2027
2035
|
category: q,
|
|
2028
2036
|
type: "forecast"
|
|
@@ -2038,7 +2046,7 @@ class V0 {
|
|
|
2038
2046
|
date: L.format(),
|
|
2039
2047
|
hour: Number(d),
|
|
2040
2048
|
format: L.format("MMM-DD/HHmm[Z]"),
|
|
2041
|
-
pressure: Y.pressure > 1e4 ?
|
|
2049
|
+
pressure: Y.pressure > 1e4 ? X.roundPrecision(Y.pressure / 100, 0) : X.roundPrecision(Y.pressure, 0),
|
|
2042
2050
|
gusts: Y.gusts,
|
|
2043
2051
|
wind: Y.wind || {},
|
|
2044
2052
|
movement: Y.movement,
|
|
@@ -2048,7 +2056,7 @@ class V0 {
|
|
|
2048
2056
|
z.features.push(T), c.push(T.geometry.coordinates);
|
|
2049
2057
|
}
|
|
2050
2058
|
if ((c == null ? void 0 : c.length) > 1) {
|
|
2051
|
-
const d = e.lineString(
|
|
2059
|
+
const d = e.lineString(X.convertToMonotonicLng2(c), {
|
|
2052
2060
|
date: b.date,
|
|
2053
2061
|
id: O.id || O.name,
|
|
2054
2062
|
model: b.model,
|
|
@@ -2067,7 +2075,7 @@ class V0 {
|
|
|
2067
2075
|
name: O.name,
|
|
2068
2076
|
date: o.format(),
|
|
2069
2077
|
format: o.format("MMM-DD/HHmm[Z]"),
|
|
2070
|
-
pressure: c.pressure > 1e4 ?
|
|
2078
|
+
pressure: c.pressure > 1e4 ? X.roundPrecision(c.pressure / 100, 0) : X.roundPrecision(c.pressure, 0),
|
|
2071
2079
|
spd: c.speed || c.spd,
|
|
2072
2080
|
kts: c.kts,
|
|
2073
2081
|
source: c.source,
|
|
@@ -2080,11 +2088,11 @@ class V0 {
|
|
|
2080
2088
|
}
|
|
2081
2089
|
const b = O.history[0];
|
|
2082
2090
|
if (A.length === 1 && A.push(A[0]), A.length > 1) {
|
|
2083
|
-
const c = e.lineString(
|
|
2091
|
+
const c = e.lineString(X.convertToMonotonicLng2(A), {
|
|
2084
2092
|
name: O.name,
|
|
2085
2093
|
type: "history",
|
|
2086
2094
|
updated: b == null ? void 0 : b.updated,
|
|
2087
|
-
pressure: (b == null ? void 0 : b.pressure) > 1e4 ?
|
|
2095
|
+
pressure: (b == null ? void 0 : b.pressure) > 1e4 ? X.roundPrecision((b == null ? void 0 : b.pressure) / 100, 0) : X.roundPrecision(b == null ? void 0 : b.pressure, 0),
|
|
2088
2096
|
spd: (b == null ? void 0 : b.speed) || (b == null ? void 0 : b.spd),
|
|
2089
2097
|
kts: b == null ? void 0 : b.kts,
|
|
2090
2098
|
source: b == null ? void 0 : b.source,
|
|
@@ -2263,7 +2271,7 @@ class V0 {
|
|
|
2263
2271
|
return z;
|
|
2264
2272
|
}
|
|
2265
2273
|
}
|
|
2266
|
-
class
|
|
2274
|
+
class V0 {
|
|
2267
2275
|
static json2Str(M) {
|
|
2268
2276
|
const z = M.type ? M.type[0].toUpperCase() : "A";
|
|
2269
2277
|
return `${M.lat}|${M.lng}|${M.positionTime}|${M.sog}|${M.cog}|${M.hdg}|${M.draught}|${z}|${JSON.stringify(M.meteo || {})}|${M.vendor}|${M.deleted}`;
|
|
@@ -2333,8 +2341,8 @@ class t0 {
|
|
|
2333
2341
|
}
|
|
2334
2342
|
}
|
|
2335
2343
|
export {
|
|
2336
|
-
|
|
2344
|
+
V0 as AisHelper,
|
|
2337
2345
|
N as LaneHelper,
|
|
2338
|
-
|
|
2339
|
-
|
|
2346
|
+
X as LngLatHelper,
|
|
2347
|
+
t0 as TropicalHelper
|
|
2340
2348
|
};
|