@idm-plugin/geo 1.9.5 → 1.9.7
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 +138 -135
- package/dist/index.umd.cjs +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -24,51 +24,51 @@ var j = { exports: {} };
|
|
|
24
24
|
return o > 96 ? o - 87 : o > 64 ? o - 29 : o - 48;
|
|
25
25
|
}
|
|
26
26
|
function T(o) {
|
|
27
|
-
var
|
|
28
|
-
for (o.charCodeAt(0) === 45 && (
|
|
29
|
-
E = R(L.charCodeAt(
|
|
30
|
-
for (
|
|
31
|
-
U = U / 60, E = R(e.charCodeAt(
|
|
27
|
+
var n = 0, X = o.split("."), L = X[0], e = X[1] || "", U = 1, E, t = 0, l = 1;
|
|
28
|
+
for (o.charCodeAt(0) === 45 && (n = 1, l = -1), n; n < L.length; n++)
|
|
29
|
+
E = R(L.charCodeAt(n)), t = 60 * t + E;
|
|
30
|
+
for (n = 0; n < e.length; n++)
|
|
31
|
+
U = U / 60, E = R(e.charCodeAt(n)), t += E * U;
|
|
32
32
|
return t * l;
|
|
33
33
|
}
|
|
34
34
|
function f(o) {
|
|
35
|
-
for (var
|
|
36
|
-
o[
|
|
35
|
+
for (var n = 0; n < o.length; n++)
|
|
36
|
+
o[n] = T(o[n]);
|
|
37
37
|
}
|
|
38
|
-
function i(o,
|
|
39
|
-
for (var X = 0; X <
|
|
38
|
+
function i(o, n) {
|
|
39
|
+
for (var X = 0; X < n; X++)
|
|
40
40
|
o[X] = Math.round((o[X - 1] || 0) + o[X] * 6e4);
|
|
41
|
-
o[
|
|
41
|
+
o[n - 1] = 1 / 0;
|
|
42
42
|
}
|
|
43
|
-
function S(o,
|
|
43
|
+
function S(o, n) {
|
|
44
44
|
var X = [], L;
|
|
45
|
-
for (L = 0; L <
|
|
46
|
-
X[L] = o[
|
|
45
|
+
for (L = 0; L < n.length; L++)
|
|
46
|
+
X[L] = o[n[L]];
|
|
47
47
|
return X;
|
|
48
48
|
}
|
|
49
49
|
function s(o) {
|
|
50
|
-
var
|
|
50
|
+
var n = o.split("|"), X = n[2].split(" "), L = n[3].split(""), e = n[4].split(" ");
|
|
51
51
|
return f(X), f(L), f(e), i(e, L.length), {
|
|
52
|
-
name:
|
|
53
|
-
abbrs: S(
|
|
52
|
+
name: n[0],
|
|
53
|
+
abbrs: S(n[1].split(" "), L),
|
|
54
54
|
offsets: S(X, L),
|
|
55
55
|
untils: e,
|
|
56
|
-
population:
|
|
56
|
+
population: n[5] | 0
|
|
57
57
|
};
|
|
58
58
|
}
|
|
59
59
|
function Z(o) {
|
|
60
60
|
o && this._set(s(o));
|
|
61
61
|
}
|
|
62
|
-
function P(o,
|
|
63
|
-
var X =
|
|
64
|
-
if (o <
|
|
62
|
+
function P(o, n) {
|
|
63
|
+
var X = n.length;
|
|
64
|
+
if (o < n[0])
|
|
65
65
|
return 0;
|
|
66
|
-
if (X > 1 &&
|
|
66
|
+
if (X > 1 && n[X - 1] === 1 / 0 && o >= n[X - 2])
|
|
67
67
|
return X - 1;
|
|
68
|
-
if (o >=
|
|
68
|
+
if (o >= n[X - 1])
|
|
69
69
|
return -1;
|
|
70
70
|
for (var L, e = 0, U = X - 1; U - e > 1; )
|
|
71
|
-
L = Math.floor((e + U) / 2),
|
|
71
|
+
L = Math.floor((e + U) / 2), n[L] <= o ? e = L : U = L;
|
|
72
72
|
return U;
|
|
73
73
|
}
|
|
74
74
|
Z.prototype = {
|
|
@@ -76,20 +76,20 @@ var j = { exports: {} };
|
|
|
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
|
-
var
|
|
80
|
-
if (L = P(
|
|
79
|
+
var n = +o, X = this.untils, L;
|
|
80
|
+
if (L = P(n, X), L >= 0)
|
|
81
81
|
return L;
|
|
82
82
|
},
|
|
83
83
|
countries: function() {
|
|
84
84
|
var o = this.name;
|
|
85
|
-
return Object.keys(c).filter(function(
|
|
86
|
-
return c[
|
|
85
|
+
return Object.keys(c).filter(function(n) {
|
|
86
|
+
return c[n].zones.indexOf(o) !== -1;
|
|
87
87
|
});
|
|
88
88
|
},
|
|
89
89
|
parse: function(o) {
|
|
90
|
-
var
|
|
90
|
+
var n = +o, X = this.offsets, L = this.untils, e = L.length - 1, U, E, t, l;
|
|
91
91
|
for (l = 0; l < e; l++)
|
|
92
|
-
if (U = X[l], E = X[l + 1], t = X[l && l - 1], U < E && V.moveAmbiguousForward ? U = E : U > t && V.moveInvalidForward && (U = t),
|
|
92
|
+
if (U = X[l], E = X[l + 1], t = X[l && l - 1], U < E && V.moveAmbiguousForward ? U = E : U > t && V.moveInvalidForward && (U = t), n < L[l] - U * 6e4)
|
|
93
93
|
return X[l];
|
|
94
94
|
return X[e];
|
|
95
95
|
},
|
|
@@ -103,12 +103,12 @@ var j = { exports: {} };
|
|
|
103
103
|
return this.offsets[this._index(o)];
|
|
104
104
|
}
|
|
105
105
|
};
|
|
106
|
-
function r(o,
|
|
107
|
-
this.name = o, this.zones =
|
|
106
|
+
function r(o, n) {
|
|
107
|
+
this.name = o, this.zones = n;
|
|
108
108
|
}
|
|
109
109
|
function G(o) {
|
|
110
|
-
var
|
|
111
|
-
X && X[0] ? (X = X[0].match(/[A-Z]/g), X = X ? X.join("") : void 0) : (X =
|
|
110
|
+
var n = o.toTimeString(), X = n.match(/\([a-z ]+\)/i);
|
|
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
113
|
function h(o) {
|
|
114
114
|
this.zone = o, this.offsetScore = 0, this.abbrScore = 0;
|
|
@@ -116,30 +116,30 @@ var j = { exports: {} };
|
|
|
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
|
-
function Q(o,
|
|
120
|
-
for (var X, L; L = ((
|
|
121
|
-
X = new G(new Date(o.at + L)), X.offset === o.offset ? o = X :
|
|
119
|
+
function Q(o, n) {
|
|
120
|
+
for (var X, L; L = ((n.at - o.at) / 12e4 | 0) * 6e4; )
|
|
121
|
+
X = new G(new Date(o.at + L)), X.offset === o.offset ? o = X : n = X;
|
|
122
122
|
return o;
|
|
123
123
|
}
|
|
124
124
|
function F() {
|
|
125
|
-
var o = (/* @__PURE__ */ new Date()).getFullYear() - 2,
|
|
125
|
+
var o = (/* @__PURE__ */ new Date()).getFullYear() - 2, n = new G(new Date(o, 0, 1)), X = n.offset, L = [n], e, U, E, t;
|
|
126
126
|
for (t = 1; t < 48; t++)
|
|
127
|
-
E = new Date(o, t, 1).getTimezoneOffset(), E !== X && (U = new G(new Date(o, t, 1)), e = Q(
|
|
127
|
+
E = new Date(o, t, 1).getTimezoneOffset(), E !== X && (U = new G(new Date(o, t, 1)), e = Q(n, U), L.push(e), L.push(new G(new Date(e.at + 6e4))), n = U, X = E);
|
|
128
128
|
for (t = 0; t < 4; t++)
|
|
129
129
|
L.push(new G(new Date(o + t, 0, 1))), L.push(new G(new Date(o + t, 6, 1)));
|
|
130
130
|
return L;
|
|
131
131
|
}
|
|
132
|
-
function M0(o,
|
|
133
|
-
return o.offsetScore !==
|
|
132
|
+
function M0(o, n) {
|
|
133
|
+
return o.offsetScore !== n.offsetScore ? o.offsetScore - n.offsetScore : o.abbrScore !== n.abbrScore ? o.abbrScore - n.abbrScore : o.zone.population !== n.zone.population ? n.zone.population - o.zone.population : n.zone.name.localeCompare(o.zone.name);
|
|
134
134
|
}
|
|
135
|
-
function z0(o,
|
|
135
|
+
function z0(o, n) {
|
|
136
136
|
var X, L;
|
|
137
|
-
for (f(
|
|
138
|
-
L =
|
|
137
|
+
for (f(n), X = 0; X < n.length; X++)
|
|
138
|
+
L = n[X], A[L] = A[L] || {}, A[L][o] = !0;
|
|
139
139
|
}
|
|
140
140
|
function b0(o) {
|
|
141
|
-
var
|
|
142
|
-
for (U = 0; U <
|
|
141
|
+
var n = o.length, X = {}, L = [], e = {}, U, E, t, l;
|
|
142
|
+
for (U = 0; U < n; U++)
|
|
143
143
|
if (t = o[U].offset, !e.hasOwnProperty(t)) {
|
|
144
144
|
l = A[t] || {};
|
|
145
145
|
for (E in l)
|
|
@@ -154,9 +154,9 @@ var j = { exports: {} };
|
|
|
154
154
|
try {
|
|
155
155
|
var o = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
156
156
|
if (o && o.length > 3) {
|
|
157
|
-
var
|
|
158
|
-
if (
|
|
159
|
-
return
|
|
157
|
+
var n = O[K(o)];
|
|
158
|
+
if (n)
|
|
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 {
|
|
@@ -176,34 +176,34 @@ var j = { exports: {} };
|
|
|
176
176
|
return (o || "").toLowerCase().replace(/\//g, "_");
|
|
177
177
|
}
|
|
178
178
|
function k(o) {
|
|
179
|
-
var
|
|
180
|
-
for (typeof o == "string" && (o = [o]),
|
|
181
|
-
L = o[
|
|
179
|
+
var n, X, L, e;
|
|
180
|
+
for (typeof o == "string" && (o = [o]), n = 0; n < o.length; n++)
|
|
181
|
+
L = o[n].split("|"), X = L[0], e = K(X), b[e] = o[n], O[e] = X, z0(e, L[2].split(" "));
|
|
182
182
|
}
|
|
183
|
-
function g(o,
|
|
183
|
+
function g(o, n) {
|
|
184
184
|
o = K(o);
|
|
185
185
|
var X = b[o], L;
|
|
186
|
-
return X instanceof Z ? X : typeof X == "string" ? (X = new Z(X), b[o] = X, X) : p[o] &&
|
|
186
|
+
return X instanceof Z ? X : typeof X == "string" ? (X = new Z(X), b[o] = X, X) : p[o] && n !== g && (L = g(p[o], g)) ? (X = b[o] = new Z(), X._set(L), X.name = O[o], X) : null;
|
|
187
187
|
}
|
|
188
188
|
function A0() {
|
|
189
|
-
var o,
|
|
189
|
+
var o, n = [];
|
|
190
190
|
for (o in O)
|
|
191
|
-
O.hasOwnProperty(o) && (b[o] || b[p[o]]) && O[o] &&
|
|
192
|
-
return
|
|
191
|
+
O.hasOwnProperty(o) && (b[o] || b[p[o]]) && O[o] && n.push(O[o]);
|
|
192
|
+
return n.sort();
|
|
193
193
|
}
|
|
194
194
|
function c0() {
|
|
195
195
|
return Object.keys(c);
|
|
196
196
|
}
|
|
197
197
|
function v(o) {
|
|
198
|
-
var
|
|
199
|
-
for (typeof o == "string" && (o = [o]),
|
|
200
|
-
X = o[
|
|
198
|
+
var n, X, L, e;
|
|
199
|
+
for (typeof o == "string" && (o = [o]), n = 0; n < o.length; n++)
|
|
200
|
+
X = o[n].split("|"), L = K(X[0]), e = K(X[1]), p[L] = e, O[L] = X[0], p[e] = L, O[e] = X[1];
|
|
201
201
|
}
|
|
202
202
|
function W0(o) {
|
|
203
|
-
var
|
|
203
|
+
var n, X, L, e;
|
|
204
204
|
if (!(!o || !o.length))
|
|
205
|
-
for (
|
|
206
|
-
e = o[
|
|
205
|
+
for (n = 0; n < o.length; n++)
|
|
206
|
+
e = o[n].split("|"), X = e[0].toUpperCase(), L = e[1].split(" "), c[X] = new r(
|
|
207
207
|
X,
|
|
208
208
|
L
|
|
209
209
|
);
|
|
@@ -211,11 +211,11 @@ var j = { exports: {} };
|
|
|
211
211
|
function o0(o) {
|
|
212
212
|
return o = o.toUpperCase(), c[o] || null;
|
|
213
213
|
}
|
|
214
|
-
function q0(o,
|
|
214
|
+
function q0(o, n) {
|
|
215
215
|
if (o = o0(o), !o)
|
|
216
216
|
return null;
|
|
217
217
|
var X = o.zones.sort();
|
|
218
|
-
return
|
|
218
|
+
return n ? X.map(function(L) {
|
|
219
219
|
var e = g(L);
|
|
220
220
|
return {
|
|
221
221
|
name: L,
|
|
@@ -230,31 +230,31 @@ var j = { exports: {} };
|
|
|
230
230
|
return $.didShowError || ($.didShowError = !0, D("moment.tz.zoneExists('" + o + "') has been deprecated in favor of !moment.tz.zone('" + o + "')")), !!g(o);
|
|
231
231
|
}
|
|
232
232
|
function J(o) {
|
|
233
|
-
var
|
|
234
|
-
return !!(o._a && o._tzm === void 0 && !
|
|
233
|
+
var n = o._f === "X" || o._f === "x";
|
|
234
|
+
return !!(o._a && o._tzm === void 0 && !n);
|
|
235
235
|
}
|
|
236
236
|
function D(o) {
|
|
237
237
|
typeof console < "u" && typeof console.error == "function" && console.error(o);
|
|
238
238
|
}
|
|
239
239
|
function V(o) {
|
|
240
|
-
var
|
|
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) && J(L) && (e = g(X)) && L.add(e.parse(L), "minutes"), L.tz(X), L;
|
|
242
242
|
}
|
|
243
243
|
V.version = z, V.dataVersion = "", V._zones = b, V._links = p, V._names = O, V._countries = c, V.add = k, V.link = v, V.load = Y0, V.zone = g, V.zoneExists = $, V.guess = O0, V.names = A0, V.Zone = Z, V.unpack = s, V.unpackBase60 = T, V.needsOffset = J, V.moveInvalidForward = !0, V.moveAmbiguousForward = !1, V.countries = c0, V.zonesForCountry = q0;
|
|
244
244
|
var C = M.fn;
|
|
245
|
-
M.tz = V, M.defaultZone = null, M.updateOffset = function(o,
|
|
245
|
+
M.tz = V, M.defaultZone = null, M.updateOffset = function(o, n) {
|
|
246
246
|
var X = M.defaultZone, L;
|
|
247
247
|
if (o._z === void 0 && (X && J(o) && !o._isUTC && o.isValid() && (o._d = M.utc(o._a)._d, o.utc().add(X.parse(o), "minutes")), o._z = X), o._z)
|
|
248
248
|
if (L = o._z.utcOffset(o), Math.abs(L) < 16 && (L = L / 60), o.utcOffset !== void 0) {
|
|
249
249
|
var e = o._z;
|
|
250
|
-
o.utcOffset(-L,
|
|
250
|
+
o.utcOffset(-L, n), o._z = e;
|
|
251
251
|
} else
|
|
252
|
-
o.zone(L,
|
|
253
|
-
}, C.tz = function(o,
|
|
252
|
+
o.zone(L, n);
|
|
253
|
+
}, C.tz = function(o, n) {
|
|
254
254
|
if (o) {
|
|
255
255
|
if (typeof o != "string")
|
|
256
256
|
throw new Error("Time zone name must be a string, got " + o + " [" + typeof o + "]");
|
|
257
|
-
return this._z = g(o), this._z ? M.updateOffset(this,
|
|
257
|
+
return this._z = g(o), this._z ? M.updateOffset(this, n) : D("Moment Timezone has no data for " + o + ". See http://momentjs.com/timezone/docs/#/data-loading/."), this;
|
|
258
258
|
}
|
|
259
259
|
if (this._z)
|
|
260
260
|
return this._z.name;
|
|
@@ -1154,15 +1154,16 @@ var x = { exports: {} };
|
|
|
1154
1154
|
})(x);
|
|
1155
1155
|
var f0 = x.exports;
|
|
1156
1156
|
const S0 = /* @__PURE__ */ n0(f0);
|
|
1157
|
-
class
|
|
1157
|
+
class a {
|
|
1158
1158
|
/**
|
|
1159
1159
|
* 基于输入的经度,计算出时区
|
|
1160
1160
|
* @param lng
|
|
1161
1161
|
* @param lat
|
|
1162
1162
|
*/
|
|
1163
1163
|
static guessTimeZoneOffset(M, z) {
|
|
1164
|
+
M = a.convertToStdLng(M);
|
|
1164
1165
|
const b = S0(z, M), p = u().tz(b).utcOffset();
|
|
1165
|
-
return
|
|
1166
|
+
return a.roundPrecision(p / 60, 1);
|
|
1166
1167
|
}
|
|
1167
1168
|
/**
|
|
1168
1169
|
* 将时间offset转换为时区,例如:8.5 => +08:30
|
|
@@ -1179,17 +1180,17 @@ class n {
|
|
|
1179
1180
|
* @param format
|
|
1180
1181
|
*/
|
|
1181
1182
|
static lng2pretty(M, z = 6, b = "H°M′") {
|
|
1182
|
-
M =
|
|
1183
|
+
M = a.convertToStdLng(M, z);
|
|
1183
1184
|
let p = "E";
|
|
1184
1185
|
M < 0 && (p = "W"), M = Math.abs(M), b = b.toUpperCase();
|
|
1185
1186
|
let c = M * 3600, O, A, W, q, Y, d;
|
|
1186
|
-
O = c % 3600 % 60, b.indexOf("S") !== -1 && (c = c - O, A =
|
|
1187
|
+
O = c % 3600 % 60, b.indexOf("S") !== -1 && (c = c - O, A = a.padNumber(O, 2, 2)), W = c / 60 % 60, b.indexOf("M") !== -1 && (b.indexOf("S") !== -1 ? q = a.roundPrecision(W, z).toString().padStart(2, "0") : q = a.padNumber(W, 2, 2), c = c - W * 60), Y = c / 3600, b.indexOf("M") !== -1 ? d = a.roundPrecision(Y, z).toString().padStart(3, "0") : d = a.padNumber(Y, 3, 2), Number(A) >= 60 && (q = Number(q) + 1, A = 0), Number(q) >= 60 && (d = Number(d) + 1, q = 0);
|
|
1187
1188
|
const R = `${b.replace(/S+/gi, A).replace(/M+/gi, q).replace(/H+/gi, d)}${p}`;
|
|
1188
1189
|
return {
|
|
1189
1190
|
direction: p,
|
|
1190
|
-
degree:
|
|
1191
|
-
minute:
|
|
1192
|
-
second:
|
|
1191
|
+
degree: a.roundPrecision(Y, z),
|
|
1192
|
+
minute: a.roundPrecision(W, z),
|
|
1193
|
+
second: a.roundPrecision(O, z),
|
|
1193
1194
|
pretty: R
|
|
1194
1195
|
};
|
|
1195
1196
|
}
|
|
@@ -1204,20 +1205,20 @@ class n {
|
|
|
1204
1205
|
let p = "N";
|
|
1205
1206
|
M < 0 && (p = "S"), M = Math.abs(M), b = b.toUpperCase();
|
|
1206
1207
|
let c = M * 3600, O, A, W, q, Y, d;
|
|
1207
|
-
O = c % 3600 % 60, b.indexOf("S") !== -1 && (c = c - O, A =
|
|
1208
|
+
O = c % 3600 % 60, b.indexOf("S") !== -1 && (c = c - O, A = a.padNumber(O, 2, 2)), W = c / 60 % 60, b.indexOf("M") !== -1 && (b.indexOf("S") !== -1 ? q = a.roundPrecision(W, z).toString().padStart(2, "0") : q = a.padNumber(W, 2, 2), c = c - W * 60), Y = c / 3600, b.indexOf("M") !== -1 ? d = a.roundPrecision(Y, z).toString().padStart(2, "0") : d = a.padNumber(Y, 2, 2), Number(A) >= 60 && (q = Number(q) + 1, A = 0), Number(q) >= 60 && (d = Number(d) + 1, q = 0);
|
|
1208
1209
|
const R = `${b.replace(/S+/gi, A).replace(/M+/gi, q).replace(/H+/gi, d)}${p}`;
|
|
1209
1210
|
return {
|
|
1210
1211
|
direction: p,
|
|
1211
|
-
degree:
|
|
1212
|
-
minute:
|
|
1213
|
-
second:
|
|
1212
|
+
degree: a.roundPrecision(Y, z),
|
|
1213
|
+
minute: a.roundPrecision(W, z),
|
|
1214
|
+
second: a.roundPrecision(O, z),
|
|
1214
1215
|
pretty: R
|
|
1215
1216
|
};
|
|
1216
1217
|
}
|
|
1217
1218
|
static str2Lng(M, z = 6) {
|
|
1218
1219
|
let b;
|
|
1219
1220
|
if (isNaN(M)) {
|
|
1220
|
-
M =
|
|
1221
|
+
M = a.strReplace(M, "LNG");
|
|
1221
1222
|
const p = M[M.length - 1].toUpperCase();
|
|
1222
1223
|
M = M.substring(0, M.length - 1).trim();
|
|
1223
1224
|
const c = M.split(" ").filter((q) => q !== "").map((q) => Math.abs(Number(q)));
|
|
@@ -1229,12 +1230,12 @@ class n {
|
|
|
1229
1230
|
b = O + A / 60 + W / 3600, p === "W" && (b = b * -1);
|
|
1230
1231
|
} else
|
|
1231
1232
|
b = Number(M);
|
|
1232
|
-
return
|
|
1233
|
+
return a.convertToStdLng(b, z);
|
|
1233
1234
|
}
|
|
1234
1235
|
static str2Lat(M, z = 6) {
|
|
1235
1236
|
let b;
|
|
1236
1237
|
if (isNaN(M)) {
|
|
1237
|
-
M =
|
|
1238
|
+
M = a.strReplace(M, "LAT");
|
|
1238
1239
|
const p = M[M.length - 1].toUpperCase();
|
|
1239
1240
|
M = M.substring(0, M.length - 1).trim();
|
|
1240
1241
|
const c = M.split(" ").filter((q) => q !== "").map((q) => Math.abs(Number(q)));
|
|
@@ -1248,19 +1249,19 @@ class n {
|
|
|
1248
1249
|
p === "S" && (b = b * -1);
|
|
1249
1250
|
} else
|
|
1250
1251
|
b = Number(M);
|
|
1251
|
-
return
|
|
1252
|
+
return a.roundPrecision(b, z);
|
|
1252
1253
|
}
|
|
1253
1254
|
static str2LngOrLat(M, z = 6, b = "LAT") {
|
|
1254
|
-
M =
|
|
1255
|
+
M = a.strReplace(M, b);
|
|
1255
1256
|
const p = M[M.length - 1].toUpperCase();
|
|
1256
1257
|
return ["N", "S"].includes(p) ? {
|
|
1257
|
-
lat:
|
|
1258
|
+
lat: a.str2Lat(M, z)
|
|
1258
1259
|
} : {
|
|
1259
|
-
lng:
|
|
1260
|
+
lng: a.str2Lng(M, z)
|
|
1260
1261
|
};
|
|
1261
1262
|
}
|
|
1262
1263
|
static convertToStdLng(M, z = 6) {
|
|
1263
|
-
return M > 180 ? (M = M % 360, M = M > 180 ? M - 360 : M) : M < -180 && (M = M % 360, M = M < -180 ? M + 360 : M),
|
|
1264
|
+
return M > 180 ? (M = M % 360, M = M > 180 ? M - 360 : M) : M < -180 && (M = M % 360, M = M < -180 ? M + 360 : M), a.roundPrecision(M, z);
|
|
1264
1265
|
}
|
|
1265
1266
|
static roundPrecision(M, z = 6) {
|
|
1266
1267
|
const b = Number("1".padEnd(z + 1, "0"));
|
|
@@ -1303,7 +1304,7 @@ class n {
|
|
|
1303
1304
|
* @param dcmPrecision 小数位数
|
|
1304
1305
|
*/
|
|
1305
1306
|
static padNumber(M, z = 2, b = 2) {
|
|
1306
|
-
const p =
|
|
1307
|
+
const p = a.roundPrecision(M - Math.trunc(M), b), c = p >= 1 ? Math.trunc(M + 1).toString().padStart(z, "0") : Math.trunc(M).toString().padStart(z, "0");
|
|
1307
1308
|
return p >= 1 ? c : b > 0 ? `${c}.${Math.trunc(p * Math.pow(10, b)).toString().padStart(b, "0")}` : c;
|
|
1308
1309
|
}
|
|
1309
1310
|
}
|
|
@@ -1328,7 +1329,7 @@ class B {
|
|
|
1328
1329
|
[z.lng, z.lat]
|
|
1329
1330
|
]);
|
|
1330
1331
|
let O;
|
|
1331
|
-
return b ? O = N.rhumbBearing(c.features[0], c.features[1]) : O = N.bearing(c.features[0], c.features[1]), O < 0 && (O += 360),
|
|
1332
|
+
return b ? O = N.rhumbBearing(c.features[0], c.features[1]) : O = N.bearing(c.features[0], c.features[1]), O < 0 && (O += 360), a.roundPrecision(O, p);
|
|
1332
1333
|
}
|
|
1333
1334
|
/**
|
|
1334
1335
|
* 计算两点间距离
|
|
@@ -1340,13 +1341,13 @@ class B {
|
|
|
1340
1341
|
* @returns {number}
|
|
1341
1342
|
*/
|
|
1342
1343
|
static calculateDistance(M, z, b = !0, p = 4, c = "nauticalmiles") {
|
|
1343
|
-
M = { ...M }, z = { ...z }, M.lng =
|
|
1344
|
+
M = { ...M }, z = { ...z }, M.lng = a.convertToStdLng(M.lng, p), z.lng = a.convertToStdLng(z.lng, p);
|
|
1344
1345
|
const O = N.points([
|
|
1345
1346
|
[M.lng, M.lat],
|
|
1346
1347
|
[z.lng, z.lat]
|
|
1347
1348
|
]);
|
|
1348
1349
|
let A;
|
|
1349
|
-
return b ? A = N.rhumbDistance(O.features[0], O.features[1], { units: c }) : A = N.distance(O.features[0], O.features[1], { units: c }),
|
|
1350
|
+
return b ? A = N.rhumbDistance(O.features[0], O.features[1], { units: c }) : A = N.distance(O.features[0], O.features[1], { units: c }), a.roundPrecision(A, p);
|
|
1350
1351
|
}
|
|
1351
1352
|
/**
|
|
1352
1353
|
* 计算航线距离
|
|
@@ -1363,7 +1364,7 @@ class B {
|
|
|
1363
1364
|
const q = { lng: O[A + 1][0], lat: O[A + 1][1] };
|
|
1364
1365
|
p += this.calculateDistance(W, q, !0, z, b), c = q;
|
|
1365
1366
|
}
|
|
1366
|
-
return
|
|
1367
|
+
return a.roundPrecision(p, z);
|
|
1367
1368
|
}
|
|
1368
1369
|
/**
|
|
1369
1370
|
* 计算坐标(基于方位角和距离)
|
|
@@ -1378,7 +1379,7 @@ class B {
|
|
|
1378
1379
|
let A;
|
|
1379
1380
|
c ? A = N.rhumbDestination(O, b, z, { units: p }) : A = N.destination(O, b, z, { units: p });
|
|
1380
1381
|
const W = A.geometry.coordinates;
|
|
1381
|
-
return { lng:
|
|
1382
|
+
return { lng: a.convertToStdLng(W[0], 8), lat: a.roundPrecision(W[1], 8) };
|
|
1382
1383
|
}
|
|
1383
1384
|
/**
|
|
1384
1385
|
* 插值大圆坐标(基于两点方位角和间距)
|
|
@@ -1417,10 +1418,10 @@ class B {
|
|
|
1417
1418
|
const c = [];
|
|
1418
1419
|
let O, A;
|
|
1419
1420
|
for (let W = 0; W < M.length - 1; W++) {
|
|
1420
|
-
O =
|
|
1421
|
+
O = a.convertToStdLng(M[W].lng, 8), A = a.convertToStdLng(M[W + 1].lng, 8), M[W].lat = a.roundPrecision(M[W].lat, 8), M[W + 1].lat = a.roundPrecision(M[W + 1].lat, 8), p.push([O, M[W].lat]);
|
|
1421
1422
|
const q = O - A;
|
|
1422
1423
|
if (Math.abs(q) > 180) {
|
|
1423
|
-
const Y =
|
|
1424
|
+
const Y = a.convertToMonotonicLng2([
|
|
1424
1425
|
[O, M[W].lat],
|
|
1425
1426
|
[A, M[W + 1].lat]
|
|
1426
1427
|
]);
|
|
@@ -1433,7 +1434,7 @@ class B {
|
|
|
1433
1434
|
let f;
|
|
1434
1435
|
if (T.features.length) {
|
|
1435
1436
|
const i = N.getCoord(T.features[0]);
|
|
1436
|
-
f =
|
|
1437
|
+
f = a.roundPrecision(i[1], 8);
|
|
1437
1438
|
} else
|
|
1438
1439
|
f = M[W].lat;
|
|
1439
1440
|
q > 0 ? (p.push([180 - 1e-6, f]), c.push([...p]), p = [], p.push([-(180 - 1e-6), f])) : (p.push([-(180 - 1e-6), f]), c.push([...p]), p = [], p.push([180 - 1e-6, f]));
|
|
@@ -1467,10 +1468,10 @@ class B {
|
|
|
1467
1468
|
* @param route 航线[[[lng, lat],[lng, lat]]]
|
|
1468
1469
|
*/
|
|
1469
1470
|
static removeCoordinateFromRoute(M, z) {
|
|
1470
|
-
M.lng =
|
|
1471
|
+
M.lng = a.convertToStdLng(M.lng, 8);
|
|
1471
1472
|
for (const b of z)
|
|
1472
1473
|
for (let p = b.length - 1; p >= 0; p--)
|
|
1473
|
-
|
|
1474
|
+
a.roundPrecision(b[p][0], 8) === M.lng && a.roundPrecision(b[p][1], 8) === a.roundPrecision(M.lat, 8) && b.splice(p, 1);
|
|
1474
1475
|
return z;
|
|
1475
1476
|
}
|
|
1476
1477
|
/**
|
|
@@ -1479,9 +1480,9 @@ class B {
|
|
|
1479
1480
|
* @param waypoints [{lat, lng}, {lat, lng}]
|
|
1480
1481
|
*/
|
|
1481
1482
|
static removeCoordinateFromWaypoints(M, z) {
|
|
1482
|
-
M.lng =
|
|
1483
|
+
M.lng = a.convertToStdLng(M.lng, 8);
|
|
1483
1484
|
for (let b = z.length - 1; b >= 0; b--)
|
|
1484
|
-
|
|
1485
|
+
a.roundPrecision(z[b].lng, 8) === M.lng && a.roundPrecision(z[b].lat, 8) === a.roundPrecision(M.lat, 8) && z.splice(b, 1);
|
|
1485
1486
|
return z;
|
|
1486
1487
|
}
|
|
1487
1488
|
/**
|
|
@@ -1496,7 +1497,7 @@ class B {
|
|
|
1496
1497
|
* [[[120, 30], [120, 35], [125,40], [130, 37]], [[-150, 40], [-130, 30]]]
|
|
1497
1498
|
*/
|
|
1498
1499
|
static mergeCoordinateToRoute(M, z) {
|
|
1499
|
-
M.lng =
|
|
1500
|
+
M.lng = a.convertToStdLng(M.lng, 8);
|
|
1500
1501
|
let b = Number.MAX_VALUE, p = 0, c = 0, O, A;
|
|
1501
1502
|
return z.forEach((W, q) => {
|
|
1502
1503
|
for (let Y = 0; Y < W.length - 1; Y++) {
|
|
@@ -1511,7 +1512,7 @@ class B {
|
|
|
1511
1512
|
* @param route
|
|
1512
1513
|
*/
|
|
1513
1514
|
static appendCoordinateToRoute(M, z) {
|
|
1514
|
-
M.lng =
|
|
1515
|
+
M.lng = a.convertToStdLng(M.lng, 8);
|
|
1515
1516
|
const b = B.convertRouteToCoordinates(z);
|
|
1516
1517
|
return b.push(M), B.divideAccordingToLng(b);
|
|
1517
1518
|
}
|
|
@@ -1550,11 +1551,11 @@ class B {
|
|
|
1550
1551
|
return;
|
|
1551
1552
|
const A = [];
|
|
1552
1553
|
for (const W of O) {
|
|
1553
|
-
if (
|
|
1554
|
+
if (a.roundPrecision(z.lng, 8) === a.roundPrecision(W[0], 8) && a.roundPrecision(z.lat, 8) === a.roundPrecision(W[1], 8)) {
|
|
1554
1555
|
A.push(W), c === 0 && A.push([M.lng, M.lat]), c = 2;
|
|
1555
1556
|
break;
|
|
1556
1557
|
}
|
|
1557
|
-
c === 1 ? A.push(W) :
|
|
1558
|
+
c === 1 ? A.push(W) : a.roundPrecision(M.lng, 8) === a.roundPrecision(W[0], 8) && a.roundPrecision(M.lat, 8) === a.roundPrecision(W[1], 8) && (c = 1, A.push(W));
|
|
1558
1559
|
}
|
|
1559
1560
|
A.length && p.push(A);
|
|
1560
1561
|
}), p;
|
|
@@ -1569,9 +1570,9 @@ class B {
|
|
|
1569
1570
|
*/
|
|
1570
1571
|
static calculateRangeWaypoints(M, z, b, p = []) {
|
|
1571
1572
|
const c = this.convertRouteToCoordinates(b, 0), O = this.mergeCoordinatesToWaypoints([M, z], c.length ? c : p), A = O.findIndex(
|
|
1572
|
-
(Y) =>
|
|
1573
|
+
(Y) => a.roundPrecision(M.lng, 8) === a.roundPrecision(Y.lng, 8) && a.roundPrecision(M.lat, 8) === a.roundPrecision(Y.lat, 8)
|
|
1573
1574
|
), W = O.findIndex(
|
|
1574
|
-
(Y) =>
|
|
1575
|
+
(Y) => a.roundPrecision(z.lng, 8) === a.roundPrecision(Y.lng, 8) && a.roundPrecision(z.lat, 8) === a.roundPrecision(Y.lat, 8)
|
|
1575
1576
|
);
|
|
1576
1577
|
return O.filter((Y, d) => d >= A && d <= W);
|
|
1577
1578
|
}
|
|
@@ -1599,7 +1600,7 @@ class B {
|
|
|
1599
1600
|
const b = B.convertRouteToCoordinates(z);
|
|
1600
1601
|
B.mergeCoordinateToWaypoints(M, b, !0), z = B.divideAccordingToLng(b);
|
|
1601
1602
|
const { segIndex: p, minIndex: c } = this.calculateMinDistanceToRoute({ ...M }, z);
|
|
1602
|
-
M.lng =
|
|
1603
|
+
M.lng = a.convertToStdLng(M.lng);
|
|
1603
1604
|
const O = [];
|
|
1604
1605
|
let A = !0;
|
|
1605
1606
|
for (let W = p; W < z.length; W++)
|
|
@@ -1630,7 +1631,7 @@ class B {
|
|
|
1630
1631
|
const q = this.calculatePointToLineDistance(M, A, W);
|
|
1631
1632
|
b > q && (b = q, p = O);
|
|
1632
1633
|
}
|
|
1633
|
-
M.lng =
|
|
1634
|
+
M.lng = a.convertToStdLng(M.lng);
|
|
1634
1635
|
const c = [M];
|
|
1635
1636
|
for (let O = p + 1; O < z.length; O++)
|
|
1636
1637
|
c.push(z[O]);
|
|
@@ -1644,14 +1645,14 @@ class B {
|
|
|
1644
1645
|
* @param options
|
|
1645
1646
|
*/
|
|
1646
1647
|
static calculatePointToLineDistance(M, z, b, p = { units: "nauticalmiles", method: "geodesic" }) {
|
|
1647
|
-
M.lng =
|
|
1648
|
-
const c =
|
|
1648
|
+
M.lng = a.convertToStdLng(M.lng, 8), z = { ...z }, b = { ...b }, z.lng = a.convertToStdLng(z.lng, 8), b.lng = a.convertToStdLng(b.lng, 8);
|
|
1649
|
+
const c = a.convertToMonotonicLng([z, b]);
|
|
1649
1650
|
z = c[0], b = c[1];
|
|
1650
1651
|
const O = N.lineString([
|
|
1651
1652
|
[z.lng, z.lat],
|
|
1652
1653
|
[b.lng, b.lat]
|
|
1653
1654
|
]), A = N.pointToLineDistance(N.point([M.lng, M.lat]), O, p), W = N.pointToLineDistance(N.point([M.lng > 0 ? M.lng - 360 : M.lng + 360, M.lat]), O, p);
|
|
1654
|
-
return
|
|
1655
|
+
return a.roundPrecision(Math.min(A, W), 6);
|
|
1655
1656
|
}
|
|
1656
1657
|
/**
|
|
1657
1658
|
* 计算途经点的COG, Distance等属性
|
|
@@ -1662,7 +1663,7 @@ class B {
|
|
|
1662
1663
|
z = this.mergeWaypointsToRoute(M, z);
|
|
1663
1664
|
for (let b = 0; b < M.length - 1; b++) {
|
|
1664
1665
|
const p = M[b], c = M[b + 1], O = this.calculateRangeRoute(p, c, z);
|
|
1665
|
-
b === 0 && (p.distanceFromPrevious = 0, p.distanceFromStart = 0), c.distanceFromPrevious = this.calculateRouteDistance(O), c.distanceFromStart =
|
|
1666
|
+
b === 0 && (p.distanceFromPrevious = 0, p.distanceFromStart = 0), c.distanceFromPrevious = this.calculateRouteDistance(O), c.distanceFromStart = a.roundPrecision((p.distanceFromStart || 0) + c.distanceFromPrevious);
|
|
1666
1667
|
}
|
|
1667
1668
|
return M;
|
|
1668
1669
|
}
|
|
@@ -1689,7 +1690,7 @@ class B {
|
|
|
1689
1690
|
* [{ lng: 160, lat: 30}, { lng: 170, lat: 40}, {lng: 179, lat: 50}, {lng: -170, lat: 40}, {lng: -160, lat: 30}]
|
|
1690
1691
|
*/
|
|
1691
1692
|
static mergeCoordinateToWaypoints(M, z, b = !0) {
|
|
1692
|
-
M.lng =
|
|
1693
|
+
M.lng = a.convertToStdLng(M.lng, 8);
|
|
1693
1694
|
let p = Number.MAX_VALUE, c = 0, O = 0, A = 0;
|
|
1694
1695
|
if (z.length < 2)
|
|
1695
1696
|
z.push(M);
|
|
@@ -1701,11 +1702,11 @@ class B {
|
|
|
1701
1702
|
O !== 0 && A !== 0 ? O <= p && c === 0 ? z.unshift(M) : A <= p && c === z.length - 2 ? z.push(M) : z.splice(c + 1, 0, M) : O === 0 ? b ? z.splice(c, 1, M) : z.splice(c + 1, 0, M) : A === 0 && (b ? z.splice(c + 1, 1, M) : z.splice(c + 1, 0, M));
|
|
1702
1703
|
}
|
|
1703
1704
|
return z.map((W, q) => {
|
|
1704
|
-
W.lng =
|
|
1705
|
+
W.lng = a.convertToStdLng(W.lng);
|
|
1705
1706
|
const Y = z[q + 1];
|
|
1706
1707
|
if (Y && (W.bearing || ((W.positionTime || 0) > (Y.positionTime || 0) ? W.bearing = this.calculateBearing(Y, W, !0) : W.bearing = this.calculateBearing(W, Y, !0)), W.cog = W.cog || W.bearing, !W.sog && W.positionTime && Y.positionTime)) {
|
|
1707
1708
|
const d = this.calculateDistance(W, Y, !0), R = Math.abs(Y.positionTime - W.positionTime) / 3600;
|
|
1708
|
-
W.sog =
|
|
1709
|
+
W.sog = a.roundPrecision(d / R, 2);
|
|
1709
1710
|
}
|
|
1710
1711
|
return W;
|
|
1711
1712
|
});
|
|
@@ -1736,7 +1737,7 @@ class B {
|
|
|
1736
1737
|
*/
|
|
1737
1738
|
static nearestCoordinateInRoute(M, z) {
|
|
1738
1739
|
const b = N.point([M.lng, M.lat]), c = this.convertRouteToCoordinates(z).map((q) => [q.lng, q.lat]), O = N.lineString(c), A = N.nearestPointOnLine(O, b), W = N.getCoord(A);
|
|
1739
|
-
return { lng:
|
|
1740
|
+
return { lng: a.roundPrecision(W[0], 8), lat: a.roundPrecision(W[1], 8) };
|
|
1740
1741
|
}
|
|
1741
1742
|
/**
|
|
1742
1743
|
* 计算经过方向上的最后一个waypoint
|
|
@@ -1812,10 +1813,10 @@ class B {
|
|
|
1812
1813
|
* @param to {lng, lat}
|
|
1813
1814
|
*/
|
|
1814
1815
|
static nearestCoordinateInLine(M, z, b) {
|
|
1815
|
-
const p =
|
|
1816
|
+
const p = a.convertToStdLng(M.lng, 6), c = N.point([p, M.lat]), O = a.convertToStdLng(z.lng, 6), A = a.convertToStdLng(b.lng, 6), W = N.lineString([
|
|
1816
1817
|
[O, z.lat],
|
|
1817
1818
|
[A, b.lat]
|
|
1818
|
-
]), q = N.nearestPointOnLine(W, c), Y = N.getCoord(q), d =
|
|
1819
|
+
]), q = N.nearestPointOnLine(W, c), Y = N.getCoord(q), d = a.roundPrecision(Y[0], 6), R = a.roundPrecision(Y[1], 6);
|
|
1819
1820
|
return { lng: d, lat: R, inline: !(d === O && R === z.lat) && !(d === A && R === b.lat) };
|
|
1820
1821
|
}
|
|
1821
1822
|
/**
|
|
@@ -1828,7 +1829,7 @@ class B {
|
|
|
1828
1829
|
let p, c;
|
|
1829
1830
|
return M.forEach((O) => {
|
|
1830
1831
|
O.forEach((A) => {
|
|
1831
|
-
const W = { lng:
|
|
1832
|
+
const W = { lng: a.roundPrecision(A[0], 8), lat: a.roundPrecision(A[1], 8) };
|
|
1832
1833
|
if (!c)
|
|
1833
1834
|
b.push(W), c = W;
|
|
1834
1835
|
else if (c.bearing === void 0)
|
|
@@ -1871,9 +1872,9 @@ class B {
|
|
|
1871
1872
|
let b = 0;
|
|
1872
1873
|
for (let p = 1; p < M.length; p++) {
|
|
1873
1874
|
const c = M[p - 1], O = M[p];
|
|
1874
|
-
O.gcToPrevious ? (c.bearing = this.calculateBearing(c, O, !1), O.distanceFromPrevious = this.calculateDistance(c, O, !1)) : (c.bearing = this.calculateBearing(c, O, !0), O.distanceFromPrevious = this.calculateDistance(c, O, !0)), b =
|
|
1875
|
+
O.gcToPrevious ? (c.bearing = this.calculateBearing(c, O, !1), O.distanceFromPrevious = this.calculateDistance(c, O, !1)) : (c.bearing = this.calculateBearing(c, O, !0), O.distanceFromPrevious = this.calculateDistance(c, O, !0)), b = a.roundPrecision(b + O.distanceFromPrevious), O.distanceFromStart = b;
|
|
1875
1876
|
}
|
|
1876
|
-
return M.map((p) => (p.lng =
|
|
1877
|
+
return M.map((p) => (p.lng = a.convertToStdLng(p.lng), p));
|
|
1877
1878
|
}
|
|
1878
1879
|
/**
|
|
1879
1880
|
* 计算轨迹中心点
|
|
@@ -1884,11 +1885,11 @@ class B {
|
|
|
1884
1885
|
for (const A of M)
|
|
1885
1886
|
for (const W of A)
|
|
1886
1887
|
z.push(W);
|
|
1887
|
-
const b = N.featureCollection([]), p =
|
|
1888
|
+
const b = N.featureCollection([]), p = a.convertToMonotonicLng2(z);
|
|
1888
1889
|
for (const A of p)
|
|
1889
1890
|
b.features.push(N.point(A));
|
|
1890
1891
|
const O = N.center(b).geometry.coordinates;
|
|
1891
|
-
return { lng:
|
|
1892
|
+
return { lng: a.convertToStdLng(O[0], 8), lat: a.roundPrecision(O[1], 8) };
|
|
1892
1893
|
}
|
|
1893
1894
|
/**
|
|
1894
1895
|
* 计算中心点
|
|
@@ -1907,7 +1908,7 @@ class B {
|
|
|
1907
1908
|
for (const c of M)
|
|
1908
1909
|
for (const O of c)
|
|
1909
1910
|
z.push(O);
|
|
1910
|
-
const b =
|
|
1911
|
+
const b = a.convertToMonotonicLng2(z), p = N.lineString(b);
|
|
1911
1912
|
return N.bbox(p);
|
|
1912
1913
|
}
|
|
1913
1914
|
/**
|
|
@@ -2150,7 +2151,7 @@ class t0 {
|
|
|
2150
2151
|
date: s.format(),
|
|
2151
2152
|
hour: Number(i),
|
|
2152
2153
|
format: s.format("MMM-DD/HHmm[Z]"),
|
|
2153
|
-
pressure: S.pressure > 1e4 ?
|
|
2154
|
+
pressure: S.pressure > 1e4 ? a.roundPrecision(S.pressure / 100, 0) : a.roundPrecision(S.pressure, 0),
|
|
2154
2155
|
gusts: S.gusts,
|
|
2155
2156
|
wind: S.wind || {},
|
|
2156
2157
|
movement: S.movement,
|
|
@@ -2172,10 +2173,11 @@ class t0 {
|
|
|
2172
2173
|
const S = N.point([A.lng, A.lat], {
|
|
2173
2174
|
model: W.model,
|
|
2174
2175
|
name: O.name,
|
|
2176
|
+
nameCn: O.nameCn,
|
|
2175
2177
|
date: i.format(),
|
|
2176
2178
|
hour: 0,
|
|
2177
2179
|
format: i.format("MMM-DD/HHmm[Z]"),
|
|
2178
|
-
pressure: A.pressure > 1e4 ?
|
|
2180
|
+
pressure: A.pressure > 1e4 ? a.roundPrecision((A == null ? void 0 : A.pressure) / 100, 0) : a.roundPrecision(A.pressure, 0),
|
|
2179
2181
|
wind: A.wind,
|
|
2180
2182
|
movement: f,
|
|
2181
2183
|
category: T,
|
|
@@ -2186,7 +2188,7 @@ class t0 {
|
|
|
2186
2188
|
d.unshift(S), Y.unshift(S.geometry.coordinates);
|
|
2187
2189
|
}
|
|
2188
2190
|
if (z.features.push(...d), (Y == null ? void 0 : Y.length) > 1) {
|
|
2189
|
-
const i = N.lineString(
|
|
2191
|
+
const i = N.lineString(a.convertToMonotonicLng2(Y), {
|
|
2190
2192
|
date: (A == null ? void 0 : A.updated) || (R == null ? void 0 : R.format()),
|
|
2191
2193
|
id: O.id || O.name,
|
|
2192
2194
|
model: W.model,
|
|
@@ -2206,9 +2208,10 @@ class t0 {
|
|
|
2206
2208
|
f && q.add(-d, "h");
|
|
2207
2209
|
const i = N.point([R.lng, R.lat], {
|
|
2208
2210
|
name: O.name,
|
|
2211
|
+
nameCn: O.nameCn,
|
|
2209
2212
|
date: T.format(),
|
|
2210
2213
|
format: T.format("MMM-DD/HHmm[Z]"),
|
|
2211
|
-
pressure: R.pressure > 1e4 ?
|
|
2214
|
+
pressure: R.pressure > 1e4 ? a.roundPrecision(R.pressure / 100, 0) : a.roundPrecision(R.pressure, 0),
|
|
2212
2215
|
kts: R.kts,
|
|
2213
2216
|
level: R.type,
|
|
2214
2217
|
type: "history",
|
|
@@ -2220,11 +2223,11 @@ class t0 {
|
|
|
2220
2223
|
z.features.push(i), W.push(i.geometry.coordinates);
|
|
2221
2224
|
}
|
|
2222
2225
|
if (W.length === 1 && W.push(W[0]), W.length > 1) {
|
|
2223
|
-
const R = N.lineString(
|
|
2226
|
+
const R = N.lineString(a.convertToMonotonicLng2(W), {
|
|
2224
2227
|
name: O.name,
|
|
2225
2228
|
type: "history",
|
|
2226
2229
|
updated: A == null ? void 0 : A.updated,
|
|
2227
|
-
pressure: (A == null ? void 0 : A.pressure) > 1e4 ?
|
|
2230
|
+
pressure: (A == null ? void 0 : A.pressure) > 1e4 ? a.roundPrecision((A == null ? void 0 : A.pressure) / 100, 0) : a.roundPrecision(A == null ? void 0 : A.pressure, 0),
|
|
2228
2231
|
kts: A == null ? void 0 : A.kts,
|
|
2229
2232
|
level: A == null ? void 0 : A.type
|
|
2230
2233
|
});
|
|
@@ -2473,6 +2476,6 @@ class V0 {
|
|
|
2473
2476
|
export {
|
|
2474
2477
|
V0 as AisHelper,
|
|
2475
2478
|
B as LaneHelper,
|
|
2476
|
-
|
|
2479
|
+
a as LngLatHelper,
|
|
2477
2480
|
t0 as TropicalHelper
|
|
2478
2481
|
};
|