@3clear/basegis 0.1.4 → 0.1.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/README.md +1700 -642
- package/dist/WindDataGrid-B1KZflZc.js +438 -0
- package/dist/assets.js +6 -2
- package/dist/basegis.js +6421 -3070
- package/dist/basemap.config-Bs1PwVYt.js +176 -0
- package/dist/html2canvas.esm-dgT_1dIT.js +4871 -0
- package/dist/layers.js +78 -69
- package/dist/methods.js +1988 -1503
- package/dist/{pointLarge-Ct8TsOPW.js → pointLarge-CNhpMZoP.js} +54 -58
- package/dist/style.css +1 -1
- package/dist/typhoon-path-BAiUgsJf.js +4 -0
- package/package.json +3 -2
- package/dist/WindDataGrid-AGJaASUG.js +0 -96
|
@@ -0,0 +1,438 @@
|
|
|
1
|
+
const S = {
|
|
2
|
+
OK: "OK",
|
|
3
|
+
CANCELLED: "CANCELLED",
|
|
4
|
+
FAILED: "FAILED",
|
|
5
|
+
NOT_INITIALIZED: "NOT_INITIALIZED",
|
|
6
|
+
INVALID_CONTAINER: "INVALID_CONTAINER",
|
|
7
|
+
ENGINE_NOT_REGISTERED: "ENGINE_NOT_REGISTERED",
|
|
8
|
+
ENGINE_RESOURCE_MISSING: "ENGINE_RESOURCE_MISSING",
|
|
9
|
+
METHOD_NOT_FOUND: "METHOD_NOT_FOUND",
|
|
10
|
+
UNSUPPORTED_CAPABILITY: "UNSUPPORTED_CAPABILITY",
|
|
11
|
+
INVALID_DEM: "INVALID_DEM"
|
|
12
|
+
};
|
|
13
|
+
function v({
|
|
14
|
+
success: t = !0,
|
|
15
|
+
message: n = "",
|
|
16
|
+
data: e = null,
|
|
17
|
+
code: i = S.OK
|
|
18
|
+
} = {}) {
|
|
19
|
+
return { success: t, message: n, data: e, code: i };
|
|
20
|
+
}
|
|
21
|
+
function q(t = null, n = "OK", e = S.OK) {
|
|
22
|
+
return v({ success: !0, message: n, data: t, code: e });
|
|
23
|
+
}
|
|
24
|
+
function z(t = "Operation failed.", n = S.FAILED, e = null) {
|
|
25
|
+
return v({ success: !1, message: t, data: e, code: n });
|
|
26
|
+
}
|
|
27
|
+
function H(t, n, e = "") {
|
|
28
|
+
const i = `${n} adapter does not support "${t}". ${e}`.trim();
|
|
29
|
+
return console.warn(`[3clear-dt-base] ${i}`), z(i, S.UNSUPPORTED_CAPABILITY, {
|
|
30
|
+
methodName: t,
|
|
31
|
+
engineType: n,
|
|
32
|
+
detail: e
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
function Z(t, n = {}) {
|
|
36
|
+
var i, o, s, r, l;
|
|
37
|
+
if (n.currentTime !== void 0 && n.currentTime !== null && !Number.isFinite(n.currentTime))
|
|
38
|
+
return "currentTime must be a finite timestamp in milliseconds or null.";
|
|
39
|
+
if (t.times !== void 0) {
|
|
40
|
+
if (!t.colors || !Array.isArray(t.times) || t.times.length !== ((i = t.positions) == null ? void 0 : i.length))
|
|
41
|
+
return "line.times requires vertex colors and one timestamp for each position.";
|
|
42
|
+
for (let a = 0; a < t.times.length; a += 1)
|
|
43
|
+
if (!Number.isFinite(t.times[a]) || a > 0 && t.times[a] <= t.times[a - 1])
|
|
44
|
+
return "line.times must contain strictly increasing finite timestamps in milliseconds.";
|
|
45
|
+
}
|
|
46
|
+
if (t.colors === void 0) return "";
|
|
47
|
+
if (!Array.isArray(t.colors) || t.colors.length !== ((o = t.positions) == null ? void 0 : o.length))
|
|
48
|
+
return "line.colors must have one color for each position.";
|
|
49
|
+
if (t.colors.some((a) => typeof a != "string" || !/^#[0-9a-f]{6}$/i.test(a)))
|
|
50
|
+
return "line.colors requires six-digit HEX colors.";
|
|
51
|
+
const e = { ...n.style, ...t.style };
|
|
52
|
+
return e.pattern === "dashed" || (r = (s = e.color) == null ? void 0 : s.flow) != null && r.enabled ? "Vertex colors support solid lines only." : (e.clampToGround ?? n.clampToGround) === !0 ? "Vertex colors do not support clampToGround; use false for the thematic overlay." : (l = n.animation) != null && l.enabled && (!n.animation.lineId || String(n.animation.lineId) === String(t.id)) ? "Vertex-colored lines do not support reveal animation." : "";
|
|
53
|
+
}
|
|
54
|
+
const B = {
|
|
55
|
+
TD: "#e6d64f",
|
|
56
|
+
TS: "#2f8df4",
|
|
57
|
+
STS: "#28a46a",
|
|
58
|
+
TY: "#f59e0b",
|
|
59
|
+
STY: "#d946ef",
|
|
60
|
+
SuperTY: "#ef4444"
|
|
61
|
+
}, w = {
|
|
62
|
+
trackLine: {
|
|
63
|
+
color: "#ffffff",
|
|
64
|
+
width: 3,
|
|
65
|
+
opacity: 0.96,
|
|
66
|
+
outlineColor: "#08131f",
|
|
67
|
+
outlineWidth: 1
|
|
68
|
+
},
|
|
69
|
+
forecastLine: {
|
|
70
|
+
color: "#f8fafc",
|
|
71
|
+
width: 2,
|
|
72
|
+
opacity: 0.92,
|
|
73
|
+
dashLength: 12,
|
|
74
|
+
gapLength: 8
|
|
75
|
+
},
|
|
76
|
+
point: {
|
|
77
|
+
radius: 5,
|
|
78
|
+
outlineColor: "#07111f",
|
|
79
|
+
outlineWidth: 1
|
|
80
|
+
},
|
|
81
|
+
label: {
|
|
82
|
+
visible: !0,
|
|
83
|
+
color: "#ffffff",
|
|
84
|
+
fontSize: 12,
|
|
85
|
+
backgroundColor: "rgba(2, 20, 42, 0.82)",
|
|
86
|
+
offset: [0, -22]
|
|
87
|
+
},
|
|
88
|
+
center: {
|
|
89
|
+
iconUrl: "",
|
|
90
|
+
iconSize: [36, 36],
|
|
91
|
+
rotate: !0,
|
|
92
|
+
rotationDurationMs: 1400,
|
|
93
|
+
showLabel: !0,
|
|
94
|
+
labelColor: "#07111f",
|
|
95
|
+
labelBackgroundColor: "rgba(255, 255, 255, 0.88)",
|
|
96
|
+
labelOffset: [30, -30]
|
|
97
|
+
},
|
|
98
|
+
windCircle: {
|
|
99
|
+
visible: !0,
|
|
100
|
+
r7: { color: "#c8c537", fillOpacity: 0.26, outlineOpacity: 0.9 },
|
|
101
|
+
r10: { color: "#ffaa00", fillOpacity: 0.22, outlineOpacity: 0.9 },
|
|
102
|
+
r12: { color: "#cc4400", fillOpacity: 0.18, outlineOpacity: 0.95 }
|
|
103
|
+
},
|
|
104
|
+
intensityColors: B
|
|
105
|
+
}, D = {
|
|
106
|
+
enabled: !0,
|
|
107
|
+
durationMs: 15e3,
|
|
108
|
+
autoplay: !1,
|
|
109
|
+
loop: !1,
|
|
110
|
+
currentIndex: 0
|
|
111
|
+
};
|
|
112
|
+
function h(t) {
|
|
113
|
+
return !!(t && typeof t == "object" && !Array.isArray(t));
|
|
114
|
+
}
|
|
115
|
+
function b(t, n) {
|
|
116
|
+
return Object.prototype.hasOwnProperty.call(t || {}, n);
|
|
117
|
+
}
|
|
118
|
+
function f(t, n, e) {
|
|
119
|
+
return Math.min(Math.max(t, n), e);
|
|
120
|
+
}
|
|
121
|
+
function u(t, n = 0) {
|
|
122
|
+
const e = Number(t);
|
|
123
|
+
return Number.isFinite(e) ? e : n;
|
|
124
|
+
}
|
|
125
|
+
function m(t, n) {
|
|
126
|
+
return {
|
|
127
|
+
...h(t) ? t : {},
|
|
128
|
+
...h(n) ? n : {}
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
function R(t = {}, n = {}) {
|
|
132
|
+
const e = h(t) ? t : {}, i = h(n) ? n : {}, o = {
|
|
133
|
+
...e,
|
|
134
|
+
...i
|
|
135
|
+
};
|
|
136
|
+
["trackLine", "forecastLine", "point", "label", "center", "intensityColors"].forEach((l) => {
|
|
137
|
+
o[l] = m(e[l], i[l]);
|
|
138
|
+
});
|
|
139
|
+
const s = h(e.windCircle) ? e.windCircle : {}, r = h(i.windCircle) ? i.windCircle : {};
|
|
140
|
+
return o.windCircle = {
|
|
141
|
+
...s,
|
|
142
|
+
...r,
|
|
143
|
+
r7: m(s.r7, r.r7),
|
|
144
|
+
r10: m(s.r10, r.r10),
|
|
145
|
+
r12: m(s.r12, r.r12)
|
|
146
|
+
}, o;
|
|
147
|
+
}
|
|
148
|
+
function Q(t = {}, n = {}) {
|
|
149
|
+
const e = h(t) ? t : {}, i = h(n) ? n : {}, o = {
|
|
150
|
+
...e,
|
|
151
|
+
...i,
|
|
152
|
+
typhoon: m(e.typhoon, i.typhoon),
|
|
153
|
+
style: R(e.style, i.style),
|
|
154
|
+
playback: m(e.playback, i.playback)
|
|
155
|
+
};
|
|
156
|
+
return !b(i, "tracks") && b(e, "tracks") && (o.tracks = e.tracks), !b(i, "forecastPaths") && b(e, "forecastPaths") && (o.forecastPaths = e.forecastPaths), o;
|
|
157
|
+
}
|
|
158
|
+
function U(t, n) {
|
|
159
|
+
if (!Array.isArray(t) || t.length < 2)
|
|
160
|
+
throw new Error(`${n} must be [longitude, latitude, height?].`);
|
|
161
|
+
const e = Number(t[0]), i = Number(t[1]), o = t.length > 2 ? Number(t[2]) : 0;
|
|
162
|
+
if (!Number.isFinite(e) || !Number.isFinite(i) || !Number.isFinite(o) || i < -90 || i > 90)
|
|
163
|
+
throw new Error(`${n} must contain finite coordinates and latitude must be between -90 and 90.`);
|
|
164
|
+
return [e, i, o];
|
|
165
|
+
}
|
|
166
|
+
function G(t, n) {
|
|
167
|
+
if (t == null) return null;
|
|
168
|
+
if (!h(t))
|
|
169
|
+
throw new Error(`${n} must be { ne, se, sw, nw } in kilometres.`);
|
|
170
|
+
const e = {};
|
|
171
|
+
for (const i of ["ne", "se", "sw", "nw"]) {
|
|
172
|
+
const o = Number(t[i]);
|
|
173
|
+
if (!Number.isFinite(o) || o < 0)
|
|
174
|
+
throw new Error(`${n}.${i} must be a non-negative number.`);
|
|
175
|
+
e[i] = o;
|
|
176
|
+
}
|
|
177
|
+
return e;
|
|
178
|
+
}
|
|
179
|
+
function V(t, n) {
|
|
180
|
+
if (t == null) return {};
|
|
181
|
+
if (!h(t)) throw new Error(`${n} must be an object.`);
|
|
182
|
+
return ["r7", "r10", "r12"].reduce((e, i) => {
|
|
183
|
+
const o = G(t[i], `${n}.${i}`);
|
|
184
|
+
return o && (e[i] = o), e;
|
|
185
|
+
}, {});
|
|
186
|
+
}
|
|
187
|
+
function _(t, n, e = "tracks") {
|
|
188
|
+
if (!h(t)) throw new Error(`${e}[${n}] must be an object.`);
|
|
189
|
+
const i = t.time ?? "", o = Date.parse(i), s = i == null || String(i) === "" ? `${e}-${n}` : i;
|
|
190
|
+
return {
|
|
191
|
+
...t,
|
|
192
|
+
id: String(t.id === void 0 || t.id === null || String(t.id) === "" ? s : t.id),
|
|
193
|
+
time: i,
|
|
194
|
+
timestamp: Number.isFinite(o) ? o : null,
|
|
195
|
+
position: U(t.position, `${e}[${n}].position`),
|
|
196
|
+
level: String(t.level || "TD"),
|
|
197
|
+
windSpeed: t.windSpeed === void 0 ? null : u(t.windSpeed, null),
|
|
198
|
+
pressure: t.pressure === void 0 ? null : u(t.pressure, null),
|
|
199
|
+
windCircles: V(t.windCircles, `${e}[${n}].windCircles`)
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
function W(t, n, e) {
|
|
203
|
+
if (!h(t)) throw new Error(`forecastPaths[${n}] must be an object.`);
|
|
204
|
+
if (!Array.isArray(t.points) || t.points.length === 0)
|
|
205
|
+
throw new Error(`forecastPaths[${n}].points requires at least one point.`);
|
|
206
|
+
const i = String(t.id ?? `forecast-${n}`), o = t.points.map((s, r) => {
|
|
207
|
+
const l = _(s, r, `forecastPaths[${n}].points`), a = s == null ? void 0 : s.uncertaintyRadiusKm;
|
|
208
|
+
return {
|
|
209
|
+
...l,
|
|
210
|
+
uncertaintyRadiusKm: a == null ? 0 : Math.max(u(a, 0), 0)
|
|
211
|
+
};
|
|
212
|
+
});
|
|
213
|
+
return {
|
|
214
|
+
...t,
|
|
215
|
+
id: i,
|
|
216
|
+
points: o,
|
|
217
|
+
style: m(e, t.style)
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
function Y(t = {}) {
|
|
221
|
+
const n = R(w, t);
|
|
222
|
+
return n.trackLine.width = Math.max(u(n.trackLine.width, 3), 0.5), n.trackLine.opacity = f(u(n.trackLine.opacity, 0.96), 0, 1), n.trackLine.outlineWidth = Math.max(u(n.trackLine.outlineWidth, 1), 0), n.forecastLine.width = Math.max(u(n.forecastLine.width, 2), 0.5), n.forecastLine.opacity = f(u(n.forecastLine.opacity, 0.92), 0, 1), n.forecastLine.dashLength = Math.max(u(n.forecastLine.dashLength, 12), 1), n.forecastLine.gapLength = Math.max(u(n.forecastLine.gapLength, 8), 1), n.point.radius = Math.max(u(n.point.radius, 5), 1), n.point.outlineWidth = Math.max(u(n.point.outlineWidth, 1), 0), n.label.fontSize = Math.max(u(n.label.fontSize, 12), 8), n.label.offset = Array.isArray(n.label.offset) ? n.label.offset.slice(0, 2) : [0, -22], n.center.iconSize = Array.isArray(n.center.iconSize) ? n.center.iconSize.slice(0, 2).map((e) => Math.max(u(e, 36), 1)) : [36, 36], n.center.rotationDurationMs = Math.max(u(n.center.rotationDurationMs, 1400), 1), n.center.labelOffset = Array.isArray(n.center.labelOffset) ? n.center.labelOffset.slice(0, 2) : [30, -30], ["r7", "r10", "r12"].forEach((e) => {
|
|
223
|
+
n.windCircle[e].fillOpacity = f(
|
|
224
|
+
u(n.windCircle[e].fillOpacity, w.windCircle[e].fillOpacity),
|
|
225
|
+
0,
|
|
226
|
+
1
|
|
227
|
+
), n.windCircle[e].outlineOpacity = f(
|
|
228
|
+
u(n.windCircle[e].outlineOpacity, w.windCircle[e].outlineOpacity),
|
|
229
|
+
0,
|
|
230
|
+
1
|
|
231
|
+
);
|
|
232
|
+
}), n;
|
|
233
|
+
}
|
|
234
|
+
function X(t = {}, n = {}) {
|
|
235
|
+
const e = h(t) ? t : {}, i = Array.isArray(e.tracks) ? e.tracks.map((l, a) => _(l, a)) : [];
|
|
236
|
+
if (!n.allowEmpty && i.length === 0)
|
|
237
|
+
throw new Error("Typhoon path requires a non-empty tracks array.");
|
|
238
|
+
const o = Y(e.style), s = Array.isArray(e.forecastPaths) ? e.forecastPaths.map((l, a) => W(l, a, o.forecastLine)) : [], r = m(D, e.playback);
|
|
239
|
+
return r.enabled = r.enabled !== !1, r.durationMs = Math.max(u(r.durationMs, D.durationMs), 1), r.autoplay = r.autoplay === !0, r.loop = r.loop === !0, r.currentIndex = i.length ? f(Math.floor(u(r.currentIndex, 0)), 0, i.length - 1) : 0, {
|
|
240
|
+
...e,
|
|
241
|
+
layerId: String(e.typhoonPathLayerId || e.layerId || e.id || "typhoon-path-default"),
|
|
242
|
+
typhoon: m({}, e.typhoon),
|
|
243
|
+
tracks: i,
|
|
244
|
+
forecastPaths: s,
|
|
245
|
+
style: o,
|
|
246
|
+
playback: r,
|
|
247
|
+
visible: e.visible !== !1,
|
|
248
|
+
onCurrentChange: typeof e.onCurrentChange == "function" ? e.onCurrentChange : null,
|
|
249
|
+
onPointClick: typeof e.onPointClick == "function" ? e.onPointClick : null
|
|
250
|
+
};
|
|
251
|
+
}
|
|
252
|
+
function d(t) {
|
|
253
|
+
return t * Math.PI / 180;
|
|
254
|
+
}
|
|
255
|
+
function N(t) {
|
|
256
|
+
return t * 180 / Math.PI;
|
|
257
|
+
}
|
|
258
|
+
function j(t, n) {
|
|
259
|
+
const e = d(t[1]), i = d(n[1]), o = i - e, s = d(n[0] - t[0]), r = Math.sin(o / 2) ** 2 + Math.cos(e) * Math.cos(i) * Math.sin(s / 2) ** 2;
|
|
260
|
+
return 6371e3 * 2 * Math.atan2(Math.sqrt(r), Math.sqrt(Math.max(1 - r, 0)));
|
|
261
|
+
}
|
|
262
|
+
function $(t) {
|
|
263
|
+
if (t.length <= 1) return [0];
|
|
264
|
+
if (t.every(
|
|
265
|
+
(o, s) => o.timestamp !== null && (s === 0 || o.timestamp > t[s - 1].timestamp)
|
|
266
|
+
)) {
|
|
267
|
+
const o = t[0].timestamp, s = t[t.length - 1].timestamp - o;
|
|
268
|
+
if (s > 0) return t.map((r) => (r.timestamp - o) / s);
|
|
269
|
+
}
|
|
270
|
+
const e = [0];
|
|
271
|
+
for (let o = 1; o < t.length; o += 1) {
|
|
272
|
+
const s = j(t[o - 1].position, t[o].position), r = t[o].position[2] - t[o - 1].position[2];
|
|
273
|
+
e.push(e[o - 1] + Math.hypot(s, r));
|
|
274
|
+
}
|
|
275
|
+
const i = e[e.length - 1];
|
|
276
|
+
return i > 0 ? e.map((o) => o / i) : e.map((o, s) => s / (t.length - 1));
|
|
277
|
+
}
|
|
278
|
+
function K(t, n, e) {
|
|
279
|
+
const i = d(t[1]), o = d(t[0]), s = d(n[1]), r = d(n[0]), l = 2 * Math.asin(Math.sqrt(
|
|
280
|
+
Math.sin((s - i) / 2) ** 2 + Math.cos(i) * Math.cos(s) * Math.sin((r - o) / 2) ** 2
|
|
281
|
+
));
|
|
282
|
+
if (!Number.isFinite(l) || l < 1e-9)
|
|
283
|
+
return [t[0], t[1], t[2] + (n[2] - t[2]) * e];
|
|
284
|
+
const a = Math.sin(l), c = Math.sin((1 - e) * l) / a, p = Math.sin(e * l) / a, M = c * Math.cos(i) * Math.cos(o) + p * Math.cos(s) * Math.cos(r), g = c * Math.cos(i) * Math.sin(o) + p * Math.cos(s) * Math.sin(r), y = c * Math.sin(i) + p * Math.sin(s);
|
|
285
|
+
return [
|
|
286
|
+
N(Math.atan2(g, M)),
|
|
287
|
+
N(Math.atan2(y, Math.hypot(M, g))),
|
|
288
|
+
t[2] + (n[2] - t[2]) * e
|
|
289
|
+
];
|
|
290
|
+
}
|
|
291
|
+
function J(t = [], n = 0) {
|
|
292
|
+
if (!t.length) return null;
|
|
293
|
+
const e = f(u(n, 0), 0, 1);
|
|
294
|
+
if (t.length === 1)
|
|
295
|
+
return { progress: e, index: 0, nextIndex: 0, segmentProgress: 0, position: [...t[0].position], track: t[0] };
|
|
296
|
+
const i = $(t);
|
|
297
|
+
let o = i.length - 2;
|
|
298
|
+
for (let c = 1; c < i.length; c += 1)
|
|
299
|
+
if (e < i[c]) {
|
|
300
|
+
o = c - 1;
|
|
301
|
+
break;
|
|
302
|
+
}
|
|
303
|
+
e >= 1 && (o = t.length - 1);
|
|
304
|
+
const s = Math.min(o + 1, t.length - 1), r = i[o], l = i[s], a = s === o ? 0 : f((e - r) / Math.max(l - r, Number.EPSILON), 0, 1);
|
|
305
|
+
return {
|
|
306
|
+
progress: e,
|
|
307
|
+
index: o,
|
|
308
|
+
nextIndex: s,
|
|
309
|
+
segmentProgress: a,
|
|
310
|
+
position: K(t[o].position, t[s].position, a),
|
|
311
|
+
track: t[o]
|
|
312
|
+
};
|
|
313
|
+
}
|
|
314
|
+
function k(t = [], n = 0) {
|
|
315
|
+
if (!t.length) return 0;
|
|
316
|
+
const e = f(Math.floor(u(n, 0)), 0, t.length - 1);
|
|
317
|
+
return $(t)[e] || 0;
|
|
318
|
+
}
|
|
319
|
+
function tt(t = [], n) {
|
|
320
|
+
if (!t.length) return -1;
|
|
321
|
+
const e = Date.parse(n);
|
|
322
|
+
return Number.isFinite(e) ? t.reduce((i, o, s) => {
|
|
323
|
+
if (o.timestamp === null) return i;
|
|
324
|
+
const r = Math.abs(o.timestamp - e), l = t[i].timestamp === null ? Number.POSITIVE_INFINITY : Math.abs(t[i].timestamp - e);
|
|
325
|
+
return r < l ? s : i;
|
|
326
|
+
}, 0) : -1;
|
|
327
|
+
}
|
|
328
|
+
function F(t, n, e, i) {
|
|
329
|
+
const o = i / 6371, s = d(e), r = d(n), l = d(t), a = Math.asin(
|
|
330
|
+
Math.sin(r) * Math.cos(o) + Math.cos(r) * Math.sin(o) * Math.cos(s)
|
|
331
|
+
), c = l + Math.atan2(
|
|
332
|
+
Math.sin(s) * Math.sin(o) * Math.cos(r),
|
|
333
|
+
Math.cos(o) - Math.sin(r) * Math.sin(a)
|
|
334
|
+
);
|
|
335
|
+
return [(N(c) + 540) % 360 - 180, N(a)];
|
|
336
|
+
}
|
|
337
|
+
function nt(t, n, e, i = 4) {
|
|
338
|
+
if (!h(e)) return [];
|
|
339
|
+
const o = [], s = f(Math.floor(u(i, 4)), 1, 30);
|
|
340
|
+
for (let r = 0; r < 360; r += s) {
|
|
341
|
+
const l = r < 90 ? e.ne : r < 180 ? e.se : r < 270 ? e.sw : e.nw;
|
|
342
|
+
o.push(F(t, n, r, u(l, 0)));
|
|
343
|
+
}
|
|
344
|
+
return o;
|
|
345
|
+
}
|
|
346
|
+
function et(t, n, e, i = 6) {
|
|
347
|
+
const o = [], s = f(Math.floor(u(i, 6)), 1, 30);
|
|
348
|
+
for (let r = 0; r < 360; r += s)
|
|
349
|
+
o.push(F(t, n, r, Math.max(u(e, 0), 0)));
|
|
350
|
+
return o;
|
|
351
|
+
}
|
|
352
|
+
function it(t = [], n = []) {
|
|
353
|
+
const e = t.map((i) => i.position);
|
|
354
|
+
return n.forEach((i) => i.points.forEach((o) => e.push(o.position))), e.length ? e.reduce((i, o) => ({
|
|
355
|
+
west: Math.min(i.west, o[0]),
|
|
356
|
+
south: Math.min(i.south, o[1]),
|
|
357
|
+
east: Math.max(i.east, o[0]),
|
|
358
|
+
north: Math.max(i.north, o[1])
|
|
359
|
+
}), { west: 1 / 0, south: 1 / 0, east: -1 / 0, north: -1 / 0 }) : null;
|
|
360
|
+
}
|
|
361
|
+
function ot(t = {}, n = {}) {
|
|
362
|
+
const e = [t.code, t.name].filter(Boolean).join(" "), i = [n.stage || n.level, n.windSpeed === null ? "" : `${n.windSpeed}m/s`].filter(Boolean).join(" ");
|
|
363
|
+
return [e, i].filter(Boolean).join(`
|
|
364
|
+
`);
|
|
365
|
+
}
|
|
366
|
+
class rt {
|
|
367
|
+
constructor(n = {}) {
|
|
368
|
+
this.rawData = n, this.bound = Array.isArray(n.Bound) ? n.Bound : [], this.data = Array.isArray(n.DataAry) ? n.DataAry : [], this.valid = !1, this.errorMessage = "", this.lonMin = 0, this.latMin = 0, this.lonMax = 0, this.latMax = 0, this.lonCount = 0, this.latCount = 0, this.lonSpan = 0, this.latSpan = 0, this.lonStep = 0, this.latStep = 0, this.valueScale = 1, this.parse();
|
|
369
|
+
}
|
|
370
|
+
parse() {
|
|
371
|
+
if (this.bound.length < 6) {
|
|
372
|
+
this.errorMessage = "Wind field Bound must contain at least 6 values.";
|
|
373
|
+
return;
|
|
374
|
+
}
|
|
375
|
+
const [n, e, i, o, s, r, l = 1] = this.bound, a = Number(i) * Number(o) * 2;
|
|
376
|
+
if (!Number.isFinite(Number(n)) || !Number.isFinite(Number(e)) || Number(i) < 2 || Number(o) < 2 || Number(s) <= 0 || Number(r) <= 0 || this.data.length !== a) {
|
|
377
|
+
this.errorMessage = `Invalid wind field data. Expected DataAry length ${a}, got ${this.data.length}.`;
|
|
378
|
+
return;
|
|
379
|
+
}
|
|
380
|
+
this.lonMin = Number(n), this.latMin = Number(e), this.lonCount = Number(i), this.latCount = Number(o), this.lonSpan = Number(s), this.latSpan = Number(r), this.valueScale = Number(l) || 1, this.lonMax = this.lonMin + this.lonSpan, this.latMax = this.latMin + this.latSpan, this.lonStep = this.lonSpan / (this.lonCount - 1), this.latStep = this.latSpan / (this.latCount - 1), this.valid = !0;
|
|
381
|
+
}
|
|
382
|
+
contains(n, e) {
|
|
383
|
+
return Number.isFinite(n) && Number.isFinite(e) && n >= this.lonMin && n <= this.lonMax && e >= this.latMin && e <= this.latMax;
|
|
384
|
+
}
|
|
385
|
+
getBounds() {
|
|
386
|
+
return {
|
|
387
|
+
west: this.lonMin,
|
|
388
|
+
south: this.latMin,
|
|
389
|
+
east: this.lonMax,
|
|
390
|
+
north: this.latMax
|
|
391
|
+
};
|
|
392
|
+
}
|
|
393
|
+
getCenter() {
|
|
394
|
+
return {
|
|
395
|
+
lon: this.lonMin + this.lonSpan / 2,
|
|
396
|
+
lat: this.latMin + this.latSpan / 2
|
|
397
|
+
};
|
|
398
|
+
}
|
|
399
|
+
getVector(n, e) {
|
|
400
|
+
const i = (n * this.lonCount + e) * 2;
|
|
401
|
+
return {
|
|
402
|
+
u: Number(this.data[i]) / this.valueScale,
|
|
403
|
+
v: Number(this.data[i + 1]) / this.valueScale
|
|
404
|
+
};
|
|
405
|
+
}
|
|
406
|
+
/**
|
|
407
|
+
* 双线性插值。
|
|
408
|
+
*
|
|
409
|
+
* 数据约定为从左下角开始平铺,因此 row 直接对应从南到北的纬度索引。
|
|
410
|
+
*/
|
|
411
|
+
sample(n, e) {
|
|
412
|
+
if (!this.valid || !this.contains(n, e))
|
|
413
|
+
return null;
|
|
414
|
+
const i = (n - this.lonMin) / this.lonStep, o = (e - this.latMin) / this.latStep, s = Math.max(0, Math.min(Math.floor(i), this.lonCount - 2)), r = Math.max(0, Math.min(Math.floor(o), this.latCount - 2)), l = s + 1, a = r + 1, c = Math.max(0, Math.min(i - s, 1)), p = Math.max(0, Math.min(o - r, 1)), M = this.getVector(r, s), g = this.getVector(r, l), y = this.getVector(a, s), E = this.getVector(a, l), L = 1 - c, T = 1 - p, A = L * T, O = c * T, x = L * p, P = c * p, C = M.u * A + g.u * O + y.u * x + E.u * P, I = M.v * A + g.v * O + y.v * x + E.v * P;
|
|
415
|
+
return !Number.isFinite(C) || !Number.isFinite(I) ? null : {
|
|
416
|
+
u: C,
|
|
417
|
+
v: I,
|
|
418
|
+
speed: Math.hypot(C, I)
|
|
419
|
+
};
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
export {
|
|
423
|
+
S as R,
|
|
424
|
+
rt as W,
|
|
425
|
+
nt as a,
|
|
426
|
+
et as b,
|
|
427
|
+
J as c,
|
|
428
|
+
it as d,
|
|
429
|
+
z as e,
|
|
430
|
+
ot as f,
|
|
431
|
+
k as g,
|
|
432
|
+
Q as m,
|
|
433
|
+
X as n,
|
|
434
|
+
tt as r,
|
|
435
|
+
q as s,
|
|
436
|
+
H as u,
|
|
437
|
+
Z as v
|
|
438
|
+
};
|
package/dist/assets.js
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
import { t as r } from "./typhoon-path-BAiUgsJf.js";
|
|
2
|
+
const f = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%3e%3ccircle%20cx='12'%20cy='12'%20r='11'%20fill='%232f80ed'/%3e%3cpath%20fill='%23ffffff'%20d='M7%203h5l-.7%208.2%203.7-2V12l4-2.2V21H5v-8h1.2L7%203Zm1.9%202-.7%208H7v6h10v-5.8l-4%202.2v-2.8l-4%202.2L9.8%205h-.9Z'/%3e%3cpath%20fill='%23ffffff'%20d='M7%2017h2v2H7zm4%200h2v2h-2zm4%200h2v2h-2z'/%3e%3c/svg%3e", e = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='84'%20height='100'%20viewBox='0%200%2084%20100'%3e%3cdefs%3e%3clinearGradient%20id='pin-gradient'%20x1='0%25'%20y1='0%25'%20x2='100%25'%20y2='100%25'%3e%3cstop%20offset='0%25'%20stop-color='%234fd3ff'%20/%3e%3cstop%20offset='100%25'%20stop-color='%231d79ff'%20/%3e%3c/linearGradient%3e%3c/defs%3e%3cpath%20d='M42%204C22.12%204%206%2020.12%206%2040c0%2026%2030.5%2053.2%2034.02%2056.28a3%203%200%200%200%203.96%200C47.5%2093.2%2078%2066%2078%2040%2078%2020.12%2061.88%204%2042%204Z'%20fill='url(%23pin-gradient)'%20stroke='%23d8f0ff'%20stroke-width='3'/%3e%3ccircle%20cx='42'%20cy='39'%20r='15'%20fill='%23ffffff'%20fill-opacity='0.92'/%3e%3ccircle%20cx='42'%20cy='39'%20r='7'%20fill='%231d79ff'/%3e%3c/svg%3e", c = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%3e%3ccircle%20cx='12'%20cy='12'%20r='10'%20fill='%232f80ed'/%3e%3ccircle%20cx='12'%20cy='7.5'%20r='1.4'%20fill='%23ffffff'/%3e%3crect%20x='10.8'%20y='10'%20width='2.4'%20height='7'%20rx='1.2'%20fill='%23ffffff'/%3e%3c/svg%3e";
|
|
2
3
|
export {
|
|
3
|
-
|
|
4
|
+
f as gisFactoryMarker,
|
|
5
|
+
c as gisInfoMarker,
|
|
6
|
+
e as gisMarkerSample,
|
|
7
|
+
r as typhoonPathIcon
|
|
4
8
|
};
|