@3clear/basegis 0.1.0 → 0.1.1

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.
Files changed (4) hide show
  1. package/README.md +2023 -344
  2. package/dist/basegis.js +3244 -1382
  3. package/dist/methods.js +547 -483
  4. package/package.json +1 -1
package/dist/methods.js CHANGED
@@ -1,21 +1,21 @@
1
- import { f as c, s as f, R as w } from "./result-D03zgqh0.js";
2
- import G from "leaflet";
3
- function se(i) {
1
+ import { f as c, s as y, R as G } from "./result-D03zgqh0.js";
2
+ import w from "leaflet";
3
+ function re(i) {
4
4
  return !!(i && typeof i.getMapInstance == "function" && typeof i.drawPoint == "function" && typeof i.drawLine == "function" && typeof i.drawPolygon == "function" && typeof i.drawText == "function" && typeof i.addMarker == "function" && typeof i.clearGraphics == "function");
5
5
  }
6
- class Be {
6
+ class Re {
7
7
  constructor(e = {}) {
8
8
  this.baseGIS = null, this.items = [], this.loadedCount = 0, (e.mapCore || e.baseGIS) && this.mount(e.mapCore || e.baseGIS);
9
9
  }
10
10
  mount(e) {
11
- return se(e) ? (this.baseGIS = e, f(null, "GraphicGroupController mounted with BaseGIS.")) : c(
11
+ return re(e) ? (this.baseGIS = e, y(null, "GraphicGroupController mounted with BaseGIS.")) : c(
12
12
  "GraphicGroupController mount requires BaseGIS instance.",
13
13
  "INVALID_MOUNT_TARGET"
14
14
  );
15
15
  }
16
16
  resolveBaseGIS() {
17
17
  var e, t;
18
- return this.baseGIS ? (t = (e = this.baseGIS).getMapInstance) != null && t.call(e) ? f(null, "BaseGIS is ready.") : c(
18
+ return this.baseGIS ? (t = (e = this.baseGIS).getMapInstance) != null && t.call(e) ? y(null, "BaseGIS is ready.") : c(
19
19
  "Map instance is not ready. Please call mapCore.init() first.",
20
20
  "NOT_INITIALIZED"
21
21
  ) : c("GraphicGroupController has not been mounted.", "NOT_MOUNTED");
@@ -43,20 +43,20 @@ class Be {
43
43
  if (!Array.isArray(e) || e.length === 0)
44
44
  return c("Graphic item list is empty.", "INVALID_ITEMS");
45
45
  t.clearBeforeLoad !== !1 && this.baseGIS.clearGraphics(), this.items = e, this.loadedCount = 0;
46
- const n = e.map((r) => {
47
- const o = this.drawItem(r);
48
- return o != null && o.success && (this.loadedCount += 1), {
49
- type: r.type,
50
- id: r.id || "",
51
- success: !!(o != null && o.success),
52
- message: (o == null ? void 0 : o.message) || ""
46
+ const r = e.map((n) => {
47
+ const a = this.drawItem(n);
48
+ return a != null && a.success && (this.loadedCount += 1), {
49
+ type: n.type,
50
+ id: n.id || "",
51
+ success: !!(a != null && a.success),
52
+ message: (a == null ? void 0 : a.message) || ""
53
53
  };
54
54
  });
55
- return f(
55
+ return y(
56
56
  {
57
57
  total: e.length,
58
58
  loadedCount: this.loadedCount,
59
- results: n
59
+ results: r
60
60
  },
61
61
  `Graphic group loaded: ${this.loadedCount}/${e.length}.`
62
62
  );
@@ -80,22 +80,22 @@ class Be {
80
80
  function O(i = {}) {
81
81
  return Array.isArray(i) || Array.isArray(i == null ? void 0 : i.features) ? { contours: i } : i || {};
82
82
  }
83
- function $(i = {}) {
83
+ function k(i = {}) {
84
84
  const e = O(i);
85
85
  return ["contours", "isolines", "isoline", "lines", "data", "items"].some(
86
86
  (t) => Object.prototype.hasOwnProperty.call(e, t)
87
87
  );
88
88
  }
89
- function ie(i) {
89
+ function ne(i) {
90
90
  return !!(i && typeof i.getEngineType == "function" && typeof i.getMapInstance == "function" && typeof i.upsertContourLayer == "function" && typeof i.updateContourLayer == "function" && typeof i.showContourLayer == "function" && typeof i.hideContourLayer == "function" && typeof i.removeContourLayer == "function" && typeof i.clearContourLayer == "function" && typeof i.getContourLayerState == "function");
91
91
  }
92
- function re(i = {}) {
92
+ function ae(i = {}) {
93
93
  const { mapCore: e, baseGIS: t, ...s } = i;
94
94
  return s;
95
95
  }
96
- class ne {
96
+ class oe {
97
97
  constructor(e = {}) {
98
- const t = re(e), s = t.contourLayerId || t.layerId || t.id || "contour-default";
98
+ const t = ae(e), s = t.contourLayerId || t.layerId || t.id || "contour-default";
99
99
  this.options = {
100
100
  layerId: s,
101
101
  visible: t.visible ?? !0
@@ -114,7 +114,7 @@ class ne {
114
114
  }
115
115
  mount(e) {
116
116
  var t, s;
117
- return ie(e) ? (this.baseGIS = e, f(
117
+ return ne(e) ? (this.baseGIS = e, y(
118
118
  { engineType: ((s = (t = this.baseGIS).getEngineType) == null ? void 0 : s.call(t)) || "unknown" },
119
119
  "ContourLayerController mounted with BaseGIS."
120
120
  )) : c(
@@ -124,7 +124,7 @@ class ne {
124
124
  }
125
125
  resolveBaseGIS() {
126
126
  var e, t;
127
- return this.baseGIS ? (t = (e = this.baseGIS).getMapInstance) != null && t.call(e) ? f(null, "BaseGIS is ready.") : c(
127
+ return this.baseGIS ? (t = (e = this.baseGIS).getMapInstance) != null && t.call(e) ? y(null, "BaseGIS is ready.") : c(
128
128
  "Map instance is not ready. Please call mapCore.init() first.",
129
129
  "NOT_INITIALIZED"
130
130
  ) : c("ContourLayerController has not been mounted.", "NOT_MOUNTED");
@@ -151,27 +151,27 @@ class ne {
151
151
  }, typeof t.visible == "boolean" && (this.visible = t.visible));
152
152
  }
153
153
  async load(e = {}, t = {}) {
154
- var o;
154
+ var a;
155
155
  const s = this.resolveBaseGIS();
156
156
  if (!s.success)
157
157
  return s;
158
- const n = this.buildPayload({
158
+ const r = this.buildPayload({
159
159
  ...O(e),
160
160
  ...O(t)
161
161
  });
162
- if (!$(n))
162
+ if (!k(r))
163
163
  return c(
164
164
  "Contour layer requires contours, isolines, lines, data or items.",
165
165
  "INVALID_CONTOUR_SOURCE"
166
166
  );
167
- const r = await this.baseGIS.upsertContourLayer(n);
168
- return r.success && (this.currentPayload = n, this.visible = n.visible !== !1, this.layerType = ((o = r == null ? void 0 : r.data) == null ? void 0 : o.layerType) || this.layerType, this.syncStateFromResult(r)), r;
167
+ const n = await this.baseGIS.upsertContourLayer(r);
168
+ return n.success && (this.currentPayload = r, this.visible = r.visible !== !1, this.layerType = ((a = n == null ? void 0 : n.data) == null ? void 0 : a.layerType) || this.layerType, this.syncStateFromResult(n)), n;
169
169
  }
170
170
  upsert(e = {}, t = {}) {
171
171
  return this.load(e, t);
172
172
  }
173
173
  async update(e = {}) {
174
- var r;
174
+ var n;
175
175
  const t = this.resolveBaseGIS();
176
176
  if (!t.success)
177
177
  return t;
@@ -179,10 +179,10 @@ class ne {
179
179
  ...this.currentPayload || this.defaultPayload,
180
180
  ...O(e)
181
181
  };
182
- if (!this.currentPayload && !$(s))
182
+ if (!this.currentPayload && !k(s))
183
183
  return c("Contour layer has not been loaded.", "NOT_LOADED");
184
- const n = await this.baseGIS.updateContourLayer(s);
185
- return n.success && (this.currentPayload = s, this.visible = s.visible !== !1, this.layerType = ((r = n == null ? void 0 : n.data) == null ? void 0 : r.layerType) || this.layerType, this.syncStateFromResult(n)), n;
184
+ const r = await this.baseGIS.updateContourLayer(s);
185
+ return r.success && (this.currentPayload = s, this.visible = s.visible !== !1, this.layerType = ((n = r == null ? void 0 : r.data) == null ? void 0 : n.layerType) || this.layerType, this.syncStateFromResult(r)), r;
186
186
  }
187
187
  setConfig(e = {}) {
188
188
  return this.update(e);
@@ -244,7 +244,7 @@ class ne {
244
244
  levelCount: 0,
245
245
  lineCount: 0,
246
246
  destroyed: !0
247
- }, f(null, "Contour layer controller destroyed (local state only).");
247
+ }, y(null, "Contour layer controller destroyed (local state only).");
248
248
  const s = this.baseGIS.removeContourLayer({
249
249
  ...e,
250
250
  layerId: this.getLayerId(e)
@@ -255,25 +255,25 @@ class ne {
255
255
  levelCount: 0,
256
256
  lineCount: 0,
257
257
  destroyed: !0
258
- }, s.success ? f(null, "Contour layer controller destroyed.") : s;
258
+ }, s.success ? y(null, "Contour layer controller destroyed.") : s;
259
259
  }
260
260
  removeLayer(e = {}) {
261
261
  return this.destroy(e);
262
262
  }
263
263
  getState() {
264
- var e, t, s, n, r, o, a;
264
+ var e, t, s, r, n, a, o;
265
265
  if ((t = (e = this.baseGIS) == null ? void 0 : e.getMapInstance) != null && t.call(e) && this.currentPayload) {
266
- const l = (n = (s = this.baseGIS).getContourLayerState) == null ? void 0 : n.call(s, {
266
+ const l = (r = (s = this.baseGIS).getContourLayerState) == null ? void 0 : r.call(s, {
267
267
  layerId: this.currentPayload.layerId || this.options.layerId
268
268
  });
269
269
  l != null && l.success && this.syncStateFromResult(l);
270
270
  }
271
271
  return {
272
272
  mounted: !!this.baseGIS,
273
- engineType: ((o = (r = this.baseGIS) == null ? void 0 : r.getEngineType) == null ? void 0 : o.call(r)) || "unknown",
273
+ engineType: ((a = (n = this.baseGIS) == null ? void 0 : n.getEngineType) == null ? void 0 : a.call(n)) || "unknown",
274
274
  layerType: this.layerType,
275
275
  visible: this.visible,
276
- layerId: ((a = this.currentPayload) == null ? void 0 : a.layerId) || this.options.layerId,
276
+ layerId: ((o = this.currentPayload) == null ? void 0 : o.layerId) || this.options.layerId,
277
277
  payload: this.currentPayload,
278
278
  ...this.currentState
279
279
  };
@@ -283,7 +283,7 @@ function P(i, e = 0) {
283
283
  const t = Number(i);
284
284
  return Number.isFinite(t) ? t : e;
285
285
  }
286
- function k(i, e = {
286
+ function q(i, e = {
287
287
  startLon: 73,
288
288
  startLat: 18,
289
289
  endLon: 135,
@@ -297,18 +297,18 @@ function k(i, e = {
297
297
  endLat: P(t.endLat, e.endLat)
298
298
  };
299
299
  }
300
- function oe(i) {
300
+ function le(i) {
301
301
  return !!(i && typeof i.getEngineType == "function" && typeof i.getMapInstance == "function" && typeof i.upsertGridLayer == "function" && typeof i.showGridLayer == "function" && typeof i.hideGridLayer == "function" && typeof i.removeGridLayer == "function");
302
302
  }
303
- function ae(i = {}) {
303
+ function ce(i = {}) {
304
304
  return !!(i.tifUrl || i.imageUrl || i.grayImageUrl || i.imageGridData);
305
305
  }
306
- class De {
306
+ class Fe {
307
307
  constructor(e = {}) {
308
308
  this.options = {
309
309
  visible: e.visible ?? !0,
310
310
  layerId: e.layerId || "grid-layer-default",
311
- defaultArea: k(e.defaultArea),
311
+ defaultArea: q(e.defaultArea),
312
312
  gridTotal: P(e.gridTotal, 4),
313
313
  tileSize: P(e.tileSize, 512),
314
314
  decimalPlaces: P(e.decimalPlaces, 2),
@@ -319,7 +319,7 @@ class De {
319
319
  }
320
320
  mount(e) {
321
321
  var t, s;
322
- return oe(e) ? (this.baseGIS = e, f(
322
+ return le(e) ? (this.baseGIS = e, y(
323
323
  { engineType: ((s = (t = this.baseGIS).getEngineType) == null ? void 0 : s.call(t)) || "unknown" },
324
324
  "GridLayerController mounted with BaseGIS."
325
325
  )) : c(
@@ -329,7 +329,7 @@ class De {
329
329
  }
330
330
  resolveBaseGIS() {
331
331
  var e, t;
332
- return this.baseGIS ? (t = (e = this.baseGIS).getMapInstance) != null && t.call(e) ? f(null, "BaseGIS is ready.") : c(
332
+ return this.baseGIS ? (t = (e = this.baseGIS).getMapInstance) != null && t.call(e) ? y(null, "BaseGIS is ready.") : c(
333
333
  "Map instance is not ready. Please call mapCore.init() first.",
334
334
  "NOT_INITIALIZED"
335
335
  ) : c("GridLayerController has not been mounted.", "NOT_MOUNTED");
@@ -339,7 +339,7 @@ class De {
339
339
  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;
340
340
  }
341
341
  buildPayload(e = {}) {
342
- const t = e.imageUrl || e.grayImageUrl || e.imageGridData, s = e.area ? k(e.area, this.options.defaultArea) : t ? this.options.defaultArea : void 0;
342
+ const t = e.imageUrl || e.grayImageUrl || e.imageGridData, s = e.area ? q(e.area, this.options.defaultArea) : t ? this.options.defaultArea : void 0;
343
343
  return {
344
344
  ...e,
345
345
  layerId: this.getLayerId(e),
@@ -354,17 +354,17 @@ class De {
354
354
  };
355
355
  }
356
356
  async load(e = {}) {
357
- var r;
357
+ var n;
358
358
  const t = this.resolveBaseGIS();
359
359
  if (!t.success)
360
360
  return t;
361
- if (!ae(e))
361
+ if (!ce(e))
362
362
  return c(
363
363
  "Grid layer requires tifUrl, imageUrl, grayImageUrl or imageGridData.",
364
364
  "INVALID_GRID_SOURCE"
365
365
  );
366
- const s = this.buildPayload(e), n = await this.baseGIS.upsertGridLayer(s);
367
- return n.success && (this.currentPayload = s, this.visible = s.visible !== !1, this.layerType = ((r = n == null ? void 0 : n.data) == null ? void 0 : r.layerType) || this.layerType), n;
366
+ const s = this.buildPayload(e), r = await this.baseGIS.upsertGridLayer(s);
367
+ return r.success && (this.currentPayload = s, this.visible = s.visible !== !1, this.layerType = ((n = r == null ? void 0 : r.data) == null ? void 0 : n.layerType) || this.layerType), r;
368
368
  }
369
369
  loadTif(e = {}) {
370
370
  return this.load({
@@ -412,11 +412,11 @@ class De {
412
412
  }
413
413
  destroy(e = {}) {
414
414
  if (!this.resolveBaseGIS().success)
415
- return this.currentPayload = null, this.layerType = "unknown", f(null, "Grid layer controller destroyed (local state only).");
415
+ return this.currentPayload = null, this.layerType = "unknown", y(null, "Grid layer controller destroyed (local state only).");
416
416
  const s = this.baseGIS.removeGridLayer({
417
417
  layerId: this.getLayerId(e)
418
418
  });
419
- return this.currentPayload = null, this.layerType = "unknown", s.success ? f(null, "Grid layer controller destroyed.") : s;
419
+ return this.currentPayload = null, this.layerType = "unknown", s.success ? y(null, "Grid layer controller destroyed.") : s;
420
420
  }
421
421
  getState() {
422
422
  var e, t, s;
@@ -434,7 +434,7 @@ function S(i, e = 0) {
434
434
  const t = Number(i);
435
435
  return Number.isFinite(t) ? t : e;
436
436
  }
437
- function V(i, e = {
437
+ function U(i, e = {
438
438
  startLon: 73,
439
439
  startLat: 18,
440
440
  endLon: 135,
@@ -448,22 +448,53 @@ function V(i, e = {
448
448
  endLat: S(t.endLat, e.endLat)
449
449
  };
450
450
  }
451
- function le(i) {
451
+ function H(i = {}, e = 0, t = void 0) {
452
+ return {
453
+ id: (i == null ? void 0 : i.id) || `image-${e}`,
454
+ name: (i == null ? void 0 : i.name) || `Image ${e + 1}`,
455
+ imageUrl: (i == null ? void 0 : i.imageUrl) || "",
456
+ tifUrl: (i == null ? void 0 : i.tifUrl) || "",
457
+ description: (i == null ? void 0 : i.description) || "",
458
+ area: U(i == null ? void 0 : i.area, t),
459
+ opacity: i == null ? void 0 : i.opacity,
460
+ isSplit: i == null ? void 0 : i.isSplit,
461
+ imageSourceType: i == null ? void 0 : i.imageSourceType,
462
+ isGrayImage: i == null ? void 0 : i.isGrayImage,
463
+ colorize: i == null ? void 0 : i.colorize,
464
+ minValue: i == null ? void 0 : i.minValue,
465
+ maxValue: i == null ? void 0 : i.maxValue,
466
+ grayMinValue: i == null ? void 0 : i.grayMinValue,
467
+ grayMaxValue: i == null ? void 0 : i.grayMaxValue,
468
+ noDataValue: i == null ? void 0 : i.noDataValue,
469
+ colorMapType: i == null ? void 0 : i.colorMapType,
470
+ type: i == null ? void 0 : i.type,
471
+ colorStops: i == null ? void 0 : i.colorStops,
472
+ colors: i == null ? void 0 : i.colors,
473
+ showProbe: i == null ? void 0 : i.showProbe,
474
+ enableProbe: i == null ? void 0 : i.enableProbe,
475
+ showMouseProbe: i == null ? void 0 : i.showMouseProbe,
476
+ showLabel: i == null ? void 0 : i.showLabel,
477
+ gridTotal: i == null ? void 0 : i.gridTotal,
478
+ tileSize: i == null ? void 0 : i.tileSize,
479
+ decimalPlaces: i == null ? void 0 : i.decimalPlaces
480
+ };
481
+ }
482
+ function ue(i) {
452
483
  return !!(i && typeof i.getEngineType == "function" && typeof i.getMapInstance == "function" && typeof i.upsertImageLayer == "function" && typeof i.showImageLayer == "function" && typeof i.hideImageLayer == "function" && typeof i.removeImageLayer == "function");
453
484
  }
454
- class Re {
485
+ class Ee {
455
486
  constructor(e = {}) {
456
487
  this.options = {
457
488
  visible: e.visible ?? !0,
458
489
  opacity: S(e.opacity, 0.85),
459
- defaultArea: V(e.defaultArea),
490
+ defaultArea: U(e.defaultArea),
460
491
  gridTotal: S(e.gridTotal, 4),
461
492
  tileSize: S(e.tileSize, 512),
462
493
  decimalPlaces: S(e.decimalPlaces, 2),
463
494
  imageSourceType: e.imageSourceType || "color",
464
495
  colorize: e.colorize || null,
465
496
  layerId: e.layerId || "image-layer-default"
466
- }, this.baseGIS = null, this.items = [], this.activeIndex = -1, this.visible = this.options.visible, this.layerType = "unknown", (e.mapCore || e.baseGIS) && this.mount(e.mapCore || e.baseGIS);
497
+ }, this.baseGIS = null, this.items = [], this.activeIndex = -1, this.visible = this.options.visible, this.layerType = "unknown", this.currentPayload = null, (e.mapCore || e.baseGIS) && this.mount(e.mapCore || e.baseGIS);
467
498
  }
468
499
  /**
469
500
  * 绑定 BaseGIS 实例。
@@ -471,7 +502,7 @@ class Re {
471
502
  */
472
503
  mount(e) {
473
504
  var t, s;
474
- return le(e) ? (this.baseGIS = e, f(
505
+ return ue(e) ? (this.baseGIS = e, y(
475
506
  { engineType: ((s = (t = this.baseGIS).getEngineType) == null ? void 0 : s.call(t)) || "unknown" },
476
507
  "ImageLayerController mounted with BaseGIS."
477
508
  )) : c(
@@ -481,7 +512,7 @@ class Re {
481
512
  }
482
513
  resolveBaseGIS() {
483
514
  var e, t;
484
- return this.baseGIS ? (t = (e = this.baseGIS).getMapInstance) != null && t.call(e) ? f(null, "BaseGIS is ready.") : c(
515
+ return this.baseGIS ? (t = (e = this.baseGIS).getMapInstance) != null && t.call(e) ? y(null, "BaseGIS is ready.") : c(
485
516
  "Map instance is not ready. Please call mapCore.init() first.",
486
517
  "NOT_INITIALIZED"
487
518
  ) : c("ImageLayerController has not been mounted.", "NOT_MOUNTED");
@@ -494,7 +525,7 @@ class Re {
494
525
  layerId: this.getLayerId(t),
495
526
  imageUrl: e.imageUrl,
496
527
  tifUrl: e.tifUrl,
497
- area: V(e.area, this.options.defaultArea),
528
+ area: U(e.area, this.options.defaultArea),
498
529
  isSplit: !!e.isSplit,
499
530
  imageSourceType: e.imageSourceType || this.options.imageSourceType,
500
531
  isGrayImage: e.isGrayImage,
@@ -526,47 +557,19 @@ class Re {
526
557
  async load(e = [], t = {}) {
527
558
  if (!Array.isArray(e) || e.length === 0)
528
559
  return c("Image list is empty.", "INVALID_ITEMS");
529
- const s = e.map((r, o) => ({
530
- id: (r == null ? void 0 : r.id) || `image-${o}`,
531
- name: (r == null ? void 0 : r.name) || `Image ${o + 1}`,
532
- imageUrl: (r == null ? void 0 : r.imageUrl) || "",
533
- tifUrl: (r == null ? void 0 : r.tifUrl) || "",
534
- description: (r == null ? void 0 : r.description) || "",
535
- area: V(r == null ? void 0 : r.area, this.options.defaultArea),
536
- opacity: r == null ? void 0 : r.opacity,
537
- isSplit: r == null ? void 0 : r.isSplit,
538
- imageSourceType: r == null ? void 0 : r.imageSourceType,
539
- isGrayImage: r == null ? void 0 : r.isGrayImage,
540
- colorize: r == null ? void 0 : r.colorize,
541
- minValue: r == null ? void 0 : r.minValue,
542
- maxValue: r == null ? void 0 : r.maxValue,
543
- grayMinValue: r == null ? void 0 : r.grayMinValue,
544
- grayMaxValue: r == null ? void 0 : r.grayMaxValue,
545
- noDataValue: r == null ? void 0 : r.noDataValue,
546
- colorMapType: r == null ? void 0 : r.colorMapType,
547
- type: r == null ? void 0 : r.type,
548
- colorStops: r == null ? void 0 : r.colorStops,
549
- colors: r == null ? void 0 : r.colors,
550
- showProbe: r == null ? void 0 : r.showProbe,
551
- enableProbe: r == null ? void 0 : r.enableProbe,
552
- showMouseProbe: r == null ? void 0 : r.showMouseProbe,
553
- showLabel: r == null ? void 0 : r.showLabel,
554
- gridTotal: r == null ? void 0 : r.gridTotal,
555
- tileSize: r == null ? void 0 : r.tileSize,
556
- decimalPlaces: r == null ? void 0 : r.decimalPlaces
557
- })).filter((r) => r.imageUrl || r.tifUrl);
560
+ const s = e.map((n, a) => H(n, a, this.options.defaultArea)).filter((n) => n.imageUrl || n.tifUrl);
558
561
  if (s.length === 0)
559
562
  return c("No valid imageUrl or tifUrl found in items.", "INVALID_ITEMS");
560
563
  this.items = s, typeof t.visible == "boolean" && (this.visible = t.visible);
561
- const n = Number.isInteger(t.index) ? t.index : 0;
562
- return this.switchTo(n);
564
+ const r = Number.isInteger(t.index) ? t.index : 0;
565
+ return this.switchTo(r);
563
566
  }
564
567
  /**
565
568
  * 切换图片。
566
569
  * target 可传索引数字,也可传图片 id。
567
570
  */
568
571
  async switchTo(e) {
569
- var a;
572
+ var o;
570
573
  const t = this.resolveBaseGIS();
571
574
  if (!t.success)
572
575
  return t;
@@ -575,10 +578,41 @@ class Re {
575
578
  let s = -1;
576
579
  if (typeof e == "number" ? s = e : typeof e == "string" && (s = this.items.findIndex((l) => l.id === e)), s < 0 || s >= this.items.length)
577
580
  return c(`Invalid image target "${e}".`, "INVALID_TARGET");
578
- const n = this.items[s], r = this.buildLayerPayload(n), o = await this.baseGIS.upsertImageLayer(r);
579
- return o.success ? (this.activeIndex = s, this.layerType = ((a = o == null ? void 0 : o.data) == null ? void 0 : a.layerType) || this.layerType, f(
580
- { activeIndex: s, activeItem: n },
581
- `Image switched to "${n.name}".`
581
+ const r = this.items[s], n = this.buildLayerPayload(r), a = await this.baseGIS.upsertImageLayer(n);
582
+ return a.success ? (this.activeIndex = s, this.layerType = ((o = a == null ? void 0 : a.data) == null ? void 0 : o.layerType) || this.layerType, this.currentPayload = n, y(
583
+ { activeIndex: s, activeItem: r },
584
+ `Image switched to "${r.name}".`
585
+ )) : a;
586
+ }
587
+ /**
588
+ * 更新当前图片图层数据。
589
+ *
590
+ * 这是页面频繁切换时次数据时的推荐入口。
591
+ * 与 load(items) 不同,update(payload) 不要求维护图片数组,也不表达 next / prev 两态。
592
+ */
593
+ async update(e = {}) {
594
+ var l;
595
+ const t = this.resolveBaseGIS();
596
+ if (!t.success)
597
+ return t;
598
+ const s = this.items[this.activeIndex] || {}, r = this.activeIndex >= 0 ? this.activeIndex : 0, n = H(
599
+ {
600
+ ...s,
601
+ ...e
602
+ },
603
+ r,
604
+ this.options.defaultArea
605
+ );
606
+ if (!n.imageUrl && !n.tifUrl)
607
+ return c("Image layer update requires imageUrl or tifUrl.", "INVALID_ITEM");
608
+ typeof e.visible == "boolean" && (this.visible = e.visible);
609
+ const a = this.buildLayerPayload(n, e), o = await this.baseGIS.upsertImageLayer(a);
610
+ return o.success ? (this.items.length === 0 ? (this.items = [n], this.activeIndex = 0) : (this.items.splice(r, 1, n), this.activeIndex = r), this.layerType = ((l = o == null ? void 0 : o.data) == null ? void 0 : l.layerType) || this.layerType, this.currentPayload = a, y(
611
+ {
612
+ activeIndex: this.activeIndex,
613
+ activeItem: n
614
+ },
615
+ `Image layer updated: "${n.name}".`
582
616
  )) : o;
583
617
  }
584
618
  async next() {
@@ -617,11 +651,11 @@ class Re {
617
651
  */
618
652
  destroy(e = {}) {
619
653
  if (!this.resolveBaseGIS().success)
620
- return this.items = [], this.activeIndex = -1, this.layerType = "unknown", f(null, "Image layer controller destroyed (local state only).");
654
+ return this.items = [], this.activeIndex = -1, this.layerType = "unknown", this.currentPayload = null, y(null, "Image layer controller destroyed (local state only).");
621
655
  const s = this.baseGIS.removeImageLayer({
622
656
  layerId: this.getLayerId(e)
623
657
  });
624
- return this.items = [], this.activeIndex = -1, this.layerType = "unknown", s.success ? f(null, "Image layer controller destroyed.") : s;
658
+ return this.items = [], this.activeIndex = -1, this.layerType = "unknown", this.currentPayload = null, s.success ? y(null, "Image layer controller destroyed.") : s;
625
659
  }
626
660
  getState() {
627
661
  var e, t;
@@ -632,29 +666,30 @@ class Re {
632
666
  visible: this.visible,
633
667
  total: this.items.length,
634
668
  activeIndex: this.activeIndex,
635
- activeItem: this.items[this.activeIndex] || null
669
+ activeItem: this.items[this.activeIndex] || null,
670
+ payload: this.currentPayload
636
671
  };
637
672
  }
638
673
  }
639
674
  function B(i = {}) {
640
675
  return Array.isArray(i) || Array.isArray(i == null ? void 0 : i.features) ? { points: i } : i || {};
641
676
  }
642
- function q(i = {}) {
677
+ function Y(i = {}) {
643
678
  const e = B(i);
644
679
  return ["points", "data", "items"].some(
645
680
  (t) => Object.prototype.hasOwnProperty.call(e, t)
646
681
  );
647
682
  }
648
- function ce(i) {
683
+ function he(i) {
649
684
  return !!(i && typeof i.getEngineType == "function" && typeof i.getMapInstance == "function" && typeof i.upsertPointDensityLayer == "function" && typeof i.showPointDensityLayer == "function" && typeof i.hidePointDensityLayer == "function" && typeof i.removePointDensityLayer == "function" && typeof i.clearPointDensityLayer == "function" && typeof i.getPointDensityLayerState == "function");
650
685
  }
651
- function ue(i = {}) {
686
+ function de(i = {}) {
652
687
  const { mapCore: e, baseGIS: t, ...s } = i;
653
688
  return s;
654
689
  }
655
- class Fe {
690
+ class Ve {
656
691
  constructor(e = {}) {
657
- const t = ue(e), s = t.pointDensityLayerId || t.densityLayerId || t.layerId || t.id || "point-density-default";
692
+ const t = de(e), s = t.pointDensityLayerId || t.densityLayerId || t.layerId || t.id || "point-density-default";
658
693
  this.options = {
659
694
  layerId: s,
660
695
  visible: t.visible ?? !0,
@@ -676,7 +711,7 @@ class Fe {
676
711
  }
677
712
  mount(e) {
678
713
  var t, s;
679
- return ce(e) ? (this.baseGIS = e, f(
714
+ return he(e) ? (this.baseGIS = e, y(
680
715
  { engineType: ((s = (t = this.baseGIS).getEngineType) == null ? void 0 : s.call(t)) || "unknown" },
681
716
  "PointDensityController mounted with BaseGIS."
682
717
  )) : c(
@@ -686,7 +721,7 @@ class Fe {
686
721
  }
687
722
  resolveBaseGIS() {
688
723
  var e, t;
689
- return this.baseGIS ? (t = (e = this.baseGIS).getMapInstance) != null && t.call(e) ? f(null, "BaseGIS is ready.") : c(
724
+ return this.baseGIS ? (t = (e = this.baseGIS).getMapInstance) != null && t.call(e) ? y(null, "BaseGIS is ready.") : c(
690
725
  "Map instance is not ready. Please call mapCore.init() first.",
691
726
  "NOT_INITIALIZED"
692
727
  ) : c("PointDensityController has not been mounted.", "NOT_MOUNTED");
@@ -717,17 +752,17 @@ class Fe {
717
752
  const s = this.resolveBaseGIS();
718
753
  if (!s.success)
719
754
  return s;
720
- const n = B(e), r = B(t), o = this.buildPayload({
721
- ...n,
722
- ...r
755
+ const r = B(e), n = B(t), a = this.buildPayload({
756
+ ...r,
757
+ ...n
723
758
  });
724
- if (!q(o))
759
+ if (!Y(a))
725
760
  return c(
726
761
  "Point density layer requires points, data or items.",
727
762
  "INVALID_POINT_SOURCE"
728
763
  );
729
- const a = await this.baseGIS.upsertPointDensityLayer(o);
730
- return a.success && (this.currentPayload = o, this.visible = o.visible !== !1, this.layerType = ((l = a == null ? void 0 : a.data) == null ? void 0 : l.layerType) || this.layerType, this.syncStateFromResult(a)), a;
764
+ const o = await this.baseGIS.upsertPointDensityLayer(a);
765
+ return o.success && (this.currentPayload = a, this.visible = a.visible !== !1, this.layerType = ((l = o == null ? void 0 : o.data) == null ? void 0 : l.layerType) || this.layerType, this.syncStateFromResult(o)), o;
731
766
  }
732
767
  upsert(e = {}, t = {}) {
733
768
  return this.load(e, t);
@@ -737,7 +772,7 @@ class Fe {
737
772
  ...this.currentPayload || this.defaultPayload,
738
773
  ...B(e)
739
774
  };
740
- return !this.currentPayload && !q(t) ? c("Point density layer has not been loaded.", "NOT_LOADED") : this.load(t);
775
+ return !this.currentPayload && !Y(t) ? c("Point density layer has not been loaded.", "NOT_LOADED") : this.load(t);
741
776
  }
742
777
  setConfig(e = {}) {
743
778
  return this.update(e);
@@ -799,7 +834,7 @@ class Fe {
799
834
  hiddenCount: 0,
800
835
  gridCount: 0,
801
836
  destroyed: !0
802
- }, f(null, "Point density layer controller destroyed (local state only).");
837
+ }, y(null, "Point density layer controller destroyed (local state only).");
803
838
  const s = this.baseGIS.removePointDensityLayer({
804
839
  ...e,
805
840
  layerId: this.getLayerId(e)
@@ -811,25 +846,25 @@ class Fe {
811
846
  hiddenCount: 0,
812
847
  gridCount: 0,
813
848
  destroyed: !0
814
- }, s.success ? f(null, "Point density layer controller destroyed.") : s;
849
+ }, s.success ? y(null, "Point density layer controller destroyed.") : s;
815
850
  }
816
851
  removeLayer(e = {}) {
817
852
  return this.destroy(e);
818
853
  }
819
854
  getState() {
820
- var e, t, s, n, r, o, a;
855
+ var e, t, s, r, n, a, o;
821
856
  if ((t = (e = this.baseGIS) == null ? void 0 : e.getMapInstance) != null && t.call(e) && this.currentPayload) {
822
- const l = (n = (s = this.baseGIS).getPointDensityLayerState) == null ? void 0 : n.call(s, {
857
+ const l = (r = (s = this.baseGIS).getPointDensityLayerState) == null ? void 0 : r.call(s, {
823
858
  layerId: this.currentPayload.layerId || this.options.layerId
824
859
  });
825
860
  l != null && l.success && this.syncStateFromResult(l);
826
861
  }
827
862
  return {
828
863
  mounted: !!this.baseGIS,
829
- engineType: ((o = (r = this.baseGIS) == null ? void 0 : r.getEngineType) == null ? void 0 : o.call(r)) || "unknown",
864
+ engineType: ((a = (n = this.baseGIS) == null ? void 0 : n.getEngineType) == null ? void 0 : a.call(n)) || "unknown",
830
865
  layerType: this.layerType,
831
866
  visible: this.visible,
832
- layerId: ((a = this.currentPayload) == null ? void 0 : a.layerId) || this.options.layerId,
867
+ layerId: ((o = this.currentPayload) == null ? void 0 : o.layerId) || this.options.layerId,
833
868
  payload: this.currentPayload,
834
869
  ...this.currentState
835
870
  };
@@ -838,29 +873,29 @@ class Fe {
838
873
  function D(i = {}) {
839
874
  return Array.isArray(i) || Array.isArray(i == null ? void 0 : i.features) ? { points: i } : i || {};
840
875
  }
841
- function H(i = {}) {
876
+ function Z(i = {}) {
842
877
  const e = D(i);
843
878
  return ["points", "data", "items"].some(
844
879
  (t) => Object.prototype.hasOwnProperty.call(e, t)
845
880
  );
846
881
  }
847
- function he(i) {
882
+ function ye(i) {
848
883
  return !!(i && typeof i.getEngineType == "function" && typeof i.getMapInstance == "function" && typeof i.upsertPointLargeLayer == "function" && typeof i.showPointLargeLayer == "function" && typeof i.hidePointLargeLayer == "function" && typeof i.removePointLargeLayer == "function" && typeof i.setPointLargeHighlight == "function" && typeof i.clearPointLargeHighlight == "function" && typeof i.removePointLargePoint == "function" && typeof i.clearPointLargeLayer == "function");
849
884
  }
850
- function Y(i, e = {}) {
885
+ function K(i, e = {}) {
851
886
  return i && typeof i == "object" && !Array.isArray(i) ? i.pointId ?? i.highlightId ?? i.key ?? i.id : i ?? e.pointId ?? e.highlightId ?? e.key ?? e.id;
852
887
  }
853
- function de(i, e = "id", t = "") {
854
- var s, n;
855
- return !i || typeof i != "object" || Array.isArray(i) ? t : i[e] ?? ((s = i.properties) == null ? void 0 : s[e]) ?? i.id ?? ((n = i.properties) == null ? void 0 : n.id) ?? t;
888
+ function fe(i, e = "id", t = "") {
889
+ var s, r;
890
+ return !i || typeof i != "object" || Array.isArray(i) ? t : i[e] ?? ((s = i.properties) == null ? void 0 : s[e]) ?? i.id ?? ((r = i.properties) == null ? void 0 : r.id) ?? t;
856
891
  }
857
- function ye(i = {}) {
892
+ function Ie(i = {}) {
858
893
  const { mapCore: e, baseGIS: t, ...s } = i;
859
894
  return s;
860
895
  }
861
- class Ee {
896
+ class ze {
862
897
  constructor(e = {}) {
863
- const t = ye(e), s = t.pointLargeLayerId || t.largeLayerId || t.layerId || t.id || "point-large-default";
898
+ const t = Ie(e), s = t.pointLargeLayerId || t.largeLayerId || t.layerId || t.id || "point-large-default";
864
899
  this.options = {
865
900
  layerId: s,
866
901
  visible: t.visible ?? !0,
@@ -881,7 +916,7 @@ class Ee {
881
916
  }
882
917
  mount(e) {
883
918
  var t, s;
884
- return he(e) ? (this.baseGIS = e, f(
919
+ return ye(e) ? (this.baseGIS = e, y(
885
920
  { engineType: ((s = (t = this.baseGIS).getEngineType) == null ? void 0 : s.call(t)) || "unknown" },
886
921
  "PointLargeLayerController mounted with BaseGIS."
887
922
  )) : c(
@@ -891,15 +926,15 @@ class Ee {
891
926
  }
892
927
  resolveBaseGIS() {
893
928
  var e, t;
894
- return this.baseGIS ? (t = (e = this.baseGIS).getMapInstance) != null && t.call(e) ? f(null, "BaseGIS is ready.") : c(
929
+ return this.baseGIS ? (t = (e = this.baseGIS).getMapInstance) != null && t.call(e) ? y(null, "BaseGIS is ready.") : c(
895
930
  "Map instance is not ready. Please call mapCore.init() first.",
896
931
  "NOT_INITIALIZED"
897
932
  ) : c("PointLargeLayerController has not been mounted.", "NOT_MOUNTED");
898
933
  }
899
934
  getLayerId(e = {}, t = {}) {
900
- var n;
935
+ var r;
901
936
  const { allowId: s = !0 } = t;
902
- return typeof e == "string" && e ? e : (e == null ? void 0 : e.pointLargeLayerId) || (e == null ? void 0 : e.largeLayerId) || (e == null ? void 0 : e.layerId) || (s ? e == null ? void 0 : e.id : "") || ((n = this.currentPayload) == null ? void 0 : n.layerId) || this.options.layerId;
937
+ return typeof e == "string" && e ? e : (e == null ? void 0 : e.pointLargeLayerId) || (e == null ? void 0 : e.largeLayerId) || (e == null ? void 0 : e.layerId) || (s ? e == null ? void 0 : e.id : "") || ((r = this.currentPayload) == null ? void 0 : r.layerId) || this.options.layerId;
903
938
  }
904
939
  buildPayload(e = {}) {
905
940
  const t = D(e), s = this.getLayerId(t);
@@ -927,17 +962,17 @@ class Ee {
927
962
  const s = this.resolveBaseGIS();
928
963
  if (!s.success)
929
964
  return s;
930
- const n = D(e), r = D(t), o = this.buildPayload({
931
- ...n,
932
- ...r
965
+ const r = D(e), n = D(t), a = this.buildPayload({
966
+ ...r,
967
+ ...n
933
968
  });
934
- if (!H(o))
969
+ if (!Z(a))
935
970
  return c(
936
971
  "Point large layer requires points, data or items.",
937
972
  "INVALID_POINT_SOURCE"
938
973
  );
939
- const a = await this.baseGIS.upsertPointLargeLayer(o);
940
- return a.success && (this.currentPayload = o, this.visible = o.visible !== !1, this.layerType = ((l = a == null ? void 0 : a.data) == null ? void 0 : l.layerType) || this.layerType, this.syncStateFromResult(a)), a;
974
+ const o = await this.baseGIS.upsertPointLargeLayer(a);
975
+ return o.success && (this.currentPayload = a, this.visible = a.visible !== !1, this.layerType = ((l = o == null ? void 0 : o.data) == null ? void 0 : l.layerType) || this.layerType, this.syncStateFromResult(o)), o;
941
976
  }
942
977
  upsert(e = {}, t = {}) {
943
978
  return this.load(e, t);
@@ -947,7 +982,7 @@ class Ee {
947
982
  ...this.currentPayload || this.defaultPayload,
948
983
  ...D(e)
949
984
  };
950
- return !this.currentPayload && !H(t) ? c("Point large layer has not been loaded.", "NOT_LOADED") : this.load(t);
985
+ return !this.currentPayload && !Z(t) ? c("Point large layer has not been loaded.", "NOT_LOADED") : this.load(t);
951
986
  }
952
987
  show(e = {}) {
953
988
  const t = this.resolveBaseGIS();
@@ -976,15 +1011,15 @@ class Ee {
976
1011
  const s = this.resolveBaseGIS();
977
1012
  if (!s.success)
978
1013
  return s;
979
- const n = e && typeof e == "object" && !Array.isArray(e) ? e : t, r = Y(e, n);
980
- if (r == null || r === "")
1014
+ const r = e && typeof e == "object" && !Array.isArray(e) ? e : t, n = K(e, r);
1015
+ if (n == null || n === "")
981
1016
  return c("Point id is required when setting highlight.", "INVALID_POINT_ID");
982
- const o = this.baseGIS.setPointLargeHighlight({
983
- ...n,
984
- layerId: this.getLayerId(n, { allowId: !1 }),
985
- pointId: r
1017
+ const a = this.baseGIS.setPointLargeHighlight({
1018
+ ...r,
1019
+ layerId: this.getLayerId(r, { allowId: !1 }),
1020
+ pointId: n
986
1021
  });
987
- return o.success && this.syncStateFromResult(o), o;
1022
+ return a.success && this.syncStateFromResult(a), a;
988
1023
  }
989
1024
  highlight(e, t = {}) {
990
1025
  return this.setHighlight(e, t);
@@ -1008,12 +1043,12 @@ class Ee {
1008
1043
  removeCachedPoints(e = []) {
1009
1044
  if (!this.currentPayload || !Array.isArray(this.currentPayload.points))
1010
1045
  return;
1011
- const t = this.currentPayload.idKey || this.options.idKey, s = new Set(e.map((n) => String(n)));
1046
+ const t = this.currentPayload.idKey || this.options.idKey, s = new Set(e.map((r) => String(r)));
1012
1047
  this.currentPayload = {
1013
1048
  ...this.currentPayload,
1014
- points: this.currentPayload.points.filter((n, r) => {
1015
- const o = de(n, t, r);
1016
- return !s.has(String(o));
1049
+ points: this.currentPayload.points.filter((r, n) => {
1050
+ const a = fe(r, t, n);
1051
+ return !s.has(String(a));
1017
1052
  })
1018
1053
  };
1019
1054
  }
@@ -1021,15 +1056,15 @@ class Ee {
1021
1056
  const s = this.resolveBaseGIS();
1022
1057
  if (!s.success)
1023
1058
  return s;
1024
- const n = e && typeof e == "object" && !Array.isArray(e) ? e : t, r = Y(e, n);
1025
- if (r == null || r === "")
1059
+ const r = e && typeof e == "object" && !Array.isArray(e) ? e : t, n = K(e, r);
1060
+ if (n == null || n === "")
1026
1061
  return c("Point id is required when removing point.", "INVALID_POINT_ID");
1027
- const o = this.baseGIS.removePointLargePoint({
1028
- ...n,
1029
- layerId: this.getLayerId(n, { allowId: !1 }),
1030
- pointId: r
1062
+ const a = this.baseGIS.removePointLargePoint({
1063
+ ...r,
1064
+ layerId: this.getLayerId(r, { allowId: !1 }),
1065
+ pointId: n
1031
1066
  });
1032
- return o.success && (this.removeCachedPoints([r]), this.syncStateFromResult(o)), o;
1067
+ return a.success && (this.removeCachedPoints([n]), this.syncStateFromResult(a)), a;
1033
1068
  }
1034
1069
  deletePoint(e, t = {}) {
1035
1070
  return this.removePoint(e, t);
@@ -1041,15 +1076,15 @@ class Ee {
1041
1076
  const s = this.resolveBaseGIS();
1042
1077
  if (!s.success)
1043
1078
  return s;
1044
- const n = Array.isArray(e) ? e : [e];
1045
- if (n.length === 0)
1079
+ const r = Array.isArray(e) ? e : [e];
1080
+ if (r.length === 0)
1046
1081
  return c("Point id list is required when removing points.", "INVALID_POINT_ID");
1047
- const r = this.baseGIS.removePointLargePoints({
1082
+ const n = this.baseGIS.removePointLargePoints({
1048
1083
  ...t,
1049
1084
  layerId: this.getLayerId(t, { allowId: !1 }),
1050
- pointIds: n
1085
+ pointIds: r
1051
1086
  });
1052
- return r.success && (this.removeCachedPoints(n), this.syncStateFromResult(r)), r;
1087
+ return n.success && (this.removeCachedPoints(r), this.syncStateFromResult(n)), n;
1053
1088
  }
1054
1089
  deletePoints(e = [], t = {}) {
1055
1090
  return this.removePoints(e, t);
@@ -1094,7 +1129,7 @@ class Ee {
1094
1129
  renderedCount: 0,
1095
1130
  building: !1,
1096
1131
  destroyed: !0
1097
- }, f(null, "Point large layer controller destroyed (local state only).");
1132
+ }, y(null, "Point large layer controller destroyed (local state only).");
1098
1133
  const s = this.baseGIS.removePointLargeLayer({
1099
1134
  ...e,
1100
1135
  layerId: this.getLayerId(e)
@@ -1105,54 +1140,54 @@ class Ee {
1105
1140
  renderedCount: 0,
1106
1141
  building: !1,
1107
1142
  destroyed: !0
1108
- }, s.success ? f(null, "Point large layer controller destroyed.") : s;
1143
+ }, s.success ? y(null, "Point large layer controller destroyed.") : s;
1109
1144
  }
1110
1145
  removeLayer(e = {}) {
1111
1146
  return this.destroy(e);
1112
1147
  }
1113
1148
  getState() {
1114
- var e, t, s, n, r, o, a;
1149
+ var e, t, s, r, n, a, o;
1115
1150
  if ((t = (e = this.baseGIS) == null ? void 0 : e.getMapInstance) != null && t.call(e) && this.currentPayload) {
1116
- const l = (n = (s = this.baseGIS).getPointLargeLayerState) == null ? void 0 : n.call(s, {
1151
+ const l = (r = (s = this.baseGIS).getPointLargeLayerState) == null ? void 0 : r.call(s, {
1117
1152
  layerId: this.currentPayload.layerId || this.options.layerId
1118
1153
  });
1119
1154
  l != null && l.success && this.syncStateFromResult(l);
1120
1155
  }
1121
1156
  return {
1122
1157
  mounted: !!this.baseGIS,
1123
- engineType: ((o = (r = this.baseGIS) == null ? void 0 : r.getEngineType) == null ? void 0 : o.call(r)) || "unknown",
1158
+ engineType: ((a = (n = this.baseGIS) == null ? void 0 : n.getEngineType) == null ? void 0 : a.call(n)) || "unknown",
1124
1159
  layerType: this.layerType,
1125
1160
  visible: this.visible,
1126
- layerId: ((a = this.currentPayload) == null ? void 0 : a.layerId) || this.options.layerId,
1161
+ layerId: ((o = this.currentPayload) == null ? void 0 : o.layerId) || this.options.layerId,
1127
1162
  payload: this.currentPayload,
1128
1163
  ...this.currentState
1129
1164
  };
1130
1165
  }
1131
1166
  }
1132
- function A() {
1167
+ function N() {
1133
1168
  return typeof window < "u" ? window.Cesium : null;
1134
1169
  }
1135
- function fe(i) {
1170
+ function ge(i) {
1136
1171
  let e = i;
1137
1172
  return e > 90 && (e -= 180), e < -90 && (e += 180), e;
1138
1173
  }
1139
- function ge(i, e = 0) {
1140
- return G.divIcon({
1174
+ function me(i, e = 0) {
1175
+ return w.divIcon({
1141
1176
  className: "pressure-label-icon",
1142
- html: `<span style="transform: translate(-50%, -50%) rotate(${fe(e)}deg)">${i}</span>`,
1177
+ html: `<span style="transform: translate(-50%, -50%) rotate(${ge(e)}deg)">${i}</span>`,
1143
1178
  iconSize: [0, 0],
1144
1179
  iconAnchor: [0, 0]
1145
1180
  });
1146
1181
  }
1147
- function Ie(i) {
1148
- return G.divIcon({
1182
+ function be(i) {
1183
+ return w.divIcon({
1149
1184
  className: `pressure-center-icon pressure-center-icon--${i.type.toLowerCase()}`,
1150
1185
  html: `<span class="pressure-center-icon__type">${i.type}</span><span class="pressure-center-icon__value">${i.value}</span>`,
1151
1186
  iconSize: [0, 0],
1152
1187
  iconAnchor: [0, 0]
1153
1188
  });
1154
1189
  }
1155
- function U(i, e) {
1190
+ function j(i, e) {
1156
1191
  return i.some(
1157
1192
  (t) => !(e.right < t.left || e.left > t.right || e.bottom < t.top || e.top > t.bottom)
1158
1193
  );
@@ -1165,28 +1200,28 @@ function W(i, e, t) {
1165
1200
  bottom: i.y + t
1166
1201
  };
1167
1202
  }
1168
- function Z(i, e, t = 18, s = 10) {
1169
- i.sort((n, r) => n.score - r.score);
1170
- for (let n = 0; n < i.length; n += 1) {
1171
- const r = i[n], o = W(r.point, t, s);
1172
- if (!U(e, o))
1173
- return e.push(o), r;
1203
+ function X(i, e, t = 18, s = 10) {
1204
+ i.sort((r, n) => r.score - n.score);
1205
+ for (let r = 0; r < i.length; r += 1) {
1206
+ const n = i[r], a = W(n.point, t, s);
1207
+ if (!j(e, a))
1208
+ return e.push(a), n;
1174
1209
  }
1175
1210
  return null;
1176
1211
  }
1177
- function K(i = [], e = 0) {
1212
+ function J(i = [], e = 0) {
1178
1213
  return e ? i.map((t) => [t[0], t[1] + e]) : i;
1179
1214
  }
1180
- function me(i = [], e = 2) {
1215
+ function pe(i = [], e = 2) {
1181
1216
  if (i.length <= 2 || e <= 1)
1182
1217
  return i;
1183
1218
  const t = [];
1184
- for (let n = 0; n < i.length; n += e)
1185
- t.push(i[n]);
1219
+ for (let r = 0; r < i.length; r += e)
1220
+ t.push(i[r]);
1186
1221
  const s = i[i.length - 1];
1187
1222
  return t[t.length - 1] !== s && t.push(s), t;
1188
1223
  }
1189
- function be(i) {
1224
+ function Se(i) {
1190
1225
  let e = Number(i);
1191
1226
  for (; e > 180; )
1192
1227
  e -= 360;
@@ -1194,68 +1229,75 @@ function be(i) {
1194
1229
  e += 360;
1195
1230
  return e;
1196
1231
  }
1197
- function X(i) {
1232
+ function Q(i) {
1198
1233
  return Math.round(Number(i) / 100);
1199
1234
  }
1200
- function pe(i = [], e = 0) {
1235
+ function ve(i = [], e = 0) {
1201
1236
  const t = [];
1202
1237
  for (let s = 0; s < i.length - 1; s += 2) {
1203
- const n = Number(i[s]), r = Number(i[s + 1]) + e;
1204
- Number.isFinite(n) && Number.isFinite(r) && t.push([n, r]);
1238
+ const r = Number(i[s]), n = Number(i[s + 1]) + e;
1239
+ Number.isFinite(r) && Number.isFinite(n) && t.push([r, n]);
1205
1240
  }
1206
1241
  return t;
1207
1242
  }
1208
- function Se(i, e, t, s, n) {
1209
- const r = n * n, o = r * n;
1243
+ function Ce(i, e, t, s, r) {
1244
+ const n = r * r, a = n * r;
1210
1245
  return [
1211
- 0.5 * (2 * e[0] + (-i[0] + t[0]) * n + (2 * i[0] - 5 * e[0] + 4 * t[0] - s[0]) * r + (-i[0] + 3 * e[0] - 3 * t[0] + s[0]) * o),
1212
- 0.5 * (2 * e[1] + (-i[1] + t[1]) * n + (2 * i[1] - 5 * e[1] + 4 * t[1] - s[1]) * r + (-i[1] + 3 * e[1] - 3 * t[1] + s[1]) * o)
1246
+ 0.5 * (2 * e[0] + (-i[0] + t[0]) * r + (2 * i[0] - 5 * e[0] + 4 * t[0] - s[0]) * n + (-i[0] + 3 * e[0] - 3 * t[0] + s[0]) * a),
1247
+ 0.5 * (2 * e[1] + (-i[1] + t[1]) * r + (2 * i[1] - 5 * e[1] + 4 * t[1] - s[1]) * n + (-i[1] + 3 * e[1] - 3 * t[1] + s[1]) * a)
1213
1248
  ];
1214
1249
  }
1215
- function ve(i = [], e = 5) {
1250
+ function Le(i = [], e = 5) {
1216
1251
  if (i.length < 3)
1217
1252
  return i;
1218
1253
  const t = [i[0]];
1219
1254
  for (let s = 0; s < i.length - 1; s += 1) {
1220
- const n = i[s - 1] || i[s], r = i[s], o = i[s + 1], a = i[s + 2] || o;
1255
+ const r = i[s - 1] || i[s], n = i[s], a = i[s + 1], o = i[s + 2] || a;
1221
1256
  for (let l = 1; l <= e; l += 1)
1222
- t.push(Se(n, r, o, a, l / e));
1257
+ t.push(Ce(r, n, a, o, l / e));
1223
1258
  }
1224
1259
  return t;
1225
1260
  }
1226
- function Ce(i = {}) {
1261
+ function Pe(i = {}) {
1227
1262
  const e = (i.isoline || []).map((s) => {
1228
- const n = Number(s.value);
1263
+ const r = Number(s.value);
1229
1264
  return {
1230
- value: n,
1231
- hpa: X(n),
1232
- major: n % 800 === 0,
1233
- lines: [ve(pe(s.points))].filter((r) => r.length > 1)
1265
+ value: r,
1266
+ hpa: Q(r),
1267
+ major: r % 800 === 0,
1268
+ lines: [Le(ve(s.points))].filter((n) => n.length > 1)
1234
1269
  };
1235
1270
  }), t = ["high", "low"].flatMap((s) => {
1236
- const n = i[s] || {}, r = Array.isArray(n.value) ? n.value : [], o = Array.isArray(n.points) ? n.points : [], a = [];
1237
- for (let l = 0; l < o.length - 1; l += 2)
1238
- a.push({
1271
+ const r = i[s] || {}, n = Array.isArray(r.value) ? r.value : [], a = Array.isArray(r.points) ? r.points : [], o = [];
1272
+ for (let l = 0; l < a.length - 1; l += 2)
1273
+ o.push({
1239
1274
  type: s === "high" ? "H" : "L",
1240
- value: X(r[l / 2]),
1241
- lat: Number(o[l]),
1242
- lon: be(o[l + 1])
1275
+ value: Q(n[l / 2]),
1276
+ lat: Number(a[l]),
1277
+ lon: Se(a[l + 1])
1243
1278
  });
1244
- return a;
1279
+ return o;
1245
1280
  });
1246
1281
  return {
1247
1282
  isolines: e,
1248
1283
  centers: t
1249
1284
  };
1250
1285
  }
1251
- function Ve(i = {}) {
1286
+ function $(i = {}) {
1287
+ return Array.isArray(i == null ? void 0 : i.isolines) ? {
1288
+ ...i,
1289
+ isolines: i.isolines,
1290
+ centers: Array.isArray(i.centers) ? i.centers : []
1291
+ } : Pe(i);
1292
+ }
1293
+ function _e(i = {}) {
1252
1294
  const e = /* @__PURE__ */ new Map();
1253
1295
  return (t = "default") => {
1254
1296
  const s = t || "default";
1255
- return e.has(s) || e.set(s, Ce(i[s] || i.default || {})), e.get(s);
1297
+ return e.has(s) || e.set(s, $(i[s] || i.default || {})), e.get(s);
1256
1298
  };
1257
1299
  }
1258
- class Le {
1300
+ class Ge {
1259
1301
  constructor(e = {}) {
1260
1302
  this.mapCore = e.mapCore, this.mapContainerId = e.mapContainerId, this.getData = e.getData, this.isVisible = e.isVisible, this.onStateChange = e.onStateChange, this.worldCopyOffsets = e.worldCopyOffsets || [-360, 0, 360], this.cesiumWorldCopyOffsets = e.cesiumWorldCopyOffsets || [0], this.cesiumLineThinStep = e.cesiumLineThinStep || 2, this.labelLayerGroup = null, this.cesiumLabelCollection = null, this.labelUpdateTimer = null, this.removeViewChangeListener = null;
1261
1303
  }
@@ -1266,22 +1308,22 @@ class Le {
1266
1308
  }
1267
1309
  // Cesium 3D 模式需要判断地球背面遮挡,2D/哥伦布视图不做额外遮挡过滤。
1268
1310
  getCesiumSceneMode() {
1269
- var t, s, n;
1311
+ var t, s, r;
1270
1312
  const e = (s = (t = this.mapCore) == null ? void 0 : t.getMapInstance) == null ? void 0 : s.call(t);
1271
- return (n = e == null ? void 0 : e.scene) == null ? void 0 : n.mode;
1313
+ return (r = e == null ? void 0 : e.scene) == null ? void 0 : r.mode;
1272
1314
  }
1273
1315
  // 挂载标注层事件:Leaflet 监听地图事件,Cesium 走 BaseGIS 的视图变化回调。
1274
1316
  mount() {
1275
- var t, s, n, r, o, a;
1317
+ var t, s, r, n, a, o;
1276
1318
  if (this.isCesiumEngine()) {
1277
- this.removeViewChangeListener = ((r = (n = (s = (t = this.mapCore) == null ? void 0 : t.onViewChange) == null ? void 0 : s.call(t, {
1319
+ this.removeViewChangeListener = ((n = (r = (s = (t = this.mapCore) == null ? void 0 : t.onViewChange) == null ? void 0 : s.call(t, {
1278
1320
  onEnd: () => this.scheduleUpdate(),
1279
1321
  endDelay: 180
1280
- })) == null ? void 0 : n.data) == null ? void 0 : r.off) || null;
1322
+ })) == null ? void 0 : r.data) == null ? void 0 : n.off) || null;
1281
1323
  return;
1282
1324
  }
1283
- const e = (a = (o = this.mapCore) == null ? void 0 : o.getMapInstance) == null ? void 0 : a.call(o);
1284
- e && (this.labelLayerGroup = G.layerGroup().addTo(e), e.on("moveend zoomend resize", this.scheduleUpdate, this));
1325
+ const e = (o = (a = this.mapCore) == null ? void 0 : a.getMapInstance) == null ? void 0 : o.call(a);
1326
+ e && (this.labelLayerGroup = w.layerGroup().addTo(e), e.on("moveend zoomend resize", this.scheduleUpdate, this));
1285
1327
  }
1286
1328
  // 地图连续移动时只在下一帧刷新一次标签,减少重复碰撞计算。
1287
1329
  scheduleUpdate() {
@@ -1301,10 +1343,10 @@ class Le {
1301
1343
  }
1302
1344
  // 销毁时移除地图事件、Cesium LabelCollection 和 Leaflet 图层组。
1303
1345
  destroy() {
1304
- var t, s, n, r, o;
1346
+ var t, s, r, n, a;
1305
1347
  this.labelUpdateTimer && (window.cancelAnimationFrame(this.labelUpdateTimer), this.labelUpdateTimer = null);
1306
1348
  const e = (s = (t = this.mapCore) == null ? void 0 : t.getMapInstance) == null ? void 0 : s.call(t);
1307
- (n = e == null ? void 0 : e.off) == null || n.call(e, "moveend zoomend resize", this.scheduleUpdate, this), (r = this.removeViewChangeListener) == null || r.call(this), this.removeViewChangeListener = null, this.clearCesiumLabelCollection(!0), (o = this.labelLayerGroup) == null || o.remove(), this.labelLayerGroup = null;
1349
+ (r = e == null ? void 0 : e.off) == null || r.call(e, "moveend zoomend resize", this.scheduleUpdate, this), (n = this.removeViewChangeListener) == null || n.call(this), this.removeViewChangeListener = null, this.clearCesiumLabelCollection(!0), (a = this.labelLayerGroup) == null || a.remove(), this.labelLayerGroup = null;
1308
1350
  }
1309
1351
  // 把标签数量回传给页面状态面板。
1310
1352
  emitStateChange(e) {
@@ -1315,35 +1357,35 @@ class Le {
1315
1357
  }
1316
1358
  // Cesium 3D 球面下,屏幕外或地球背面的点不参与标签候选。
1317
1359
  isCesiumPointVisible(e) {
1318
- var u, h, g, d, y, I;
1319
- const t = (h = (u = this.mapCore) == null ? void 0 : u.getMapInstance) == null ? void 0 : h.call(u), s = A(), n = t == null ? void 0 : t.scene;
1320
- if (!t || !s || !n)
1360
+ var u, h, I, d, f, g;
1361
+ const t = (h = (u = this.mapCore) == null ? void 0 : u.getMapInstance) == null ? void 0 : h.call(u), s = N(), r = t == null ? void 0 : t.scene;
1362
+ if (!t || !s || !r)
1321
1363
  return !1;
1322
1364
  if (this.getCesiumSceneMode() !== s.SceneMode.SCENE3D)
1323
1365
  return !0;
1324
- const r = ((g = n.globe) == null ? void 0 : g.ellipsoid) || ((d = n.mapProjection) == null ? void 0 : d.ellipsoid), o = ((y = n.camera) == null ? void 0 : y.positionWC) || ((I = n.camera) == null ? void 0 : I.position);
1325
- if (!r || !o)
1366
+ const n = ((I = r.globe) == null ? void 0 : I.ellipsoid) || ((d = r.mapProjection) == null ? void 0 : d.ellipsoid), a = ((f = r.camera) == null ? void 0 : f.positionWC) || ((g = r.camera) == null ? void 0 : g.position);
1367
+ if (!n || !a)
1326
1368
  return !0;
1327
- const a = s.Cartesian3.fromDegrees(e[1], e[0], 0);
1328
- return new s.EllipsoidalOccluder(r, o).isPointVisible(a);
1369
+ const o = s.Cartesian3.fromDegrees(e[1], e[0], 0);
1370
+ return new s.EllipsoidalOccluder(n, a).isPointVisible(o);
1329
1371
  }
1330
1372
  // 标签候选点只在地图容器附近参与碰撞,防止屏幕外点影响布局。
1331
1373
  isCesiumScreenPointInViewport(e, t = 80) {
1332
- const s = document.getElementById(this.mapContainerId), n = (s == null ? void 0 : s.clientWidth) || 0, r = (s == null ? void 0 : s.clientHeight) || 0;
1333
- return !n || !r ? !0 : !(e.x < -t || e.y < -t || e.x > n + t || e.y > r + t);
1374
+ const s = document.getElementById(this.mapContainerId), r = (s == null ? void 0 : s.clientWidth) || 0, n = (s == null ? void 0 : s.clientHeight) || 0;
1375
+ return !r || !n ? !0 : !(e.x < -t || e.y < -t || e.x > r + t || e.y > n + t);
1334
1376
  }
1335
1377
  // LabelCollection 比为每个标签创建 Entity 更轻量,适合动态重建。
1336
1378
  ensureCesiumLabelCollection() {
1337
- var s, n, r;
1338
- const e = (n = (s = this.mapCore) == null ? void 0 : s.getMapInstance) == null ? void 0 : n.call(s), t = A();
1339
- return !((r = e == null ? void 0 : e.scene) != null && r.primitives) || !t ? null : (this.cesiumLabelCollection || (this.cesiumLabelCollection = e.scene.primitives.add(new t.LabelCollection())), this.cesiumLabelCollection);
1379
+ var s, r, n;
1380
+ const e = (r = (s = this.mapCore) == null ? void 0 : s.getMapInstance) == null ? void 0 : r.call(s), t = N();
1381
+ return !((n = e == null ? void 0 : e.scene) != null && n.primitives) || !t ? null : (this.cesiumLabelCollection || (this.cesiumLabelCollection = e.scene.primitives.add(new t.LabelCollection())), this.cesiumLabelCollection);
1340
1382
  }
1341
1383
  // 数据更新和图层隐藏时清空标签;页面卸载时才销毁集合。
1342
1384
  clearCesiumLabelCollection(e = !1) {
1343
- var s, n, r;
1344
- const t = (n = (s = this.mapCore) == null ? void 0 : s.getMapInstance) == null ? void 0 : n.call(s);
1385
+ var s, r, n;
1386
+ const t = (r = (s = this.mapCore) == null ? void 0 : s.getMapInstance) == null ? void 0 : r.call(s);
1345
1387
  if (this.cesiumLabelCollection) {
1346
- if (e && ((r = t == null ? void 0 : t.scene) != null && r.primitives)) {
1388
+ if (e && ((n = t == null ? void 0 : t.scene) != null && n.primitives)) {
1347
1389
  t.scene.primitives.remove(this.cesiumLabelCollection), this.cesiumLabelCollection = null;
1348
1390
  return;
1349
1391
  }
@@ -1352,149 +1394,149 @@ class Le {
1352
1394
  }
1353
1395
  // 页面数据统一是 [lat, lon],Cesium 创建坐标时需要 [lon, lat]。
1354
1396
  createCesiumPosition(e) {
1355
- return A().Cartesian3.fromDegrees(e[1], e[0], 0);
1397
+ return N().Cartesian3.fromDegrees(e[1], e[0], 0);
1356
1398
  }
1357
1399
  // 将地理点投影到容器像素坐标,供标签碰撞避让使用。
1358
1400
  projectCesiumPoint(e) {
1359
- var n, r;
1401
+ var r, n;
1360
1402
  if (!this.isCesiumPointVisible(e))
1361
1403
  return null;
1362
- const t = (r = (n = this.mapCore) == null ? void 0 : n.projectToContainerPoint) == null ? void 0 : r.call(n, {
1404
+ const t = (n = (r = this.mapCore) == null ? void 0 : r.projectToContainerPoint) == null ? void 0 : n.call(r, {
1363
1405
  latitude: e[0],
1364
1406
  longitude: e[1]
1365
1407
  });
1366
1408
  if (!(t != null && t.success))
1367
1409
  return null;
1368
- const s = G.point(t.data.x, t.data.y);
1410
+ const s = w.point(t.data.x, t.data.y);
1369
1411
  return this.isCesiumScreenPointInViewport(s) ? s : null;
1370
1412
  }
1371
1413
  // Cesium 添加单个标签,中心点标签和线值标签共用该方法。
1372
1414
  addCesiumLabel(e, t, s = {}) {
1373
- const n = A(), r = this.ensureCesiumLabelCollection();
1374
- return !r || !n || !this.isCesiumPointVisible(e) ? null : r.add({
1415
+ const r = N(), n = this.ensureCesiumLabelCollection();
1416
+ return !n || !r || !this.isCesiumPointVisible(e) ? null : n.add({
1375
1417
  position: this.createCesiumPosition(e),
1376
1418
  text: t,
1377
1419
  font: s.font || "12px Arial",
1378
- fillColor: s.fillColor || n.Color.fromCssColorString("#244349"),
1379
- outlineColor: n.Color.fromCssColorString("rgba(255,255,255,0.72)"),
1420
+ fillColor: s.fillColor || r.Color.fromCssColorString("#244349"),
1421
+ outlineColor: r.Color.fromCssColorString("rgba(255,255,255,0.72)"),
1380
1422
  outlineWidth: s.outlineWidth ?? 2,
1381
- style: n.LabelStyle.FILL_AND_OUTLINE,
1423
+ style: r.LabelStyle.FILL_AND_OUTLINE,
1382
1424
  showBackground: s.showBackground !== !1,
1383
- backgroundColor: s.backgroundColor || n.Color.fromCssColorString("rgba(246,251,231,0.92)"),
1384
- backgroundPadding: s.backgroundPadding || new n.Cartesian2(7, 4),
1385
- horizontalOrigin: n.HorizontalOrigin.CENTER,
1386
- verticalOrigin: n.VerticalOrigin.CENTER,
1425
+ backgroundColor: s.backgroundColor || r.Color.fromCssColorString("rgba(246,251,231,0.92)"),
1426
+ backgroundPadding: s.backgroundPadding || new r.Cartesian2(7, 4),
1427
+ horizontalOrigin: r.HorizontalOrigin.CENTER,
1428
+ verticalOrigin: r.VerticalOrigin.CENTER,
1387
1429
  disableDepthTestDistance: s.disableDepthTestDistance ?? 0,
1388
1430
  scale: s.scale || 1
1389
1431
  });
1390
1432
  }
1391
1433
  // Cesium H/L 中心点标注,先做屏幕碰撞检测再绘制。
1392
1434
  addCesiumCenters(e, t) {
1393
- const s = A();
1435
+ const s = N();
1394
1436
  if (!s)
1395
1437
  return 0;
1396
- let n = 0;
1397
- return e.centers.forEach((r) => {
1398
- this.cesiumWorldCopyOffsets.forEach((o) => {
1399
- const a = [r.lat, r.lon + o], l = this.projectCesiumPoint(a);
1438
+ let r = 0;
1439
+ return e.centers.forEach((n) => {
1440
+ this.cesiumWorldCopyOffsets.forEach((a) => {
1441
+ const o = [n.lat, n.lon + a], l = this.projectCesiumPoint(o);
1400
1442
  if (!l)
1401
1443
  return;
1402
1444
  const u = W(l, 18, 20);
1403
- U(t, u) || (t.push(u), this.addCesiumLabel(a, `${r.type}
1404
- ${r.value}`, {
1445
+ j(t, u) || (t.push(u), this.addCesiumLabel(o, `${n.type}
1446
+ ${n.value}`, {
1405
1447
  font: "700 18px Arial",
1406
- fillColor: s.Color.fromCssColorString(r.type === "H" ? "#efb7ff" : "#e3f8ff"),
1448
+ fillColor: s.Color.fromCssColorString(n.type === "H" ? "#efb7ff" : "#e3f8ff"),
1407
1449
  backgroundColor: s.Color.TRANSPARENT,
1408
1450
  showBackground: !1,
1409
1451
  outlineWidth: 3
1410
- }), n += 1);
1452
+ }), r += 1);
1411
1453
  });
1412
- }), n;
1454
+ }), r;
1413
1455
  }
1414
1456
  // Leaflet H/L 中心点标注,按当前视野过滤后再做碰撞检测。
1415
1457
  addLeafletCenters(e, t) {
1416
- var o, a, l, u;
1417
- const s = (a = (o = this.mapCore) == null ? void 0 : o.getMapInstance) == null ? void 0 : a.call(o), n = (u = (l = s == null ? void 0 : s.getBounds) == null ? void 0 : l.call(s)) == null ? void 0 : u.pad(0.2);
1418
- if (!s || !n || !this.labelLayerGroup)
1458
+ var a, o, l, u;
1459
+ const s = (o = (a = this.mapCore) == null ? void 0 : a.getMapInstance) == null ? void 0 : o.call(a), r = (u = (l = s == null ? void 0 : s.getBounds) == null ? void 0 : l.call(s)) == null ? void 0 : u.pad(0.2);
1460
+ if (!s || !r || !this.labelLayerGroup)
1419
1461
  return 0;
1420
- let r = 0;
1462
+ let n = 0;
1421
1463
  return e.centers.forEach((h) => {
1422
- this.worldCopyOffsets.forEach((g) => {
1423
- const d = [h.lat, h.lon + g];
1424
- if (!n.contains(d))
1464
+ this.worldCopyOffsets.forEach((I) => {
1465
+ const d = [h.lat, h.lon + I];
1466
+ if (!r.contains(d))
1425
1467
  return;
1426
- const y = s.latLngToContainerPoint(d), I = W(y, 16, 18);
1427
- U(t, I) || (t.push(I), G.marker(d, {
1468
+ const f = s.latLngToContainerPoint(d), g = W(f, 16, 18);
1469
+ j(t, g) || (t.push(g), w.marker(d, {
1428
1470
  interactive: !1,
1429
1471
  keyboard: !1,
1430
- icon: Ie(h),
1472
+ icon: be(h),
1431
1473
  zIndexOffset: 140
1432
- }).addTo(this.labelLayerGroup), r += 1);
1474
+ }).addTo(this.labelLayerGroup), n += 1);
1433
1475
  });
1434
- }), r;
1476
+ }), n;
1435
1477
  }
1436
1478
  // 线值标签统一从折线中采样候选点,再按离视野中心的距离排序。
1437
1479
  getLineLabelCandidates(e, t = {}) {
1438
- const { bounds: s, useSegmentMidpoint: n = !1, viewCenter: r, projectPoint: o } = t, a = [], l = Math.max(Math.floor(e.length / 40), 1);
1480
+ const { bounds: s, useSegmentMidpoint: r = !1, viewCenter: n, projectPoint: a } = t, o = [], l = Math.max(Math.floor(e.length / 40), 1);
1439
1481
  for (let u = 0; u < e.length - 1; u += l) {
1440
- const h = e[u], g = e[Math.min(u + l, e.length - 1)], d = [
1441
- (h[0] + g[0]) / 2,
1442
- (h[1] + g[1]) / 2
1482
+ const h = e[u], I = e[Math.min(u + l, e.length - 1)], d = [
1483
+ (h[0] + I[0]) / 2,
1484
+ (h[1] + I[1]) / 2
1443
1485
  ];
1444
1486
  if (s && !s.contains(d))
1445
1487
  continue;
1446
- const y = o(h), I = o(g), m = o(d);
1447
- if (!y || !I || !m)
1488
+ const f = a(h), g = a(I), m = a(d);
1489
+ if (!f || !g || !m)
1448
1490
  continue;
1449
- const p = n ? G.point((y.x + I.x) / 2, (y.y + I.y) / 2) : m;
1450
- a.push({
1491
+ const p = r ? w.point((f.x + g.x) / 2, (f.y + g.y) / 2) : m;
1492
+ o.push({
1451
1493
  position: d,
1452
1494
  point: p,
1453
- angle: Math.atan2(I.y - y.y, I.x - y.x) * 180 / Math.PI,
1454
- score: p.distanceTo(r)
1495
+ angle: Math.atan2(g.y - f.y, g.x - f.x) * 180 / Math.PI,
1496
+ score: p.distanceTo(n)
1455
1497
  });
1456
1498
  }
1457
- return a;
1499
+ return o;
1458
1500
  }
1459
1501
  // Leaflet 线值标签:每条线选择靠近视野中心且不碰撞的位置。
1460
1502
  addLeafletLineLabels(e, t) {
1461
- var a, l, u, h;
1462
- const s = (l = (a = this.mapCore) == null ? void 0 : a.getMapInstance) == null ? void 0 : l.call(a), n = (h = (u = s == null ? void 0 : s.getBounds) == null ? void 0 : u.call(s)) == null ? void 0 : h.pad(0.15);
1463
- if (!s || !n || !this.labelLayerGroup)
1503
+ var o, l, u, h;
1504
+ const s = (l = (o = this.mapCore) == null ? void 0 : o.getMapInstance) == null ? void 0 : l.call(o), r = (h = (u = s == null ? void 0 : s.getBounds) == null ? void 0 : u.call(s)) == null ? void 0 : h.pad(0.15);
1505
+ if (!s || !r || !this.labelLayerGroup)
1464
1506
  return 0;
1465
- const r = s.getSize().divideBy(2);
1466
- let o = 0;
1467
- return e.isolines.forEach((g) => {
1507
+ const n = s.getSize().divideBy(2);
1508
+ let a = 0;
1509
+ return e.isolines.forEach((I) => {
1468
1510
  this.worldCopyOffsets.forEach((d) => {
1469
- g.lines.forEach((y) => {
1470
- const I = K(y, d), m = Z(this.getLineLabelCandidates(I, {
1471
- bounds: n,
1511
+ I.lines.forEach((f) => {
1512
+ const g = J(f, d), m = X(this.getLineLabelCandidates(g, {
1513
+ bounds: r,
1472
1514
  useSegmentMidpoint: !0,
1473
- viewCenter: r,
1515
+ viewCenter: n,
1474
1516
  projectPoint: (p) => s.latLngToContainerPoint(p)
1475
1517
  }), t);
1476
- m && (G.marker(m.position, {
1518
+ m && (w.marker(m.position, {
1477
1519
  interactive: !1,
1478
1520
  keyboard: !1,
1479
- icon: ge(g.hpa, m.angle),
1521
+ icon: me(I.hpa, m.angle),
1480
1522
  zIndexOffset: 120
1481
- }).addTo(this.labelLayerGroup), o += 1);
1523
+ }).addTo(this.labelLayerGroup), a += 1);
1482
1524
  });
1483
1525
  });
1484
- }), o;
1526
+ }), a;
1485
1527
  }
1486
1528
  // Cesium 线值标签:先将候选点投影到屏幕,再按距离和碰撞筛选。
1487
1529
  addCesiumLineLabels(e, t) {
1488
1530
  let s = 0;
1489
- const n = document.getElementById(this.mapContainerId), r = G.point(((n == null ? void 0 : n.clientWidth) || 0) / 2, ((n == null ? void 0 : n.clientHeight) || 0) / 2);
1490
- return e.isolines.forEach((o) => {
1491
- this.cesiumWorldCopyOffsets.forEach((a) => {
1492
- o.lines.forEach((l) => {
1493
- const u = me(K(l, a), this.cesiumLineThinStep), h = Z(this.getLineLabelCandidates(u, {
1494
- viewCenter: r,
1495
- projectPoint: (g) => this.projectCesiumPoint(g)
1531
+ const r = document.getElementById(this.mapContainerId), n = w.point(((r == null ? void 0 : r.clientWidth) || 0) / 2, ((r == null ? void 0 : r.clientHeight) || 0) / 2);
1532
+ return e.isolines.forEach((a) => {
1533
+ this.cesiumWorldCopyOffsets.forEach((o) => {
1534
+ a.lines.forEach((l) => {
1535
+ const u = pe(J(l, o), this.cesiumLineThinStep), h = X(this.getLineLabelCandidates(u, {
1536
+ viewCenter: n,
1537
+ projectPoint: (I) => this.projectCesiumPoint(I)
1496
1538
  }), t);
1497
- h && (this.addCesiumLabel(h.position, String(o.hpa), {
1539
+ h && (this.addCesiumLabel(h.position, String(a.hpa), {
1498
1540
  font: "12px Arial"
1499
1541
  }), s += 1);
1500
1542
  });
@@ -1503,45 +1545,67 @@ ${r.value}`, {
1503
1545
  }
1504
1546
  // 重建 Cesium 全部标签,并请求场景刷新。
1505
1547
  updateCesiumLabels() {
1506
- var a, l, u, h, g, d, y, I, m;
1507
- const e = (l = (a = this.mapCore) == null ? void 0 : a.getMapInstance) == null ? void 0 : l.call(a), t = (u = this.getData) == null ? void 0 : u.call(this);
1548
+ var o, l, u, h, I, d, f, g, m;
1549
+ const e = (l = (o = this.mapCore) == null ? void 0 : o.getMapInstance) == null ? void 0 : l.call(o), t = (u = this.getData) == null ? void 0 : u.call(this);
1508
1550
  if (!t)
1509
1551
  return this.clear(), 0;
1510
1552
  const s = this.cesiumLabelCollection;
1511
1553
  this.cesiumLabelCollection = null;
1512
- const n = this.ensureCesiumLabelCollection();
1513
- if (!n)
1554
+ const r = this.ensureCesiumLabelCollection();
1555
+ if (!r)
1514
1556
  return this.cesiumLabelCollection = s, 0;
1515
- const r = [];
1516
- let o = 0;
1557
+ const n = [];
1558
+ let a = 0;
1517
1559
  try {
1518
- o = this.addCesiumCenters(t, r) + this.addCesiumLineLabels(t, r), s && s !== n && ((h = e == null ? void 0 : e.scene) != null && h.primitives) && e.scene.primitives.remove(s);
1560
+ a = this.addCesiumCenters(t, n) + this.addCesiumLineLabels(t, n), s && s !== r && ((h = e == null ? void 0 : e.scene) != null && h.primitives) && e.scene.primitives.remove(s);
1519
1561
  } catch (p) {
1520
- throw (y = (d = (g = e == null ? void 0 : e.scene) == null ? void 0 : g.primitives) == null ? void 0 : d.remove) == null || y.call(d, n), this.cesiumLabelCollection = s, p;
1562
+ throw (f = (d = (I = e == null ? void 0 : e.scene) == null ? void 0 : I.primitives) == null ? void 0 : d.remove) == null || f.call(d, r), this.cesiumLabelCollection = s, p;
1521
1563
  }
1522
- return this.emitStateChange(o), (m = (I = e == null ? void 0 : e.scene) == null ? void 0 : I.requestRender) == null || m.call(I), o;
1564
+ return this.emitStateChange(a), (m = (g = e == null ? void 0 : e.scene) == null ? void 0 : g.requestRender) == null || m.call(g), a;
1523
1565
  }
1524
1566
  // 重建 Leaflet 全部标签和 marker。
1525
1567
  updateLeafletLabels() {
1526
- var a, l, u;
1527
- const e = (a = this.getData) == null ? void 0 : a.call(this), t = (u = (l = this.mapCore) == null ? void 0 : l.getMapInstance) == null ? void 0 : u.call(l);
1568
+ var o, l, u;
1569
+ const e = (o = this.getData) == null ? void 0 : o.call(this), t = (u = (l = this.mapCore) == null ? void 0 : l.getMapInstance) == null ? void 0 : u.call(l);
1528
1570
  if (!e || !t || !this.labelLayerGroup)
1529
1571
  return this.clear(), 0;
1530
- const s = this.labelLayerGroup, n = G.layerGroup();
1531
- this.labelLayerGroup = n;
1532
- const r = [];
1533
- let o = 0;
1572
+ const s = this.labelLayerGroup, r = w.layerGroup();
1573
+ this.labelLayerGroup = r;
1574
+ const n = [];
1575
+ let a = 0;
1534
1576
  try {
1535
- o = this.addLeafletCenters(e, r) + this.addLeafletLineLabels(e, r), n.addTo(t), s == null || s.remove();
1577
+ a = this.addLeafletCenters(e, n) + this.addLeafletLineLabels(e, n), r.addTo(t), s == null || s.remove();
1536
1578
  } catch (h) {
1537
- throw n.remove(), this.labelLayerGroup = s, h;
1579
+ throw r.remove(), this.labelLayerGroup = s, h;
1538
1580
  }
1539
- return this.emitStateChange(o), o;
1581
+ return this.emitStateChange(a), a;
1540
1582
  }
1541
1583
  }
1542
- class ze {
1584
+ class Ue {
1585
+ /**
1586
+ * @param {Object} options 等压线组合图层参数。
1587
+ * @param {Object} options.mapCore 必填,BaseGIS 实例,线图层和标注层都通过它访问当前地图引擎。
1588
+ * @param {String} [options.layerId='pressure-contour'] 图层 id,用于后续更新、显隐和销毁同一组等压线。
1589
+ * @param {Object} [options.data] 初始数据,支持 Windy 原始数据,也支持已整理的 `{ isolines, centers }`。
1590
+ * @param {Object} [options.sourceData] 初始数据别名,作用同 data。
1591
+ * @param {String} [options.color='rgba(255,255,255,0.82)'] 等压线颜色。
1592
+ * @param {Number} [options.weight=1.15] Leaflet 线宽,保留该字段是为了兼容 Leaflet polyline 参数。
1593
+ * @param {Number} [options.width=1.15] Cesium 线宽,Cesium 和 Leaflet 页面可同时传 width / weight。
1594
+ * @param {Number} [options.opacity=1] 等压线透明度。
1595
+ * @param {Number} [options.smoothFactor=0.2] Leaflet 折线简化参数,不是数据平滑;数据平滑由 smoothLine 处理。
1596
+ * @param {String} [options.lineJoin='round'] 线段连接样式,主要给 Leaflet 使用。
1597
+ * @param {String} [options.lineCap='round'] 线段端点样式,主要给 Leaflet 使用。
1598
+ * @param {Number[]} [options.worldCopyOffsets=[-360,0,360]] 世界副本经度偏移,Leaflet 跨日期变更线时使用。
1599
+ * @param {Number} [options.lineThinStep=1] 绘制线时的抽稀步长,Cesium 数据量大时可调大。
1600
+ * @param {String} [options.mapContainerId] 地图容器 id,Cesium 标签碰撞和屏幕范围判断会用到。
1601
+ * @param {Function} [options.isAnnotationVisible] 标注显隐判断函数,返回 false 时不显示线值标签和 H/L 中心点。
1602
+ * @param {Number[]} [options.cesiumWorldCopyOffsets=[0]] Cesium 标注经度偏移,默认不复制世界副本。
1603
+ * @param {Number} [options.cesiumLineThinStep=2] Cesium 线值标签候选点抽稀步长,值越大标签计算越少。
1604
+ * @param {Function} [options.onContourStateChange] 线图层状态变化回调,返回 levelCount / lineCount 等统计。
1605
+ * @param {Function} [options.onAnnotationStateChange] 标注状态变化回调,返回 labelCount。
1606
+ */
1543
1607
  constructor(e = {}) {
1544
- this.mapCore = e.mapCore, this.contourController = new ne({
1608
+ this.mapCore = e.mapCore, this.currentData = $(e.data || e.sourceData || {}), this.contourController = new oe({
1545
1609
  mapCore: e.mapCore,
1546
1610
  layerId: e.layerId || "pressure-contour",
1547
1611
  color: e.color || "rgba(255,255,255,0.82)",
@@ -1554,10 +1618,10 @@ class ze {
1554
1618
  worldCopyOffsets: e.worldCopyOffsets || [-360, 0, 360],
1555
1619
  lineThinStep: e.lineThinStep || 1,
1556
1620
  onStateChange: e.onContourStateChange
1557
- }), this.annotationLayer = new Le({
1621
+ }), this.annotationLayer = new Ge({
1558
1622
  mapCore: e.mapCore,
1559
1623
  mapContainerId: e.mapContainerId,
1560
- getData: e.getData,
1624
+ getData: () => this.currentData,
1561
1625
  isVisible: e.isAnnotationVisible,
1562
1626
  worldCopyOffsets: e.worldCopyOffsets || [-360, 0, 360],
1563
1627
  cesiumWorldCopyOffsets: e.cesiumWorldCopyOffsets || [0],
@@ -1569,8 +1633,8 @@ class ze {
1569
1633
  this.annotationLayer.mount();
1570
1634
  }
1571
1635
  buildPayload(e, t = {}) {
1572
- return {
1573
- isolines: (e == null ? void 0 : e.isolines) || [],
1636
+ return this.currentData = $(e), {
1637
+ isolines: this.currentData.isolines || [],
1574
1638
  visible: t.visible !== !1,
1575
1639
  ...t
1576
1640
  };
@@ -1581,8 +1645,8 @@ class ze {
1581
1645
  return s != null && s.success && this.annotationLayer.update(), s;
1582
1646
  }
1583
1647
  async update(e, t = {}) {
1584
- const s = this.buildPayload(e, t), r = !!this.contourController.getState().payload ? await this.contourController.update(s) : await this.contourController.load(s);
1585
- return r != null && r.success && this.annotationLayer.update(), r;
1648
+ const s = this.buildPayload(e, t), n = !!this.contourController.getState().payload ? await this.contourController.update(s) : await this.contourController.load(s);
1649
+ return n != null && n.success && this.annotationLayer.update(), n;
1586
1650
  }
1587
1651
  hide() {
1588
1652
  const e = this.contourController.hide();
@@ -1604,7 +1668,7 @@ class ze {
1604
1668
  this.annotationLayer.destroy(), this.contourController.destroy();
1605
1669
  }
1606
1670
  }
1607
- class z {
1671
+ class V {
1608
1672
  constructor(e = {}) {
1609
1673
  this.rawData = e, this.bound = Array.isArray(e.Bound) ? e.Bound : [], this.data = Array.isArray(e.DataAry) ? e.DataAry : [], this.valid = !1, this.errorMessage = "", this.lonMin = 0, this.latMin = 0, this.lonMax = 0, this.latMax = 0, this.lonCount = 0, this.latCount = 0, this.lonSpan = 0, this.latSpan = 0, this.lonStep = 0, this.latStep = 0, this.valueScale = 1, this.parse();
1610
1674
  }
@@ -1613,12 +1677,12 @@ class z {
1613
1677
  this.errorMessage = "Wind field Bound must contain at least 6 values.";
1614
1678
  return;
1615
1679
  }
1616
- const [e, t, s, n, r, o, a = 1] = this.bound, l = Number(s) * Number(n) * 2;
1617
- if (!Number.isFinite(Number(e)) || !Number.isFinite(Number(t)) || Number(s) < 2 || Number(n) < 2 || Number(r) <= 0 || Number(o) <= 0 || this.data.length !== l) {
1680
+ const [e, t, s, r, n, a, o = 1] = this.bound, l = Number(s) * Number(r) * 2;
1681
+ if (!Number.isFinite(Number(e)) || !Number.isFinite(Number(t)) || Number(s) < 2 || Number(r) < 2 || Number(n) <= 0 || Number(a) <= 0 || this.data.length !== l) {
1618
1682
  this.errorMessage = `Invalid wind field data. Expected DataAry length ${l}, got ${this.data.length}.`;
1619
1683
  return;
1620
1684
  }
1621
- this.lonMin = Number(e), this.latMin = Number(t), this.lonCount = Number(s), this.latCount = Number(n), this.lonSpan = Number(r), this.latSpan = Number(o), this.valueScale = Number(a) || 1, this.lonMax = this.lonMin + this.lonSpan, this.latMax = this.latMin + this.latSpan, this.lonStep = this.lonSpan / (this.lonCount - 1), this.latStep = this.latSpan / (this.latCount - 1), this.valid = !0;
1685
+ this.lonMin = Number(e), this.latMin = Number(t), this.lonCount = Number(s), this.latCount = Number(r), this.lonSpan = Number(n), this.latSpan = Number(a), this.valueScale = Number(o) || 1, this.lonMax = this.lonMin + this.lonSpan, this.latMax = this.latMin + this.latSpan, this.lonStep = this.lonSpan / (this.lonCount - 1), this.latStep = this.latSpan / (this.latCount - 1), this.valid = !0;
1622
1686
  }
1623
1687
  contains(e, t) {
1624
1688
  return Number.isFinite(e) && Number.isFinite(t) && e >= this.lonMin && e <= this.lonMax && t >= this.latMin && t <= this.latMax;
@@ -1652,7 +1716,7 @@ class z {
1652
1716
  sample(e, t) {
1653
1717
  if (!this.valid || !this.contains(e, t))
1654
1718
  return null;
1655
- const s = (e - this.lonMin) / this.lonStep, n = (t - this.latMin) / this.latStep, r = Math.max(0, Math.min(Math.floor(s), this.lonCount - 2)), o = Math.max(0, Math.min(Math.floor(n), this.latCount - 2)), a = r + 1, l = o + 1, u = Math.max(0, Math.min(s - r, 1)), h = Math.max(0, Math.min(n - o, 1)), g = this.getVector(o, r), d = this.getVector(o, a), y = this.getVector(l, r), I = this.getVector(l, a), m = 1 - u, p = 1 - h, v = m * p, C = u * p, L = m * h, N = u * h, T = g.u * v + d.u * C + y.u * L + I.u * N, M = g.v * v + d.v * C + y.v * L + I.v * N;
1719
+ const s = (e - this.lonMin) / this.lonStep, r = (t - this.latMin) / this.latStep, n = Math.max(0, Math.min(Math.floor(s), this.lonCount - 2)), a = Math.max(0, Math.min(Math.floor(r), this.latCount - 2)), o = n + 1, l = a + 1, u = Math.max(0, Math.min(s - n, 1)), h = Math.max(0, Math.min(r - a, 1)), I = this.getVector(a, n), d = this.getVector(a, o), f = this.getVector(l, n), g = this.getVector(l, o), m = 1 - u, p = 1 - h, v = m * p, C = u * p, L = m * h, A = u * h, T = I.u * v + d.u * C + f.u * L + g.u * A, M = I.v * v + d.v * C + f.v * L + g.v * A;
1656
1720
  return !Number.isFinite(T) || !Number.isFinite(M) ? null : {
1657
1721
  u: T,
1658
1722
  v: M,
@@ -1660,7 +1724,7 @@ class z {
1660
1724
  };
1661
1725
  }
1662
1726
  }
1663
- const J = [
1727
+ const ee = [
1664
1728
  { value: 0, color: [36, 88, 190] },
1665
1729
  { value: 2, color: [36, 145, 184] },
1666
1730
  { value: 5, color: [54, 177, 111] },
@@ -1668,7 +1732,7 @@ const J = [
1668
1732
  { value: 11, color: [229, 178, 78] },
1669
1733
  { value: 14, color: [224, 103, 117] },
1670
1734
  { value: 18, color: [162, 82, 202] }
1671
- ], Q = [
1735
+ ], te = [
1672
1736
  { value: 0, color: [178, 223, 255] },
1673
1737
  { value: 3, color: [190, 248, 222] },
1674
1738
  { value: 6, color: [235, 252, 174] },
@@ -1679,7 +1743,7 @@ const J = [
1679
1743
  function b(i, e, t) {
1680
1744
  return Math.min(Math.max(i, e), t);
1681
1745
  }
1682
- function Pe(i) {
1746
+ function we(i) {
1683
1747
  if (Array.isArray(i) && i.length >= 3)
1684
1748
  return [Number(i[0]) || 0, Number(i[1]) || 0, Number(i[2]) || 0];
1685
1749
  if (typeof i != "string")
@@ -1694,48 +1758,48 @@ function Pe(i) {
1694
1758
  const t = i.match(/rgba?\(([^)]+)\)/i);
1695
1759
  if (!t)
1696
1760
  return null;
1697
- const s = t[1].split(",").map((n) => Number(n.trim()));
1698
- return s.length < 3 || s.slice(0, 3).some((n) => !Number.isFinite(n)) ? null : s.slice(0, 3);
1761
+ const s = t[1].split(",").map((r) => Number(r.trim()));
1762
+ return s.length < 3 || s.slice(0, 3).some((r) => !Number.isFinite(r)) ? null : s.slice(0, 3);
1699
1763
  }
1700
1764
  function E(i, e) {
1701
- const s = (Array.isArray(i) && i.length > 0 ? i : e).map((n, r) => {
1702
- const o = Number((n == null ? void 0 : n.value) ?? (n == null ? void 0 : n.speed) ?? (n == null ? void 0 : n[0]) ?? r), a = Pe((n == null ? void 0 : n.color) ?? (n == null ? void 0 : n[1]) ?? n);
1703
- return !Number.isFinite(o) || !a ? null : { value: o, color: a };
1704
- }).filter(Boolean).sort((n, r) => n.value - r.value);
1765
+ const s = (Array.isArray(i) && i.length > 0 ? i : e).map((r, n) => {
1766
+ const a = Number((r == null ? void 0 : r.value) ?? (r == null ? void 0 : r.speed) ?? (r == null ? void 0 : r[0]) ?? n), o = we((r == null ? void 0 : r.color) ?? (r == null ? void 0 : r[1]) ?? r);
1767
+ return !Number.isFinite(a) || !o ? null : { value: a, color: o };
1768
+ }).filter(Boolean).sort((r, n) => r.value - n.value);
1705
1769
  return s.length > 0 ? s : e;
1706
1770
  }
1707
- function we(i, e) {
1771
+ function Te(i, e) {
1708
1772
  if (!Array.isArray(i) || i.length === 0)
1709
1773
  return [255, 255, 255];
1710
1774
  if (e <= i[0].value)
1711
1775
  return i[0].color;
1712
1776
  for (let t = 1; t < i.length; t += 1) {
1713
- const s = i[t], n = i[t - 1];
1777
+ const s = i[t], r = i[t - 1];
1714
1778
  if (e <= s.value) {
1715
- const r = Math.max(s.value - n.value, 1e-4), o = b((e - n.value) / r, 0, 1);
1716
- return n.color.map(
1717
- (a, l) => Math.round(a + (s.color[l] - a) * o)
1779
+ const n = Math.max(s.value - r.value, 1e-4), a = b((e - r.value) / n, 0, 1);
1780
+ return r.color.map(
1781
+ (o, l) => Math.round(o + (s.color[l] - o) * a)
1718
1782
  );
1719
1783
  }
1720
1784
  }
1721
1785
  return i[i.length - 1].color;
1722
1786
  }
1723
- function _(i, e) {
1724
- const [t, s, n] = i;
1725
- return `rgba(${t}, ${s}, ${n}, ${b(e, 0, 1)})`;
1787
+ function z(i, e) {
1788
+ const [t, s, r] = i;
1789
+ return `rgba(${t}, ${s}, ${r}, ${b(e, 0, 1)})`;
1726
1790
  }
1727
- function Ge(i, e) {
1791
+ function Me(i, e) {
1728
1792
  if (!i || typeof i != "object")
1729
1793
  return e;
1730
- const t = Number(i.west), s = Number(i.south), n = Number(i.east), r = Number(i.north);
1731
- return [t, s, n, r].every(Number.isFinite) ? {
1732
- west: Math.min(t, n),
1733
- south: Math.min(s, r),
1734
- east: Math.max(t, n),
1735
- north: Math.max(s, r)
1794
+ const t = Number(i.west), s = Number(i.south), r = Number(i.east), n = Number(i.north);
1795
+ return [t, s, r, n].every(Number.isFinite) ? {
1796
+ west: Math.min(t, r),
1797
+ south: Math.min(s, n),
1798
+ east: Math.max(t, r),
1799
+ north: Math.max(s, n)
1736
1800
  } : e;
1737
1801
  }
1738
- function Te(i, e) {
1802
+ function xe(i, e) {
1739
1803
  const t = {
1740
1804
  west: Math.max(i.west, e.west),
1741
1805
  south: Math.max(i.south, e.south),
@@ -1744,18 +1808,18 @@ function Te(i, e) {
1744
1808
  };
1745
1809
  return t.west >= t.east || t.south >= t.north ? null : t;
1746
1810
  }
1747
- function j(i, e, t) {
1811
+ function _(i, e, t) {
1748
1812
  return i && Number.isFinite(i.x) && Number.isFinite(i.y) && i.x >= -64 && i.x <= e + 64 && i.y >= -64 && i.y <= t + 64;
1749
1813
  }
1750
- function Me(i) {
1814
+ function Ae(i) {
1751
1815
  return i && Number.isFinite(i.x) && Number.isFinite(i.y);
1752
1816
  }
1753
- function xe(i) {
1817
+ function Ne(i) {
1754
1818
  return String(i || "").toLowerCase();
1755
1819
  }
1756
- class Ne {
1820
+ class Oe {
1757
1821
  constructor(e = {}) {
1758
- 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 z ? e.grid : new z(e.data), this.options = {
1822
+ 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 V ? e.grid : new V(e.data), this.options = {
1759
1823
  zIndex: Number(e.zIndex ?? 30),
1760
1824
  visible: e.visible !== !1,
1761
1825
  running: e.running !== !1,
@@ -1780,9 +1844,9 @@ class Ne {
1780
1844
  projectionGrid: e.projectionGrid !== !1,
1781
1845
  projectionGridCols: Number(e.projectionGridCols ?? 32),
1782
1846
  projectionGridRows: Number(e.projectionGridRows ?? 20)
1783
- }, this.colorScale = E(e.colorScale, J), this.particleColorScale = E(
1847
+ }, this.colorScale = E(e.colorScale, ee), this.particleColorScale = E(
1784
1848
  e.particleColorScale,
1785
- Q
1849
+ te
1786
1850
  ), 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();
1787
1851
  }
1788
1852
  isReady() {
@@ -1808,12 +1872,12 @@ class Ne {
1808
1872
  resize() {
1809
1873
  if (!this.canvas || !this.overlayCanvas || !this.container)
1810
1874
  return;
1811
- const e = this.container.getBoundingClientRect(), t = b(this.options.devicePixelRatio || 1, 1, 2), s = Math.max(1, Math.floor(e.width)), n = Math.max(1, Math.floor(e.height));
1812
- s === this.width && n === this.height || (this.width = s, this.height = n, [
1875
+ const e = this.container.getBoundingClientRect(), t = b(this.options.devicePixelRatio || 1, 1, 2), s = Math.max(1, Math.floor(e.width)), r = Math.max(1, Math.floor(e.height));
1876
+ s === this.width && r === this.height || (this.width = s, this.height = r, [
1813
1877
  [this.canvas, this.ctx],
1814
1878
  [this.overlayCanvas, this.overlayCtx]
1815
- ].forEach(([r, o]) => {
1816
- r.width = Math.floor(s * t), r.height = Math.floor(n * t), o == null || o.setTransform(t, 0, 0, t, 0, 0);
1879
+ ].forEach(([n, a]) => {
1880
+ n.width = Math.floor(s * t), n.height = Math.floor(r * t), a == null || a.setTransform(t, 0, 0, t, 0, 0);
1817
1881
  }), this.overlayDirty = !0, this.invalidateProjectionGrid(), this.clear());
1818
1882
  }
1819
1883
  clear() {
@@ -1829,10 +1893,10 @@ class Ne {
1829
1893
  this.options = {
1830
1894
  ...this.options,
1831
1895
  ...e
1832
- }, e.colorScale !== void 0 && (this.colorScale = E(e.colorScale, J), this.overlayDirty = !0), e.particleColorScale !== void 0 && (this.particleColorScale = E(
1896
+ }, e.colorScale !== void 0 && (this.colorScale = E(e.colorScale, ee), this.overlayDirty = !0), e.particleColorScale !== void 0 && (this.particleColorScale = E(
1833
1897
  e.particleColorScale,
1834
- Q
1835
- )), 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 z(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();
1898
+ te
1899
+ )), 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 V(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();
1836
1900
  }
1837
1901
  refreshSpawnBounds() {
1838
1902
  return this.spawnBoundsCache = this.getSpawnBounds(), this.invalidateProjectionGrid(), this.spawnBoundsCache;
@@ -1841,7 +1905,7 @@ class Ne {
1841
1905
  var t;
1842
1906
  if (!this.options.projectionGrid)
1843
1907
  return !1;
1844
- const e = xe((t = this.getSceneMode) == null ? void 0 : t.call(this));
1908
+ const e = Ne((t = this.getSceneMode) == null ? void 0 : t.call(this));
1845
1909
  return e === "2d" || e === "2.5d";
1846
1910
  }
1847
1911
  invalidateProjectionGrid() {
@@ -1850,36 +1914,36 @@ class Ne {
1850
1914
  buildProjectionGrid(e = this.spawnBoundsCache) {
1851
1915
  if (!this.shouldUseProjectionGrid() || !e)
1852
1916
  return this.projectionGrid = null, null;
1853
- const t = b(Math.floor(this.options.projectionGridCols) || 32, 8, 96), s = b(Math.floor(this.options.projectionGridRows) || 20, 6, 64), n = [];
1854
- for (let r = 0; r <= s; r += 1)
1855
- for (let o = 0; o <= t; o += 1) {
1856
- const a = e.west + (e.east - e.west) * (o / t), l = e.south + (e.north - e.south) * (r / s);
1857
- n.push(this.project(a, l, this.options.height));
1917
+ const t = b(Math.floor(this.options.projectionGridCols) || 32, 8, 96), s = b(Math.floor(this.options.projectionGridRows) || 20, 6, 64), r = [];
1918
+ for (let n = 0; n <= s; n += 1)
1919
+ for (let a = 0; a <= t; a += 1) {
1920
+ const o = e.west + (e.east - e.west) * (a / t), l = e.south + (e.north - e.south) * (n / s);
1921
+ r.push(this.project(o, l, this.options.height));
1858
1922
  }
1859
1923
  return this.projectionGrid = {
1860
1924
  bounds: e,
1861
1925
  cols: t,
1862
1926
  rows: s,
1863
- nodes: n
1927
+ nodes: r
1864
1928
  }, this.projectionGrid;
1865
1929
  }
1866
1930
  projectPoint(e, t) {
1867
1931
  const s = this.projectionGrid || this.buildProjectionGrid(this.spawnBoundsCache);
1868
1932
  if (!s || !s.bounds)
1869
1933
  return this.project(e, t, this.options.height);
1870
- const { bounds: n, cols: r, rows: o, nodes: a } = s, l = Math.max(n.east - n.west, 1e-4), u = Math.max(n.north - n.south, 1e-4), h = (e - n.west) / l * r, g = (t - n.south) / u * o, d = b(Math.floor(h), 0, r - 1), y = b(Math.floor(g), 0, o - 1), I = d + 1, m = y + 1, p = b(h - d, 0, 1), v = b(g - y, 0, 1), C = r + 1, L = a[y * C + d], N = a[y * C + I], T = a[m * C + d], M = a[m * C + I];
1871
- if (![L, N, T, M].every(Me))
1934
+ const { bounds: r, cols: n, rows: a, nodes: o } = s, l = Math.max(r.east - r.west, 1e-4), u = Math.max(r.north - r.south, 1e-4), h = (e - r.west) / l * n, I = (t - r.south) / u * a, d = b(Math.floor(h), 0, n - 1), f = b(Math.floor(I), 0, a - 1), g = d + 1, m = f + 1, p = b(h - d, 0, 1), v = b(I - f, 0, 1), C = n + 1, L = o[f * C + d], A = o[f * C + g], T = o[m * C + d], M = o[m * C + g];
1935
+ if (![L, A, T, M].every(Ae))
1872
1936
  return this.project(e, t, this.options.height);
1873
1937
  const R = 1 - p, F = 1 - v;
1874
1938
  return {
1875
- x: L.x * R * F + N.x * p * F + T.x * R * v + M.x * p * v,
1876
- y: L.y * R * F + N.y * p * F + T.y * R * v + M.y * p * v
1939
+ x: L.x * R * F + A.x * p * F + T.x * R * v + M.x * p * v,
1940
+ y: L.y * R * F + A.y * p * F + T.y * R * v + M.y * p * v
1877
1941
  };
1878
1942
  }
1879
1943
  getSpawnBounds() {
1880
1944
  var s;
1881
- const e = this.grid.getBounds(), t = Ge((s = this.getViewBounds) == null ? void 0 : s.call(this), e);
1882
- return Te(e, t) || e;
1945
+ const e = this.grid.getBounds(), t = Me((s = this.getViewBounds) == null ? void 0 : s.call(this), e);
1946
+ return xe(e, t) || e;
1883
1947
  }
1884
1948
  createParticle(e = this.spawnBoundsCache || this.refreshSpawnBounds()) {
1885
1949
  if (!e)
@@ -1890,11 +1954,11 @@ class Ne {
1890
1954
  maxAge: this.options.maxAge
1891
1955
  };
1892
1956
  for (let t = 0; t < 8; t += 1) {
1893
- const s = e.west + Math.random() * (e.east - e.west), n = e.south + Math.random() * (e.north - e.south), r = this.grid.sample(s, n);
1894
- if (r && r.speed > 0)
1957
+ const s = e.west + Math.random() * (e.east - e.west), r = e.south + Math.random() * (e.north - e.south), n = this.grid.sample(s, r);
1958
+ if (n && n.speed > 0)
1895
1959
  return {
1896
1960
  lon: s,
1897
- lat: n,
1961
+ lat: r,
1898
1962
  screenX: null,
1899
1963
  screenY: null,
1900
1964
  age: Math.floor(Math.random() * this.options.maxAge),
@@ -1926,8 +1990,8 @@ class Ne {
1926
1990
  if (!Array.isArray(this.particleColorScale) || this.particleColorScale.length <= 1)
1927
1991
  return 0;
1928
1992
  for (let t = 1; t < this.particleColorScale.length; t += 1) {
1929
- const s = this.particleColorScale[t - 1], n = this.particleColorScale[t], r = s.value + (n.value - s.value) / 2;
1930
- if (e <= r)
1993
+ const s = this.particleColorScale[t - 1], r = this.particleColorScale[t], n = s.value + (r.value - s.value) / 2;
1994
+ if (e <= n)
1931
1995
  return t - 1;
1932
1996
  }
1933
1997
  return this.particleColorScale.length - 1;
@@ -1938,32 +2002,32 @@ class Ne {
1938
2002
  const e = this.spawnBoundsCache || this.refreshSpawnBounds();
1939
2003
  if (!e)
1940
2004
  return;
1941
- const t = this.overlayCtx, s = b(Number(this.options.velocityOverlayCellSize) || 54, 28, 96), n = b(Math.ceil(this.width / s), 10, 64), r = b(Math.ceil(this.height / s), 8, 48), o = (e.east - e.west) / n, a = (e.north - e.south) / r, l = s * 1.25, u = this.grid.getBounds();
2005
+ const t = this.overlayCtx, s = b(Number(this.options.velocityOverlayCellSize) || 54, 28, 96), r = b(Math.ceil(this.width / s), 10, 64), n = b(Math.ceil(this.height / s), 8, 48), a = (e.east - e.west) / r, o = (e.north - e.south) / n, l = s * 1.25, u = this.grid.getBounds();
1942
2006
  t.save(), t.globalCompositeOperation = "source-over";
1943
- for (let h = 0; h < r; h += 1) {
1944
- const g = e.south + (h + 0.5) * a;
1945
- for (let d = 0; d < n; d += 1) {
1946
- const y = e.west + (d + 0.5) * o, I = this.grid.sample(y, g);
1947
- if (!I || I.speed <= 0)
2007
+ for (let h = 0; h < n; h += 1) {
2008
+ const I = e.south + (h + 0.5) * o;
2009
+ for (let d = 0; d < r; d += 1) {
2010
+ const f = e.west + (d + 0.5) * a, g = this.grid.sample(f, I);
2011
+ if (!g || g.speed <= 0)
1948
2012
  continue;
1949
- const m = this.projectPoint(y, g);
1950
- if (!j(m, this.width, this.height))
2013
+ const m = this.projectPoint(f, I);
2014
+ if (!_(m, this.width, this.height))
1951
2015
  continue;
1952
- const p = we(this.colorScale, I.speed), v = this.getDataEdgeOpacity(y, g, u), C = this.options.velocityOverlayOpacity * v;
2016
+ const p = Te(this.colorScale, g.speed), v = this.getDataEdgeOpacity(f, I, u), C = this.options.velocityOverlayOpacity * v;
1953
2017
  if (C <= 0.01)
1954
2018
  continue;
1955
2019
  const L = t.createRadialGradient(m.x, m.y, 0, m.x, m.y, l);
1956
- L.addColorStop(0, _(p, C)), L.addColorStop(1, _(p, 0)), t.fillStyle = L, t.fillRect(m.x - l, m.y - l, l * 2, l * 2);
2020
+ L.addColorStop(0, z(p, C)), L.addColorStop(1, z(p, 0)), t.fillStyle = L, t.fillRect(m.x - l, m.y - l, l * 2, l * 2);
1957
2021
  }
1958
2022
  }
1959
2023
  t.restore();
1960
2024
  }
1961
2025
  getDataEdgeOpacity(e, t, s) {
1962
- const n = b(this.options.velocityOverlayEdgeFade, 0, 0.35);
1963
- if (n <= 0 || !s)
2026
+ const r = b(this.options.velocityOverlayEdgeFade, 0, 0.35);
2027
+ if (r <= 0 || !s)
1964
2028
  return 1;
1965
- const r = (e - s.west) / Math.max(s.east - s.west, 1e-4), o = (t - s.south) / Math.max(s.north - s.south, 1e-4), a = Math.min(r, 1 - r, o, 1 - o);
1966
- return b(a / n, 0, 1);
2029
+ const n = (e - s.west) / Math.max(s.east - s.west, 1e-4), a = (t - s.south) / Math.max(s.north - s.south, 1e-4), o = Math.min(n, 1 - n, a, 1 - a);
2030
+ return b(o / r, 0, 1);
1967
2031
  }
1968
2032
  start() {
1969
2033
  this.destroyed || (this.options.running = !0, this.interactionSuspended = !1, this.animationFrame || (this.lastFrameTime = performance.now(), this.animationFrame = requestAnimationFrame((e) => this.animate(e))));
@@ -1992,36 +2056,36 @@ class Ne {
1992
2056
  this.options.visible = !1, this.canvas && (this.canvas.style.display = "none"), this.overlayCanvas && (this.overlayCanvas.style.display = "none");
1993
2057
  }
1994
2058
  stepParticle(e, t) {
1995
- const s = this.grid.sample(e.lon, e.lat), n = Number.isFinite(e.screenX) && Number.isFinite(e.screenY) ? { x: e.screenX, y: e.screenY } : this.projectPoint(e.lon, e.lat);
1996
- if (!s || s.speed <= 0 || !j(n, this.width, this.height))
2059
+ const s = this.grid.sample(e.lon, e.lat), r = Number.isFinite(e.screenX) && Number.isFinite(e.screenY) ? { x: e.screenX, y: e.screenY } : this.projectPoint(e.lon, e.lat);
2060
+ if (!s || s.speed <= 0 || !_(r, this.width, this.height))
1997
2061
  return Object.assign(e, this.createParticle()), null;
1998
- const r = e.lat * Math.PI / 180, o = Math.max(Math.cos(r) * 111320, 1e3), a = 111320, l = this.options.velocityScale * t, u = e.lon + s.u * l / o, h = e.lat + s.v * l / a, g = this.grid.sample(u, h), d = this.projectPoint(u, h);
1999
- return !g || !j(d, this.width, this.height) ? (Object.assign(e, this.createParticle()), null) : (e.lon = u, e.lat = h, e.screenX = d.x, e.screenY = d.y, e.age += 1, e.age > e.maxAge && Object.assign(e, this.createParticle()), { from: n, to: d, speed: g.speed });
2062
+ const n = e.lat * Math.PI / 180, a = Math.max(Math.cos(n) * 111320, 1e3), o = 111320, l = this.options.velocityScale * t, u = e.lon + s.u * l / a, h = e.lat + s.v * l / o, I = this.grid.sample(u, h), d = this.projectPoint(u, h);
2063
+ return !I || !_(d, this.width, this.height) ? (Object.assign(e, this.createParticle()), null) : (e.lon = u, e.lat = h, e.screenX = d.x, e.screenY = d.y, e.age += 1, e.age > e.maxAge && Object.assign(e, this.createParticle()), { from: r, to: d, speed: I.speed });
2000
2064
  }
2001
2065
  getFrameParticleCount(e) {
2002
- var r;
2066
+ var n;
2003
2067
  const t = b(
2004
2068
  Math.floor(this.options.maxFrameParticles || e),
2005
2069
  1,
2006
2070
  e
2007
- ), s = Math.floor(this.options.sceneModeMaxFrameParticles || 0), n = String(((r = this.getSceneMode) == null ? void 0 : r.call(this)) || "").toLowerCase();
2008
- return (n === "2d" || n === "2.5d") && s > 0 ? b(s, 1, t) : t;
2071
+ ), s = Math.floor(this.options.sceneModeMaxFrameParticles || 0), r = String(((n = this.getSceneMode) == null ? void 0 : n.call(this)) || "").toLowerCase();
2072
+ return (r === "2d" || r === "2.5d") && s > 0 ? b(s, 1, t) : t;
2009
2073
  }
2010
2074
  drawFrame(e) {
2011
2075
  if (!this.ctx || this.width <= 0 || this.height <= 0)
2012
2076
  return;
2013
2077
  const t = this.ctx;
2014
2078
  t.globalCompositeOperation = "destination-in", t.fillStyle = `rgba(0, 0, 0, ${b(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";
2015
- const s = this.particleColorScale.map(() => []), n = this.particles.length, r = this.getFrameParticleCount(n);
2016
- for (let o = 0; o < r; o += 1) {
2017
- const a = (this.particleCursor + o) % n, l = this.stepParticle(this.particles[a], e);
2079
+ const s = this.particleColorScale.map(() => []), r = this.particles.length, n = this.getFrameParticleCount(r);
2080
+ for (let a = 0; a < n; a += 1) {
2081
+ const o = (this.particleCursor + a) % r, l = this.stepParticle(this.particles[o], e);
2018
2082
  l && s[this.getParticleColorIndex(l.speed)].push(l);
2019
2083
  }
2020
- this.particleCursor = (this.particleCursor + r) % n, s.forEach((o, a) => {
2021
- if (o.length === 0)
2084
+ this.particleCursor = (this.particleCursor + n) % r, s.forEach((a, o) => {
2085
+ if (a.length === 0)
2022
2086
  return;
2023
- const l = this.particleColorScale.length <= 1 ? 0 : a / (this.particleColorScale.length - 1);
2024
- t.lineWidth = this.options.lineWidth * (0.72 + l * 0.56), t.strokeStyle = this.particleColorScale[a] ? _(this.particleColorScale[a].color, this.options.particleOpacity) : this.options.color, t.beginPath(), o.forEach((u) => {
2087
+ const l = this.particleColorScale.length <= 1 ? 0 : o / (this.particleColorScale.length - 1);
2088
+ t.lineWidth = this.options.lineWidth * (0.72 + l * 0.56), t.strokeStyle = this.particleColorScale[o] ? z(this.particleColorScale[o].color, this.options.particleOpacity) : this.options.color, t.beginPath(), a.forEach((u) => {
2025
2089
  t.moveTo(u.from.x, u.from.y), t.lineTo(u.to.x, u.to.y);
2026
2090
  }), t.stroke();
2027
2091
  });
@@ -2031,8 +2095,8 @@ class Ne {
2031
2095
  if (this.options.visible && this.isReady()) {
2032
2096
  const t = 1e3 / b(this.options.frameRate, 1, 60), s = e - this.lastFrameTime;
2033
2097
  if (s >= t) {
2034
- const n = b(s / 16.67, 0.5, 2.5);
2035
- this.lastFrameTime = e, this.drawFrame(n);
2098
+ const r = b(s / 16.67, 0.5, 2.5);
2099
+ this.lastFrameTime = e, this.drawFrame(r);
2036
2100
  }
2037
2101
  }
2038
2102
  this.animationFrame = requestAnimationFrame((t) => this.animate(t));
@@ -2057,44 +2121,44 @@ class Ne {
2057
2121
  function x(i = {}) {
2058
2122
  return typeof i == "string" ? i || "wind-field-default" : (i == null ? void 0 : i.id) || (i == null ? void 0 : i.layerId) || "wind-field-default";
2059
2123
  }
2060
- function ee(i = {}) {
2124
+ function se(i = {}) {
2061
2125
  const {
2062
2126
  id: e,
2063
2127
  layerId: t,
2064
2128
  data: s,
2065
- windData: n,
2066
- options: r,
2067
- container: o,
2068
- project: a,
2129
+ windData: r,
2130
+ options: n,
2131
+ container: a,
2132
+ project: o,
2069
2133
  getViewBounds: l,
2070
2134
  ...u
2071
2135
  } = i || {};
2072
2136
  return {
2073
2137
  ...u,
2074
- ...r || {}
2138
+ ...n || {}
2075
2139
  };
2076
2140
  }
2077
- function te(i) {
2141
+ function ie(i) {
2078
2142
  return !!(i && typeof i.getMapInstance == "function" && typeof i.getMapContainer == "function" && typeof i.projectToContainerPoint == "function" && typeof i.getViewBounds == "function" && typeof i.onViewChange == "function");
2079
2143
  }
2080
- class _e {
2144
+ class je {
2081
2145
  constructor(e = {}) {
2082
2146
  this.baseGIS = null, this.layers = /* @__PURE__ */ new Map();
2083
- const t = (e == null ? void 0 : e.mapCore) || (e == null ? void 0 : e.baseGIS) || (te(e) ? e : null);
2147
+ const t = (e == null ? void 0 : e.mapCore) || (e == null ? void 0 : e.baseGIS) || (ie(e) ? e : null);
2084
2148
  t && this.mount(t);
2085
2149
  }
2086
2150
  mount(e) {
2087
2151
  var t, s;
2088
- return te(e) ? (this.baseGIS = e, f(
2152
+ return ie(e) ? (this.baseGIS = e, y(
2089
2153
  { engineType: ((s = (t = this.baseGIS).getEngineType) == null ? void 0 : s.call(t)) || "unknown" },
2090
2154
  "WindFieldMethods mounted with BaseGIS."
2091
2155
  )) : c("WindFieldMethods mount requires BaseGIS instance.", "INVALID_MOUNT_TARGET");
2092
2156
  }
2093
2157
  resolveBaseGIS() {
2094
2158
  var e, t;
2095
- return this.baseGIS ? (t = (e = this.baseGIS).getMapInstance) != null && t.call(e) ? f(null, "BaseGIS is ready.") : c(
2159
+ return this.baseGIS ? (t = (e = this.baseGIS).getMapInstance) != null && t.call(e) ? y(null, "BaseGIS is ready.") : c(
2096
2160
  "Map instance is not ready. Please call mapCore.init() first.",
2097
- w.NOT_INITIALIZED
2161
+ G.NOT_INITIALIZED
2098
2162
  ) : c("WindFieldMethods has not been mounted.", "NOT_MOUNTED");
2099
2163
  }
2100
2164
  addWindField(e = {}) {
@@ -2104,83 +2168,83 @@ class _e {
2104
2168
  return t;
2105
2169
  const s = (e == null ? void 0 : e.data) || (e == null ? void 0 : e.windData);
2106
2170
  if (!s)
2107
- return c("Wind field data is required.", w.FAILED);
2108
- const n = this.baseGIS.getMapContainer();
2109
- if (!(n != null && n.success) || !((l = n.data) != null && l.container))
2110
- return (n == null ? void 0 : n.success) === !1 ? n : c("Map container is not available.", w.NOT_INITIALIZED);
2111
- const r = x(e);
2112
- this.removeWindField(r);
2113
- const o = new Ne({
2114
- id: r,
2171
+ return c("Wind field data is required.", G.FAILED);
2172
+ const r = this.baseGIS.getMapContainer();
2173
+ if (!(r != null && r.success) || !((l = r.data) != null && l.container))
2174
+ return (r == null ? void 0 : r.success) === !1 ? r : c("Map container is not available.", G.NOT_INITIALIZED);
2175
+ const n = x(e);
2176
+ this.removeWindField(n);
2177
+ const a = new Oe({
2178
+ id: n,
2115
2179
  data: s,
2116
- container: n.data.container,
2117
- ...ee(e),
2118
- project: (h, g, d = 0) => {
2119
- const y = this.baseGIS.projectToContainerPoint({
2180
+ container: r.data.container,
2181
+ ...se(e),
2182
+ project: (h, I, d = 0) => {
2183
+ const f = this.baseGIS.projectToContainerPoint({
2120
2184
  longitude: h,
2121
- latitude: g,
2185
+ latitude: I,
2122
2186
  height: d
2123
2187
  });
2124
- return y != null && y.success ? y.data : null;
2188
+ return f != null && f.success ? f.data : null;
2125
2189
  },
2126
2190
  getViewBounds: () => {
2127
2191
  const h = this.baseGIS.getViewBounds();
2128
2192
  return h != null && h.success ? h.data : null;
2129
2193
  },
2130
2194
  getSceneMode: () => {
2131
- var g, d, y;
2132
- const h = (d = (g = this.baseGIS).getSceneMode) == null ? void 0 : d.call(g);
2133
- return h != null && h.success ? (y = h.data) == null ? void 0 : y.mode : "";
2195
+ var I, d, f;
2196
+ const h = (d = (I = this.baseGIS).getSceneMode) == null ? void 0 : d.call(I);
2197
+ return h != null && h.success ? (f = h.data) == null ? void 0 : f.mode : "";
2134
2198
  }
2135
2199
  });
2136
- if (!o.grid.valid)
2137
- return o.destroy(), c(o.grid.errorMessage || "Invalid wind field data.", w.FAILED);
2138
- const a = this.baseGIS.onViewChange({
2139
- onStart: () => o.suspendForInteraction(),
2140
- onEnd: () => o.resumeAfterInteraction()
2200
+ if (!a.grid.valid)
2201
+ return a.destroy(), c(a.grid.errorMessage || "Invalid wind field data.", G.FAILED);
2202
+ const o = this.baseGIS.onViewChange({
2203
+ onStart: () => a.suspendForInteraction(),
2204
+ onEnd: () => a.resumeAfterInteraction()
2141
2205
  });
2142
- return a != null && a.success ? (this.layers.set(r, {
2143
- layer: o,
2144
- offViewChange: (u = a.data) == null ? void 0 : u.off
2145
- }), f(o.getState(), `Wind field "${r}" added.`)) : (o.destroy(), a || c("View change listener is not available."));
2206
+ return o != null && o.success ? (this.layers.set(n, {
2207
+ layer: a,
2208
+ offViewChange: (u = o.data) == null ? void 0 : u.off
2209
+ }), y(a.getState(), `Wind field "${n}" added.`)) : (a.destroy(), o || c("View change listener is not available."));
2146
2210
  }
2147
2211
  updateWindField(e = {}) {
2148
2212
  const t = this.resolveBaseGIS();
2149
2213
  if (!t.success)
2150
2214
  return t;
2151
- const s = x(e), n = this.layers.get(s);
2152
- if (!n)
2153
- return c(`Wind field "${s}" not found.`, w.FAILED);
2154
- const r = ee(e), o = (e == null ? void 0 : e.data) || (e == null ? void 0 : e.windData);
2155
- return o && (r.data = o), n.layer.updateOptions(r), f(n.layer.getState(), `Wind field "${s}" updated.`);
2215
+ const s = x(e), r = this.layers.get(s);
2216
+ if (!r)
2217
+ return c(`Wind field "${s}" not found.`, G.FAILED);
2218
+ const n = se(e), a = (e == null ? void 0 : e.data) || (e == null ? void 0 : e.windData);
2219
+ return a && (n.data = a), r.layer.updateOptions(n), y(r.layer.getState(), `Wind field "${s}" updated.`);
2156
2220
  }
2157
2221
  startWindField(e = {}) {
2158
2222
  const t = x(e), s = this.layers.get(t);
2159
- return s ? (s.layer.start(), f(s.layer.getState(), `Wind field "${t}" started.`)) : c(`Wind field "${t}" not found.`, w.FAILED);
2223
+ return s ? (s.layer.start(), y(s.layer.getState(), `Wind field "${t}" started.`)) : c(`Wind field "${t}" not found.`, G.FAILED);
2160
2224
  }
2161
2225
  stopWindField(e = {}) {
2162
2226
  const t = x(e), s = this.layers.get(t);
2163
- return s ? (s.layer.stop(), f(s.layer.getState(), `Wind field "${t}" stopped.`)) : c(`Wind field "${t}" not found.`, w.FAILED);
2227
+ return s ? (s.layer.stop(), y(s.layer.getState(), `Wind field "${t}" stopped.`)) : c(`Wind field "${t}" not found.`, G.FAILED);
2164
2228
  }
2165
2229
  showWindField(e = {}) {
2166
2230
  const t = x(e), s = this.layers.get(t);
2167
- return s ? (s.layer.show(), f(s.layer.getState(), `Wind field "${t}" shown.`)) : c(`Wind field "${t}" not found.`, w.FAILED);
2231
+ return s ? (s.layer.show(), y(s.layer.getState(), `Wind field "${t}" shown.`)) : c(`Wind field "${t}" not found.`, G.FAILED);
2168
2232
  }
2169
2233
  hideWindField(e = {}) {
2170
2234
  const t = x(e), s = this.layers.get(t);
2171
- return s ? (s.layer.hide(), f(s.layer.getState(), `Wind field "${t}" hidden.`)) : c(`Wind field "${t}" not found.`, w.FAILED);
2235
+ return s ? (s.layer.hide(), y(s.layer.getState(), `Wind field "${t}" hidden.`)) : c(`Wind field "${t}" not found.`, G.FAILED);
2172
2236
  }
2173
2237
  removeWindField(e = {}) {
2174
- var n;
2238
+ var r;
2175
2239
  const t = x(e), s = this.layers.get(t);
2176
- return s ? ((n = s.offViewChange) == null || n.call(s), s.layer.destroy(), this.layers.delete(t), f({ layerId: t, removed: !0 }, `Wind field "${t}" removed.`)) : f({ layerId: t, removed: !1 }, `Wind field "${t}" not found.`);
2240
+ return s ? ((r = s.offViewChange) == null || r.call(s), s.layer.destroy(), this.layers.delete(t), y({ layerId: t, removed: !0 }, `Wind field "${t}" removed.`)) : y({ layerId: t, removed: !1 }, `Wind field "${t}" not found.`);
2177
2241
  }
2178
2242
  clearWindFields() {
2179
2243
  const e = this.layers.size;
2180
2244
  return this.layers.forEach((t) => {
2181
2245
  var s;
2182
2246
  (s = t.offViewChange) == null || s.call(t), t.layer.destroy();
2183
- }), this.layers.clear(), f({ count: e }, `Wind fields cleared: ${e}.`);
2247
+ }), this.layers.clear(), y({ count: e }, `Wind fields cleared: ${e}.`);
2184
2248
  }
2185
2249
  getState() {
2186
2250
  return {
@@ -2191,14 +2255,14 @@ class _e {
2191
2255
  }
2192
2256
  }
2193
2257
  export {
2194
- ne as ContourLayerController,
2195
- Be as GraphicGroupController,
2196
- De as GridLayerController,
2197
- Re as ImageLayerController,
2198
- Fe as PointDensityController,
2199
- Ee as PointLargeLayerController,
2200
- ze as PressureContourLayer,
2201
- _e as WindFieldMethods,
2202
- Ce as buildPressureRenderData,
2203
- Ve as createPressureDataResolver
2258
+ oe as ContourLayerController,
2259
+ Re as GraphicGroupController,
2260
+ Fe as GridLayerController,
2261
+ Ee as ImageLayerController,
2262
+ Ve as PointDensityController,
2263
+ ze as PointLargeLayerController,
2264
+ Ue as PressureContourLayer,
2265
+ je as WindFieldMethods,
2266
+ Pe as buildPressureRenderData,
2267
+ _e as createPressureDataResolver
2204
2268
  };