@3clear/basegis 0.1.6 → 0.1.8
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 +120 -34
- package/dist/WindDataGrid-DA9pzsfX.js +508 -0
- package/dist/assets.js +5 -5
- package/dist/basegis.js +4684 -3278
- package/dist/{basemap.config-Bs1PwVYt.js → basemap.config-CtXrS74D.js} +22 -17
- package/dist/layers.js +23 -23
- package/dist/methods.js +1454 -1133
- package/package.json +1 -1
- package/dist/WindDataGrid-B1KZflZc.js +0 -438
package/dist/methods.js
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
function
|
|
1
|
+
import { l as m, s as p, v as Lt, m as ye, n as Fe, W as me, R as V } from "./WindDataGrid-DA9pzsfX.js";
|
|
2
|
+
import wt from "axios";
|
|
3
|
+
function te(r = {}) {
|
|
4
4
|
return Array.isArray(r) || Array.isArray(r == null ? void 0 : r.features) ? { contours: r } : r || {};
|
|
5
5
|
}
|
|
6
|
-
function
|
|
7
|
-
const e =
|
|
6
|
+
function Be(r = {}) {
|
|
7
|
+
const e = te(r);
|
|
8
8
|
return ["contours", "isolines", "isoline", "lines", "data", "items", "centers"].some(
|
|
9
9
|
(t) => Object.prototype.hasOwnProperty.call(e, t)
|
|
10
10
|
);
|
|
11
11
|
}
|
|
12
|
-
function
|
|
12
|
+
function Ct(r) {
|
|
13
13
|
return !!(r && typeof r.getEngineType == "function" && typeof r.getMapInstance == "function" && typeof r.upsertContourLayer == "function" && typeof r.updateContourLayer == "function" && typeof r.showContourLayer == "function" && typeof r.hideContourLayer == "function" && typeof r.removeContourLayer == "function" && typeof r.clearContourLayer == "function" && typeof r.getContourLayerState == "function");
|
|
14
14
|
}
|
|
15
|
-
function
|
|
15
|
+
function Mt(r = {}) {
|
|
16
16
|
const { mapCore: e, baseGIS: t, ...n } = r;
|
|
17
17
|
return n;
|
|
18
18
|
}
|
|
19
|
-
class
|
|
19
|
+
class Tt {
|
|
20
20
|
constructor(e = {}) {
|
|
21
|
-
const t =
|
|
21
|
+
const t = Mt(e), n = t.contourLayerId || t.layerId || t.id || "contour-default";
|
|
22
22
|
this.options = {
|
|
23
23
|
layerId: n,
|
|
24
24
|
visible: t.visible ?? !0
|
|
@@ -41,27 +41,27 @@ class et {
|
|
|
41
41
|
}
|
|
42
42
|
mount(e) {
|
|
43
43
|
var t, n;
|
|
44
|
-
return
|
|
44
|
+
return Ct(e) ? (this.baseGIS = e, p(
|
|
45
45
|
{ engineType: ((n = (t = this.baseGIS).getEngineType) == null ? void 0 : n.call(t)) || "unknown" },
|
|
46
46
|
"ContourLayerController mounted with BaseGIS."
|
|
47
|
-
)) :
|
|
47
|
+
)) : m(
|
|
48
48
|
"ContourLayerController mount requires BaseGIS instance.",
|
|
49
49
|
"INVALID_MOUNT_TARGET"
|
|
50
50
|
);
|
|
51
51
|
}
|
|
52
52
|
resolveBaseGIS() {
|
|
53
53
|
var e, t;
|
|
54
|
-
return this.baseGIS ? (t = (e = this.baseGIS).getMapInstance) != null && t.call(e) ?
|
|
54
|
+
return this.baseGIS ? (t = (e = this.baseGIS).getMapInstance) != null && t.call(e) ? p(null, "BaseGIS is ready.") : m(
|
|
55
55
|
"Map instance is not ready. Please call mapCore.init() first.",
|
|
56
56
|
"NOT_INITIALIZED"
|
|
57
|
-
) :
|
|
57
|
+
) : m("ContourLayerController has not been mounted.", "NOT_MOUNTED");
|
|
58
58
|
}
|
|
59
59
|
getLayerId(e = {}) {
|
|
60
60
|
var t;
|
|
61
61
|
return typeof e == "string" && e ? e : (e == null ? void 0 : e.contourLayerId) || (e == null ? void 0 : e.layerId) || (e == null ? void 0 : e.id) || ((t = this.currentPayload) == null ? void 0 : t.layerId) || this.options.layerId;
|
|
62
62
|
}
|
|
63
63
|
buildPayload(e = {}) {
|
|
64
|
-
const t =
|
|
64
|
+
const t = te(e), n = this.getLayerId(t);
|
|
65
65
|
return {
|
|
66
66
|
...this.defaultPayload,
|
|
67
67
|
...t,
|
|
@@ -78,21 +78,21 @@ class et {
|
|
|
78
78
|
}, typeof t.visible == "boolean" && (this.visible = t.visible));
|
|
79
79
|
}
|
|
80
80
|
async load(e = {}, t = {}) {
|
|
81
|
-
var
|
|
81
|
+
var o;
|
|
82
82
|
const n = this.resolveBaseGIS();
|
|
83
83
|
if (!n.success)
|
|
84
84
|
return n;
|
|
85
85
|
const s = this.buildPayload({
|
|
86
|
-
...
|
|
87
|
-
...
|
|
86
|
+
...te(e),
|
|
87
|
+
...te(t)
|
|
88
88
|
});
|
|
89
|
-
if (!
|
|
90
|
-
return
|
|
89
|
+
if (!Be(s))
|
|
90
|
+
return m(
|
|
91
91
|
"Contour layer requires contours, isolines, lines, data, items or centers.",
|
|
92
92
|
"INVALID_CONTOUR_SOURCE"
|
|
93
93
|
);
|
|
94
94
|
const i = await this.baseGIS.upsertContourLayer(s);
|
|
95
|
-
return i.success && (this.currentPayload = s, this.visible = s.visible !== !1, this.layerType = ((
|
|
95
|
+
return i.success && (this.currentPayload = s, this.visible = s.visible !== !1, this.layerType = ((o = i == null ? void 0 : i.data) == null ? void 0 : o.layerType) || this.layerType, this.syncStateFromResult(i)), i;
|
|
96
96
|
}
|
|
97
97
|
upsert(e = {}, t = {}) {
|
|
98
98
|
return this.load(e, t);
|
|
@@ -104,10 +104,10 @@ class et {
|
|
|
104
104
|
return t;
|
|
105
105
|
const n = {
|
|
106
106
|
...this.currentPayload || this.defaultPayload,
|
|
107
|
-
...
|
|
107
|
+
...te(e)
|
|
108
108
|
};
|
|
109
|
-
if (!this.currentPayload && !
|
|
110
|
-
return
|
|
109
|
+
if (!this.currentPayload && !Be(n))
|
|
110
|
+
return m("Contour layer has not been loaded.", "NOT_LOADED");
|
|
111
111
|
const s = await this.baseGIS.updateContourLayer(n);
|
|
112
112
|
return s.success && (this.currentPayload = n, this.visible = n.visible !== !1, this.layerType = ((i = s == null ? void 0 : s.data) == null ? void 0 : i.layerType) || this.layerType, this.syncStateFromResult(s)), s;
|
|
113
113
|
}
|
|
@@ -177,7 +177,7 @@ class et {
|
|
|
177
177
|
labelCount: 0,
|
|
178
178
|
visible: !1,
|
|
179
179
|
destroyed: !0
|
|
180
|
-
},
|
|
180
|
+
}, p(null, "Contour layer controller destroyed (local state only).");
|
|
181
181
|
const n = this.baseGIS.removeContourLayer({
|
|
182
182
|
...e,
|
|
183
183
|
layerId: this.getLayerId(e)
|
|
@@ -193,13 +193,13 @@ class et {
|
|
|
193
193
|
labelCount: 0,
|
|
194
194
|
visible: !1,
|
|
195
195
|
destroyed: !0
|
|
196
|
-
}, n.success ?
|
|
196
|
+
}, n.success ? p(null, "Contour layer controller destroyed.") : n;
|
|
197
197
|
}
|
|
198
198
|
removeLayer(e = {}) {
|
|
199
199
|
return this.destroy(e);
|
|
200
200
|
}
|
|
201
201
|
getState() {
|
|
202
|
-
var e, t, n, s, i,
|
|
202
|
+
var e, t, n, s, i, o, a;
|
|
203
203
|
if ((t = (e = this.baseGIS) == null ? void 0 : e.getMapInstance) != null && t.call(e) && this.currentPayload) {
|
|
204
204
|
const u = (s = (n = this.baseGIS).getContourLayerState) == null ? void 0 : s.call(n, {
|
|
205
205
|
layerId: this.currentPayload.layerId || this.options.layerId
|
|
@@ -208,20 +208,26 @@ class et {
|
|
|
208
208
|
}
|
|
209
209
|
return {
|
|
210
210
|
mounted: !!this.baseGIS,
|
|
211
|
-
engineType: ((
|
|
211
|
+
engineType: ((o = (i = this.baseGIS) == null ? void 0 : i.getEngineType) == null ? void 0 : o.call(i)) || "unknown",
|
|
212
212
|
layerType: this.layerType,
|
|
213
213
|
visible: this.visible,
|
|
214
|
-
layerId: ((
|
|
214
|
+
layerId: ((a = this.currentPayload) == null ? void 0 : a.layerId) || this.options.layerId,
|
|
215
215
|
payload: this.currentPayload,
|
|
216
216
|
...this.currentState
|
|
217
217
|
};
|
|
218
218
|
}
|
|
219
219
|
}
|
|
220
|
-
function
|
|
220
|
+
function j(r, e = 0) {
|
|
221
221
|
const t = Number(r);
|
|
222
222
|
return Number.isFinite(t) ? t : e;
|
|
223
223
|
}
|
|
224
|
-
function
|
|
224
|
+
function Oe(r) {
|
|
225
|
+
return r != null && String(r).trim() !== "";
|
|
226
|
+
}
|
|
227
|
+
function je(r, e, t = "") {
|
|
228
|
+
return Oe(r) ? r : Oe(e) ? e : t;
|
|
229
|
+
}
|
|
230
|
+
function _e(r, e = {
|
|
225
231
|
startLon: 73,
|
|
226
232
|
startLat: 18,
|
|
227
233
|
endLon: 135,
|
|
@@ -229,65 +235,79 @@ function Se(r, e = {
|
|
|
229
235
|
}) {
|
|
230
236
|
const t = r && typeof r == "object" ? r : e;
|
|
231
237
|
return {
|
|
232
|
-
startLon:
|
|
233
|
-
startLat:
|
|
234
|
-
endLon:
|
|
235
|
-
endLat:
|
|
238
|
+
startLon: j(t.startLon, e.startLon),
|
|
239
|
+
startLat: j(t.startLat, e.startLat),
|
|
240
|
+
endLon: j(t.endLon, e.endLon),
|
|
241
|
+
endLat: j(t.endLat, e.endLat)
|
|
236
242
|
};
|
|
237
243
|
}
|
|
238
|
-
function
|
|
244
|
+
function Gt(r) {
|
|
239
245
|
return !!(r && typeof r.getEngineType == "function" && typeof r.getMapInstance == "function" && typeof r.upsertGridLayer == "function" && typeof r.showGridLayer == "function" && typeof r.hideGridLayer == "function" && typeof r.removeGridLayer == "function");
|
|
240
246
|
}
|
|
241
|
-
function
|
|
247
|
+
function Nt(r = {}) {
|
|
242
248
|
return !!(r.tifUrl || r.imageUrl || r.grayImageUrl || r.imageGridData);
|
|
243
249
|
}
|
|
244
|
-
class
|
|
250
|
+
class bn {
|
|
245
251
|
constructor(e = {}) {
|
|
246
252
|
this.options = {
|
|
247
253
|
visible: e.visible ?? !0,
|
|
248
254
|
layerId: e.layerId || "grid-layer-default",
|
|
249
|
-
defaultArea:
|
|
250
|
-
gridTotal:
|
|
251
|
-
tileSize:
|
|
252
|
-
decimalPlaces:
|
|
255
|
+
defaultArea: _e(e.defaultArea),
|
|
256
|
+
gridTotal: j(e.gridTotal, 4),
|
|
257
|
+
tileSize: j(e.tileSize, 512),
|
|
258
|
+
decimalPlaces: j(e.decimalPlaces, 2),
|
|
253
259
|
showLabel: !!e.showLabel,
|
|
254
260
|
showProbe: !!e.showProbe,
|
|
255
|
-
colorize: e.colorize || null
|
|
261
|
+
colorize: e.colorize || null,
|
|
262
|
+
// 控制器级配置属于当前图层的显式覆盖;BaseGIS 全局默认由主入口另行注入。
|
|
263
|
+
sourceProjectionCrs: je(
|
|
264
|
+
e.sourceProjectionCrs,
|
|
265
|
+
e.sourceProjection
|
|
266
|
+
)
|
|
256
267
|
}, this.baseGIS = null, this.visible = this.options.visible, this.layerType = "unknown", this.currentPayload = null, (e.mapCore || e.baseGIS) && this.mount(e.mapCore || e.baseGIS);
|
|
257
268
|
}
|
|
258
269
|
mount(e) {
|
|
259
270
|
var t, n;
|
|
260
|
-
return
|
|
271
|
+
return Gt(e) ? (this.baseGIS = e, p(
|
|
261
272
|
{ engineType: ((n = (t = this.baseGIS).getEngineType) == null ? void 0 : n.call(t)) || "unknown" },
|
|
262
273
|
"GridLayerController mounted with BaseGIS."
|
|
263
|
-
)) :
|
|
274
|
+
)) : m(
|
|
264
275
|
"GridLayerController mount requires BaseGIS instance.",
|
|
265
276
|
"INVALID_MOUNT_TARGET"
|
|
266
277
|
);
|
|
267
278
|
}
|
|
268
279
|
resolveBaseGIS() {
|
|
269
280
|
var e, t;
|
|
270
|
-
return this.baseGIS ? (t = (e = this.baseGIS).getMapInstance) != null && t.call(e) ?
|
|
281
|
+
return this.baseGIS ? (t = (e = this.baseGIS).getMapInstance) != null && t.call(e) ? p(null, "BaseGIS is ready.") : m(
|
|
271
282
|
"Map instance is not ready. Please call mapCore.init() first.",
|
|
272
283
|
"NOT_INITIALIZED"
|
|
273
|
-
) :
|
|
284
|
+
) : m("GridLayerController has not been mounted.", "NOT_MOUNTED");
|
|
274
285
|
}
|
|
275
286
|
getLayerId(e = {}) {
|
|
276
287
|
var t;
|
|
277
288
|
return typeof e == "string" && e ? e : (e == null ? void 0 : e.layerId) || (e == null ? void 0 : e.gridLayerId) || ((t = this.currentPayload) == null ? void 0 : t.layerId) || this.options.layerId;
|
|
278
289
|
}
|
|
279
290
|
buildPayload(e = {}) {
|
|
280
|
-
const t = e.imageUrl || e.grayImageUrl || e.imageGridData, n = e.area ?
|
|
291
|
+
const t = e.imageUrl || e.grayImageUrl || e.imageGridData, n = e.area ? _e(e.area, this.options.defaultArea) : t ? this.options.defaultArea : void 0, s = je(
|
|
292
|
+
e.sourceProjectionCrs,
|
|
293
|
+
e.sourceProjection,
|
|
294
|
+
this.options.sourceProjectionCrs
|
|
295
|
+
);
|
|
281
296
|
return {
|
|
282
297
|
...e,
|
|
283
298
|
layerId: this.getLayerId(e),
|
|
284
299
|
area: n,
|
|
285
|
-
gridTotal:
|
|
286
|
-
tileSize:
|
|
287
|
-
decimalPlaces:
|
|
300
|
+
gridTotal: j(e.gridTotal, this.options.gridTotal),
|
|
301
|
+
tileSize: j(e.tileSize, this.options.tileSize),
|
|
302
|
+
decimalPlaces: j(e.decimalPlaces, this.options.decimalPlaces),
|
|
288
303
|
showLabel: typeof e.showLabel == "boolean" ? e.showLabel : this.options.showLabel,
|
|
289
304
|
showProbe: typeof e.showProbe == "boolean" ? e.showProbe : this.options.showProbe,
|
|
290
305
|
colorize: e.colorize || this.options.colorize,
|
|
306
|
+
...s ? {
|
|
307
|
+
sourceProjectionCrs: s,
|
|
308
|
+
// 兼容尚在使用 sourceProjection 的调用和适配层。
|
|
309
|
+
sourceProjection: s
|
|
310
|
+
} : {},
|
|
291
311
|
visible: typeof e.visible == "boolean" ? e.visible : this.visible
|
|
292
312
|
};
|
|
293
313
|
}
|
|
@@ -296,8 +316,8 @@ class $r {
|
|
|
296
316
|
const t = this.resolveBaseGIS();
|
|
297
317
|
if (!t.success)
|
|
298
318
|
return t;
|
|
299
|
-
if (!
|
|
300
|
-
return
|
|
319
|
+
if (!Nt(e))
|
|
320
|
+
return m(
|
|
301
321
|
"Grid layer requires tifUrl, imageUrl, grayImageUrl or imageGridData.",
|
|
302
322
|
"INVALID_GRID_SOURCE"
|
|
303
323
|
);
|
|
@@ -328,7 +348,7 @@ class $r {
|
|
|
328
348
|
...this.currentPayload,
|
|
329
349
|
...e,
|
|
330
350
|
layerId: e.layerId || e.gridLayerId || this.currentPayload.layerId
|
|
331
|
-
}) :
|
|
351
|
+
}) : m("Grid layer has not been loaded.", "NOT_LOADED");
|
|
332
352
|
}
|
|
333
353
|
show(e = {}) {
|
|
334
354
|
const t = this.resolveBaseGIS();
|
|
@@ -350,11 +370,11 @@ class $r {
|
|
|
350
370
|
}
|
|
351
371
|
destroy(e = {}) {
|
|
352
372
|
if (!this.resolveBaseGIS().success)
|
|
353
|
-
return this.currentPayload = null, this.layerType = "unknown",
|
|
373
|
+
return this.currentPayload = null, this.layerType = "unknown", p(null, "Grid layer controller destroyed (local state only).");
|
|
354
374
|
const n = this.baseGIS.removeGridLayer({
|
|
355
375
|
layerId: this.getLayerId(e)
|
|
356
376
|
});
|
|
357
|
-
return this.currentPayload = null, this.layerType = "unknown", n.success ?
|
|
377
|
+
return this.currentPayload = null, this.layerType = "unknown", n.success ? p(null, "Grid layer controller destroyed.") : n;
|
|
358
378
|
}
|
|
359
379
|
getState() {
|
|
360
380
|
var e, t, n;
|
|
@@ -368,14 +388,17 @@ class $r {
|
|
|
368
388
|
};
|
|
369
389
|
}
|
|
370
390
|
}
|
|
371
|
-
|
|
372
|
-
maxSize: 12
|
|
373
|
-
};
|
|
374
|
-
function E(r, e = 0) {
|
|
391
|
+
function F(r, e = 0) {
|
|
375
392
|
const t = Number(r);
|
|
376
393
|
return Number.isFinite(t) ? t : e;
|
|
377
394
|
}
|
|
378
|
-
function
|
|
395
|
+
function Ve(r) {
|
|
396
|
+
return r != null && String(r).trim() !== "";
|
|
397
|
+
}
|
|
398
|
+
function ze(r, e, t = "") {
|
|
399
|
+
return Ve(r) ? r : Ve(e) ? e : t;
|
|
400
|
+
}
|
|
401
|
+
function Ue(r) {
|
|
379
402
|
if (Array.isArray(r) && r.length >= 2) {
|
|
380
403
|
const e = Number(r[0]), t = Number(r[1]);
|
|
381
404
|
return Number.isFinite(e) && Number.isFinite(t) ? { lat: e, lng: t } : null;
|
|
@@ -386,7 +409,7 @@ function Le(r) {
|
|
|
386
409
|
}
|
|
387
410
|
return null;
|
|
388
411
|
}
|
|
389
|
-
function
|
|
412
|
+
function we(r) {
|
|
390
413
|
if (!r) return null;
|
|
391
414
|
if (typeof r.getWest == "function" && typeof r.getSouth == "function" && typeof r.getEast == "function" && typeof r.getNorth == "function")
|
|
392
415
|
return {
|
|
@@ -403,7 +426,7 @@ function he(r) {
|
|
|
403
426
|
endLon: r[2],
|
|
404
427
|
endLat: r[3]
|
|
405
428
|
};
|
|
406
|
-
const e =
|
|
429
|
+
const e = Ue(r[0]), t = Ue(r[1]);
|
|
407
430
|
if (e && t)
|
|
408
431
|
return {
|
|
409
432
|
startLon: e.lng,
|
|
@@ -414,11 +437,11 @@ function he(r) {
|
|
|
414
437
|
}
|
|
415
438
|
if (r && typeof r == "object") {
|
|
416
439
|
if (r.area) {
|
|
417
|
-
const e =
|
|
440
|
+
const e = we(r.area);
|
|
418
441
|
if (e) return e;
|
|
419
442
|
}
|
|
420
443
|
if (r._southWest && r._northEast)
|
|
421
|
-
return
|
|
444
|
+
return we([r._southWest, r._northEast]);
|
|
422
445
|
if (["west", "south", "east", "north"].every(
|
|
423
446
|
(e) => Number.isFinite(Number(r[e]))
|
|
424
447
|
))
|
|
@@ -435,8 +458,8 @@ function he(r) {
|
|
|
435
458
|
}
|
|
436
459
|
return null;
|
|
437
460
|
}
|
|
438
|
-
function
|
|
439
|
-
const e =
|
|
461
|
+
function $e(r) {
|
|
462
|
+
const e = we(r);
|
|
440
463
|
if (!e) return null;
|
|
441
464
|
const t = Number(e.startLon), n = Number(e.startLat), s = Number(e.endLon), i = Number(e.endLat);
|
|
442
465
|
return [t, n, s, i].every(Number.isFinite) ? {
|
|
@@ -446,141 +469,33 @@ function z(r) {
|
|
|
446
469
|
endLat: Math.max(n, i)
|
|
447
470
|
} : null;
|
|
448
471
|
}
|
|
449
|
-
function
|
|
472
|
+
function Ce(r, e = {
|
|
450
473
|
startLon: 73,
|
|
451
474
|
startLat: 18,
|
|
452
475
|
endLon: 135,
|
|
453
476
|
endLat: 54
|
|
454
477
|
}) {
|
|
455
|
-
const t =
|
|
478
|
+
const t = $e(e) || {
|
|
456
479
|
startLon: 73,
|
|
457
480
|
startLat: 18,
|
|
458
481
|
endLon: 135,
|
|
459
482
|
endLat: 54
|
|
460
|
-
}, n =
|
|
483
|
+
}, n = $e(r) || t, s = F(n.startLon, t.startLon), i = F(n.startLat, t.startLat), o = F(n.endLon, t.endLon), a = F(n.endLat, t.endLat);
|
|
461
484
|
return {
|
|
462
|
-
startLon: Math.min(s,
|
|
463
|
-
startLat: Math.min(i,
|
|
464
|
-
endLon: Math.max(s,
|
|
465
|
-
endLat: Math.max(i,
|
|
466
|
-
};
|
|
467
|
-
}
|
|
468
|
-
function st() {
|
|
469
|
-
return typeof window < "u" && typeof document < "u";
|
|
470
|
-
}
|
|
471
|
-
function it(r) {
|
|
472
|
-
return `${r || ""}`.toUpperCase() === "EPSG:3857";
|
|
473
|
-
}
|
|
474
|
-
function J(r, e = "EPSG:4326") {
|
|
475
|
-
return `${r || e}`.toUpperCase();
|
|
476
|
-
}
|
|
477
|
-
function ge(r) {
|
|
478
|
-
const e = z(r);
|
|
479
|
-
return e ? [e.startLon, e.startLat, e.endLon, e.endLat].every((t) => Math.abs(Number(t)) <= 180) : !1;
|
|
480
|
-
}
|
|
481
|
-
function de(r, e) {
|
|
482
|
-
const t = 85.0511287798066, n = Math.min(Math.max(Number(r), -t), t), s = Number(e), i = 6378137, a = i * s * Math.PI / 180, o = i * Math.log(Math.tan(Math.PI / 4 + n * Math.PI / 360));
|
|
483
|
-
return { x: a, y: o };
|
|
484
|
-
}
|
|
485
|
-
function ve(r, e) {
|
|
486
|
-
const n = Number(r) / 6378137 * 180 / Math.PI;
|
|
487
|
-
return { lat: (2 * Math.atan(Math.exp(Number(e) / 6378137)) - Math.PI / 2) * 180 / Math.PI, lng: n };
|
|
488
|
-
}
|
|
489
|
-
function at(r) {
|
|
490
|
-
const e = z(r);
|
|
491
|
-
if (!e) return null;
|
|
492
|
-
const t = de(e.startLat, e.startLon), n = de(e.endLat, e.endLon);
|
|
493
|
-
return {
|
|
494
|
-
startLon: t.x,
|
|
495
|
-
startLat: t.y,
|
|
496
|
-
endLon: n.x,
|
|
497
|
-
endLat: n.y
|
|
498
|
-
};
|
|
499
|
-
}
|
|
500
|
-
function fe(r) {
|
|
501
|
-
const e = z(r);
|
|
502
|
-
if (!e) return null;
|
|
503
|
-
if (ge(e)) return e;
|
|
504
|
-
const t = ve(e.startLon, e.startLat), n = ve(e.endLon, e.endLat);
|
|
505
|
-
return {
|
|
506
|
-
startLon: t.lng,
|
|
507
|
-
startLat: t.lat,
|
|
508
|
-
endLon: n.lng,
|
|
509
|
-
endLat: n.lat
|
|
510
|
-
};
|
|
511
|
-
}
|
|
512
|
-
function ot(r) {
|
|
513
|
-
return new Promise((e, t) => {
|
|
514
|
-
const n = new Image();
|
|
515
|
-
n.crossOrigin = "anonymous", n.onload = () => e(n), n.onerror = () => t(new Error(`图片加载失败:${r}`)), n.src = r;
|
|
516
|
-
});
|
|
517
|
-
}
|
|
518
|
-
function lt(r, e, t) {
|
|
519
|
-
const n = z(t) || {};
|
|
520
|
-
return [
|
|
521
|
-
r,
|
|
522
|
-
e,
|
|
523
|
-
n.startLon,
|
|
524
|
-
n.startLat,
|
|
525
|
-
n.endLon,
|
|
526
|
-
n.endLat
|
|
527
|
-
].join("|");
|
|
528
|
-
}
|
|
529
|
-
function ut(r, e) {
|
|
530
|
-
if (!(!r || !e))
|
|
531
|
-
for (V.has(r) && V.delete(r), V.set(r, e); V.size > nt.maxSize; ) {
|
|
532
|
-
const t = V.keys().next().value;
|
|
533
|
-
V.delete(t);
|
|
534
|
-
}
|
|
535
|
-
}
|
|
536
|
-
async function ct(r, e) {
|
|
537
|
-
const t = z(e), n = fe(t);
|
|
538
|
-
if (!st() || !t || !n || ge(t))
|
|
539
|
-
return r;
|
|
540
|
-
const s = await ot(r), i = s.naturalWidth || s.width, a = s.naturalHeight || s.height, o = document.createElement("canvas");
|
|
541
|
-
o.width = i, o.height = a;
|
|
542
|
-
const u = o.getContext("2d", { willReadFrequently: !0 });
|
|
543
|
-
u.drawImage(s, 0, 0, i, a);
|
|
544
|
-
const l = u.getImageData(0, 0, i, a), c = document.createElement("canvas");
|
|
545
|
-
c.width = i, c.height = a;
|
|
546
|
-
const h = c.getContext("2d", { willReadFrequently: !0 }), y = h.createImageData(i, a), d = l.data, I = y.data, b = Math.min(Number(t.startLat), Number(t.endLat)), S = Math.max(Number(t.startLat), Number(t.endLat)), g = S - b;
|
|
547
|
-
if (!Number.isFinite(g) || g === 0)
|
|
548
|
-
return r;
|
|
549
|
-
for (let L = 0; L < a; L += 1) {
|
|
550
|
-
const p = n.endLat - (n.endLat - n.startLat) * L / Math.max(a - 1, 1), P = de(p, 0), T = Math.round((S - P.y) / g * (a - 1)), N = Math.min(Math.max(T, 0), a - 1) * i * 4, A = L * i * 4;
|
|
551
|
-
I.set(d.subarray(N, N + i * 4), A);
|
|
552
|
-
}
|
|
553
|
-
return h.putImageData(y, 0, 0), c.toDataURL("image/png");
|
|
554
|
-
}
|
|
555
|
-
async function Pe(r) {
|
|
556
|
-
const e = J(r == null ? void 0 : r.sourceProjection, ""), t = J(r == null ? void 0 : r.targetProjection);
|
|
557
|
-
if (!(r != null && r.imageUrl) || !it(e) || e === t)
|
|
558
|
-
return r;
|
|
559
|
-
const n = r.sourceArea || r.area, s = lt(r.imageUrl, `${e}_${t}`, n);
|
|
560
|
-
if (V.has(s))
|
|
561
|
-
return {
|
|
562
|
-
...r,
|
|
563
|
-
imageUrl: V.get(s),
|
|
564
|
-
area: X(fe(n) || r.area, r.area)
|
|
565
|
-
};
|
|
566
|
-
const i = fe(n) || r.area;
|
|
567
|
-
let a = null;
|
|
568
|
-
ge(n) ? a = at(n) : a = z(n);
|
|
569
|
-
const o = await ct(r.imageUrl, a);
|
|
570
|
-
return ut(s, o), {
|
|
571
|
-
...r,
|
|
572
|
-
imageUrl: o,
|
|
573
|
-
area: X(i, r.area)
|
|
485
|
+
startLon: Math.min(s, o),
|
|
486
|
+
startLat: Math.min(i, a),
|
|
487
|
+
endLon: Math.max(s, o),
|
|
488
|
+
endLat: Math.max(i, a)
|
|
574
489
|
};
|
|
575
490
|
}
|
|
576
|
-
function
|
|
491
|
+
function ke(r = {}, e = 0, t = void 0) {
|
|
577
492
|
return {
|
|
578
493
|
id: (r == null ? void 0 : r.id) || `image-${e}`,
|
|
579
494
|
name: (r == null ? void 0 : r.name) || `Image ${e + 1}`,
|
|
580
495
|
imageUrl: (r == null ? void 0 : r.imageUrl) || "",
|
|
581
496
|
tifUrl: (r == null ? void 0 : r.tifUrl) || "",
|
|
582
497
|
description: (r == null ? void 0 : r.description) || "",
|
|
583
|
-
area:
|
|
498
|
+
area: Ce(r == null ? void 0 : r.area, t),
|
|
584
499
|
opacity: r == null ? void 0 : r.opacity,
|
|
585
500
|
zIndex: r == null ? void 0 : r.zIndex,
|
|
586
501
|
isSplit: r == null ? void 0 : r.isSplit,
|
|
@@ -603,26 +518,31 @@ function we(r = {}, e = 0, t = void 0) {
|
|
|
603
518
|
gridTotal: r == null ? void 0 : r.gridTotal,
|
|
604
519
|
tileSize: r == null ? void 0 : r.tileSize,
|
|
605
520
|
decimalPlaces: r == null ? void 0 : r.decimalPlaces,
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
sourceArea: r == null ? void 0 : r.sourceArea
|
|
521
|
+
sourceProjectionCrs: r == null ? void 0 : r.sourceProjectionCrs,
|
|
522
|
+
sourceProjection: r == null ? void 0 : r.sourceProjection
|
|
609
523
|
};
|
|
610
524
|
}
|
|
611
|
-
function
|
|
525
|
+
function xt(r) {
|
|
612
526
|
return !!(r && typeof r.getEngineType == "function" && typeof r.getMapInstance == "function" && typeof r.upsertImageLayer == "function" && typeof r.showImageLayer == "function" && typeof r.hideImageLayer == "function" && typeof r.removeImageLayer == "function");
|
|
613
527
|
}
|
|
614
|
-
class
|
|
528
|
+
class pn {
|
|
615
529
|
constructor(e = {}) {
|
|
616
530
|
this.options = {
|
|
617
531
|
visible: e.visible ?? !0,
|
|
618
|
-
opacity:
|
|
619
|
-
zIndex:
|
|
620
|
-
defaultArea:
|
|
621
|
-
gridTotal:
|
|
622
|
-
tileSize:
|
|
623
|
-
decimalPlaces:
|
|
532
|
+
opacity: F(e.opacity, 0.85),
|
|
533
|
+
zIndex: F(e.zIndex, 650),
|
|
534
|
+
defaultArea: Ce(e.defaultArea),
|
|
535
|
+
gridTotal: F(e.gridTotal, 4),
|
|
536
|
+
tileSize: F(e.tileSize, 512),
|
|
537
|
+
decimalPlaces: F(e.decimalPlaces, 2),
|
|
624
538
|
imageSourceType: e.imageSourceType || "color",
|
|
625
539
|
colorize: e.colorize || null,
|
|
540
|
+
// 控制器级配置属于当前图层的显式覆盖;不填时才由
|
|
541
|
+
// BaseGIS 默认值或 GeoTIFF GeoKey 决定。
|
|
542
|
+
sourceProjectionCrs: ze(
|
|
543
|
+
e.sourceProjectionCrs,
|
|
544
|
+
e.sourceProjection
|
|
545
|
+
),
|
|
626
546
|
layerId: e.layerId || "image-layer-default"
|
|
627
547
|
}, this.baseGIS = null, this.items = [], this.activeIndex = -1, this.visible = this.options.visible, this.layerType = "unknown", this.currentPayload = null, this._operationRequestId = 0, (e.mapCore || e.baseGIS) && this.mount(e.mapCore || e.baseGIS);
|
|
628
548
|
}
|
|
@@ -632,38 +552,34 @@ class kr {
|
|
|
632
552
|
*/
|
|
633
553
|
mount(e) {
|
|
634
554
|
var t, n;
|
|
635
|
-
return
|
|
555
|
+
return xt(e) ? (this._operationRequestId += 1, this.baseGIS = e, p(
|
|
636
556
|
{ engineType: ((n = (t = this.baseGIS).getEngineType) == null ? void 0 : n.call(t)) || "unknown" },
|
|
637
557
|
"ImageLayerController mounted with BaseGIS."
|
|
638
|
-
)) :
|
|
558
|
+
)) : m(
|
|
639
559
|
"ImageLayerController mount requires BaseGIS instance.",
|
|
640
560
|
"INVALID_MOUNT_TARGET"
|
|
641
561
|
);
|
|
642
562
|
}
|
|
643
563
|
resolveBaseGIS() {
|
|
644
564
|
var e, t;
|
|
645
|
-
return this.baseGIS ? (t = (e = this.baseGIS).getMapInstance) != null && t.call(e) ?
|
|
565
|
+
return this.baseGIS ? (t = (e = this.baseGIS).getMapInstance) != null && t.call(e) ? p(null, "BaseGIS is ready.") : m(
|
|
646
566
|
"Map instance is not ready. Please call mapCore.init() first.",
|
|
647
567
|
"NOT_INITIALIZED"
|
|
648
|
-
) :
|
|
568
|
+
) : m("ImageLayerController has not been mounted.", "NOT_MOUNTED");
|
|
649
569
|
}
|
|
650
570
|
getLayerId(e = {}) {
|
|
651
571
|
return typeof e == "string" && e ? e : (e == null ? void 0 : e.layerId) || this.options.layerId;
|
|
652
572
|
}
|
|
653
|
-
/* 获取图片图层目标投影 */
|
|
654
|
-
getTargetProjectionFn(e = {}) {
|
|
655
|
-
var s, i, a, o, u, l, c, h, y;
|
|
656
|
-
if (e.targetProjection)
|
|
657
|
-
return J(e.targetProjection);
|
|
658
|
-
const t = (i = (s = this.baseGIS) == null ? void 0 : s.getMapInstance) == null ? void 0 : i.call(s), n = ((o = (a = t == null ? void 0 : t.options) == null ? void 0 : a.crs) == null ? void 0 : o.code) || ((c = (l = (u = t == null ? void 0 : t.options) == null ? void 0 : u.crs) == null ? void 0 : l.options) == null ? void 0 : c.code);
|
|
659
|
-
return n ? J(n) : (((y = (h = this.baseGIS) == null ? void 0 : h.getEngineType) == null ? void 0 : y.call(h)) === "leaflet", "EPSG:4326");
|
|
660
|
-
}
|
|
661
573
|
buildLayerPayload(e, t = {}) {
|
|
574
|
+
const s = ze(
|
|
575
|
+
e.sourceProjectionCrs,
|
|
576
|
+
e.sourceProjection
|
|
577
|
+
) || this.options.sourceProjectionCrs;
|
|
662
578
|
return {
|
|
663
579
|
layerId: this.getLayerId(t),
|
|
664
580
|
imageUrl: e.imageUrl,
|
|
665
581
|
tifUrl: e.tifUrl,
|
|
666
|
-
area:
|
|
582
|
+
area: Ce(e.area, this.options.defaultArea),
|
|
667
583
|
isSplit: !!e.isSplit,
|
|
668
584
|
imageSourceType: e.imageSourceType || this.options.imageSourceType,
|
|
669
585
|
isGrayImage: e.isGrayImage,
|
|
@@ -677,15 +593,18 @@ class kr {
|
|
|
677
593
|
type: e.type,
|
|
678
594
|
colorStops: e.colorStops,
|
|
679
595
|
colors: e.colors,
|
|
596
|
+
sourceProjectionCrs: s,
|
|
597
|
+
// 暂时同步旧字段,保证尚未升级的引擎适配层和已有业务调用继续工作。
|
|
598
|
+
sourceProjection: s,
|
|
680
599
|
showProbe: e.showProbe,
|
|
681
600
|
enableProbe: e.enableProbe,
|
|
682
601
|
showMouseProbe: e.showMouseProbe,
|
|
683
602
|
showLabel: !!e.showLabel,
|
|
684
|
-
gridTotal:
|
|
685
|
-
tileSize:
|
|
686
|
-
decimalPlaces:
|
|
687
|
-
opacity:
|
|
688
|
-
zIndex:
|
|
603
|
+
gridTotal: F(e.gridTotal, this.options.gridTotal),
|
|
604
|
+
tileSize: F(e.tileSize, this.options.tileSize),
|
|
605
|
+
decimalPlaces: F(e.decimalPlaces, this.options.decimalPlaces),
|
|
606
|
+
opacity: F(e.opacity, this.options.opacity),
|
|
607
|
+
zIndex: F(e.zIndex, this.options.zIndex),
|
|
689
608
|
visible: typeof t.visible == "boolean" ? t.visible : this.visible
|
|
690
609
|
};
|
|
691
610
|
}
|
|
@@ -695,10 +614,10 @@ class kr {
|
|
|
695
614
|
*/
|
|
696
615
|
async load(e = [], t = {}) {
|
|
697
616
|
if (!Array.isArray(e) || e.length === 0)
|
|
698
|
-
return
|
|
699
|
-
const n = e.map((i,
|
|
617
|
+
return m("Image list is empty.", "INVALID_ITEMS");
|
|
618
|
+
const n = e.map((i, o) => ke(i, o, this.options.defaultArea)).filter((i) => i.imageUrl || i.tifUrl);
|
|
700
619
|
if (n.length === 0)
|
|
701
|
-
return
|
|
620
|
+
return m("No valid imageUrl or tifUrl found in items.", "INVALID_ITEMS");
|
|
702
621
|
this.items = n, typeof t.visible == "boolean" && (this.visible = t.visible);
|
|
703
622
|
const s = Number.isInteger(t.index) ? t.index : 0;
|
|
704
623
|
return this.switchTo(s);
|
|
@@ -708,26 +627,23 @@ class kr {
|
|
|
708
627
|
* target 可传索引数字,也可传图片 id。
|
|
709
628
|
*/
|
|
710
629
|
async switchTo(e) {
|
|
711
|
-
var
|
|
630
|
+
var u, l;
|
|
712
631
|
const t = this.resolveBaseGIS();
|
|
713
632
|
if (!t.success)
|
|
714
633
|
return t;
|
|
715
634
|
if (!Array.isArray(this.items) || this.items.length === 0)
|
|
716
|
-
return
|
|
635
|
+
return m("Image list has not been loaded.", "NOT_LOADED");
|
|
717
636
|
let n = -1;
|
|
718
|
-
if (typeof e == "number" ? n = e : typeof e == "string" && (n = this.items.findIndex((
|
|
719
|
-
return
|
|
720
|
-
const s = this.items[n], i = await
|
|
721
|
-
|
|
722
|
-
targetProjection: this.getTargetProjectionFn(s)
|
|
723
|
-
}), a = this.buildLayerPayload(i), o = ++this._operationRequestId, u = await this.baseGIS.upsertImageLayer(a);
|
|
724
|
-
return o !== this._operationRequestId || (l = u == null ? void 0 : u.data) != null && l.stale ? m(
|
|
637
|
+
if (typeof e == "number" ? n = e : typeof e == "string" && (n = this.items.findIndex((c) => c.id === e)), n < 0 || n >= this.items.length)
|
|
638
|
+
return m(`Invalid image target "${e}".`, "INVALID_TARGET");
|
|
639
|
+
const s = this.items[n], i = this.buildLayerPayload(s), o = ++this._operationRequestId, a = await this.baseGIS.upsertImageLayer(i);
|
|
640
|
+
return o !== this._operationRequestId || (u = a == null ? void 0 : a.data) != null && u.stale ? p(
|
|
725
641
|
{ stale: !0, ignored: !0 },
|
|
726
642
|
`Image switch to "${s.name}" was superseded.`
|
|
727
|
-
) :
|
|
728
|
-
{ activeIndex: n, activeItem:
|
|
729
|
-
`Image switched to "${
|
|
730
|
-
)) :
|
|
643
|
+
) : a.success ? (this.activeIndex = n, this.layerType = ((l = a == null ? void 0 : a.data) == null ? void 0 : l.layerType) || this.layerType, this.currentPayload = i, p(
|
|
644
|
+
{ activeIndex: n, activeItem: s },
|
|
645
|
+
`Image switched to "${s.name}".`
|
|
646
|
+
)) : a;
|
|
731
647
|
}
|
|
732
648
|
/**
|
|
733
649
|
* 更新当前图片图层数据。
|
|
@@ -736,43 +652,42 @@ class kr {
|
|
|
736
652
|
* 与 load(items) 不同,update(payload) 不要求维护图片数组,也不表达 next / prev 两态。
|
|
737
653
|
*/
|
|
738
654
|
async update(e = {}) {
|
|
739
|
-
var
|
|
655
|
+
var l, c;
|
|
740
656
|
const t = this.resolveBaseGIS();
|
|
741
657
|
if (!t.success)
|
|
742
658
|
return t;
|
|
743
|
-
const n = this.items[this.activeIndex] || {}, s = this.activeIndex >= 0 ? this.activeIndex : 0, i =
|
|
659
|
+
const n = this.items[this.activeIndex] || {}, s = this.activeIndex >= 0 ? this.activeIndex : 0, i = ke(
|
|
744
660
|
{
|
|
745
661
|
...n,
|
|
746
|
-
...e
|
|
747
|
-
targetProjection: this.getTargetProjectionFn(e)
|
|
662
|
+
...e
|
|
748
663
|
},
|
|
749
664
|
s,
|
|
750
665
|
this.options.defaultArea
|
|
751
666
|
);
|
|
752
667
|
if (!i.imageUrl && !i.tifUrl)
|
|
753
|
-
return
|
|
668
|
+
return m("Image layer update requires imageUrl or tifUrl.", "INVALID_ITEM");
|
|
754
669
|
typeof e.visible == "boolean" && (this.visible = e.visible);
|
|
755
|
-
const
|
|
756
|
-
return
|
|
670
|
+
const o = this.buildLayerPayload(i, e), a = ++this._operationRequestId, u = await this.baseGIS.upsertImageLayer(o);
|
|
671
|
+
return a !== this._operationRequestId || (l = u == null ? void 0 : u.data) != null && l.stale ? p(
|
|
757
672
|
{ stale: !0, ignored: !0 },
|
|
758
673
|
`Image layer update "${i.name}" was superseded.`
|
|
759
|
-
) :
|
|
674
|
+
) : u.success ? (this.items.length === 0 ? (this.items = [i], this.activeIndex = 0) : (this.items.splice(s, 1, i), this.activeIndex = s), this.layerType = ((c = u == null ? void 0 : u.data) == null ? void 0 : c.layerType) || this.layerType, this.currentPayload = o, p(
|
|
760
675
|
{
|
|
761
676
|
activeIndex: this.activeIndex,
|
|
762
|
-
activeItem:
|
|
677
|
+
activeItem: i
|
|
763
678
|
},
|
|
764
|
-
`Image layer updated: "${
|
|
765
|
-
)) :
|
|
679
|
+
`Image layer updated: "${i.name}".`
|
|
680
|
+
)) : u;
|
|
766
681
|
}
|
|
767
682
|
async next() {
|
|
768
683
|
if (!this.items.length)
|
|
769
|
-
return
|
|
684
|
+
return m("Image list has not been loaded.", "NOT_LOADED");
|
|
770
685
|
const e = this.activeIndex < 0 ? 0 : (this.activeIndex + 1) % this.items.length;
|
|
771
686
|
return this.switchTo(e);
|
|
772
687
|
}
|
|
773
688
|
async prev() {
|
|
774
689
|
if (!this.items.length)
|
|
775
|
-
return
|
|
690
|
+
return m("Image list has not been loaded.", "NOT_LOADED");
|
|
776
691
|
const e = this.activeIndex < 0 ? this.items.length - 1 : (this.activeIndex - 1 + this.items.length) % this.items.length;
|
|
777
692
|
return this.switchTo(e);
|
|
778
693
|
}
|
|
@@ -800,11 +715,11 @@ class kr {
|
|
|
800
715
|
*/
|
|
801
716
|
destroy(e = {}) {
|
|
802
717
|
if (this._operationRequestId += 1, !this.resolveBaseGIS().success)
|
|
803
|
-
return this.items = [], this.activeIndex = -1, this.layerType = "unknown", this.currentPayload = null,
|
|
718
|
+
return this.items = [], this.activeIndex = -1, this.layerType = "unknown", this.currentPayload = null, p(null, "Image layer controller destroyed (local state only).");
|
|
804
719
|
const n = this.baseGIS.removeImageLayer({
|
|
805
720
|
layerId: this.getLayerId(e)
|
|
806
721
|
});
|
|
807
|
-
return this.items = [], this.activeIndex = -1, this.layerType = "unknown", this.currentPayload = null, n.success ?
|
|
722
|
+
return this.items = [], this.activeIndex = -1, this.layerType = "unknown", this.currentPayload = null, n.success ? p(null, "Image layer controller destroyed.") : n;
|
|
808
723
|
}
|
|
809
724
|
getState() {
|
|
810
725
|
var e, t;
|
|
@@ -820,79 +735,79 @@ class kr {
|
|
|
820
735
|
};
|
|
821
736
|
}
|
|
822
737
|
}
|
|
823
|
-
const
|
|
738
|
+
const Et = {
|
|
824
739
|
color: "#2f80ff",
|
|
825
740
|
width: 3,
|
|
826
741
|
opacity: 1,
|
|
827
742
|
pattern: "solid",
|
|
828
743
|
dashLength: 12,
|
|
829
744
|
gapLength: 8
|
|
830
|
-
},
|
|
745
|
+
}, At = {
|
|
831
746
|
enabled: !1,
|
|
832
747
|
mode: "reveal",
|
|
833
748
|
durationMs: 1e4,
|
|
834
749
|
autoplay: !0,
|
|
835
750
|
loop: !1
|
|
836
751
|
};
|
|
837
|
-
function
|
|
752
|
+
function oe(r, e) {
|
|
838
753
|
return Object.prototype.hasOwnProperty.call(r || {}, e);
|
|
839
754
|
}
|
|
840
|
-
function
|
|
755
|
+
function R(r) {
|
|
841
756
|
return !!(r && typeof r == "object" && !Array.isArray(r));
|
|
842
757
|
}
|
|
843
|
-
function
|
|
844
|
-
return Array.isArray(r) ? { lines: r } :
|
|
758
|
+
function Z(r = {}) {
|
|
759
|
+
return Array.isArray(r) ? { lines: r } : R(r) ? r : {};
|
|
845
760
|
}
|
|
846
|
-
function
|
|
847
|
-
if (!
|
|
761
|
+
function Rt(r, e) {
|
|
762
|
+
if (!R(e))
|
|
848
763
|
return e;
|
|
849
|
-
const t =
|
|
764
|
+
const t = R(r) ? r : {};
|
|
850
765
|
return {
|
|
851
766
|
...t,
|
|
852
767
|
...e,
|
|
853
|
-
flow:
|
|
854
|
-
...
|
|
768
|
+
flow: R(e.flow) ? {
|
|
769
|
+
...R(t.flow) ? t.flow : {},
|
|
855
770
|
...e.flow
|
|
856
771
|
} : e.flow ?? t.flow
|
|
857
772
|
};
|
|
858
773
|
}
|
|
859
|
-
function
|
|
860
|
-
if (!
|
|
861
|
-
return { ...
|
|
774
|
+
function ct(r = {}, e = {}) {
|
|
775
|
+
if (!R(e))
|
|
776
|
+
return { ...R(r) ? r : {} };
|
|
862
777
|
const t = {
|
|
863
|
-
...
|
|
778
|
+
...R(r) ? r : {},
|
|
864
779
|
...e
|
|
865
780
|
};
|
|
866
|
-
return
|
|
781
|
+
return oe(e, "color") && (t.color = Rt(r == null ? void 0 : r.color, e.color)), t.weight !== void 0 && !oe(e, "width") && (t.width = t.weight), t;
|
|
867
782
|
}
|
|
868
|
-
function
|
|
869
|
-
return
|
|
870
|
-
...
|
|
783
|
+
function ht(r = {}, e = {}) {
|
|
784
|
+
return R(e) ? {
|
|
785
|
+
...R(r) ? r : {},
|
|
871
786
|
...e,
|
|
872
|
-
icon:
|
|
873
|
-
...
|
|
787
|
+
icon: R(e.icon) ? {
|
|
788
|
+
...R(r == null ? void 0 : r.icon) ? r.icon : {},
|
|
874
789
|
...e.icon
|
|
875
790
|
} : e.icon ?? (r == null ? void 0 : r.icon)
|
|
876
|
-
} : { ...
|
|
791
|
+
} : { ...R(r) ? r : {} };
|
|
877
792
|
}
|
|
878
|
-
function
|
|
879
|
-
const t =
|
|
793
|
+
function Ie(r = {}, e = {}) {
|
|
794
|
+
const t = Z(r), n = Z(e), s = {
|
|
880
795
|
...t,
|
|
881
796
|
...n
|
|
882
797
|
};
|
|
883
|
-
return s.style =
|
|
798
|
+
return s.style = ct(t.style, oe(n, "style") ? n.style : {}), s.animation = ht(
|
|
884
799
|
t.animation,
|
|
885
|
-
|
|
800
|
+
oe(n, "animation") ? n.animation : {}
|
|
886
801
|
), s;
|
|
887
802
|
}
|
|
888
|
-
function
|
|
803
|
+
function Dt(r = {}) {
|
|
889
804
|
const { mapCore: e, baseGIS: t, ...n } = r;
|
|
890
805
|
return n;
|
|
891
806
|
}
|
|
892
|
-
function
|
|
807
|
+
function Ft(r, e = "style.color") {
|
|
893
808
|
if (typeof r == "string" && r.trim())
|
|
894
809
|
return "";
|
|
895
|
-
if (!
|
|
810
|
+
if (!R(r) || r.type !== "gradient")
|
|
896
811
|
return `${e} must be a CSS color string or a gradient object.`;
|
|
897
812
|
if (!Array.isArray(r.stops) || r.stops.length < 2)
|
|
898
813
|
return `${e}.stops requires at least two gradient stops.`;
|
|
@@ -905,7 +820,7 @@ function gt(r, e = "style.color") {
|
|
|
905
820
|
return `${e}.stops[${n}].color must be a CSS color string.`;
|
|
906
821
|
t = i;
|
|
907
822
|
}
|
|
908
|
-
if (
|
|
823
|
+
if (R(r.flow) && r.flow.enabled === !0) {
|
|
909
824
|
const n = Number(r.flow.durationMs ?? 2400);
|
|
910
825
|
if (!Number.isFinite(n) || n <= 0)
|
|
911
826
|
return `${e}.flow.durationMs must be greater than 0.`;
|
|
@@ -914,17 +829,17 @@ function gt(r, e = "style.color") {
|
|
|
914
829
|
}
|
|
915
830
|
return "";
|
|
916
831
|
}
|
|
917
|
-
function
|
|
918
|
-
if (!
|
|
832
|
+
function dt(r = {}, e = "style") {
|
|
833
|
+
if (!R(r))
|
|
919
834
|
return `${e} must be an object.`;
|
|
920
835
|
if (r.pattern !== void 0 && !["solid", "dashed"].includes(r.pattern))
|
|
921
836
|
return `${e}.pattern must be "solid" or "dashed".`;
|
|
922
837
|
for (const t of ["width", "dashLength", "gapLength"])
|
|
923
838
|
if (r[t] !== void 0 && (!Number.isFinite(Number(r[t])) || Number(r[t]) <= 0))
|
|
924
839
|
return `${e}.${t} must be greater than 0.`;
|
|
925
|
-
return r.opacity !== void 0 && (!Number.isFinite(Number(r.opacity)) || Number(r.opacity) < 0 || Number(r.opacity) > 1) ? `${e}.opacity must be between 0 and 1.` : r.color === void 0 ? "" :
|
|
840
|
+
return r.opacity !== void 0 && (!Number.isFinite(Number(r.opacity)) || Number(r.opacity) < 0 || Number(r.opacity) > 1) ? `${e}.opacity must be between 0 and 1.` : r.color === void 0 ? "" : Ft(r.color, `${e}.color`);
|
|
926
841
|
}
|
|
927
|
-
function
|
|
842
|
+
function Bt(r) {
|
|
928
843
|
if (!Array.isArray(r) || r.length === 0)
|
|
929
844
|
return "Line layer requires a non-empty lines array.";
|
|
930
845
|
const e = /* @__PURE__ */ new Set();
|
|
@@ -937,18 +852,18 @@ function mt(r) {
|
|
|
937
852
|
if (e.add(String(s)), !Array.isArray(n.positions) || n.positions.length < 2)
|
|
938
853
|
return `lines[${t}].positions requires at least two coordinates.`;
|
|
939
854
|
for (let i = 0; i < n.positions.length; i += 1) {
|
|
940
|
-
const
|
|
941
|
-
if (!Array.isArray(
|
|
855
|
+
const o = n.positions[i], a = Number(o == null ? void 0 : o[0]), u = Number(o == null ? void 0 : o[1]), l = (o == null ? void 0 : o.length) > 2 ? Number(o[2]) : 0;
|
|
856
|
+
if (!Array.isArray(o) || !Number.isFinite(a) || !Number.isFinite(u) || u < -90 || u > 90 || !Number.isFinite(l))
|
|
942
857
|
return `lines[${t}].positions[${i}] must be [longitude, latitude, height?].`;
|
|
943
858
|
}
|
|
944
859
|
if (n.style !== void 0) {
|
|
945
|
-
const i =
|
|
860
|
+
const i = dt(n.style, `lines[${t}].style`);
|
|
946
861
|
if (i) return i;
|
|
947
862
|
}
|
|
948
863
|
}
|
|
949
864
|
return "";
|
|
950
865
|
}
|
|
951
|
-
function
|
|
866
|
+
function Ot(r = {}, e = []) {
|
|
952
867
|
if (!(r != null && r.enabled))
|
|
953
868
|
return "";
|
|
954
869
|
if (r.mode !== void 0 && r.mode !== "reveal")
|
|
@@ -959,7 +874,7 @@ function bt(r = {}, e = []) {
|
|
|
959
874
|
if (!r.lineId || !e.some((n) => String(n.id) === String(r.lineId)))
|
|
960
875
|
return "animation.lineId must match an existing line id.";
|
|
961
876
|
if (r.icon !== void 0 && r.icon !== null) {
|
|
962
|
-
if (!
|
|
877
|
+
if (!R(r.icon))
|
|
963
878
|
return "animation.icon must be an object.";
|
|
964
879
|
if (r.icon.url !== void 0 && typeof r.icon.url != "string")
|
|
965
880
|
return "animation.icon.url must be a string.";
|
|
@@ -968,7 +883,7 @@ function bt(r = {}, e = []) {
|
|
|
968
883
|
}
|
|
969
884
|
return "";
|
|
970
885
|
}
|
|
971
|
-
function
|
|
886
|
+
function ge(r = {}) {
|
|
972
887
|
var e, t;
|
|
973
888
|
return !((e = r.animation) != null && e.enabled) || r.animation.lineId || ((t = r.lines) == null ? void 0 : t.length) !== 1 ? r : {
|
|
974
889
|
...r,
|
|
@@ -978,28 +893,28 @@ function se(r = {}) {
|
|
|
978
893
|
}
|
|
979
894
|
};
|
|
980
895
|
}
|
|
981
|
-
function
|
|
982
|
-
const e =
|
|
896
|
+
function We(r = {}) {
|
|
897
|
+
const e = Bt(r.lines);
|
|
983
898
|
if (e) return e;
|
|
984
899
|
for (const n of r.lines) {
|
|
985
|
-
const s =
|
|
900
|
+
const s = Lt(n, r);
|
|
986
901
|
if (s) return s;
|
|
987
902
|
}
|
|
988
|
-
const t =
|
|
989
|
-
return t ||
|
|
903
|
+
const t = dt(r.style);
|
|
904
|
+
return t || Ot(r.animation, r.lines);
|
|
990
905
|
}
|
|
991
|
-
function
|
|
906
|
+
function jt(r) {
|
|
992
907
|
return !!(r && typeof r.getEngineType == "function" && typeof r.getMapInstance == "function" && typeof r.upsertLineLayer == "function" && typeof r.updateLineLayer == "function" && typeof r.showLineLayer == "function" && typeof r.hideLineLayer == "function" && typeof r.clearLineLayer == "function" && typeof r.removeLineLayer == "function" && typeof r.getLineLayerState == "function" && typeof r.playLineAnimation == "function" && typeof r.pauseLineAnimation == "function" && typeof r.restartLineAnimation == "function");
|
|
993
908
|
}
|
|
994
|
-
class
|
|
909
|
+
class Sn {
|
|
995
910
|
constructor(e = {}) {
|
|
996
|
-
const t =
|
|
997
|
-
this.baseGIS = null, this.visible = t.visible !== !1, this.layerType = "unknown", this.defaultPayload =
|
|
911
|
+
const t = Dt(e), n = t.lineLayerId || t.layerId || t.id || "line-default";
|
|
912
|
+
this.baseGIS = null, this.visible = t.visible !== !1, this.layerType = "unknown", this.defaultPayload = ge({
|
|
998
913
|
...t,
|
|
999
914
|
layerId: n,
|
|
1000
915
|
visible: this.visible,
|
|
1001
|
-
style:
|
|
1002
|
-
animation:
|
|
916
|
+
style: ct(Et, t.style || {}),
|
|
917
|
+
animation: ht(At, t.animation || {})
|
|
1003
918
|
}), this.currentPayload = null, this.currentState = {
|
|
1004
919
|
layerId: n,
|
|
1005
920
|
visible: this.visible,
|
|
@@ -1014,64 +929,64 @@ class Wr {
|
|
|
1014
929
|
}
|
|
1015
930
|
mount(e) {
|
|
1016
931
|
var t;
|
|
1017
|
-
return
|
|
932
|
+
return jt(e) ? (this.baseGIS = e, p(
|
|
1018
933
|
{ engineType: ((t = e.getEngineType) == null ? void 0 : t.call(e)) || "unknown" },
|
|
1019
934
|
"LineLayerController mounted with BaseGIS."
|
|
1020
|
-
)) :
|
|
935
|
+
)) : m(
|
|
1021
936
|
"LineLayerController mount requires BaseGIS instance.",
|
|
1022
937
|
"INVALID_MOUNT_TARGET"
|
|
1023
938
|
);
|
|
1024
939
|
}
|
|
1025
940
|
resolveBaseGIS() {
|
|
1026
941
|
var e, t;
|
|
1027
|
-
return this.baseGIS ? (t = (e = this.baseGIS).getMapInstance) != null && t.call(e) ?
|
|
942
|
+
return this.baseGIS ? (t = (e = this.baseGIS).getMapInstance) != null && t.call(e) ? p(null, "BaseGIS is ready.") : m(
|
|
1028
943
|
"Map instance is not ready. Please call mapCore.init() first.",
|
|
1029
944
|
"NOT_INITIALIZED"
|
|
1030
|
-
) :
|
|
945
|
+
) : m("LineLayerController has not been mounted.", "NOT_MOUNTED");
|
|
1031
946
|
}
|
|
1032
947
|
getLayerId(e = {}) {
|
|
1033
948
|
var t;
|
|
1034
949
|
return typeof e == "string" || typeof e == "number" ? String(e) : e.lineLayerId || e.layerId || e.id || ((t = this.currentPayload) == null ? void 0 : t.layerId) || this.defaultPayload.layerId;
|
|
1035
950
|
}
|
|
1036
951
|
buildPayload(e = {}) {
|
|
1037
|
-
const t =
|
|
1038
|
-
return n.layerId = this.getLayerId(n), n.visible =
|
|
952
|
+
const t = Z(e), n = Ie(this.defaultPayload, t);
|
|
953
|
+
return n.layerId = this.getLayerId(n), n.visible = oe(t, "visible") ? t.visible !== !1 : this.visible, ge(n);
|
|
1039
954
|
}
|
|
1040
955
|
syncStateFromResult(e) {
|
|
1041
|
-
var s, i,
|
|
956
|
+
var s, i, o, a;
|
|
1042
957
|
const t = ((s = e == null ? void 0 : e.data) == null ? void 0 : s.state) || (e == null ? void 0 : e.data);
|
|
1043
958
|
if (!t || typeof t != "object") return;
|
|
1044
|
-
const n = (
|
|
1045
|
-
this.layerType = ((
|
|
959
|
+
const n = (o = (i = this.baseGIS) == null ? void 0 : i.getEngineType) == null ? void 0 : o.call(i);
|
|
960
|
+
this.layerType = ((a = e == null ? void 0 : e.data) == null ? void 0 : a.layerType) || (this.currentPayload && ["cesium", "leaflet"].includes(n) ? `${n}-line-layer` : this.layerType), this.currentState = {
|
|
1046
961
|
...this.currentState,
|
|
1047
962
|
...t
|
|
1048
963
|
}, typeof t.visible == "boolean" && (this.visible = t.visible);
|
|
1049
964
|
}
|
|
1050
965
|
async load(e = {}, t = {}) {
|
|
1051
|
-
var
|
|
966
|
+
var a;
|
|
1052
967
|
const n = this.resolveBaseGIS();
|
|
1053
968
|
if (!n.success) return n;
|
|
1054
969
|
const s = this.buildPayload(
|
|
1055
|
-
|
|
1056
|
-
), i =
|
|
970
|
+
Ie(Z(e), Z(t))
|
|
971
|
+
), i = We(s);
|
|
1057
972
|
if (i)
|
|
1058
|
-
return
|
|
1059
|
-
const
|
|
1060
|
-
return
|
|
973
|
+
return m(i, "INVALID_LINE_LAYER_PAYLOAD");
|
|
974
|
+
const o = await this.baseGIS.upsertLineLayer(s);
|
|
975
|
+
return o.success && (this.currentPayload = s, this.visible = s.visible !== !1, this.layerType = ((a = o == null ? void 0 : o.data) == null ? void 0 : a.layerType) || this.layerType, this.syncStateFromResult(o)), o;
|
|
1061
976
|
}
|
|
1062
977
|
async update(e = {}) {
|
|
1063
|
-
var
|
|
978
|
+
var o;
|
|
1064
979
|
const t = this.resolveBaseGIS();
|
|
1065
980
|
if (!t.success) return t;
|
|
1066
981
|
if (!this.currentPayload)
|
|
1067
|
-
return
|
|
1068
|
-
const n =
|
|
1069
|
-
|
|
1070
|
-
), s =
|
|
982
|
+
return m("Line layer has not been loaded.", "NOT_LOADED");
|
|
983
|
+
const n = ge(
|
|
984
|
+
Ie(this.currentPayload, Z(e))
|
|
985
|
+
), s = We(n);
|
|
1071
986
|
if (s)
|
|
1072
|
-
return
|
|
987
|
+
return m(s, "INVALID_LINE_LAYER_PAYLOAD");
|
|
1073
988
|
const i = await this.baseGIS.updateLineLayer(n);
|
|
1074
|
-
return i.success && (this.currentPayload = n, this.visible = n.visible !== !1, this.layerType = ((
|
|
989
|
+
return i.success && (this.currentPayload = n, this.visible = n.visible !== !1, this.layerType = ((o = i == null ? void 0 : i.data) == null ? void 0 : o.layerType) || this.layerType, this.syncStateFromResult(i)), i;
|
|
1075
990
|
}
|
|
1076
991
|
show(e = {}) {
|
|
1077
992
|
const t = this.resolveBaseGIS();
|
|
@@ -1099,9 +1014,9 @@ class Wr {
|
|
|
1099
1014
|
const t = this.resolveBaseGIS();
|
|
1100
1015
|
if (!t.success) return t;
|
|
1101
1016
|
if (e !== null && !Number.isFinite(e))
|
|
1102
|
-
return
|
|
1017
|
+
return m("currentTime must be a finite timestamp in milliseconds or null.");
|
|
1103
1018
|
if (typeof this.baseGIS.setLineLayerTime != "function")
|
|
1104
|
-
return
|
|
1019
|
+
return m("Current BaseGIS does not support setLineLayerTime.");
|
|
1105
1020
|
const n = this.baseGIS.setLineLayerTime({ layerId: this.getLayerId(), currentTime: e });
|
|
1106
1021
|
return n.success && (this.currentPayload && (this.currentPayload.currentTime = e), this.currentState.currentTime = e), n;
|
|
1107
1022
|
}
|
|
@@ -1168,22 +1083,22 @@ class Wr {
|
|
|
1168
1083
|
}
|
|
1169
1084
|
destroy(e = {}) {
|
|
1170
1085
|
if (!this.resolveBaseGIS().success)
|
|
1171
|
-
return this.resetLocalState(),
|
|
1086
|
+
return this.resetLocalState(), p(null, "Line layer controller destroyed (local state only).");
|
|
1172
1087
|
const n = this.baseGIS.removeLineLayer({
|
|
1173
1088
|
...e,
|
|
1174
1089
|
layerId: this.getLayerId(e)
|
|
1175
1090
|
});
|
|
1176
|
-
return this.resetLocalState(), n.success ?
|
|
1091
|
+
return this.resetLocalState(), n.success ? p(null, "Line layer controller destroyed.") : n;
|
|
1177
1092
|
}
|
|
1178
1093
|
getState() {
|
|
1179
|
-
var e, t, n, s, i,
|
|
1094
|
+
var e, t, n, s, i, o;
|
|
1180
1095
|
if ((t = (e = this.baseGIS) == null ? void 0 : e.getMapInstance) != null && t.call(e) && this.currentPayload) {
|
|
1181
|
-
const
|
|
1182
|
-
|
|
1096
|
+
const a = (s = (n = this.baseGIS).getLineLayerState) == null ? void 0 : s.call(n, { layerId: this.getLayerId() });
|
|
1097
|
+
a != null && a.success && this.syncStateFromResult(a);
|
|
1183
1098
|
}
|
|
1184
1099
|
return {
|
|
1185
1100
|
mounted: !!this.baseGIS,
|
|
1186
|
-
engineType: ((
|
|
1101
|
+
engineType: ((o = (i = this.baseGIS) == null ? void 0 : i.getEngineType) == null ? void 0 : o.call(i)) || "unknown",
|
|
1187
1102
|
layerType: this.layerType,
|
|
1188
1103
|
layerId: this.getLayerId(),
|
|
1189
1104
|
visible: this.visible,
|
|
@@ -1192,23 +1107,23 @@ class Wr {
|
|
|
1192
1107
|
};
|
|
1193
1108
|
}
|
|
1194
1109
|
}
|
|
1195
|
-
const
|
|
1196
|
-
function
|
|
1110
|
+
const ft = ["all", "leader", "group"], yt = ["auto", "view", "bounds"];
|
|
1111
|
+
function A(r) {
|
|
1197
1112
|
return r == null ? "" : String(r).trim();
|
|
1198
1113
|
}
|
|
1199
|
-
function
|
|
1200
|
-
return
|
|
1114
|
+
function _t(r) {
|
|
1115
|
+
return ft.includes(r) ? r : "all";
|
|
1201
1116
|
}
|
|
1202
|
-
function
|
|
1203
|
-
return
|
|
1117
|
+
function be(r) {
|
|
1118
|
+
return yt.includes(r) ? r : "auto";
|
|
1204
1119
|
}
|
|
1205
|
-
function
|
|
1120
|
+
function Vt(r) {
|
|
1206
1121
|
return !!(r && typeof r.getMapInstance == "function" && typeof r.getEngineType == "function" && typeof r.getViewState == "function" && typeof r.onViewChange == "function" && typeof r.setInitialView == "function" && typeof r.fitViewBounds == "function" && typeof r.zoomIn == "function" && typeof r.zoomOut == "function" && typeof r.resetView == "function" && typeof r.resize == "function");
|
|
1207
1122
|
}
|
|
1208
|
-
function
|
|
1123
|
+
function He(r) {
|
|
1209
1124
|
return Number.isFinite(Number(r));
|
|
1210
1125
|
}
|
|
1211
|
-
function
|
|
1126
|
+
function Ye(r, e) {
|
|
1212
1127
|
const t = r.filter((s) => {
|
|
1213
1128
|
var i;
|
|
1214
1129
|
return !((i = s.result) != null && i.success);
|
|
@@ -1218,42 +1133,42 @@ function Me(r, e) {
|
|
|
1218
1133
|
failed: t.length,
|
|
1219
1134
|
results: r
|
|
1220
1135
|
};
|
|
1221
|
-
return t.length === 0 ?
|
|
1136
|
+
return t.length === 0 ? p(n, e) : m(`${e} ${t.length} map(s) failed.`, "MAP_VIEW_LINK_PARTIAL_FAILED", n);
|
|
1222
1137
|
}
|
|
1223
|
-
class
|
|
1138
|
+
class vn {
|
|
1224
1139
|
constructor(e = {}) {
|
|
1225
|
-
this.enabled = e.enabled !== !1, this.realtime = e.realtime !== !1, this.mode =
|
|
1140
|
+
this.enabled = e.enabled !== !1, this.realtime = e.realtime !== !1, this.mode = _t(e.mode), this.strategy = be(e.strategy), this.leaderId = A(e.leaderId), this.activeMapId = A(e.activeMapId || e.leaderId), this.suppressionMs = Math.max(Number(e.suppressionMs) || 220, 32), this.endDelay = Math.max(Number(e.endDelay) || 80, 0);
|
|
1226
1141
|
const t = Number(e.syncInterval);
|
|
1227
1142
|
this.syncInterval = Number.isFinite(t) ? Math.max(t, 0) : 32, this.onStateChange = typeof e.onStateChange == "function" ? e.onStateChange : null, this.entries = /* @__PURE__ */ new Map(), this.suppressedUntil = /* @__PURE__ */ new Map(), this.pendingSourceId = "", this.frameHandle = null, this.frameType = "", this.lastSourceId = "", this.lastSyncedAt = 0, this.lastRealtimeSyncAt = 0, this.interactionSourceId = "", this.sourceReleaseTimer = null, this.destroyed = !1;
|
|
1228
1143
|
}
|
|
1229
1144
|
registerMap(e, t, n = {}) {
|
|
1230
1145
|
var u, l;
|
|
1231
1146
|
if (this.destroyed)
|
|
1232
|
-
return
|
|
1233
|
-
const s =
|
|
1147
|
+
return m("MapViewLinkController has been destroyed.", "CONTROLLER_DESTROYED");
|
|
1148
|
+
const s = A(e);
|
|
1234
1149
|
if (!s)
|
|
1235
|
-
return
|
|
1236
|
-
if (!
|
|
1237
|
-
return
|
|
1150
|
+
return m("Map id is required.", "INVALID_MAP_ID");
|
|
1151
|
+
if (!Vt(t))
|
|
1152
|
+
return m("registerMap requires an initialized BaseGIS instance.", "INVALID_MAP_INSTANCE");
|
|
1238
1153
|
if (!t.getMapInstance())
|
|
1239
|
-
return
|
|
1154
|
+
return m(
|
|
1240
1155
|
`Map "${s}" is not initialized. Please call mapCore.init() first.`,
|
|
1241
1156
|
"MAP_NOT_INITIALIZED"
|
|
1242
1157
|
);
|
|
1243
1158
|
const i = this.entries.get(s);
|
|
1244
1159
|
if (i && i.mapCore !== t && n.replace !== !0)
|
|
1245
|
-
return
|
|
1160
|
+
return m(
|
|
1246
1161
|
`Map id "${s}" is already registered. Pass replace:true to replace it.`,
|
|
1247
1162
|
"MAP_ALREADY_REGISTERED"
|
|
1248
1163
|
);
|
|
1249
1164
|
i && ((u = i.offViewChange) == null || u.call(i), this.entries.delete(s));
|
|
1250
|
-
const
|
|
1165
|
+
const o = {
|
|
1251
1166
|
id: s,
|
|
1252
1167
|
mapCore: t,
|
|
1253
|
-
group:
|
|
1168
|
+
group: A(n.group) || "default",
|
|
1254
1169
|
enabled: n.enabled !== !1,
|
|
1255
1170
|
offViewChange: null
|
|
1256
|
-
},
|
|
1171
|
+
}, a = t.onViewChange({
|
|
1257
1172
|
endDelay: this.endDelay,
|
|
1258
1173
|
// Cesium 的 camera.changed 默认按变化比例触发,无法满足多屏平滑联动。
|
|
1259
1174
|
// 由适配器在用户交互期间逐帧检测,本控制器再通过 syncInterval 合并写入。
|
|
@@ -1262,34 +1177,34 @@ class Yr {
|
|
|
1262
1177
|
onChange: () => this.handleViewChange(s),
|
|
1263
1178
|
onEnd: () => this.handleViewEnd(s)
|
|
1264
1179
|
});
|
|
1265
|
-
return
|
|
1180
|
+
return a != null && a.success ? (o.offViewChange = (l = a.data) == null ? void 0 : l.off, this.entries.set(s, o), this.leaderId || (this.leaderId = s), this.activeMapId || (this.activeMapId = s), this.notifyStateChange("register"), p(
|
|
1266
1181
|
{ id: s, mapCore: t, state: this.getState() },
|
|
1267
1182
|
`Map "${s}" registered for view linking.`
|
|
1268
|
-
)) :
|
|
1183
|
+
)) : a || m(`Failed to listen to map "${s}".`, "LISTENER_FAILED");
|
|
1269
1184
|
}
|
|
1270
1185
|
unregisterMap(e) {
|
|
1271
1186
|
var i;
|
|
1272
|
-
const t =
|
|
1187
|
+
const t = A(e), n = this.entries.get(t);
|
|
1273
1188
|
if (!n)
|
|
1274
|
-
return
|
|
1189
|
+
return m(`Map "${t}" is not registered.`, "MAP_NOT_REGISTERED");
|
|
1275
1190
|
(i = n.offViewChange) == null || i.call(n), this.entries.delete(t), this.suppressedUntil.delete(t);
|
|
1276
1191
|
const s = this.entries.keys().next().value || "";
|
|
1277
|
-
return this.leaderId === t && (this.leaderId = s), this.activeMapId === t && (this.activeMapId = this.leaderId || s), this.pendingSourceId === t && this.cancelPendingSync(), this.interactionSourceId === t && this.releaseInteractionSource(t, 0), this.notifyStateChange("unregister"),
|
|
1192
|
+
return this.leaderId === t && (this.leaderId = s), this.activeMapId === t && (this.activeMapId = this.leaderId || s), this.pendingSourceId === t && this.cancelPendingSync(), this.interactionSourceId === t && this.releaseInteractionSource(t, 0), this.notifyStateChange("unregister"), p(
|
|
1278
1193
|
{ id: t, mapCore: n.mapCore, state: this.getState() },
|
|
1279
1194
|
`Map "${t}" unregistered. The BaseGIS instance was not destroyed.`
|
|
1280
1195
|
);
|
|
1281
1196
|
}
|
|
1282
1197
|
refreshMap(e) {
|
|
1283
|
-
const t =
|
|
1198
|
+
const t = A(e), n = this.entries.get(t);
|
|
1284
1199
|
return n ? this.registerMap(t, n.mapCore, {
|
|
1285
1200
|
group: n.group,
|
|
1286
1201
|
enabled: n.enabled,
|
|
1287
1202
|
replace: !0
|
|
1288
|
-
}) :
|
|
1203
|
+
}) : m(`Map "${t}" is not registered.`, "MAP_NOT_REGISTERED");
|
|
1289
1204
|
}
|
|
1290
1205
|
getMap(e) {
|
|
1291
1206
|
var t;
|
|
1292
|
-
return ((t = this.entries.get(
|
|
1207
|
+
return ((t = this.entries.get(A(e))) == null ? void 0 : t.mapCore) || null;
|
|
1293
1208
|
}
|
|
1294
1209
|
getNativeMap(e) {
|
|
1295
1210
|
var t, n;
|
|
@@ -1304,7 +1219,7 @@ class Yr {
|
|
|
1304
1219
|
return Array.from(this.entries.keys());
|
|
1305
1220
|
}
|
|
1306
1221
|
hasMap(e) {
|
|
1307
|
-
return this.entries.has(
|
|
1222
|
+
return this.entries.has(A(e));
|
|
1308
1223
|
}
|
|
1309
1224
|
forEachMap(e) {
|
|
1310
1225
|
typeof e == "function" && this.entries.forEach((t, n) => e(t.mapCore, n, t));
|
|
@@ -1316,17 +1231,17 @@ class Yr {
|
|
|
1316
1231
|
return this.getMap(this.activeMapId);
|
|
1317
1232
|
}
|
|
1318
1233
|
setLeader(e) {
|
|
1319
|
-
const t =
|
|
1320
|
-
return this.entries.has(t) ? (this.leaderId = t, this.activeMapId = t, this.notifyStateChange("leader"),
|
|
1234
|
+
const t = A(e);
|
|
1235
|
+
return this.entries.has(t) ? (this.leaderId = t, this.activeMapId = t, this.notifyStateChange("leader"), p({ leaderId: t, mapCore: this.getMap(t) }, "View link leader updated.")) : m(`Map "${t}" is not registered.`, "MAP_NOT_REGISTERED");
|
|
1321
1236
|
}
|
|
1322
1237
|
setMode(e) {
|
|
1323
|
-
return
|
|
1238
|
+
return ft.includes(e) ? (this.mode = e, this.notifyStateChange("mode"), p({ mode: e }, "View link mode updated.")) : m("Link mode must be all, leader or group.", "INVALID_LINK_MODE");
|
|
1324
1239
|
}
|
|
1325
1240
|
setStrategy(e) {
|
|
1326
|
-
return
|
|
1241
|
+
return yt.includes(e) ? (this.strategy = e, this.notifyStateChange("strategy"), p({ strategy: e }, "View link strategy updated.")) : m("Link strategy must be auto, view or bounds.", "INVALID_LINK_STRATEGY");
|
|
1327
1242
|
}
|
|
1328
1243
|
setEnabled(e) {
|
|
1329
|
-
return this.enabled = !!e, this.enabled || (this.cancelPendingSync(), this.releaseInteractionSource("", 0)), this.notifyStateChange("enabled"),
|
|
1244
|
+
return this.enabled = !!e, this.enabled || (this.cancelPendingSync(), this.releaseInteractionSource("", 0)), this.notifyStateChange("enabled"), p({ enabled: this.enabled }, `View linking ${this.enabled ? "enabled" : "disabled"}.`);
|
|
1330
1245
|
}
|
|
1331
1246
|
pause() {
|
|
1332
1247
|
return this.setEnabled(!1);
|
|
@@ -1335,15 +1250,15 @@ class Yr {
|
|
|
1335
1250
|
return this.setEnabled(!0);
|
|
1336
1251
|
}
|
|
1337
1252
|
setRealtime(e) {
|
|
1338
|
-
return this.realtime = !!e, this.realtime || this.cancelPendingSync(), this.notifyStateChange("realtime"),
|
|
1253
|
+
return this.realtime = !!e, this.realtime || this.cancelPendingSync(), this.notifyStateChange("realtime"), p({ realtime: this.realtime }, "Realtime view linking updated.");
|
|
1339
1254
|
}
|
|
1340
1255
|
setMapGroup(e, t) {
|
|
1341
|
-
const n = this.entries.get(
|
|
1342
|
-
return n ? (n.group =
|
|
1256
|
+
const n = this.entries.get(A(e));
|
|
1257
|
+
return n ? (n.group = A(t) || "default", this.notifyStateChange("group"), p({ id: n.id, group: n.group }, "Map view link group updated.")) : m(`Map "${A(e)}" is not registered.`, "MAP_NOT_REGISTERED");
|
|
1343
1258
|
}
|
|
1344
1259
|
setMapEnabled(e, t) {
|
|
1345
|
-
const n = this.entries.get(
|
|
1346
|
-
return n ? (n.enabled = !!t, this.notifyStateChange("map-enabled"),
|
|
1260
|
+
const n = this.entries.get(A(e));
|
|
1261
|
+
return n ? (n.enabled = !!t, this.notifyStateChange("map-enabled"), p({ id: n.id, enabled: n.enabled }, "Map view linking state updated.")) : m(`Map "${A(e)}" is not registered.`, "MAP_NOT_REGISTERED");
|
|
1347
1262
|
}
|
|
1348
1263
|
handleViewStart(e) {
|
|
1349
1264
|
this.canUseAsSource(e) && (this.clearSourceReleaseTimer(), this.interactionSourceId = e, this.activeMapId = e);
|
|
@@ -1359,7 +1274,7 @@ class Yr {
|
|
|
1359
1274
|
}
|
|
1360
1275
|
releaseInteractionSource(e, t = 0) {
|
|
1361
1276
|
this.clearSourceReleaseTimer();
|
|
1362
|
-
const n =
|
|
1277
|
+
const n = A(e), s = () => {
|
|
1363
1278
|
this.sourceReleaseTimer = null, (!n || this.interactionSourceId === n) && (this.interactionSourceId = "");
|
|
1364
1279
|
};
|
|
1365
1280
|
t > 0 ? this.sourceReleaseTimer = globalThis.setTimeout(s, t) : s();
|
|
@@ -1396,30 +1311,30 @@ class Yr {
|
|
|
1396
1311
|
return Array.from(this.entries.values()).filter((t) => !(t.id === e.id || !t.enabled || this.mode === "group" && t.group !== e.group));
|
|
1397
1312
|
}
|
|
1398
1313
|
syncFrom(e, t = {}) {
|
|
1399
|
-
var h,
|
|
1400
|
-
const n =
|
|
1314
|
+
var h, d;
|
|
1315
|
+
const n = A(e), s = this.entries.get(n);
|
|
1401
1316
|
if (!s)
|
|
1402
|
-
return
|
|
1317
|
+
return m(`Map "${n}" is not registered.`, "MAP_NOT_REGISTERED");
|
|
1403
1318
|
if (!t.force && !this.canUseAsSource(n))
|
|
1404
|
-
return
|
|
1405
|
-
const i = this.resolveTargets(s),
|
|
1406
|
-
var
|
|
1407
|
-
return (((
|
|
1319
|
+
return m(`Map "${n}" cannot currently control linked maps.`, "LINK_SOURCE_DISABLED");
|
|
1320
|
+
const i = this.resolveTargets(s), o = be(t.strategy || this.strategy), a = ((d = (h = s.mapCore).getEngineType) == null ? void 0 : d.call(h)) || "unknown", u = o === "bounds" || o === "auto" && i.some((f) => {
|
|
1321
|
+
var y, I;
|
|
1322
|
+
return (((I = (y = f.mapCore).getEngineType) == null ? void 0 : I.call(y)) || "unknown") !== a;
|
|
1408
1323
|
}), l = s.mapCore.getViewState({ includeBounds: u });
|
|
1409
1324
|
if (!(l != null && l.success) || !l.data)
|
|
1410
|
-
return l ||
|
|
1411
|
-
const c = i.map((
|
|
1412
|
-
id:
|
|
1413
|
-
result: this.applyViewState(
|
|
1325
|
+
return l || m(`Map "${n}" view state is unavailable.`, "VIEW_STATE_FAILED");
|
|
1326
|
+
const c = i.map((f) => ({
|
|
1327
|
+
id: f.id,
|
|
1328
|
+
result: this.applyViewState(f, l.data, t)
|
|
1414
1329
|
}));
|
|
1415
|
-
return this.lastSourceId = n, this.lastSyncedAt = Date.now(),
|
|
1330
|
+
return this.lastSourceId = n, this.lastSyncedAt = Date.now(), Ye(c, `View synchronized from map "${n}".`);
|
|
1416
1331
|
}
|
|
1417
1332
|
applyViewState(e, t, n = {}) {
|
|
1418
1333
|
var l, c;
|
|
1419
|
-
const s =
|
|
1420
|
-
return this.suppressedUntil.set(e.id, Date.now() + this.suppressionMs), s !== "bounds" && Array.isArray(t.center) && (
|
|
1334
|
+
const s = be(n.strategy || this.strategy), i = ((c = (l = e.mapCore).getEngineType) == null ? void 0 : c.call(l)) || "unknown", o = t.engineType === i, a = o && i === "leaflet" && He(t.zoom), u = o && i === "cesium" && He(t.height);
|
|
1335
|
+
return this.suppressedUntil.set(e.id, Date.now() + this.suppressionMs), s !== "bounds" && Array.isArray(t.center) && (a || u) ? e.mapCore.setInitialView({
|
|
1421
1336
|
center: u && Array.isArray(t.cameraPosition) ? t.cameraPosition : t.center,
|
|
1422
|
-
...
|
|
1337
|
+
...a ? { zoom: Number(t.zoom) } : {},
|
|
1423
1338
|
...u ? {
|
|
1424
1339
|
height: Number(t.height),
|
|
1425
1340
|
heading: t.heading,
|
|
@@ -1431,21 +1346,21 @@ class Yr {
|
|
|
1431
1346
|
animate: n.animate === !0,
|
|
1432
1347
|
duration: n.duration,
|
|
1433
1348
|
padding: n.padding || 0
|
|
1434
|
-
}) : Array.isArray(t.center) ? e.mapCore.setInitialView({ center: t.center }) :
|
|
1349
|
+
}) : Array.isArray(t.center) ? e.mapCore.setInitialView({ center: t.center }) : m(`Map "${e.id}" cannot apply the source view state.`, "VIEW_SYNC_FAILED");
|
|
1435
1350
|
}
|
|
1436
1351
|
resolveControlMap(e) {
|
|
1437
|
-
const t =
|
|
1352
|
+
const t = A(e || this.activeMapId || this.leaderId), n = this.getMap(t);
|
|
1438
1353
|
return n ? { mapId: t, mapCore: n } : null;
|
|
1439
1354
|
}
|
|
1440
1355
|
zoomIn(e = {}) {
|
|
1441
1356
|
const t = this.resolveControlMap(e.mapId);
|
|
1442
|
-
if (!t) return
|
|
1357
|
+
if (!t) return m("No map is available for zoom in.", "MAP_NOT_REGISTERED");
|
|
1443
1358
|
const { mapId: n, ...s } = e, i = t.mapCore.zoomIn(s);
|
|
1444
1359
|
return i != null && i.success && this.scheduleSync(t.mapId), i;
|
|
1445
1360
|
}
|
|
1446
1361
|
zoomOut(e = {}) {
|
|
1447
1362
|
const t = this.resolveControlMap(e.mapId);
|
|
1448
|
-
if (!t) return
|
|
1363
|
+
if (!t) return m("No map is available for zoom out.", "MAP_NOT_REGISTERED");
|
|
1449
1364
|
const { mapId: n, ...s } = e, i = t.mapCore.zoomOut(s);
|
|
1450
1365
|
return i != null && i.success && this.scheduleSync(t.mapId), i;
|
|
1451
1366
|
}
|
|
@@ -1478,7 +1393,7 @@ class Yr {
|
|
|
1478
1393
|
id: s.id,
|
|
1479
1394
|
result: e(s)
|
|
1480
1395
|
}));
|
|
1481
|
-
return
|
|
1396
|
+
return Ye(n, t);
|
|
1482
1397
|
}
|
|
1483
1398
|
getState() {
|
|
1484
1399
|
return {
|
|
@@ -1515,25 +1430,25 @@ class Yr {
|
|
|
1515
1430
|
return this.cancelPendingSync(), this.releaseInteractionSource("", 0), this.entries.forEach((e) => {
|
|
1516
1431
|
var t;
|
|
1517
1432
|
return (t = e.offViewChange) == null ? void 0 : t.call(e);
|
|
1518
|
-
}), this.entries.clear(), this.suppressedUntil.clear(), this.leaderId = "", this.activeMapId = "", this.lastSourceId = "", this.lastSyncedAt = 0, this.lastRealtimeSyncAt = 0, this.notifyStateChange("clear"),
|
|
1433
|
+
}), this.entries.clear(), this.suppressedUntil.clear(), this.leaderId = "", this.activeMapId = "", this.lastSourceId = "", this.lastSyncedAt = 0, this.lastRealtimeSyncAt = 0, this.notifyStateChange("clear"), p(null, "All maps unregistered. BaseGIS instances were not destroyed.");
|
|
1519
1434
|
}
|
|
1520
1435
|
destroy() {
|
|
1521
|
-
return this.destroyed ?
|
|
1436
|
+
return this.destroyed ? p(null, "MapViewLinkController is already destroyed.") : (this.clear(), this.destroyed = !0, this.onStateChange = null, p(null, "MapViewLinkController destroyed. BaseGIS instances were not destroyed."));
|
|
1522
1437
|
}
|
|
1523
1438
|
}
|
|
1524
|
-
function
|
|
1439
|
+
function zt(r = {}) {
|
|
1525
1440
|
const { mapCore: e, baseGIS: t, ...n } = r || {};
|
|
1526
1441
|
return n;
|
|
1527
1442
|
}
|
|
1528
|
-
function
|
|
1443
|
+
function Ut(r, e) {
|
|
1529
1444
|
return Object.prototype.hasOwnProperty.call(r || {}, e);
|
|
1530
1445
|
}
|
|
1531
|
-
function
|
|
1446
|
+
function $t(r) {
|
|
1532
1447
|
return !!(r && typeof r.getEngineType == "function" && typeof r.getMapInstance == "function" && typeof r.upsertTyphoonPathLayer == "function" && typeof r.updateTyphoonPathLayer == "function" && typeof r.showTyphoonPathLayer == "function" && typeof r.hideTyphoonPathLayer == "function" && typeof r.clearTyphoonPathLayer == "function" && typeof r.removeTyphoonPathLayer == "function" && typeof r.getTyphoonPathLayerState == "function" && typeof r.playTyphoonPath == "function" && typeof r.pauseTyphoonPath == "function" && typeof r.restartTyphoonPath == "function" && typeof r.seekTyphoonPath == "function" && typeof r.flyToTyphoonPath == "function");
|
|
1533
1448
|
}
|
|
1534
|
-
class
|
|
1449
|
+
class Pn {
|
|
1535
1450
|
constructor(e = {}) {
|
|
1536
|
-
const t =
|
|
1451
|
+
const t = zt(e), n = t.typhoonPathLayerId || t.layerId || t.id || "typhoon-path-default";
|
|
1537
1452
|
this.baseGIS = null, this.visible = t.visible !== !1, this.layerType = "unknown", this.defaultPayload = {
|
|
1538
1453
|
...t,
|
|
1539
1454
|
layerId: n,
|
|
@@ -1554,35 +1469,35 @@ class Hr {
|
|
|
1554
1469
|
}
|
|
1555
1470
|
mount(e) {
|
|
1556
1471
|
var t;
|
|
1557
|
-
return
|
|
1472
|
+
return $t(e) ? (this.baseGIS = e, p(
|
|
1558
1473
|
{ engineType: ((t = e.getEngineType) == null ? void 0 : t.call(e)) || "unknown" },
|
|
1559
1474
|
"TyphoonPathController mounted with BaseGIS."
|
|
1560
|
-
)) :
|
|
1475
|
+
)) : m(
|
|
1561
1476
|
"TyphoonPathController mount requires BaseGIS instance.",
|
|
1562
1477
|
"INVALID_MOUNT_TARGET"
|
|
1563
1478
|
);
|
|
1564
1479
|
}
|
|
1565
1480
|
resolveBaseGIS() {
|
|
1566
1481
|
var e, t;
|
|
1567
|
-
return this.baseGIS ? (t = (e = this.baseGIS).getMapInstance) != null && t.call(e) ?
|
|
1482
|
+
return this.baseGIS ? (t = (e = this.baseGIS).getMapInstance) != null && t.call(e) ? p(null, "BaseGIS is ready.") : m(
|
|
1568
1483
|
"Map instance is not ready. Please call mapCore.init() first.",
|
|
1569
1484
|
"NOT_INITIALIZED"
|
|
1570
|
-
) :
|
|
1485
|
+
) : m("TyphoonPathController has not been mounted.", "NOT_MOUNTED");
|
|
1571
1486
|
}
|
|
1572
1487
|
getLayerId(e = {}) {
|
|
1573
1488
|
var t;
|
|
1574
1489
|
return String(typeof e == "string" || typeof e == "number" ? e : e.typhoonPathLayerId || e.layerId || e.id || ((t = this.currentPayload) == null ? void 0 : t.layerId) || this.defaultPayload.layerId);
|
|
1575
1490
|
}
|
|
1576
1491
|
buildPayload(e = {}, t = {}) {
|
|
1577
|
-
const n =
|
|
1578
|
-
return s.layerId = this.getLayerId(s), s.visible =
|
|
1492
|
+
const n = ye(e, t), s = ye(this.defaultPayload, n);
|
|
1493
|
+
return s.layerId = this.getLayerId(s), s.visible = Ut(n, "visible") ? n.visible !== !1 : this.visible, Fe(s);
|
|
1579
1494
|
}
|
|
1580
1495
|
syncStateFromResult(e) {
|
|
1581
|
-
var s, i,
|
|
1496
|
+
var s, i, o, a;
|
|
1582
1497
|
const t = ((s = e == null ? void 0 : e.data) == null ? void 0 : s.state) || (e == null ? void 0 : e.data);
|
|
1583
1498
|
if (!t || typeof t != "object") return;
|
|
1584
|
-
const n = (
|
|
1585
|
-
this.layerType = ((
|
|
1499
|
+
const n = (o = (i = this.baseGIS) == null ? void 0 : i.getEngineType) == null ? void 0 : o.call(i);
|
|
1500
|
+
this.layerType = ((a = e == null ? void 0 : e.data) == null ? void 0 : a.layerType) || (this.currentPayload && ["cesium", "leaflet"].includes(n) ? `${n}-typhoon-path-layer` : this.layerType), this.currentState = {
|
|
1586
1501
|
...this.currentState,
|
|
1587
1502
|
...t
|
|
1588
1503
|
}, typeof t.visible == "boolean" && (this.visible = t.visible);
|
|
@@ -1593,8 +1508,8 @@ class Hr {
|
|
|
1593
1508
|
let s;
|
|
1594
1509
|
try {
|
|
1595
1510
|
s = this.buildPayload(e, t);
|
|
1596
|
-
} catch (
|
|
1597
|
-
return
|
|
1511
|
+
} catch (o) {
|
|
1512
|
+
return m((o == null ? void 0 : o.message) || "Invalid typhoon path payload.", "INVALID_TYPHOON_PATH_PAYLOAD");
|
|
1598
1513
|
}
|
|
1599
1514
|
const i = await this.baseGIS.upsertTyphoonPathLayer(s);
|
|
1600
1515
|
return i.success && (this.currentPayload = s, this.visible = s.visible !== !1, this.syncStateFromResult(i)), i;
|
|
@@ -1603,14 +1518,14 @@ class Hr {
|
|
|
1603
1518
|
const t = this.resolveBaseGIS();
|
|
1604
1519
|
if (!t.success) return t;
|
|
1605
1520
|
if (!this.currentPayload)
|
|
1606
|
-
return
|
|
1521
|
+
return m("Typhoon path has not been loaded.", "NOT_LOADED");
|
|
1607
1522
|
let n;
|
|
1608
1523
|
try {
|
|
1609
|
-
n =
|
|
1610
|
-
|
|
1524
|
+
n = Fe(
|
|
1525
|
+
ye(this.currentPayload, e)
|
|
1611
1526
|
);
|
|
1612
1527
|
} catch (i) {
|
|
1613
|
-
return
|
|
1528
|
+
return m((i == null ? void 0 : i.message) || "Invalid typhoon path payload.", "INVALID_TYPHOON_PATH_PAYLOAD");
|
|
1614
1529
|
}
|
|
1615
1530
|
const s = await this.baseGIS.updateTyphoonPathLayer(n);
|
|
1616
1531
|
return s.success && (this.currentPayload = n, this.visible = n.visible !== !1, this.syncStateFromResult(s)), s;
|
|
@@ -1668,7 +1583,7 @@ class Hr {
|
|
|
1668
1583
|
}, this.syncStateFromResult(n)), n;
|
|
1669
1584
|
}
|
|
1670
1585
|
seek(e) {
|
|
1671
|
-
var i,
|
|
1586
|
+
var i, o, a;
|
|
1672
1587
|
const t = this.resolveBaseGIS();
|
|
1673
1588
|
if (!t.success) return t;
|
|
1674
1589
|
const n = typeof e == "number" ? { index: e } : e || {}, s = this.baseGIS.seekTyphoonPath({
|
|
@@ -1676,7 +1591,7 @@ class Hr {
|
|
|
1676
1591
|
layerId: this.getLayerId(n)
|
|
1677
1592
|
});
|
|
1678
1593
|
if (s.success && this.currentPayload) {
|
|
1679
|
-
const u = ((
|
|
1594
|
+
const u = ((o = (i = s == null ? void 0 : s.data) == null ? void 0 : i.state) == null ? void 0 : o.currentIndex) ?? ((a = s == null ? void 0 : s.data) == null ? void 0 : a.currentIndex);
|
|
1680
1595
|
Number.isInteger(u) && (this.currentPayload = {
|
|
1681
1596
|
...this.currentPayload,
|
|
1682
1597
|
playback: { ...this.currentPayload.playback, currentIndex: u }
|
|
@@ -1714,22 +1629,22 @@ class Hr {
|
|
|
1714
1629
|
}
|
|
1715
1630
|
destroy(e = {}) {
|
|
1716
1631
|
if (!this.resolveBaseGIS().success)
|
|
1717
|
-
return this.resetLocalState(),
|
|
1632
|
+
return this.resetLocalState(), p(null, "Typhoon path controller destroyed (local state only).");
|
|
1718
1633
|
const n = this.baseGIS.removeTyphoonPathLayer({
|
|
1719
1634
|
...e,
|
|
1720
1635
|
layerId: this.getLayerId(e)
|
|
1721
1636
|
});
|
|
1722
|
-
return this.resetLocalState(), n.success ?
|
|
1637
|
+
return this.resetLocalState(), n.success ? p(null, "Typhoon path controller destroyed.") : n;
|
|
1723
1638
|
}
|
|
1724
1639
|
getState() {
|
|
1725
|
-
var e, t, n, s, i,
|
|
1640
|
+
var e, t, n, s, i, o;
|
|
1726
1641
|
if ((t = (e = this.baseGIS) == null ? void 0 : e.getMapInstance) != null && t.call(e) && this.currentPayload) {
|
|
1727
|
-
const
|
|
1728
|
-
|
|
1642
|
+
const a = (s = (n = this.baseGIS).getTyphoonPathLayerState) == null ? void 0 : s.call(n, { layerId: this.getLayerId() });
|
|
1643
|
+
a != null && a.success && this.syncStateFromResult(a);
|
|
1729
1644
|
}
|
|
1730
1645
|
return {
|
|
1731
1646
|
mounted: !!this.baseGIS,
|
|
1732
|
-
engineType: ((
|
|
1647
|
+
engineType: ((o = (i = this.baseGIS) == null ? void 0 : i.getEngineType) == null ? void 0 : o.call(i)) || "unknown",
|
|
1733
1648
|
layerType: this.layerType,
|
|
1734
1649
|
layerId: this.getLayerId(),
|
|
1735
1650
|
visible: this.visible,
|
|
@@ -1738,25 +1653,25 @@ class Hr {
|
|
|
1738
1653
|
};
|
|
1739
1654
|
}
|
|
1740
1655
|
}
|
|
1741
|
-
function
|
|
1656
|
+
function re(r = {}) {
|
|
1742
1657
|
return Array.isArray(r) || Array.isArray(r == null ? void 0 : r.features) ? { points: r } : r || {};
|
|
1743
1658
|
}
|
|
1744
|
-
function
|
|
1745
|
-
const e =
|
|
1659
|
+
function qe(r = {}) {
|
|
1660
|
+
const e = re(r);
|
|
1746
1661
|
return ["points", "data", "items"].some(
|
|
1747
1662
|
(t) => Object.prototype.hasOwnProperty.call(e, t)
|
|
1748
1663
|
);
|
|
1749
1664
|
}
|
|
1750
|
-
function
|
|
1665
|
+
function kt(r) {
|
|
1751
1666
|
return !!(r && typeof r.getEngineType == "function" && typeof r.getMapInstance == "function" && typeof r.upsertPointClusterLayer == "function" && typeof r.showPointClusterLayer == "function" && typeof r.hidePointClusterLayer == "function" && typeof r.removePointClusterLayer == "function" && typeof r.clearPointClusterLayer == "function" && typeof r.getPointClusterLayerState == "function");
|
|
1752
1667
|
}
|
|
1753
|
-
function
|
|
1668
|
+
function Wt(r = {}) {
|
|
1754
1669
|
const e = { ...r };
|
|
1755
1670
|
return delete e.mapCore, delete e.baseGIS, e;
|
|
1756
1671
|
}
|
|
1757
|
-
class
|
|
1672
|
+
class Ln {
|
|
1758
1673
|
constructor(e = {}) {
|
|
1759
|
-
const t =
|
|
1674
|
+
const t = Wt(e), n = t.pointClusterLayerId || t.clusterLayerId || t.layerId || t.id || "point-cluster-default";
|
|
1760
1675
|
this.options = {
|
|
1761
1676
|
layerId: n,
|
|
1762
1677
|
visible: t.visible ?? !0,
|
|
@@ -1782,27 +1697,27 @@ class qr {
|
|
|
1782
1697
|
}
|
|
1783
1698
|
mount(e) {
|
|
1784
1699
|
var t, n;
|
|
1785
|
-
return
|
|
1700
|
+
return kt(e) ? (this.baseGIS = e, p(
|
|
1786
1701
|
{ engineType: ((n = (t = this.baseGIS).getEngineType) == null ? void 0 : n.call(t)) || "unknown" },
|
|
1787
1702
|
"PointClusterController mounted with BaseGIS."
|
|
1788
|
-
)) :
|
|
1703
|
+
)) : m(
|
|
1789
1704
|
"PointClusterController mount requires BaseGIS instance.",
|
|
1790
1705
|
"INVALID_MOUNT_TARGET"
|
|
1791
1706
|
);
|
|
1792
1707
|
}
|
|
1793
1708
|
resolveBaseGIS() {
|
|
1794
1709
|
var e, t;
|
|
1795
|
-
return this.baseGIS ? (t = (e = this.baseGIS).getMapInstance) != null && t.call(e) ?
|
|
1710
|
+
return this.baseGIS ? (t = (e = this.baseGIS).getMapInstance) != null && t.call(e) ? p(null, "BaseGIS is ready.") : m(
|
|
1796
1711
|
"Map instance is not ready. Please call mapCore.init() first.",
|
|
1797
1712
|
"NOT_INITIALIZED"
|
|
1798
|
-
) :
|
|
1713
|
+
) : m("PointClusterController has not been mounted.", "NOT_MOUNTED");
|
|
1799
1714
|
}
|
|
1800
1715
|
getLayerId(e = {}) {
|
|
1801
1716
|
var t;
|
|
1802
1717
|
return (typeof e == "string" || typeof e == "number") && e !== "" ? String(e) : (e == null ? void 0 : e.pointClusterLayerId) || (e == null ? void 0 : e.clusterLayerId) || (e == null ? void 0 : e.layerId) || (e == null ? void 0 : e.id) || ((t = this.currentPayload) == null ? void 0 : t.layerId) || this.options.layerId;
|
|
1803
1718
|
}
|
|
1804
1719
|
buildPayload(e = {}) {
|
|
1805
|
-
const t =
|
|
1720
|
+
const t = re(e);
|
|
1806
1721
|
return {
|
|
1807
1722
|
...this.defaultPayload,
|
|
1808
1723
|
...t,
|
|
@@ -1819,21 +1734,21 @@ class qr {
|
|
|
1819
1734
|
}, typeof t.visible == "boolean" && (this.visible = t.visible));
|
|
1820
1735
|
}
|
|
1821
1736
|
async load(e = {}, t = {}) {
|
|
1822
|
-
var
|
|
1737
|
+
var o;
|
|
1823
1738
|
const n = this.resolveBaseGIS();
|
|
1824
1739
|
if (!n.success)
|
|
1825
1740
|
return n;
|
|
1826
1741
|
const s = this.buildPayload({
|
|
1827
|
-
...
|
|
1828
|
-
...
|
|
1742
|
+
...re(e),
|
|
1743
|
+
...re(t)
|
|
1829
1744
|
});
|
|
1830
|
-
if (!
|
|
1831
|
-
return
|
|
1745
|
+
if (!qe(s))
|
|
1746
|
+
return m(
|
|
1832
1747
|
"Point cluster layer requires points, data or items.",
|
|
1833
1748
|
"INVALID_POINT_SOURCE"
|
|
1834
1749
|
);
|
|
1835
1750
|
const i = await this.baseGIS.upsertPointClusterLayer(s);
|
|
1836
|
-
return i.success && (this.currentPayload = s, this.visible = s.visible !== !1, this.layerType = ((
|
|
1751
|
+
return i.success && (this.currentPayload = s, this.visible = s.visible !== !1, this.layerType = ((o = i == null ? void 0 : i.data) == null ? void 0 : o.layerType) || this.layerType, this.syncStateFromResult(i)), i;
|
|
1837
1752
|
}
|
|
1838
1753
|
upsert(e = {}, t = {}) {
|
|
1839
1754
|
return this.load(e, t);
|
|
@@ -1841,9 +1756,9 @@ class qr {
|
|
|
1841
1756
|
update(e = {}) {
|
|
1842
1757
|
const t = {
|
|
1843
1758
|
...this.currentPayload || this.defaultPayload,
|
|
1844
|
-
...
|
|
1759
|
+
...re(e)
|
|
1845
1760
|
};
|
|
1846
|
-
return !this.currentPayload && !
|
|
1761
|
+
return !this.currentPayload && !qe(t) ? m("Point cluster layer has not been loaded.", "NOT_LOADED") : this.load(t);
|
|
1847
1762
|
}
|
|
1848
1763
|
setConfig(e = {}) {
|
|
1849
1764
|
return this.update(e);
|
|
@@ -1898,12 +1813,12 @@ class qr {
|
|
|
1898
1813
|
}
|
|
1899
1814
|
destroy(e = {}) {
|
|
1900
1815
|
if (!this.resolveBaseGIS().success)
|
|
1901
|
-
return this.resetLocalState(),
|
|
1816
|
+
return this.resetLocalState(), p(null, "Point cluster layer controller destroyed (local state only).");
|
|
1902
1817
|
const n = this.baseGIS.removePointClusterLayer({
|
|
1903
1818
|
...e,
|
|
1904
1819
|
layerId: this.getLayerId(e)
|
|
1905
1820
|
});
|
|
1906
|
-
return this.resetLocalState(), n.success ?
|
|
1821
|
+
return this.resetLocalState(), n.success ? p(null, "Point cluster layer controller destroyed.") : n;
|
|
1907
1822
|
}
|
|
1908
1823
|
resetLocalState() {
|
|
1909
1824
|
this.currentPayload = null, this.layerType = "unknown", this.currentState = {
|
|
@@ -1922,7 +1837,7 @@ class qr {
|
|
|
1922
1837
|
return this.destroy(e);
|
|
1923
1838
|
}
|
|
1924
1839
|
getState() {
|
|
1925
|
-
var e, t, n, s, i,
|
|
1840
|
+
var e, t, n, s, i, o, a;
|
|
1926
1841
|
if ((t = (e = this.baseGIS) == null ? void 0 : e.getMapInstance) != null && t.call(e) && this.currentPayload) {
|
|
1927
1842
|
const u = (s = (n = this.baseGIS).getPointClusterLayerState) == null ? void 0 : s.call(n, {
|
|
1928
1843
|
layerId: this.currentPayload.layerId || this.options.layerId
|
|
@@ -1931,34 +1846,34 @@ class qr {
|
|
|
1931
1846
|
}
|
|
1932
1847
|
return {
|
|
1933
1848
|
mounted: !!this.baseGIS,
|
|
1934
|
-
engineType: ((
|
|
1849
|
+
engineType: ((o = (i = this.baseGIS) == null ? void 0 : i.getEngineType) == null ? void 0 : o.call(i)) || "unknown",
|
|
1935
1850
|
layerType: this.layerType,
|
|
1936
1851
|
visible: this.visible,
|
|
1937
|
-
layerId: ((
|
|
1852
|
+
layerId: ((a = this.currentPayload) == null ? void 0 : a.layerId) || this.options.layerId,
|
|
1938
1853
|
payload: this.currentPayload,
|
|
1939
1854
|
...this.currentState
|
|
1940
1855
|
};
|
|
1941
1856
|
}
|
|
1942
1857
|
}
|
|
1943
|
-
function
|
|
1858
|
+
function ne(r = {}) {
|
|
1944
1859
|
return Array.isArray(r) || Array.isArray(r == null ? void 0 : r.features) ? { points: r } : r || {};
|
|
1945
1860
|
}
|
|
1946
|
-
function
|
|
1947
|
-
const e =
|
|
1861
|
+
function Xe(r = {}) {
|
|
1862
|
+
const e = ne(r);
|
|
1948
1863
|
return ["points", "data", "items"].some(
|
|
1949
1864
|
(t) => Object.prototype.hasOwnProperty.call(e, t)
|
|
1950
1865
|
);
|
|
1951
1866
|
}
|
|
1952
|
-
function
|
|
1867
|
+
function Ht(r) {
|
|
1953
1868
|
return !!(r && typeof r.getEngineType == "function" && typeof r.getMapInstance == "function" && typeof r.upsertPointDensityLayer == "function" && typeof r.showPointDensityLayer == "function" && typeof r.hidePointDensityLayer == "function" && typeof r.removePointDensityLayer == "function" && typeof r.clearPointDensityLayer == "function" && typeof r.getPointDensityLayerState == "function");
|
|
1954
1869
|
}
|
|
1955
|
-
function
|
|
1870
|
+
function Yt(r = {}) {
|
|
1956
1871
|
const e = { ...r };
|
|
1957
1872
|
return delete e.mapCore, delete e.baseGIS, e;
|
|
1958
1873
|
}
|
|
1959
|
-
class
|
|
1874
|
+
class wn {
|
|
1960
1875
|
constructor(e = {}) {
|
|
1961
|
-
const t =
|
|
1876
|
+
const t = Yt(e), n = t.pointDensityLayerId || t.densityLayerId || t.layerId || t.id || "point-density-default";
|
|
1962
1877
|
this.options = {
|
|
1963
1878
|
layerId: n,
|
|
1964
1879
|
visible: t.visible ?? !0,
|
|
@@ -1980,27 +1895,27 @@ class Xr {
|
|
|
1980
1895
|
}
|
|
1981
1896
|
mount(e) {
|
|
1982
1897
|
var t, n;
|
|
1983
|
-
return
|
|
1898
|
+
return Ht(e) ? (this.baseGIS = e, p(
|
|
1984
1899
|
{ engineType: ((n = (t = this.baseGIS).getEngineType) == null ? void 0 : n.call(t)) || "unknown" },
|
|
1985
1900
|
"PointDensityController mounted with BaseGIS."
|
|
1986
|
-
)) :
|
|
1901
|
+
)) : m(
|
|
1987
1902
|
"PointDensityController mount requires BaseGIS instance.",
|
|
1988
1903
|
"INVALID_MOUNT_TARGET"
|
|
1989
1904
|
);
|
|
1990
1905
|
}
|
|
1991
1906
|
resolveBaseGIS() {
|
|
1992
1907
|
var e, t;
|
|
1993
|
-
return this.baseGIS ? (t = (e = this.baseGIS).getMapInstance) != null && t.call(e) ?
|
|
1908
|
+
return this.baseGIS ? (t = (e = this.baseGIS).getMapInstance) != null && t.call(e) ? p(null, "BaseGIS is ready.") : m(
|
|
1994
1909
|
"Map instance is not ready. Please call mapCore.init() first.",
|
|
1995
1910
|
"NOT_INITIALIZED"
|
|
1996
|
-
) :
|
|
1911
|
+
) : m("PointDensityController has not been mounted.", "NOT_MOUNTED");
|
|
1997
1912
|
}
|
|
1998
1913
|
getLayerId(e = {}) {
|
|
1999
1914
|
var t;
|
|
2000
1915
|
return typeof e == "string" && e ? e : (e == null ? void 0 : e.pointDensityLayerId) || (e == null ? void 0 : e.densityLayerId) || (e == null ? void 0 : e.layerId) || (e == null ? void 0 : e.id) || ((t = this.currentPayload) == null ? void 0 : t.layerId) || this.options.layerId;
|
|
2001
1916
|
}
|
|
2002
1917
|
buildPayload(e = {}) {
|
|
2003
|
-
const t =
|
|
1918
|
+
const t = ne(e), n = this.getLayerId(t);
|
|
2004
1919
|
return {
|
|
2005
1920
|
...this.defaultPayload,
|
|
2006
1921
|
...t,
|
|
@@ -2021,17 +1936,17 @@ class Xr {
|
|
|
2021
1936
|
const n = this.resolveBaseGIS();
|
|
2022
1937
|
if (!n.success)
|
|
2023
1938
|
return n;
|
|
2024
|
-
const s =
|
|
1939
|
+
const s = ne(e), i = ne(t), o = this.buildPayload({
|
|
2025
1940
|
...s,
|
|
2026
1941
|
...i
|
|
2027
1942
|
});
|
|
2028
|
-
if (!
|
|
2029
|
-
return
|
|
1943
|
+
if (!Xe(o))
|
|
1944
|
+
return m(
|
|
2030
1945
|
"Point density layer requires points, data or items.",
|
|
2031
1946
|
"INVALID_POINT_SOURCE"
|
|
2032
1947
|
);
|
|
2033
|
-
const
|
|
2034
|
-
return
|
|
1948
|
+
const a = await this.baseGIS.upsertPointDensityLayer(o);
|
|
1949
|
+
return a.success && (this.currentPayload = o, this.visible = o.visible !== !1, this.layerType = ((u = a == null ? void 0 : a.data) == null ? void 0 : u.layerType) || this.layerType, this.syncStateFromResult(a)), a;
|
|
2035
1950
|
}
|
|
2036
1951
|
upsert(e = {}, t = {}) {
|
|
2037
1952
|
return this.load(e, t);
|
|
@@ -2039,9 +1954,9 @@ class Xr {
|
|
|
2039
1954
|
async update(e = {}) {
|
|
2040
1955
|
const t = {
|
|
2041
1956
|
...this.currentPayload || this.defaultPayload,
|
|
2042
|
-
...
|
|
1957
|
+
...ne(e)
|
|
2043
1958
|
};
|
|
2044
|
-
return !this.currentPayload && !
|
|
1959
|
+
return !this.currentPayload && !Xe(t) ? m("Point density layer has not been loaded.", "NOT_LOADED") : this.load(t);
|
|
2045
1960
|
}
|
|
2046
1961
|
setConfig(e = {}) {
|
|
2047
1962
|
return this.update(e);
|
|
@@ -2103,7 +2018,7 @@ class Xr {
|
|
|
2103
2018
|
hiddenCount: 0,
|
|
2104
2019
|
gridCount: 0,
|
|
2105
2020
|
destroyed: !0
|
|
2106
|
-
},
|
|
2021
|
+
}, p(null, "Point density layer controller destroyed (local state only).");
|
|
2107
2022
|
const n = this.baseGIS.removePointDensityLayer({
|
|
2108
2023
|
...e,
|
|
2109
2024
|
layerId: this.getLayerId(e)
|
|
@@ -2115,13 +2030,13 @@ class Xr {
|
|
|
2115
2030
|
hiddenCount: 0,
|
|
2116
2031
|
gridCount: 0,
|
|
2117
2032
|
destroyed: !0
|
|
2118
|
-
}, n.success ?
|
|
2033
|
+
}, n.success ? p(null, "Point density layer controller destroyed.") : n;
|
|
2119
2034
|
}
|
|
2120
2035
|
removeLayer(e = {}) {
|
|
2121
2036
|
return this.destroy(e);
|
|
2122
2037
|
}
|
|
2123
2038
|
getState() {
|
|
2124
|
-
var e, t, n, s, i,
|
|
2039
|
+
var e, t, n, s, i, o, a;
|
|
2125
2040
|
if ((t = (e = this.baseGIS) == null ? void 0 : e.getMapInstance) != null && t.call(e) && this.currentPayload) {
|
|
2126
2041
|
const u = (s = (n = this.baseGIS).getPointDensityLayerState) == null ? void 0 : s.call(n, {
|
|
2127
2042
|
layerId: this.currentPayload.layerId || this.options.layerId
|
|
@@ -2130,41 +2045,41 @@ class Xr {
|
|
|
2130
2045
|
}
|
|
2131
2046
|
return {
|
|
2132
2047
|
mounted: !!this.baseGIS,
|
|
2133
|
-
engineType: ((
|
|
2048
|
+
engineType: ((o = (i = this.baseGIS) == null ? void 0 : i.getEngineType) == null ? void 0 : o.call(i)) || "unknown",
|
|
2134
2049
|
layerType: this.layerType,
|
|
2135
2050
|
visible: this.visible,
|
|
2136
|
-
layerId: ((
|
|
2051
|
+
layerId: ((a = this.currentPayload) == null ? void 0 : a.layerId) || this.options.layerId,
|
|
2137
2052
|
payload: this.currentPayload,
|
|
2138
2053
|
...this.currentState
|
|
2139
2054
|
};
|
|
2140
2055
|
}
|
|
2141
2056
|
}
|
|
2142
|
-
function
|
|
2057
|
+
function se(r = {}) {
|
|
2143
2058
|
return Array.isArray(r) || Array.isArray(r == null ? void 0 : r.features) ? { points: r } : r || {};
|
|
2144
2059
|
}
|
|
2145
|
-
function
|
|
2146
|
-
const e =
|
|
2060
|
+
function Ke(r = {}) {
|
|
2061
|
+
const e = se(r);
|
|
2147
2062
|
return ["points", "data", "items"].some(
|
|
2148
2063
|
(t) => Object.prototype.hasOwnProperty.call(e, t)
|
|
2149
2064
|
);
|
|
2150
2065
|
}
|
|
2151
|
-
function
|
|
2066
|
+
function qt(r) {
|
|
2152
2067
|
return !!(r && typeof r.getEngineType == "function" && typeof r.getMapInstance == "function" && typeof r.upsertPointLargeLayer == "function" && typeof r.showPointLargeLayer == "function" && typeof r.hidePointLargeLayer == "function" && typeof r.removePointLargeLayer == "function" && typeof r.setPointLargeHighlight == "function" && typeof r.clearPointLargeHighlight == "function" && typeof r.removePointLargePoint == "function" && typeof r.clearPointLargeLayer == "function");
|
|
2153
2068
|
}
|
|
2154
|
-
function
|
|
2069
|
+
function Ze(r, e = {}) {
|
|
2155
2070
|
return r && typeof r == "object" && !Array.isArray(r) ? r.pointId ?? r.highlightId ?? r.key ?? r.id : r ?? e.pointId ?? e.highlightId ?? e.key ?? e.id;
|
|
2156
2071
|
}
|
|
2157
|
-
function
|
|
2072
|
+
function Xt(r, e = "id", t = "") {
|
|
2158
2073
|
var n, s;
|
|
2159
2074
|
return !r || typeof r != "object" || Array.isArray(r) ? t : r[e] ?? ((n = r.properties) == null ? void 0 : n[e]) ?? r.id ?? ((s = r.properties) == null ? void 0 : s.id) ?? t;
|
|
2160
2075
|
}
|
|
2161
|
-
function
|
|
2076
|
+
function Kt(r = {}) {
|
|
2162
2077
|
const { mapCore: e, baseGIS: t, ...n } = r;
|
|
2163
2078
|
return n;
|
|
2164
2079
|
}
|
|
2165
|
-
class
|
|
2080
|
+
class Cn {
|
|
2166
2081
|
constructor(e = {}) {
|
|
2167
|
-
const t =
|
|
2082
|
+
const t = Kt(e), n = t.pointLargeLayerId || t.largeLayerId || t.layerId || t.id || "point-large-default";
|
|
2168
2083
|
this.options = {
|
|
2169
2084
|
layerId: n,
|
|
2170
2085
|
visible: t.visible ?? !0,
|
|
@@ -2185,20 +2100,20 @@ class Kr {
|
|
|
2185
2100
|
}
|
|
2186
2101
|
mount(e) {
|
|
2187
2102
|
var t, n;
|
|
2188
|
-
return
|
|
2103
|
+
return qt(e) ? (this.baseGIS = e, p(
|
|
2189
2104
|
{ engineType: ((n = (t = this.baseGIS).getEngineType) == null ? void 0 : n.call(t)) || "unknown" },
|
|
2190
2105
|
"PointLargeLayerController mounted with BaseGIS."
|
|
2191
|
-
)) :
|
|
2106
|
+
)) : m(
|
|
2192
2107
|
"PointLargeLayerController mount requires BaseGIS instance.",
|
|
2193
2108
|
"INVALID_MOUNT_TARGET"
|
|
2194
2109
|
);
|
|
2195
2110
|
}
|
|
2196
2111
|
resolveBaseGIS() {
|
|
2197
2112
|
var e, t;
|
|
2198
|
-
return this.baseGIS ? (t = (e = this.baseGIS).getMapInstance) != null && t.call(e) ?
|
|
2113
|
+
return this.baseGIS ? (t = (e = this.baseGIS).getMapInstance) != null && t.call(e) ? p(null, "BaseGIS is ready.") : m(
|
|
2199
2114
|
"Map instance is not ready. Please call mapCore.init() first.",
|
|
2200
2115
|
"NOT_INITIALIZED"
|
|
2201
|
-
) :
|
|
2116
|
+
) : m("PointLargeLayerController has not been mounted.", "NOT_MOUNTED");
|
|
2202
2117
|
}
|
|
2203
2118
|
getLayerId(e = {}, t = {}) {
|
|
2204
2119
|
var s;
|
|
@@ -2206,7 +2121,7 @@ class Kr {
|
|
|
2206
2121
|
return typeof e == "string" && e ? e : (e == null ? void 0 : e.pointLargeLayerId) || (e == null ? void 0 : e.largeLayerId) || (e == null ? void 0 : e.layerId) || (n ? e == null ? void 0 : e.id : "") || ((s = this.currentPayload) == null ? void 0 : s.layerId) || this.options.layerId;
|
|
2207
2122
|
}
|
|
2208
2123
|
buildPayload(e = {}) {
|
|
2209
|
-
const t =
|
|
2124
|
+
const t = se(e), n = this.getLayerId(t);
|
|
2210
2125
|
return {
|
|
2211
2126
|
...this.defaultPayload,
|
|
2212
2127
|
...t,
|
|
@@ -2231,17 +2146,17 @@ class Kr {
|
|
|
2231
2146
|
const n = this.resolveBaseGIS();
|
|
2232
2147
|
if (!n.success)
|
|
2233
2148
|
return n;
|
|
2234
|
-
const s =
|
|
2149
|
+
const s = se(e), i = se(t), o = this.buildPayload({
|
|
2235
2150
|
...s,
|
|
2236
2151
|
...i
|
|
2237
2152
|
});
|
|
2238
|
-
if (!
|
|
2239
|
-
return
|
|
2153
|
+
if (!Ke(o))
|
|
2154
|
+
return m(
|
|
2240
2155
|
"Point large layer requires points, data or items.",
|
|
2241
2156
|
"INVALID_POINT_SOURCE"
|
|
2242
2157
|
);
|
|
2243
|
-
const
|
|
2244
|
-
return
|
|
2158
|
+
const a = await this.baseGIS.upsertPointLargeLayer(o);
|
|
2159
|
+
return a.success && (this.currentPayload = o, this.visible = o.visible !== !1, this.layerType = ((u = a == null ? void 0 : a.data) == null ? void 0 : u.layerType) || this.layerType, this.syncStateFromResult(a)), a;
|
|
2245
2160
|
}
|
|
2246
2161
|
upsert(e = {}, t = {}) {
|
|
2247
2162
|
return this.load(e, t);
|
|
@@ -2249,9 +2164,9 @@ class Kr {
|
|
|
2249
2164
|
async update(e = {}) {
|
|
2250
2165
|
const t = {
|
|
2251
2166
|
...this.currentPayload || this.defaultPayload,
|
|
2252
|
-
...
|
|
2167
|
+
...se(e)
|
|
2253
2168
|
};
|
|
2254
|
-
return !this.currentPayload && !
|
|
2169
|
+
return !this.currentPayload && !Ke(t) ? m("Point large layer has not been loaded.", "NOT_LOADED") : this.load(t);
|
|
2255
2170
|
}
|
|
2256
2171
|
show(e = {}) {
|
|
2257
2172
|
const t = this.resolveBaseGIS();
|
|
@@ -2280,15 +2195,15 @@ class Kr {
|
|
|
2280
2195
|
const n = this.resolveBaseGIS();
|
|
2281
2196
|
if (!n.success)
|
|
2282
2197
|
return n;
|
|
2283
|
-
const s = e && typeof e == "object" && !Array.isArray(e) ? e : t, i =
|
|
2198
|
+
const s = e && typeof e == "object" && !Array.isArray(e) ? e : t, i = Ze(e, s);
|
|
2284
2199
|
if (i == null || i === "")
|
|
2285
|
-
return
|
|
2286
|
-
const
|
|
2200
|
+
return m("Point id is required when setting highlight.", "INVALID_POINT_ID");
|
|
2201
|
+
const o = this.baseGIS.setPointLargeHighlight({
|
|
2287
2202
|
...s,
|
|
2288
2203
|
layerId: this.getLayerId(s, { allowId: !1 }),
|
|
2289
2204
|
pointId: i
|
|
2290
2205
|
});
|
|
2291
|
-
return
|
|
2206
|
+
return o.success && this.syncStateFromResult(o), o;
|
|
2292
2207
|
}
|
|
2293
2208
|
highlight(e, t = {}) {
|
|
2294
2209
|
return this.setHighlight(e, t);
|
|
@@ -2316,8 +2231,8 @@ class Kr {
|
|
|
2316
2231
|
this.currentPayload = {
|
|
2317
2232
|
...this.currentPayload,
|
|
2318
2233
|
points: this.currentPayload.points.filter((s, i) => {
|
|
2319
|
-
const
|
|
2320
|
-
return !n.has(String(
|
|
2234
|
+
const o = Xt(s, t, i);
|
|
2235
|
+
return !n.has(String(o));
|
|
2321
2236
|
})
|
|
2322
2237
|
};
|
|
2323
2238
|
}
|
|
@@ -2325,15 +2240,15 @@ class Kr {
|
|
|
2325
2240
|
const n = this.resolveBaseGIS();
|
|
2326
2241
|
if (!n.success)
|
|
2327
2242
|
return n;
|
|
2328
|
-
const s = e && typeof e == "object" && !Array.isArray(e) ? e : t, i =
|
|
2243
|
+
const s = e && typeof e == "object" && !Array.isArray(e) ? e : t, i = Ze(e, s);
|
|
2329
2244
|
if (i == null || i === "")
|
|
2330
|
-
return
|
|
2331
|
-
const
|
|
2245
|
+
return m("Point id is required when removing point.", "INVALID_POINT_ID");
|
|
2246
|
+
const o = this.baseGIS.removePointLargePoint({
|
|
2332
2247
|
...s,
|
|
2333
2248
|
layerId: this.getLayerId(s, { allowId: !1 }),
|
|
2334
2249
|
pointId: i
|
|
2335
2250
|
});
|
|
2336
|
-
return
|
|
2251
|
+
return o.success && (this.removeCachedPoints([i]), this.syncStateFromResult(o)), o;
|
|
2337
2252
|
}
|
|
2338
2253
|
deletePoint(e, t = {}) {
|
|
2339
2254
|
return this.removePoint(e, t);
|
|
@@ -2347,7 +2262,7 @@ class Kr {
|
|
|
2347
2262
|
return n;
|
|
2348
2263
|
const s = Array.isArray(e) ? e : [e];
|
|
2349
2264
|
if (s.length === 0)
|
|
2350
|
-
return
|
|
2265
|
+
return m("Point id list is required when removing points.", "INVALID_POINT_ID");
|
|
2351
2266
|
const i = this.baseGIS.removePointLargePoints({
|
|
2352
2267
|
...t,
|
|
2353
2268
|
layerId: this.getLayerId(t, { allowId: !1 }),
|
|
@@ -2398,7 +2313,7 @@ class Kr {
|
|
|
2398
2313
|
renderedCount: 0,
|
|
2399
2314
|
building: !1,
|
|
2400
2315
|
destroyed: !0
|
|
2401
|
-
},
|
|
2316
|
+
}, p(null, "Point large layer controller destroyed (local state only).");
|
|
2402
2317
|
const n = this.baseGIS.removePointLargeLayer({
|
|
2403
2318
|
...e,
|
|
2404
2319
|
layerId: this.getLayerId(e)
|
|
@@ -2409,13 +2324,13 @@ class Kr {
|
|
|
2409
2324
|
renderedCount: 0,
|
|
2410
2325
|
building: !1,
|
|
2411
2326
|
destroyed: !0
|
|
2412
|
-
}, n.success ?
|
|
2327
|
+
}, n.success ? p(null, "Point large layer controller destroyed.") : n;
|
|
2413
2328
|
}
|
|
2414
2329
|
removeLayer(e = {}) {
|
|
2415
2330
|
return this.destroy(e);
|
|
2416
2331
|
}
|
|
2417
2332
|
getState() {
|
|
2418
|
-
var e, t, n, s, i,
|
|
2333
|
+
var e, t, n, s, i, o, a;
|
|
2419
2334
|
if ((t = (e = this.baseGIS) == null ? void 0 : e.getMapInstance) != null && t.call(e) && this.currentPayload) {
|
|
2420
2335
|
const u = (s = (n = this.baseGIS).getPointLargeLayerState) == null ? void 0 : s.call(n, {
|
|
2421
2336
|
layerId: this.currentPayload.layerId || this.options.layerId
|
|
@@ -2424,22 +2339,22 @@ class Kr {
|
|
|
2424
2339
|
}
|
|
2425
2340
|
return {
|
|
2426
2341
|
mounted: !!this.baseGIS,
|
|
2427
|
-
engineType: ((
|
|
2342
|
+
engineType: ((o = (i = this.baseGIS) == null ? void 0 : i.getEngineType) == null ? void 0 : o.call(i)) || "unknown",
|
|
2428
2343
|
layerType: this.layerType,
|
|
2429
2344
|
visible: this.visible,
|
|
2430
|
-
layerId: ((
|
|
2345
|
+
layerId: ((a = this.currentPayload) == null ? void 0 : a.layerId) || this.options.layerId,
|
|
2431
2346
|
payload: this.currentPayload,
|
|
2432
2347
|
...this.currentState
|
|
2433
2348
|
};
|
|
2434
2349
|
}
|
|
2435
2350
|
}
|
|
2436
|
-
function
|
|
2351
|
+
function Zt(r, e) {
|
|
2437
2352
|
let t = 0;
|
|
2438
2353
|
for (let n of r)
|
|
2439
2354
|
n != null && (n = +n) >= n && ++t;
|
|
2440
2355
|
return t;
|
|
2441
2356
|
}
|
|
2442
|
-
function
|
|
2357
|
+
function Jt(r, e) {
|
|
2443
2358
|
let t, n;
|
|
2444
2359
|
if (e === void 0)
|
|
2445
2360
|
for (const s of r)
|
|
@@ -2451,74 +2366,74 @@ function xt(r, e) {
|
|
|
2451
2366
|
}
|
|
2452
2367
|
return [t, n];
|
|
2453
2368
|
}
|
|
2454
|
-
const
|
|
2455
|
-
function
|
|
2456
|
-
const n = (e - r) / Math.max(0, t), s = Math.floor(Math.log10(n)), i = n / Math.pow(10, s),
|
|
2457
|
-
let
|
|
2458
|
-
return s < 0 ? (l = Math.pow(10, -s) /
|
|
2369
|
+
const Qt = Math.sqrt(50), er = Math.sqrt(10), tr = Math.sqrt(2);
|
|
2370
|
+
function he(r, e, t) {
|
|
2371
|
+
const n = (e - r) / Math.max(0, t), s = Math.floor(Math.log10(n)), i = n / Math.pow(10, s), o = i >= Qt ? 10 : i >= er ? 5 : i >= tr ? 2 : 1;
|
|
2372
|
+
let a, u, l;
|
|
2373
|
+
return s < 0 ? (l = Math.pow(10, -s) / o, a = Math.round(r * l), u = Math.round(e * l), a / l < r && ++a, u / l > e && --u, l = -l) : (l = Math.pow(10, s) * o, a = Math.round(r / l), u = Math.round(e / l), a * l < r && ++a, u * l > e && --u), u < a && 0.5 <= t && t < 2 ? he(r, e, t * 2) : [a, u, l];
|
|
2459
2374
|
}
|
|
2460
|
-
function
|
|
2375
|
+
function rr(r, e, t) {
|
|
2461
2376
|
if (e = +e, r = +r, t = +t, !(t > 0)) return [];
|
|
2462
2377
|
if (r === e) return [r];
|
|
2463
|
-
const n = e < r, [s, i,
|
|
2378
|
+
const n = e < r, [s, i, o] = n ? he(e, r, t) : he(r, e, t);
|
|
2464
2379
|
if (!(i >= s)) return [];
|
|
2465
|
-
const
|
|
2380
|
+
const a = i - s + 1, u = new Array(a);
|
|
2466
2381
|
if (n)
|
|
2467
|
-
if (
|
|
2468
|
-
else for (let l = 0; l <
|
|
2469
|
-
else if (
|
|
2470
|
-
else for (let l = 0; l <
|
|
2382
|
+
if (o < 0) for (let l = 0; l < a; ++l) u[l] = (i - l) / -o;
|
|
2383
|
+
else for (let l = 0; l < a; ++l) u[l] = (i - l) * o;
|
|
2384
|
+
else if (o < 0) for (let l = 0; l < a; ++l) u[l] = (s + l) / -o;
|
|
2385
|
+
else for (let l = 0; l < a; ++l) u[l] = (s + l) * o;
|
|
2471
2386
|
return u;
|
|
2472
2387
|
}
|
|
2473
|
-
function
|
|
2474
|
-
return e = +e, r = +r, t = +t,
|
|
2388
|
+
function nr(r, e, t) {
|
|
2389
|
+
return e = +e, r = +r, t = +t, he(r, e, t)[2];
|
|
2475
2390
|
}
|
|
2476
|
-
function
|
|
2391
|
+
function sr(r, e, t) {
|
|
2477
2392
|
let n;
|
|
2478
2393
|
for (; ; ) {
|
|
2479
|
-
const s =
|
|
2394
|
+
const s = nr(r, e, t);
|
|
2480
2395
|
if (s === n || s === 0 || !isFinite(s))
|
|
2481
2396
|
return [r, e];
|
|
2482
2397
|
s > 0 ? (r = Math.floor(r / s) * s, e = Math.ceil(e / s) * s) : s < 0 && (r = Math.ceil(r * s) / s, e = Math.floor(e * s) / s), n = s;
|
|
2483
2398
|
}
|
|
2484
2399
|
}
|
|
2485
|
-
function
|
|
2486
|
-
return Math.max(1, Math.ceil(Math.log(
|
|
2400
|
+
function ir(r) {
|
|
2401
|
+
return Math.max(1, Math.ceil(Math.log(Zt(r)) / Math.LN2) + 1);
|
|
2487
2402
|
}
|
|
2488
|
-
var
|
|
2489
|
-
function
|
|
2403
|
+
var or = Array.prototype, ar = or.slice;
|
|
2404
|
+
function lr(r, e) {
|
|
2490
2405
|
return r - e;
|
|
2491
2406
|
}
|
|
2492
|
-
function
|
|
2407
|
+
function ur(r) {
|
|
2493
2408
|
for (var e = 0, t = r.length, n = r[t - 1][1] * r[0][0] - r[t - 1][0] * r[0][1]; ++e < t; ) n += r[e - 1][1] * r[e][0] - r[e - 1][0] * r[e][1];
|
|
2494
2409
|
return n;
|
|
2495
2410
|
}
|
|
2496
|
-
const
|
|
2497
|
-
function
|
|
2498
|
-
for (var t = -1, n = e.length, s; ++t < n; ) if (s =
|
|
2411
|
+
const Je = (r) => () => r;
|
|
2412
|
+
function cr(r, e) {
|
|
2413
|
+
for (var t = -1, n = e.length, s; ++t < n; ) if (s = hr(r, e[t])) return s;
|
|
2499
2414
|
return 0;
|
|
2500
2415
|
}
|
|
2501
|
-
function
|
|
2502
|
-
for (var t = e[0], n = e[1], s = -1, i = 0,
|
|
2503
|
-
var u = r[i], l = u[0], c = u[1], h = r[
|
|
2504
|
-
if (
|
|
2505
|
-
c > n !=
|
|
2416
|
+
function hr(r, e) {
|
|
2417
|
+
for (var t = e[0], n = e[1], s = -1, i = 0, o = r.length, a = o - 1; i < o; a = i++) {
|
|
2418
|
+
var u = r[i], l = u[0], c = u[1], h = r[a], d = h[0], f = h[1];
|
|
2419
|
+
if (dr(u, h, e)) return 0;
|
|
2420
|
+
c > n != f > n && t < (d - l) * (n - c) / (f - c) + l && (s = -s);
|
|
2506
2421
|
}
|
|
2507
2422
|
return s;
|
|
2508
2423
|
}
|
|
2509
|
-
function
|
|
2424
|
+
function dr(r, e, t) {
|
|
2510
2425
|
var n;
|
|
2511
|
-
return
|
|
2426
|
+
return fr(r, e, t) && yr(r[n = +(r[0] === e[0])], t[n], e[n]);
|
|
2512
2427
|
}
|
|
2513
|
-
function
|
|
2428
|
+
function fr(r, e, t) {
|
|
2514
2429
|
return (e[0] - r[0]) * (t[1] - r[1]) === (t[0] - r[0]) * (e[1] - r[1]);
|
|
2515
2430
|
}
|
|
2516
|
-
function
|
|
2431
|
+
function yr(r, e, t) {
|
|
2517
2432
|
return r <= e && e <= t || t <= e && e <= r;
|
|
2518
2433
|
}
|
|
2519
|
-
function
|
|
2434
|
+
function mr() {
|
|
2520
2435
|
}
|
|
2521
|
-
var
|
|
2436
|
+
var z = [
|
|
2522
2437
|
[],
|
|
2523
2438
|
[[[1, 1.5], [0.5, 1]]],
|
|
2524
2439
|
[[[1.5, 1], [1, 1.5]]],
|
|
@@ -2536,15 +2451,15 @@ var B = [
|
|
|
2536
2451
|
[[[0.5, 1], [1, 1.5]]],
|
|
2537
2452
|
[]
|
|
2538
2453
|
];
|
|
2539
|
-
function
|
|
2540
|
-
var r = 1, e = 1, t =
|
|
2454
|
+
function Ir() {
|
|
2455
|
+
var r = 1, e = 1, t = ir, n = u;
|
|
2541
2456
|
function s(l) {
|
|
2542
2457
|
var c = t(l);
|
|
2543
2458
|
if (Array.isArray(c))
|
|
2544
|
-
c = c.slice().sort(
|
|
2459
|
+
c = c.slice().sort(lr);
|
|
2545
2460
|
else {
|
|
2546
|
-
const h =
|
|
2547
|
-
for (c =
|
|
2461
|
+
const h = Jt(l, gr);
|
|
2462
|
+
for (c = rr(...sr(h[0], h[1], c), c); c[c.length - 1] >= h[1]; ) c.pop();
|
|
2548
2463
|
for (; c[1] < h[0]; ) c.shift();
|
|
2549
2464
|
}
|
|
2550
2465
|
return c.map((h) => i(l, h));
|
|
@@ -2552,45 +2467,45 @@ function Zt() {
|
|
|
2552
2467
|
function i(l, c) {
|
|
2553
2468
|
const h = c == null ? NaN : +c;
|
|
2554
2469
|
if (isNaN(h)) throw new Error(`invalid value: ${c}`);
|
|
2555
|
-
var
|
|
2556
|
-
return
|
|
2557
|
-
n(
|
|
2558
|
-
}),
|
|
2559
|
-
for (var
|
|
2560
|
-
if (
|
|
2561
|
-
|
|
2470
|
+
var d = [], f = [];
|
|
2471
|
+
return o(l, h, function(y) {
|
|
2472
|
+
n(y, l, h), ur(y) > 0 ? d.push([y]) : f.push(y);
|
|
2473
|
+
}), f.forEach(function(y) {
|
|
2474
|
+
for (var I = 0, v = d.length, P; I < v; ++I)
|
|
2475
|
+
if (cr((P = d[I])[0], y) !== -1) {
|
|
2476
|
+
P.push(y);
|
|
2562
2477
|
return;
|
|
2563
2478
|
}
|
|
2564
2479
|
}), {
|
|
2565
2480
|
type: "MultiPolygon",
|
|
2566
2481
|
value: c,
|
|
2567
|
-
coordinates:
|
|
2482
|
+
coordinates: d
|
|
2568
2483
|
};
|
|
2569
2484
|
}
|
|
2570
|
-
function
|
|
2571
|
-
var
|
|
2572
|
-
for (
|
|
2573
|
-
|
|
2574
|
-
for (
|
|
2575
|
-
for (
|
|
2576
|
-
|
|
2577
|
-
|
|
2485
|
+
function o(l, c, h) {
|
|
2486
|
+
var d = new Array(), f = new Array(), y, I, v, P, b, w;
|
|
2487
|
+
for (y = I = -1, P = W(l[0], c), z[P << 1].forEach(S); ++y < r - 1; )
|
|
2488
|
+
v = P, P = W(l[y + 1], c), z[v | P << 1].forEach(S);
|
|
2489
|
+
for (z[P << 0].forEach(S); ++I < e - 1; ) {
|
|
2490
|
+
for (y = -1, P = W(l[I * r + r], c), b = W(l[I * r], c), z[P << 1 | b << 2].forEach(S); ++y < r - 1; )
|
|
2491
|
+
v = P, P = W(l[I * r + r + y + 1], c), w = b, b = W(l[I * r + y + 1], c), z[v | P << 1 | b << 2 | w << 3].forEach(S);
|
|
2492
|
+
z[P | b << 3].forEach(S);
|
|
2578
2493
|
}
|
|
2579
|
-
for (
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
function
|
|
2583
|
-
var
|
|
2584
|
-
(
|
|
2494
|
+
for (y = -1, b = l[I * r] >= c, z[b << 2].forEach(S); ++y < r - 1; )
|
|
2495
|
+
w = b, b = W(l[I * r + y + 1], c), z[b << 2 | w << 3].forEach(S);
|
|
2496
|
+
z[b << 3].forEach(S);
|
|
2497
|
+
function S(g) {
|
|
2498
|
+
var C = [g[0][0] + y, g[0][1] + I], T = [g[1][0] + y, g[1][1] + I], G = a(C), x = a(T), L, M;
|
|
2499
|
+
(L = f[G]) ? (M = d[x]) ? (delete f[L.end], delete d[M.start], L === M ? (L.ring.push(T), h(L.ring)) : d[L.start] = f[M.end] = { start: L.start, end: M.end, ring: L.ring.concat(M.ring) }) : (delete f[L.end], L.ring.push(T), f[L.end = x] = L) : (L = d[x]) ? (M = f[G]) ? (delete d[L.start], delete f[M.end], L === M ? (L.ring.push(T), h(L.ring)) : d[M.start] = f[L.end] = { start: M.start, end: L.end, ring: M.ring.concat(L.ring) }) : (delete d[L.start], L.ring.unshift(C), d[L.start = G] = L) : d[G] = f[x] = { start: G, end: x, ring: [C, T] };
|
|
2585
2500
|
}
|
|
2586
2501
|
}
|
|
2587
|
-
function
|
|
2502
|
+
function a(l) {
|
|
2588
2503
|
return l[0] * 2 + l[1] * (r + 1) * 4;
|
|
2589
2504
|
}
|
|
2590
2505
|
function u(l, c, h) {
|
|
2591
|
-
l.forEach(function(
|
|
2592
|
-
var
|
|
2593
|
-
|
|
2506
|
+
l.forEach(function(d) {
|
|
2507
|
+
var f = d[0], y = d[1], I = f | 0, v = y | 0, P = pe(c[v * r + I]);
|
|
2508
|
+
f > 0 && f < r && I === f && (d[0] = Qe(f, pe(c[v * r + I - 1]), P, h)), y > 0 && y < e && v === y && (d[1] = Qe(y, pe(c[(v - 1) * r + I]), P, h));
|
|
2594
2509
|
});
|
|
2595
2510
|
}
|
|
2596
2511
|
return s.contour = i, s.size = function(l) {
|
|
@@ -2599,26 +2514,300 @@ function Zt() {
|
|
|
2599
2514
|
if (!(c >= 0 && h >= 0)) throw new Error("invalid size");
|
|
2600
2515
|
return r = c, e = h, s;
|
|
2601
2516
|
}, s.thresholds = function(l) {
|
|
2602
|
-
return arguments.length ? (t = typeof l == "function" ? l : Array.isArray(l) ?
|
|
2517
|
+
return arguments.length ? (t = typeof l == "function" ? l : Array.isArray(l) ? Je(ar.call(l)) : Je(l), s) : t;
|
|
2603
2518
|
}, s.smooth = function(l) {
|
|
2604
|
-
return arguments.length ? (n = l ? u :
|
|
2519
|
+
return arguments.length ? (n = l ? u : mr, s) : n === u;
|
|
2605
2520
|
}, s;
|
|
2606
2521
|
}
|
|
2607
|
-
function
|
|
2522
|
+
function gr(r) {
|
|
2608
2523
|
return isFinite(r) ? r : NaN;
|
|
2609
2524
|
}
|
|
2610
|
-
function
|
|
2525
|
+
function W(r, e) {
|
|
2611
2526
|
return r == null ? !1 : +r >= e;
|
|
2612
2527
|
}
|
|
2613
|
-
function
|
|
2528
|
+
function pe(r) {
|
|
2614
2529
|
return r == null || isNaN(r = +r) ? -1 / 0 : r;
|
|
2615
2530
|
}
|
|
2616
|
-
function
|
|
2617
|
-
const s = n - e, i = t - e,
|
|
2618
|
-
return isNaN(
|
|
2531
|
+
function Qe(r, e, t, n) {
|
|
2532
|
+
const s = n - e, i = t - e, o = isFinite(s) || isFinite(i) ? s / i : Math.sign(s) / Math.sign(i);
|
|
2533
|
+
return isNaN(o) ? r : r + o - 0.5;
|
|
2534
|
+
}
|
|
2535
|
+
const ie = Object.freeze({
|
|
2536
|
+
enabled: !1,
|
|
2537
|
+
radius: 2,
|
|
2538
|
+
sigma: null,
|
|
2539
|
+
passes: 1
|
|
2540
|
+
});
|
|
2541
|
+
function mt(r = {}) {
|
|
2542
|
+
const e = r && typeof r == "object" ? r : {}, t = Number(e.radius ?? ie.radius), n = Number.isFinite(t) ? Math.max(0, Math.min(6, Math.round(t))) : ie.radius, s = Number(e.sigma), i = Number(e.passes ?? ie.passes);
|
|
2543
|
+
return {
|
|
2544
|
+
enabled: e.enabled === !0,
|
|
2545
|
+
radius: n,
|
|
2546
|
+
sigma: Number.isFinite(s) && s > 0 ? s : Math.max(n / 2, 0.8),
|
|
2547
|
+
passes: Number.isFinite(i) ? Math.max(1, Math.min(3, Math.round(i))) : ie.passes
|
|
2548
|
+
};
|
|
2549
|
+
}
|
|
2550
|
+
function et(r, e, t, n, s, i) {
|
|
2551
|
+
const o = Math.floor(n.length / 2), a = new Float64Array(r.length);
|
|
2552
|
+
a.fill(Number.NaN);
|
|
2553
|
+
for (let u = 0; u < t; u += 1)
|
|
2554
|
+
for (let l = 0; l < e; l += 1) {
|
|
2555
|
+
const c = u * e + l;
|
|
2556
|
+
if (!Number.isFinite(r[c])) continue;
|
|
2557
|
+
let h = 0, d = 0;
|
|
2558
|
+
for (let f = -o; f <= o; f += 1) {
|
|
2559
|
+
let y = s ? l + f : l;
|
|
2560
|
+
const I = s ? u : u + f;
|
|
2561
|
+
if (I < 0 || I >= t) continue;
|
|
2562
|
+
if (y < 0 || y >= e) {
|
|
2563
|
+
if (!s || !i) continue;
|
|
2564
|
+
y = (y % e + e) % e;
|
|
2565
|
+
}
|
|
2566
|
+
const v = r[I * e + y];
|
|
2567
|
+
if (!Number.isFinite(v)) continue;
|
|
2568
|
+
const P = n[f + o];
|
|
2569
|
+
h += v * P, d += P;
|
|
2570
|
+
}
|
|
2571
|
+
d > 0 && (a[c] = h / d);
|
|
2572
|
+
}
|
|
2573
|
+
return a;
|
|
2574
|
+
}
|
|
2575
|
+
function br(r, e = {}, t = !1) {
|
|
2576
|
+
const { enabled: n, radius: s, sigma: i, passes: o } = mt(e);
|
|
2577
|
+
if (!n || s === 0) return r;
|
|
2578
|
+
const a = Float64Array.from({ length: s * 2 + 1 }, (l, c) => Math.exp(-((c - s) ** 2) / (2 * i * i)));
|
|
2579
|
+
let u = r.values;
|
|
2580
|
+
for (let l = 0; l < o; l += 1)
|
|
2581
|
+
u = et(u, r.width, r.height, a, !0, t), u = et(u, r.width, r.height, a, !1, !1);
|
|
2582
|
+
return { ...r, values: u };
|
|
2583
|
+
}
|
|
2584
|
+
function It(r = [], e = 0, t = 0) {
|
|
2585
|
+
const n = Math.min(Math.max(Math.floor(e), 0), 3);
|
|
2586
|
+
if (!n || r.length < 3) return r;
|
|
2587
|
+
const s = t > 0 ? Math.round((r.at(-1)[1] - r[0][1]) / t) * t : 0, i = t > 0 ? 1e-5 : 0, o = Math.abs(r[0][0] - r.at(-1)[0]) <= i && Math.abs(r[0][1] - (r.at(-1)[1] - s)) <= i;
|
|
2588
|
+
let a = o ? r.slice(0, -1) : r;
|
|
2589
|
+
for (let u = 0; u < n; u += 1) {
|
|
2590
|
+
const l = o ? [] : [a[0]], c = o ? a.length : a.length - 1;
|
|
2591
|
+
for (let h = 0; h < c; h += 1) {
|
|
2592
|
+
const d = a[h], f = h + 1 < a.length ? a[h + 1] : [a[0][0], a[0][1] + s];
|
|
2593
|
+
l.push([
|
|
2594
|
+
d[0] * 0.75 + f[0] * 0.25,
|
|
2595
|
+
d[1] * 0.75 + f[1] * 0.25
|
|
2596
|
+
]), l.push([
|
|
2597
|
+
d[0] * 0.25 + f[0] * 0.75,
|
|
2598
|
+
d[1] * 0.25 + f[1] * 0.75
|
|
2599
|
+
]);
|
|
2600
|
+
}
|
|
2601
|
+
o || l.push(a.at(-1)), a = l;
|
|
2602
|
+
}
|
|
2603
|
+
return o ? [...a, [a[0][0], a[0][1] + s]] : a;
|
|
2604
|
+
}
|
|
2605
|
+
const pr = 6371.0088, le = (r) => r * Math.PI / 180;
|
|
2606
|
+
function Sr(r, e) {
|
|
2607
|
+
const t = le(e.lat - r.lat), n = le(e.lon - r.lon), s = Math.sin(t / 2) ** 2 + Math.cos(le(r.lat)) * Math.cos(le(e.lat)) * Math.sin(n / 2) ** 2;
|
|
2608
|
+
return pr * 2 * Math.asin(Math.sqrt(Math.min(1, s)));
|
|
2609
|
+
}
|
|
2610
|
+
function Se(r, e) {
|
|
2611
|
+
return r != null && Number.isFinite(Number(r)) ? Math.max(0, Number(r)) : e;
|
|
2612
|
+
}
|
|
2613
|
+
function vr(r, e = {}, t = !1) {
|
|
2614
|
+
const { width: n, height: s, values: i } = r, o = {
|
|
2615
|
+
method: "closed-contour",
|
|
2616
|
+
candidates: 0,
|
|
2617
|
+
closed: 0,
|
|
2618
|
+
rejectedOpen: 0,
|
|
2619
|
+
rejectedWeak: 0,
|
|
2620
|
+
rejectedDistance: 0,
|
|
2621
|
+
rejectedLimit: 0
|
|
2622
|
+
}, a = Math.floor(Se(e.maxCount, 200));
|
|
2623
|
+
if (!e.enabled || !a || n < 3 || s < 3) return { centers: [], stats: o };
|
|
2624
|
+
const u = Math.max(Se(e.minProminence, 0.5), 1e-9), l = Se(e.minDistanceKm, 250), c = n * s, h = new Int32Array(c).fill(-1), d = new Int32Array(c), f = new Uint32Array(c), y = [], I = (g) => {
|
|
2625
|
+
const C = g % n, T = Math.floor(g / n), G = [];
|
|
2626
|
+
for (let x = -1; x <= 1; x += 1)
|
|
2627
|
+
for (let L = -1; L <= 1; L += 1) {
|
|
2628
|
+
if (!L && !x) continue;
|
|
2629
|
+
const M = T + x;
|
|
2630
|
+
let B = C + L;
|
|
2631
|
+
t && (B = (B + n) % n), G.push(M < 0 || M >= s || B < 0 || B >= n ? -1 : M * n + B);
|
|
2632
|
+
}
|
|
2633
|
+
return G;
|
|
2634
|
+
};
|
|
2635
|
+
for (let g = 0; g < c; g += 1) {
|
|
2636
|
+
if (h[g] !== -1 || !Number.isFinite(i[g])) continue;
|
|
2637
|
+
const C = i[g];
|
|
2638
|
+
let T = 0, G = 1, x = !1, L = !1, M = !1, B = 0, O = 0;
|
|
2639
|
+
const X = g % n, Re = (_) => {
|
|
2640
|
+
const D = _ % n - X;
|
|
2641
|
+
return X + (t ? D - Math.round(D / n) * n : D);
|
|
2642
|
+
};
|
|
2643
|
+
for (d[0] = g, h[g] = g; T < G; ) {
|
|
2644
|
+
const _ = d[T++];
|
|
2645
|
+
B += Re(_), O += Math.floor(_ / n);
|
|
2646
|
+
for (const D of I(_)) {
|
|
2647
|
+
if (D < 0 || !Number.isFinite(i[D])) {
|
|
2648
|
+
M = !0;
|
|
2649
|
+
continue;
|
|
2650
|
+
}
|
|
2651
|
+
const ee = i[D];
|
|
2652
|
+
ee < C ? x = !0 : ee > C ? L = !0 : h[D] === -1 && (h[D] = g, d[G++] = D);
|
|
2653
|
+
}
|
|
2654
|
+
}
|
|
2655
|
+
const Q = x && !L ? "H" : L && !x ? "L" : null;
|
|
2656
|
+
if (!Q || Q === "H" && e.includeHigh === !1 || Q === "L" && e.includeLow === !1) continue;
|
|
2657
|
+
if (o.candidates += 1, M) {
|
|
2658
|
+
o.rejectedOpen += 1;
|
|
2659
|
+
continue;
|
|
2660
|
+
}
|
|
2661
|
+
let ae = g, De = 1 / 0;
|
|
2662
|
+
for (let _ = 0; _ < G; _ += 1) {
|
|
2663
|
+
const D = d[_], ee = (Re(D) - B / G) ** 2 + (Math.floor(D / n) - O / G) ** 2;
|
|
2664
|
+
ee < De && (ae = D, De = ee);
|
|
2665
|
+
}
|
|
2666
|
+
const [vt, Pt] = r.mapCoordinate(ae % n + 0.5, Math.floor(ae / n) + 0.5);
|
|
2667
|
+
y.push({ type: Q, label: Q, value: C, lat: vt, lon: Pt, index: ae, owner: g });
|
|
2668
|
+
}
|
|
2669
|
+
const v = [];
|
|
2670
|
+
let P = 0;
|
|
2671
|
+
y.sort((g, C) => g.type.localeCompare(C.type) || (g.type === "H" ? C.value - g.value : g.value - C.value) || g.index - C.index);
|
|
2672
|
+
for (const g of y) {
|
|
2673
|
+
const C = g.type === "H" ? 1 : -1, T = C * g.value, G = T - u;
|
|
2674
|
+
let x = 0, L = 1, M = null;
|
|
2675
|
+
for (P += 1, d[0] = g.index, f[g.index] = P; x < L && !M; ) {
|
|
2676
|
+
const B = d[x++];
|
|
2677
|
+
for (const O of I(B)) {
|
|
2678
|
+
if (O < 0 || !Number.isFinite(i[O])) {
|
|
2679
|
+
M = "open";
|
|
2680
|
+
break;
|
|
2681
|
+
}
|
|
2682
|
+
if (f[O] === P) continue;
|
|
2683
|
+
const X = C * i[O];
|
|
2684
|
+
if (!(X <= G)) {
|
|
2685
|
+
if (X > T || X === T && h[O] < g.owner) {
|
|
2686
|
+
M = "weak";
|
|
2687
|
+
break;
|
|
2688
|
+
}
|
|
2689
|
+
f[O] = P, d[L++] = O;
|
|
2690
|
+
}
|
|
2691
|
+
}
|
|
2692
|
+
}
|
|
2693
|
+
if (M) {
|
|
2694
|
+
o[M === "open" ? "rejectedOpen" : "rejectedWeak"] += 1;
|
|
2695
|
+
continue;
|
|
2696
|
+
}
|
|
2697
|
+
if (o.closed += 1, l && v.some((B) => B.type === g.type && Sr(B, g) < l)) {
|
|
2698
|
+
o.rejectedDistance += 1;
|
|
2699
|
+
continue;
|
|
2700
|
+
}
|
|
2701
|
+
v.push(g);
|
|
2702
|
+
}
|
|
2703
|
+
const b = v.filter((g) => g.type === "H"), w = v.filter((g) => g.type === "L"), S = [];
|
|
2704
|
+
for (let g = 0; g < Math.max(b.length, w.length); g += 1)
|
|
2705
|
+
b[g] && S.push(b[g]), w[g] && S.push(w[g]);
|
|
2706
|
+
return o.rejectedLimit = Math.max(0, S.length - a), {
|
|
2707
|
+
centers: S.slice(0, a).map(({ type: g, label: C, value: T, lat: G, lon: x }) => ({ type: g, label: C, value: T, lat: G, lon: x })),
|
|
2708
|
+
stats: o
|
|
2709
|
+
};
|
|
2710
|
+
}
|
|
2711
|
+
const Y = 1e-5, ve = (r, e) => Math.abs(r[0] - e[0]) <= Y && Math.abs(r[1] - e[1]) <= Y;
|
|
2712
|
+
function Pr(r, e) {
|
|
2713
|
+
return e === !0 && Math.abs(r.area.endLon - r.area.startLon - 360) <= 1e-3;
|
|
2714
|
+
}
|
|
2715
|
+
function Lr(r) {
|
|
2716
|
+
const e = r.width + 2, t = new Float64Array(e * r.height);
|
|
2717
|
+
for (let s = 0; s < r.height; s += 1) {
|
|
2718
|
+
const i = s * r.width;
|
|
2719
|
+
t.set(r.values.subarray(i, i + r.width), s * e + 1), t[s * e] = r.values[i + r.width - 1], t[s * e + e - 1] = r.values[i];
|
|
2720
|
+
}
|
|
2721
|
+
const n = r.area.endLon - r.area.startLon;
|
|
2722
|
+
return {
|
|
2723
|
+
...r,
|
|
2724
|
+
width: e,
|
|
2725
|
+
values: t,
|
|
2726
|
+
mapCoordinate(s, i) {
|
|
2727
|
+
const [o] = r.mapCoordinate(0, i);
|
|
2728
|
+
return [o, r.area.startLon + (s - 1) / r.width * n];
|
|
2729
|
+
}
|
|
2730
|
+
};
|
|
2619
2731
|
}
|
|
2620
|
-
const
|
|
2732
|
+
const ue = (r, e, t) => [
|
|
2733
|
+
r[0] + (e[0] - r[0]) * (t - r[1]) / (e[1] - r[1]),
|
|
2734
|
+
t
|
|
2735
|
+
];
|
|
2736
|
+
function tt(r, e, t) {
|
|
2737
|
+
const n = [];
|
|
2738
|
+
let s = [];
|
|
2739
|
+
const i = () => {
|
|
2740
|
+
s.length > 1 && n.push(s), s = [];
|
|
2741
|
+
};
|
|
2742
|
+
for (let o = 1; o < r.length; o += 1) {
|
|
2743
|
+
const a = r[o - 1], u = r[o];
|
|
2744
|
+
if (Math.max(a[1], u[1]) < e || Math.min(a[1], u[1]) > t) {
|
|
2745
|
+
i();
|
|
2746
|
+
continue;
|
|
2747
|
+
}
|
|
2748
|
+
const l = a[1] < e ? ue(a, u, e) : a[1] > t ? ue(a, u, t) : a, c = u[1] < e ? ue(a, u, e) : u[1] > t ? ue(a, u, t) : u;
|
|
2749
|
+
ve(l, c) || (s.length && !ve(s.at(-1), l) && i(), s.length || s.push(l), s.push(c), (u[1] < e || u[1] > t) && i());
|
|
2750
|
+
}
|
|
2751
|
+
return i(), n.length > 1 && ve(n.at(-1).at(-1), n[0][0]) && (n[0] = [...n.pop(), ...n[0].slice(1)]), n;
|
|
2752
|
+
}
|
|
2753
|
+
function wr(r, e, t) {
|
|
2754
|
+
const n = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Set(), i = (l) => Math.abs(l[1] - e) <= Y ? "west" : Math.abs(l[1] - t) <= Y ? "east" : null;
|
|
2755
|
+
r.forEach((l, c) => {
|
|
2756
|
+
for (const h of [0, l.length - 1]) {
|
|
2757
|
+
const d = l[h], f = i(d);
|
|
2758
|
+
if (!f) continue;
|
|
2759
|
+
const y = `${f}:${Math.round(d[0] / Y)}`;
|
|
2760
|
+
n.has(y) || n.set(y, []), n.get(y).push({ index: c, end: h, point: d });
|
|
2761
|
+
}
|
|
2762
|
+
});
|
|
2763
|
+
const o = (l) => {
|
|
2764
|
+
var f;
|
|
2765
|
+
const c = i(l);
|
|
2766
|
+
if (!c) return null;
|
|
2767
|
+
const h = c === "west" ? "east" : "west", d = Math.round(l[0] / Y);
|
|
2768
|
+
for (const y of [0, -1, 1]) {
|
|
2769
|
+
const I = (f = n.get(`${h}:${d + y}`)) == null ? void 0 : f.find((v) => !s.has(v.index) && Math.abs(v.point[0] - l[0]) <= Y);
|
|
2770
|
+
if (I) return I;
|
|
2771
|
+
}
|
|
2772
|
+
return null;
|
|
2773
|
+
}, a = (l, c) => {
|
|
2774
|
+
let h = o(c);
|
|
2775
|
+
for (; h; ) {
|
|
2776
|
+
s.add(h.index);
|
|
2777
|
+
const d = h.end === 0 ? r[h.index] : [...r[h.index]].reverse(), f = l.at(-1)[1] - d[0][1];
|
|
2778
|
+
for (let y = 1; y < d.length; y += 1)
|
|
2779
|
+
l.push([d[y][0], d[y][1] + f]);
|
|
2780
|
+
h = o(d.at(-1));
|
|
2781
|
+
}
|
|
2782
|
+
}, u = [];
|
|
2783
|
+
return r.forEach((l, c) => {
|
|
2784
|
+
if (s.has(c)) return;
|
|
2785
|
+
s.add(c);
|
|
2786
|
+
const h = l.map((d) => [...d]);
|
|
2787
|
+
a(h, l.at(-1)), h.reverse(), a(h, l[0]), h.reverse(), u.push(h);
|
|
2788
|
+
}), u;
|
|
2789
|
+
}
|
|
2790
|
+
function Cr(r, e, t, n) {
|
|
2791
|
+
const { startLon: s, endLon: i } = e, o = i - s, a = r.flatMap((u) => tt(u, s, i));
|
|
2792
|
+
return wr(a, s, i).map((u) => It(u, t, o)).filter((u) => u.length >= n).flatMap((u) => {
|
|
2793
|
+
let l = 1 / 0, c = -1 / 0;
|
|
2794
|
+
for (const y of u)
|
|
2795
|
+
l = Math.min(l, y[1]), c = Math.max(c, y[1]);
|
|
2796
|
+
const h = [], d = Math.floor((l - s) / o), f = Math.floor((c - s) / o);
|
|
2797
|
+
for (let y = d; y <= f; y += 1) {
|
|
2798
|
+
const I = y * o;
|
|
2799
|
+
for (const v of tt(u, s + I, i + I))
|
|
2800
|
+
h.push(v.map(([P, b]) => [P, b - I]));
|
|
2801
|
+
}
|
|
2802
|
+
return h;
|
|
2803
|
+
});
|
|
2804
|
+
}
|
|
2805
|
+
const Me = 6378137, de = 85.0511287798066, fe = 1e6, k = "EPSG:4326", q = "EPSG:3857", Mr = /* @__PURE__ */ new Set([
|
|
2806
|
+
k,
|
|
2807
|
+
q
|
|
2808
|
+
]), K = Object.freeze({
|
|
2621
2809
|
enabled: !1,
|
|
2810
|
+
method: "neighborhood",
|
|
2622
2811
|
radius: 6,
|
|
2623
2812
|
minProminence: 2,
|
|
2624
2813
|
minGridDistance: 20,
|
|
@@ -2628,22 +2817,22 @@ const Fe = 6378137, De = 85.0511287798066, ee = 1e6, $ = Object.freeze({
|
|
|
2628
2817
|
excludeBoundary: !0,
|
|
2629
2818
|
smoothingIterations: 1
|
|
2630
2819
|
});
|
|
2631
|
-
function
|
|
2820
|
+
function N(r, e = null) {
|
|
2632
2821
|
const t = Number(r);
|
|
2633
2822
|
return Number.isFinite(t) ? t : e;
|
|
2634
2823
|
}
|
|
2635
|
-
function
|
|
2824
|
+
function gt(r, e) {
|
|
2636
2825
|
return Object.prototype.hasOwnProperty.call(r || {}, e);
|
|
2637
2826
|
}
|
|
2638
|
-
function
|
|
2827
|
+
function Ne(r) {
|
|
2639
2828
|
if (Array.isArray(r) && r.length >= 4) {
|
|
2640
|
-
const [i,
|
|
2641
|
-
if ([i,
|
|
2829
|
+
const [i, o, a, u] = r.map(Number);
|
|
2830
|
+
if ([i, o, a, u].every(Number.isFinite))
|
|
2642
2831
|
return {
|
|
2643
|
-
startLon: Math.min(i,
|
|
2644
|
-
startLat: Math.min(
|
|
2645
|
-
endLon: Math.max(i,
|
|
2646
|
-
endLat: Math.max(
|
|
2832
|
+
startLon: Math.min(i, a),
|
|
2833
|
+
startLat: Math.min(o, u),
|
|
2834
|
+
endLon: Math.max(i, a),
|
|
2835
|
+
endLat: Math.max(o, u)
|
|
2647
2836
|
};
|
|
2648
2837
|
}
|
|
2649
2838
|
if (!r || typeof r != "object")
|
|
@@ -2656,198 +2845,280 @@ function He(r) {
|
|
|
2656
2845
|
endLat: Math.max(t, s)
|
|
2657
2846
|
} : null;
|
|
2658
2847
|
}
|
|
2659
|
-
function
|
|
2848
|
+
function Tr(r = "") {
|
|
2660
2849
|
const e = String(r || "").trim().toUpperCase().replace("::", ":");
|
|
2661
|
-
return ["3857", "
|
|
2850
|
+
return ["3857", "EPSG3857", "EPSG:3857", "EPSG900913", "EPSG:900913", "900913"].includes(
|
|
2851
|
+
e
|
|
2852
|
+
) ? "EPSG:3857" : ["4326", "EPSG4326", "EPSG:4326", "WGS84", "WGS 84"].includes(e) ? "EPSG:4326" : e;
|
|
2662
2853
|
}
|
|
2663
|
-
function
|
|
2664
|
-
|
|
2665
|
-
return t === 3857 || t === 900913 ? "EPSG:3857" : Number(r.GeographicTypeGeoKey) === 4326 || e.length >= 4 && Math.abs(Number(e[0])) <= 360 && Math.abs(Number(e[2])) <= 360 && Math.abs(Number(e[1])) <= 180 && Math.abs(Number(e[3])) <= 180 ? "EPSG:4326" : "";
|
|
2854
|
+
function $(r) {
|
|
2855
|
+
return r != null && String(r).trim() !== "";
|
|
2666
2856
|
}
|
|
2667
|
-
function
|
|
2668
|
-
|
|
2857
|
+
function xe(r = {}, e = !1) {
|
|
2858
|
+
return $(r.sourceProjectionCrs) ? r.sourceProjectionCrs : $(r.sourceProjection) ? r.sourceProjection : e && $(r.projection) ? r.projection : "";
|
|
2859
|
+
}
|
|
2860
|
+
function Ee(r = {}) {
|
|
2861
|
+
return $(r.defaultSourceProjectionCrs) ? r.defaultSourceProjectionCrs : "";
|
|
2862
|
+
}
|
|
2863
|
+
function J(r, e = k) {
|
|
2864
|
+
const t = Tr(r) || e;
|
|
2865
|
+
if (!Mr.has(t))
|
|
2866
|
+
throw new Error(
|
|
2867
|
+
`暂不支持栅格投影“${t || r}”,当前仅支持 EPSG:4326 和 EPSG:3857。`
|
|
2868
|
+
);
|
|
2869
|
+
return t;
|
|
2870
|
+
}
|
|
2871
|
+
function Gr(r = []) {
|
|
2872
|
+
if (!Array.isArray(r) || r.length < 4) return !1;
|
|
2873
|
+
const [e, t, n, s] = r.slice(0, 4).map(Number);
|
|
2874
|
+
return [e, t, n, s].every(Number.isFinite) && e <= n && t <= s && n - e <= 360 && Math.abs(e) <= 360 && Math.abs(n) <= 360 && Math.abs(t) <= 90 && Math.abs(s) <= 90;
|
|
2875
|
+
}
|
|
2876
|
+
function Nr(r = {}, e = {}, t = []) {
|
|
2877
|
+
const n = xe(r);
|
|
2878
|
+
if (n)
|
|
2879
|
+
return J(n, "");
|
|
2880
|
+
if ($(e.ProjectedCSTypeGeoKey)) {
|
|
2881
|
+
const o = Number(e.ProjectedCSTypeGeoKey);
|
|
2882
|
+
if (o === 3857 || o === 900913)
|
|
2883
|
+
return q;
|
|
2884
|
+
throw new Error(
|
|
2885
|
+
`暂不支持 GeoTIFF 投影“EPSG:${e.ProjectedCSTypeGeoKey}”,当前仅支持 EPSG:4326 和 EPSG:3857。`
|
|
2886
|
+
);
|
|
2887
|
+
}
|
|
2888
|
+
const s = Number(e.GTModelTypeGeoKey);
|
|
2889
|
+
if ($(e.GTModelTypeGeoKey) && [1, 3].includes(s))
|
|
2890
|
+
throw new Error(
|
|
2891
|
+
"GeoTIFF 声明了未识别的投影坐标系,请通过 sourceProjectionCrs 显式指定 EPSG:3857。"
|
|
2892
|
+
);
|
|
2893
|
+
if ($(e.GeographicTypeGeoKey)) {
|
|
2894
|
+
if (Number(e.GeographicTypeGeoKey) === 4326)
|
|
2895
|
+
return k;
|
|
2896
|
+
throw new Error(
|
|
2897
|
+
`暂不支持 GeoTIFF 地理坐标系“EPSG:${e.GeographicTypeGeoKey}”,当前仅支持 EPSG:4326。`
|
|
2898
|
+
);
|
|
2899
|
+
}
|
|
2900
|
+
if ($(e.GTModelTypeGeoKey) && s === 2)
|
|
2901
|
+
throw new Error(
|
|
2902
|
+
"GeoTIFF 只声明了地理坐标模型,但缺少具体 CRS,请通过 sourceProjectionCrs 显式指定。"
|
|
2903
|
+
);
|
|
2904
|
+
const i = Ee(r);
|
|
2905
|
+
if (i)
|
|
2906
|
+
return J(i, "");
|
|
2907
|
+
if (Gr(t)) return k;
|
|
2908
|
+
throw new Error(
|
|
2909
|
+
"无法识别 GeoTIFF 投影,请通过 sourceProjectionCrs 显式指定 EPSG:4326 或 EPSG:3857。"
|
|
2910
|
+
);
|
|
2911
|
+
}
|
|
2912
|
+
function Te(r, e) {
|
|
2913
|
+
const t = Number(r) / Me * (180 / Math.PI), n = (2 * Math.atan(Math.exp(Number(e) / Me)) - Math.PI / 2) * (180 / Math.PI);
|
|
2669
2914
|
return {
|
|
2670
2915
|
lng: t,
|
|
2671
|
-
lat: Math.min(Math.max(n, -
|
|
2916
|
+
lat: Math.min(Math.max(n, -de), de)
|
|
2672
2917
|
};
|
|
2673
2918
|
}
|
|
2674
|
-
function
|
|
2919
|
+
function xr(r) {
|
|
2675
2920
|
return !Number.isFinite(r) || r >= -180 && r <= 180 ? r : ((r + 180) % 360 + 360) % 360 - 180;
|
|
2676
2921
|
}
|
|
2677
|
-
function
|
|
2678
|
-
|
|
2679
|
-
if (
|
|
2680
|
-
|
|
2922
|
+
function rt(r) {
|
|
2923
|
+
const e = Number(r);
|
|
2924
|
+
if (!Number.isFinite(e) || Math.abs(e) > de)
|
|
2925
|
+
throw new Error(
|
|
2926
|
+
`EPSG:3857 栅格的纬度范围不能超过 ±${de}°。`
|
|
2927
|
+
);
|
|
2928
|
+
const t = e * Math.PI / 180;
|
|
2929
|
+
return Me * Math.log(Math.tan(Math.PI / 4 + t / 2));
|
|
2930
|
+
}
|
|
2931
|
+
function nt({ area: r, projection: e, width: t, height: n, isSplit: s }) {
|
|
2932
|
+
let i = Ne(r);
|
|
2933
|
+
if (s && i && Math.abs(i.endLon - i.startLon) >= 359.999 && (i = {
|
|
2934
|
+
...i,
|
|
2681
2935
|
startLon: -180,
|
|
2682
2936
|
endLon: 180
|
|
2683
|
-
}),
|
|
2684
|
-
|
|
2937
|
+
}), !i)
|
|
2938
|
+
throw new Error("栅格缺少有效的地理范围。");
|
|
2939
|
+
const o = i.endLon - i.startLon;
|
|
2940
|
+
if (o === 0 || i.endLat === i.startLat)
|
|
2941
|
+
throw new Error("栅格地理范围无效,宽度或高度为 0。");
|
|
2942
|
+
const a = e === q ? rt(i.startLat) : i.startLat, u = e === q ? rt(i.endLat) : i.endLat, l = u - a;
|
|
2943
|
+
return {
|
|
2944
|
+
area: i,
|
|
2945
|
+
projection: e,
|
|
2946
|
+
map(c, h) {
|
|
2947
|
+
const d = u - h / n * l;
|
|
2948
|
+
return [
|
|
2949
|
+
e === q ? Te(0, d).lat : d,
|
|
2950
|
+
xr(i.startLon + c / t * o)
|
|
2951
|
+
];
|
|
2952
|
+
}
|
|
2953
|
+
};
|
|
2954
|
+
}
|
|
2955
|
+
function Ae({
|
|
2956
|
+
area: r,
|
|
2957
|
+
bbox: e,
|
|
2958
|
+
projection: t,
|
|
2959
|
+
bboxProjection: n,
|
|
2960
|
+
width: s,
|
|
2961
|
+
height: i,
|
|
2962
|
+
isSplit: o = !1
|
|
2963
|
+
}) {
|
|
2964
|
+
const a = J(t), u = Ne(r);
|
|
2965
|
+
if (u)
|
|
2685
2966
|
return {
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2967
|
+
...nt({
|
|
2968
|
+
area: u,
|
|
2969
|
+
projection: a,
|
|
2970
|
+
width: s,
|
|
2971
|
+
height: i,
|
|
2972
|
+
isSplit: o
|
|
2973
|
+
}),
|
|
2974
|
+
bboxProjection: k
|
|
2694
2975
|
};
|
|
2695
|
-
|
|
2696
|
-
if (!Array.isArray(e) || e.length < 4 || !e.slice(0, 4).every(Number.isFinite))
|
|
2976
|
+
if (!Array.isArray(e) || e.length < 4)
|
|
2697
2977
|
throw new Error("栅格缺少地理范围,请通过 area 提供 [west, south, east, north]。");
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
const h = l - o, y = c - u;
|
|
2701
|
-
if (h === 0 || y === 0)
|
|
2978
|
+
const [l, c, h, d] = e.slice(0, 4).map(Number);
|
|
2979
|
+
if (![l, c, h, d].every(Number.isFinite) || h === l || d === c)
|
|
2702
2980
|
throw new Error("栅格地理范围无效,宽度或高度为 0。");
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
|
|
2981
|
+
const f = J(
|
|
2982
|
+
n,
|
|
2983
|
+
a
|
|
2984
|
+
), y = f === q ? Te(l, c) : { lng: l, lat: c }, I = f === q ? Te(h, d) : { lng: h, lat: d };
|
|
2985
|
+
return {
|
|
2986
|
+
...nt({
|
|
2706
2987
|
area: {
|
|
2707
|
-
startLon:
|
|
2708
|
-
startLat:
|
|
2988
|
+
startLon: y.lng,
|
|
2989
|
+
startLat: y.lat,
|
|
2709
2990
|
endLon: I.lng,
|
|
2710
2991
|
endLat: I.lat
|
|
2711
2992
|
},
|
|
2712
|
-
projection:
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
return [g.lat, le(g.lng)];
|
|
2719
|
-
}
|
|
2720
|
-
};
|
|
2721
|
-
}
|
|
2722
|
-
if (t && t !== "EPSG:4326")
|
|
2723
|
-
throw new Error(`暂不支持 ${t} 栅格,请传入 WGS84 area 覆盖原始范围。`);
|
|
2724
|
-
return {
|
|
2725
|
-
area: {
|
|
2726
|
-
startLon: o,
|
|
2727
|
-
startLat: u,
|
|
2728
|
-
endLon: l,
|
|
2729
|
-
endLat: c
|
|
2730
|
-
},
|
|
2731
|
-
projection: t || "EPSG:4326",
|
|
2732
|
-
map(d, I) {
|
|
2733
|
-
return [c - I / s * y, le(o + d / n * h)];
|
|
2734
|
-
}
|
|
2993
|
+
projection: a,
|
|
2994
|
+
width: s,
|
|
2995
|
+
height: i,
|
|
2996
|
+
isSplit: o
|
|
2997
|
+
}),
|
|
2998
|
+
bboxProjection: f
|
|
2735
2999
|
};
|
|
2736
3000
|
}
|
|
2737
|
-
function
|
|
3001
|
+
function Er(r = {}) {
|
|
2738
3002
|
const e = String(r.sourceType || r.dataType || "").toLowerCase();
|
|
2739
3003
|
return ["tif", "tiff", "geotiff"].includes(e) ? "geotiff" : ["gray", "grey", "grayscale", "greyscale", "image"].includes(e) ? "grayscale" : ["grid", "array", "values"].includes(e) ? "grid" : r.tifUrl || r.tiffUrl || r.arrayBuffer ? "geotiff" : r.grayImageUrl || r.imageUrl ? "grayscale" : r.values || r.data || r.grid ? "grid" : "";
|
|
2740
3004
|
}
|
|
2741
|
-
function
|
|
3005
|
+
function Ar() {
|
|
2742
3006
|
return typeof window > "u" ? null : window.GeoTIFF || null;
|
|
2743
3007
|
}
|
|
2744
|
-
function
|
|
3008
|
+
function Rr(r, e = {}, t = null) {
|
|
2745
3009
|
if (!Number.isFinite(r)) return !0;
|
|
2746
|
-
const n =
|
|
3010
|
+
const n = gt(e, "noDataValue") ? Number(e.noDataValue) : t;
|
|
2747
3011
|
if (Number.isFinite(n) && r === n) return !0;
|
|
2748
|
-
const s =
|
|
3012
|
+
const s = N(e.validMin), i = N(e.validMax);
|
|
2749
3013
|
return s !== null && r < s || i !== null && r > i;
|
|
2750
3014
|
}
|
|
2751
|
-
function
|
|
2752
|
-
const n =
|
|
2753
|
-
for (let
|
|
2754
|
-
const
|
|
2755
|
-
i[
|
|
3015
|
+
function bt(r, e = {}, t = null) {
|
|
3016
|
+
const n = N(e.scale, 1), s = N(e.offset, 0), i = new Float64Array(r.length);
|
|
3017
|
+
for (let o = 0; o < r.length; o += 1) {
|
|
3018
|
+
const a = Number(r[o]);
|
|
3019
|
+
i[o] = Rr(a, e, t) ? Number.NaN : a * n + s;
|
|
2756
3020
|
}
|
|
2757
3021
|
return i;
|
|
2758
3022
|
}
|
|
2759
|
-
function
|
|
3023
|
+
function pt(r, e, t) {
|
|
2760
3024
|
const n = new Float64Array(r.length), s = Math.floor(e / 2);
|
|
2761
3025
|
for (let i = 0; i < t; i += 1)
|
|
2762
|
-
for (let
|
|
2763
|
-
const
|
|
2764
|
-
n[i * e +
|
|
3026
|
+
for (let o = 0; o < e; o += 1) {
|
|
3027
|
+
const a = (o + s) % e;
|
|
3028
|
+
n[i * e + o] = r[i * e + a];
|
|
2765
3029
|
}
|
|
2766
3030
|
return n;
|
|
2767
3031
|
}
|
|
2768
|
-
async function
|
|
2769
|
-
var
|
|
2770
|
-
const e =
|
|
3032
|
+
async function Dr(r = {}) {
|
|
3033
|
+
var b, w, S;
|
|
3034
|
+
const e = Ar();
|
|
2771
3035
|
if (!e)
|
|
2772
3036
|
throw new Error("GeoTIFF 未加载,请先提供 window.GeoTIFF。");
|
|
2773
3037
|
let t = r.arrayBuffer || null;
|
|
2774
3038
|
const n = r.tifUrl || r.tiffUrl || "";
|
|
2775
3039
|
if (!t) {
|
|
2776
3040
|
if (!n) throw new Error("GeoTIFF 数据源缺少 tifUrl。");
|
|
2777
|
-
t = (await
|
|
3041
|
+
t = (await wt.get(n, { responseType: "arraybuffer" })).data;
|
|
2778
3042
|
}
|
|
2779
|
-
const s = await e.fromArrayBuffer(t), i = Math.max(Math.floor(
|
|
2780
|
-
if (l >=
|
|
3043
|
+
const s = await e.fromArrayBuffer(t), i = Math.max(Math.floor(N(r.imageIndex, 0)), 0), o = await s.getImage(i), a = o.getWidth(), u = o.getHeight(), l = Math.max(Math.floor(N(r.band, 0)), 0);
|
|
3044
|
+
if (l >= o.getSamplesPerPixel())
|
|
2781
3045
|
throw new Error(`GeoTIFF 不存在第 ${l} 个波段。`);
|
|
2782
|
-
const c = { samples: [l], interleave: !1 }, h = await
|
|
2783
|
-
let
|
|
2784
|
-
r.isSplit && (
|
|
2785
|
-
let
|
|
3046
|
+
const c = { samples: [l], interleave: !1 }, h = await o.readRasters(c), d = N((b = o.getGDALNoData) == null ? void 0 : b.call(o));
|
|
3047
|
+
let f = bt(h[0], r, d);
|
|
3048
|
+
r.isSplit && (f = pt(f, a, u));
|
|
3049
|
+
let y = [];
|
|
2786
3050
|
try {
|
|
2787
|
-
|
|
2788
|
-
} catch (
|
|
2789
|
-
if (!r.area) throw
|
|
3051
|
+
y = ((w = o.getBoundingBox) == null ? void 0 : w.call(o)) || [];
|
|
3052
|
+
} catch (g) {
|
|
3053
|
+
if (!r.area) throw g;
|
|
2790
3054
|
}
|
|
2791
|
-
const
|
|
3055
|
+
const I = ((S = o.getGeoKeys) == null ? void 0 : S.call(o)) || {}, v = Nr(r, I, y), P = Ae({
|
|
2792
3056
|
area: r.area,
|
|
2793
|
-
bbox:
|
|
2794
|
-
projection:
|
|
2795
|
-
|
|
3057
|
+
bbox: y,
|
|
3058
|
+
projection: v,
|
|
3059
|
+
bboxProjection: r.area ? k : v,
|
|
3060
|
+
width: a,
|
|
2796
3061
|
height: u,
|
|
2797
3062
|
isSplit: r.isSplit
|
|
2798
3063
|
});
|
|
2799
3064
|
return {
|
|
2800
3065
|
sourceType: "geotiff",
|
|
2801
3066
|
sourceUrl: n,
|
|
2802
|
-
width:
|
|
3067
|
+
width: a,
|
|
2803
3068
|
height: u,
|
|
2804
|
-
values:
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
|
|
2808
|
-
|
|
3069
|
+
values: f,
|
|
3070
|
+
sourceProjectionCrs: v,
|
|
3071
|
+
sourceProjection: v,
|
|
3072
|
+
projection: P.projection,
|
|
3073
|
+
bboxProjection: P.bboxProjection,
|
|
3074
|
+
area: P.area,
|
|
3075
|
+
mapCoordinate: P.map,
|
|
2809
3076
|
band: l
|
|
2810
3077
|
};
|
|
2811
3078
|
}
|
|
2812
|
-
function
|
|
3079
|
+
function Fr(r) {
|
|
2813
3080
|
return new Promise((e, t) => {
|
|
2814
3081
|
const n = new Image();
|
|
2815
3082
|
n.crossOrigin = "anonymous", n.onload = () => e(n), n.onerror = () => t(new Error(`灰度图加载失败:${r}`)), n.src = r;
|
|
2816
3083
|
});
|
|
2817
3084
|
}
|
|
2818
|
-
function
|
|
3085
|
+
function Br(r, e, t = "luminance") {
|
|
2819
3086
|
return t === "red" ? r[e] : t === "green" ? r[e + 1] : t === "blue" ? r[e + 2] : t === "average" ? (r[e] + r[e + 1] + r[e + 2]) / 3 : r[e] * 0.2126 + r[e + 1] * 0.7152 + r[e + 2] * 0.0722;
|
|
2820
3087
|
}
|
|
2821
|
-
async function
|
|
3088
|
+
async function Or(r = {}) {
|
|
2822
3089
|
if (typeof document > "u" || typeof Image > "u")
|
|
2823
3090
|
throw new Error("灰度图解析只能在浏览器环境中运行。");
|
|
2824
|
-
const e = r.grayImageUrl || r.imageUrl || "", t =
|
|
3091
|
+
const e = r.grayImageUrl || r.imageUrl || "", t = Ne(r.area);
|
|
2825
3092
|
if (!e) throw new Error("灰度图数据源缺少 grayImageUrl 或 imageUrl。");
|
|
2826
3093
|
if (!t) throw new Error("灰度图没有地理信息,必须通过 area 提供覆盖范围。");
|
|
2827
|
-
const n = await
|
|
2828
|
-
|
|
2829
|
-
const
|
|
2830
|
-
if (!
|
|
2831
|
-
|
|
3094
|
+
const n = await Fr(e), s = n.naturalWidth || n.width, i = n.naturalHeight || n.height, o = document.createElement("canvas");
|
|
3095
|
+
o.width = s, o.height = i;
|
|
3096
|
+
const a = o.getContext("2d", { willReadFrequently: !0 });
|
|
3097
|
+
if (!a) throw new Error("当前浏览器不支持 Canvas 2D。");
|
|
3098
|
+
a.drawImage(n, 0, 0, s, i);
|
|
2832
3099
|
let u;
|
|
2833
3100
|
try {
|
|
2834
|
-
u =
|
|
2835
|
-
} catch (
|
|
2836
|
-
throw new Error(`灰度图像素读取失败,请检查图片 CORS:${(
|
|
2837
|
-
}
|
|
2838
|
-
const l =
|
|
2839
|
-
for (let
|
|
2840
|
-
for (let
|
|
2841
|
-
const
|
|
2842
|
-
if (u[
|
|
2843
|
-
|
|
3101
|
+
u = a.getImageData(0, 0, s, i).data;
|
|
3102
|
+
} catch (g) {
|
|
3103
|
+
throw new Error(`灰度图像素读取失败,请检查图片 CORS:${(g == null ? void 0 : g.message) || ""}`);
|
|
3104
|
+
}
|
|
3105
|
+
const l = N(r.grayMinValue, 0), c = N(r.grayMaxValue, 255), h = N(r.minValue, l), d = N(r.maxValue, c), f = c - l, y = String(r.grayChannel || r.grayMode || "luminance").toLowerCase(), I = gt(r, "noDataValue"), v = Number(r.noDataValue), P = r.isSplit ? Math.floor(s / 2) : 0, b = new Float64Array(s * i);
|
|
3106
|
+
for (let g = 0; g < i; g += 1)
|
|
3107
|
+
for (let C = 0; C < s; C += 1) {
|
|
3108
|
+
const T = (C + P) % s, G = (g * s + T) * 4, x = g * s + C, L = Br(u, G, y);
|
|
3109
|
+
if (u[G + 3] === 0 || I && Math.abs(L - v) < 0.5) {
|
|
3110
|
+
b[x] = Number.NaN;
|
|
2844
3111
|
continue;
|
|
2845
3112
|
}
|
|
2846
|
-
let
|
|
2847
|
-
|
|
3113
|
+
let M = f === 0 ? 0 : (L - l) / f;
|
|
3114
|
+
M = Math.min(Math.max(M, 0), 1), r.invert && (M = 1 - M), b[x] = h + M * (d - h);
|
|
2848
3115
|
}
|
|
2849
|
-
const
|
|
3116
|
+
const w = J(
|
|
3117
|
+
xe(r, !0) || Ee(r)
|
|
3118
|
+
), S = Ae({
|
|
2850
3119
|
area: t,
|
|
3120
|
+
projection: w,
|
|
3121
|
+
bboxProjection: k,
|
|
2851
3122
|
width: s,
|
|
2852
3123
|
height: i,
|
|
2853
3124
|
isSplit: r.isSplit
|
|
@@ -2857,42 +3128,47 @@ async function ar(r = {}) {
|
|
|
2857
3128
|
sourceUrl: e,
|
|
2858
3129
|
width: s,
|
|
2859
3130
|
height: i,
|
|
2860
|
-
values:
|
|
2861
|
-
|
|
2862
|
-
|
|
2863
|
-
|
|
2864
|
-
|
|
3131
|
+
values: b,
|
|
3132
|
+
sourceProjectionCrs: w,
|
|
3133
|
+
sourceProjection: w,
|
|
3134
|
+
projection: S.projection,
|
|
3135
|
+
bboxProjection: S.bboxProjection,
|
|
3136
|
+
area: S.area,
|
|
3137
|
+
mapCoordinate: S.map,
|
|
2865
3138
|
band: 0
|
|
2866
3139
|
};
|
|
2867
3140
|
}
|
|
2868
|
-
function
|
|
3141
|
+
function jr(r = {}) {
|
|
2869
3142
|
var s;
|
|
2870
3143
|
const e = r.values || r.data || r.grid;
|
|
2871
3144
|
if (!e) return null;
|
|
2872
3145
|
if (Array.isArray(e) && Array.isArray(e[0])) {
|
|
2873
|
-
const i = e.length,
|
|
2874
|
-
if (!
|
|
3146
|
+
const i = e.length, o = ((s = e[0]) == null ? void 0 : s.length) || 0;
|
|
3147
|
+
if (!o || e.some((a) => !Array.isArray(a) || a.length !== o))
|
|
2875
3148
|
throw new Error("二维数值网格的每一行长度必须一致。");
|
|
2876
3149
|
return {
|
|
2877
|
-
width:
|
|
3150
|
+
width: o,
|
|
2878
3151
|
height: i,
|
|
2879
3152
|
values: e.flat()
|
|
2880
3153
|
};
|
|
2881
3154
|
}
|
|
2882
|
-
const t = Math.floor(
|
|
3155
|
+
const t = Math.floor(N(r.width, 0)), n = Math.floor(N(r.height, 0));
|
|
2883
3156
|
if (t < 2 || n < 2 || e.length < t * n)
|
|
2884
3157
|
throw new Error("一维数值网格必须提供正确的 width 和 height。");
|
|
2885
3158
|
return { width: t, height: n, values: e };
|
|
2886
3159
|
}
|
|
2887
|
-
function
|
|
2888
|
-
const e =
|
|
3160
|
+
function _r(r = {}) {
|
|
3161
|
+
const e = jr(r);
|
|
2889
3162
|
if (!e) throw new Error("数值网格缺少 values、data 或 grid。");
|
|
2890
|
-
let t =
|
|
2891
|
-
r.isSplit && (t =
|
|
2892
|
-
const n =
|
|
3163
|
+
let t = bt(e.values, r);
|
|
3164
|
+
r.isSplit && (t = pt(t, e.width, e.height));
|
|
3165
|
+
const n = J(
|
|
3166
|
+
xe(r, !0) || Ee(r)
|
|
3167
|
+
), s = Ae({
|
|
2893
3168
|
area: r.area,
|
|
2894
3169
|
bbox: r.bbox,
|
|
2895
|
-
projection:
|
|
3170
|
+
projection: n,
|
|
3171
|
+
bboxProjection: r.area ? k : r.bboxProjection || n,
|
|
2896
3172
|
width: e.width,
|
|
2897
3173
|
height: e.height,
|
|
2898
3174
|
isSplit: r.isSplit
|
|
@@ -2903,21 +3179,23 @@ function lr(r = {}) {
|
|
|
2903
3179
|
width: e.width,
|
|
2904
3180
|
height: e.height,
|
|
2905
3181
|
values: t,
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
|
|
2909
|
-
|
|
3182
|
+
sourceProjectionCrs: n,
|
|
3183
|
+
sourceProjection: n,
|
|
3184
|
+
projection: s.projection,
|
|
3185
|
+
bboxProjection: s.bboxProjection,
|
|
3186
|
+
area: s.area,
|
|
3187
|
+
mapCoordinate: s.map,
|
|
2910
3188
|
band: 0
|
|
2911
3189
|
};
|
|
2912
3190
|
}
|
|
2913
|
-
async function
|
|
2914
|
-
const e =
|
|
2915
|
-
if (e === "geotiff") return
|
|
2916
|
-
if (e === "grayscale") return
|
|
2917
|
-
if (e === "grid") return
|
|
3191
|
+
async function Vr(r = {}) {
|
|
3192
|
+
const e = Er(r);
|
|
3193
|
+
if (e === "geotiff") return Dr(r);
|
|
3194
|
+
if (e === "grayscale") return Or(r);
|
|
3195
|
+
if (e === "grid") return _r(r);
|
|
2918
3196
|
throw new Error("无法识别栅格数据源,请提供 tifUrl、grayImageUrl 或 values。");
|
|
2919
3197
|
}
|
|
2920
|
-
function
|
|
3198
|
+
function zr(r) {
|
|
2921
3199
|
let e = Number.POSITIVE_INFINITY, t = Number.NEGATIVE_INFINITY, n = 0;
|
|
2922
3200
|
for (let s = 0; s < r.length; s += 1) {
|
|
2923
3201
|
const i = Number(r[s]);
|
|
@@ -2926,26 +3204,26 @@ function cr(r) {
|
|
|
2926
3204
|
if (!n) throw new Error("栅格中没有可用于生成等值线的有效数值。");
|
|
2927
3205
|
return { min: e, max: t, validCount: n, noDataCount: r.length - n };
|
|
2928
3206
|
}
|
|
2929
|
-
function
|
|
2930
|
-
const t = Math.max(Math.floor(
|
|
3207
|
+
function Ur(r, e = fe) {
|
|
3208
|
+
const t = Math.max(Math.floor(N(e, fe)), 4);
|
|
2931
3209
|
if (r.width * r.height <= t)
|
|
2932
3210
|
return r;
|
|
2933
|
-
const n = Math.sqrt(t / (r.width * r.height)), s = Math.max(Math.floor(r.width * n), 2), i = Math.max(Math.floor(r.height * n), 2),
|
|
2934
|
-
for (let
|
|
2935
|
-
const u = Math.round(
|
|
3211
|
+
const n = Math.sqrt(t / (r.width * r.height)), s = Math.max(Math.floor(r.width * n), 2), i = Math.max(Math.floor(r.height * n), 2), o = new Float64Array(s * i);
|
|
3212
|
+
for (let a = 0; a < i; a += 1) {
|
|
3213
|
+
const u = Math.round(a / Math.max(i - 1, 1) * (r.height - 1));
|
|
2936
3214
|
for (let l = 0; l < s; l += 1) {
|
|
2937
3215
|
const c = Math.round(l / Math.max(s - 1, 1) * (r.width - 1));
|
|
2938
|
-
a
|
|
3216
|
+
o[a * s + l] = r.values[u * r.width + c];
|
|
2939
3217
|
}
|
|
2940
3218
|
}
|
|
2941
3219
|
return {
|
|
2942
3220
|
...r,
|
|
2943
3221
|
width: s,
|
|
2944
3222
|
height: i,
|
|
2945
|
-
values:
|
|
2946
|
-
mapCoordinate(
|
|
3223
|
+
values: o,
|
|
3224
|
+
mapCoordinate(a, u) {
|
|
2947
3225
|
return r.mapCoordinate(
|
|
2948
|
-
|
|
3226
|
+
a / s * r.width,
|
|
2949
3227
|
u / i * r.height
|
|
2950
3228
|
);
|
|
2951
3229
|
},
|
|
@@ -2954,108 +3232,84 @@ function hr(r, e = ee) {
|
|
|
2954
3232
|
originalHeight: r.height
|
|
2955
3233
|
};
|
|
2956
3234
|
}
|
|
2957
|
-
function
|
|
3235
|
+
function st(r, e = 10) {
|
|
2958
3236
|
const t = 10 ** e;
|
|
2959
3237
|
return Math.round(r * t) / t;
|
|
2960
3238
|
}
|
|
2961
|
-
function
|
|
3239
|
+
function $r(r, e = {}) {
|
|
2962
3240
|
const t = e.thresholds || e.levels;
|
|
2963
3241
|
if (Array.isArray(t))
|
|
2964
|
-
return [...new Set(t.map(Number).filter(Number.isFinite))].filter((
|
|
2965
|
-
const n =
|
|
3242
|
+
return [...new Set(t.map(Number).filter(Number.isFinite))].filter((o) => o > r.min && o < r.max).sort((o, a) => o - a);
|
|
3243
|
+
const n = N(e.interval ?? e.contourInterval);
|
|
2966
3244
|
if (n !== null && n > 0) {
|
|
2967
|
-
const
|
|
2968
|
-
let
|
|
2969
|
-
for (;
|
|
2970
|
-
|
|
2971
|
-
return
|
|
3245
|
+
const o = [];
|
|
3246
|
+
let a = Math.ceil(r.min / n) * n;
|
|
3247
|
+
for (; a < r.max && o.length < 200; )
|
|
3248
|
+
a > r.min && o.push(st(a)), a += n;
|
|
3249
|
+
return o;
|
|
2972
3250
|
}
|
|
2973
3251
|
const s = Math.min(
|
|
2974
|
-
Math.max(Math.floor(
|
|
3252
|
+
Math.max(Math.floor(N(e.thresholdCount ?? e.levelCount, 12)), 1),
|
|
2975
3253
|
100
|
|
2976
3254
|
), i = (r.max - r.min) / (s + 1);
|
|
2977
3255
|
return Array.from(
|
|
2978
3256
|
{ length: s },
|
|
2979
|
-
(
|
|
3257
|
+
(o, a) => st(r.min + i * (a + 1))
|
|
2980
3258
|
);
|
|
2981
3259
|
}
|
|
2982
|
-
function
|
|
3260
|
+
function kr(r, e, t, n) {
|
|
2983
3261
|
return Math.abs(r[0]) < 1e-7 && Math.abs(e[0]) < 1e-7 || Math.abs(r[0] - t) < 1e-7 && Math.abs(e[0] - t) < 1e-7 || Math.abs(r[1]) < 1e-7 && Math.abs(e[1]) < 1e-7 || Math.abs(r[1] - n) < 1e-7 && Math.abs(e[1] - n) < 1e-7;
|
|
2984
3262
|
}
|
|
2985
|
-
function
|
|
3263
|
+
function Wr(r = [], e, t) {
|
|
2986
3264
|
const n = [...r];
|
|
2987
3265
|
if (n.length > 1 && n[0][0] === n[n.length - 1][0] && n[0][1] === n[n.length - 1][1] && n.pop(), n.length < 2) return [];
|
|
2988
3266
|
const s = n.map(
|
|
2989
|
-
(u, l) =>
|
|
3267
|
+
(u, l) => kr(u, n[(l + 1) % n.length], e, t)
|
|
2990
3268
|
), i = s.findIndex(Boolean);
|
|
2991
3269
|
if (i < 0)
|
|
2992
3270
|
return [[...n, n[0]]];
|
|
2993
|
-
const
|
|
2994
|
-
let
|
|
3271
|
+
const o = [];
|
|
3272
|
+
let a = [];
|
|
2995
3273
|
for (let u = 1; u <= n.length; u += 1) {
|
|
2996
3274
|
const l = (i + u) % n.length, c = (l + 1) % n.length;
|
|
2997
3275
|
if (s[l]) {
|
|
2998
|
-
|
|
3276
|
+
a.length > 1 && o.push(a), a = [];
|
|
2999
3277
|
continue;
|
|
3000
3278
|
}
|
|
3001
|
-
|
|
3279
|
+
a.length === 0 && a.push(n[l]), a.push(n[c]);
|
|
3002
3280
|
}
|
|
3003
|
-
return
|
|
3281
|
+
return a.length > 1 && o.push(a), o;
|
|
3004
3282
|
}
|
|
3005
|
-
function
|
|
3283
|
+
function Hr(r = {}) {
|
|
3006
3284
|
return r.type === "Polygon" ? r.coordinates || [] : r.type === "MultiPolygon" ? (r.coordinates || []).flatMap((e) => e) : [];
|
|
3007
3285
|
}
|
|
3008
|
-
function
|
|
3009
|
-
return (r == null ? void 0 : r[0]) === (e == null ? void 0 : e[0]) && (r == null ? void 0 : r[1]) === (e == null ? void 0 : e[1]);
|
|
3010
|
-
}
|
|
3011
|
-
function mr(r = [], e = 0) {
|
|
3012
|
-
const t = Math.min(Math.max(Math.floor(e), 0), 3);
|
|
3013
|
-
if (t === 0 || r.length < 3) return r;
|
|
3014
|
-
const n = gr(r[0], r[r.length - 1]);
|
|
3015
|
-
let s = n ? r.slice(0, -1) : [...r];
|
|
3016
|
-
for (let i = 0; i < t; i += 1) {
|
|
3017
|
-
const a = n ? [] : [s[0]], o = n ? s.length : s.length - 1;
|
|
3018
|
-
for (let u = 0; u < o; u += 1) {
|
|
3019
|
-
const l = s[u], c = s[(u + 1) % s.length];
|
|
3020
|
-
a.push([
|
|
3021
|
-
l[0] * 0.75 + c[0] * 0.25,
|
|
3022
|
-
l[1] * 0.75 + c[1] * 0.25
|
|
3023
|
-
]), a.push([
|
|
3024
|
-
l[0] * 0.25 + c[0] * 0.75,
|
|
3025
|
-
l[1] * 0.25 + c[1] * 0.75
|
|
3026
|
-
]);
|
|
3027
|
-
}
|
|
3028
|
-
n || a.push(s[s.length - 1]), s = a;
|
|
3029
|
-
}
|
|
3030
|
-
return n ? [...s, s[0]] : s;
|
|
3031
|
-
}
|
|
3032
|
-
function br(r, e, t = 6) {
|
|
3286
|
+
function it(r, e, t = 6) {
|
|
3033
3287
|
const n = 10 ** Math.max(Math.floor(t), 0), s = [];
|
|
3034
3288
|
return r.forEach((i) => {
|
|
3035
|
-
const
|
|
3036
|
-
if (!(
|
|
3037
|
-
const
|
|
3038
|
-
(!u || u[0] !==
|
|
3289
|
+
const o = e(i[0], i[1]);
|
|
3290
|
+
if (!(o != null && o.every(Number.isFinite))) return;
|
|
3291
|
+
const a = o.map((l) => Math.round(l * n) / n), u = s[s.length - 1];
|
|
3292
|
+
(!u || u[0] !== a[0] || u[1] !== a[1]) && s.push(a);
|
|
3039
3293
|
}), s;
|
|
3040
3294
|
}
|
|
3041
|
-
function
|
|
3295
|
+
function Yr(r = {}) {
|
|
3042
3296
|
const e = r && typeof r == "object" ? r : {};
|
|
3043
3297
|
return {
|
|
3044
3298
|
enabled: e.enabled === !0,
|
|
3045
3299
|
radius: Math.max(
|
|
3046
|
-
Math.floor(
|
|
3300
|
+
Math.floor(N(e.radius, K.radius)),
|
|
3047
3301
|
1
|
|
3048
3302
|
),
|
|
3049
3303
|
minProminence: Math.max(
|
|
3050
|
-
|
|
3304
|
+
N(e.minProminence, K.minProminence),
|
|
3051
3305
|
0
|
|
3052
3306
|
),
|
|
3053
3307
|
minGridDistance: Math.max(
|
|
3054
|
-
|
|
3308
|
+
N(e.minGridDistance, K.minGridDistance),
|
|
3055
3309
|
0
|
|
3056
3310
|
),
|
|
3057
3311
|
maxCount: Math.max(
|
|
3058
|
-
Math.floor(
|
|
3312
|
+
Math.floor(N(e.maxCount, K.maxCount)),
|
|
3059
3313
|
0
|
|
3060
3314
|
),
|
|
3061
3315
|
includeHigh: e.includeHigh !== !1,
|
|
@@ -3064,9 +3318,9 @@ function pr(r = {}) {
|
|
|
3064
3318
|
smoothingIterations: Math.min(
|
|
3065
3319
|
Math.max(
|
|
3066
3320
|
Math.floor(
|
|
3067
|
-
|
|
3321
|
+
N(
|
|
3068
3322
|
e.smoothingIterations,
|
|
3069
|
-
|
|
3323
|
+
K.smoothingIterations
|
|
3070
3324
|
)
|
|
3071
3325
|
),
|
|
3072
3326
|
0
|
|
@@ -3075,30 +3329,30 @@ function pr(r = {}) {
|
|
|
3075
3329
|
)
|
|
3076
3330
|
};
|
|
3077
3331
|
}
|
|
3078
|
-
function
|
|
3079
|
-
const e = r.width * r.height, t = e >
|
|
3332
|
+
function qr(r) {
|
|
3333
|
+
const e = r.width * r.height, t = e > fe ? Math.max(Math.ceil(Math.sqrt(e / fe)), 2) : 1;
|
|
3080
3334
|
if (t === 1)
|
|
3081
3335
|
return {
|
|
3082
3336
|
width: r.width,
|
|
3083
3337
|
height: r.height,
|
|
3084
3338
|
values: r.values,
|
|
3085
3339
|
stride: t,
|
|
3086
|
-
getSourceBounds(
|
|
3087
|
-
return { startX:
|
|
3340
|
+
getSourceBounds(o, a) {
|
|
3341
|
+
return { startX: o, endX: o, startY: a, endY: a };
|
|
3088
3342
|
}
|
|
3089
3343
|
};
|
|
3090
3344
|
const n = Math.ceil(r.width / t), s = Math.ceil(r.height / t), i = new Float64Array(n * s);
|
|
3091
|
-
for (let
|
|
3092
|
-
const
|
|
3345
|
+
for (let o = 0; o < s; o += 1) {
|
|
3346
|
+
const a = o * t, u = Math.min(a + t - 1, r.height - 1);
|
|
3093
3347
|
for (let l = 0; l < n; l += 1) {
|
|
3094
3348
|
const c = l * t, h = Math.min(c + t - 1, r.width - 1);
|
|
3095
|
-
let
|
|
3096
|
-
for (let
|
|
3097
|
-
for (let
|
|
3098
|
-
const
|
|
3099
|
-
Number.isFinite(
|
|
3349
|
+
let d = 0, f = 0;
|
|
3350
|
+
for (let y = a; y <= u; y += 1)
|
|
3351
|
+
for (let I = c; I <= h; I += 1) {
|
|
3352
|
+
const v = Number(r.values[y * r.width + I]);
|
|
3353
|
+
Number.isFinite(v) && (d += v, f += 1);
|
|
3100
3354
|
}
|
|
3101
|
-
i[
|
|
3355
|
+
i[o * n + l] = f > 0 ? d / f : Number.NaN;
|
|
3102
3356
|
}
|
|
3103
3357
|
}
|
|
3104
3358
|
return {
|
|
@@ -3106,8 +3360,8 @@ function Sr(r) {
|
|
|
3106
3360
|
height: s,
|
|
3107
3361
|
values: i,
|
|
3108
3362
|
stride: t,
|
|
3109
|
-
getSourceBounds(
|
|
3110
|
-
const u =
|
|
3363
|
+
getSourceBounds(o, a) {
|
|
3364
|
+
const u = o * t, l = a * t;
|
|
3111
3365
|
return {
|
|
3112
3366
|
startX: u,
|
|
3113
3367
|
endX: Math.min(u + t - 1, r.width - 1),
|
|
@@ -3117,134 +3371,134 @@ function Sr(r) {
|
|
|
3117
3371
|
}
|
|
3118
3372
|
};
|
|
3119
3373
|
}
|
|
3120
|
-
function
|
|
3374
|
+
function Xr(r, e, t, n) {
|
|
3121
3375
|
let s = r;
|
|
3122
3376
|
for (let i = 0; i < n; i += 1) {
|
|
3123
|
-
const
|
|
3124
|
-
for (let
|
|
3377
|
+
const o = new Float64Array(r.length);
|
|
3378
|
+
for (let a = 0; a < t; a += 1)
|
|
3125
3379
|
for (let u = 0; u < e; u += 1) {
|
|
3126
|
-
const l =
|
|
3380
|
+
const l = a * e + u;
|
|
3127
3381
|
if (!Number.isFinite(Number(s[l]))) {
|
|
3128
|
-
|
|
3382
|
+
o[l] = Number.NaN;
|
|
3129
3383
|
continue;
|
|
3130
3384
|
}
|
|
3131
3385
|
let c = 0, h = 0;
|
|
3132
|
-
for (let
|
|
3133
|
-
const
|
|
3134
|
-
if (!(
|
|
3135
|
-
for (let
|
|
3136
|
-
const
|
|
3137
|
-
if (
|
|
3138
|
-
const
|
|
3139
|
-
Number.isFinite(
|
|
3386
|
+
for (let d = -1; d <= 1; d += 1) {
|
|
3387
|
+
const f = a + d;
|
|
3388
|
+
if (!(f < 0 || f >= t))
|
|
3389
|
+
for (let y = -1; y <= 1; y += 1) {
|
|
3390
|
+
const I = u + y;
|
|
3391
|
+
if (I < 0 || I >= e) continue;
|
|
3392
|
+
const v = Number(s[f * e + I]);
|
|
3393
|
+
Number.isFinite(v) && (c += v, h += 1);
|
|
3140
3394
|
}
|
|
3141
3395
|
}
|
|
3142
|
-
|
|
3396
|
+
o[l] = h > 0 ? c / h : Number.NaN;
|
|
3143
3397
|
}
|
|
3144
|
-
s =
|
|
3398
|
+
s = o;
|
|
3145
3399
|
}
|
|
3146
3400
|
return s;
|
|
3147
3401
|
}
|
|
3148
|
-
function
|
|
3402
|
+
function Kr(r, e, t) {
|
|
3149
3403
|
const n = e + 1, s = new Float64Array(n * (t + 1)), i = new Uint32Array(n * (t + 1));
|
|
3150
|
-
for (let
|
|
3151
|
-
let
|
|
3404
|
+
for (let o = 0; o < t; o += 1) {
|
|
3405
|
+
let a = 0, u = 0;
|
|
3152
3406
|
for (let l = 0; l < e; l += 1) {
|
|
3153
|
-
const c = Number(r[
|
|
3154
|
-
Number.isFinite(c) && (
|
|
3155
|
-
const h = (
|
|
3156
|
-
s[h] = s[
|
|
3407
|
+
const c = Number(r[o * e + l]);
|
|
3408
|
+
Number.isFinite(c) && (a += c, u += 1);
|
|
3409
|
+
const h = (o + 1) * n + l + 1;
|
|
3410
|
+
s[h] = s[o * n + l + 1] + a, i[h] = i[o * n + l + 1] + u;
|
|
3157
3411
|
}
|
|
3158
3412
|
}
|
|
3159
3413
|
return {
|
|
3160
|
-
query(
|
|
3161
|
-
const c = Math.max(Math.min(
|
|
3414
|
+
query(o, a, u, l) {
|
|
3415
|
+
const c = Math.max(Math.min(o, e - 1), 0), h = Math.max(Math.min(a, t - 1), 0), d = Math.max(Math.min(u, e - 1), c), f = Math.max(Math.min(l, t - 1), h), y = h * n + c, I = h * n + d + 1, v = (f + 1) * n + c, P = (f + 1) * n + d + 1;
|
|
3162
3416
|
return {
|
|
3163
|
-
sum: s[
|
|
3164
|
-
count: i[
|
|
3165
|
-
cellCount: (
|
|
3417
|
+
sum: s[P] - s[I] - s[v] + s[y],
|
|
3418
|
+
count: i[P] - i[I] - i[v] + i[y],
|
|
3419
|
+
cellCount: (d - c + 1) * (f - h + 1)
|
|
3166
3420
|
};
|
|
3167
3421
|
}
|
|
3168
3422
|
};
|
|
3169
3423
|
}
|
|
3170
|
-
function
|
|
3171
|
-
const
|
|
3172
|
-
if (!Number.isFinite(
|
|
3173
|
-
let u = i.includeHigh, l = i.includeLow, c = !1, h = !1,
|
|
3174
|
-
for (let
|
|
3175
|
-
const
|
|
3176
|
-
if (!(
|
|
3177
|
-
for (let
|
|
3178
|
-
if (
|
|
3179
|
-
const
|
|
3180
|
-
if (
|
|
3181
|
-
const
|
|
3182
|
-
if (!Number.isFinite(
|
|
3424
|
+
function Zr(r, e, t, n, s, i) {
|
|
3425
|
+
const o = s * e + n, a = Number(r[o]);
|
|
3426
|
+
if (!Number.isFinite(a)) return [];
|
|
3427
|
+
let u = i.includeHigh, l = i.includeLow, c = !1, h = !1, d = 0;
|
|
3428
|
+
for (let y = -1; y <= 1; y += 1) {
|
|
3429
|
+
const I = s + y;
|
|
3430
|
+
if (!(I < 0 || I >= t))
|
|
3431
|
+
for (let v = -1; v <= 1; v += 1) {
|
|
3432
|
+
if (v === 0 && y === 0) continue;
|
|
3433
|
+
const P = n + v;
|
|
3434
|
+
if (P < 0 || P >= e) continue;
|
|
3435
|
+
const b = I * e + P, w = Number(r[b]);
|
|
3436
|
+
if (!Number.isFinite(w)) {
|
|
3183
3437
|
if (i.excludeBoundary) return [];
|
|
3184
3438
|
continue;
|
|
3185
3439
|
}
|
|
3186
|
-
|
|
3440
|
+
d += 1, w > a ? (u = !1, h = !0) : w < a ? (l = !1, c = !0) : b < o && (u = !1, l = !1);
|
|
3187
3441
|
}
|
|
3188
3442
|
}
|
|
3189
|
-
if (
|
|
3190
|
-
const
|
|
3191
|
-
return u && c &&
|
|
3443
|
+
if (d < 3) return [];
|
|
3444
|
+
const f = [];
|
|
3445
|
+
return u && c && f.push("H"), l && h && f.push("L"), f;
|
|
3192
3446
|
}
|
|
3193
|
-
function
|
|
3194
|
-
const s = e.getSourceBounds(r.gridX, r.gridY), i = (s.startX + s.endX) / 2,
|
|
3195
|
-
let
|
|
3447
|
+
function Jr(r, e, t, n) {
|
|
3448
|
+
const s = e.getSourceBounds(r.gridX, r.gridY), i = (s.startX + s.endX) / 2, o = (s.startY + s.endY) / 2;
|
|
3449
|
+
let a = null;
|
|
3196
3450
|
for (let l = s.startY; l <= s.endY; l += 1)
|
|
3197
3451
|
for (let c = s.startX; c <= s.endX; c += 1) {
|
|
3198
3452
|
if (n.excludeBoundary && (c < n.radius || l < n.radius || c >= t.width - n.radius || l >= t.height - n.radius))
|
|
3199
3453
|
continue;
|
|
3200
3454
|
const h = Number(t.values[l * t.width + c]);
|
|
3201
3455
|
if (!Number.isFinite(h)) continue;
|
|
3202
|
-
const
|
|
3203
|
-
(
|
|
3456
|
+
const d = (c - i) ** 2 + (l - o) ** 2, f = r.type === "H" ? !a || h > a.value : !a || h < a.value, y = a && h === a.value && d < a.distanceToApproximate;
|
|
3457
|
+
(f || y) && (a = { x: c, y: l, value: h, distanceToApproximate: d });
|
|
3204
3458
|
}
|
|
3205
|
-
if (!
|
|
3206
|
-
const u = t.mapCoordinate(
|
|
3459
|
+
if (!a) return null;
|
|
3460
|
+
const u = t.mapCoordinate(a.x, a.y);
|
|
3207
3461
|
return u != null && u.every(Number.isFinite) ? {
|
|
3208
3462
|
...r,
|
|
3209
|
-
value:
|
|
3463
|
+
value: a.value,
|
|
3210
3464
|
lat: u[0],
|
|
3211
3465
|
lon: u[1],
|
|
3212
|
-
sourceX:
|
|
3213
|
-
sourceY:
|
|
3466
|
+
sourceX: a.x,
|
|
3467
|
+
sourceY: a.y
|
|
3214
3468
|
} : null;
|
|
3215
3469
|
}
|
|
3216
|
-
function
|
|
3470
|
+
function Ge(r, e) {
|
|
3217
3471
|
return r.type !== e.type ? r.type === "H" ? -1 : 1 : (r.type === "H" ? e.value - r.value : r.value - e.value) || e.prominence - r.prominence || r.sourceY - e.sourceY || r.sourceX - e.sourceX;
|
|
3218
3472
|
}
|
|
3219
|
-
function
|
|
3473
|
+
function Qr(r, e) {
|
|
3220
3474
|
const t = e ** 2, n = [];
|
|
3221
|
-
return r.sort(
|
|
3475
|
+
return r.sort(Ge).forEach((s) => {
|
|
3222
3476
|
n.some(
|
|
3223
|
-
(
|
|
3477
|
+
(o) => o.type === s.type && (o.sourceX - s.sourceX) ** 2 + (o.sourceY - s.sourceY) ** 2 < t
|
|
3224
3478
|
) || n.push(s);
|
|
3225
3479
|
}), n;
|
|
3226
3480
|
}
|
|
3227
|
-
function
|
|
3228
|
-
const t =
|
|
3481
|
+
function en(r, e = {}) {
|
|
3482
|
+
const t = Yr(e);
|
|
3229
3483
|
if (!t.enabled || t.maxCount === 0 || !t.includeHigh && !t.includeLow || r.width < 3 || r.height < 3)
|
|
3230
3484
|
return [];
|
|
3231
|
-
const n =
|
|
3485
|
+
const n = qr(r), s = Xr(
|
|
3232
3486
|
n.values,
|
|
3233
3487
|
n.width,
|
|
3234
3488
|
n.height,
|
|
3235
3489
|
t.smoothingIterations
|
|
3236
|
-
), i =
|
|
3490
|
+
), i = Kr(
|
|
3237
3491
|
s,
|
|
3238
3492
|
n.width,
|
|
3239
3493
|
n.height
|
|
3240
|
-
),
|
|
3494
|
+
), o = Math.max(Math.ceil(t.radius / n.stride), 1), a = [];
|
|
3241
3495
|
for (let c = 0; c < n.height; c += 1)
|
|
3242
3496
|
for (let h = 0; h < n.width; h += 1) {
|
|
3243
|
-
if (t.excludeBoundary && (h <
|
|
3497
|
+
if (t.excludeBoundary && (h < o || c < o || h >= n.width - o || c >= n.height - o))
|
|
3244
3498
|
continue;
|
|
3245
|
-
const
|
|
3246
|
-
if (!Number.isFinite(
|
|
3247
|
-
const
|
|
3499
|
+
const d = Number(s[c * n.width + h]);
|
|
3500
|
+
if (!Number.isFinite(d)) continue;
|
|
3501
|
+
const f = Zr(
|
|
3248
3502
|
s,
|
|
3249
3503
|
n.width,
|
|
3250
3504
|
n.height,
|
|
@@ -3252,83 +3506,99 @@ function Tr(r, e = {}) {
|
|
|
3252
3506
|
c,
|
|
3253
3507
|
t
|
|
3254
3508
|
);
|
|
3255
|
-
if (
|
|
3256
|
-
const
|
|
3257
|
-
h -
|
|
3258
|
-
c -
|
|
3259
|
-
h +
|
|
3260
|
-
c +
|
|
3509
|
+
if (f.length === 0) continue;
|
|
3510
|
+
const y = i.query(
|
|
3511
|
+
h - o,
|
|
3512
|
+
c - o,
|
|
3513
|
+
h + o,
|
|
3514
|
+
c + o
|
|
3261
3515
|
);
|
|
3262
|
-
if (t.excludeBoundary &&
|
|
3263
|
-
const
|
|
3264
|
-
if (
|
|
3265
|
-
const
|
|
3266
|
-
|
|
3267
|
-
const
|
|
3268
|
-
|
|
3269
|
-
type:
|
|
3270
|
-
label:
|
|
3271
|
-
prominence:
|
|
3516
|
+
if (t.excludeBoundary && y.count < y.cellCount) continue;
|
|
3517
|
+
const I = y.count - 1;
|
|
3518
|
+
if (I < 3) continue;
|
|
3519
|
+
const v = (y.sum - d) / I;
|
|
3520
|
+
f.forEach((P) => {
|
|
3521
|
+
const b = P === "H" ? d - v : v - d;
|
|
3522
|
+
b < t.minProminence || a.push({
|
|
3523
|
+
type: P,
|
|
3524
|
+
label: P,
|
|
3525
|
+
prominence: b,
|
|
3272
3526
|
gridX: h,
|
|
3273
3527
|
gridY: c
|
|
3274
3528
|
});
|
|
3275
3529
|
});
|
|
3276
3530
|
}
|
|
3277
|
-
const u =
|
|
3278
|
-
return
|
|
3279
|
-
(c, h) => h.prominence - c.prominence ||
|
|
3280
|
-
).slice(0, t.maxCount).sort(
|
|
3281
|
-
}
|
|
3282
|
-
function
|
|
3283
|
-
|
|
3531
|
+
const u = a.map((c) => Jr(c, n, r, t)).filter(Boolean);
|
|
3532
|
+
return Qr(u, t.minGridDistance).sort(
|
|
3533
|
+
(c, h) => h.prominence - c.prominence || Ge(c, h)
|
|
3534
|
+
).slice(0, t.maxCount).sort(Ge).map(({ type: c, label: h, value: d, lat: f, lon: y }) => ({ type: c, label: h, value: d, lat: f, lon: y }));
|
|
3535
|
+
}
|
|
3536
|
+
function tn(r, e = {}) {
|
|
3537
|
+
var P;
|
|
3538
|
+
const t = zr(r.values);
|
|
3284
3539
|
if (t.min === t.max)
|
|
3285
3540
|
throw new Error("栅格数值全部相同,无法生成等值线。");
|
|
3286
|
-
const n =
|
|
3287
|
-
if (
|
|
3541
|
+
const n = Ur(r, e.maxCells), s = Pr(n, e.wrapLongitude), i = mt(e.gridSmoothing), o = performance.now(), a = br(n, i, s), u = a === n ? 0 : performance.now() - o, l = s ? Lr(a) : a, c = $r(t, e);
|
|
3542
|
+
if (c.length === 0)
|
|
3288
3543
|
throw new Error("当前值域内没有可用的等值线级别。");
|
|
3289
|
-
const
|
|
3290
|
-
Math.floor(
|
|
3544
|
+
const h = Ir().size([l.width, l.height]).smooth(e.smooth !== !1).thresholds(c)(l.values), d = Math.max(
|
|
3545
|
+
Math.floor(N(e.minimumLinePoints, 3)),
|
|
3291
3546
|
2
|
|
3292
|
-
),
|
|
3293
|
-
Math.max(Math.floor(
|
|
3547
|
+
), f = Math.min(
|
|
3548
|
+
Math.max(Math.floor(N(e.smoothingIterations, 0)), 0),
|
|
3294
3549
|
3
|
|
3295
|
-
),
|
|
3296
|
-
const
|
|
3297
|
-
(
|
|
3298
|
-
)
|
|
3550
|
+
), y = h.map((b) => {
|
|
3551
|
+
const w = Hr(b).flatMap(
|
|
3552
|
+
(g) => e.excludeBoundary === !1 ? [g] : Wr(g, l.width, l.height)
|
|
3553
|
+
), S = s ? Cr(
|
|
3554
|
+
// 拼接前保留坐标精度,避免低 coordinatePrecision 把不同接缝端点合并。
|
|
3555
|
+
w.map((g) => g.map(([C, T]) => l.mapCoordinate(C, T))),
|
|
3556
|
+
l.area,
|
|
3557
|
+
f,
|
|
3558
|
+
d
|
|
3559
|
+
).map((g) => it(g, (C, T) => [C, T], e.coordinatePrecision)).filter((g) => g.length >= 2) : w.map((g) => It(g, f)).map((g) => it(g, l.mapCoordinate, e.coordinatePrecision)).filter((g) => g.length >= d);
|
|
3299
3560
|
return {
|
|
3300
|
-
value:
|
|
3301
|
-
label: String(
|
|
3302
|
-
lines:
|
|
3561
|
+
value: b.value,
|
|
3562
|
+
label: String(b.value),
|
|
3563
|
+
lines: S
|
|
3303
3564
|
};
|
|
3304
|
-
}),
|
|
3565
|
+
}), I = ((P = e.centerDetection) == null ? void 0 : P.method) === "closed-contour" ? vr(a, e.centerDetection, s) : null, v = (I == null ? void 0 : I.centers) || en(r, e.centerDetection);
|
|
3305
3566
|
return {
|
|
3306
|
-
isolines:
|
|
3307
|
-
centers:
|
|
3308
|
-
|
|
3567
|
+
isolines: y,
|
|
3568
|
+
centers: v,
|
|
3569
|
+
centerDiagnostics: (I == null ? void 0 : I.stats) || null,
|
|
3570
|
+
thresholds: c,
|
|
3309
3571
|
range: t,
|
|
3572
|
+
// 报告真实计算网格尺寸,内部的两列周期补边不计入业务格点数。
|
|
3310
3573
|
renderWidth: n.width,
|
|
3311
3574
|
renderHeight: n.height,
|
|
3312
3575
|
downsampled: !!n.downsampled,
|
|
3313
|
-
|
|
3576
|
+
gridSmoothing: i,
|
|
3577
|
+
gridSmoothingElapsed: u,
|
|
3578
|
+
wrapLongitude: s,
|
|
3579
|
+
pointCount: y.reduce((b, w) => b + w.lines.reduce((S, g) => S + g.length, 0), 0),
|
|
3580
|
+
lineCount: y.reduce((b, w) => b + w.lines.length, 0)
|
|
3314
3581
|
};
|
|
3315
3582
|
}
|
|
3316
|
-
const
|
|
3583
|
+
const St = /* @__PURE__ */ new Set([
|
|
3317
3584
|
"arrayBuffer",
|
|
3318
3585
|
"area",
|
|
3319
3586
|
"band",
|
|
3320
3587
|
"bbox",
|
|
3588
|
+
"bboxProjection",
|
|
3321
3589
|
"contourInterval",
|
|
3322
3590
|
"centerDetection",
|
|
3323
3591
|
"coordinatePrecision",
|
|
3324
3592
|
"data",
|
|
3325
3593
|
"dataType",
|
|
3594
|
+
"defaultSourceProjectionCrs",
|
|
3326
3595
|
"excludeBoundary",
|
|
3327
3596
|
"grayChannel",
|
|
3328
3597
|
"grayImageUrl",
|
|
3329
3598
|
"grayMaxValue",
|
|
3330
3599
|
"grayMinValue",
|
|
3331
3600
|
"grid",
|
|
3601
|
+
"gridSmoothing",
|
|
3332
3602
|
"imageIndex",
|
|
3333
3603
|
"imageUrl",
|
|
3334
3604
|
"interval",
|
|
@@ -3342,10 +3612,12 @@ const Gr = /* @__PURE__ */ new Set([
|
|
|
3342
3612
|
"minimumLinePoints",
|
|
3343
3613
|
"noDataValue",
|
|
3344
3614
|
"offset",
|
|
3615
|
+
"projection",
|
|
3345
3616
|
"scale",
|
|
3346
3617
|
"smooth",
|
|
3347
3618
|
"smoothingIterations",
|
|
3348
3619
|
"sourceProjection",
|
|
3620
|
+
"sourceProjectionCrs",
|
|
3349
3621
|
"sourceType",
|
|
3350
3622
|
"thresholdCount",
|
|
3351
3623
|
"thresholds",
|
|
@@ -3355,14 +3627,17 @@ const Gr = /* @__PURE__ */ new Set([
|
|
|
3355
3627
|
"validMin",
|
|
3356
3628
|
"values",
|
|
3357
3629
|
"width",
|
|
3358
|
-
"height"
|
|
3359
|
-
|
|
3630
|
+
"height",
|
|
3631
|
+
"wrapLongitude"
|
|
3632
|
+
]), rn = /* @__PURE__ */ new Set([
|
|
3360
3633
|
"arrayBuffer",
|
|
3361
3634
|
"area",
|
|
3362
3635
|
"band",
|
|
3363
3636
|
"bbox",
|
|
3637
|
+
"bboxProjection",
|
|
3364
3638
|
"data",
|
|
3365
3639
|
"dataType",
|
|
3640
|
+
"defaultSourceProjectionCrs",
|
|
3366
3641
|
"grayChannel",
|
|
3367
3642
|
"grayImageUrl",
|
|
3368
3643
|
"grayMaxValue",
|
|
@@ -3377,8 +3652,10 @@ const Gr = /* @__PURE__ */ new Set([
|
|
|
3377
3652
|
"minValue",
|
|
3378
3653
|
"noDataValue",
|
|
3379
3654
|
"offset",
|
|
3655
|
+
"projection",
|
|
3380
3656
|
"scale",
|
|
3381
3657
|
"sourceProjection",
|
|
3658
|
+
"sourceProjectionCrs",
|
|
3382
3659
|
"sourceType",
|
|
3383
3660
|
"tifUrl",
|
|
3384
3661
|
"tiffUrl",
|
|
@@ -3387,18 +3664,18 @@ const Gr = /* @__PURE__ */ new Set([
|
|
|
3387
3664
|
"values",
|
|
3388
3665
|
"width"
|
|
3389
3666
|
]);
|
|
3390
|
-
function
|
|
3667
|
+
function nn(r = {}) {
|
|
3391
3668
|
const { mapCore: e, baseGIS: t, ...n } = r;
|
|
3392
3669
|
return n;
|
|
3393
3670
|
}
|
|
3394
|
-
function
|
|
3671
|
+
function sn(r = {}) {
|
|
3395
3672
|
var e;
|
|
3396
3673
|
return ((e = r.centerDetection) == null ? void 0 : e.enabled) === !0;
|
|
3397
3674
|
}
|
|
3398
|
-
function
|
|
3675
|
+
function on(r, e, t = null) {
|
|
3399
3676
|
const n = {};
|
|
3400
|
-
Object.entries(r).forEach(([i,
|
|
3401
|
-
|
|
3677
|
+
Object.entries(r).forEach(([i, o]) => {
|
|
3678
|
+
St.has(i) || (n[i] = o);
|
|
3402
3679
|
});
|
|
3403
3680
|
const s = {
|
|
3404
3681
|
...n,
|
|
@@ -3408,35 +3685,47 @@ function Rr(r, e, t = null) {
|
|
|
3408
3685
|
worldCopyArea: r.worldCopyArea || t,
|
|
3409
3686
|
isolines: e.isolines
|
|
3410
3687
|
};
|
|
3411
|
-
return s.centers = Array.isArray(r.centers) ? r.centers :
|
|
3688
|
+
return s.centers = Array.isArray(r.centers) ? r.centers : sn(r) ? e.centers : [], s;
|
|
3412
3689
|
}
|
|
3413
|
-
function
|
|
3690
|
+
function U() {
|
|
3414
3691
|
return typeof performance < "u" ? performance.now() : Date.now();
|
|
3415
3692
|
}
|
|
3416
|
-
function
|
|
3417
|
-
|
|
3693
|
+
function an(r) {
|
|
3694
|
+
var t, n;
|
|
3695
|
+
const e = (n = (t = r == null ? void 0 : r.getConfig) == null ? void 0 : t.call(r)) == null ? void 0 : n.sourceProjectionCrs;
|
|
3696
|
+
return e != null && String(e).trim() !== "" ? e : "";
|
|
3697
|
+
}
|
|
3698
|
+
function ln(r = {}) {
|
|
3699
|
+
return Object.keys(r).some((e) => rn.has(e));
|
|
3418
3700
|
}
|
|
3419
|
-
class
|
|
3701
|
+
class Mn {
|
|
3420
3702
|
constructor(e = {}) {
|
|
3421
|
-
const t =
|
|
3703
|
+
const t = nn(e), n = t.layerId || t.contourLayerId || "raster-contour-default";
|
|
3422
3704
|
this.defaultPayload = {
|
|
3423
3705
|
thresholdCount: 12,
|
|
3424
3706
|
maxCells: 1e6,
|
|
3425
3707
|
smooth: !0,
|
|
3426
3708
|
excludeBoundary: !0,
|
|
3427
3709
|
visible: !0,
|
|
3710
|
+
wrapLongitude: !1,
|
|
3428
3711
|
...t,
|
|
3712
|
+
gridSmoothing: {
|
|
3713
|
+
...ie,
|
|
3714
|
+
...t.gridSmoothing || {}
|
|
3715
|
+
},
|
|
3429
3716
|
centerDetection: {
|
|
3430
|
-
|
|
3717
|
+
...K,
|
|
3431
3718
|
...t.centerDetection || {}
|
|
3432
3719
|
},
|
|
3433
3720
|
layerId: n
|
|
3434
|
-
}, this.baseGIS = null, this.contourController = new
|
|
3721
|
+
}, this.baseGIS = null, this.contourController = new Tt({ layerId: n }), this.currentPayload = null, this.currentGrid = null, this.currentContourData = null, this.operationId = 0, this.state = {
|
|
3435
3722
|
layerId: n,
|
|
3436
3723
|
sourceType: "",
|
|
3437
3724
|
sourceUrl: "",
|
|
3725
|
+
sourceProjectionCrs: "",
|
|
3438
3726
|
sourceProjection: "",
|
|
3439
3727
|
projection: "",
|
|
3728
|
+
bboxProjection: "",
|
|
3440
3729
|
width: 0,
|
|
3441
3730
|
height: 0,
|
|
3442
3731
|
renderWidth: 0,
|
|
@@ -3448,6 +3737,7 @@ class Zr {
|
|
|
3448
3737
|
levelCount: 0,
|
|
3449
3738
|
lineCount: 0,
|
|
3450
3739
|
centerCount: 0,
|
|
3740
|
+
centerDiagnostics: null,
|
|
3451
3741
|
lineLabelCount: 0,
|
|
3452
3742
|
centerLabelCount: 0,
|
|
3453
3743
|
labelCount: 0,
|
|
@@ -3456,6 +3746,11 @@ class Zr {
|
|
|
3456
3746
|
area: null,
|
|
3457
3747
|
sourceElapsed: 0,
|
|
3458
3748
|
generateElapsed: 0,
|
|
3749
|
+
gridSmoothingElapsed: 0,
|
|
3750
|
+
gridSmoothing: { ...this.defaultPayload.gridSmoothing },
|
|
3751
|
+
wrapLongitude: !1,
|
|
3752
|
+
pointCount: 0,
|
|
3753
|
+
contoursReused: !1,
|
|
3459
3754
|
renderElapsed: 0,
|
|
3460
3755
|
lineBuildElapsed: 0,
|
|
3461
3756
|
labelLayoutElapsed: 0,
|
|
@@ -3472,78 +3767,86 @@ class Zr {
|
|
|
3472
3767
|
}
|
|
3473
3768
|
resolveBaseGIS() {
|
|
3474
3769
|
var e, t;
|
|
3475
|
-
return this.baseGIS ? (t = (e = this.baseGIS).getMapInstance) != null && t.call(e) ?
|
|
3770
|
+
return this.baseGIS ? (t = (e = this.baseGIS).getMapInstance) != null && t.call(e) ? p(null, "BaseGIS is ready.") : m(
|
|
3476
3771
|
"Map instance is not ready. Please call mapCore.init() first.",
|
|
3477
3772
|
"NOT_INITIALIZED"
|
|
3478
|
-
) :
|
|
3773
|
+
) : m("RasterContourController has not been mounted.", "NOT_MOUNTED");
|
|
3479
3774
|
}
|
|
3480
|
-
async renderGrid(e, t, n, s, i = !1, a =
|
|
3481
|
-
var
|
|
3482
|
-
const
|
|
3483
|
-
|
|
3775
|
+
async renderGrid(e, t, n, s, i = !1, o = 0, a = null) {
|
|
3776
|
+
var w;
|
|
3777
|
+
const u = U(), l = a || tn(e, t), c = a ? 0 : U() - u, h = on(t, l, e.area), d = h.centers.length, f = h.onStateChange;
|
|
3778
|
+
h.onStateChange = (S) => {
|
|
3484
3779
|
n === this.operationId && (this.state = {
|
|
3485
3780
|
...this.state,
|
|
3486
|
-
lineCount: (
|
|
3487
|
-
centerCount: (
|
|
3488
|
-
lineLabelCount: (
|
|
3489
|
-
centerLabelCount: (
|
|
3490
|
-
labelCount: (
|
|
3491
|
-
lineRenderer: (
|
|
3492
|
-
lineBuildElapsed: (
|
|
3493
|
-
labelLayoutElapsed: (
|
|
3494
|
-
primitiveReadyElapsed: (
|
|
3495
|
-
visible: (
|
|
3496
|
-
},
|
|
3781
|
+
lineCount: (S == null ? void 0 : S.lineCount) ?? this.state.lineCount,
|
|
3782
|
+
centerCount: (S == null ? void 0 : S.centerCount) ?? d,
|
|
3783
|
+
lineLabelCount: (S == null ? void 0 : S.lineLabelCount) ?? this.state.lineLabelCount,
|
|
3784
|
+
centerLabelCount: (S == null ? void 0 : S.centerLabelCount) ?? this.state.centerLabelCount,
|
|
3785
|
+
labelCount: (S == null ? void 0 : S.labelCount) ?? this.state.labelCount,
|
|
3786
|
+
lineRenderer: (S == null ? void 0 : S.lineRenderer) ?? this.state.lineRenderer,
|
|
3787
|
+
lineBuildElapsed: (S == null ? void 0 : S.lineBuildElapsed) ?? this.state.lineBuildElapsed,
|
|
3788
|
+
labelLayoutElapsed: (S == null ? void 0 : S.labelLayoutElapsed) ?? this.state.labelLayoutElapsed,
|
|
3789
|
+
primitiveReadyElapsed: (S == null ? void 0 : S.primitiveReadyElapsed) ?? this.state.primitiveReadyElapsed,
|
|
3790
|
+
visible: (S == null ? void 0 : S.visible) ?? this.state.visible
|
|
3791
|
+
}, f == null || f(S));
|
|
3497
3792
|
};
|
|
3498
|
-
const
|
|
3793
|
+
const y = U(), I = i ? await this.contourController.update(h) : await this.contourController.load(h), v = U() - y;
|
|
3499
3794
|
if (!I.success) return I;
|
|
3500
3795
|
if (n !== this.operationId)
|
|
3501
|
-
return
|
|
3502
|
-
const
|
|
3503
|
-
return this.currentPayload = t, this.currentGrid = e, this.state = {
|
|
3796
|
+
return p({ stale: !0, ignored: !0 }, "Raster contour render was superseded.");
|
|
3797
|
+
const P = U() - s, b = ((w = I.data) == null ? void 0 : w.state) || I.data || null;
|
|
3798
|
+
return this.currentPayload = t, this.currentGrid = e, this.currentContourData = l, this.state = {
|
|
3504
3799
|
...this.state,
|
|
3505
|
-
layerId:
|
|
3800
|
+
layerId: h.layerId,
|
|
3506
3801
|
sourceType: e.sourceType,
|
|
3507
3802
|
sourceUrl: e.sourceUrl,
|
|
3803
|
+
sourceProjectionCrs: e.sourceProjectionCrs || e.sourceProjection,
|
|
3508
3804
|
sourceProjection: e.sourceProjection,
|
|
3509
3805
|
projection: e.projection,
|
|
3806
|
+
bboxProjection: e.bboxProjection,
|
|
3510
3807
|
width: e.width,
|
|
3511
3808
|
height: e.height,
|
|
3512
|
-
renderWidth:
|
|
3513
|
-
renderHeight:
|
|
3514
|
-
min:
|
|
3515
|
-
max:
|
|
3516
|
-
validCount:
|
|
3517
|
-
noDataCount:
|
|
3518
|
-
levelCount:
|
|
3519
|
-
lineCount:
|
|
3520
|
-
centerCount: (
|
|
3521
|
-
lineLabelCount: (
|
|
3522
|
-
centerLabelCount: (
|
|
3523
|
-
labelCount: (
|
|
3524
|
-
lineRenderer: (
|
|
3525
|
-
thresholds:
|
|
3809
|
+
renderWidth: l.renderWidth,
|
|
3810
|
+
renderHeight: l.renderHeight,
|
|
3811
|
+
min: l.range.min,
|
|
3812
|
+
max: l.range.max,
|
|
3813
|
+
validCount: l.range.validCount,
|
|
3814
|
+
noDataCount: l.range.noDataCount,
|
|
3815
|
+
levelCount: l.thresholds.length,
|
|
3816
|
+
lineCount: l.lineCount,
|
|
3817
|
+
centerCount: (b == null ? void 0 : b.centerCount) ?? d,
|
|
3818
|
+
lineLabelCount: (b == null ? void 0 : b.lineLabelCount) || 0,
|
|
3819
|
+
centerLabelCount: (b == null ? void 0 : b.centerLabelCount) || 0,
|
|
3820
|
+
labelCount: (b == null ? void 0 : b.labelCount) || 0,
|
|
3821
|
+
lineRenderer: (b == null ? void 0 : b.lineRenderer) || "",
|
|
3822
|
+
thresholds: l.thresholds,
|
|
3526
3823
|
area: e.area,
|
|
3527
|
-
sourceElapsed:
|
|
3528
|
-
generateElapsed:
|
|
3529
|
-
|
|
3530
|
-
|
|
3531
|
-
|
|
3532
|
-
|
|
3533
|
-
|
|
3534
|
-
|
|
3535
|
-
|
|
3824
|
+
sourceElapsed: o,
|
|
3825
|
+
generateElapsed: c,
|
|
3826
|
+
gridSmoothingElapsed: a ? 0 : l.gridSmoothingElapsed,
|
|
3827
|
+
gridSmoothing: l.gridSmoothing,
|
|
3828
|
+
wrapLongitude: l.wrapLongitude,
|
|
3829
|
+
pointCount: l.pointCount,
|
|
3830
|
+
centerDiagnostics: l.centerDiagnostics,
|
|
3831
|
+
contoursReused: !!a,
|
|
3832
|
+
renderElapsed: v,
|
|
3833
|
+
lineBuildElapsed: (b == null ? void 0 : b.lineBuildElapsed) || 0,
|
|
3834
|
+
labelLayoutElapsed: (b == null ? void 0 : b.labelLayoutElapsed) || 0,
|
|
3835
|
+
primitiveReadyElapsed: (b == null ? void 0 : b.primitiveReadyElapsed) || 0,
|
|
3836
|
+
elapsed: P,
|
|
3837
|
+
downsampled: l.downsampled,
|
|
3838
|
+
visible: h.visible !== !1,
|
|
3536
3839
|
loaded: !0
|
|
3537
|
-
},
|
|
3840
|
+
}, p(
|
|
3538
3841
|
{
|
|
3539
3842
|
...this.getState(),
|
|
3540
|
-
contourState:
|
|
3843
|
+
contourState: b
|
|
3541
3844
|
},
|
|
3542
|
-
i ? `Raster contour layer "${
|
|
3845
|
+
i ? `Raster contour layer "${h.layerId}" ${a ? "updated" : "regenerated"}.` : `Raster contour layer "${h.layerId}" loaded.`
|
|
3543
3846
|
);
|
|
3544
3847
|
}
|
|
3545
3848
|
async load(e = {}, t = {}) {
|
|
3546
|
-
var
|
|
3849
|
+
var a, u;
|
|
3547
3850
|
const n = this.resolveBaseGIS();
|
|
3548
3851
|
if (!n.success) return n;
|
|
3549
3852
|
const s = {
|
|
@@ -3551,26 +3854,32 @@ class Zr {
|
|
|
3551
3854
|
...this.currentPayload || {},
|
|
3552
3855
|
...e,
|
|
3553
3856
|
...t,
|
|
3857
|
+
gridSmoothing: {
|
|
3858
|
+
...this.defaultPayload.gridSmoothing,
|
|
3859
|
+
...((a = this.currentPayload) == null ? void 0 : a.gridSmoothing) || {},
|
|
3860
|
+
...e.gridSmoothing || {},
|
|
3861
|
+
...t.gridSmoothing || {}
|
|
3862
|
+
},
|
|
3554
3863
|
centerDetection: {
|
|
3555
3864
|
...this.defaultPayload.centerDetection,
|
|
3556
|
-
...((
|
|
3865
|
+
...((u = this.currentPayload) == null ? void 0 : u.centerDetection) || {},
|
|
3557
3866
|
...e.centerDetection || {},
|
|
3558
3867
|
...t.centerDetection || {}
|
|
3559
3868
|
}
|
|
3560
|
-
}, i = ++this.operationId,
|
|
3869
|
+
}, i = ++this.operationId, o = U();
|
|
3561
3870
|
try {
|
|
3562
|
-
const
|
|
3563
|
-
return i !== this.operationId ?
|
|
3564
|
-
|
|
3871
|
+
const l = an(this.baseGIS) || s.defaultSourceProjectionCrs, c = l ? { ...s, defaultSourceProjectionCrs: l } : s, h = await Vr(c), d = U() - o;
|
|
3872
|
+
return i !== this.operationId ? p({ stale: !0, ignored: !0 }, "Raster contour load was superseded.") : this.renderGrid(
|
|
3873
|
+
h,
|
|
3565
3874
|
s,
|
|
3566
3875
|
i,
|
|
3567
|
-
|
|
3876
|
+
o,
|
|
3568
3877
|
!1,
|
|
3569
|
-
|
|
3878
|
+
d
|
|
3570
3879
|
);
|
|
3571
|
-
} catch (
|
|
3572
|
-
return
|
|
3573
|
-
(
|
|
3880
|
+
} catch (l) {
|
|
3881
|
+
return m(
|
|
3882
|
+
(l == null ? void 0 : l.message) || "Raster contour generation failed.",
|
|
3574
3883
|
"RASTER_CONTOUR_FAILED"
|
|
3575
3884
|
);
|
|
3576
3885
|
}
|
|
@@ -3586,41 +3895,47 @@ class Zr {
|
|
|
3586
3895
|
}
|
|
3587
3896
|
async update(e = {}) {
|
|
3588
3897
|
if (!this.currentPayload || !this.currentGrid)
|
|
3589
|
-
return
|
|
3590
|
-
if (
|
|
3898
|
+
return m("Raster contour source has not been loaded.", "NOT_LOADED");
|
|
3899
|
+
if (ln(e))
|
|
3591
3900
|
return this.load(e);
|
|
3592
3901
|
const t = this.resolveBaseGIS();
|
|
3593
3902
|
if (!t.success) return t;
|
|
3594
3903
|
const n = {
|
|
3595
3904
|
...this.currentPayload,
|
|
3596
3905
|
...e,
|
|
3906
|
+
gridSmoothing: {
|
|
3907
|
+
...this.currentPayload.gridSmoothing || {},
|
|
3908
|
+
...e.gridSmoothing || {}
|
|
3909
|
+
},
|
|
3597
3910
|
centerDetection: {
|
|
3598
3911
|
...this.currentPayload.centerDetection || {},
|
|
3599
3912
|
...e.centerDetection || {}
|
|
3600
3913
|
}
|
|
3601
|
-
}, s = ++this.operationId, i =
|
|
3914
|
+
}, s = ++this.operationId, i = U();
|
|
3602
3915
|
try {
|
|
3603
3916
|
return await this.renderGrid(
|
|
3604
3917
|
this.currentGrid,
|
|
3605
3918
|
n,
|
|
3606
3919
|
s,
|
|
3607
3920
|
i,
|
|
3608
|
-
!0
|
|
3921
|
+
!0,
|
|
3922
|
+
0,
|
|
3923
|
+
Object.keys(e).some((o) => St.has(o)) ? null : this.currentContourData
|
|
3609
3924
|
);
|
|
3610
|
-
} catch (
|
|
3611
|
-
return
|
|
3612
|
-
(
|
|
3925
|
+
} catch (o) {
|
|
3926
|
+
return m(
|
|
3927
|
+
(o == null ? void 0 : o.message) || "Raster contour regeneration failed.",
|
|
3613
3928
|
"RASTER_CONTOUR_FAILED"
|
|
3614
3929
|
);
|
|
3615
3930
|
}
|
|
3616
3931
|
}
|
|
3617
3932
|
show() {
|
|
3618
3933
|
const e = this.contourController.show();
|
|
3619
|
-
return e.success && (this.state.visible = !0), e;
|
|
3934
|
+
return e.success && (this.state.visible = !0, this.currentPayload && (this.currentPayload.visible = !0)), e;
|
|
3620
3935
|
}
|
|
3621
3936
|
hide() {
|
|
3622
3937
|
const e = this.contourController.hide();
|
|
3623
|
-
return e.success && (this.state.visible = !1), e;
|
|
3938
|
+
return e.success && (this.state.visible = !1, this.currentPayload && (this.currentPayload.visible = !1)), e;
|
|
3624
3939
|
}
|
|
3625
3940
|
toggle(e) {
|
|
3626
3941
|
return typeof e == "boolean" ? e ? this.show() : this.hide() : this.state.visible ? this.hide() : this.show();
|
|
@@ -3628,32 +3943,38 @@ class Zr {
|
|
|
3628
3943
|
clear() {
|
|
3629
3944
|
this.operationId += 1;
|
|
3630
3945
|
const e = this.contourController.clear();
|
|
3631
|
-
return e.success && (this.state = {
|
|
3946
|
+
return e.success && (this.currentContourData = null, this.state = {
|
|
3632
3947
|
...this.state,
|
|
3633
3948
|
levelCount: 0,
|
|
3634
3949
|
lineCount: 0,
|
|
3635
3950
|
centerCount: 0,
|
|
3951
|
+
centerDiagnostics: null,
|
|
3636
3952
|
lineLabelCount: 0,
|
|
3637
3953
|
centerLabelCount: 0,
|
|
3638
3954
|
labelCount: 0,
|
|
3639
3955
|
thresholds: [],
|
|
3640
|
-
loaded: !1
|
|
3956
|
+
loaded: !1,
|
|
3957
|
+
pointCount: 0,
|
|
3958
|
+
contoursReused: !1
|
|
3641
3959
|
}), e;
|
|
3642
3960
|
}
|
|
3643
3961
|
destroy() {
|
|
3644
3962
|
this.operationId += 1;
|
|
3645
3963
|
const e = this.contourController.destroy();
|
|
3646
|
-
return this.currentPayload = null, this.currentGrid = null, this.baseGIS = null, this.state = {
|
|
3964
|
+
return this.currentPayload = null, this.currentGrid = null, this.currentContourData = null, this.baseGIS = null, this.state = {
|
|
3647
3965
|
...this.state,
|
|
3648
3966
|
levelCount: 0,
|
|
3649
3967
|
lineCount: 0,
|
|
3650
3968
|
centerCount: 0,
|
|
3969
|
+
centerDiagnostics: null,
|
|
3651
3970
|
lineLabelCount: 0,
|
|
3652
3971
|
centerLabelCount: 0,
|
|
3653
3972
|
labelCount: 0,
|
|
3654
3973
|
thresholds: [],
|
|
3655
3974
|
loaded: !1,
|
|
3656
|
-
visible: !1
|
|
3975
|
+
visible: !1,
|
|
3976
|
+
pointCount: 0,
|
|
3977
|
+
contoursReused: !1
|
|
3657
3978
|
}, e;
|
|
3658
3979
|
}
|
|
3659
3980
|
getRasterData() {
|
|
@@ -3668,7 +3989,7 @@ class Zr {
|
|
|
3668
3989
|
};
|
|
3669
3990
|
}
|
|
3670
3991
|
}
|
|
3671
|
-
const
|
|
3992
|
+
const ot = [
|
|
3672
3993
|
{ value: 0, color: [36, 88, 190] },
|
|
3673
3994
|
{ value: 2, color: [36, 145, 184] },
|
|
3674
3995
|
{ value: 5, color: [54, 177, 111] },
|
|
@@ -3676,7 +3997,7 @@ const Oe = [
|
|
|
3676
3997
|
{ value: 11, color: [229, 178, 78] },
|
|
3677
3998
|
{ value: 14, color: [224, 103, 117] },
|
|
3678
3999
|
{ value: 18, color: [162, 82, 202] }
|
|
3679
|
-
],
|
|
4000
|
+
], at = [
|
|
3680
4001
|
{ value: 0, color: [178, 223, 255] },
|
|
3681
4002
|
{ value: 3, color: [190, 248, 222] },
|
|
3682
4003
|
{ value: 6, color: [235, 252, 174] },
|
|
@@ -3684,10 +4005,10 @@ const Oe = [
|
|
|
3684
4005
|
{ value: 14, color: [255, 166, 156] },
|
|
3685
4006
|
{ value: 18, color: [232, 153, 255] }
|
|
3686
4007
|
];
|
|
3687
|
-
function
|
|
4008
|
+
function E(r, e, t) {
|
|
3688
4009
|
return Math.min(Math.max(r, e), t);
|
|
3689
4010
|
}
|
|
3690
|
-
function
|
|
4011
|
+
function un(r) {
|
|
3691
4012
|
if (Array.isArray(r) && r.length >= 3)
|
|
3692
4013
|
return [Number(r[0]) || 0, Number(r[1]) || 0, Number(r[2]) || 0];
|
|
3693
4014
|
if (typeof r != "string")
|
|
@@ -3705,14 +4026,14 @@ function Fr(r) {
|
|
|
3705
4026
|
const n = t[1].split(",").map((s) => Number(s.trim()));
|
|
3706
4027
|
return n.length < 3 || n.slice(0, 3).some((s) => !Number.isFinite(s)) ? null : n.slice(0, 3);
|
|
3707
4028
|
}
|
|
3708
|
-
function
|
|
4029
|
+
function ce(r, e) {
|
|
3709
4030
|
const n = (Array.isArray(r) && r.length > 0 ? r : e).map((s, i) => {
|
|
3710
|
-
const
|
|
3711
|
-
return !Number.isFinite(
|
|
4031
|
+
const o = Number((s == null ? void 0 : s.value) ?? (s == null ? void 0 : s.speed) ?? (s == null ? void 0 : s[0]) ?? i), a = un((s == null ? void 0 : s.color) ?? (s == null ? void 0 : s[1]) ?? s);
|
|
4032
|
+
return !Number.isFinite(o) || !a ? null : { value: o, color: a };
|
|
3712
4033
|
}).filter(Boolean).sort((s, i) => s.value - i.value);
|
|
3713
4034
|
return n.length > 0 ? n : e;
|
|
3714
4035
|
}
|
|
3715
|
-
function
|
|
4036
|
+
function cn(r, e) {
|
|
3716
4037
|
if (!Array.isArray(r) || r.length === 0)
|
|
3717
4038
|
return [255, 255, 255];
|
|
3718
4039
|
if (e <= r[0].value)
|
|
@@ -3720,19 +4041,19 @@ function Dr(r, e) {
|
|
|
3720
4041
|
for (let t = 1; t < r.length; t += 1) {
|
|
3721
4042
|
const n = r[t], s = r[t - 1];
|
|
3722
4043
|
if (e <= n.value) {
|
|
3723
|
-
const i = Math.max(n.value - s.value, 1e-4),
|
|
4044
|
+
const i = Math.max(n.value - s.value, 1e-4), o = E((e - s.value) / i, 0, 1);
|
|
3724
4045
|
return s.color.map(
|
|
3725
|
-
(
|
|
4046
|
+
(a, u) => Math.round(a + (n.color[u] - a) * o)
|
|
3726
4047
|
);
|
|
3727
4048
|
}
|
|
3728
4049
|
}
|
|
3729
4050
|
return r[r.length - 1].color;
|
|
3730
4051
|
}
|
|
3731
|
-
function
|
|
4052
|
+
function Pe(r, e) {
|
|
3732
4053
|
const [t, n, s] = r;
|
|
3733
|
-
return `rgba(${t}, ${n}, ${s}, ${
|
|
4054
|
+
return `rgba(${t}, ${n}, ${s}, ${E(e, 0, 1)})`;
|
|
3734
4055
|
}
|
|
3735
|
-
function
|
|
4056
|
+
function hn(r, e) {
|
|
3736
4057
|
if (!r || typeof r != "object")
|
|
3737
4058
|
return e;
|
|
3738
4059
|
const t = Number(r.west), n = Number(r.south), s = Number(r.east), i = Number(r.north);
|
|
@@ -3743,7 +4064,7 @@ function Br(r, e) {
|
|
|
3743
4064
|
north: Math.max(n, i)
|
|
3744
4065
|
} : e;
|
|
3745
4066
|
}
|
|
3746
|
-
function
|
|
4067
|
+
function dn(r, e) {
|
|
3747
4068
|
const t = {
|
|
3748
4069
|
west: Math.max(r.west, e.west),
|
|
3749
4070
|
south: Math.max(r.south, e.south),
|
|
@@ -3752,18 +4073,18 @@ function Or(r, e) {
|
|
|
3752
4073
|
};
|
|
3753
4074
|
return t.west >= t.east || t.south >= t.north ? null : t;
|
|
3754
4075
|
}
|
|
3755
|
-
function
|
|
4076
|
+
function Le(r, e, t) {
|
|
3756
4077
|
return r && Number.isFinite(r.x) && Number.isFinite(r.y) && r.x >= -64 && r.x <= e + 64 && r.y >= -64 && r.y <= t + 64;
|
|
3757
4078
|
}
|
|
3758
|
-
function
|
|
4079
|
+
function fn(r) {
|
|
3759
4080
|
return r && Number.isFinite(r.x) && Number.isFinite(r.y);
|
|
3760
4081
|
}
|
|
3761
|
-
function
|
|
4082
|
+
function yn(r) {
|
|
3762
4083
|
return String(r || "").toLowerCase();
|
|
3763
4084
|
}
|
|
3764
|
-
class
|
|
4085
|
+
class mn {
|
|
3765
4086
|
constructor(e = {}) {
|
|
3766
|
-
this.id = e.id || "wind-field-default", this.container = e.container || null, this.project = typeof e.project == "function" ? e.project : null, this.getViewBounds = typeof e.getViewBounds == "function" ? e.getViewBounds : null, this.getSceneMode = typeof e.getSceneMode == "function" ? e.getSceneMode : null, this.grid = e.grid instanceof
|
|
4087
|
+
this.id = e.id || "wind-field-default", this.container = e.container || null, this.project = typeof e.project == "function" ? e.project : null, this.getViewBounds = typeof e.getViewBounds == "function" ? e.getViewBounds : null, this.getSceneMode = typeof e.getSceneMode == "function" ? e.getSceneMode : null, this.grid = e.grid instanceof me ? e.grid : new me(e.data), this.options = {
|
|
3767
4088
|
zIndex: Number(e.zIndex ?? 30),
|
|
3768
4089
|
visible: e.visible !== !1,
|
|
3769
4090
|
running: e.running !== !1,
|
|
@@ -3788,9 +4109,9 @@ class zr {
|
|
|
3788
4109
|
projectionGrid: e.projectionGrid !== !1,
|
|
3789
4110
|
projectionGridCols: Number(e.projectionGridCols ?? 32),
|
|
3790
4111
|
projectionGridRows: Number(e.projectionGridRows ?? 20)
|
|
3791
|
-
}, this.colorScale =
|
|
4112
|
+
}, this.colorScale = ce(e.colorScale, ot), this.particleColorScale = ce(
|
|
3792
4113
|
e.particleColorScale,
|
|
3793
|
-
|
|
4114
|
+
at
|
|
3794
4115
|
), this.canvas = null, this.ctx = null, this.overlayCanvas = null, this.overlayCtx = null, this.particles = [], this.animationFrame = null, this.lastFrameTime = 0, this.destroyed = !1, this.width = 0, this.height = 0, this.resizeObserver = null, this.interactionSuspended = !1, this.runningBeforeInteraction = !1, this.overlayDirty = !0, this.spawnBoundsCache = null, this.resumeTimer = null, this.particleCursor = 0, this.projectionGrid = null, this.mount();
|
|
3795
4116
|
}
|
|
3796
4117
|
isReady() {
|
|
@@ -3816,12 +4137,12 @@ class zr {
|
|
|
3816
4137
|
resize() {
|
|
3817
4138
|
if (!this.canvas || !this.overlayCanvas || !this.container)
|
|
3818
4139
|
return;
|
|
3819
|
-
const e = this.container.getBoundingClientRect(), t =
|
|
4140
|
+
const e = this.container.getBoundingClientRect(), t = E(this.options.devicePixelRatio || 1, 1, 2), n = Math.max(1, Math.floor(e.width)), s = Math.max(1, Math.floor(e.height));
|
|
3820
4141
|
n === this.width && s === this.height || (this.width = n, this.height = s, [
|
|
3821
4142
|
[this.canvas, this.ctx],
|
|
3822
4143
|
[this.overlayCanvas, this.overlayCtx]
|
|
3823
|
-
].forEach(([i,
|
|
3824
|
-
i.width = Math.floor(n * t), i.height = Math.floor(s * t),
|
|
4144
|
+
].forEach(([i, o]) => {
|
|
4145
|
+
i.width = Math.floor(n * t), i.height = Math.floor(s * t), o == null || o.setTransform(t, 0, 0, t, 0, 0);
|
|
3825
4146
|
}), this.overlayDirty = !0, this.invalidateProjectionGrid(), this.clear());
|
|
3826
4147
|
}
|
|
3827
4148
|
clear() {
|
|
@@ -3837,10 +4158,10 @@ class zr {
|
|
|
3837
4158
|
this.options = {
|
|
3838
4159
|
...this.options,
|
|
3839
4160
|
...e
|
|
3840
|
-
}, e.colorScale !== void 0 && (this.colorScale =
|
|
4161
|
+
}, e.colorScale !== void 0 && (this.colorScale = ce(e.colorScale, ot), this.overlayDirty = !0), e.particleColorScale !== void 0 && (this.particleColorScale = ce(
|
|
3841
4162
|
e.particleColorScale,
|
|
3842
|
-
|
|
3843
|
-
)), this.canvas && (this.canvas.style.zIndex = String(this.options.zIndex + 1), this.canvas.style.display = this.options.visible ? "block" : "none"), this.overlayCanvas && (this.overlayCanvas.style.zIndex = String(this.options.zIndex), this.overlayCanvas.style.display = this.options.visible ? "block" : "none"), e.data && (this.grid = new
|
|
4163
|
+
at
|
|
4164
|
+
)), this.canvas && (this.canvas.style.zIndex = String(this.options.zIndex + 1), this.canvas.style.display = this.options.visible ? "block" : "none"), this.overlayCanvas && (this.overlayCanvas.style.zIndex = String(this.options.zIndex), this.overlayCanvas.style.display = this.options.visible ? "block" : "none"), e.data && (this.grid = new me(e.data), this.overlayDirty = !0, this.reset()), (e.particleCount !== void 0 || e.maxAge !== void 0 || e.velocityOverlay !== void 0 || e.velocityOverlayOpacity !== void 0 || e.velocityOverlayCellSize !== void 0 || e.velocityOverlayEdgeFade !== void 0 || e.projectionGrid !== void 0 || e.projectionGridCols !== void 0 || e.projectionGridRows !== void 0 || e.reset === !0) && (this.overlayDirty = !0, this.reset()), this.drawVelocityOverlay();
|
|
3844
4165
|
}
|
|
3845
4166
|
refreshSpawnBounds() {
|
|
3846
4167
|
return this.spawnBoundsCache = this.getSpawnBounds(), this.invalidateProjectionGrid(), this.spawnBoundsCache;
|
|
@@ -3849,7 +4170,7 @@ class zr {
|
|
|
3849
4170
|
var t;
|
|
3850
4171
|
if (!this.options.projectionGrid)
|
|
3851
4172
|
return !1;
|
|
3852
|
-
const e =
|
|
4173
|
+
const e = yn((t = this.getSceneMode) == null ? void 0 : t.call(this));
|
|
3853
4174
|
return e === "2d" || e === "2.5d";
|
|
3854
4175
|
}
|
|
3855
4176
|
invalidateProjectionGrid() {
|
|
@@ -3858,11 +4179,11 @@ class zr {
|
|
|
3858
4179
|
buildProjectionGrid(e = this.spawnBoundsCache) {
|
|
3859
4180
|
if (!this.shouldUseProjectionGrid() || !e)
|
|
3860
4181
|
return this.projectionGrid = null, null;
|
|
3861
|
-
const t =
|
|
4182
|
+
const t = E(Math.floor(this.options.projectionGridCols) || 32, 8, 96), n = E(Math.floor(this.options.projectionGridRows) || 20, 6, 64), s = [];
|
|
3862
4183
|
for (let i = 0; i <= n; i += 1)
|
|
3863
|
-
for (let
|
|
3864
|
-
const
|
|
3865
|
-
s.push(this.project(
|
|
4184
|
+
for (let o = 0; o <= t; o += 1) {
|
|
4185
|
+
const a = e.west + (e.east - e.west) * (o / t), u = e.south + (e.north - e.south) * (i / n);
|
|
4186
|
+
s.push(this.project(a, u, this.options.height));
|
|
3866
4187
|
}
|
|
3867
4188
|
return this.projectionGrid = {
|
|
3868
4189
|
bounds: e,
|
|
@@ -3875,19 +4196,19 @@ class zr {
|
|
|
3875
4196
|
const n = this.projectionGrid || this.buildProjectionGrid(this.spawnBoundsCache);
|
|
3876
4197
|
if (!n || !n.bounds)
|
|
3877
4198
|
return this.project(e, t, this.options.height);
|
|
3878
|
-
const { bounds: s, cols: i, rows:
|
|
3879
|
-
if (![
|
|
4199
|
+
const { bounds: s, cols: i, rows: o, nodes: a } = n, u = Math.max(s.east - s.west, 1e-4), l = Math.max(s.north - s.south, 1e-4), c = (e - s.west) / u * i, h = (t - s.south) / l * o, d = E(Math.floor(c), 0, i - 1), f = E(Math.floor(h), 0, o - 1), y = d + 1, I = f + 1, v = E(c - d, 0, 1), P = E(h - f, 0, 1), b = i + 1, w = a[f * b + d], S = a[f * b + y], g = a[I * b + d], C = a[I * b + y];
|
|
4200
|
+
if (![w, S, g, C].every(fn))
|
|
3880
4201
|
return this.project(e, t, this.options.height);
|
|
3881
|
-
const
|
|
4202
|
+
const T = 1 - v, G = 1 - P;
|
|
3882
4203
|
return {
|
|
3883
|
-
x:
|
|
3884
|
-
y:
|
|
4204
|
+
x: w.x * T * G + S.x * v * G + g.x * T * P + C.x * v * P,
|
|
4205
|
+
y: w.y * T * G + S.y * v * G + g.y * T * P + C.y * v * P
|
|
3885
4206
|
};
|
|
3886
4207
|
}
|
|
3887
4208
|
getSpawnBounds() {
|
|
3888
4209
|
var n;
|
|
3889
|
-
const e = this.grid.getBounds(), t =
|
|
3890
|
-
return
|
|
4210
|
+
const e = this.grid.getBounds(), t = hn((n = this.getViewBounds) == null ? void 0 : n.call(this), e);
|
|
4211
|
+
return dn(e, t) || e;
|
|
3891
4212
|
}
|
|
3892
4213
|
createParticle(e = this.spawnBoundsCache || this.refreshSpawnBounds()) {
|
|
3893
4214
|
if (!e)
|
|
@@ -3927,7 +4248,7 @@ class zr {
|
|
|
3927
4248
|
if (!this.isReady())
|
|
3928
4249
|
return;
|
|
3929
4250
|
this.clear();
|
|
3930
|
-
const e =
|
|
4251
|
+
const e = E(Math.floor(this.options.particleCount), 1, 8e3), t = this.refreshSpawnBounds();
|
|
3931
4252
|
this.particles = Array.from({ length: e }, () => this.createParticle(t)), this.particleCursor = 0, this.overlayDirty = !0, this.drawVelocityOverlay();
|
|
3932
4253
|
}
|
|
3933
4254
|
getParticleColorIndex(e) {
|
|
@@ -3946,32 +4267,32 @@ class zr {
|
|
|
3946
4267
|
const e = this.spawnBoundsCache || this.refreshSpawnBounds();
|
|
3947
4268
|
if (!e)
|
|
3948
4269
|
return;
|
|
3949
|
-
const t = this.overlayCtx, n =
|
|
4270
|
+
const t = this.overlayCtx, n = E(Number(this.options.velocityOverlayCellSize) || 54, 28, 96), s = E(Math.ceil(this.width / n), 10, 64), i = E(Math.ceil(this.height / n), 8, 48), o = (e.east - e.west) / s, a = (e.north - e.south) / i, u = n * 1.25, l = this.grid.getBounds();
|
|
3950
4271
|
t.save(), t.globalCompositeOperation = "source-over";
|
|
3951
4272
|
for (let c = 0; c < i; c += 1) {
|
|
3952
|
-
const h = e.south + (c + 0.5) *
|
|
3953
|
-
for (let
|
|
3954
|
-
const
|
|
3955
|
-
if (!
|
|
4273
|
+
const h = e.south + (c + 0.5) * a;
|
|
4274
|
+
for (let d = 0; d < s; d += 1) {
|
|
4275
|
+
const f = e.west + (d + 0.5) * o, y = this.grid.sample(f, h);
|
|
4276
|
+
if (!y || y.speed <= 0)
|
|
3956
4277
|
continue;
|
|
3957
|
-
const
|
|
3958
|
-
if (!
|
|
4278
|
+
const I = this.projectPoint(f, h);
|
|
4279
|
+
if (!Le(I, this.width, this.height))
|
|
3959
4280
|
continue;
|
|
3960
|
-
const
|
|
3961
|
-
if (
|
|
4281
|
+
const v = cn(this.colorScale, y.speed), P = this.getDataEdgeOpacity(f, h, l), b = this.options.velocityOverlayOpacity * P;
|
|
4282
|
+
if (b <= 0.01)
|
|
3962
4283
|
continue;
|
|
3963
|
-
const
|
|
3964
|
-
|
|
4284
|
+
const w = t.createRadialGradient(I.x, I.y, 0, I.x, I.y, u);
|
|
4285
|
+
w.addColorStop(0, Pe(v, b)), w.addColorStop(1, Pe(v, 0)), t.fillStyle = w, t.fillRect(I.x - u, I.y - u, u * 2, u * 2);
|
|
3965
4286
|
}
|
|
3966
4287
|
}
|
|
3967
4288
|
t.restore();
|
|
3968
4289
|
}
|
|
3969
4290
|
getDataEdgeOpacity(e, t, n) {
|
|
3970
|
-
const s =
|
|
4291
|
+
const s = E(this.options.velocityOverlayEdgeFade, 0, 0.35);
|
|
3971
4292
|
if (s <= 0 || !n)
|
|
3972
4293
|
return 1;
|
|
3973
|
-
const i = (e - n.west) / Math.max(n.east - n.west, 1e-4),
|
|
3974
|
-
return
|
|
4294
|
+
const i = (e - n.west) / Math.max(n.east - n.west, 1e-4), o = (t - n.south) / Math.max(n.north - n.south, 1e-4), a = Math.min(i, 1 - i, o, 1 - o);
|
|
4295
|
+
return E(a / s, 0, 1);
|
|
3975
4296
|
}
|
|
3976
4297
|
start() {
|
|
3977
4298
|
this.destroyed || (this.options.running = !0, this.interactionSuspended = !1, this.animationFrame || (this.lastFrameTime = performance.now(), this.animationFrame = requestAnimationFrame((e) => this.animate(e))));
|
|
@@ -4001,35 +4322,35 @@ class zr {
|
|
|
4001
4322
|
}
|
|
4002
4323
|
stepParticle(e, t) {
|
|
4003
4324
|
const n = this.grid.sample(e.lon, e.lat), s = Number.isFinite(e.screenX) && Number.isFinite(e.screenY) ? { x: e.screenX, y: e.screenY } : this.projectPoint(e.lon, e.lat);
|
|
4004
|
-
if (!n || n.speed <= 0 || !
|
|
4325
|
+
if (!n || n.speed <= 0 || !Le(s, this.width, this.height))
|
|
4005
4326
|
return Object.assign(e, this.createParticle()), null;
|
|
4006
|
-
const i = e.lat * Math.PI / 180,
|
|
4007
|
-
return !h || !
|
|
4327
|
+
const i = e.lat * Math.PI / 180, o = Math.max(Math.cos(i) * 111320, 1e3), a = 111320, u = this.options.velocityScale * t, l = e.lon + n.u * u / o, c = e.lat + n.v * u / a, h = this.grid.sample(l, c), d = this.projectPoint(l, c);
|
|
4328
|
+
return !h || !Le(d, this.width, this.height) ? (Object.assign(e, this.createParticle()), null) : (e.lon = l, e.lat = c, e.screenX = d.x, e.screenY = d.y, e.age += 1, e.age > e.maxAge && Object.assign(e, this.createParticle()), { from: s, to: d, speed: h.speed });
|
|
4008
4329
|
}
|
|
4009
4330
|
getFrameParticleCount(e) {
|
|
4010
4331
|
var i;
|
|
4011
|
-
const t =
|
|
4332
|
+
const t = E(
|
|
4012
4333
|
Math.floor(this.options.maxFrameParticles || e),
|
|
4013
4334
|
1,
|
|
4014
4335
|
e
|
|
4015
4336
|
), n = Math.floor(this.options.sceneModeMaxFrameParticles || 0), s = String(((i = this.getSceneMode) == null ? void 0 : i.call(this)) || "").toLowerCase();
|
|
4016
|
-
return (s === "2d" || s === "2.5d") && n > 0 ?
|
|
4337
|
+
return (s === "2d" || s === "2.5d") && n > 0 ? E(n, 1, t) : t;
|
|
4017
4338
|
}
|
|
4018
4339
|
drawFrame(e) {
|
|
4019
4340
|
if (!this.ctx || this.width <= 0 || this.height <= 0)
|
|
4020
4341
|
return;
|
|
4021
4342
|
const t = this.ctx;
|
|
4022
|
-
t.globalCompositeOperation = "destination-in", t.fillStyle = `rgba(0, 0, 0, ${
|
|
4343
|
+
t.globalCompositeOperation = "destination-in", t.fillStyle = `rgba(0, 0, 0, ${E(this.options.fadeOpacity, 0.75, 0.98)})`, t.fillRect(0, 0, this.width, this.height), t.globalCompositeOperation = this.options.blendMode, t.lineCap = "round", t.lineJoin = "round";
|
|
4023
4344
|
const n = this.particleColorScale.map(() => []), s = this.particles.length, i = this.getFrameParticleCount(s);
|
|
4024
|
-
for (let
|
|
4025
|
-
const
|
|
4345
|
+
for (let o = 0; o < i; o += 1) {
|
|
4346
|
+
const a = (this.particleCursor + o) % s, u = this.stepParticle(this.particles[a], e);
|
|
4026
4347
|
u && n[this.getParticleColorIndex(u.speed)].push(u);
|
|
4027
4348
|
}
|
|
4028
|
-
this.particleCursor = (this.particleCursor + i) % s, n.forEach((
|
|
4029
|
-
if (
|
|
4349
|
+
this.particleCursor = (this.particleCursor + i) % s, n.forEach((o, a) => {
|
|
4350
|
+
if (o.length === 0)
|
|
4030
4351
|
return;
|
|
4031
|
-
const u = this.particleColorScale.length <= 1 ? 0 :
|
|
4032
|
-
t.lineWidth = this.options.lineWidth * (0.72 + u * 0.56), t.strokeStyle = this.particleColorScale[
|
|
4352
|
+
const u = this.particleColorScale.length <= 1 ? 0 : a / (this.particleColorScale.length - 1);
|
|
4353
|
+
t.lineWidth = this.options.lineWidth * (0.72 + u * 0.56), t.strokeStyle = this.particleColorScale[a] ? Pe(this.particleColorScale[a].color, this.options.particleOpacity) : this.options.color, t.beginPath(), o.forEach((l) => {
|
|
4033
4354
|
t.moveTo(l.from.x, l.from.y), t.lineTo(l.to.x, l.to.y);
|
|
4034
4355
|
}), t.stroke();
|
|
4035
4356
|
});
|
|
@@ -4037,9 +4358,9 @@ class zr {
|
|
|
4037
4358
|
animate(e) {
|
|
4038
4359
|
if (this.animationFrame = null, !(this.destroyed || !this.options.running || this.interactionSuspended)) {
|
|
4039
4360
|
if (this.options.visible && this.isReady()) {
|
|
4040
|
-
const t = 1e3 /
|
|
4361
|
+
const t = 1e3 / E(this.options.frameRate, 1, 60), n = e - this.lastFrameTime;
|
|
4041
4362
|
if (n >= t) {
|
|
4042
|
-
const s =
|
|
4363
|
+
const s = E(n / 16.67, 0.5, 2.5);
|
|
4043
4364
|
this.lastFrameTime = e, this.drawFrame(s);
|
|
4044
4365
|
}
|
|
4045
4366
|
}
|
|
@@ -4062,18 +4383,18 @@ class zr {
|
|
|
4062
4383
|
this.stop(), this.destroyed = !0, this.clearResumeTimer(), this.resizeObserver && (this.resizeObserver.disconnect(), this.resizeObserver = null), (e = this.canvas) != null && e.parentNode && this.canvas.parentNode.removeChild(this.canvas), (t = this.overlayCanvas) != null && t.parentNode && this.overlayCanvas.parentNode.removeChild(this.overlayCanvas), this.clear(), this.canvas = null, this.ctx = null, this.overlayCanvas = null, this.overlayCtx = null, this.particles = [];
|
|
4063
4384
|
}
|
|
4064
4385
|
}
|
|
4065
|
-
function
|
|
4386
|
+
function H(r = {}) {
|
|
4066
4387
|
return typeof r == "string" ? r || "wind-field-default" : (r == null ? void 0 : r.id) || (r == null ? void 0 : r.layerId) || "wind-field-default";
|
|
4067
4388
|
}
|
|
4068
|
-
function
|
|
4389
|
+
function lt(r = {}) {
|
|
4069
4390
|
const {
|
|
4070
4391
|
id: e,
|
|
4071
4392
|
layerId: t,
|
|
4072
4393
|
data: n,
|
|
4073
4394
|
windData: s,
|
|
4074
4395
|
options: i,
|
|
4075
|
-
container:
|
|
4076
|
-
project:
|
|
4396
|
+
container: o,
|
|
4397
|
+
project: a,
|
|
4077
4398
|
getViewBounds: u,
|
|
4078
4399
|
...l
|
|
4079
4400
|
} = r || {};
|
|
@@ -4082,28 +4403,28 @@ function Ve(r = {}) {
|
|
|
4082
4403
|
...i || {}
|
|
4083
4404
|
};
|
|
4084
4405
|
}
|
|
4085
|
-
function
|
|
4406
|
+
function ut(r) {
|
|
4086
4407
|
return !!(r && typeof r.getMapInstance == "function" && typeof r.getMapContainer == "function" && typeof r.projectToContainerPoint == "function" && typeof r.getViewBounds == "function" && typeof r.onViewChange == "function");
|
|
4087
4408
|
}
|
|
4088
|
-
class
|
|
4409
|
+
class Tn {
|
|
4089
4410
|
constructor(e = {}) {
|
|
4090
4411
|
this.baseGIS = null, this.layers = /* @__PURE__ */ new Map();
|
|
4091
|
-
const t = (e == null ? void 0 : e.mapCore) || (e == null ? void 0 : e.baseGIS) || (
|
|
4412
|
+
const t = (e == null ? void 0 : e.mapCore) || (e == null ? void 0 : e.baseGIS) || (ut(e) ? e : null);
|
|
4092
4413
|
t && this.mount(t);
|
|
4093
4414
|
}
|
|
4094
4415
|
mount(e) {
|
|
4095
4416
|
var t, n;
|
|
4096
|
-
return
|
|
4417
|
+
return ut(e) ? (this.baseGIS = e, p(
|
|
4097
4418
|
{ engineType: ((n = (t = this.baseGIS).getEngineType) == null ? void 0 : n.call(t)) || "unknown" },
|
|
4098
4419
|
"WindFieldMethods mounted with BaseGIS."
|
|
4099
|
-
)) :
|
|
4420
|
+
)) : m("WindFieldMethods mount requires BaseGIS instance.", "INVALID_MOUNT_TARGET");
|
|
4100
4421
|
}
|
|
4101
4422
|
resolveBaseGIS() {
|
|
4102
4423
|
var e, t;
|
|
4103
|
-
return this.baseGIS ? (t = (e = this.baseGIS).getMapInstance) != null && t.call(e) ?
|
|
4424
|
+
return this.baseGIS ? (t = (e = this.baseGIS).getMapInstance) != null && t.call(e) ? p(null, "BaseGIS is ready.") : m(
|
|
4104
4425
|
"Map instance is not ready. Please call mapCore.init() first.",
|
|
4105
|
-
|
|
4106
|
-
) :
|
|
4426
|
+
V.NOT_INITIALIZED
|
|
4427
|
+
) : m("WindFieldMethods has not been mounted.", "NOT_MOUNTED");
|
|
4107
4428
|
}
|
|
4108
4429
|
addWindField(e = {}) {
|
|
4109
4430
|
var u, l;
|
|
@@ -4112,83 +4433,83 @@ class Jr {
|
|
|
4112
4433
|
return t;
|
|
4113
4434
|
const n = (e == null ? void 0 : e.data) || (e == null ? void 0 : e.windData);
|
|
4114
4435
|
if (!n)
|
|
4115
|
-
return
|
|
4436
|
+
return m("Wind field data is required.", V.FAILED);
|
|
4116
4437
|
const s = this.baseGIS.getMapContainer();
|
|
4117
4438
|
if (!(s != null && s.success) || !((u = s.data) != null && u.container))
|
|
4118
|
-
return (s == null ? void 0 : s.success) === !1 ? s :
|
|
4119
|
-
const i =
|
|
4439
|
+
return (s == null ? void 0 : s.success) === !1 ? s : m("Map container is not available.", V.NOT_INITIALIZED);
|
|
4440
|
+
const i = H(e);
|
|
4120
4441
|
this.removeWindField(i);
|
|
4121
|
-
const
|
|
4442
|
+
const o = new mn({
|
|
4122
4443
|
id: i,
|
|
4123
4444
|
data: n,
|
|
4124
4445
|
container: s.data.container,
|
|
4125
|
-
...
|
|
4126
|
-
project: (c, h,
|
|
4127
|
-
const
|
|
4446
|
+
...lt(e),
|
|
4447
|
+
project: (c, h, d = 0) => {
|
|
4448
|
+
const f = this.baseGIS.projectToContainerPoint({
|
|
4128
4449
|
longitude: c,
|
|
4129
4450
|
latitude: h,
|
|
4130
|
-
height:
|
|
4451
|
+
height: d
|
|
4131
4452
|
});
|
|
4132
|
-
return
|
|
4453
|
+
return f != null && f.success ? f.data : null;
|
|
4133
4454
|
},
|
|
4134
4455
|
getViewBounds: () => {
|
|
4135
4456
|
const c = this.baseGIS.getViewBounds();
|
|
4136
4457
|
return c != null && c.success ? c.data : null;
|
|
4137
4458
|
},
|
|
4138
4459
|
getSceneMode: () => {
|
|
4139
|
-
var h,
|
|
4140
|
-
const c = (
|
|
4141
|
-
return c != null && c.success ? (
|
|
4460
|
+
var h, d, f;
|
|
4461
|
+
const c = (d = (h = this.baseGIS).getSceneMode) == null ? void 0 : d.call(h);
|
|
4462
|
+
return c != null && c.success ? (f = c.data) == null ? void 0 : f.mode : "";
|
|
4142
4463
|
}
|
|
4143
4464
|
});
|
|
4144
|
-
if (!
|
|
4145
|
-
return
|
|
4146
|
-
const
|
|
4147
|
-
onStart: () =>
|
|
4148
|
-
onEnd: () =>
|
|
4465
|
+
if (!o.grid.valid)
|
|
4466
|
+
return o.destroy(), m(o.grid.errorMessage || "Invalid wind field data.", V.FAILED);
|
|
4467
|
+
const a = this.baseGIS.onViewChange({
|
|
4468
|
+
onStart: () => o.suspendForInteraction(),
|
|
4469
|
+
onEnd: () => o.resumeAfterInteraction()
|
|
4149
4470
|
});
|
|
4150
|
-
return
|
|
4151
|
-
layer:
|
|
4152
|
-
offViewChange: (l =
|
|
4153
|
-
}),
|
|
4471
|
+
return a != null && a.success ? (this.layers.set(i, {
|
|
4472
|
+
layer: o,
|
|
4473
|
+
offViewChange: (l = a.data) == null ? void 0 : l.off
|
|
4474
|
+
}), p(o.getState(), `Wind field "${i}" added.`)) : (o.destroy(), a || m("View change listener is not available."));
|
|
4154
4475
|
}
|
|
4155
4476
|
updateWindField(e = {}) {
|
|
4156
4477
|
const t = this.resolveBaseGIS();
|
|
4157
4478
|
if (!t.success)
|
|
4158
4479
|
return t;
|
|
4159
|
-
const n =
|
|
4480
|
+
const n = H(e), s = this.layers.get(n);
|
|
4160
4481
|
if (!s)
|
|
4161
|
-
return
|
|
4162
|
-
const i =
|
|
4163
|
-
return
|
|
4482
|
+
return m(`Wind field "${n}" not found.`, V.FAILED);
|
|
4483
|
+
const i = lt(e), o = (e == null ? void 0 : e.data) || (e == null ? void 0 : e.windData);
|
|
4484
|
+
return o && (i.data = o), s.layer.updateOptions(i), p(s.layer.getState(), `Wind field "${n}" updated.`);
|
|
4164
4485
|
}
|
|
4165
4486
|
startWindField(e = {}) {
|
|
4166
|
-
const t =
|
|
4167
|
-
return n ? (n.layer.start(),
|
|
4487
|
+
const t = H(e), n = this.layers.get(t);
|
|
4488
|
+
return n ? (n.layer.start(), p(n.layer.getState(), `Wind field "${t}" started.`)) : m(`Wind field "${t}" not found.`, V.FAILED);
|
|
4168
4489
|
}
|
|
4169
4490
|
stopWindField(e = {}) {
|
|
4170
|
-
const t =
|
|
4171
|
-
return n ? (n.layer.stop(),
|
|
4491
|
+
const t = H(e), n = this.layers.get(t);
|
|
4492
|
+
return n ? (n.layer.stop(), p(n.layer.getState(), `Wind field "${t}" stopped.`)) : m(`Wind field "${t}" not found.`, V.FAILED);
|
|
4172
4493
|
}
|
|
4173
4494
|
showWindField(e = {}) {
|
|
4174
|
-
const t =
|
|
4175
|
-
return n ? (n.layer.show(),
|
|
4495
|
+
const t = H(e), n = this.layers.get(t);
|
|
4496
|
+
return n ? (n.layer.show(), p(n.layer.getState(), `Wind field "${t}" shown.`)) : m(`Wind field "${t}" not found.`, V.FAILED);
|
|
4176
4497
|
}
|
|
4177
4498
|
hideWindField(e = {}) {
|
|
4178
|
-
const t =
|
|
4179
|
-
return n ? (n.layer.hide(),
|
|
4499
|
+
const t = H(e), n = this.layers.get(t);
|
|
4500
|
+
return n ? (n.layer.hide(), p(n.layer.getState(), `Wind field "${t}" hidden.`)) : m(`Wind field "${t}" not found.`, V.FAILED);
|
|
4180
4501
|
}
|
|
4181
4502
|
removeWindField(e = {}) {
|
|
4182
4503
|
var s;
|
|
4183
|
-
const t =
|
|
4184
|
-
return n ? ((s = n.offViewChange) == null || s.call(n), n.layer.destroy(), this.layers.delete(t),
|
|
4504
|
+
const t = H(e), n = this.layers.get(t);
|
|
4505
|
+
return n ? ((s = n.offViewChange) == null || s.call(n), n.layer.destroy(), this.layers.delete(t), p({ layerId: t, removed: !0 }, `Wind field "${t}" removed.`)) : p({ layerId: t, removed: !1 }, `Wind field "${t}" not found.`);
|
|
4185
4506
|
}
|
|
4186
4507
|
clearWindFields() {
|
|
4187
4508
|
const e = this.layers.size;
|
|
4188
4509
|
return this.layers.forEach((t) => {
|
|
4189
4510
|
var n;
|
|
4190
4511
|
(n = t.offViewChange) == null || n.call(t), t.layer.destroy();
|
|
4191
|
-
}), this.layers.clear(),
|
|
4512
|
+
}), this.layers.clear(), p({ count: e }, `Wind fields cleared: ${e}.`);
|
|
4192
4513
|
}
|
|
4193
4514
|
getState() {
|
|
4194
4515
|
return {
|
|
@@ -4199,16 +4520,16 @@ class Jr {
|
|
|
4199
4520
|
}
|
|
4200
4521
|
}
|
|
4201
4522
|
export {
|
|
4202
|
-
|
|
4203
|
-
|
|
4204
|
-
|
|
4205
|
-
|
|
4206
|
-
|
|
4207
|
-
|
|
4208
|
-
|
|
4209
|
-
|
|
4210
|
-
|
|
4211
|
-
|
|
4212
|
-
|
|
4213
|
-
|
|
4523
|
+
Tt as ContourLayerController,
|
|
4524
|
+
bn as GridLayerController,
|
|
4525
|
+
pn as ImageLayerController,
|
|
4526
|
+
Sn as LineLayerController,
|
|
4527
|
+
vn as MapViewLinkController,
|
|
4528
|
+
Ln as PointClusterController,
|
|
4529
|
+
wn as PointDensityController,
|
|
4530
|
+
Cn as PointLargeLayerController,
|
|
4531
|
+
Mn as RasterContourController,
|
|
4532
|
+
Pn as TyphoonPathController,
|
|
4533
|
+
Tn as WindFieldMethods,
|
|
4534
|
+
$e as toImageLayerArea
|
|
4214
4535
|
};
|