@3clear/basegis 0.1.7 → 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 +65 -17
- package/dist/WindDataGrid-DA9pzsfX.js +508 -0
- package/dist/basegis.js +3578 -2636
- package/dist/methods.js +1232 -935
- 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 nt {
|
|
|
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,
|
|
@@ -83,11 +83,11 @@ class nt {
|
|
|
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
|
);
|
|
@@ -104,10 +104,10 @@ class nt {
|
|
|
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 nt {
|
|
|
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,7 +193,7 @@ class nt {
|
|
|
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);
|
|
@@ -201,10 +201,10 @@ class nt {
|
|
|
201
201
|
getState() {
|
|
202
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
|
-
const
|
|
204
|
+
const u = (s = (n = this.baseGIS).getContourLayerState) == null ? void 0 : s.call(n, {
|
|
205
205
|
layerId: this.currentPayload.layerId || this.options.layerId
|
|
206
206
|
});
|
|
207
|
-
|
|
207
|
+
u != null && u.success && this.syncStateFromResult(u);
|
|
208
208
|
}
|
|
209
209
|
return {
|
|
210
210
|
mounted: !!this.baseGIS,
|
|
@@ -217,17 +217,17 @@ class nt {
|
|
|
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
225
|
return r != null && String(r).trim() !== "";
|
|
226
226
|
}
|
|
227
|
-
function
|
|
228
|
-
return
|
|
227
|
+
function je(r, e, t = "") {
|
|
228
|
+
return Oe(r) ? r : Oe(e) ? e : t;
|
|
229
229
|
}
|
|
230
|
-
function
|
|
230
|
+
function _e(r, e = {
|
|
231
231
|
startLon: 73,
|
|
232
232
|
startLat: 18,
|
|
233
233
|
endLon: 135,
|
|
@@ -235,32 +235,32 @@ function Le(r, e = {
|
|
|
235
235
|
}) {
|
|
236
236
|
const t = r && typeof r == "object" ? r : e;
|
|
237
237
|
return {
|
|
238
|
-
startLon:
|
|
239
|
-
startLat:
|
|
240
|
-
endLon:
|
|
241
|
-
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)
|
|
242
242
|
};
|
|
243
243
|
}
|
|
244
|
-
function
|
|
244
|
+
function Gt(r) {
|
|
245
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");
|
|
246
246
|
}
|
|
247
|
-
function
|
|
247
|
+
function Nt(r = {}) {
|
|
248
248
|
return !!(r.tifUrl || r.imageUrl || r.grayImageUrl || r.imageGridData);
|
|
249
249
|
}
|
|
250
|
-
class
|
|
250
|
+
class bn {
|
|
251
251
|
constructor(e = {}) {
|
|
252
252
|
this.options = {
|
|
253
253
|
visible: e.visible ?? !0,
|
|
254
254
|
layerId: e.layerId || "grid-layer-default",
|
|
255
|
-
defaultArea:
|
|
256
|
-
gridTotal:
|
|
257
|
-
tileSize:
|
|
258
|
-
decimalPlaces:
|
|
255
|
+
defaultArea: _e(e.defaultArea),
|
|
256
|
+
gridTotal: j(e.gridTotal, 4),
|
|
257
|
+
tileSize: j(e.tileSize, 512),
|
|
258
|
+
decimalPlaces: j(e.decimalPlaces, 2),
|
|
259
259
|
showLabel: !!e.showLabel,
|
|
260
260
|
showProbe: !!e.showProbe,
|
|
261
261
|
colorize: e.colorize || null,
|
|
262
262
|
// 控制器级配置属于当前图层的显式覆盖;BaseGIS 全局默认由主入口另行注入。
|
|
263
|
-
sourceProjectionCrs:
|
|
263
|
+
sourceProjectionCrs: je(
|
|
264
264
|
e.sourceProjectionCrs,
|
|
265
265
|
e.sourceProjection
|
|
266
266
|
)
|
|
@@ -268,27 +268,27 @@ class $r {
|
|
|
268
268
|
}
|
|
269
269
|
mount(e) {
|
|
270
270
|
var t, n;
|
|
271
|
-
return
|
|
271
|
+
return Gt(e) ? (this.baseGIS = e, p(
|
|
272
272
|
{ engineType: ((n = (t = this.baseGIS).getEngineType) == null ? void 0 : n.call(t)) || "unknown" },
|
|
273
273
|
"GridLayerController mounted with BaseGIS."
|
|
274
|
-
)) :
|
|
274
|
+
)) : m(
|
|
275
275
|
"GridLayerController mount requires BaseGIS instance.",
|
|
276
276
|
"INVALID_MOUNT_TARGET"
|
|
277
277
|
);
|
|
278
278
|
}
|
|
279
279
|
resolveBaseGIS() {
|
|
280
280
|
var e, t;
|
|
281
|
-
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(
|
|
282
282
|
"Map instance is not ready. Please call mapCore.init() first.",
|
|
283
283
|
"NOT_INITIALIZED"
|
|
284
|
-
) :
|
|
284
|
+
) : m("GridLayerController has not been mounted.", "NOT_MOUNTED");
|
|
285
285
|
}
|
|
286
286
|
getLayerId(e = {}) {
|
|
287
287
|
var t;
|
|
288
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;
|
|
289
289
|
}
|
|
290
290
|
buildPayload(e = {}) {
|
|
291
|
-
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
292
|
e.sourceProjectionCrs,
|
|
293
293
|
e.sourceProjection,
|
|
294
294
|
this.options.sourceProjectionCrs
|
|
@@ -297,9 +297,9 @@ class $r {
|
|
|
297
297
|
...e,
|
|
298
298
|
layerId: this.getLayerId(e),
|
|
299
299
|
area: n,
|
|
300
|
-
gridTotal:
|
|
301
|
-
tileSize:
|
|
302
|
-
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),
|
|
303
303
|
showLabel: typeof e.showLabel == "boolean" ? e.showLabel : this.options.showLabel,
|
|
304
304
|
showProbe: typeof e.showProbe == "boolean" ? e.showProbe : this.options.showProbe,
|
|
305
305
|
colorize: e.colorize || this.options.colorize,
|
|
@@ -316,8 +316,8 @@ class $r {
|
|
|
316
316
|
const t = this.resolveBaseGIS();
|
|
317
317
|
if (!t.success)
|
|
318
318
|
return t;
|
|
319
|
-
if (!
|
|
320
|
-
return
|
|
319
|
+
if (!Nt(e))
|
|
320
|
+
return m(
|
|
321
321
|
"Grid layer requires tifUrl, imageUrl, grayImageUrl or imageGridData.",
|
|
322
322
|
"INVALID_GRID_SOURCE"
|
|
323
323
|
);
|
|
@@ -348,7 +348,7 @@ class $r {
|
|
|
348
348
|
...this.currentPayload,
|
|
349
349
|
...e,
|
|
350
350
|
layerId: e.layerId || e.gridLayerId || this.currentPayload.layerId
|
|
351
|
-
}) :
|
|
351
|
+
}) : m("Grid layer has not been loaded.", "NOT_LOADED");
|
|
352
352
|
}
|
|
353
353
|
show(e = {}) {
|
|
354
354
|
const t = this.resolveBaseGIS();
|
|
@@ -370,11 +370,11 @@ class $r {
|
|
|
370
370
|
}
|
|
371
371
|
destroy(e = {}) {
|
|
372
372
|
if (!this.resolveBaseGIS().success)
|
|
373
|
-
return this.currentPayload = null, this.layerType = "unknown",
|
|
373
|
+
return this.currentPayload = null, this.layerType = "unknown", p(null, "Grid layer controller destroyed (local state only).");
|
|
374
374
|
const n = this.baseGIS.removeGridLayer({
|
|
375
375
|
layerId: this.getLayerId(e)
|
|
376
376
|
});
|
|
377
|
-
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;
|
|
378
378
|
}
|
|
379
379
|
getState() {
|
|
380
380
|
var e, t, n;
|
|
@@ -388,17 +388,17 @@ class $r {
|
|
|
388
388
|
};
|
|
389
389
|
}
|
|
390
390
|
}
|
|
391
|
-
function
|
|
391
|
+
function F(r, e = 0) {
|
|
392
392
|
const t = Number(r);
|
|
393
393
|
return Number.isFinite(t) ? t : e;
|
|
394
394
|
}
|
|
395
|
-
function
|
|
395
|
+
function Ve(r) {
|
|
396
396
|
return r != null && String(r).trim() !== "";
|
|
397
397
|
}
|
|
398
|
-
function
|
|
399
|
-
return
|
|
398
|
+
function ze(r, e, t = "") {
|
|
399
|
+
return Ve(r) ? r : Ve(e) ? e : t;
|
|
400
400
|
}
|
|
401
|
-
function
|
|
401
|
+
function Ue(r) {
|
|
402
402
|
if (Array.isArray(r) && r.length >= 2) {
|
|
403
403
|
const e = Number(r[0]), t = Number(r[1]);
|
|
404
404
|
return Number.isFinite(e) && Number.isFinite(t) ? { lat: e, lng: t } : null;
|
|
@@ -409,7 +409,7 @@ function Te(r) {
|
|
|
409
409
|
}
|
|
410
410
|
return null;
|
|
411
411
|
}
|
|
412
|
-
function
|
|
412
|
+
function we(r) {
|
|
413
413
|
if (!r) return null;
|
|
414
414
|
if (typeof r.getWest == "function" && typeof r.getSouth == "function" && typeof r.getEast == "function" && typeof r.getNorth == "function")
|
|
415
415
|
return {
|
|
@@ -426,7 +426,7 @@ function ce(r) {
|
|
|
426
426
|
endLon: r[2],
|
|
427
427
|
endLat: r[3]
|
|
428
428
|
};
|
|
429
|
-
const e =
|
|
429
|
+
const e = Ue(r[0]), t = Ue(r[1]);
|
|
430
430
|
if (e && t)
|
|
431
431
|
return {
|
|
432
432
|
startLon: e.lng,
|
|
@@ -437,11 +437,11 @@ function ce(r) {
|
|
|
437
437
|
}
|
|
438
438
|
if (r && typeof r == "object") {
|
|
439
439
|
if (r.area) {
|
|
440
|
-
const e =
|
|
440
|
+
const e = we(r.area);
|
|
441
441
|
if (e) return e;
|
|
442
442
|
}
|
|
443
443
|
if (r._southWest && r._northEast)
|
|
444
|
-
return
|
|
444
|
+
return we([r._southWest, r._northEast]);
|
|
445
445
|
if (["west", "south", "east", "north"].every(
|
|
446
446
|
(e) => Number.isFinite(Number(r[e]))
|
|
447
447
|
))
|
|
@@ -458,8 +458,8 @@ function ce(r) {
|
|
|
458
458
|
}
|
|
459
459
|
return null;
|
|
460
460
|
}
|
|
461
|
-
function
|
|
462
|
-
const e =
|
|
461
|
+
function $e(r) {
|
|
462
|
+
const e = we(r);
|
|
463
463
|
if (!e) return null;
|
|
464
464
|
const t = Number(e.startLon), n = Number(e.startLat), s = Number(e.endLon), i = Number(e.endLat);
|
|
465
465
|
return [t, n, s, i].every(Number.isFinite) ? {
|
|
@@ -469,18 +469,18 @@ function Ge(r) {
|
|
|
469
469
|
endLat: Math.max(n, i)
|
|
470
470
|
} : null;
|
|
471
471
|
}
|
|
472
|
-
function
|
|
472
|
+
function Ce(r, e = {
|
|
473
473
|
startLon: 73,
|
|
474
474
|
startLat: 18,
|
|
475
475
|
endLon: 135,
|
|
476
476
|
endLat: 54
|
|
477
477
|
}) {
|
|
478
|
-
const t =
|
|
478
|
+
const t = $e(e) || {
|
|
479
479
|
startLon: 73,
|
|
480
480
|
startLat: 18,
|
|
481
481
|
endLon: 135,
|
|
482
482
|
endLat: 54
|
|
483
|
-
}, 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);
|
|
484
484
|
return {
|
|
485
485
|
startLon: Math.min(s, o),
|
|
486
486
|
startLat: Math.min(i, a),
|
|
@@ -488,14 +488,14 @@ function he(r, e = {
|
|
|
488
488
|
endLat: Math.max(i, a)
|
|
489
489
|
};
|
|
490
490
|
}
|
|
491
|
-
function
|
|
491
|
+
function ke(r = {}, e = 0, t = void 0) {
|
|
492
492
|
return {
|
|
493
493
|
id: (r == null ? void 0 : r.id) || `image-${e}`,
|
|
494
494
|
name: (r == null ? void 0 : r.name) || `Image ${e + 1}`,
|
|
495
495
|
imageUrl: (r == null ? void 0 : r.imageUrl) || "",
|
|
496
496
|
tifUrl: (r == null ? void 0 : r.tifUrl) || "",
|
|
497
497
|
description: (r == null ? void 0 : r.description) || "",
|
|
498
|
-
area:
|
|
498
|
+
area: Ce(r == null ? void 0 : r.area, t),
|
|
499
499
|
opacity: r == null ? void 0 : r.opacity,
|
|
500
500
|
zIndex: r == null ? void 0 : r.zIndex,
|
|
501
501
|
isSplit: r == null ? void 0 : r.isSplit,
|
|
@@ -522,24 +522,24 @@ function Me(r = {}, e = 0, t = void 0) {
|
|
|
522
522
|
sourceProjection: r == null ? void 0 : r.sourceProjection
|
|
523
523
|
};
|
|
524
524
|
}
|
|
525
|
-
function
|
|
525
|
+
function xt(r) {
|
|
526
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");
|
|
527
527
|
}
|
|
528
|
-
class
|
|
528
|
+
class pn {
|
|
529
529
|
constructor(e = {}) {
|
|
530
530
|
this.options = {
|
|
531
531
|
visible: e.visible ?? !0,
|
|
532
|
-
opacity:
|
|
533
|
-
zIndex:
|
|
534
|
-
defaultArea:
|
|
535
|
-
gridTotal:
|
|
536
|
-
tileSize:
|
|
537
|
-
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),
|
|
538
538
|
imageSourceType: e.imageSourceType || "color",
|
|
539
539
|
colorize: e.colorize || null,
|
|
540
540
|
// 控制器级配置属于当前图层的显式覆盖;不填时才由
|
|
541
541
|
// BaseGIS 默认值或 GeoTIFF GeoKey 决定。
|
|
542
|
-
sourceProjectionCrs:
|
|
542
|
+
sourceProjectionCrs: ze(
|
|
543
543
|
e.sourceProjectionCrs,
|
|
544
544
|
e.sourceProjection
|
|
545
545
|
),
|
|
@@ -552,26 +552,26 @@ class kr {
|
|
|
552
552
|
*/
|
|
553
553
|
mount(e) {
|
|
554
554
|
var t, n;
|
|
555
|
-
return
|
|
555
|
+
return xt(e) ? (this._operationRequestId += 1, this.baseGIS = e, p(
|
|
556
556
|
{ engineType: ((n = (t = this.baseGIS).getEngineType) == null ? void 0 : n.call(t)) || "unknown" },
|
|
557
557
|
"ImageLayerController mounted with BaseGIS."
|
|
558
|
-
)) :
|
|
558
|
+
)) : m(
|
|
559
559
|
"ImageLayerController mount requires BaseGIS instance.",
|
|
560
560
|
"INVALID_MOUNT_TARGET"
|
|
561
561
|
);
|
|
562
562
|
}
|
|
563
563
|
resolveBaseGIS() {
|
|
564
564
|
var e, t;
|
|
565
|
-
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(
|
|
566
566
|
"Map instance is not ready. Please call mapCore.init() first.",
|
|
567
567
|
"NOT_INITIALIZED"
|
|
568
|
-
) :
|
|
568
|
+
) : m("ImageLayerController has not been mounted.", "NOT_MOUNTED");
|
|
569
569
|
}
|
|
570
570
|
getLayerId(e = {}) {
|
|
571
571
|
return typeof e == "string" && e ? e : (e == null ? void 0 : e.layerId) || this.options.layerId;
|
|
572
572
|
}
|
|
573
573
|
buildLayerPayload(e, t = {}) {
|
|
574
|
-
const s =
|
|
574
|
+
const s = ze(
|
|
575
575
|
e.sourceProjectionCrs,
|
|
576
576
|
e.sourceProjection
|
|
577
577
|
) || this.options.sourceProjectionCrs;
|
|
@@ -579,7 +579,7 @@ class kr {
|
|
|
579
579
|
layerId: this.getLayerId(t),
|
|
580
580
|
imageUrl: e.imageUrl,
|
|
581
581
|
tifUrl: e.tifUrl,
|
|
582
|
-
area:
|
|
582
|
+
area: Ce(e.area, this.options.defaultArea),
|
|
583
583
|
isSplit: !!e.isSplit,
|
|
584
584
|
imageSourceType: e.imageSourceType || this.options.imageSourceType,
|
|
585
585
|
isGrayImage: e.isGrayImage,
|
|
@@ -600,11 +600,11 @@ class kr {
|
|
|
600
600
|
enableProbe: e.enableProbe,
|
|
601
601
|
showMouseProbe: e.showMouseProbe,
|
|
602
602
|
showLabel: !!e.showLabel,
|
|
603
|
-
gridTotal:
|
|
604
|
-
tileSize:
|
|
605
|
-
decimalPlaces:
|
|
606
|
-
opacity:
|
|
607
|
-
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),
|
|
608
608
|
visible: typeof t.visible == "boolean" ? t.visible : this.visible
|
|
609
609
|
};
|
|
610
610
|
}
|
|
@@ -614,10 +614,10 @@ class kr {
|
|
|
614
614
|
*/
|
|
615
615
|
async load(e = [], t = {}) {
|
|
616
616
|
if (!Array.isArray(e) || e.length === 0)
|
|
617
|
-
return
|
|
618
|
-
const n = e.map((i, o) =>
|
|
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);
|
|
619
619
|
if (n.length === 0)
|
|
620
|
-
return
|
|
620
|
+
return m("No valid imageUrl or tifUrl found in items.", "INVALID_ITEMS");
|
|
621
621
|
this.items = n, typeof t.visible == "boolean" && (this.visible = t.visible);
|
|
622
622
|
const s = Number.isInteger(t.index) ? t.index : 0;
|
|
623
623
|
return this.switchTo(s);
|
|
@@ -627,20 +627,20 @@ class kr {
|
|
|
627
627
|
* target 可传索引数字,也可传图片 id。
|
|
628
628
|
*/
|
|
629
629
|
async switchTo(e) {
|
|
630
|
-
var
|
|
630
|
+
var u, l;
|
|
631
631
|
const t = this.resolveBaseGIS();
|
|
632
632
|
if (!t.success)
|
|
633
633
|
return t;
|
|
634
634
|
if (!Array.isArray(this.items) || this.items.length === 0)
|
|
635
|
-
return
|
|
635
|
+
return m("Image list has not been loaded.", "NOT_LOADED");
|
|
636
636
|
let n = -1;
|
|
637
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
|
|
638
|
+
return m(`Invalid image target "${e}".`, "INVALID_TARGET");
|
|
639
639
|
const s = this.items[n], i = this.buildLayerPayload(s), o = ++this._operationRequestId, a = await this.baseGIS.upsertImageLayer(i);
|
|
640
|
-
return o !== this._operationRequestId || (
|
|
640
|
+
return o !== this._operationRequestId || (u = a == null ? void 0 : a.data) != null && u.stale ? p(
|
|
641
641
|
{ stale: !0, ignored: !0 },
|
|
642
642
|
`Image switch to "${s.name}" was superseded.`
|
|
643
|
-
) : a.success ? (this.activeIndex = n, this.layerType = ((
|
|
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
644
|
{ activeIndex: n, activeItem: s },
|
|
645
645
|
`Image switched to "${s.name}".`
|
|
646
646
|
)) : a;
|
|
@@ -652,11 +652,11 @@ class kr {
|
|
|
652
652
|
* 与 load(items) 不同,update(payload) 不要求维护图片数组,也不表达 next / prev 两态。
|
|
653
653
|
*/
|
|
654
654
|
async update(e = {}) {
|
|
655
|
-
var
|
|
655
|
+
var l, c;
|
|
656
656
|
const t = this.resolveBaseGIS();
|
|
657
657
|
if (!t.success)
|
|
658
658
|
return t;
|
|
659
|
-
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(
|
|
660
660
|
{
|
|
661
661
|
...n,
|
|
662
662
|
...e
|
|
@@ -665,29 +665,29 @@ class kr {
|
|
|
665
665
|
this.options.defaultArea
|
|
666
666
|
);
|
|
667
667
|
if (!i.imageUrl && !i.tifUrl)
|
|
668
|
-
return
|
|
668
|
+
return m("Image layer update requires imageUrl or tifUrl.", "INVALID_ITEM");
|
|
669
669
|
typeof e.visible == "boolean" && (this.visible = e.visible);
|
|
670
|
-
const o = this.buildLayerPayload(i, e), a = ++this._operationRequestId,
|
|
671
|
-
return a !== this._operationRequestId || (
|
|
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(
|
|
672
672
|
{ stale: !0, ignored: !0 },
|
|
673
673
|
`Image layer update "${i.name}" was superseded.`
|
|
674
|
-
) :
|
|
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(
|
|
675
675
|
{
|
|
676
676
|
activeIndex: this.activeIndex,
|
|
677
677
|
activeItem: i
|
|
678
678
|
},
|
|
679
679
|
`Image layer updated: "${i.name}".`
|
|
680
|
-
)) :
|
|
680
|
+
)) : u;
|
|
681
681
|
}
|
|
682
682
|
async next() {
|
|
683
683
|
if (!this.items.length)
|
|
684
|
-
return
|
|
684
|
+
return m("Image list has not been loaded.", "NOT_LOADED");
|
|
685
685
|
const e = this.activeIndex < 0 ? 0 : (this.activeIndex + 1) % this.items.length;
|
|
686
686
|
return this.switchTo(e);
|
|
687
687
|
}
|
|
688
688
|
async prev() {
|
|
689
689
|
if (!this.items.length)
|
|
690
|
-
return
|
|
690
|
+
return m("Image list has not been loaded.", "NOT_LOADED");
|
|
691
691
|
const e = this.activeIndex < 0 ? this.items.length - 1 : (this.activeIndex - 1 + this.items.length) % this.items.length;
|
|
692
692
|
return this.switchTo(e);
|
|
693
693
|
}
|
|
@@ -715,11 +715,11 @@ class kr {
|
|
|
715
715
|
*/
|
|
716
716
|
destroy(e = {}) {
|
|
717
717
|
if (this._operationRequestId += 1, !this.resolveBaseGIS().success)
|
|
718
|
-
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).");
|
|
719
719
|
const n = this.baseGIS.removeImageLayer({
|
|
720
720
|
layerId: this.getLayerId(e)
|
|
721
721
|
});
|
|
722
|
-
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;
|
|
723
723
|
}
|
|
724
724
|
getState() {
|
|
725
725
|
var e, t;
|
|
@@ -735,79 +735,79 @@ class kr {
|
|
|
735
735
|
};
|
|
736
736
|
}
|
|
737
737
|
}
|
|
738
|
-
const
|
|
738
|
+
const Et = {
|
|
739
739
|
color: "#2f80ff",
|
|
740
740
|
width: 3,
|
|
741
741
|
opacity: 1,
|
|
742
742
|
pattern: "solid",
|
|
743
743
|
dashLength: 12,
|
|
744
744
|
gapLength: 8
|
|
745
|
-
},
|
|
745
|
+
}, At = {
|
|
746
746
|
enabled: !1,
|
|
747
747
|
mode: "reveal",
|
|
748
748
|
durationMs: 1e4,
|
|
749
749
|
autoplay: !0,
|
|
750
750
|
loop: !1
|
|
751
751
|
};
|
|
752
|
-
function
|
|
752
|
+
function oe(r, e) {
|
|
753
753
|
return Object.prototype.hasOwnProperty.call(r || {}, e);
|
|
754
754
|
}
|
|
755
|
-
function
|
|
755
|
+
function R(r) {
|
|
756
756
|
return !!(r && typeof r == "object" && !Array.isArray(r));
|
|
757
757
|
}
|
|
758
|
-
function
|
|
759
|
-
return Array.isArray(r) ? { lines: r } :
|
|
758
|
+
function Z(r = {}) {
|
|
759
|
+
return Array.isArray(r) ? { lines: r } : R(r) ? r : {};
|
|
760
760
|
}
|
|
761
|
-
function
|
|
762
|
-
if (!
|
|
761
|
+
function Rt(r, e) {
|
|
762
|
+
if (!R(e))
|
|
763
763
|
return e;
|
|
764
|
-
const t =
|
|
764
|
+
const t = R(r) ? r : {};
|
|
765
765
|
return {
|
|
766
766
|
...t,
|
|
767
767
|
...e,
|
|
768
|
-
flow:
|
|
769
|
-
...
|
|
768
|
+
flow: R(e.flow) ? {
|
|
769
|
+
...R(t.flow) ? t.flow : {},
|
|
770
770
|
...e.flow
|
|
771
771
|
} : e.flow ?? t.flow
|
|
772
772
|
};
|
|
773
773
|
}
|
|
774
|
-
function
|
|
775
|
-
if (!
|
|
776
|
-
return { ...
|
|
774
|
+
function ct(r = {}, e = {}) {
|
|
775
|
+
if (!R(e))
|
|
776
|
+
return { ...R(r) ? r : {} };
|
|
777
777
|
const t = {
|
|
778
|
-
...
|
|
778
|
+
...R(r) ? r : {},
|
|
779
779
|
...e
|
|
780
780
|
};
|
|
781
|
-
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;
|
|
782
782
|
}
|
|
783
|
-
function
|
|
784
|
-
return
|
|
785
|
-
...
|
|
783
|
+
function ht(r = {}, e = {}) {
|
|
784
|
+
return R(e) ? {
|
|
785
|
+
...R(r) ? r : {},
|
|
786
786
|
...e,
|
|
787
|
-
icon:
|
|
788
|
-
...
|
|
787
|
+
icon: R(e.icon) ? {
|
|
788
|
+
...R(r == null ? void 0 : r.icon) ? r.icon : {},
|
|
789
789
|
...e.icon
|
|
790
790
|
} : e.icon ?? (r == null ? void 0 : r.icon)
|
|
791
|
-
} : { ...
|
|
791
|
+
} : { ...R(r) ? r : {} };
|
|
792
792
|
}
|
|
793
|
-
function
|
|
794
|
-
const t =
|
|
793
|
+
function Ie(r = {}, e = {}) {
|
|
794
|
+
const t = Z(r), n = Z(e), s = {
|
|
795
795
|
...t,
|
|
796
796
|
...n
|
|
797
797
|
};
|
|
798
|
-
return s.style =
|
|
798
|
+
return s.style = ct(t.style, oe(n, "style") ? n.style : {}), s.animation = ht(
|
|
799
799
|
t.animation,
|
|
800
|
-
|
|
800
|
+
oe(n, "animation") ? n.animation : {}
|
|
801
801
|
), s;
|
|
802
802
|
}
|
|
803
|
-
function
|
|
803
|
+
function Dt(r = {}) {
|
|
804
804
|
const { mapCore: e, baseGIS: t, ...n } = r;
|
|
805
805
|
return n;
|
|
806
806
|
}
|
|
807
|
-
function
|
|
807
|
+
function Ft(r, e = "style.color") {
|
|
808
808
|
if (typeof r == "string" && r.trim())
|
|
809
809
|
return "";
|
|
810
|
-
if (!
|
|
810
|
+
if (!R(r) || r.type !== "gradient")
|
|
811
811
|
return `${e} must be a CSS color string or a gradient object.`;
|
|
812
812
|
if (!Array.isArray(r.stops) || r.stops.length < 2)
|
|
813
813
|
return `${e}.stops requires at least two gradient stops.`;
|
|
@@ -820,7 +820,7 @@ function ht(r, e = "style.color") {
|
|
|
820
820
|
return `${e}.stops[${n}].color must be a CSS color string.`;
|
|
821
821
|
t = i;
|
|
822
822
|
}
|
|
823
|
-
if (
|
|
823
|
+
if (R(r.flow) && r.flow.enabled === !0) {
|
|
824
824
|
const n = Number(r.flow.durationMs ?? 2400);
|
|
825
825
|
if (!Number.isFinite(n) || n <= 0)
|
|
826
826
|
return `${e}.flow.durationMs must be greater than 0.`;
|
|
@@ -829,17 +829,17 @@ function ht(r, e = "style.color") {
|
|
|
829
829
|
}
|
|
830
830
|
return "";
|
|
831
831
|
}
|
|
832
|
-
function
|
|
833
|
-
if (!
|
|
832
|
+
function dt(r = {}, e = "style") {
|
|
833
|
+
if (!R(r))
|
|
834
834
|
return `${e} must be an object.`;
|
|
835
835
|
if (r.pattern !== void 0 && !["solid", "dashed"].includes(r.pattern))
|
|
836
836
|
return `${e}.pattern must be "solid" or "dashed".`;
|
|
837
837
|
for (const t of ["width", "dashLength", "gapLength"])
|
|
838
838
|
if (r[t] !== void 0 && (!Number.isFinite(Number(r[t])) || Number(r[t]) <= 0))
|
|
839
839
|
return `${e}.${t} must be greater than 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 ? "" :
|
|
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`);
|
|
841
841
|
}
|
|
842
|
-
function
|
|
842
|
+
function Bt(r) {
|
|
843
843
|
if (!Array.isArray(r) || r.length === 0)
|
|
844
844
|
return "Line layer requires a non-empty lines array.";
|
|
845
845
|
const e = /* @__PURE__ */ new Set();
|
|
@@ -852,18 +852,18 @@ function dt(r) {
|
|
|
852
852
|
if (e.add(String(s)), !Array.isArray(n.positions) || n.positions.length < 2)
|
|
853
853
|
return `lines[${t}].positions requires at least two coordinates.`;
|
|
854
854
|
for (let i = 0; i < n.positions.length; i += 1) {
|
|
855
|
-
const o = n.positions[i], a = Number(o == null ? void 0 : o[0]),
|
|
856
|
-
if (!Array.isArray(o) || !Number.isFinite(a) || !Number.isFinite(
|
|
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))
|
|
857
857
|
return `lines[${t}].positions[${i}] must be [longitude, latitude, height?].`;
|
|
858
858
|
}
|
|
859
859
|
if (n.style !== void 0) {
|
|
860
|
-
const i =
|
|
860
|
+
const i = dt(n.style, `lines[${t}].style`);
|
|
861
861
|
if (i) return i;
|
|
862
862
|
}
|
|
863
863
|
}
|
|
864
864
|
return "";
|
|
865
865
|
}
|
|
866
|
-
function
|
|
866
|
+
function Ot(r = {}, e = []) {
|
|
867
867
|
if (!(r != null && r.enabled))
|
|
868
868
|
return "";
|
|
869
869
|
if (r.mode !== void 0 && r.mode !== "reveal")
|
|
@@ -874,7 +874,7 @@ function ft(r = {}, e = []) {
|
|
|
874
874
|
if (!r.lineId || !e.some((n) => String(n.id) === String(r.lineId)))
|
|
875
875
|
return "animation.lineId must match an existing line id.";
|
|
876
876
|
if (r.icon !== void 0 && r.icon !== null) {
|
|
877
|
-
if (!
|
|
877
|
+
if (!R(r.icon))
|
|
878
878
|
return "animation.icon must be an object.";
|
|
879
879
|
if (r.icon.url !== void 0 && typeof r.icon.url != "string")
|
|
880
880
|
return "animation.icon.url must be a string.";
|
|
@@ -883,7 +883,7 @@ function ft(r = {}, e = []) {
|
|
|
883
883
|
}
|
|
884
884
|
return "";
|
|
885
885
|
}
|
|
886
|
-
function
|
|
886
|
+
function ge(r = {}) {
|
|
887
887
|
var e, t;
|
|
888
888
|
return !((e = r.animation) != null && e.enabled) || r.animation.lineId || ((t = r.lines) == null ? void 0 : t.length) !== 1 ? r : {
|
|
889
889
|
...r,
|
|
@@ -893,28 +893,28 @@ function ie(r = {}) {
|
|
|
893
893
|
}
|
|
894
894
|
};
|
|
895
895
|
}
|
|
896
|
-
function
|
|
897
|
-
const e =
|
|
896
|
+
function We(r = {}) {
|
|
897
|
+
const e = Bt(r.lines);
|
|
898
898
|
if (e) return e;
|
|
899
899
|
for (const n of r.lines) {
|
|
900
|
-
const s =
|
|
900
|
+
const s = Lt(n, r);
|
|
901
901
|
if (s) return s;
|
|
902
902
|
}
|
|
903
|
-
const t =
|
|
904
|
-
return t ||
|
|
903
|
+
const t = dt(r.style);
|
|
904
|
+
return t || Ot(r.animation, r.lines);
|
|
905
905
|
}
|
|
906
|
-
function
|
|
906
|
+
function jt(r) {
|
|
907
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");
|
|
908
908
|
}
|
|
909
|
-
class
|
|
909
|
+
class Sn {
|
|
910
910
|
constructor(e = {}) {
|
|
911
|
-
const t =
|
|
912
|
-
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({
|
|
913
913
|
...t,
|
|
914
914
|
layerId: n,
|
|
915
915
|
visible: this.visible,
|
|
916
|
-
style:
|
|
917
|
-
animation:
|
|
916
|
+
style: ct(Et, t.style || {}),
|
|
917
|
+
animation: ht(At, t.animation || {})
|
|
918
918
|
}), this.currentPayload = null, this.currentState = {
|
|
919
919
|
layerId: n,
|
|
920
920
|
visible: this.visible,
|
|
@@ -929,28 +929,28 @@ class Wr {
|
|
|
929
929
|
}
|
|
930
930
|
mount(e) {
|
|
931
931
|
var t;
|
|
932
|
-
return
|
|
932
|
+
return jt(e) ? (this.baseGIS = e, p(
|
|
933
933
|
{ engineType: ((t = e.getEngineType) == null ? void 0 : t.call(e)) || "unknown" },
|
|
934
934
|
"LineLayerController mounted with BaseGIS."
|
|
935
|
-
)) :
|
|
935
|
+
)) : m(
|
|
936
936
|
"LineLayerController mount requires BaseGIS instance.",
|
|
937
937
|
"INVALID_MOUNT_TARGET"
|
|
938
938
|
);
|
|
939
939
|
}
|
|
940
940
|
resolveBaseGIS() {
|
|
941
941
|
var e, t;
|
|
942
|
-
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(
|
|
943
943
|
"Map instance is not ready. Please call mapCore.init() first.",
|
|
944
944
|
"NOT_INITIALIZED"
|
|
945
|
-
) :
|
|
945
|
+
) : m("LineLayerController has not been mounted.", "NOT_MOUNTED");
|
|
946
946
|
}
|
|
947
947
|
getLayerId(e = {}) {
|
|
948
948
|
var t;
|
|
949
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;
|
|
950
950
|
}
|
|
951
951
|
buildPayload(e = {}) {
|
|
952
|
-
const t =
|
|
953
|
-
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);
|
|
954
954
|
}
|
|
955
955
|
syncStateFromResult(e) {
|
|
956
956
|
var s, i, o, a;
|
|
@@ -967,10 +967,10 @@ class Wr {
|
|
|
967
967
|
const n = this.resolveBaseGIS();
|
|
968
968
|
if (!n.success) return n;
|
|
969
969
|
const s = this.buildPayload(
|
|
970
|
-
|
|
971
|
-
), i =
|
|
970
|
+
Ie(Z(e), Z(t))
|
|
971
|
+
), i = We(s);
|
|
972
972
|
if (i)
|
|
973
|
-
return
|
|
973
|
+
return m(i, "INVALID_LINE_LAYER_PAYLOAD");
|
|
974
974
|
const o = await this.baseGIS.upsertLineLayer(s);
|
|
975
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;
|
|
976
976
|
}
|
|
@@ -979,12 +979,12 @@ class Wr {
|
|
|
979
979
|
const t = this.resolveBaseGIS();
|
|
980
980
|
if (!t.success) return t;
|
|
981
981
|
if (!this.currentPayload)
|
|
982
|
-
return
|
|
983
|
-
const n =
|
|
984
|
-
|
|
985
|
-
), 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);
|
|
986
986
|
if (s)
|
|
987
|
-
return
|
|
987
|
+
return m(s, "INVALID_LINE_LAYER_PAYLOAD");
|
|
988
988
|
const i = await this.baseGIS.updateLineLayer(n);
|
|
989
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;
|
|
990
990
|
}
|
|
@@ -1014,9 +1014,9 @@ class Wr {
|
|
|
1014
1014
|
const t = this.resolveBaseGIS();
|
|
1015
1015
|
if (!t.success) return t;
|
|
1016
1016
|
if (e !== null && !Number.isFinite(e))
|
|
1017
|
-
return
|
|
1017
|
+
return m("currentTime must be a finite timestamp in milliseconds or null.");
|
|
1018
1018
|
if (typeof this.baseGIS.setLineLayerTime != "function")
|
|
1019
|
-
return
|
|
1019
|
+
return m("Current BaseGIS does not support setLineLayerTime.");
|
|
1020
1020
|
const n = this.baseGIS.setLineLayerTime({ layerId: this.getLayerId(), currentTime: e });
|
|
1021
1021
|
return n.success && (this.currentPayload && (this.currentPayload.currentTime = e), this.currentState.currentTime = e), n;
|
|
1022
1022
|
}
|
|
@@ -1083,12 +1083,12 @@ class Wr {
|
|
|
1083
1083
|
}
|
|
1084
1084
|
destroy(e = {}) {
|
|
1085
1085
|
if (!this.resolveBaseGIS().success)
|
|
1086
|
-
return this.resetLocalState(),
|
|
1086
|
+
return this.resetLocalState(), p(null, "Line layer controller destroyed (local state only).");
|
|
1087
1087
|
const n = this.baseGIS.removeLineLayer({
|
|
1088
1088
|
...e,
|
|
1089
1089
|
layerId: this.getLayerId(e)
|
|
1090
1090
|
});
|
|
1091
|
-
return this.resetLocalState(), n.success ?
|
|
1091
|
+
return this.resetLocalState(), n.success ? p(null, "Line layer controller destroyed.") : n;
|
|
1092
1092
|
}
|
|
1093
1093
|
getState() {
|
|
1094
1094
|
var e, t, n, s, i, o;
|
|
@@ -1107,23 +1107,23 @@ class Wr {
|
|
|
1107
1107
|
};
|
|
1108
1108
|
}
|
|
1109
1109
|
}
|
|
1110
|
-
const
|
|
1111
|
-
function
|
|
1110
|
+
const ft = ["all", "leader", "group"], yt = ["auto", "view", "bounds"];
|
|
1111
|
+
function A(r) {
|
|
1112
1112
|
return r == null ? "" : String(r).trim();
|
|
1113
1113
|
}
|
|
1114
|
-
function
|
|
1115
|
-
return
|
|
1114
|
+
function _t(r) {
|
|
1115
|
+
return ft.includes(r) ? r : "all";
|
|
1116
1116
|
}
|
|
1117
|
-
function
|
|
1118
|
-
return
|
|
1117
|
+
function be(r) {
|
|
1118
|
+
return yt.includes(r) ? r : "auto";
|
|
1119
1119
|
}
|
|
1120
|
-
function
|
|
1120
|
+
function Vt(r) {
|
|
1121
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");
|
|
1122
1122
|
}
|
|
1123
|
-
function
|
|
1123
|
+
function He(r) {
|
|
1124
1124
|
return Number.isFinite(Number(r));
|
|
1125
1125
|
}
|
|
1126
|
-
function
|
|
1126
|
+
function Ye(r, e) {
|
|
1127
1127
|
const t = r.filter((s) => {
|
|
1128
1128
|
var i;
|
|
1129
1129
|
return !((i = s.result) != null && i.success);
|
|
@@ -1133,39 +1133,39 @@ function Ae(r, e) {
|
|
|
1133
1133
|
failed: t.length,
|
|
1134
1134
|
results: r
|
|
1135
1135
|
};
|
|
1136
|
-
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);
|
|
1137
1137
|
}
|
|
1138
|
-
class
|
|
1138
|
+
class vn {
|
|
1139
1139
|
constructor(e = {}) {
|
|
1140
|
-
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);
|
|
1141
1141
|
const t = Number(e.syncInterval);
|
|
1142
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;
|
|
1143
1143
|
}
|
|
1144
1144
|
registerMap(e, t, n = {}) {
|
|
1145
|
-
var
|
|
1145
|
+
var u, l;
|
|
1146
1146
|
if (this.destroyed)
|
|
1147
|
-
return
|
|
1148
|
-
const s =
|
|
1147
|
+
return m("MapViewLinkController has been destroyed.", "CONTROLLER_DESTROYED");
|
|
1148
|
+
const s = A(e);
|
|
1149
1149
|
if (!s)
|
|
1150
|
-
return
|
|
1151
|
-
if (!
|
|
1152
|
-
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");
|
|
1153
1153
|
if (!t.getMapInstance())
|
|
1154
|
-
return
|
|
1154
|
+
return m(
|
|
1155
1155
|
`Map "${s}" is not initialized. Please call mapCore.init() first.`,
|
|
1156
1156
|
"MAP_NOT_INITIALIZED"
|
|
1157
1157
|
);
|
|
1158
1158
|
const i = this.entries.get(s);
|
|
1159
1159
|
if (i && i.mapCore !== t && n.replace !== !0)
|
|
1160
|
-
return
|
|
1160
|
+
return m(
|
|
1161
1161
|
`Map id "${s}" is already registered. Pass replace:true to replace it.`,
|
|
1162
1162
|
"MAP_ALREADY_REGISTERED"
|
|
1163
1163
|
);
|
|
1164
|
-
i && ((
|
|
1164
|
+
i && ((u = i.offViewChange) == null || u.call(i), this.entries.delete(s));
|
|
1165
1165
|
const o = {
|
|
1166
1166
|
id: s,
|
|
1167
1167
|
mapCore: t,
|
|
1168
|
-
group:
|
|
1168
|
+
group: A(n.group) || "default",
|
|
1169
1169
|
enabled: n.enabled !== !1,
|
|
1170
1170
|
offViewChange: null
|
|
1171
1171
|
}, a = t.onViewChange({
|
|
@@ -1177,34 +1177,34 @@ class Yr {
|
|
|
1177
1177
|
onChange: () => this.handleViewChange(s),
|
|
1178
1178
|
onEnd: () => this.handleViewEnd(s)
|
|
1179
1179
|
});
|
|
1180
|
-
return a != null && a.success ? (o.offViewChange = (
|
|
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(
|
|
1181
1181
|
{ id: s, mapCore: t, state: this.getState() },
|
|
1182
1182
|
`Map "${s}" registered for view linking.`
|
|
1183
|
-
)) : a ||
|
|
1183
|
+
)) : a || m(`Failed to listen to map "${s}".`, "LISTENER_FAILED");
|
|
1184
1184
|
}
|
|
1185
1185
|
unregisterMap(e) {
|
|
1186
1186
|
var i;
|
|
1187
|
-
const t =
|
|
1187
|
+
const t = A(e), n = this.entries.get(t);
|
|
1188
1188
|
if (!n)
|
|
1189
|
-
return
|
|
1189
|
+
return m(`Map "${t}" is not registered.`, "MAP_NOT_REGISTERED");
|
|
1190
1190
|
(i = n.offViewChange) == null || i.call(n), this.entries.delete(t), this.suppressedUntil.delete(t);
|
|
1191
1191
|
const s = this.entries.keys().next().value || "";
|
|
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"),
|
|
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(
|
|
1193
1193
|
{ id: t, mapCore: n.mapCore, state: this.getState() },
|
|
1194
1194
|
`Map "${t}" unregistered. The BaseGIS instance was not destroyed.`
|
|
1195
1195
|
);
|
|
1196
1196
|
}
|
|
1197
1197
|
refreshMap(e) {
|
|
1198
|
-
const t =
|
|
1198
|
+
const t = A(e), n = this.entries.get(t);
|
|
1199
1199
|
return n ? this.registerMap(t, n.mapCore, {
|
|
1200
1200
|
group: n.group,
|
|
1201
1201
|
enabled: n.enabled,
|
|
1202
1202
|
replace: !0
|
|
1203
|
-
}) :
|
|
1203
|
+
}) : m(`Map "${t}" is not registered.`, "MAP_NOT_REGISTERED");
|
|
1204
1204
|
}
|
|
1205
1205
|
getMap(e) {
|
|
1206
1206
|
var t;
|
|
1207
|
-
return ((t = this.entries.get(
|
|
1207
|
+
return ((t = this.entries.get(A(e))) == null ? void 0 : t.mapCore) || null;
|
|
1208
1208
|
}
|
|
1209
1209
|
getNativeMap(e) {
|
|
1210
1210
|
var t, n;
|
|
@@ -1219,7 +1219,7 @@ class Yr {
|
|
|
1219
1219
|
return Array.from(this.entries.keys());
|
|
1220
1220
|
}
|
|
1221
1221
|
hasMap(e) {
|
|
1222
|
-
return this.entries.has(
|
|
1222
|
+
return this.entries.has(A(e));
|
|
1223
1223
|
}
|
|
1224
1224
|
forEachMap(e) {
|
|
1225
1225
|
typeof e == "function" && this.entries.forEach((t, n) => e(t.mapCore, n, t));
|
|
@@ -1231,17 +1231,17 @@ class Yr {
|
|
|
1231
1231
|
return this.getMap(this.activeMapId);
|
|
1232
1232
|
}
|
|
1233
1233
|
setLeader(e) {
|
|
1234
|
-
const t =
|
|
1235
|
-
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");
|
|
1236
1236
|
}
|
|
1237
1237
|
setMode(e) {
|
|
1238
|
-
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");
|
|
1239
1239
|
}
|
|
1240
1240
|
setStrategy(e) {
|
|
1241
|
-
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");
|
|
1242
1242
|
}
|
|
1243
1243
|
setEnabled(e) {
|
|
1244
|
-
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"}.`);
|
|
1245
1245
|
}
|
|
1246
1246
|
pause() {
|
|
1247
1247
|
return this.setEnabled(!1);
|
|
@@ -1250,15 +1250,15 @@ class Yr {
|
|
|
1250
1250
|
return this.setEnabled(!0);
|
|
1251
1251
|
}
|
|
1252
1252
|
setRealtime(e) {
|
|
1253
|
-
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.");
|
|
1254
1254
|
}
|
|
1255
1255
|
setMapGroup(e, t) {
|
|
1256
|
-
const n = this.entries.get(
|
|
1257
|
-
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");
|
|
1258
1258
|
}
|
|
1259
1259
|
setMapEnabled(e, t) {
|
|
1260
|
-
const n = this.entries.get(
|
|
1261
|
-
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");
|
|
1262
1262
|
}
|
|
1263
1263
|
handleViewStart(e) {
|
|
1264
1264
|
this.canUseAsSource(e) && (this.clearSourceReleaseTimer(), this.interactionSourceId = e, this.activeMapId = e);
|
|
@@ -1274,7 +1274,7 @@ class Yr {
|
|
|
1274
1274
|
}
|
|
1275
1275
|
releaseInteractionSource(e, t = 0) {
|
|
1276
1276
|
this.clearSourceReleaseTimer();
|
|
1277
|
-
const n =
|
|
1277
|
+
const n = A(e), s = () => {
|
|
1278
1278
|
this.sourceReleaseTimer = null, (!n || this.interactionSourceId === n) && (this.interactionSourceId = "");
|
|
1279
1279
|
};
|
|
1280
1280
|
t > 0 ? this.sourceReleaseTimer = globalThis.setTimeout(s, t) : s();
|
|
@@ -1311,31 +1311,31 @@ class Yr {
|
|
|
1311
1311
|
return Array.from(this.entries.values()).filter((t) => !(t.id === e.id || !t.enabled || this.mode === "group" && t.group !== e.group));
|
|
1312
1312
|
}
|
|
1313
1313
|
syncFrom(e, t = {}) {
|
|
1314
|
-
var h,
|
|
1315
|
-
const n =
|
|
1314
|
+
var h, d;
|
|
1315
|
+
const n = A(e), s = this.entries.get(n);
|
|
1316
1316
|
if (!s)
|
|
1317
|
-
return
|
|
1317
|
+
return m(`Map "${n}" is not registered.`, "MAP_NOT_REGISTERED");
|
|
1318
1318
|
if (!t.force && !this.canUseAsSource(n))
|
|
1319
|
-
return
|
|
1320
|
-
const i = this.resolveTargets(s), o =
|
|
1321
|
-
var
|
|
1322
|
-
return (((
|
|
1323
|
-
}),
|
|
1324
|
-
if (!(
|
|
1325
|
-
return
|
|
1326
|
-
const c = i.map((
|
|
1327
|
-
id:
|
|
1328
|
-
result: this.applyViewState(
|
|
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;
|
|
1323
|
+
}), l = s.mapCore.getViewState({ includeBounds: u });
|
|
1324
|
+
if (!(l != null && l.success) || !l.data)
|
|
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)
|
|
1329
1329
|
}));
|
|
1330
|
-
return this.lastSourceId = n, this.lastSyncedAt = Date.now(),
|
|
1330
|
+
return this.lastSourceId = n, this.lastSyncedAt = Date.now(), Ye(c, `View synchronized from map "${n}".`);
|
|
1331
1331
|
}
|
|
1332
1332
|
applyViewState(e, t, n = {}) {
|
|
1333
|
-
var
|
|
1334
|
-
const s =
|
|
1335
|
-
return this.suppressedUntil.set(e.id, Date.now() + this.suppressionMs), s !== "bounds" && Array.isArray(t.center) && (a ||
|
|
1336
|
-
center:
|
|
1333
|
+
var l, c;
|
|
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({
|
|
1336
|
+
center: u && Array.isArray(t.cameraPosition) ? t.cameraPosition : t.center,
|
|
1337
1337
|
...a ? { zoom: Number(t.zoom) } : {},
|
|
1338
|
-
...
|
|
1338
|
+
...u ? {
|
|
1339
1339
|
height: Number(t.height),
|
|
1340
1340
|
heading: t.heading,
|
|
1341
1341
|
pitch: t.pitch,
|
|
@@ -1346,21 +1346,21 @@ class Yr {
|
|
|
1346
1346
|
animate: n.animate === !0,
|
|
1347
1347
|
duration: n.duration,
|
|
1348
1348
|
padding: n.padding || 0
|
|
1349
|
-
}) : 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");
|
|
1350
1350
|
}
|
|
1351
1351
|
resolveControlMap(e) {
|
|
1352
|
-
const t =
|
|
1352
|
+
const t = A(e || this.activeMapId || this.leaderId), n = this.getMap(t);
|
|
1353
1353
|
return n ? { mapId: t, mapCore: n } : null;
|
|
1354
1354
|
}
|
|
1355
1355
|
zoomIn(e = {}) {
|
|
1356
1356
|
const t = this.resolveControlMap(e.mapId);
|
|
1357
|
-
if (!t) return
|
|
1357
|
+
if (!t) return m("No map is available for zoom in.", "MAP_NOT_REGISTERED");
|
|
1358
1358
|
const { mapId: n, ...s } = e, i = t.mapCore.zoomIn(s);
|
|
1359
1359
|
return i != null && i.success && this.scheduleSync(t.mapId), i;
|
|
1360
1360
|
}
|
|
1361
1361
|
zoomOut(e = {}) {
|
|
1362
1362
|
const t = this.resolveControlMap(e.mapId);
|
|
1363
|
-
if (!t) return
|
|
1363
|
+
if (!t) return m("No map is available for zoom out.", "MAP_NOT_REGISTERED");
|
|
1364
1364
|
const { mapId: n, ...s } = e, i = t.mapCore.zoomOut(s);
|
|
1365
1365
|
return i != null && i.success && this.scheduleSync(t.mapId), i;
|
|
1366
1366
|
}
|
|
@@ -1393,7 +1393,7 @@ class Yr {
|
|
|
1393
1393
|
id: s.id,
|
|
1394
1394
|
result: e(s)
|
|
1395
1395
|
}));
|
|
1396
|
-
return
|
|
1396
|
+
return Ye(n, t);
|
|
1397
1397
|
}
|
|
1398
1398
|
getState() {
|
|
1399
1399
|
return {
|
|
@@ -1430,25 +1430,25 @@ class Yr {
|
|
|
1430
1430
|
return this.cancelPendingSync(), this.releaseInteractionSource("", 0), this.entries.forEach((e) => {
|
|
1431
1431
|
var t;
|
|
1432
1432
|
return (t = e.offViewChange) == null ? void 0 : t.call(e);
|
|
1433
|
-
}), 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.");
|
|
1434
1434
|
}
|
|
1435
1435
|
destroy() {
|
|
1436
|
-
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."));
|
|
1437
1437
|
}
|
|
1438
1438
|
}
|
|
1439
|
-
function
|
|
1439
|
+
function zt(r = {}) {
|
|
1440
1440
|
const { mapCore: e, baseGIS: t, ...n } = r || {};
|
|
1441
1441
|
return n;
|
|
1442
1442
|
}
|
|
1443
|
-
function
|
|
1443
|
+
function Ut(r, e) {
|
|
1444
1444
|
return Object.prototype.hasOwnProperty.call(r || {}, e);
|
|
1445
1445
|
}
|
|
1446
|
-
function
|
|
1446
|
+
function $t(r) {
|
|
1447
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");
|
|
1448
1448
|
}
|
|
1449
|
-
class
|
|
1449
|
+
class Pn {
|
|
1450
1450
|
constructor(e = {}) {
|
|
1451
|
-
const t =
|
|
1451
|
+
const t = zt(e), n = t.typhoonPathLayerId || t.layerId || t.id || "typhoon-path-default";
|
|
1452
1452
|
this.baseGIS = null, this.visible = t.visible !== !1, this.layerType = "unknown", this.defaultPayload = {
|
|
1453
1453
|
...t,
|
|
1454
1454
|
layerId: n,
|
|
@@ -1469,28 +1469,28 @@ class Hr {
|
|
|
1469
1469
|
}
|
|
1470
1470
|
mount(e) {
|
|
1471
1471
|
var t;
|
|
1472
|
-
return
|
|
1472
|
+
return $t(e) ? (this.baseGIS = e, p(
|
|
1473
1473
|
{ engineType: ((t = e.getEngineType) == null ? void 0 : t.call(e)) || "unknown" },
|
|
1474
1474
|
"TyphoonPathController mounted with BaseGIS."
|
|
1475
|
-
)) :
|
|
1475
|
+
)) : m(
|
|
1476
1476
|
"TyphoonPathController mount requires BaseGIS instance.",
|
|
1477
1477
|
"INVALID_MOUNT_TARGET"
|
|
1478
1478
|
);
|
|
1479
1479
|
}
|
|
1480
1480
|
resolveBaseGIS() {
|
|
1481
1481
|
var e, t;
|
|
1482
|
-
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(
|
|
1483
1483
|
"Map instance is not ready. Please call mapCore.init() first.",
|
|
1484
1484
|
"NOT_INITIALIZED"
|
|
1485
|
-
) :
|
|
1485
|
+
) : m("TyphoonPathController has not been mounted.", "NOT_MOUNTED");
|
|
1486
1486
|
}
|
|
1487
1487
|
getLayerId(e = {}) {
|
|
1488
1488
|
var t;
|
|
1489
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);
|
|
1490
1490
|
}
|
|
1491
1491
|
buildPayload(e = {}, t = {}) {
|
|
1492
|
-
const n =
|
|
1493
|
-
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);
|
|
1494
1494
|
}
|
|
1495
1495
|
syncStateFromResult(e) {
|
|
1496
1496
|
var s, i, o, a;
|
|
@@ -1509,7 +1509,7 @@ class Hr {
|
|
|
1509
1509
|
try {
|
|
1510
1510
|
s = this.buildPayload(e, t);
|
|
1511
1511
|
} catch (o) {
|
|
1512
|
-
return
|
|
1512
|
+
return m((o == null ? void 0 : o.message) || "Invalid typhoon path payload.", "INVALID_TYPHOON_PATH_PAYLOAD");
|
|
1513
1513
|
}
|
|
1514
1514
|
const i = await this.baseGIS.upsertTyphoonPathLayer(s);
|
|
1515
1515
|
return i.success && (this.currentPayload = s, this.visible = s.visible !== !1, this.syncStateFromResult(i)), i;
|
|
@@ -1518,14 +1518,14 @@ class Hr {
|
|
|
1518
1518
|
const t = this.resolveBaseGIS();
|
|
1519
1519
|
if (!t.success) return t;
|
|
1520
1520
|
if (!this.currentPayload)
|
|
1521
|
-
return
|
|
1521
|
+
return m("Typhoon path has not been loaded.", "NOT_LOADED");
|
|
1522
1522
|
let n;
|
|
1523
1523
|
try {
|
|
1524
|
-
n =
|
|
1525
|
-
|
|
1524
|
+
n = Fe(
|
|
1525
|
+
ye(this.currentPayload, e)
|
|
1526
1526
|
);
|
|
1527
1527
|
} catch (i) {
|
|
1528
|
-
return
|
|
1528
|
+
return m((i == null ? void 0 : i.message) || "Invalid typhoon path payload.", "INVALID_TYPHOON_PATH_PAYLOAD");
|
|
1529
1529
|
}
|
|
1530
1530
|
const s = await this.baseGIS.updateTyphoonPathLayer(n);
|
|
1531
1531
|
return s.success && (this.currentPayload = n, this.visible = n.visible !== !1, this.syncStateFromResult(s)), s;
|
|
@@ -1591,10 +1591,10 @@ class Hr {
|
|
|
1591
1591
|
layerId: this.getLayerId(n)
|
|
1592
1592
|
});
|
|
1593
1593
|
if (s.success && this.currentPayload) {
|
|
1594
|
-
const
|
|
1595
|
-
Number.isInteger(
|
|
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);
|
|
1595
|
+
Number.isInteger(u) && (this.currentPayload = {
|
|
1596
1596
|
...this.currentPayload,
|
|
1597
|
-
playback: { ...this.currentPayload.playback, currentIndex:
|
|
1597
|
+
playback: { ...this.currentPayload.playback, currentIndex: u }
|
|
1598
1598
|
}), this.syncStateFromResult(s);
|
|
1599
1599
|
}
|
|
1600
1600
|
return s;
|
|
@@ -1629,12 +1629,12 @@ class Hr {
|
|
|
1629
1629
|
}
|
|
1630
1630
|
destroy(e = {}) {
|
|
1631
1631
|
if (!this.resolveBaseGIS().success)
|
|
1632
|
-
return this.resetLocalState(),
|
|
1632
|
+
return this.resetLocalState(), p(null, "Typhoon path controller destroyed (local state only).");
|
|
1633
1633
|
const n = this.baseGIS.removeTyphoonPathLayer({
|
|
1634
1634
|
...e,
|
|
1635
1635
|
layerId: this.getLayerId(e)
|
|
1636
1636
|
});
|
|
1637
|
-
return this.resetLocalState(), n.success ?
|
|
1637
|
+
return this.resetLocalState(), n.success ? p(null, "Typhoon path controller destroyed.") : n;
|
|
1638
1638
|
}
|
|
1639
1639
|
getState() {
|
|
1640
1640
|
var e, t, n, s, i, o;
|
|
@@ -1653,25 +1653,25 @@ class Hr {
|
|
|
1653
1653
|
};
|
|
1654
1654
|
}
|
|
1655
1655
|
}
|
|
1656
|
-
function
|
|
1656
|
+
function re(r = {}) {
|
|
1657
1657
|
return Array.isArray(r) || Array.isArray(r == null ? void 0 : r.features) ? { points: r } : r || {};
|
|
1658
1658
|
}
|
|
1659
|
-
function
|
|
1660
|
-
const e =
|
|
1659
|
+
function qe(r = {}) {
|
|
1660
|
+
const e = re(r);
|
|
1661
1661
|
return ["points", "data", "items"].some(
|
|
1662
1662
|
(t) => Object.prototype.hasOwnProperty.call(e, t)
|
|
1663
1663
|
);
|
|
1664
1664
|
}
|
|
1665
|
-
function
|
|
1665
|
+
function kt(r) {
|
|
1666
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");
|
|
1667
1667
|
}
|
|
1668
|
-
function
|
|
1668
|
+
function Wt(r = {}) {
|
|
1669
1669
|
const e = { ...r };
|
|
1670
1670
|
return delete e.mapCore, delete e.baseGIS, e;
|
|
1671
1671
|
}
|
|
1672
|
-
class
|
|
1672
|
+
class Ln {
|
|
1673
1673
|
constructor(e = {}) {
|
|
1674
|
-
const t =
|
|
1674
|
+
const t = Wt(e), n = t.pointClusterLayerId || t.clusterLayerId || t.layerId || t.id || "point-cluster-default";
|
|
1675
1675
|
this.options = {
|
|
1676
1676
|
layerId: n,
|
|
1677
1677
|
visible: t.visible ?? !0,
|
|
@@ -1697,27 +1697,27 @@ class qr {
|
|
|
1697
1697
|
}
|
|
1698
1698
|
mount(e) {
|
|
1699
1699
|
var t, n;
|
|
1700
|
-
return
|
|
1700
|
+
return kt(e) ? (this.baseGIS = e, p(
|
|
1701
1701
|
{ engineType: ((n = (t = this.baseGIS).getEngineType) == null ? void 0 : n.call(t)) || "unknown" },
|
|
1702
1702
|
"PointClusterController mounted with BaseGIS."
|
|
1703
|
-
)) :
|
|
1703
|
+
)) : m(
|
|
1704
1704
|
"PointClusterController mount requires BaseGIS instance.",
|
|
1705
1705
|
"INVALID_MOUNT_TARGET"
|
|
1706
1706
|
);
|
|
1707
1707
|
}
|
|
1708
1708
|
resolveBaseGIS() {
|
|
1709
1709
|
var e, t;
|
|
1710
|
-
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(
|
|
1711
1711
|
"Map instance is not ready. Please call mapCore.init() first.",
|
|
1712
1712
|
"NOT_INITIALIZED"
|
|
1713
|
-
) :
|
|
1713
|
+
) : m("PointClusterController has not been mounted.", "NOT_MOUNTED");
|
|
1714
1714
|
}
|
|
1715
1715
|
getLayerId(e = {}) {
|
|
1716
1716
|
var t;
|
|
1717
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;
|
|
1718
1718
|
}
|
|
1719
1719
|
buildPayload(e = {}) {
|
|
1720
|
-
const t =
|
|
1720
|
+
const t = re(e);
|
|
1721
1721
|
return {
|
|
1722
1722
|
...this.defaultPayload,
|
|
1723
1723
|
...t,
|
|
@@ -1739,11 +1739,11 @@ class qr {
|
|
|
1739
1739
|
if (!n.success)
|
|
1740
1740
|
return n;
|
|
1741
1741
|
const s = this.buildPayload({
|
|
1742
|
-
...
|
|
1743
|
-
...
|
|
1742
|
+
...re(e),
|
|
1743
|
+
...re(t)
|
|
1744
1744
|
});
|
|
1745
|
-
if (!
|
|
1746
|
-
return
|
|
1745
|
+
if (!qe(s))
|
|
1746
|
+
return m(
|
|
1747
1747
|
"Point cluster layer requires points, data or items.",
|
|
1748
1748
|
"INVALID_POINT_SOURCE"
|
|
1749
1749
|
);
|
|
@@ -1756,9 +1756,9 @@ class qr {
|
|
|
1756
1756
|
update(e = {}) {
|
|
1757
1757
|
const t = {
|
|
1758
1758
|
...this.currentPayload || this.defaultPayload,
|
|
1759
|
-
...
|
|
1759
|
+
...re(e)
|
|
1760
1760
|
};
|
|
1761
|
-
return !this.currentPayload && !
|
|
1761
|
+
return !this.currentPayload && !qe(t) ? m("Point cluster layer has not been loaded.", "NOT_LOADED") : this.load(t);
|
|
1762
1762
|
}
|
|
1763
1763
|
setConfig(e = {}) {
|
|
1764
1764
|
return this.update(e);
|
|
@@ -1813,12 +1813,12 @@ class qr {
|
|
|
1813
1813
|
}
|
|
1814
1814
|
destroy(e = {}) {
|
|
1815
1815
|
if (!this.resolveBaseGIS().success)
|
|
1816
|
-
return this.resetLocalState(),
|
|
1816
|
+
return this.resetLocalState(), p(null, "Point cluster layer controller destroyed (local state only).");
|
|
1817
1817
|
const n = this.baseGIS.removePointClusterLayer({
|
|
1818
1818
|
...e,
|
|
1819
1819
|
layerId: this.getLayerId(e)
|
|
1820
1820
|
});
|
|
1821
|
-
return this.resetLocalState(), n.success ?
|
|
1821
|
+
return this.resetLocalState(), n.success ? p(null, "Point cluster layer controller destroyed.") : n;
|
|
1822
1822
|
}
|
|
1823
1823
|
resetLocalState() {
|
|
1824
1824
|
this.currentPayload = null, this.layerType = "unknown", this.currentState = {
|
|
@@ -1839,10 +1839,10 @@ class qr {
|
|
|
1839
1839
|
getState() {
|
|
1840
1840
|
var e, t, n, s, i, o, a;
|
|
1841
1841
|
if ((t = (e = this.baseGIS) == null ? void 0 : e.getMapInstance) != null && t.call(e) && this.currentPayload) {
|
|
1842
|
-
const
|
|
1842
|
+
const u = (s = (n = this.baseGIS).getPointClusterLayerState) == null ? void 0 : s.call(n, {
|
|
1843
1843
|
layerId: this.currentPayload.layerId || this.options.layerId
|
|
1844
1844
|
});
|
|
1845
|
-
|
|
1845
|
+
u != null && u.success && this.syncStateFromResult(u);
|
|
1846
1846
|
}
|
|
1847
1847
|
return {
|
|
1848
1848
|
mounted: !!this.baseGIS,
|
|
@@ -1855,25 +1855,25 @@ class qr {
|
|
|
1855
1855
|
};
|
|
1856
1856
|
}
|
|
1857
1857
|
}
|
|
1858
|
-
function
|
|
1858
|
+
function ne(r = {}) {
|
|
1859
1859
|
return Array.isArray(r) || Array.isArray(r == null ? void 0 : r.features) ? { points: r } : r || {};
|
|
1860
1860
|
}
|
|
1861
|
-
function
|
|
1862
|
-
const e =
|
|
1861
|
+
function Xe(r = {}) {
|
|
1862
|
+
const e = ne(r);
|
|
1863
1863
|
return ["points", "data", "items"].some(
|
|
1864
1864
|
(t) => Object.prototype.hasOwnProperty.call(e, t)
|
|
1865
1865
|
);
|
|
1866
1866
|
}
|
|
1867
|
-
function
|
|
1867
|
+
function Ht(r) {
|
|
1868
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");
|
|
1869
1869
|
}
|
|
1870
|
-
function
|
|
1870
|
+
function Yt(r = {}) {
|
|
1871
1871
|
const e = { ...r };
|
|
1872
1872
|
return delete e.mapCore, delete e.baseGIS, e;
|
|
1873
1873
|
}
|
|
1874
|
-
class
|
|
1874
|
+
class wn {
|
|
1875
1875
|
constructor(e = {}) {
|
|
1876
|
-
const t =
|
|
1876
|
+
const t = Yt(e), n = t.pointDensityLayerId || t.densityLayerId || t.layerId || t.id || "point-density-default";
|
|
1877
1877
|
this.options = {
|
|
1878
1878
|
layerId: n,
|
|
1879
1879
|
visible: t.visible ?? !0,
|
|
@@ -1895,27 +1895,27 @@ class Xr {
|
|
|
1895
1895
|
}
|
|
1896
1896
|
mount(e) {
|
|
1897
1897
|
var t, n;
|
|
1898
|
-
return
|
|
1898
|
+
return Ht(e) ? (this.baseGIS = e, p(
|
|
1899
1899
|
{ engineType: ((n = (t = this.baseGIS).getEngineType) == null ? void 0 : n.call(t)) || "unknown" },
|
|
1900
1900
|
"PointDensityController mounted with BaseGIS."
|
|
1901
|
-
)) :
|
|
1901
|
+
)) : m(
|
|
1902
1902
|
"PointDensityController mount requires BaseGIS instance.",
|
|
1903
1903
|
"INVALID_MOUNT_TARGET"
|
|
1904
1904
|
);
|
|
1905
1905
|
}
|
|
1906
1906
|
resolveBaseGIS() {
|
|
1907
1907
|
var e, t;
|
|
1908
|
-
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(
|
|
1909
1909
|
"Map instance is not ready. Please call mapCore.init() first.",
|
|
1910
1910
|
"NOT_INITIALIZED"
|
|
1911
|
-
) :
|
|
1911
|
+
) : m("PointDensityController has not been mounted.", "NOT_MOUNTED");
|
|
1912
1912
|
}
|
|
1913
1913
|
getLayerId(e = {}) {
|
|
1914
1914
|
var t;
|
|
1915
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;
|
|
1916
1916
|
}
|
|
1917
1917
|
buildPayload(e = {}) {
|
|
1918
|
-
const t =
|
|
1918
|
+
const t = ne(e), n = this.getLayerId(t);
|
|
1919
1919
|
return {
|
|
1920
1920
|
...this.defaultPayload,
|
|
1921
1921
|
...t,
|
|
@@ -1932,21 +1932,21 @@ class Xr {
|
|
|
1932
1932
|
}, typeof t.visible == "boolean" && (this.visible = t.visible));
|
|
1933
1933
|
}
|
|
1934
1934
|
async load(e = {}, t = {}) {
|
|
1935
|
-
var
|
|
1935
|
+
var u;
|
|
1936
1936
|
const n = this.resolveBaseGIS();
|
|
1937
1937
|
if (!n.success)
|
|
1938
1938
|
return n;
|
|
1939
|
-
const s =
|
|
1939
|
+
const s = ne(e), i = ne(t), o = this.buildPayload({
|
|
1940
1940
|
...s,
|
|
1941
1941
|
...i
|
|
1942
1942
|
});
|
|
1943
|
-
if (!
|
|
1944
|
-
return
|
|
1943
|
+
if (!Xe(o))
|
|
1944
|
+
return m(
|
|
1945
1945
|
"Point density layer requires points, data or items.",
|
|
1946
1946
|
"INVALID_POINT_SOURCE"
|
|
1947
1947
|
);
|
|
1948
1948
|
const a = await this.baseGIS.upsertPointDensityLayer(o);
|
|
1949
|
-
return a.success && (this.currentPayload = o, this.visible = o.visible !== !1, this.layerType = ((
|
|
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;
|
|
1950
1950
|
}
|
|
1951
1951
|
upsert(e = {}, t = {}) {
|
|
1952
1952
|
return this.load(e, t);
|
|
@@ -1954,9 +1954,9 @@ class Xr {
|
|
|
1954
1954
|
async update(e = {}) {
|
|
1955
1955
|
const t = {
|
|
1956
1956
|
...this.currentPayload || this.defaultPayload,
|
|
1957
|
-
...
|
|
1957
|
+
...ne(e)
|
|
1958
1958
|
};
|
|
1959
|
-
return !this.currentPayload && !
|
|
1959
|
+
return !this.currentPayload && !Xe(t) ? m("Point density layer has not been loaded.", "NOT_LOADED") : this.load(t);
|
|
1960
1960
|
}
|
|
1961
1961
|
setConfig(e = {}) {
|
|
1962
1962
|
return this.update(e);
|
|
@@ -2018,7 +2018,7 @@ class Xr {
|
|
|
2018
2018
|
hiddenCount: 0,
|
|
2019
2019
|
gridCount: 0,
|
|
2020
2020
|
destroyed: !0
|
|
2021
|
-
},
|
|
2021
|
+
}, p(null, "Point density layer controller destroyed (local state only).");
|
|
2022
2022
|
const n = this.baseGIS.removePointDensityLayer({
|
|
2023
2023
|
...e,
|
|
2024
2024
|
layerId: this.getLayerId(e)
|
|
@@ -2030,7 +2030,7 @@ class Xr {
|
|
|
2030
2030
|
hiddenCount: 0,
|
|
2031
2031
|
gridCount: 0,
|
|
2032
2032
|
destroyed: !0
|
|
2033
|
-
}, n.success ?
|
|
2033
|
+
}, n.success ? p(null, "Point density layer controller destroyed.") : n;
|
|
2034
2034
|
}
|
|
2035
2035
|
removeLayer(e = {}) {
|
|
2036
2036
|
return this.destroy(e);
|
|
@@ -2038,10 +2038,10 @@ class Xr {
|
|
|
2038
2038
|
getState() {
|
|
2039
2039
|
var e, t, n, s, i, o, a;
|
|
2040
2040
|
if ((t = (e = this.baseGIS) == null ? void 0 : e.getMapInstance) != null && t.call(e) && this.currentPayload) {
|
|
2041
|
-
const
|
|
2041
|
+
const u = (s = (n = this.baseGIS).getPointDensityLayerState) == null ? void 0 : s.call(n, {
|
|
2042
2042
|
layerId: this.currentPayload.layerId || this.options.layerId
|
|
2043
2043
|
});
|
|
2044
|
-
|
|
2044
|
+
u != null && u.success && this.syncStateFromResult(u);
|
|
2045
2045
|
}
|
|
2046
2046
|
return {
|
|
2047
2047
|
mounted: !!this.baseGIS,
|
|
@@ -2054,32 +2054,32 @@ class Xr {
|
|
|
2054
2054
|
};
|
|
2055
2055
|
}
|
|
2056
2056
|
}
|
|
2057
|
-
function
|
|
2057
|
+
function se(r = {}) {
|
|
2058
2058
|
return Array.isArray(r) || Array.isArray(r == null ? void 0 : r.features) ? { points: r } : r || {};
|
|
2059
2059
|
}
|
|
2060
|
-
function
|
|
2061
|
-
const e =
|
|
2060
|
+
function Ke(r = {}) {
|
|
2061
|
+
const e = se(r);
|
|
2062
2062
|
return ["points", "data", "items"].some(
|
|
2063
2063
|
(t) => Object.prototype.hasOwnProperty.call(e, t)
|
|
2064
2064
|
);
|
|
2065
2065
|
}
|
|
2066
|
-
function
|
|
2066
|
+
function qt(r) {
|
|
2067
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");
|
|
2068
2068
|
}
|
|
2069
|
-
function
|
|
2069
|
+
function Ze(r, e = {}) {
|
|
2070
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;
|
|
2071
2071
|
}
|
|
2072
|
-
function
|
|
2072
|
+
function Xt(r, e = "id", t = "") {
|
|
2073
2073
|
var n, s;
|
|
2074
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;
|
|
2075
2075
|
}
|
|
2076
|
-
function
|
|
2076
|
+
function Kt(r = {}) {
|
|
2077
2077
|
const { mapCore: e, baseGIS: t, ...n } = r;
|
|
2078
2078
|
return n;
|
|
2079
2079
|
}
|
|
2080
|
-
class
|
|
2080
|
+
class Cn {
|
|
2081
2081
|
constructor(e = {}) {
|
|
2082
|
-
const t =
|
|
2082
|
+
const t = Kt(e), n = t.pointLargeLayerId || t.largeLayerId || t.layerId || t.id || "point-large-default";
|
|
2083
2083
|
this.options = {
|
|
2084
2084
|
layerId: n,
|
|
2085
2085
|
visible: t.visible ?? !0,
|
|
@@ -2100,20 +2100,20 @@ class Kr {
|
|
|
2100
2100
|
}
|
|
2101
2101
|
mount(e) {
|
|
2102
2102
|
var t, n;
|
|
2103
|
-
return
|
|
2103
|
+
return qt(e) ? (this.baseGIS = e, p(
|
|
2104
2104
|
{ engineType: ((n = (t = this.baseGIS).getEngineType) == null ? void 0 : n.call(t)) || "unknown" },
|
|
2105
2105
|
"PointLargeLayerController mounted with BaseGIS."
|
|
2106
|
-
)) :
|
|
2106
|
+
)) : m(
|
|
2107
2107
|
"PointLargeLayerController mount requires BaseGIS instance.",
|
|
2108
2108
|
"INVALID_MOUNT_TARGET"
|
|
2109
2109
|
);
|
|
2110
2110
|
}
|
|
2111
2111
|
resolveBaseGIS() {
|
|
2112
2112
|
var e, t;
|
|
2113
|
-
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(
|
|
2114
2114
|
"Map instance is not ready. Please call mapCore.init() first.",
|
|
2115
2115
|
"NOT_INITIALIZED"
|
|
2116
|
-
) :
|
|
2116
|
+
) : m("PointLargeLayerController has not been mounted.", "NOT_MOUNTED");
|
|
2117
2117
|
}
|
|
2118
2118
|
getLayerId(e = {}, t = {}) {
|
|
2119
2119
|
var s;
|
|
@@ -2121,7 +2121,7 @@ class Kr {
|
|
|
2121
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;
|
|
2122
2122
|
}
|
|
2123
2123
|
buildPayload(e = {}) {
|
|
2124
|
-
const t =
|
|
2124
|
+
const t = se(e), n = this.getLayerId(t);
|
|
2125
2125
|
return {
|
|
2126
2126
|
...this.defaultPayload,
|
|
2127
2127
|
...t,
|
|
@@ -2142,21 +2142,21 @@ class Kr {
|
|
|
2142
2142
|
* 支持 load(points, options) 或 load({ points, ...options }) 两种调用方式。
|
|
2143
2143
|
*/
|
|
2144
2144
|
async load(e = {}, t = {}) {
|
|
2145
|
-
var
|
|
2145
|
+
var u;
|
|
2146
2146
|
const n = this.resolveBaseGIS();
|
|
2147
2147
|
if (!n.success)
|
|
2148
2148
|
return n;
|
|
2149
|
-
const s =
|
|
2149
|
+
const s = se(e), i = se(t), o = this.buildPayload({
|
|
2150
2150
|
...s,
|
|
2151
2151
|
...i
|
|
2152
2152
|
});
|
|
2153
|
-
if (!
|
|
2154
|
-
return
|
|
2153
|
+
if (!Ke(o))
|
|
2154
|
+
return m(
|
|
2155
2155
|
"Point large layer requires points, data or items.",
|
|
2156
2156
|
"INVALID_POINT_SOURCE"
|
|
2157
2157
|
);
|
|
2158
2158
|
const a = await this.baseGIS.upsertPointLargeLayer(o);
|
|
2159
|
-
return a.success && (this.currentPayload = o, this.visible = o.visible !== !1, this.layerType = ((
|
|
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;
|
|
2160
2160
|
}
|
|
2161
2161
|
upsert(e = {}, t = {}) {
|
|
2162
2162
|
return this.load(e, t);
|
|
@@ -2164,9 +2164,9 @@ class Kr {
|
|
|
2164
2164
|
async update(e = {}) {
|
|
2165
2165
|
const t = {
|
|
2166
2166
|
...this.currentPayload || this.defaultPayload,
|
|
2167
|
-
...
|
|
2167
|
+
...se(e)
|
|
2168
2168
|
};
|
|
2169
|
-
return !this.currentPayload && !
|
|
2169
|
+
return !this.currentPayload && !Ke(t) ? m("Point large layer has not been loaded.", "NOT_LOADED") : this.load(t);
|
|
2170
2170
|
}
|
|
2171
2171
|
show(e = {}) {
|
|
2172
2172
|
const t = this.resolveBaseGIS();
|
|
@@ -2195,9 +2195,9 @@ class Kr {
|
|
|
2195
2195
|
const n = this.resolveBaseGIS();
|
|
2196
2196
|
if (!n.success)
|
|
2197
2197
|
return n;
|
|
2198
|
-
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);
|
|
2199
2199
|
if (i == null || i === "")
|
|
2200
|
-
return
|
|
2200
|
+
return m("Point id is required when setting highlight.", "INVALID_POINT_ID");
|
|
2201
2201
|
const o = this.baseGIS.setPointLargeHighlight({
|
|
2202
2202
|
...s,
|
|
2203
2203
|
layerId: this.getLayerId(s, { allowId: !1 }),
|
|
@@ -2231,7 +2231,7 @@ class Kr {
|
|
|
2231
2231
|
this.currentPayload = {
|
|
2232
2232
|
...this.currentPayload,
|
|
2233
2233
|
points: this.currentPayload.points.filter((s, i) => {
|
|
2234
|
-
const o =
|
|
2234
|
+
const o = Xt(s, t, i);
|
|
2235
2235
|
return !n.has(String(o));
|
|
2236
2236
|
})
|
|
2237
2237
|
};
|
|
@@ -2240,9 +2240,9 @@ class Kr {
|
|
|
2240
2240
|
const n = this.resolveBaseGIS();
|
|
2241
2241
|
if (!n.success)
|
|
2242
2242
|
return n;
|
|
2243
|
-
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);
|
|
2244
2244
|
if (i == null || i === "")
|
|
2245
|
-
return
|
|
2245
|
+
return m("Point id is required when removing point.", "INVALID_POINT_ID");
|
|
2246
2246
|
const o = this.baseGIS.removePointLargePoint({
|
|
2247
2247
|
...s,
|
|
2248
2248
|
layerId: this.getLayerId(s, { allowId: !1 }),
|
|
@@ -2262,7 +2262,7 @@ class Kr {
|
|
|
2262
2262
|
return n;
|
|
2263
2263
|
const s = Array.isArray(e) ? e : [e];
|
|
2264
2264
|
if (s.length === 0)
|
|
2265
|
-
return
|
|
2265
|
+
return m("Point id list is required when removing points.", "INVALID_POINT_ID");
|
|
2266
2266
|
const i = this.baseGIS.removePointLargePoints({
|
|
2267
2267
|
...t,
|
|
2268
2268
|
layerId: this.getLayerId(t, { allowId: !1 }),
|
|
@@ -2313,7 +2313,7 @@ class Kr {
|
|
|
2313
2313
|
renderedCount: 0,
|
|
2314
2314
|
building: !1,
|
|
2315
2315
|
destroyed: !0
|
|
2316
|
-
},
|
|
2316
|
+
}, p(null, "Point large layer controller destroyed (local state only).");
|
|
2317
2317
|
const n = this.baseGIS.removePointLargeLayer({
|
|
2318
2318
|
...e,
|
|
2319
2319
|
layerId: this.getLayerId(e)
|
|
@@ -2324,7 +2324,7 @@ class Kr {
|
|
|
2324
2324
|
renderedCount: 0,
|
|
2325
2325
|
building: !1,
|
|
2326
2326
|
destroyed: !0
|
|
2327
|
-
}, n.success ?
|
|
2327
|
+
}, n.success ? p(null, "Point large layer controller destroyed.") : n;
|
|
2328
2328
|
}
|
|
2329
2329
|
removeLayer(e = {}) {
|
|
2330
2330
|
return this.destroy(e);
|
|
@@ -2332,10 +2332,10 @@ class Kr {
|
|
|
2332
2332
|
getState() {
|
|
2333
2333
|
var e, t, n, s, i, o, a;
|
|
2334
2334
|
if ((t = (e = this.baseGIS) == null ? void 0 : e.getMapInstance) != null && t.call(e) && this.currentPayload) {
|
|
2335
|
-
const
|
|
2335
|
+
const u = (s = (n = this.baseGIS).getPointLargeLayerState) == null ? void 0 : s.call(n, {
|
|
2336
2336
|
layerId: this.currentPayload.layerId || this.options.layerId
|
|
2337
2337
|
});
|
|
2338
|
-
|
|
2338
|
+
u != null && u.success && this.syncStateFromResult(u);
|
|
2339
2339
|
}
|
|
2340
2340
|
return {
|
|
2341
2341
|
mounted: !!this.baseGIS,
|
|
@@ -2348,13 +2348,13 @@ class Kr {
|
|
|
2348
2348
|
};
|
|
2349
2349
|
}
|
|
2350
2350
|
}
|
|
2351
|
-
function
|
|
2351
|
+
function Zt(r, e) {
|
|
2352
2352
|
let t = 0;
|
|
2353
2353
|
for (let n of r)
|
|
2354
2354
|
n != null && (n = +n) >= n && ++t;
|
|
2355
2355
|
return t;
|
|
2356
2356
|
}
|
|
2357
|
-
function
|
|
2357
|
+
function Jt(r, e) {
|
|
2358
2358
|
let t, n;
|
|
2359
2359
|
if (e === void 0)
|
|
2360
2360
|
for (const s of r)
|
|
@@ -2366,74 +2366,74 @@ function Mt(r, e) {
|
|
|
2366
2366
|
}
|
|
2367
2367
|
return [t, n];
|
|
2368
2368
|
}
|
|
2369
|
-
const
|
|
2370
|
-
function
|
|
2371
|
-
const n = (e - r) / Math.max(0, t), s = Math.floor(Math.log10(n)), i = n / Math.pow(10, s), o = i >=
|
|
2372
|
-
let a,
|
|
2373
|
-
return s < 0 ? (
|
|
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];
|
|
2374
2374
|
}
|
|
2375
|
-
function
|
|
2375
|
+
function rr(r, e, t) {
|
|
2376
2376
|
if (e = +e, r = +r, t = +t, !(t > 0)) return [];
|
|
2377
2377
|
if (r === e) return [r];
|
|
2378
|
-
const n = e < r, [s, i, o] = n ?
|
|
2378
|
+
const n = e < r, [s, i, o] = n ? he(e, r, t) : he(r, e, t);
|
|
2379
2379
|
if (!(i >= s)) return [];
|
|
2380
|
-
const a = i - s + 1,
|
|
2380
|
+
const a = i - s + 1, u = new Array(a);
|
|
2381
2381
|
if (n)
|
|
2382
|
-
if (o < 0) for (let
|
|
2383
|
-
else for (let
|
|
2384
|
-
else if (o < 0) for (let
|
|
2385
|
-
else for (let
|
|
2386
|
-
return
|
|
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;
|
|
2386
|
+
return u;
|
|
2387
2387
|
}
|
|
2388
|
-
function
|
|
2389
|
-
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];
|
|
2390
2390
|
}
|
|
2391
|
-
function
|
|
2391
|
+
function sr(r, e, t) {
|
|
2392
2392
|
let n;
|
|
2393
2393
|
for (; ; ) {
|
|
2394
|
-
const s =
|
|
2394
|
+
const s = nr(r, e, t);
|
|
2395
2395
|
if (s === n || s === 0 || !isFinite(s))
|
|
2396
2396
|
return [r, e];
|
|
2397
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;
|
|
2398
2398
|
}
|
|
2399
2399
|
}
|
|
2400
|
-
function
|
|
2401
|
-
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);
|
|
2402
2402
|
}
|
|
2403
|
-
var
|
|
2404
|
-
function
|
|
2403
|
+
var or = Array.prototype, ar = or.slice;
|
|
2404
|
+
function lr(r, e) {
|
|
2405
2405
|
return r - e;
|
|
2406
2406
|
}
|
|
2407
|
-
function
|
|
2407
|
+
function ur(r) {
|
|
2408
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];
|
|
2409
2409
|
return n;
|
|
2410
2410
|
}
|
|
2411
|
-
const
|
|
2412
|
-
function
|
|
2413
|
-
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;
|
|
2414
2414
|
return 0;
|
|
2415
2415
|
}
|
|
2416
|
-
function
|
|
2416
|
+
function hr(r, e) {
|
|
2417
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
|
|
2419
|
-
if (
|
|
2420
|
-
c > n !=
|
|
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);
|
|
2421
2421
|
}
|
|
2422
2422
|
return s;
|
|
2423
2423
|
}
|
|
2424
|
-
function
|
|
2424
|
+
function dr(r, e, t) {
|
|
2425
2425
|
var n;
|
|
2426
|
-
return
|
|
2426
|
+
return fr(r, e, t) && yr(r[n = +(r[0] === e[0])], t[n], e[n]);
|
|
2427
2427
|
}
|
|
2428
|
-
function
|
|
2428
|
+
function fr(r, e, t) {
|
|
2429
2429
|
return (e[0] - r[0]) * (t[1] - r[1]) === (t[0] - r[0]) * (e[1] - r[1]);
|
|
2430
2430
|
}
|
|
2431
|
-
function
|
|
2431
|
+
function yr(r, e, t) {
|
|
2432
2432
|
return r <= e && e <= t || t <= e && e <= r;
|
|
2433
2433
|
}
|
|
2434
|
-
function
|
|
2434
|
+
function mr() {
|
|
2435
2435
|
}
|
|
2436
|
-
var
|
|
2436
|
+
var z = [
|
|
2437
2437
|
[],
|
|
2438
2438
|
[[[1, 1.5], [0.5, 1]]],
|
|
2439
2439
|
[[[1.5, 1], [1, 1.5]]],
|
|
@@ -2451,92 +2451,363 @@ var B = [
|
|
|
2451
2451
|
[[[0.5, 1], [1, 1.5]]],
|
|
2452
2452
|
[]
|
|
2453
2453
|
];
|
|
2454
|
-
function
|
|
2455
|
-
var r = 1, e = 1, t =
|
|
2456
|
-
function s(
|
|
2457
|
-
var c = t(
|
|
2454
|
+
function Ir() {
|
|
2455
|
+
var r = 1, e = 1, t = ir, n = u;
|
|
2456
|
+
function s(l) {
|
|
2457
|
+
var c = t(l);
|
|
2458
2458
|
if (Array.isArray(c))
|
|
2459
|
-
c = c.slice().sort(
|
|
2459
|
+
c = c.slice().sort(lr);
|
|
2460
2460
|
else {
|
|
2461
|
-
const h =
|
|
2462
|
-
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();
|
|
2463
2463
|
for (; c[1] < h[0]; ) c.shift();
|
|
2464
2464
|
}
|
|
2465
|
-
return c.map((h) => i(
|
|
2465
|
+
return c.map((h) => i(l, h));
|
|
2466
2466
|
}
|
|
2467
|
-
function i(
|
|
2467
|
+
function i(l, c) {
|
|
2468
2468
|
const h = c == null ? NaN : +c;
|
|
2469
2469
|
if (isNaN(h)) throw new Error(`invalid value: ${c}`);
|
|
2470
|
-
var
|
|
2471
|
-
return o(
|
|
2472
|
-
n(
|
|
2473
|
-
}),
|
|
2474
|
-
for (var
|
|
2475
|
-
if (
|
|
2476
|
-
|
|
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);
|
|
2477
2477
|
return;
|
|
2478
2478
|
}
|
|
2479
2479
|
}), {
|
|
2480
2480
|
type: "MultiPolygon",
|
|
2481
2481
|
value: c,
|
|
2482
|
-
coordinates:
|
|
2482
|
+
coordinates: d
|
|
2483
2483
|
};
|
|
2484
2484
|
}
|
|
2485
|
-
function o(
|
|
2486
|
-
var
|
|
2487
|
-
for (
|
|
2488
|
-
|
|
2489
|
-
for (
|
|
2490
|
-
for (
|
|
2491
|
-
|
|
2492
|
-
|
|
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);
|
|
2493
2493
|
}
|
|
2494
|
-
for (
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
function
|
|
2498
|
-
var
|
|
2499
|
-
(
|
|
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] };
|
|
2500
2500
|
}
|
|
2501
2501
|
}
|
|
2502
|
-
function a(
|
|
2503
|
-
return
|
|
2502
|
+
function a(l) {
|
|
2503
|
+
return l[0] * 2 + l[1] * (r + 1) * 4;
|
|
2504
2504
|
}
|
|
2505
|
-
function l
|
|
2506
|
-
|
|
2507
|
-
var
|
|
2508
|
-
|
|
2505
|
+
function u(l, c, h) {
|
|
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));
|
|
2509
2509
|
});
|
|
2510
2510
|
}
|
|
2511
|
-
return s.contour = i, s.size = function(
|
|
2511
|
+
return s.contour = i, s.size = function(l) {
|
|
2512
2512
|
if (!arguments.length) return [r, e];
|
|
2513
|
-
var c = Math.floor(
|
|
2513
|
+
var c = Math.floor(l[0]), h = Math.floor(l[1]);
|
|
2514
2514
|
if (!(c >= 0 && h >= 0)) throw new Error("invalid size");
|
|
2515
2515
|
return r = c, e = h, s;
|
|
2516
|
-
}, s.thresholds = function(
|
|
2517
|
-
return arguments.length ? (t = typeof
|
|
2518
|
-
}, s.smooth = function(
|
|
2519
|
-
return arguments.length ? (n =
|
|
2516
|
+
}, s.thresholds = function(l) {
|
|
2517
|
+
return arguments.length ? (t = typeof l == "function" ? l : Array.isArray(l) ? Je(ar.call(l)) : Je(l), s) : t;
|
|
2518
|
+
}, s.smooth = function(l) {
|
|
2519
|
+
return arguments.length ? (n = l ? u : mr, s) : n === u;
|
|
2520
2520
|
}, s;
|
|
2521
2521
|
}
|
|
2522
|
-
function
|
|
2522
|
+
function gr(r) {
|
|
2523
2523
|
return isFinite(r) ? r : NaN;
|
|
2524
2524
|
}
|
|
2525
|
-
function
|
|
2525
|
+
function W(r, e) {
|
|
2526
2526
|
return r == null ? !1 : +r >= e;
|
|
2527
2527
|
}
|
|
2528
|
-
function
|
|
2528
|
+
function pe(r) {
|
|
2529
2529
|
return r == null || isNaN(r = +r) ? -1 / 0 : r;
|
|
2530
2530
|
}
|
|
2531
|
-
function
|
|
2531
|
+
function Qe(r, e, t, n) {
|
|
2532
2532
|
const s = n - e, i = t - e, o = isFinite(s) || isFinite(i) ? s / i : Math.sign(s) / Math.sign(i);
|
|
2533
2533
|
return isNaN(o) ? r : r + o - 0.5;
|
|
2534
2534
|
}
|
|
2535
|
-
const
|
|
2536
|
-
V,
|
|
2537
|
-
$
|
|
2538
|
-
]), k = Object.freeze({
|
|
2535
|
+
const ie = Object.freeze({
|
|
2539
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
|
+
};
|
|
2731
|
+
}
|
|
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({
|
|
2809
|
+
enabled: !1,
|
|
2810
|
+
method: "neighborhood",
|
|
2540
2811
|
radius: 6,
|
|
2541
2812
|
minProminence: 2,
|
|
2542
2813
|
minGridDistance: 20,
|
|
@@ -2546,22 +2817,22 @@ const de = 6378137, ee = 85.0511287798066, te = 1e6, V = "EPSG:4326", $ = "EPSG:
|
|
|
2546
2817
|
excludeBoundary: !0,
|
|
2547
2818
|
smoothingIterations: 1
|
|
2548
2819
|
});
|
|
2549
|
-
function
|
|
2820
|
+
function N(r, e = null) {
|
|
2550
2821
|
const t = Number(r);
|
|
2551
2822
|
return Number.isFinite(t) ? t : e;
|
|
2552
2823
|
}
|
|
2553
|
-
function
|
|
2824
|
+
function gt(r, e) {
|
|
2554
2825
|
return Object.prototype.hasOwnProperty.call(r || {}, e);
|
|
2555
2826
|
}
|
|
2556
|
-
function
|
|
2827
|
+
function Ne(r) {
|
|
2557
2828
|
if (Array.isArray(r) && r.length >= 4) {
|
|
2558
|
-
const [i, o, a,
|
|
2559
|
-
if ([i, o, a,
|
|
2829
|
+
const [i, o, a, u] = r.map(Number);
|
|
2830
|
+
if ([i, o, a, u].every(Number.isFinite))
|
|
2560
2831
|
return {
|
|
2561
2832
|
startLon: Math.min(i, a),
|
|
2562
|
-
startLat: Math.min(o,
|
|
2833
|
+
startLat: Math.min(o, u),
|
|
2563
2834
|
endLon: Math.max(i, a),
|
|
2564
|
-
endLat: Math.max(o,
|
|
2835
|
+
endLat: Math.max(o, u)
|
|
2565
2836
|
};
|
|
2566
2837
|
}
|
|
2567
2838
|
if (!r || typeof r != "object")
|
|
@@ -2574,91 +2845,91 @@ function Ie(r) {
|
|
|
2574
2845
|
endLat: Math.max(t, s)
|
|
2575
2846
|
} : null;
|
|
2576
2847
|
}
|
|
2577
|
-
function
|
|
2848
|
+
function Tr(r = "") {
|
|
2578
2849
|
const e = String(r || "").trim().toUpperCase().replace("::", ":");
|
|
2579
2850
|
return ["3857", "EPSG3857", "EPSG:3857", "EPSG900913", "EPSG:900913", "900913"].includes(
|
|
2580
2851
|
e
|
|
2581
2852
|
) ? "EPSG:3857" : ["4326", "EPSG4326", "EPSG:4326", "WGS84", "WGS 84"].includes(e) ? "EPSG:4326" : e;
|
|
2582
2853
|
}
|
|
2583
|
-
function
|
|
2854
|
+
function $(r) {
|
|
2584
2855
|
return r != null && String(r).trim() !== "";
|
|
2585
2856
|
}
|
|
2586
|
-
function
|
|
2587
|
-
return
|
|
2857
|
+
function xe(r = {}, e = !1) {
|
|
2858
|
+
return $(r.sourceProjectionCrs) ? r.sourceProjectionCrs : $(r.sourceProjection) ? r.sourceProjection : e && $(r.projection) ? r.projection : "";
|
|
2588
2859
|
}
|
|
2589
|
-
function
|
|
2590
|
-
return
|
|
2860
|
+
function Ee(r = {}) {
|
|
2861
|
+
return $(r.defaultSourceProjectionCrs) ? r.defaultSourceProjectionCrs : "";
|
|
2591
2862
|
}
|
|
2592
|
-
function
|
|
2593
|
-
const t =
|
|
2594
|
-
if (!
|
|
2863
|
+
function J(r, e = k) {
|
|
2864
|
+
const t = Tr(r) || e;
|
|
2865
|
+
if (!Mr.has(t))
|
|
2595
2866
|
throw new Error(
|
|
2596
2867
|
`暂不支持栅格投影“${t || r}”,当前仅支持 EPSG:4326 和 EPSG:3857。`
|
|
2597
2868
|
);
|
|
2598
2869
|
return t;
|
|
2599
2870
|
}
|
|
2600
|
-
function
|
|
2871
|
+
function Gr(r = []) {
|
|
2601
2872
|
if (!Array.isArray(r) || r.length < 4) return !1;
|
|
2602
2873
|
const [e, t, n, s] = r.slice(0, 4).map(Number);
|
|
2603
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;
|
|
2604
2875
|
}
|
|
2605
|
-
function
|
|
2606
|
-
const n =
|
|
2876
|
+
function Nr(r = {}, e = {}, t = []) {
|
|
2877
|
+
const n = xe(r);
|
|
2607
2878
|
if (n)
|
|
2608
|
-
return
|
|
2609
|
-
if (
|
|
2879
|
+
return J(n, "");
|
|
2880
|
+
if ($(e.ProjectedCSTypeGeoKey)) {
|
|
2610
2881
|
const o = Number(e.ProjectedCSTypeGeoKey);
|
|
2611
2882
|
if (o === 3857 || o === 900913)
|
|
2612
|
-
return
|
|
2883
|
+
return q;
|
|
2613
2884
|
throw new Error(
|
|
2614
2885
|
`暂不支持 GeoTIFF 投影“EPSG:${e.ProjectedCSTypeGeoKey}”,当前仅支持 EPSG:4326 和 EPSG:3857。`
|
|
2615
2886
|
);
|
|
2616
2887
|
}
|
|
2617
2888
|
const s = Number(e.GTModelTypeGeoKey);
|
|
2618
|
-
if (
|
|
2889
|
+
if ($(e.GTModelTypeGeoKey) && [1, 3].includes(s))
|
|
2619
2890
|
throw new Error(
|
|
2620
2891
|
"GeoTIFF 声明了未识别的投影坐标系,请通过 sourceProjectionCrs 显式指定 EPSG:3857。"
|
|
2621
2892
|
);
|
|
2622
|
-
if (
|
|
2893
|
+
if ($(e.GeographicTypeGeoKey)) {
|
|
2623
2894
|
if (Number(e.GeographicTypeGeoKey) === 4326)
|
|
2624
|
-
return
|
|
2895
|
+
return k;
|
|
2625
2896
|
throw new Error(
|
|
2626
2897
|
`暂不支持 GeoTIFF 地理坐标系“EPSG:${e.GeographicTypeGeoKey}”,当前仅支持 EPSG:4326。`
|
|
2627
2898
|
);
|
|
2628
2899
|
}
|
|
2629
|
-
if (
|
|
2900
|
+
if ($(e.GTModelTypeGeoKey) && s === 2)
|
|
2630
2901
|
throw new Error(
|
|
2631
2902
|
"GeoTIFF 只声明了地理坐标模型,但缺少具体 CRS,请通过 sourceProjectionCrs 显式指定。"
|
|
2632
2903
|
);
|
|
2633
|
-
const i =
|
|
2904
|
+
const i = Ee(r);
|
|
2634
2905
|
if (i)
|
|
2635
|
-
return
|
|
2636
|
-
if (
|
|
2906
|
+
return J(i, "");
|
|
2907
|
+
if (Gr(t)) return k;
|
|
2637
2908
|
throw new Error(
|
|
2638
2909
|
"无法识别 GeoTIFF 投影,请通过 sourceProjectionCrs 显式指定 EPSG:4326 或 EPSG:3857。"
|
|
2639
2910
|
);
|
|
2640
2911
|
}
|
|
2641
|
-
function
|
|
2642
|
-
const t = Number(r) /
|
|
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);
|
|
2643
2914
|
return {
|
|
2644
2915
|
lng: t,
|
|
2645
|
-
lat: Math.min(Math.max(n, -
|
|
2916
|
+
lat: Math.min(Math.max(n, -de), de)
|
|
2646
2917
|
};
|
|
2647
2918
|
}
|
|
2648
|
-
function
|
|
2919
|
+
function xr(r) {
|
|
2649
2920
|
return !Number.isFinite(r) || r >= -180 && r <= 180 ? r : ((r + 180) % 360 + 360) % 360 - 180;
|
|
2650
2921
|
}
|
|
2651
|
-
function
|
|
2922
|
+
function rt(r) {
|
|
2652
2923
|
const e = Number(r);
|
|
2653
|
-
if (!Number.isFinite(e) || Math.abs(e) >
|
|
2924
|
+
if (!Number.isFinite(e) || Math.abs(e) > de)
|
|
2654
2925
|
throw new Error(
|
|
2655
|
-
`EPSG:3857 栅格的纬度范围不能超过 ±${
|
|
2926
|
+
`EPSG:3857 栅格的纬度范围不能超过 ±${de}°。`
|
|
2656
2927
|
);
|
|
2657
2928
|
const t = e * Math.PI / 180;
|
|
2658
|
-
return
|
|
2929
|
+
return Me * Math.log(Math.tan(Math.PI / 4 + t / 2));
|
|
2659
2930
|
}
|
|
2660
|
-
function
|
|
2661
|
-
let i =
|
|
2931
|
+
function nt({ area: r, projection: e, width: t, height: n, isSplit: s }) {
|
|
2932
|
+
let i = Ne(r);
|
|
2662
2933
|
if (s && i && Math.abs(i.endLon - i.startLon) >= 359.999 && (i = {
|
|
2663
2934
|
...i,
|
|
2664
2935
|
startLon: -180,
|
|
@@ -2668,20 +2939,20 @@ function _e({ area: r, projection: e, width: t, height: n, isSplit: s }) {
|
|
|
2668
2939
|
const o = i.endLon - i.startLon;
|
|
2669
2940
|
if (o === 0 || i.endLat === i.startLat)
|
|
2670
2941
|
throw new Error("栅格地理范围无效,宽度或高度为 0。");
|
|
2671
|
-
const a = e ===
|
|
2942
|
+
const a = e === q ? rt(i.startLat) : i.startLat, u = e === q ? rt(i.endLat) : i.endLat, l = u - a;
|
|
2672
2943
|
return {
|
|
2673
2944
|
area: i,
|
|
2674
2945
|
projection: e,
|
|
2675
2946
|
map(c, h) {
|
|
2676
|
-
const
|
|
2947
|
+
const d = u - h / n * l;
|
|
2677
2948
|
return [
|
|
2678
|
-
e ===
|
|
2679
|
-
|
|
2949
|
+
e === q ? Te(0, d).lat : d,
|
|
2950
|
+
xr(i.startLon + c / t * o)
|
|
2680
2951
|
];
|
|
2681
2952
|
}
|
|
2682
2953
|
};
|
|
2683
2954
|
}
|
|
2684
|
-
function
|
|
2955
|
+
function Ae({
|
|
2685
2956
|
area: r,
|
|
2686
2957
|
bbox: e,
|
|
2687
2958
|
projection: t,
|
|
@@ -2690,66 +2961,66 @@ function be({
|
|
|
2690
2961
|
height: i,
|
|
2691
2962
|
isSplit: o = !1
|
|
2692
2963
|
}) {
|
|
2693
|
-
const a =
|
|
2694
|
-
if (
|
|
2964
|
+
const a = J(t), u = Ne(r);
|
|
2965
|
+
if (u)
|
|
2695
2966
|
return {
|
|
2696
|
-
...
|
|
2697
|
-
area:
|
|
2967
|
+
...nt({
|
|
2968
|
+
area: u,
|
|
2698
2969
|
projection: a,
|
|
2699
2970
|
width: s,
|
|
2700
2971
|
height: i,
|
|
2701
2972
|
isSplit: o
|
|
2702
2973
|
}),
|
|
2703
|
-
bboxProjection:
|
|
2974
|
+
bboxProjection: k
|
|
2704
2975
|
};
|
|
2705
2976
|
if (!Array.isArray(e) || e.length < 4)
|
|
2706
2977
|
throw new Error("栅格缺少地理范围,请通过 area 提供 [west, south, east, north]。");
|
|
2707
|
-
const [
|
|
2708
|
-
if (![
|
|
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)
|
|
2709
2980
|
throw new Error("栅格地理范围无效,宽度或高度为 0。");
|
|
2710
|
-
const
|
|
2981
|
+
const f = J(
|
|
2711
2982
|
n,
|
|
2712
2983
|
a
|
|
2713
|
-
),
|
|
2984
|
+
), y = f === q ? Te(l, c) : { lng: l, lat: c }, I = f === q ? Te(h, d) : { lng: h, lat: d };
|
|
2714
2985
|
return {
|
|
2715
|
-
...
|
|
2986
|
+
...nt({
|
|
2716
2987
|
area: {
|
|
2717
|
-
startLon:
|
|
2718
|
-
startLat:
|
|
2719
|
-
endLon:
|
|
2720
|
-
endLat:
|
|
2988
|
+
startLon: y.lng,
|
|
2989
|
+
startLat: y.lat,
|
|
2990
|
+
endLon: I.lng,
|
|
2991
|
+
endLat: I.lat
|
|
2721
2992
|
},
|
|
2722
2993
|
projection: a,
|
|
2723
2994
|
width: s,
|
|
2724
2995
|
height: i,
|
|
2725
2996
|
isSplit: o
|
|
2726
2997
|
}),
|
|
2727
|
-
bboxProjection:
|
|
2998
|
+
bboxProjection: f
|
|
2728
2999
|
};
|
|
2729
3000
|
}
|
|
2730
|
-
function
|
|
3001
|
+
function Er(r = {}) {
|
|
2731
3002
|
const e = String(r.sourceType || r.dataType || "").toLowerCase();
|
|
2732
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" : "";
|
|
2733
3004
|
}
|
|
2734
|
-
function
|
|
3005
|
+
function Ar() {
|
|
2735
3006
|
return typeof window > "u" ? null : window.GeoTIFF || null;
|
|
2736
3007
|
}
|
|
2737
|
-
function
|
|
3008
|
+
function Rr(r, e = {}, t = null) {
|
|
2738
3009
|
if (!Number.isFinite(r)) return !0;
|
|
2739
|
-
const n =
|
|
3010
|
+
const n = gt(e, "noDataValue") ? Number(e.noDataValue) : t;
|
|
2740
3011
|
if (Number.isFinite(n) && r === n) return !0;
|
|
2741
|
-
const s =
|
|
3012
|
+
const s = N(e.validMin), i = N(e.validMax);
|
|
2742
3013
|
return s !== null && r < s || i !== null && r > i;
|
|
2743
3014
|
}
|
|
2744
|
-
function
|
|
2745
|
-
const n =
|
|
3015
|
+
function bt(r, e = {}, t = null) {
|
|
3016
|
+
const n = N(e.scale, 1), s = N(e.offset, 0), i = new Float64Array(r.length);
|
|
2746
3017
|
for (let o = 0; o < r.length; o += 1) {
|
|
2747
3018
|
const a = Number(r[o]);
|
|
2748
|
-
i[o] =
|
|
3019
|
+
i[o] = Rr(a, e, t) ? Number.NaN : a * n + s;
|
|
2749
3020
|
}
|
|
2750
3021
|
return i;
|
|
2751
3022
|
}
|
|
2752
|
-
function
|
|
3023
|
+
function pt(r, e, t) {
|
|
2753
3024
|
const n = new Float64Array(r.length), s = Math.floor(e / 2);
|
|
2754
3025
|
for (let i = 0; i < t; i += 1)
|
|
2755
3026
|
for (let o = 0; o < e; o += 1) {
|
|
@@ -2758,96 +3029,96 @@ function Je(r, e, t) {
|
|
|
2758
3029
|
}
|
|
2759
3030
|
return n;
|
|
2760
3031
|
}
|
|
2761
|
-
async function
|
|
2762
|
-
var
|
|
2763
|
-
const e =
|
|
3032
|
+
async function Dr(r = {}) {
|
|
3033
|
+
var b, w, S;
|
|
3034
|
+
const e = Ar();
|
|
2764
3035
|
if (!e)
|
|
2765
3036
|
throw new Error("GeoTIFF 未加载,请先提供 window.GeoTIFF。");
|
|
2766
3037
|
let t = r.arrayBuffer || null;
|
|
2767
3038
|
const n = r.tifUrl || r.tiffUrl || "";
|
|
2768
3039
|
if (!t) {
|
|
2769
3040
|
if (!n) throw new Error("GeoTIFF 数据源缺少 tifUrl。");
|
|
2770
|
-
t = (await
|
|
2771
|
-
}
|
|
2772
|
-
const s = await e.fromArrayBuffer(t), i = Math.max(Math.floor(
|
|
2773
|
-
if (
|
|
2774
|
-
throw new Error(`GeoTIFF 不存在第 ${
|
|
2775
|
-
const c = { samples: [
|
|
2776
|
-
let
|
|
2777
|
-
r.isSplit && (
|
|
2778
|
-
let
|
|
3041
|
+
t = (await wt.get(n, { responseType: "arraybuffer" })).data;
|
|
3042
|
+
}
|
|
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())
|
|
3045
|
+
throw new Error(`GeoTIFF 不存在第 ${l} 个波段。`);
|
|
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 = [];
|
|
2779
3050
|
try {
|
|
2780
|
-
|
|
2781
|
-
} catch (
|
|
2782
|
-
if (!r.area) throw
|
|
3051
|
+
y = ((w = o.getBoundingBox) == null ? void 0 : w.call(o)) || [];
|
|
3052
|
+
} catch (g) {
|
|
3053
|
+
if (!r.area) throw g;
|
|
2783
3054
|
}
|
|
2784
|
-
const
|
|
3055
|
+
const I = ((S = o.getGeoKeys) == null ? void 0 : S.call(o)) || {}, v = Nr(r, I, y), P = Ae({
|
|
2785
3056
|
area: r.area,
|
|
2786
|
-
bbox:
|
|
2787
|
-
projection:
|
|
2788
|
-
bboxProjection: r.area ?
|
|
3057
|
+
bbox: y,
|
|
3058
|
+
projection: v,
|
|
3059
|
+
bboxProjection: r.area ? k : v,
|
|
2789
3060
|
width: a,
|
|
2790
|
-
height:
|
|
3061
|
+
height: u,
|
|
2791
3062
|
isSplit: r.isSplit
|
|
2792
3063
|
});
|
|
2793
3064
|
return {
|
|
2794
3065
|
sourceType: "geotiff",
|
|
2795
3066
|
sourceUrl: n,
|
|
2796
3067
|
width: a,
|
|
2797
|
-
height:
|
|
2798
|
-
values:
|
|
2799
|
-
sourceProjectionCrs:
|
|
2800
|
-
sourceProjection:
|
|
2801
|
-
projection:
|
|
2802
|
-
bboxProjection:
|
|
2803
|
-
area:
|
|
2804
|
-
mapCoordinate:
|
|
2805
|
-
band:
|
|
3068
|
+
height: u,
|
|
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,
|
|
3076
|
+
band: l
|
|
2806
3077
|
};
|
|
2807
3078
|
}
|
|
2808
|
-
function
|
|
3079
|
+
function Fr(r) {
|
|
2809
3080
|
return new Promise((e, t) => {
|
|
2810
3081
|
const n = new Image();
|
|
2811
3082
|
n.crossOrigin = "anonymous", n.onload = () => e(n), n.onerror = () => t(new Error(`灰度图加载失败:${r}`)), n.src = r;
|
|
2812
3083
|
});
|
|
2813
3084
|
}
|
|
2814
|
-
function
|
|
3085
|
+
function Br(r, e, t = "luminance") {
|
|
2815
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;
|
|
2816
3087
|
}
|
|
2817
|
-
async function
|
|
3088
|
+
async function Or(r = {}) {
|
|
2818
3089
|
if (typeof document > "u" || typeof Image > "u")
|
|
2819
3090
|
throw new Error("灰度图解析只能在浏览器环境中运行。");
|
|
2820
|
-
const e = r.grayImageUrl || r.imageUrl || "", t =
|
|
3091
|
+
const e = r.grayImageUrl || r.imageUrl || "", t = Ne(r.area);
|
|
2821
3092
|
if (!e) throw new Error("灰度图数据源缺少 grayImageUrl 或 imageUrl。");
|
|
2822
3093
|
if (!t) throw new Error("灰度图没有地理信息,必须通过 area 提供覆盖范围。");
|
|
2823
|
-
const n = await
|
|
3094
|
+
const n = await Fr(e), s = n.naturalWidth || n.width, i = n.naturalHeight || n.height, o = document.createElement("canvas");
|
|
2824
3095
|
o.width = s, o.height = i;
|
|
2825
3096
|
const a = o.getContext("2d", { willReadFrequently: !0 });
|
|
2826
3097
|
if (!a) throw new Error("当前浏览器不支持 Canvas 2D。");
|
|
2827
3098
|
a.drawImage(n, 0, 0, s, i);
|
|
2828
|
-
let
|
|
3099
|
+
let u;
|
|
2829
3100
|
try {
|
|
2830
|
-
|
|
2831
|
-
} catch (
|
|
2832
|
-
throw new Error(`灰度图像素读取失败,请检查图片 CORS:${(
|
|
2833
|
-
}
|
|
2834
|
-
const
|
|
2835
|
-
for (let
|
|
2836
|
-
for (let
|
|
2837
|
-
const
|
|
2838
|
-
if (
|
|
2839
|
-
|
|
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;
|
|
2840
3111
|
continue;
|
|
2841
3112
|
}
|
|
2842
|
-
let
|
|
2843
|
-
|
|
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);
|
|
2844
3115
|
}
|
|
2845
|
-
const
|
|
2846
|
-
|
|
2847
|
-
),
|
|
3116
|
+
const w = J(
|
|
3117
|
+
xe(r, !0) || Ee(r)
|
|
3118
|
+
), S = Ae({
|
|
2848
3119
|
area: t,
|
|
2849
|
-
projection:
|
|
2850
|
-
bboxProjection:
|
|
3120
|
+
projection: w,
|
|
3121
|
+
bboxProjection: k,
|
|
2851
3122
|
width: s,
|
|
2852
3123
|
height: i,
|
|
2853
3124
|
isSplit: r.isSplit
|
|
@@ -2857,17 +3128,17 @@ async function ir(r = {}) {
|
|
|
2857
3128
|
sourceUrl: e,
|
|
2858
3129
|
width: s,
|
|
2859
3130
|
height: i,
|
|
2860
|
-
values:
|
|
2861
|
-
sourceProjectionCrs:
|
|
2862
|
-
sourceProjection:
|
|
2863
|
-
projection:
|
|
2864
|
-
bboxProjection:
|
|
2865
|
-
area:
|
|
2866
|
-
mapCoordinate:
|
|
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,
|
|
2867
3138
|
band: 0
|
|
2868
3139
|
};
|
|
2869
3140
|
}
|
|
2870
|
-
function
|
|
3141
|
+
function jr(r = {}) {
|
|
2871
3142
|
var s;
|
|
2872
3143
|
const e = r.values || r.data || r.grid;
|
|
2873
3144
|
if (!e) return null;
|
|
@@ -2881,23 +3152,23 @@ function or(r = {}) {
|
|
|
2881
3152
|
values: e.flat()
|
|
2882
3153
|
};
|
|
2883
3154
|
}
|
|
2884
|
-
const t = Math.floor(
|
|
3155
|
+
const t = Math.floor(N(r.width, 0)), n = Math.floor(N(r.height, 0));
|
|
2885
3156
|
if (t < 2 || n < 2 || e.length < t * n)
|
|
2886
3157
|
throw new Error("一维数值网格必须提供正确的 width 和 height。");
|
|
2887
3158
|
return { width: t, height: n, values: e };
|
|
2888
3159
|
}
|
|
2889
|
-
function
|
|
2890
|
-
const e =
|
|
3160
|
+
function _r(r = {}) {
|
|
3161
|
+
const e = jr(r);
|
|
2891
3162
|
if (!e) throw new Error("数值网格缺少 values、data 或 grid。");
|
|
2892
|
-
let t =
|
|
2893
|
-
r.isSplit && (t =
|
|
2894
|
-
const n =
|
|
2895
|
-
|
|
2896
|
-
), s =
|
|
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({
|
|
2897
3168
|
area: r.area,
|
|
2898
3169
|
bbox: r.bbox,
|
|
2899
3170
|
projection: n,
|
|
2900
|
-
bboxProjection: r.area ?
|
|
3171
|
+
bboxProjection: r.area ? k : r.bboxProjection || n,
|
|
2901
3172
|
width: e.width,
|
|
2902
3173
|
height: e.height,
|
|
2903
3174
|
isSplit: r.isSplit
|
|
@@ -2917,14 +3188,14 @@ function ar(r = {}) {
|
|
|
2917
3188
|
band: 0
|
|
2918
3189
|
};
|
|
2919
3190
|
}
|
|
2920
|
-
async function
|
|
2921
|
-
const e =
|
|
2922
|
-
if (e === "geotiff") return
|
|
2923
|
-
if (e === "grayscale") return
|
|
2924
|
-
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);
|
|
2925
3196
|
throw new Error("无法识别栅格数据源,请提供 tifUrl、grayImageUrl 或 values。");
|
|
2926
3197
|
}
|
|
2927
|
-
function
|
|
3198
|
+
function zr(r) {
|
|
2928
3199
|
let e = Number.POSITIVE_INFINITY, t = Number.NEGATIVE_INFINITY, n = 0;
|
|
2929
3200
|
for (let s = 0; s < r.length; s += 1) {
|
|
2930
3201
|
const i = Number(r[s]);
|
|
@@ -2933,16 +3204,16 @@ function ur(r) {
|
|
|
2933
3204
|
if (!n) throw new Error("栅格中没有可用于生成等值线的有效数值。");
|
|
2934
3205
|
return { min: e, max: t, validCount: n, noDataCount: r.length - n };
|
|
2935
3206
|
}
|
|
2936
|
-
function
|
|
2937
|
-
const t = Math.max(Math.floor(
|
|
3207
|
+
function Ur(r, e = fe) {
|
|
3208
|
+
const t = Math.max(Math.floor(N(e, fe)), 4);
|
|
2938
3209
|
if (r.width * r.height <= t)
|
|
2939
3210
|
return r;
|
|
2940
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);
|
|
2941
3212
|
for (let a = 0; a < i; a += 1) {
|
|
2942
|
-
const
|
|
2943
|
-
for (let
|
|
2944
|
-
const c = Math.round(
|
|
2945
|
-
o[a * s +
|
|
3213
|
+
const u = Math.round(a / Math.max(i - 1, 1) * (r.height - 1));
|
|
3214
|
+
for (let l = 0; l < s; l += 1) {
|
|
3215
|
+
const c = Math.round(l / Math.max(s - 1, 1) * (r.width - 1));
|
|
3216
|
+
o[a * s + l] = r.values[u * r.width + c];
|
|
2946
3217
|
}
|
|
2947
3218
|
}
|
|
2948
3219
|
return {
|
|
@@ -2950,10 +3221,10 @@ function cr(r, e = te) {
|
|
|
2950
3221
|
width: s,
|
|
2951
3222
|
height: i,
|
|
2952
3223
|
values: o,
|
|
2953
|
-
mapCoordinate(a,
|
|
3224
|
+
mapCoordinate(a, u) {
|
|
2954
3225
|
return r.mapCoordinate(
|
|
2955
3226
|
a / s * r.width,
|
|
2956
|
-
|
|
3227
|
+
u / i * r.height
|
|
2957
3228
|
);
|
|
2958
3229
|
},
|
|
2959
3230
|
downsampled: !0,
|
|
@@ -2961,108 +3232,84 @@ function cr(r, e = te) {
|
|
|
2961
3232
|
originalHeight: r.height
|
|
2962
3233
|
};
|
|
2963
3234
|
}
|
|
2964
|
-
function
|
|
3235
|
+
function st(r, e = 10) {
|
|
2965
3236
|
const t = 10 ** e;
|
|
2966
3237
|
return Math.round(r * t) / t;
|
|
2967
3238
|
}
|
|
2968
|
-
function
|
|
3239
|
+
function $r(r, e = {}) {
|
|
2969
3240
|
const t = e.thresholds || e.levels;
|
|
2970
3241
|
if (Array.isArray(t))
|
|
2971
3242
|
return [...new Set(t.map(Number).filter(Number.isFinite))].filter((o) => o > r.min && o < r.max).sort((o, a) => o - a);
|
|
2972
|
-
const n =
|
|
3243
|
+
const n = N(e.interval ?? e.contourInterval);
|
|
2973
3244
|
if (n !== null && n > 0) {
|
|
2974
3245
|
const o = [];
|
|
2975
3246
|
let a = Math.ceil(r.min / n) * n;
|
|
2976
3247
|
for (; a < r.max && o.length < 200; )
|
|
2977
|
-
a > r.min && o.push(
|
|
3248
|
+
a > r.min && o.push(st(a)), a += n;
|
|
2978
3249
|
return o;
|
|
2979
3250
|
}
|
|
2980
3251
|
const s = Math.min(
|
|
2981
|
-
Math.max(Math.floor(
|
|
3252
|
+
Math.max(Math.floor(N(e.thresholdCount ?? e.levelCount, 12)), 1),
|
|
2982
3253
|
100
|
|
2983
3254
|
), i = (r.max - r.min) / (s + 1);
|
|
2984
3255
|
return Array.from(
|
|
2985
3256
|
{ length: s },
|
|
2986
|
-
(o, a) =>
|
|
3257
|
+
(o, a) => st(r.min + i * (a + 1))
|
|
2987
3258
|
);
|
|
2988
3259
|
}
|
|
2989
|
-
function
|
|
3260
|
+
function kr(r, e, t, n) {
|
|
2990
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;
|
|
2991
3262
|
}
|
|
2992
|
-
function
|
|
3263
|
+
function Wr(r = [], e, t) {
|
|
2993
3264
|
const n = [...r];
|
|
2994
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 [];
|
|
2995
3266
|
const s = n.map(
|
|
2996
|
-
(
|
|
3267
|
+
(u, l) => kr(u, n[(l + 1) % n.length], e, t)
|
|
2997
3268
|
), i = s.findIndex(Boolean);
|
|
2998
3269
|
if (i < 0)
|
|
2999
3270
|
return [[...n, n[0]]];
|
|
3000
3271
|
const o = [];
|
|
3001
3272
|
let a = [];
|
|
3002
|
-
for (let
|
|
3003
|
-
const
|
|
3004
|
-
if (s[
|
|
3273
|
+
for (let u = 1; u <= n.length; u += 1) {
|
|
3274
|
+
const l = (i + u) % n.length, c = (l + 1) % n.length;
|
|
3275
|
+
if (s[l]) {
|
|
3005
3276
|
a.length > 1 && o.push(a), a = [];
|
|
3006
3277
|
continue;
|
|
3007
3278
|
}
|
|
3008
|
-
a.length === 0 && a.push(n[
|
|
3279
|
+
a.length === 0 && a.push(n[l]), a.push(n[c]);
|
|
3009
3280
|
}
|
|
3010
3281
|
return a.length > 1 && o.push(a), o;
|
|
3011
3282
|
}
|
|
3012
|
-
function
|
|
3283
|
+
function Hr(r = {}) {
|
|
3013
3284
|
return r.type === "Polygon" ? r.coordinates || [] : r.type === "MultiPolygon" ? (r.coordinates || []).flatMap((e) => e) : [];
|
|
3014
3285
|
}
|
|
3015
|
-
function
|
|
3016
|
-
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]);
|
|
3017
|
-
}
|
|
3018
|
-
function mr(r = [], e = 0) {
|
|
3019
|
-
const t = Math.min(Math.max(Math.floor(e), 0), 3);
|
|
3020
|
-
if (t === 0 || r.length < 3) return r;
|
|
3021
|
-
const n = Ir(r[0], r[r.length - 1]);
|
|
3022
|
-
let s = n ? r.slice(0, -1) : [...r];
|
|
3023
|
-
for (let i = 0; i < t; i += 1) {
|
|
3024
|
-
const o = n ? [] : [s[0]], a = n ? s.length : s.length - 1;
|
|
3025
|
-
for (let l = 0; l < a; l += 1) {
|
|
3026
|
-
const u = s[l], c = s[(l + 1) % s.length];
|
|
3027
|
-
o.push([
|
|
3028
|
-
u[0] * 0.75 + c[0] * 0.25,
|
|
3029
|
-
u[1] * 0.75 + c[1] * 0.25
|
|
3030
|
-
]), o.push([
|
|
3031
|
-
u[0] * 0.25 + c[0] * 0.75,
|
|
3032
|
-
u[1] * 0.25 + c[1] * 0.75
|
|
3033
|
-
]);
|
|
3034
|
-
}
|
|
3035
|
-
n || o.push(s[s.length - 1]), s = o;
|
|
3036
|
-
}
|
|
3037
|
-
return n ? [...s, s[0]] : s;
|
|
3038
|
-
}
|
|
3039
|
-
function gr(r, e, t = 6) {
|
|
3286
|
+
function it(r, e, t = 6) {
|
|
3040
3287
|
const n = 10 ** Math.max(Math.floor(t), 0), s = [];
|
|
3041
3288
|
return r.forEach((i) => {
|
|
3042
3289
|
const o = e(i[0], i[1]);
|
|
3043
3290
|
if (!(o != null && o.every(Number.isFinite))) return;
|
|
3044
|
-
const a = o.map((
|
|
3045
|
-
(!
|
|
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);
|
|
3046
3293
|
}), s;
|
|
3047
3294
|
}
|
|
3048
|
-
function
|
|
3295
|
+
function Yr(r = {}) {
|
|
3049
3296
|
const e = r && typeof r == "object" ? r : {};
|
|
3050
3297
|
return {
|
|
3051
3298
|
enabled: e.enabled === !0,
|
|
3052
3299
|
radius: Math.max(
|
|
3053
|
-
Math.floor(
|
|
3300
|
+
Math.floor(N(e.radius, K.radius)),
|
|
3054
3301
|
1
|
|
3055
3302
|
),
|
|
3056
3303
|
minProminence: Math.max(
|
|
3057
|
-
|
|
3304
|
+
N(e.minProminence, K.minProminence),
|
|
3058
3305
|
0
|
|
3059
3306
|
),
|
|
3060
3307
|
minGridDistance: Math.max(
|
|
3061
|
-
|
|
3308
|
+
N(e.minGridDistance, K.minGridDistance),
|
|
3062
3309
|
0
|
|
3063
3310
|
),
|
|
3064
3311
|
maxCount: Math.max(
|
|
3065
|
-
Math.floor(
|
|
3312
|
+
Math.floor(N(e.maxCount, K.maxCount)),
|
|
3066
3313
|
0
|
|
3067
3314
|
),
|
|
3068
3315
|
includeHigh: e.includeHigh !== !1,
|
|
@@ -3071,9 +3318,9 @@ function br(r = {}) {
|
|
|
3071
3318
|
smoothingIterations: Math.min(
|
|
3072
3319
|
Math.max(
|
|
3073
3320
|
Math.floor(
|
|
3074
|
-
|
|
3321
|
+
N(
|
|
3075
3322
|
e.smoothingIterations,
|
|
3076
|
-
|
|
3323
|
+
K.smoothingIterations
|
|
3077
3324
|
)
|
|
3078
3325
|
),
|
|
3079
3326
|
0
|
|
@@ -3082,8 +3329,8 @@ function br(r = {}) {
|
|
|
3082
3329
|
)
|
|
3083
3330
|
};
|
|
3084
3331
|
}
|
|
3085
|
-
function
|
|
3086
|
-
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;
|
|
3087
3334
|
if (t === 1)
|
|
3088
3335
|
return {
|
|
3089
3336
|
width: r.width,
|
|
@@ -3096,16 +3343,16 @@ function pr(r) {
|
|
|
3096
3343
|
};
|
|
3097
3344
|
const n = Math.ceil(r.width / t), s = Math.ceil(r.height / t), i = new Float64Array(n * s);
|
|
3098
3345
|
for (let o = 0; o < s; o += 1) {
|
|
3099
|
-
const a = o * t,
|
|
3100
|
-
for (let
|
|
3101
|
-
const c =
|
|
3102
|
-
let
|
|
3103
|
-
for (let
|
|
3104
|
-
for (let
|
|
3105
|
-
const
|
|
3106
|
-
Number.isFinite(
|
|
3346
|
+
const a = o * t, u = Math.min(a + t - 1, r.height - 1);
|
|
3347
|
+
for (let l = 0; l < n; l += 1) {
|
|
3348
|
+
const c = l * t, h = Math.min(c + t - 1, r.width - 1);
|
|
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);
|
|
3107
3354
|
}
|
|
3108
|
-
i[o * n +
|
|
3355
|
+
i[o * n + l] = f > 0 ? d / f : Number.NaN;
|
|
3109
3356
|
}
|
|
3110
3357
|
}
|
|
3111
3358
|
return {
|
|
@@ -3114,133 +3361,133 @@ function pr(r) {
|
|
|
3114
3361
|
values: i,
|
|
3115
3362
|
stride: t,
|
|
3116
3363
|
getSourceBounds(o, a) {
|
|
3117
|
-
const
|
|
3364
|
+
const u = o * t, l = a * t;
|
|
3118
3365
|
return {
|
|
3119
|
-
startX:
|
|
3120
|
-
endX: Math.min(
|
|
3121
|
-
startY:
|
|
3122
|
-
endY: Math.min(
|
|
3366
|
+
startX: u,
|
|
3367
|
+
endX: Math.min(u + t - 1, r.width - 1),
|
|
3368
|
+
startY: l,
|
|
3369
|
+
endY: Math.min(l + t - 1, r.height - 1)
|
|
3123
3370
|
};
|
|
3124
3371
|
}
|
|
3125
3372
|
};
|
|
3126
3373
|
}
|
|
3127
|
-
function
|
|
3374
|
+
function Xr(r, e, t, n) {
|
|
3128
3375
|
let s = r;
|
|
3129
3376
|
for (let i = 0; i < n; i += 1) {
|
|
3130
3377
|
const o = new Float64Array(r.length);
|
|
3131
3378
|
for (let a = 0; a < t; a += 1)
|
|
3132
|
-
for (let
|
|
3133
|
-
const
|
|
3134
|
-
if (!Number.isFinite(Number(s[
|
|
3135
|
-
o[
|
|
3379
|
+
for (let u = 0; u < e; u += 1) {
|
|
3380
|
+
const l = a * e + u;
|
|
3381
|
+
if (!Number.isFinite(Number(s[l]))) {
|
|
3382
|
+
o[l] = Number.NaN;
|
|
3136
3383
|
continue;
|
|
3137
3384
|
}
|
|
3138
3385
|
let c = 0, h = 0;
|
|
3139
|
-
for (let
|
|
3140
|
-
const
|
|
3141
|
-
if (!(
|
|
3142
|
-
for (let
|
|
3143
|
-
const
|
|
3144
|
-
if (
|
|
3145
|
-
const
|
|
3146
|
-
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);
|
|
3147
3394
|
}
|
|
3148
3395
|
}
|
|
3149
|
-
o[
|
|
3396
|
+
o[l] = h > 0 ? c / h : Number.NaN;
|
|
3150
3397
|
}
|
|
3151
3398
|
s = o;
|
|
3152
3399
|
}
|
|
3153
3400
|
return s;
|
|
3154
3401
|
}
|
|
3155
|
-
function
|
|
3402
|
+
function Kr(r, e, t) {
|
|
3156
3403
|
const n = e + 1, s = new Float64Array(n * (t + 1)), i = new Uint32Array(n * (t + 1));
|
|
3157
3404
|
for (let o = 0; o < t; o += 1) {
|
|
3158
|
-
let a = 0,
|
|
3159
|
-
for (let
|
|
3160
|
-
const c = Number(r[o * e +
|
|
3161
|
-
Number.isFinite(c) && (a += c,
|
|
3162
|
-
const h = (o + 1) * n +
|
|
3163
|
-
s[h] = s[o * n +
|
|
3405
|
+
let a = 0, u = 0;
|
|
3406
|
+
for (let l = 0; l < e; l += 1) {
|
|
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;
|
|
3164
3411
|
}
|
|
3165
3412
|
}
|
|
3166
3413
|
return {
|
|
3167
|
-
query(o, a,
|
|
3168
|
-
const c = Math.max(Math.min(o, e - 1), 0), h = Math.max(Math.min(a, t - 1), 0),
|
|
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;
|
|
3169
3416
|
return {
|
|
3170
|
-
sum: s[
|
|
3171
|
-
count: i[
|
|
3172
|
-
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)
|
|
3173
3420
|
};
|
|
3174
3421
|
}
|
|
3175
3422
|
};
|
|
3176
3423
|
}
|
|
3177
|
-
function
|
|
3424
|
+
function Zr(r, e, t, n, s, i) {
|
|
3178
3425
|
const o = s * e + n, a = Number(r[o]);
|
|
3179
3426
|
if (!Number.isFinite(a)) return [];
|
|
3180
|
-
let
|
|
3181
|
-
for (let
|
|
3182
|
-
const
|
|
3183
|
-
if (!(
|
|
3184
|
-
for (let
|
|
3185
|
-
if (
|
|
3186
|
-
const
|
|
3187
|
-
if (
|
|
3188
|
-
const
|
|
3189
|
-
if (!Number.isFinite(
|
|
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)) {
|
|
3190
3437
|
if (i.excludeBoundary) return [];
|
|
3191
3438
|
continue;
|
|
3192
3439
|
}
|
|
3193
|
-
|
|
3440
|
+
d += 1, w > a ? (u = !1, h = !0) : w < a ? (l = !1, c = !0) : b < o && (u = !1, l = !1);
|
|
3194
3441
|
}
|
|
3195
3442
|
}
|
|
3196
|
-
if (
|
|
3197
|
-
const
|
|
3198
|
-
return
|
|
3443
|
+
if (d < 3) return [];
|
|
3444
|
+
const f = [];
|
|
3445
|
+
return u && c && f.push("H"), l && h && f.push("L"), f;
|
|
3199
3446
|
}
|
|
3200
|
-
function
|
|
3447
|
+
function Jr(r, e, t, n) {
|
|
3201
3448
|
const s = e.getSourceBounds(r.gridX, r.gridY), i = (s.startX + s.endX) / 2, o = (s.startY + s.endY) / 2;
|
|
3202
3449
|
let a = null;
|
|
3203
|
-
for (let
|
|
3450
|
+
for (let l = s.startY; l <= s.endY; l += 1)
|
|
3204
3451
|
for (let c = s.startX; c <= s.endX; c += 1) {
|
|
3205
|
-
if (n.excludeBoundary && (c < n.radius ||
|
|
3452
|
+
if (n.excludeBoundary && (c < n.radius || l < n.radius || c >= t.width - n.radius || l >= t.height - n.radius))
|
|
3206
3453
|
continue;
|
|
3207
|
-
const h = Number(t.values[
|
|
3454
|
+
const h = Number(t.values[l * t.width + c]);
|
|
3208
3455
|
if (!Number.isFinite(h)) continue;
|
|
3209
|
-
const
|
|
3210
|
-
(
|
|
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 });
|
|
3211
3458
|
}
|
|
3212
3459
|
if (!a) return null;
|
|
3213
|
-
const
|
|
3214
|
-
return
|
|
3460
|
+
const u = t.mapCoordinate(a.x, a.y);
|
|
3461
|
+
return u != null && u.every(Number.isFinite) ? {
|
|
3215
3462
|
...r,
|
|
3216
3463
|
value: a.value,
|
|
3217
|
-
lat:
|
|
3218
|
-
lon:
|
|
3464
|
+
lat: u[0],
|
|
3465
|
+
lon: u[1],
|
|
3219
3466
|
sourceX: a.x,
|
|
3220
3467
|
sourceY: a.y
|
|
3221
3468
|
} : null;
|
|
3222
3469
|
}
|
|
3223
|
-
function
|
|
3470
|
+
function Ge(r, e) {
|
|
3224
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;
|
|
3225
3472
|
}
|
|
3226
|
-
function
|
|
3473
|
+
function Qr(r, e) {
|
|
3227
3474
|
const t = e ** 2, n = [];
|
|
3228
|
-
return r.sort(
|
|
3475
|
+
return r.sort(Ge).forEach((s) => {
|
|
3229
3476
|
n.some(
|
|
3230
3477
|
(o) => o.type === s.type && (o.sourceX - s.sourceX) ** 2 + (o.sourceY - s.sourceY) ** 2 < t
|
|
3231
3478
|
) || n.push(s);
|
|
3232
3479
|
}), n;
|
|
3233
3480
|
}
|
|
3234
|
-
function
|
|
3235
|
-
const t =
|
|
3481
|
+
function en(r, e = {}) {
|
|
3482
|
+
const t = Yr(e);
|
|
3236
3483
|
if (!t.enabled || t.maxCount === 0 || !t.includeHigh && !t.includeLow || r.width < 3 || r.height < 3)
|
|
3237
3484
|
return [];
|
|
3238
|
-
const n =
|
|
3485
|
+
const n = qr(r), s = Xr(
|
|
3239
3486
|
n.values,
|
|
3240
3487
|
n.width,
|
|
3241
3488
|
n.height,
|
|
3242
3489
|
t.smoothingIterations
|
|
3243
|
-
), i =
|
|
3490
|
+
), i = Kr(
|
|
3244
3491
|
s,
|
|
3245
3492
|
n.width,
|
|
3246
3493
|
n.height
|
|
@@ -3249,9 +3496,9 @@ function wr(r, e = {}) {
|
|
|
3249
3496
|
for (let h = 0; h < n.width; h += 1) {
|
|
3250
3497
|
if (t.excludeBoundary && (h < o || c < o || h >= n.width - o || c >= n.height - o))
|
|
3251
3498
|
continue;
|
|
3252
|
-
const
|
|
3253
|
-
if (!Number.isFinite(
|
|
3254
|
-
const
|
|
3499
|
+
const d = Number(s[c * n.width + h]);
|
|
3500
|
+
if (!Number.isFinite(d)) continue;
|
|
3501
|
+
const f = Zr(
|
|
3255
3502
|
s,
|
|
3256
3503
|
n.width,
|
|
3257
3504
|
n.height,
|
|
@@ -3259,68 +3506,81 @@ function wr(r, e = {}) {
|
|
|
3259
3506
|
c,
|
|
3260
3507
|
t
|
|
3261
3508
|
);
|
|
3262
|
-
if (
|
|
3263
|
-
const
|
|
3509
|
+
if (f.length === 0) continue;
|
|
3510
|
+
const y = i.query(
|
|
3264
3511
|
h - o,
|
|
3265
3512
|
c - o,
|
|
3266
3513
|
h + o,
|
|
3267
3514
|
c + o
|
|
3268
3515
|
);
|
|
3269
|
-
if (t.excludeBoundary &&
|
|
3270
|
-
const
|
|
3271
|
-
if (
|
|
3272
|
-
const
|
|
3273
|
-
|
|
3274
|
-
const
|
|
3275
|
-
|
|
3276
|
-
type:
|
|
3277
|
-
label:
|
|
3278
|
-
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,
|
|
3279
3526
|
gridX: h,
|
|
3280
3527
|
gridY: c
|
|
3281
3528
|
});
|
|
3282
3529
|
});
|
|
3283
3530
|
}
|
|
3284
|
-
const
|
|
3285
|
-
return
|
|
3286
|
-
(c, h) => h.prominence - c.prominence ||
|
|
3287
|
-
).slice(0, t.maxCount).sort(
|
|
3288
|
-
}
|
|
3289
|
-
function
|
|
3290
|
-
|
|
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);
|
|
3291
3539
|
if (t.min === t.max)
|
|
3292
3540
|
throw new Error("栅格数值全部相同,无法生成等值线。");
|
|
3293
|
-
const n =
|
|
3294
|
-
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)
|
|
3295
3543
|
throw new Error("当前值域内没有可用的等值线级别。");
|
|
3296
|
-
const
|
|
3297
|
-
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)),
|
|
3298
3546
|
2
|
|
3299
|
-
),
|
|
3300
|
-
Math.max(Math.floor(
|
|
3547
|
+
), f = Math.min(
|
|
3548
|
+
Math.max(Math.floor(N(e.smoothingIterations, 0)), 0),
|
|
3301
3549
|
3
|
|
3302
|
-
),
|
|
3303
|
-
const
|
|
3304
|
-
(
|
|
3305
|
-
)
|
|
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);
|
|
3306
3560
|
return {
|
|
3307
|
-
value:
|
|
3308
|
-
label: String(
|
|
3309
|
-
lines:
|
|
3561
|
+
value: b.value,
|
|
3562
|
+
label: String(b.value),
|
|
3563
|
+
lines: S
|
|
3310
3564
|
};
|
|
3311
|
-
}),
|
|
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);
|
|
3312
3566
|
return {
|
|
3313
|
-
isolines:
|
|
3314
|
-
centers:
|
|
3315
|
-
|
|
3567
|
+
isolines: y,
|
|
3568
|
+
centers: v,
|
|
3569
|
+
centerDiagnostics: (I == null ? void 0 : I.stats) || null,
|
|
3570
|
+
thresholds: c,
|
|
3316
3571
|
range: t,
|
|
3572
|
+
// 报告真实计算网格尺寸,内部的两列周期补边不计入业务格点数。
|
|
3317
3573
|
renderWidth: n.width,
|
|
3318
3574
|
renderHeight: n.height,
|
|
3319
3575
|
downsampled: !!n.downsampled,
|
|
3320
|
-
|
|
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)
|
|
3321
3581
|
};
|
|
3322
3582
|
}
|
|
3323
|
-
const
|
|
3583
|
+
const St = /* @__PURE__ */ new Set([
|
|
3324
3584
|
"arrayBuffer",
|
|
3325
3585
|
"area",
|
|
3326
3586
|
"band",
|
|
@@ -3338,6 +3598,7 @@ const Gr = /* @__PURE__ */ new Set([
|
|
|
3338
3598
|
"grayMaxValue",
|
|
3339
3599
|
"grayMinValue",
|
|
3340
3600
|
"grid",
|
|
3601
|
+
"gridSmoothing",
|
|
3341
3602
|
"imageIndex",
|
|
3342
3603
|
"imageUrl",
|
|
3343
3604
|
"interval",
|
|
@@ -3366,8 +3627,9 @@ const Gr = /* @__PURE__ */ new Set([
|
|
|
3366
3627
|
"validMin",
|
|
3367
3628
|
"values",
|
|
3368
3629
|
"width",
|
|
3369
|
-
"height"
|
|
3370
|
-
|
|
3630
|
+
"height",
|
|
3631
|
+
"wrapLongitude"
|
|
3632
|
+
]), rn = /* @__PURE__ */ new Set([
|
|
3371
3633
|
"arrayBuffer",
|
|
3372
3634
|
"area",
|
|
3373
3635
|
"band",
|
|
@@ -3402,18 +3664,18 @@ const Gr = /* @__PURE__ */ new Set([
|
|
|
3402
3664
|
"values",
|
|
3403
3665
|
"width"
|
|
3404
3666
|
]);
|
|
3405
|
-
function
|
|
3667
|
+
function nn(r = {}) {
|
|
3406
3668
|
const { mapCore: e, baseGIS: t, ...n } = r;
|
|
3407
3669
|
return n;
|
|
3408
3670
|
}
|
|
3409
|
-
function
|
|
3671
|
+
function sn(r = {}) {
|
|
3410
3672
|
var e;
|
|
3411
3673
|
return ((e = r.centerDetection) == null ? void 0 : e.enabled) === !0;
|
|
3412
3674
|
}
|
|
3413
|
-
function
|
|
3675
|
+
function on(r, e, t = null) {
|
|
3414
3676
|
const n = {};
|
|
3415
3677
|
Object.entries(r).forEach(([i, o]) => {
|
|
3416
|
-
|
|
3678
|
+
St.has(i) || (n[i] = o);
|
|
3417
3679
|
});
|
|
3418
3680
|
const s = {
|
|
3419
3681
|
...n,
|
|
@@ -3423,35 +3685,40 @@ function Ar(r, e, t = null) {
|
|
|
3423
3685
|
worldCopyArea: r.worldCopyArea || t,
|
|
3424
3686
|
isolines: e.isolines
|
|
3425
3687
|
};
|
|
3426
|
-
return s.centers = Array.isArray(r.centers) ? r.centers :
|
|
3688
|
+
return s.centers = Array.isArray(r.centers) ? r.centers : sn(r) ? e.centers : [], s;
|
|
3427
3689
|
}
|
|
3428
|
-
function
|
|
3690
|
+
function U() {
|
|
3429
3691
|
return typeof performance < "u" ? performance.now() : Date.now();
|
|
3430
3692
|
}
|
|
3431
|
-
function
|
|
3693
|
+
function an(r) {
|
|
3432
3694
|
var t, n;
|
|
3433
3695
|
const e = (n = (t = r == null ? void 0 : r.getConfig) == null ? void 0 : t.call(r)) == null ? void 0 : n.sourceProjectionCrs;
|
|
3434
3696
|
return e != null && String(e).trim() !== "" ? e : "";
|
|
3435
3697
|
}
|
|
3436
|
-
function
|
|
3437
|
-
return Object.keys(r).some((e) =>
|
|
3698
|
+
function ln(r = {}) {
|
|
3699
|
+
return Object.keys(r).some((e) => rn.has(e));
|
|
3438
3700
|
}
|
|
3439
|
-
class
|
|
3701
|
+
class Mn {
|
|
3440
3702
|
constructor(e = {}) {
|
|
3441
|
-
const t =
|
|
3703
|
+
const t = nn(e), n = t.layerId || t.contourLayerId || "raster-contour-default";
|
|
3442
3704
|
this.defaultPayload = {
|
|
3443
3705
|
thresholdCount: 12,
|
|
3444
3706
|
maxCells: 1e6,
|
|
3445
3707
|
smooth: !0,
|
|
3446
3708
|
excludeBoundary: !0,
|
|
3447
3709
|
visible: !0,
|
|
3710
|
+
wrapLongitude: !1,
|
|
3448
3711
|
...t,
|
|
3712
|
+
gridSmoothing: {
|
|
3713
|
+
...ie,
|
|
3714
|
+
...t.gridSmoothing || {}
|
|
3715
|
+
},
|
|
3449
3716
|
centerDetection: {
|
|
3450
|
-
...
|
|
3717
|
+
...K,
|
|
3451
3718
|
...t.centerDetection || {}
|
|
3452
3719
|
},
|
|
3453
3720
|
layerId: n
|
|
3454
|
-
}, 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 = {
|
|
3455
3722
|
layerId: n,
|
|
3456
3723
|
sourceType: "",
|
|
3457
3724
|
sourceUrl: "",
|
|
@@ -3470,6 +3737,7 @@ class Zr {
|
|
|
3470
3737
|
levelCount: 0,
|
|
3471
3738
|
lineCount: 0,
|
|
3472
3739
|
centerCount: 0,
|
|
3740
|
+
centerDiagnostics: null,
|
|
3473
3741
|
lineLabelCount: 0,
|
|
3474
3742
|
centerLabelCount: 0,
|
|
3475
3743
|
labelCount: 0,
|
|
@@ -3478,6 +3746,11 @@ class Zr {
|
|
|
3478
3746
|
area: null,
|
|
3479
3747
|
sourceElapsed: 0,
|
|
3480
3748
|
generateElapsed: 0,
|
|
3749
|
+
gridSmoothingElapsed: 0,
|
|
3750
|
+
gridSmoothing: { ...this.defaultPayload.gridSmoothing },
|
|
3751
|
+
wrapLongitude: !1,
|
|
3752
|
+
pointCount: 0,
|
|
3753
|
+
contoursReused: !1,
|
|
3481
3754
|
renderElapsed: 0,
|
|
3482
3755
|
lineBuildElapsed: 0,
|
|
3483
3756
|
labelLayoutElapsed: 0,
|
|
@@ -3494,37 +3767,37 @@ class Zr {
|
|
|
3494
3767
|
}
|
|
3495
3768
|
resolveBaseGIS() {
|
|
3496
3769
|
var e, t;
|
|
3497
|
-
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(
|
|
3498
3771
|
"Map instance is not ready. Please call mapCore.init() first.",
|
|
3499
3772
|
"NOT_INITIALIZED"
|
|
3500
|
-
) :
|
|
3773
|
+
) : m("RasterContourController has not been mounted.", "NOT_MOUNTED");
|
|
3501
3774
|
}
|
|
3502
|
-
async renderGrid(e, t, n, s, i = !1, o = 0) {
|
|
3503
|
-
var
|
|
3504
|
-
const
|
|
3505
|
-
|
|
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) => {
|
|
3506
3779
|
n === this.operationId && (this.state = {
|
|
3507
3780
|
...this.state,
|
|
3508
|
-
lineCount: (
|
|
3509
|
-
centerCount: (
|
|
3510
|
-
lineLabelCount: (
|
|
3511
|
-
centerLabelCount: (
|
|
3512
|
-
labelCount: (
|
|
3513
|
-
lineRenderer: (
|
|
3514
|
-
lineBuildElapsed: (
|
|
3515
|
-
labelLayoutElapsed: (
|
|
3516
|
-
primitiveReadyElapsed: (
|
|
3517
|
-
visible: (
|
|
3518
|
-
},
|
|
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));
|
|
3519
3792
|
};
|
|
3520
|
-
const
|
|
3793
|
+
const y = U(), I = i ? await this.contourController.update(h) : await this.contourController.load(h), v = U() - y;
|
|
3521
3794
|
if (!I.success) return I;
|
|
3522
3795
|
if (n !== this.operationId)
|
|
3523
|
-
return
|
|
3524
|
-
const
|
|
3525
|
-
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 = {
|
|
3526
3799
|
...this.state,
|
|
3527
|
-
layerId:
|
|
3800
|
+
layerId: h.layerId,
|
|
3528
3801
|
sourceType: e.sourceType,
|
|
3529
3802
|
sourceUrl: e.sourceUrl,
|
|
3530
3803
|
sourceProjectionCrs: e.sourceProjectionCrs || e.sourceProjection,
|
|
@@ -3541,33 +3814,39 @@ class Zr {
|
|
|
3541
3814
|
noDataCount: l.range.noDataCount,
|
|
3542
3815
|
levelCount: l.thresholds.length,
|
|
3543
3816
|
lineCount: l.lineCount,
|
|
3544
|
-
centerCount: (
|
|
3545
|
-
lineLabelCount: (
|
|
3546
|
-
centerLabelCount: (
|
|
3547
|
-
labelCount: (
|
|
3548
|
-
lineRenderer: (
|
|
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) || "",
|
|
3549
3822
|
thresholds: l.thresholds,
|
|
3550
3823
|
area: e.area,
|
|
3551
3824
|
sourceElapsed: o,
|
|
3552
|
-
generateElapsed:
|
|
3553
|
-
|
|
3554
|
-
|
|
3555
|
-
|
|
3556
|
-
|
|
3557
|
-
|
|
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,
|
|
3558
3837
|
downsampled: l.downsampled,
|
|
3559
|
-
visible:
|
|
3838
|
+
visible: h.visible !== !1,
|
|
3560
3839
|
loaded: !0
|
|
3561
|
-
},
|
|
3840
|
+
}, p(
|
|
3562
3841
|
{
|
|
3563
3842
|
...this.getState(),
|
|
3564
|
-
contourState:
|
|
3843
|
+
contourState: b
|
|
3565
3844
|
},
|
|
3566
|
-
i ? `Raster contour layer "${
|
|
3845
|
+
i ? `Raster contour layer "${h.layerId}" ${a ? "updated" : "regenerated"}.` : `Raster contour layer "${h.layerId}" loaded.`
|
|
3567
3846
|
);
|
|
3568
3847
|
}
|
|
3569
3848
|
async load(e = {}, t = {}) {
|
|
3570
|
-
var a;
|
|
3849
|
+
var a, u;
|
|
3571
3850
|
const n = this.resolveBaseGIS();
|
|
3572
3851
|
if (!n.success) return n;
|
|
3573
3852
|
const s = {
|
|
@@ -3575,25 +3854,31 @@ class Zr {
|
|
|
3575
3854
|
...this.currentPayload || {},
|
|
3576
3855
|
...e,
|
|
3577
3856
|
...t,
|
|
3857
|
+
gridSmoothing: {
|
|
3858
|
+
...this.defaultPayload.gridSmoothing,
|
|
3859
|
+
...((a = this.currentPayload) == null ? void 0 : a.gridSmoothing) || {},
|
|
3860
|
+
...e.gridSmoothing || {},
|
|
3861
|
+
...t.gridSmoothing || {}
|
|
3862
|
+
},
|
|
3578
3863
|
centerDetection: {
|
|
3579
3864
|
...this.defaultPayload.centerDetection,
|
|
3580
|
-
...((
|
|
3865
|
+
...((u = this.currentPayload) == null ? void 0 : u.centerDetection) || {},
|
|
3581
3866
|
...e.centerDetection || {},
|
|
3582
3867
|
...t.centerDetection || {}
|
|
3583
3868
|
}
|
|
3584
|
-
}, i = ++this.operationId, o =
|
|
3869
|
+
}, i = ++this.operationId, o = U();
|
|
3585
3870
|
try {
|
|
3586
|
-
const l =
|
|
3587
|
-
return i !== this.operationId ?
|
|
3588
|
-
|
|
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,
|
|
3589
3874
|
s,
|
|
3590
3875
|
i,
|
|
3591
3876
|
o,
|
|
3592
3877
|
!1,
|
|
3593
|
-
|
|
3878
|
+
d
|
|
3594
3879
|
);
|
|
3595
3880
|
} catch (l) {
|
|
3596
|
-
return
|
|
3881
|
+
return m(
|
|
3597
3882
|
(l == null ? void 0 : l.message) || "Raster contour generation failed.",
|
|
3598
3883
|
"RASTER_CONTOUR_FAILED"
|
|
3599
3884
|
);
|
|
@@ -3610,29 +3895,35 @@ class Zr {
|
|
|
3610
3895
|
}
|
|
3611
3896
|
async update(e = {}) {
|
|
3612
3897
|
if (!this.currentPayload || !this.currentGrid)
|
|
3613
|
-
return
|
|
3614
|
-
if (
|
|
3898
|
+
return m("Raster contour source has not been loaded.", "NOT_LOADED");
|
|
3899
|
+
if (ln(e))
|
|
3615
3900
|
return this.load(e);
|
|
3616
3901
|
const t = this.resolveBaseGIS();
|
|
3617
3902
|
if (!t.success) return t;
|
|
3618
3903
|
const n = {
|
|
3619
3904
|
...this.currentPayload,
|
|
3620
3905
|
...e,
|
|
3906
|
+
gridSmoothing: {
|
|
3907
|
+
...this.currentPayload.gridSmoothing || {},
|
|
3908
|
+
...e.gridSmoothing || {}
|
|
3909
|
+
},
|
|
3621
3910
|
centerDetection: {
|
|
3622
3911
|
...this.currentPayload.centerDetection || {},
|
|
3623
3912
|
...e.centerDetection || {}
|
|
3624
3913
|
}
|
|
3625
|
-
}, s = ++this.operationId, i =
|
|
3914
|
+
}, s = ++this.operationId, i = U();
|
|
3626
3915
|
try {
|
|
3627
3916
|
return await this.renderGrid(
|
|
3628
3917
|
this.currentGrid,
|
|
3629
3918
|
n,
|
|
3630
3919
|
s,
|
|
3631
3920
|
i,
|
|
3632
|
-
!0
|
|
3921
|
+
!0,
|
|
3922
|
+
0,
|
|
3923
|
+
Object.keys(e).some((o) => St.has(o)) ? null : this.currentContourData
|
|
3633
3924
|
);
|
|
3634
3925
|
} catch (o) {
|
|
3635
|
-
return
|
|
3926
|
+
return m(
|
|
3636
3927
|
(o == null ? void 0 : o.message) || "Raster contour regeneration failed.",
|
|
3637
3928
|
"RASTER_CONTOUR_FAILED"
|
|
3638
3929
|
);
|
|
@@ -3640,11 +3931,11 @@ class Zr {
|
|
|
3640
3931
|
}
|
|
3641
3932
|
show() {
|
|
3642
3933
|
const e = this.contourController.show();
|
|
3643
|
-
return e.success && (this.state.visible = !0), e;
|
|
3934
|
+
return e.success && (this.state.visible = !0, this.currentPayload && (this.currentPayload.visible = !0)), e;
|
|
3644
3935
|
}
|
|
3645
3936
|
hide() {
|
|
3646
3937
|
const e = this.contourController.hide();
|
|
3647
|
-
return e.success && (this.state.visible = !1), e;
|
|
3938
|
+
return e.success && (this.state.visible = !1, this.currentPayload && (this.currentPayload.visible = !1)), e;
|
|
3648
3939
|
}
|
|
3649
3940
|
toggle(e) {
|
|
3650
3941
|
return typeof e == "boolean" ? e ? this.show() : this.hide() : this.state.visible ? this.hide() : this.show();
|
|
@@ -3652,32 +3943,38 @@ class Zr {
|
|
|
3652
3943
|
clear() {
|
|
3653
3944
|
this.operationId += 1;
|
|
3654
3945
|
const e = this.contourController.clear();
|
|
3655
|
-
return e.success && (this.state = {
|
|
3946
|
+
return e.success && (this.currentContourData = null, this.state = {
|
|
3656
3947
|
...this.state,
|
|
3657
3948
|
levelCount: 0,
|
|
3658
3949
|
lineCount: 0,
|
|
3659
3950
|
centerCount: 0,
|
|
3951
|
+
centerDiagnostics: null,
|
|
3660
3952
|
lineLabelCount: 0,
|
|
3661
3953
|
centerLabelCount: 0,
|
|
3662
3954
|
labelCount: 0,
|
|
3663
3955
|
thresholds: [],
|
|
3664
|
-
loaded: !1
|
|
3956
|
+
loaded: !1,
|
|
3957
|
+
pointCount: 0,
|
|
3958
|
+
contoursReused: !1
|
|
3665
3959
|
}), e;
|
|
3666
3960
|
}
|
|
3667
3961
|
destroy() {
|
|
3668
3962
|
this.operationId += 1;
|
|
3669
3963
|
const e = this.contourController.destroy();
|
|
3670
|
-
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 = {
|
|
3671
3965
|
...this.state,
|
|
3672
3966
|
levelCount: 0,
|
|
3673
3967
|
lineCount: 0,
|
|
3674
3968
|
centerCount: 0,
|
|
3969
|
+
centerDiagnostics: null,
|
|
3675
3970
|
lineLabelCount: 0,
|
|
3676
3971
|
centerLabelCount: 0,
|
|
3677
3972
|
labelCount: 0,
|
|
3678
3973
|
thresholds: [],
|
|
3679
3974
|
loaded: !1,
|
|
3680
|
-
visible: !1
|
|
3975
|
+
visible: !1,
|
|
3976
|
+
pointCount: 0,
|
|
3977
|
+
contoursReused: !1
|
|
3681
3978
|
}, e;
|
|
3682
3979
|
}
|
|
3683
3980
|
getRasterData() {
|
|
@@ -3692,7 +3989,7 @@ class Zr {
|
|
|
3692
3989
|
};
|
|
3693
3990
|
}
|
|
3694
3991
|
}
|
|
3695
|
-
const
|
|
3992
|
+
const ot = [
|
|
3696
3993
|
{ value: 0, color: [36, 88, 190] },
|
|
3697
3994
|
{ value: 2, color: [36, 145, 184] },
|
|
3698
3995
|
{ value: 5, color: [54, 177, 111] },
|
|
@@ -3700,7 +3997,7 @@ const ze = [
|
|
|
3700
3997
|
{ value: 11, color: [229, 178, 78] },
|
|
3701
3998
|
{ value: 14, color: [224, 103, 117] },
|
|
3702
3999
|
{ value: 18, color: [162, 82, 202] }
|
|
3703
|
-
],
|
|
4000
|
+
], at = [
|
|
3704
4001
|
{ value: 0, color: [178, 223, 255] },
|
|
3705
4002
|
{ value: 3, color: [190, 248, 222] },
|
|
3706
4003
|
{ value: 6, color: [235, 252, 174] },
|
|
@@ -3708,10 +4005,10 @@ const ze = [
|
|
|
3708
4005
|
{ value: 14, color: [255, 166, 156] },
|
|
3709
4006
|
{ value: 18, color: [232, 153, 255] }
|
|
3710
4007
|
];
|
|
3711
|
-
function
|
|
4008
|
+
function E(r, e, t) {
|
|
3712
4009
|
return Math.min(Math.max(r, e), t);
|
|
3713
4010
|
}
|
|
3714
|
-
function
|
|
4011
|
+
function un(r) {
|
|
3715
4012
|
if (Array.isArray(r) && r.length >= 3)
|
|
3716
4013
|
return [Number(r[0]) || 0, Number(r[1]) || 0, Number(r[2]) || 0];
|
|
3717
4014
|
if (typeof r != "string")
|
|
@@ -3729,14 +4026,14 @@ function Dr(r) {
|
|
|
3729
4026
|
const n = t[1].split(",").map((s) => Number(s.trim()));
|
|
3730
4027
|
return n.length < 3 || n.slice(0, 3).some((s) => !Number.isFinite(s)) ? null : n.slice(0, 3);
|
|
3731
4028
|
}
|
|
3732
|
-
function
|
|
4029
|
+
function ce(r, e) {
|
|
3733
4030
|
const n = (Array.isArray(r) && r.length > 0 ? r : e).map((s, i) => {
|
|
3734
|
-
const o = Number((s == null ? void 0 : s.value) ?? (s == null ? void 0 : s.speed) ?? (s == null ? void 0 : s[0]) ?? i), a =
|
|
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);
|
|
3735
4032
|
return !Number.isFinite(o) || !a ? null : { value: o, color: a };
|
|
3736
4033
|
}).filter(Boolean).sort((s, i) => s.value - i.value);
|
|
3737
4034
|
return n.length > 0 ? n : e;
|
|
3738
4035
|
}
|
|
3739
|
-
function
|
|
4036
|
+
function cn(r, e) {
|
|
3740
4037
|
if (!Array.isArray(r) || r.length === 0)
|
|
3741
4038
|
return [255, 255, 255];
|
|
3742
4039
|
if (e <= r[0].value)
|
|
@@ -3744,19 +4041,19 @@ function Fr(r, e) {
|
|
|
3744
4041
|
for (let t = 1; t < r.length; t += 1) {
|
|
3745
4042
|
const n = r[t], s = r[t - 1];
|
|
3746
4043
|
if (e <= n.value) {
|
|
3747
|
-
const i = Math.max(n.value - s.value, 1e-4), o =
|
|
4044
|
+
const i = Math.max(n.value - s.value, 1e-4), o = E((e - s.value) / i, 0, 1);
|
|
3748
4045
|
return s.color.map(
|
|
3749
|
-
(a,
|
|
4046
|
+
(a, u) => Math.round(a + (n.color[u] - a) * o)
|
|
3750
4047
|
);
|
|
3751
4048
|
}
|
|
3752
4049
|
}
|
|
3753
4050
|
return r[r.length - 1].color;
|
|
3754
4051
|
}
|
|
3755
|
-
function
|
|
4052
|
+
function Pe(r, e) {
|
|
3756
4053
|
const [t, n, s] = r;
|
|
3757
|
-
return `rgba(${t}, ${n}, ${s}, ${
|
|
4054
|
+
return `rgba(${t}, ${n}, ${s}, ${E(e, 0, 1)})`;
|
|
3758
4055
|
}
|
|
3759
|
-
function
|
|
4056
|
+
function hn(r, e) {
|
|
3760
4057
|
if (!r || typeof r != "object")
|
|
3761
4058
|
return e;
|
|
3762
4059
|
const t = Number(r.west), n = Number(r.south), s = Number(r.east), i = Number(r.north);
|
|
@@ -3767,7 +4064,7 @@ function Br(r, e) {
|
|
|
3767
4064
|
north: Math.max(n, i)
|
|
3768
4065
|
} : e;
|
|
3769
4066
|
}
|
|
3770
|
-
function
|
|
4067
|
+
function dn(r, e) {
|
|
3771
4068
|
const t = {
|
|
3772
4069
|
west: Math.max(r.west, e.west),
|
|
3773
4070
|
south: Math.max(r.south, e.south),
|
|
@@ -3776,18 +4073,18 @@ function Or(r, e) {
|
|
|
3776
4073
|
};
|
|
3777
4074
|
return t.west >= t.east || t.south >= t.north ? null : t;
|
|
3778
4075
|
}
|
|
3779
|
-
function
|
|
4076
|
+
function Le(r, e, t) {
|
|
3780
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;
|
|
3781
4078
|
}
|
|
3782
|
-
function
|
|
4079
|
+
function fn(r) {
|
|
3783
4080
|
return r && Number.isFinite(r.x) && Number.isFinite(r.y);
|
|
3784
4081
|
}
|
|
3785
|
-
function
|
|
4082
|
+
function yn(r) {
|
|
3786
4083
|
return String(r || "").toLowerCase();
|
|
3787
4084
|
}
|
|
3788
|
-
class
|
|
4085
|
+
class mn {
|
|
3789
4086
|
constructor(e = {}) {
|
|
3790
|
-
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 = {
|
|
3791
4088
|
zIndex: Number(e.zIndex ?? 30),
|
|
3792
4089
|
visible: e.visible !== !1,
|
|
3793
4090
|
running: e.running !== !1,
|
|
@@ -3812,9 +4109,9 @@ class Vr {
|
|
|
3812
4109
|
projectionGrid: e.projectionGrid !== !1,
|
|
3813
4110
|
projectionGridCols: Number(e.projectionGridCols ?? 32),
|
|
3814
4111
|
projectionGridRows: Number(e.projectionGridRows ?? 20)
|
|
3815
|
-
}, this.colorScale =
|
|
4112
|
+
}, this.colorScale = ce(e.colorScale, ot), this.particleColorScale = ce(
|
|
3816
4113
|
e.particleColorScale,
|
|
3817
|
-
|
|
4114
|
+
at
|
|
3818
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();
|
|
3819
4116
|
}
|
|
3820
4117
|
isReady() {
|
|
@@ -3840,7 +4137,7 @@ class Vr {
|
|
|
3840
4137
|
resize() {
|
|
3841
4138
|
if (!this.canvas || !this.overlayCanvas || !this.container)
|
|
3842
4139
|
return;
|
|
3843
|
-
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));
|
|
3844
4141
|
n === this.width && s === this.height || (this.width = n, this.height = s, [
|
|
3845
4142
|
[this.canvas, this.ctx],
|
|
3846
4143
|
[this.overlayCanvas, this.overlayCtx]
|
|
@@ -3861,10 +4158,10 @@ class Vr {
|
|
|
3861
4158
|
this.options = {
|
|
3862
4159
|
...this.options,
|
|
3863
4160
|
...e
|
|
3864
|
-
}, 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(
|
|
3865
4162
|
e.particleColorScale,
|
|
3866
|
-
|
|
3867
|
-
)), 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();
|
|
3868
4165
|
}
|
|
3869
4166
|
refreshSpawnBounds() {
|
|
3870
4167
|
return this.spawnBoundsCache = this.getSpawnBounds(), this.invalidateProjectionGrid(), this.spawnBoundsCache;
|
|
@@ -3873,7 +4170,7 @@ class Vr {
|
|
|
3873
4170
|
var t;
|
|
3874
4171
|
if (!this.options.projectionGrid)
|
|
3875
4172
|
return !1;
|
|
3876
|
-
const e =
|
|
4173
|
+
const e = yn((t = this.getSceneMode) == null ? void 0 : t.call(this));
|
|
3877
4174
|
return e === "2d" || e === "2.5d";
|
|
3878
4175
|
}
|
|
3879
4176
|
invalidateProjectionGrid() {
|
|
@@ -3882,11 +4179,11 @@ class Vr {
|
|
|
3882
4179
|
buildProjectionGrid(e = this.spawnBoundsCache) {
|
|
3883
4180
|
if (!this.shouldUseProjectionGrid() || !e)
|
|
3884
4181
|
return this.projectionGrid = null, null;
|
|
3885
|
-
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 = [];
|
|
3886
4183
|
for (let i = 0; i <= n; i += 1)
|
|
3887
4184
|
for (let o = 0; o <= t; o += 1) {
|
|
3888
|
-
const a = e.west + (e.east - e.west) * (o / t),
|
|
3889
|
-
s.push(this.project(a,
|
|
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));
|
|
3890
4187
|
}
|
|
3891
4188
|
return this.projectionGrid = {
|
|
3892
4189
|
bounds: e,
|
|
@@ -3899,19 +4196,19 @@ class Vr {
|
|
|
3899
4196
|
const n = this.projectionGrid || this.buildProjectionGrid(this.spawnBoundsCache);
|
|
3900
4197
|
if (!n || !n.bounds)
|
|
3901
4198
|
return this.project(e, t, this.options.height);
|
|
3902
|
-
const { bounds: s, cols: i, rows: o, nodes: a } = n,
|
|
3903
|
-
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))
|
|
3904
4201
|
return this.project(e, t, this.options.height);
|
|
3905
|
-
const
|
|
4202
|
+
const T = 1 - v, G = 1 - P;
|
|
3906
4203
|
return {
|
|
3907
|
-
x:
|
|
3908
|
-
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
|
|
3909
4206
|
};
|
|
3910
4207
|
}
|
|
3911
4208
|
getSpawnBounds() {
|
|
3912
4209
|
var n;
|
|
3913
|
-
const e = this.grid.getBounds(), t =
|
|
3914
|
-
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;
|
|
3915
4212
|
}
|
|
3916
4213
|
createParticle(e = this.spawnBoundsCache || this.refreshSpawnBounds()) {
|
|
3917
4214
|
if (!e)
|
|
@@ -3951,7 +4248,7 @@ class Vr {
|
|
|
3951
4248
|
if (!this.isReady())
|
|
3952
4249
|
return;
|
|
3953
4250
|
this.clear();
|
|
3954
|
-
const e =
|
|
4251
|
+
const e = E(Math.floor(this.options.particleCount), 1, 8e3), t = this.refreshSpawnBounds();
|
|
3955
4252
|
this.particles = Array.from({ length: e }, () => this.createParticle(t)), this.particleCursor = 0, this.overlayDirty = !0, this.drawVelocityOverlay();
|
|
3956
4253
|
}
|
|
3957
4254
|
getParticleColorIndex(e) {
|
|
@@ -3970,32 +4267,32 @@ class Vr {
|
|
|
3970
4267
|
const e = this.spawnBoundsCache || this.refreshSpawnBounds();
|
|
3971
4268
|
if (!e)
|
|
3972
4269
|
return;
|
|
3973
|
-
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();
|
|
3974
4271
|
t.save(), t.globalCompositeOperation = "source-over";
|
|
3975
4272
|
for (let c = 0; c < i; c += 1) {
|
|
3976
4273
|
const h = e.south + (c + 0.5) * a;
|
|
3977
|
-
for (let
|
|
3978
|
-
const
|
|
3979
|
-
if (!
|
|
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)
|
|
3980
4277
|
continue;
|
|
3981
|
-
const
|
|
3982
|
-
if (!
|
|
4278
|
+
const I = this.projectPoint(f, h);
|
|
4279
|
+
if (!Le(I, this.width, this.height))
|
|
3983
4280
|
continue;
|
|
3984
|
-
const
|
|
3985
|
-
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)
|
|
3986
4283
|
continue;
|
|
3987
|
-
const
|
|
3988
|
-
|
|
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);
|
|
3989
4286
|
}
|
|
3990
4287
|
}
|
|
3991
4288
|
t.restore();
|
|
3992
4289
|
}
|
|
3993
4290
|
getDataEdgeOpacity(e, t, n) {
|
|
3994
|
-
const s =
|
|
4291
|
+
const s = E(this.options.velocityOverlayEdgeFade, 0, 0.35);
|
|
3995
4292
|
if (s <= 0 || !n)
|
|
3996
4293
|
return 1;
|
|
3997
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);
|
|
3998
|
-
return
|
|
4295
|
+
return E(a / s, 0, 1);
|
|
3999
4296
|
}
|
|
4000
4297
|
start() {
|
|
4001
4298
|
this.destroyed || (this.options.running = !0, this.interactionSuspended = !1, this.animationFrame || (this.lastFrameTime = performance.now(), this.animationFrame = requestAnimationFrame((e) => this.animate(e))));
|
|
@@ -4025,45 +4322,45 @@ class Vr {
|
|
|
4025
4322
|
}
|
|
4026
4323
|
stepParticle(e, t) {
|
|
4027
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);
|
|
4028
|
-
if (!n || n.speed <= 0 || !
|
|
4325
|
+
if (!n || n.speed <= 0 || !Le(s, this.width, this.height))
|
|
4029
4326
|
return Object.assign(e, this.createParticle()), null;
|
|
4030
|
-
const i = e.lat * Math.PI / 180, o = Math.max(Math.cos(i) * 111320, 1e3), a = 111320,
|
|
4031
|
-
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 });
|
|
4032
4329
|
}
|
|
4033
4330
|
getFrameParticleCount(e) {
|
|
4034
4331
|
var i;
|
|
4035
|
-
const t =
|
|
4332
|
+
const t = E(
|
|
4036
4333
|
Math.floor(this.options.maxFrameParticles || e),
|
|
4037
4334
|
1,
|
|
4038
4335
|
e
|
|
4039
4336
|
), n = Math.floor(this.options.sceneModeMaxFrameParticles || 0), s = String(((i = this.getSceneMode) == null ? void 0 : i.call(this)) || "").toLowerCase();
|
|
4040
|
-
return (s === "2d" || s === "2.5d") && n > 0 ?
|
|
4337
|
+
return (s === "2d" || s === "2.5d") && n > 0 ? E(n, 1, t) : t;
|
|
4041
4338
|
}
|
|
4042
4339
|
drawFrame(e) {
|
|
4043
4340
|
if (!this.ctx || this.width <= 0 || this.height <= 0)
|
|
4044
4341
|
return;
|
|
4045
4342
|
const t = this.ctx;
|
|
4046
|
-
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";
|
|
4047
4344
|
const n = this.particleColorScale.map(() => []), s = this.particles.length, i = this.getFrameParticleCount(s);
|
|
4048
4345
|
for (let o = 0; o < i; o += 1) {
|
|
4049
|
-
const a = (this.particleCursor + o) % s,
|
|
4050
|
-
|
|
4346
|
+
const a = (this.particleCursor + o) % s, u = this.stepParticle(this.particles[a], e);
|
|
4347
|
+
u && n[this.getParticleColorIndex(u.speed)].push(u);
|
|
4051
4348
|
}
|
|
4052
4349
|
this.particleCursor = (this.particleCursor + i) % s, n.forEach((o, a) => {
|
|
4053
4350
|
if (o.length === 0)
|
|
4054
4351
|
return;
|
|
4055
|
-
const
|
|
4056
|
-
t.lineWidth = this.options.lineWidth * (0.72 +
|
|
4057
|
-
t.moveTo(
|
|
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) => {
|
|
4354
|
+
t.moveTo(l.from.x, l.from.y), t.lineTo(l.to.x, l.to.y);
|
|
4058
4355
|
}), t.stroke();
|
|
4059
4356
|
});
|
|
4060
4357
|
}
|
|
4061
4358
|
animate(e) {
|
|
4062
4359
|
if (this.animationFrame = null, !(this.destroyed || !this.options.running || this.interactionSuspended)) {
|
|
4063
4360
|
if (this.options.visible && this.isReady()) {
|
|
4064
|
-
const t = 1e3 /
|
|
4361
|
+
const t = 1e3 / E(this.options.frameRate, 1, 60), n = e - this.lastFrameTime;
|
|
4065
4362
|
if (n >= t) {
|
|
4066
|
-
const s =
|
|
4363
|
+
const s = E(n / 16.67, 0.5, 2.5);
|
|
4067
4364
|
this.lastFrameTime = e, this.drawFrame(s);
|
|
4068
4365
|
}
|
|
4069
4366
|
}
|
|
@@ -4086,10 +4383,10 @@ class Vr {
|
|
|
4086
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 = [];
|
|
4087
4384
|
}
|
|
4088
4385
|
}
|
|
4089
|
-
function
|
|
4386
|
+
function H(r = {}) {
|
|
4090
4387
|
return typeof r == "string" ? r || "wind-field-default" : (r == null ? void 0 : r.id) || (r == null ? void 0 : r.layerId) || "wind-field-default";
|
|
4091
4388
|
}
|
|
4092
|
-
function
|
|
4389
|
+
function lt(r = {}) {
|
|
4093
4390
|
const {
|
|
4094
4391
|
id: e,
|
|
4095
4392
|
layerId: t,
|
|
@@ -4098,121 +4395,121 @@ function $e(r = {}) {
|
|
|
4098
4395
|
options: i,
|
|
4099
4396
|
container: o,
|
|
4100
4397
|
project: a,
|
|
4101
|
-
getViewBounds:
|
|
4102
|
-
...
|
|
4398
|
+
getViewBounds: u,
|
|
4399
|
+
...l
|
|
4103
4400
|
} = r || {};
|
|
4104
4401
|
return {
|
|
4105
|
-
...
|
|
4402
|
+
...l,
|
|
4106
4403
|
...i || {}
|
|
4107
4404
|
};
|
|
4108
4405
|
}
|
|
4109
|
-
function
|
|
4406
|
+
function ut(r) {
|
|
4110
4407
|
return !!(r && typeof r.getMapInstance == "function" && typeof r.getMapContainer == "function" && typeof r.projectToContainerPoint == "function" && typeof r.getViewBounds == "function" && typeof r.onViewChange == "function");
|
|
4111
4408
|
}
|
|
4112
|
-
class
|
|
4409
|
+
class Tn {
|
|
4113
4410
|
constructor(e = {}) {
|
|
4114
4411
|
this.baseGIS = null, this.layers = /* @__PURE__ */ new Map();
|
|
4115
|
-
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);
|
|
4116
4413
|
t && this.mount(t);
|
|
4117
4414
|
}
|
|
4118
4415
|
mount(e) {
|
|
4119
4416
|
var t, n;
|
|
4120
|
-
return
|
|
4417
|
+
return ut(e) ? (this.baseGIS = e, p(
|
|
4121
4418
|
{ engineType: ((n = (t = this.baseGIS).getEngineType) == null ? void 0 : n.call(t)) || "unknown" },
|
|
4122
4419
|
"WindFieldMethods mounted with BaseGIS."
|
|
4123
|
-
)) :
|
|
4420
|
+
)) : m("WindFieldMethods mount requires BaseGIS instance.", "INVALID_MOUNT_TARGET");
|
|
4124
4421
|
}
|
|
4125
4422
|
resolveBaseGIS() {
|
|
4126
4423
|
var e, t;
|
|
4127
|
-
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(
|
|
4128
4425
|
"Map instance is not ready. Please call mapCore.init() first.",
|
|
4129
|
-
|
|
4130
|
-
) :
|
|
4426
|
+
V.NOT_INITIALIZED
|
|
4427
|
+
) : m("WindFieldMethods has not been mounted.", "NOT_MOUNTED");
|
|
4131
4428
|
}
|
|
4132
4429
|
addWindField(e = {}) {
|
|
4133
|
-
var
|
|
4430
|
+
var u, l;
|
|
4134
4431
|
const t = this.resolveBaseGIS();
|
|
4135
4432
|
if (!t.success)
|
|
4136
4433
|
return t;
|
|
4137
4434
|
const n = (e == null ? void 0 : e.data) || (e == null ? void 0 : e.windData);
|
|
4138
4435
|
if (!n)
|
|
4139
|
-
return
|
|
4436
|
+
return m("Wind field data is required.", V.FAILED);
|
|
4140
4437
|
const s = this.baseGIS.getMapContainer();
|
|
4141
|
-
if (!(s != null && s.success) || !((
|
|
4142
|
-
return (s == null ? void 0 : s.success) === !1 ? s :
|
|
4143
|
-
const i =
|
|
4438
|
+
if (!(s != null && s.success) || !((u = s.data) != null && u.container))
|
|
4439
|
+
return (s == null ? void 0 : s.success) === !1 ? s : m("Map container is not available.", V.NOT_INITIALIZED);
|
|
4440
|
+
const i = H(e);
|
|
4144
4441
|
this.removeWindField(i);
|
|
4145
|
-
const o = new
|
|
4442
|
+
const o = new mn({
|
|
4146
4443
|
id: i,
|
|
4147
4444
|
data: n,
|
|
4148
4445
|
container: s.data.container,
|
|
4149
|
-
|
|
4150
|
-
project: (c, h,
|
|
4151
|
-
const
|
|
4446
|
+
...lt(e),
|
|
4447
|
+
project: (c, h, d = 0) => {
|
|
4448
|
+
const f = this.baseGIS.projectToContainerPoint({
|
|
4152
4449
|
longitude: c,
|
|
4153
4450
|
latitude: h,
|
|
4154
|
-
height:
|
|
4451
|
+
height: d
|
|
4155
4452
|
});
|
|
4156
|
-
return
|
|
4453
|
+
return f != null && f.success ? f.data : null;
|
|
4157
4454
|
},
|
|
4158
4455
|
getViewBounds: () => {
|
|
4159
4456
|
const c = this.baseGIS.getViewBounds();
|
|
4160
4457
|
return c != null && c.success ? c.data : null;
|
|
4161
4458
|
},
|
|
4162
4459
|
getSceneMode: () => {
|
|
4163
|
-
var h,
|
|
4164
|
-
const c = (
|
|
4165
|
-
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 : "";
|
|
4166
4463
|
}
|
|
4167
4464
|
});
|
|
4168
4465
|
if (!o.grid.valid)
|
|
4169
|
-
return o.destroy(),
|
|
4466
|
+
return o.destroy(), m(o.grid.errorMessage || "Invalid wind field data.", V.FAILED);
|
|
4170
4467
|
const a = this.baseGIS.onViewChange({
|
|
4171
4468
|
onStart: () => o.suspendForInteraction(),
|
|
4172
4469
|
onEnd: () => o.resumeAfterInteraction()
|
|
4173
4470
|
});
|
|
4174
4471
|
return a != null && a.success ? (this.layers.set(i, {
|
|
4175
4472
|
layer: o,
|
|
4176
|
-
offViewChange: (
|
|
4177
|
-
}),
|
|
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."));
|
|
4178
4475
|
}
|
|
4179
4476
|
updateWindField(e = {}) {
|
|
4180
4477
|
const t = this.resolveBaseGIS();
|
|
4181
4478
|
if (!t.success)
|
|
4182
4479
|
return t;
|
|
4183
|
-
const n =
|
|
4480
|
+
const n = H(e), s = this.layers.get(n);
|
|
4184
4481
|
if (!s)
|
|
4185
|
-
return
|
|
4186
|
-
const i =
|
|
4187
|
-
return o && (i.data = o), s.layer.updateOptions(i),
|
|
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.`);
|
|
4188
4485
|
}
|
|
4189
4486
|
startWindField(e = {}) {
|
|
4190
|
-
const t =
|
|
4191
|
-
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);
|
|
4192
4489
|
}
|
|
4193
4490
|
stopWindField(e = {}) {
|
|
4194
|
-
const t =
|
|
4195
|
-
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);
|
|
4196
4493
|
}
|
|
4197
4494
|
showWindField(e = {}) {
|
|
4198
|
-
const t =
|
|
4199
|
-
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);
|
|
4200
4497
|
}
|
|
4201
4498
|
hideWindField(e = {}) {
|
|
4202
|
-
const t =
|
|
4203
|
-
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);
|
|
4204
4501
|
}
|
|
4205
4502
|
removeWindField(e = {}) {
|
|
4206
4503
|
var s;
|
|
4207
|
-
const t =
|
|
4208
|
-
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.`);
|
|
4209
4506
|
}
|
|
4210
4507
|
clearWindFields() {
|
|
4211
4508
|
const e = this.layers.size;
|
|
4212
4509
|
return this.layers.forEach((t) => {
|
|
4213
4510
|
var n;
|
|
4214
4511
|
(n = t.offViewChange) == null || n.call(t), t.layer.destroy();
|
|
4215
|
-
}), this.layers.clear(),
|
|
4512
|
+
}), this.layers.clear(), p({ count: e }, `Wind fields cleared: ${e}.`);
|
|
4216
4513
|
}
|
|
4217
4514
|
getState() {
|
|
4218
4515
|
return {
|
|
@@ -4223,16 +4520,16 @@ class Jr {
|
|
|
4223
4520
|
}
|
|
4224
4521
|
}
|
|
4225
4522
|
export {
|
|
4226
|
-
|
|
4227
|
-
|
|
4228
|
-
|
|
4229
|
-
|
|
4230
|
-
|
|
4231
|
-
|
|
4232
|
-
|
|
4233
|
-
|
|
4234
|
-
|
|
4235
|
-
|
|
4236
|
-
|
|
4237
|
-
|
|
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
|
|
4238
4535
|
};
|