leiting-bim 2.1.159 → 2.1.161

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.
@@ -1,46 +1,46 @@
1
- var Rt = Object.defineProperty;
2
- var Ht = (a, t, e) => t in a ? Rt(a, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : a[t] = e;
3
- var h = (a, t, e) => Ht(a, typeof t != "symbol" ? t + "" : t, e);
4
- class En {
1
+ var Nt = Object.defineProperty;
2
+ var Gt = (a, t, e) => t in a ? Nt(a, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : a[t] = e;
3
+ var l = (a, t, e) => Gt(a, typeof t != "symbol" ? t + "" : t, e);
4
+ class To {
5
5
  constructor(t, e, i) {
6
- h(this, "Cesium");
7
- h(this, "viewer");
8
- h(this, "labelPool");
9
- h(this, "threshold");
10
- h(this, "displayLimit");
11
- h(this, "maxLevel");
12
- h(this, "debugCurrentGrids");
13
- h(this, "levels");
14
- h(this, "points", []);
15
- h(this, "gridLayers", /* @__PURE__ */ new Map());
16
- h(this, "debugGrids", []);
17
- h(this, "_updateFn");
18
- h(this, "clusterTheme");
19
- h(this, "pointTheme");
20
- h(this, "centralPointMode");
21
- h(this, "minGlobalPointCount");
22
- h(this, "groupByTheme");
23
- h(this, "tilingScheme");
24
- h(this, "terrainLevelOffset");
25
- h(this, "debugTileCoordLayer", null);
26
- h(this, "levelIndexByTileLevel", /* @__PURE__ */ new Map());
27
- h(this, "_lastTileProvider", null);
28
- h(this, "_updateTimer", null);
29
- h(this, "_updateDelay", 100);
30
- h(this, "_tilesRetryCount", 0);
31
- h(this, "_tilesRetryMax", 100);
32
- h(this, "_cameraDirty", !1);
33
- h(this, "_tileLoadListener", null);
34
- h(this, "_cameraChangedHandler", null);
6
+ l(this, "Cesium");
7
+ l(this, "viewer");
8
+ l(this, "labelPool");
9
+ l(this, "threshold");
10
+ l(this, "displayLimit");
11
+ l(this, "maxLevel");
12
+ l(this, "debugCurrentGrids");
13
+ l(this, "levels");
14
+ l(this, "points", []);
15
+ l(this, "gridLayers", /* @__PURE__ */ new Map());
16
+ l(this, "debugGrids", []);
17
+ l(this, "_updateFn");
18
+ l(this, "clusterTheme");
19
+ l(this, "pointTheme");
20
+ l(this, "centralPointMode");
21
+ l(this, "minGlobalPointCount");
22
+ l(this, "groupByTheme");
23
+ l(this, "tilingScheme");
24
+ l(this, "terrainLevelOffset");
25
+ l(this, "debugTileCoordLayer", null);
26
+ l(this, "levelIndexByTileLevel", /* @__PURE__ */ new Map());
27
+ l(this, "_lastTileProvider", null);
28
+ l(this, "_updateTimer", null);
29
+ l(this, "_updateDelay", 100);
30
+ l(this, "_tilesRetryCount", 0);
31
+ l(this, "_tilesRetryMax", 100);
32
+ l(this, "_cameraDirty", !1);
33
+ l(this, "_tileLoadListener", null);
34
+ l(this, "_cameraChangedHandler", null);
35
35
  // 默认显示的地图层级区间(兼容旧数据)
36
- h(this, "defaultMinLevel", 0);
37
- h(this, "defaultMaxLevel", 28);
36
+ l(this, "defaultMinLevel", 0);
37
+ l(this, "defaultMaxLevel", 28);
38
38
  // 单次从视图层级向下细分到聚合层级时,最多细分的层级数
39
- h(this, "maxRefineLevels", 2);
39
+ l(this, "maxRefineLevels", 2);
40
40
  this.Cesium = t, this.viewer = e, this.labelPool = i.labelPool, this.threshold = i.threshold ?? 10, this.displayLimit = i.displayLimit ?? 100, this.maxLevel = i.maxLevel ?? 5, this.debugCurrentGrids = i.debugCurrentGrids ?? !1, this.clusterTheme = i.clusterTheme ?? "cluster-label", this.pointTheme = i.pointTheme ?? "point-label", this.centralPointMode = i.centralPointMode ?? "central", this.minGlobalPointCount = i.minGlobalPointCount ?? 0, this.groupByTheme = i.groupByTheme ?? !1, this.terrainLevelOffset = i.terrainLevelOffset ?? 2;
41
41
  const n = this.viewer.scene && this.viewer.scene.globe, s = n && n._surface, o = s && s._tileProvider, r = (o == null ? void 0 : o.tilingScheme) || new this.Cesium.GeographicTilingScheme();
42
- this._lastTileProvider = o, this.tilingScheme = r, this.levels = this._createLevels(), this._buildLevels(), this._updateFn = this._update.bind(this), this.debugCurrentGrids && this._ensureDebugImageryLayer(), n && (this._tileLoadListener = (l) => {
43
- l === 0 && this._cameraDirty && (this._cameraDirty = !1, this._scheduleUpdate());
42
+ this._lastTileProvider = o, this.tilingScheme = r, this.levels = this._createLevels(), this._buildLevels(), this._updateFn = this._update.bind(this), this.debugCurrentGrids && this._ensureDebugImageryLayer(), n && (this._tileLoadListener = (h) => {
43
+ h === 0 && this._cameraDirty && (this._cameraDirty = !1, this._scheduleUpdate());
44
44
  }, n.tileLoadProgressEvent.addEventListener(this._tileLoadListener)), this._cameraChangedHandler = () => {
45
45
  this._update();
46
46
  }, this.viewer.camera.changed.addEventListener(this._cameraChangedHandler);
@@ -96,7 +96,7 @@ class En {
96
96
  }, this._updateDelay);
97
97
  }
98
98
  updatePoint(t) {
99
- var s, o, r, l;
99
+ var s, o, r, h;
100
100
  const e = this.points.findIndex((c) => c.id === t.id);
101
101
  if (e === -1) return;
102
102
  const i = this.points[e];
@@ -116,7 +116,7 @@ class En {
116
116
  const y = f.skipPoints.findIndex((v) => v.id === t.id);
117
117
  y !== -1 && f.skipPoints.splice(y, 1);
118
118
  } else {
119
- const y = this.groupByTheme ? (l = i.data) == null ? void 0 : l.theme : this.clusterTheme, v = f.groups.get(y);
119
+ const y = this.groupByTheme ? (h = i.data) == null ? void 0 : h.theme : this.clusterTheme, v = f.groups.get(y);
120
120
  if (v) {
121
121
  const C = v.findIndex((b) => b.id === t.id);
122
122
  C !== -1 && v.splice(C, 1), v.length === 0 && f.groups.delete(y);
@@ -135,8 +135,8 @@ class En {
135
135
  if (n)
136
136
  for (const [s, o] of n.entries()) {
137
137
  o.allPoints = o.allPoints.filter((r) => !e.has(r.id)), o.skipPoints = o.skipPoints.filter((r) => !e.has(r.id));
138
- for (const [r, l] of o.groups.entries()) {
139
- const c = l.filter((d) => !e.has(d.id));
138
+ for (const [r, h] of o.groups.entries()) {
139
+ const c = h.filter((d) => !e.has(d.id));
140
140
  c.length === 0 ? o.groups.delete(r) : o.groups.set(r, c);
141
141
  }
142
142
  o.allPoints.length === 0 && n.delete(s);
@@ -153,8 +153,8 @@ class En {
153
153
  }
154
154
  _addPointToGrid(t) {
155
155
  var e, i, n, s, o, r;
156
- for (const l of this.levels) {
157
- const c = l.level, d = this.gridLayers.get(c);
156
+ for (const h of this.levels) {
157
+ const c = h.level, d = this.gridLayers.get(c);
158
158
  if (!d) continue;
159
159
  const u = this.Cesium.Cartographic.fromDegrees(t.lon, t.lat), m = this.tilingScheme.positionToTileXY(
160
160
  u,
@@ -250,8 +250,8 @@ class En {
250
250
  return 0;
251
251
  let s = 0, o = 1 / 0;
252
252
  for (let r = 0; r < this.levels.length; r++) {
253
- const l = Math.abs(this.levels[r].level - t);
254
- l < o && (o = l, s = r);
253
+ const h = Math.abs(this.levels[r].level - t);
254
+ h < o && (o = h, s = r);
255
255
  }
256
256
  return s;
257
257
  }
@@ -268,10 +268,10 @@ class En {
268
268
  return e;
269
269
  }
270
270
  _processTiles(t, e) {
271
- const i = /* @__PURE__ */ new Set(), n = !this._isTerrainEnabled(), s = this.viewer.scene, o = s && s.globe, r = o && o.ellipsoid, l = r && s.camera.computeViewRectangle(r), c = (d, u, m) => {
272
- if (!n || !l) return !0;
271
+ const i = /* @__PURE__ */ new Set(), n = !this._isTerrainEnabled(), s = this.viewer.scene, o = s && s.globe, r = o && o.ellipsoid, h = r && s.camera.computeViewRectangle(r), c = (d, u, m) => {
272
+ if (!n || !h) return !0;
273
273
  const g = this.tilingScheme.tileXYToRectangle(d, u, m);
274
- return !(!g || g.east <= l.west || g.west >= l.east || g.north <= l.south || g.south >= l.north);
274
+ return !(!g || g.east <= h.west || g.west >= h.east || g.north <= h.south || g.south >= h.north);
275
275
  };
276
276
  for (const d of t) {
277
277
  const u = d.rectangle, m = d._level ?? d.level;
@@ -282,14 +282,14 @@ class En {
282
282
  if (typeof w == "number" && typeof y == "number") {
283
283
  const T = m - f;
284
284
  if (T >= 0) {
285
- const A = 1 << T, D = Math.floor(w / A), O = Math.floor(y / A), x = `${f}_${D}_${O}`;
285
+ const A = 1 << T, S = Math.floor(w / A), k = Math.floor(y / A), x = `${f}_${S}_${k}`;
286
286
  if (i.has(x)) continue;
287
- i.add(x), e(p, D, O, m);
287
+ i.add(x), e(p, S, k, m);
288
288
  } else {
289
- const D = 1 << Math.min(-T, this.maxRefineLevels), O = w * D, x = y * D;
290
- for (let $ = 0; $ < D; $++)
291
- for (let F = 0; F < D; F++) {
292
- const z = O + $, G = x + F;
289
+ const S = 1 << Math.min(-T, this.maxRefineLevels), k = w * S, x = y * S;
290
+ for (let $ = 0; $ < S; $++)
291
+ for (let H = 0; H < S; H++) {
292
+ const z = k + $, G = x + H;
293
293
  if (!c(z, G, f)) continue;
294
294
  const B = `${f}_${z}_${G}`;
295
295
  i.has(B) || (i.add(B), e(p, z, G, m));
@@ -297,12 +297,12 @@ class En {
297
297
  }
298
298
  continue;
299
299
  }
300
- const C = this.levels[p].size, b = this.Cesium.Math.toDegrees(u.west), M = this.Cesium.Math.toDegrees(u.east), P = this.Cesium.Math.toDegrees(u.south), L = this.Cesium.Math.toDegrees(u.north), E = Math.floor((b - -180) / C), I = Math.floor((M - -180) / C), S = Math.floor((P - -90) / C), _ = Math.floor((L - -90) / C);
300
+ const C = this.levels[p].size, b = this.Cesium.Math.toDegrees(u.west), M = this.Cesium.Math.toDegrees(u.east), P = this.Cesium.Math.toDegrees(u.south), L = this.Cesium.Math.toDegrees(u.north), E = Math.floor((b - -180) / C), I = Math.floor((M - -180) / C), D = Math.floor((P - -90) / C), _ = Math.floor((L - -90) / C);
301
301
  for (let T = E; T <= I; T++)
302
- for (let A = S; A <= _; A++) {
302
+ for (let A = D; A <= _; A++) {
303
303
  if (!c(T, A, f)) continue;
304
- const D = `${f}_${T}_${A}`;
305
- i.has(D) || (i.add(D), e(p, T, A, m));
304
+ const S = `${f}_${T}_${A}`;
305
+ i.has(S) || (i.add(S), e(p, T, A, m));
306
306
  }
307
307
  }
308
308
  }
@@ -315,7 +315,7 @@ class En {
315
315
  _getCellContext(t, e, i, n) {
316
316
  const o = this.levels[t].level, r = this.gridLayers.get(o);
317
317
  if (!r) return null;
318
- const l = `${e}_${i}`, c = r.get(l);
318
+ const h = `${e}_${i}`, c = r.get(h);
319
319
  if (!c) return null;
320
320
  const d = this.tilingScheme.tileXYToRectangle(e, i, o), u = this.Cesium.Math.toDegrees(d.west), m = this.Cesium.Math.toDegrees(d.south), g = this.Cesium.Math.toDegrees(d.east), p = this.Cesium.Math.toDegrees(d.north), f = (u + g) / 2, w = (m + p) / 2;
321
321
  return {
@@ -323,7 +323,7 @@ class En {
323
323
  tileLevel: o,
324
324
  lonIdx: e,
325
325
  latIdx: i,
326
- key: l,
326
+ key: h,
327
327
  cell: c,
328
328
  rect: d,
329
329
  west: u,
@@ -336,7 +336,7 @@ class En {
336
336
  };
337
337
  }
338
338
  _processCellSkipPoints(t, e) {
339
- var o, r, l, c;
339
+ var o, r, h, c;
340
340
  const { cell: i, viewTileLevel: n } = t, s = n;
341
341
  for (const d of i.skipPoints)
342
342
  if (((o = d.data) == null ? void 0 : o.show) !== !1) {
@@ -346,7 +346,7 @@ class En {
346
346
  lon: d.lon,
347
347
  lat: d.lat,
348
348
  height: d.height,
349
- theme: ((c = (l = (r = d.data) == null ? void 0 : r.billboard) == null ? void 0 : l[0]) == null ? void 0 : c.theme) || this.pointTheme,
349
+ theme: ((c = (h = (r = d.data) == null ? void 0 : r.billboard) == null ? void 0 : h[0]) == null ? void 0 : c.theme) || this.pointTheme,
350
350
  style: d.style
351
351
  }), e++);
352
352
  }
@@ -359,18 +359,18 @@ class En {
359
359
  lonIdx: s,
360
360
  latIdx: o,
361
361
  cell: r,
362
- centerLon: l,
362
+ centerLon: h,
363
363
  centerLat: c,
364
364
  viewTileLevel: d
365
365
  } = t, u = d;
366
- for (const [I, S] of r.groups) {
367
- const _ = S.filter((x) => {
366
+ for (const [I, D] of r.groups) {
367
+ const _ = D.filter((x) => {
368
368
  var $;
369
369
  return (($ = x.data) == null ? void 0 : $.show) !== !1;
370
370
  });
371
371
  if (_.length === 0) continue;
372
- let T = l, A = c, D = ((m = _[0]) == null ? void 0 : m.height) || 0;
373
- if (this.centralPointMode == "firstPoint" && (T = ((g = _[0]) == null ? void 0 : g.lon) || 0, A = ((p = _[0]) == null ? void 0 : p.lat) || 0, D = ((f = _[0]) == null ? void 0 : f.height) || 0), n === this.levels.length - 1 || _.length < e)
372
+ let T = h, A = c, S = ((m = _[0]) == null ? void 0 : m.height) || 0;
373
+ if (this.centralPointMode == "firstPoint" && (T = ((g = _[0]) == null ? void 0 : g.lon) || 0, A = ((p = _[0]) == null ? void 0 : p.lat) || 0, S = ((f = _[0]) == null ? void 0 : f.height) || 0), n === this.levels.length - 1 || _.length < e)
374
374
  for (const x of _) {
375
375
  if (i >= this.displayLimit) break;
376
376
  this._isVisibleAtLevel(x, u) && (this.labelPool.add(x.data, {
@@ -387,7 +387,7 @@ class En {
387
387
  return i;
388
388
  const x = u == null ? _ : _.filter((G) => this._isVisibleAtLevel(G, u));
389
389
  if (!x.length) return i;
390
- const F = ((P = (M = (b = (C = x[0]) == null ? void 0 : C.data) == null ? void 0 : b.billboard) == null ? void 0 : M[0]) == null ? void 0 : P.theme) || this.clusterTheme, z = this.groupByTheme ? `cluster-${n}-${s}-${o}-${I}` : `cluster-${n}-${s}-${o}`;
390
+ const H = ((P = (M = (b = (C = x[0]) == null ? void 0 : C.data) == null ? void 0 : b.billboard) == null ? void 0 : M[0]) == null ? void 0 : P.theme) || this.clusterTheme, z = this.groupByTheme ? `cluster-${n}-${s}-${o}-${I}` : `cluster-${n}-${s}-${o}`;
391
391
  this.labelPool.add(
392
392
  {
393
393
  id: z,
@@ -401,8 +401,8 @@ class En {
401
401
  id: z,
402
402
  lon: T,
403
403
  lat: A,
404
- height: D,
405
- theme: F
404
+ height: S,
405
+ theme: H
406
406
  }
407
407
  ), i++;
408
408
  }
@@ -411,13 +411,13 @@ class En {
411
411
  }
412
412
  _debugDrawCell(t) {
413
413
  if (!this.debugCurrentGrids) return;
414
- const { levelIdx: e, west: i, south: n, east: s, north: o, lonIdx: r, latIdx: l } = t, c = this.levels[e].level;
414
+ const { levelIdx: e, west: i, south: n, east: s, north: o, lonIdx: r, latIdx: h } = t, c = this.levels[e].level;
415
415
  this._drawDebugGrid(
416
416
  i,
417
417
  n,
418
418
  s,
419
419
  o,
420
- `L:${c} X:${r} Y:${l}`
420
+ `L:${c} X:${r} Y:${h}`
421
421
  );
422
422
  }
423
423
  refresh() {
@@ -435,7 +435,7 @@ class En {
435
435
  n,
436
436
  t,
437
437
  e
438
- ]), l = this.viewer.entities.add({
438
+ ]), h = this.viewer.entities.add({
439
439
  rectangle: {
440
440
  coordinates: o,
441
441
  material: this.Cesium.Color.YELLOW.withAlpha(0.2),
@@ -463,7 +463,7 @@ class En {
463
463
  horizontalOrigin: this.Cesium.HorizontalOrigin.CENTER
464
464
  }
465
465
  });
466
- this.debugGrids.push(l);
466
+ this.debugGrids.push(h);
467
467
  }
468
468
  _clearDebugGrids() {
469
469
  for (const t of this.debugGrids)
@@ -495,9 +495,9 @@ class En {
495
495
  }
496
496
  }
497
497
  var te = /* @__PURE__ */ ((a) => (a.Click = "marker:click", a.DoubleClick = "marker:dblclick", a.RightClick = "marker:rightclick", a.MouseEnter = "marker:mouseenter", a.MouseLeave = "marker:mouseleave", a.MouseDown = "marker:mousedown", a.MouseUp = "marker:mouseup", a))(te || {});
498
- class zt {
498
+ class Bt {
499
499
  constructor() {
500
- h(this, "listenerMap", /* @__PURE__ */ new Map());
500
+ l(this, "listenerMap", /* @__PURE__ */ new Map());
501
501
  }
502
502
  /**
503
503
  * 添加监听器
@@ -544,7 +544,7 @@ class zt {
544
544
  }
545
545
  }
546
546
  }
547
- const Nt = {
547
+ const jt = {
548
548
  [te.Click]: "click",
549
549
  [te.DoubleClick]: "dblclick",
550
550
  [te.RightClick]: "contextmenu",
@@ -562,30 +562,30 @@ class N {
562
562
  * @param eventBus 可选:自定义事件总线
563
563
  */
564
564
  constructor(t, e, i = "html-label-container", n, s = !0) {
565
- h(this, "viewer");
566
- h(this, "Cesium");
567
- h(this, "container");
568
- h(this, "labels", /* @__PURE__ */ new Map());
569
- h(this, "activeIds", /* @__PURE__ */ new Set());
570
- h(this, "occludedIds", /* @__PURE__ */ new Set());
571
- h(this, "_updateFn");
572
- h(this, "_cameraChangedFn");
573
- h(this, "themes", {});
574
- h(this, "occlusionCheckLogs", []);
575
- h(this, "occlusionLogEnabled", !1);
576
- h(this, "occlusionLogMax", 1e4);
577
- h(this, "occlusionOptions", {
565
+ l(this, "viewer");
566
+ l(this, "Cesium");
567
+ l(this, "container");
568
+ l(this, "labels", /* @__PURE__ */ new Map());
569
+ l(this, "activeIds", /* @__PURE__ */ new Set());
570
+ l(this, "occludedIds", /* @__PURE__ */ new Set());
571
+ l(this, "_updateFn");
572
+ l(this, "_cameraChangedFn");
573
+ l(this, "themes", {});
574
+ l(this, "occlusionCheckLogs", []);
575
+ l(this, "occlusionLogEnabled", !1);
576
+ l(this, "occlusionLogMax", 1e4);
577
+ l(this, "occlusionOptions", {
578
578
  enabled: !1,
579
579
  throttleMs: 120,
580
580
  distanceEpsilon: 1
581
581
  });
582
- h(this, "_occlusionTimer", null);
583
- h(this, "_lastOcclusionAt", 0);
584
- h(this, "_occlusionChecking", !1);
585
- h(this, "_occlusionPending", !1);
586
- h(this, "eventBus");
587
- h(this, "openWheel", !0);
588
- this.Cesium = t, this.viewer = e, this.container = this._createContainer(i), this._updateFn = this._update.bind(this), this.viewer.scene.postRender.addEventListener(this._updateFn), this._cameraChangedFn = this._scheduleOcclusionCheck.bind(this), this.viewer.camera.changed.addEventListener(this._cameraChangedFn), this.eventBus = n || new zt(), this.openWheel = s, this.runOcclusionCheckNow();
582
+ l(this, "_occlusionTimer", null);
583
+ l(this, "_lastOcclusionAt", 0);
584
+ l(this, "_occlusionChecking", !1);
585
+ l(this, "_occlusionPending", !1);
586
+ l(this, "eventBus");
587
+ l(this, "openWheel", !0);
588
+ this.Cesium = t, this.viewer = e, this.container = this._createContainer(i), this._updateFn = this._update.bind(this), this.viewer.scene.postRender.addEventListener(this._updateFn), this._cameraChangedFn = this._scheduleOcclusionCheck.bind(this), this.viewer.camera.changed.addEventListener(this._cameraChangedFn), this.eventBus = n || new Bt(), this.openWheel = s, this.runOcclusionCheckNow();
589
589
  }
590
590
  /**
591
591
  * 创建标签容器
@@ -619,7 +619,7 @@ class N {
619
619
  lat: s,
620
620
  height: o = 0,
621
621
  theme: r,
622
- show: l = !0,
622
+ show: h = !0,
623
623
  notCreateElement: c = !1,
624
624
  style: d
625
625
  } = e, u = this.themes[r];
@@ -631,7 +631,7 @@ class N {
631
631
  if (m) {
632
632
  m.theme = r, m.data = t, m.notCreateElement = c;
633
633
  try {
634
- m.unload = u.createElement(m.el, { id: i, theme: r, data: t }, u), (!c || l) && this.container.appendChild(m.el);
634
+ m.unload = u.createElement(m.el, { id: i, theme: r, data: t }, u), (!c || h) && this.container.appendChild(m.el);
635
635
  } catch (g) {
636
636
  console.error(`Error updating label element for id "${i}":`, g);
637
637
  }
@@ -643,7 +643,7 @@ class N {
643
643
  pointerEvents: "auto",
644
644
  ...e.style || {}
645
645
  });
646
- for (const [f, w] of Object.entries(Nt)) {
646
+ for (const [f, w] of Object.entries(jt)) {
647
647
  g.addEventListener(w, (v) => {
648
648
  v.stopPropagation();
649
649
  const C = this.labels.get(i);
@@ -661,7 +661,7 @@ class N {
661
661
  });
662
662
  }
663
663
  let p = null;
664
- if (!c || l) {
664
+ if (!c || h) {
665
665
  try {
666
666
  p = u.createElement(g, { id: i, theme: r, data: t }, u) || {};
667
667
  } catch (f) {
@@ -671,7 +671,7 @@ class N {
671
671
  }
672
672
  m = { id: i, el: g, theme: r, data: t, notCreateElement: c, unload: p }, this.labels.set(i, m);
673
673
  }
674
- m.el.dataset.lon = String(n), m.el.dataset.lat = String(s), m.el.dataset.height = String(o), m.el.style.zIndex = (d == null ? void 0 : d.zIndex) || "1", m.el.style.display = l ? "block" : "none", l && this.activeIds.add(i), l ? this._scheduleOcclusionCheck() : this.occludedIds.delete(i);
674
+ m.el.dataset.lon = String(n), m.el.dataset.lat = String(s), m.el.dataset.height = String(o), m.el.style.zIndex = (d == null ? void 0 : d.zIndex) || "1", m.el.style.display = h ? "block" : "none", h && this.activeIds.add(i), h ? this._scheduleOcclusionCheck() : this.occludedIds.delete(i);
675
675
  }
676
676
  /**
677
677
  * 批量添加标签
@@ -807,8 +807,8 @@ class N {
807
807
  }
808
808
  let r = 0;
809
809
  o && o[0] && o[0].height != null ? r = o[0].height : r = 0;
810
- const l = i.Cartesian3.fromDegrees(t, e, r);
811
- return this.toWindowCoordinates(l);
810
+ const h = i.Cartesian3.fromDegrees(t, e, r);
811
+ return this.toWindowCoordinates(h);
812
812
  }
813
813
  /**
814
814
  * 坐标转换:经纬度 -> 屏幕像素坐标
@@ -843,10 +843,10 @@ class N {
843
843
  i.el.style.display = "none";
844
844
  continue;
845
845
  }
846
- const r = this.Cesium.Cartesian3.fromDegrees(n, s, o), l = this.toWindowCoordinates(r);
847
- if (this.Cesium.defined(l)) {
846
+ const r = this.Cesium.Cartesian3.fromDegrees(n, s, o), h = this.toWindowCoordinates(r);
847
+ if (this.Cesium.defined(h)) {
848
848
  const d = ((t = this.themes[i.theme].options) == null ? void 0 : t.offset) || {}, u = d.x || 0, m = d.y || 0, g = this.occludedIds.has(e);
849
- i.el.style.left = `${l.x}px`, i.el.style.top = `${l.y}px`, i.el.style.transform = `translate(${u}px, ${m}px)`, i.el.style.display = g ? "none" : "block";
849
+ i.el.style.left = `${h.x}px`, i.el.style.top = `${h.y}px`, i.el.style.transform = `translate(${u}px, ${m}px)`, i.el.style.display = g ? "none" : "block";
850
850
  } else
851
851
  i.el.style.display = "none";
852
852
  }
@@ -867,8 +867,8 @@ class N {
867
867
  }
868
868
  _computeLabelOccluded(t, e, i, n, s, o) {
869
869
  var d, u;
870
- const r = (d = this.viewer) == null ? void 0 : d.scene, l = (u = this.viewer) == null ? void 0 : u.camera, c = this.Cesium;
871
- if (!r || !l || !c)
870
+ const r = (d = this.viewer) == null ? void 0 : d.scene, h = (u = this.viewer) == null ? void 0 : u.camera, c = this.Cesium;
871
+ if (!r || !h || !c)
872
872
  return this._pushOcclusionLog({
873
873
  timestamp: Date.now(),
874
874
  id: t,
@@ -890,7 +890,7 @@ class N {
890
890
  }), !0;
891
891
  try {
892
892
  const m = r.pickPosition(i);
893
- if (!m || !l.positionWC)
893
+ if (!m || !h.positionWC)
894
894
  return this._pushOcclusionLog({
895
895
  timestamp: Date.now(),
896
896
  id: t,
@@ -900,7 +900,7 @@ class N {
900
900
  occluded: !0,
901
901
  reason: "pick-empty"
902
902
  }), !0;
903
- const g = Number(this.occlusionOptions.distanceEpsilon) || 0, p = c.Cartesian3.distance(l.positionWC, e), f = c.Cartesian3.distance(l.positionWC, m), w = f + g < p;
903
+ const g = Number(this.occlusionOptions.distanceEpsilon) || 0, p = c.Cartesian3.distance(h.positionWC, e), f = c.Cartesian3.distance(h.positionWC, m), w = f + g < p;
904
904
  return this._pushOcclusionLog({
905
905
  timestamp: Date.now(),
906
906
  id: t,
@@ -1002,13 +1002,13 @@ class N {
1002
1002
  this.viewer.scene.postRender.removeEventListener(this._updateFn), this.viewer.camera.changed.removeEventListener(this._cameraChangedFn), this._occlusionTimer !== null && (clearTimeout(this._occlusionTimer), this._occlusionTimer = null), this.labels.clear(), this.activeIds.clear(), this.occludedIds.clear();
1003
1003
  }
1004
1004
  }
1005
- class ze {
1005
+ class ye {
1006
1006
  constructor() {
1007
- h(this, "tooltipEl");
1008
- h(this, "visible", !1);
1009
- h(this, "offsetX", 10);
1010
- h(this, "offsetY", -20);
1011
- h(this, "onMouseMove", null);
1007
+ l(this, "tooltipEl");
1008
+ l(this, "visible", !1);
1009
+ l(this, "offsetX", 10);
1010
+ l(this, "offsetY", -20);
1011
+ l(this, "onMouseMove", null);
1012
1012
  this.tooltipEl = document.createElement("div"), this.tooltipEl.style.position = "fixed", this.tooltipEl.style.pointerEvents = "none", this.tooltipEl.style.zIndex = "10000", this.tooltipEl.style.padding = "4px 8px", this.tooltipEl.style.borderRadius = "4px", this.tooltipEl.style.background = "rgba(0, 0, 0, 0.7)", this.tooltipEl.style.color = "#fff", this.tooltipEl.style.fontSize = "13px", this.tooltipEl.style.transition = "opacity 0.1s ease", this.tooltipEl.style.opacity = "0", document.body.appendChild(this.tooltipEl), this.onMouseMove = (t) => {
1013
1013
  this.visible && (this.tooltipEl.style.left = `${t.clientX + this.offsetX}px`, this.tooltipEl.style.top = `${t.clientY + this.offsetY}px`);
1014
1014
  }, window.addEventListener("mousemove", this.onMouseMove);
@@ -1023,22 +1023,22 @@ class ze {
1023
1023
  this.onMouseMove && (window.removeEventListener("mousemove", this.onMouseMove), this.onMouseMove = null), this.tooltipEl.parentElement && this.tooltipEl.parentElement.removeChild(this.tooltipEl);
1024
1024
  }
1025
1025
  }
1026
- class Gt {
1026
+ class Yt {
1027
1027
  constructor(t, e) {
1028
- h(this, "Cesium");
1029
- h(this, "viewer");
1030
- h(this, "handler", null);
1031
- h(this, "entity", null);
1032
- h(this, "tooltip", null);
1028
+ l(this, "Cesium");
1029
+ l(this, "viewer");
1030
+ l(this, "handler", null);
1031
+ l(this, "entity", null);
1032
+ l(this, "tooltip", null);
1033
1033
  this.Cesium = t, this.viewer = e;
1034
1034
  }
1035
1035
  startDrawing(t) {
1036
1036
  const { Cesium: e, viewer: i } = this;
1037
- this.tooltip = new ze(), this.tooltip.show("左键添加点"), this.handler = new e.ScreenSpaceEventHandler(i.canvas), this.handler.setInputAction((n) => {
1037
+ this.tooltip = new ye(), this.tooltip.show("左键添加点"), this.handler = new e.ScreenSpaceEventHandler(i.canvas), this.handler.setInputAction((n) => {
1038
1038
  var m, g;
1039
1039
  const s = i.scene.pickPosition(n.position);
1040
1040
  if (!s) return;
1041
- const o = e.Cartographic.fromCartesian(s), r = e.Math.toDegrees(o.longitude), l = e.Math.toDegrees(o.latitude), c = o.height, d = i.entities.add({
1041
+ const o = e.Cartographic.fromCartesian(s), r = e.Math.toDegrees(o.longitude), h = e.Math.toDegrees(o.latitude), c = o.height, d = i.entities.add({
1042
1042
  position: s,
1043
1043
  point: {
1044
1044
  pixelSize: 10,
@@ -1050,7 +1050,7 @@ class Gt {
1050
1050
  const u = {
1051
1051
  entity: d,
1052
1052
  position: s,
1053
- lnglat: { lng: r, lat: l, height: c },
1053
+ lnglat: { lng: r, lat: h, height: c },
1054
1054
  clear: () => {
1055
1055
  this.clear();
1056
1056
  }
@@ -1066,19 +1066,21 @@ class Gt {
1066
1066
  this.entity && (this.viewer.entities.remove(this.entity), this.entity = null), this.stopDrawing();
1067
1067
  }
1068
1068
  }
1069
- class Bt {
1069
+ class Vt {
1070
1070
  constructor(t, e) {
1071
- h(this, "Cesium");
1072
- h(this, "viewer");
1073
- h(this, "handler", null);
1074
- h(this, "positions", []);
1075
- h(this, "entity", null);
1076
- h(this, "tooltip", null);
1077
- h(this, "tempPoints", []);
1071
+ l(this, "Cesium");
1072
+ l(this, "viewer");
1073
+ l(this, "handler", null);
1074
+ l(this, "positions", []);
1075
+ l(this, "entity", null);
1076
+ l(this, "tooltip", null);
1077
+ l(this, "tempPoints", []);
1078
+ l(this, "options", null);
1079
+ l(this, "keydownHandler", null);
1078
1080
  this.Cesium = t, this.viewer = e;
1079
1081
  }
1080
1082
  getPickPosition(t) {
1081
- var s, o, r, l;
1083
+ var s, o, r, h;
1082
1084
  const { viewer: e } = this, i = e == null ? void 0 : e.scene;
1083
1085
  if (!i || !t) return null;
1084
1086
  let n = null;
@@ -1089,14 +1091,63 @@ class Bt {
1089
1091
  }
1090
1092
  if (!n) {
1091
1093
  const c = (o = (s = e.camera) == null ? void 0 : s.getPickRay) == null ? void 0 : o.call(s, t);
1092
- c && (n = ((l = (r = i.globe) == null ? void 0 : r.pick) == null ? void 0 : l.call(r, c, i)) || null);
1094
+ c && (n = ((h = (r = i.globe) == null ? void 0 : r.pick) == null ? void 0 : h.call(r, c, i)) || null);
1093
1095
  }
1094
1096
  return n;
1095
1097
  }
1098
+ syncEntity() {
1099
+ if (this.entity) {
1100
+ if (this.positions.length === 0) {
1101
+ this.viewer.entities.remove(this.entity), this.entity = null;
1102
+ return;
1103
+ }
1104
+ this.entity.polyline.positions = this.positions.slice();
1105
+ }
1106
+ }
1107
+ undoLastPoint() {
1108
+ if (this.positions.length === 0) return;
1109
+ this.positions.pop();
1110
+ const t = this.tempPoints.pop();
1111
+ t && this.viewer.entities.remove(t), this.syncEntity();
1112
+ }
1113
+ finishDrawing(t = !1) {
1114
+ var s, o, r;
1115
+ const { Cesium: e } = this;
1116
+ if (t && this.positions.length > 0) {
1117
+ this.positions.length = this.positions.length - 1;
1118
+ const h = this.tempPoints.pop();
1119
+ h && this.viewer.entities.remove(h);
1120
+ }
1121
+ if (this.syncEntity(), this.stopDrawing(), (s = this.tooltip) == null || s.hide(), this.tooltip = null, this.positions.length < 2) return;
1122
+ const i = this.positions.map((h) => {
1123
+ const c = e.Cartographic.fromCartesian(h);
1124
+ return {
1125
+ lng: e.Math.toDegrees(c.longitude),
1126
+ lat: e.Math.toDegrees(c.latitude),
1127
+ height: c.height
1128
+ };
1129
+ }), n = {
1130
+ entity: this.entity,
1131
+ positions: this.positions,
1132
+ lnglats: i,
1133
+ clear: () => {
1134
+ this.clear();
1135
+ }
1136
+ };
1137
+ (r = (o = this.options) == null ? void 0 : o.onComplete) == null || r.call(o, n);
1138
+ }
1139
+ bindKeyboardEvents() {
1140
+ this.unbindKeyboardEvents(), this.keydownHandler = (t) => {
1141
+ t.key === "Escape" && (t.preventDefault(), this.finishDrawing(!1));
1142
+ }, document.addEventListener("keydown", this.keydownHandler);
1143
+ }
1144
+ unbindKeyboardEvents() {
1145
+ this.keydownHandler && (document.removeEventListener("keydown", this.keydownHandler), this.keydownHandler = null);
1146
+ }
1096
1147
  startDrawing(t) {
1097
1148
  const { Cesium: e, viewer: i } = this;
1098
- this.positions = [], this.tempPoints = [], this.entity = null, this.tooltip = new ze(), this.tooltip.show("单击左键添加点,双击左键结束"), this.handler = new e.ScreenSpaceEventHandler(i.canvas), this.handler.setInputAction((n) => {
1099
- var r, l;
1149
+ this.options = t, this.positions = [], this.tempPoints = [], this.entity = null, this.tooltip = new ye(), this.tooltip.show("单击左键添加点,右键撤销,双击左键或 Esc 结束"), this.handler = new e.ScreenSpaceEventHandler(i.canvas), this.bindKeyboardEvents(), this.handler.setInputAction((n) => {
1150
+ var r, h;
1100
1151
  const s = this.getPickPosition(n.position);
1101
1152
  if (!s) return;
1102
1153
  this.positions.push(s);
@@ -1113,49 +1164,33 @@ class Bt {
1113
1164
  positions: this.positions.slice(),
1114
1165
  width: 3,
1115
1166
  material: t.color || e.Color.YELLOW,
1116
- depthFailMaterial: ((l = (r = t.color) == null ? void 0 : r.withAlpha) == null ? void 0 : l.call(r, 0.5)) || e.Color.YELLOW.withAlpha(0.5)
1167
+ depthFailMaterial: ((h = (r = t.color) == null ? void 0 : r.withAlpha) == null ? void 0 : h.call(r, 0.5)) || e.Color.YELLOW.withAlpha(0.5)
1117
1168
  }
1118
1169
  });
1119
1170
  }, e.ScreenSpaceEventType.LEFT_CLICK), this.handler.setInputAction(() => {
1120
- var o, r;
1121
- if (this.stopDrawing(), (o = this.tooltip) == null || o.hide(), this.tooltip = null, this.positions.length < 2) return;
1122
- this.positions.length = this.positions.length - 1, this.entity && (this.entity.polyline.positions = this.positions.slice());
1123
- const n = this.positions.map((l) => {
1124
- const c = e.Cartographic.fromCartesian(l);
1125
- return {
1126
- lng: e.Math.toDegrees(c.longitude),
1127
- lat: e.Math.toDegrees(c.latitude),
1128
- height: c.height
1129
- };
1130
- }), s = {
1131
- entity: this.entity,
1132
- positions: this.positions,
1133
- lnglats: n,
1134
- clear: () => {
1135
- this.clear();
1136
- }
1137
- };
1138
- (r = t.onComplete) == null || r.call(t, s);
1171
+ this.undoLastPoint();
1172
+ }, e.ScreenSpaceEventType.RIGHT_CLICK), this.handler.setInputAction(() => {
1173
+ this.finishDrawing(!0);
1139
1174
  }, e.ScreenSpaceEventType.LEFT_DOUBLE_CLICK);
1140
1175
  }
1141
1176
  stopDrawing() {
1142
1177
  var t;
1143
- (t = this.handler) == null || t.destroy(), this.handler = null;
1178
+ this.unbindKeyboardEvents(), (t = this.handler) == null || t.destroy(), this.handler = null;
1144
1179
  }
1145
1180
  clear() {
1146
1181
  var e;
1147
1182
  const { viewer: t } = this;
1148
- this.entity && (t.entities.remove(this.entity), this.entity = null), this.tempPoints.forEach((i) => t.entities.remove(i)), this.tempPoints = [], (e = this.tooltip) == null || e.hide(), this.tooltip = null, this.positions = [], this.stopDrawing();
1183
+ this.entity && (t.entities.remove(this.entity), this.entity = null), this.tempPoints.forEach((i) => t.entities.remove(i)), this.tempPoints = [], (e = this.tooltip) == null || e.hide(), this.tooltip = null, this.positions = [], this.options = null, this.stopDrawing();
1149
1184
  }
1150
1185
  }
1151
- class jt {
1186
+ class Wt {
1152
1187
  constructor(t, e) {
1153
- h(this, "Cesium");
1154
- h(this, "viewer");
1155
- h(this, "handler", null);
1156
- h(this, "startPoint", null);
1157
- h(this, "endPoint", null);
1158
- h(this, "entity", null);
1188
+ l(this, "Cesium");
1189
+ l(this, "viewer");
1190
+ l(this, "handler", null);
1191
+ l(this, "startPoint", null);
1192
+ l(this, "endPoint", null);
1193
+ l(this, "entity", null);
1159
1194
  this.Cesium = t, this.viewer = e;
1160
1195
  }
1161
1196
  startDrawing(t) {
@@ -1170,7 +1205,7 @@ class jt {
1170
1205
  coordinates: new e.CallbackProperty(() => {
1171
1206
  if (!(!this.startPoint || !this.endPoint))
1172
1207
  try {
1173
- const r = e.Cartographic.fromCartesian(this.startPoint), l = e.Cartographic.fromCartesian(this.endPoint), c = Math.min(r.longitude, l.longitude), d = Math.max(r.longitude, l.longitude), u = Math.min(r.latitude, l.latitude), m = Math.max(r.latitude, l.latitude);
1208
+ const r = e.Cartographic.fromCartesian(this.startPoint), h = e.Cartographic.fromCartesian(this.endPoint), c = Math.min(r.longitude, h.longitude), d = Math.max(r.longitude, h.longitude), u = Math.min(r.latitude, h.latitude), m = Math.max(r.latitude, h.latitude);
1174
1209
  return new e.Rectangle(c, u, d, m);
1175
1210
  } catch (r) {
1176
1211
  console.warn("Rectangle calculation error:", r);
@@ -1185,13 +1220,13 @@ class jt {
1185
1220
  });
1186
1221
  else {
1187
1222
  this.stopDrawing();
1188
- const r = e.Cartographic.fromCartesian(this.startPoint), l = e.Cartographic.fromCartesian(this.endPoint), c = {
1189
- lng: e.Math.toDegrees(Math.min(r.longitude, l.longitude)),
1190
- lat: e.Math.toDegrees(Math.min(r.latitude, l.latitude)),
1223
+ const r = e.Cartographic.fromCartesian(this.startPoint), h = e.Cartographic.fromCartesian(this.endPoint), c = {
1224
+ lng: e.Math.toDegrees(Math.min(r.longitude, h.longitude)),
1225
+ lat: e.Math.toDegrees(Math.min(r.latitude, h.latitude)),
1191
1226
  height: 0
1192
1227
  }, d = {
1193
- lng: e.Math.toDegrees(Math.max(r.longitude, l.longitude)),
1194
- lat: e.Math.toDegrees(Math.max(r.latitude, l.latitude)),
1228
+ lng: e.Math.toDegrees(Math.max(r.longitude, h.longitude)),
1229
+ lat: e.Math.toDegrees(Math.max(r.latitude, h.latitude)),
1195
1230
  height: 0
1196
1231
  }, u = {
1197
1232
  entity: this.entity,
@@ -1223,15 +1258,15 @@ class jt {
1223
1258
  this.entity && (this.viewer.entities.remove(this.entity), this.entity = null), this.startPoint = null, this.endPoint = null, this.stopDrawing();
1224
1259
  }
1225
1260
  }
1226
- class Yt {
1261
+ class Ut {
1227
1262
  constructor(t, e) {
1228
- h(this, "viewer");
1229
- h(this, "Cesium");
1230
- h(this, "handler", null);
1231
- h(this, "entity", null);
1232
- h(this, "positions", []);
1233
- h(this, "_isDrawing", !1);
1234
- h(this, "currentRadius", 0);
1263
+ l(this, "viewer");
1264
+ l(this, "Cesium");
1265
+ l(this, "handler", null);
1266
+ l(this, "entity", null);
1267
+ l(this, "positions", []);
1268
+ l(this, "_isDrawing", !1);
1269
+ l(this, "currentRadius", 0);
1235
1270
  this.Cesium = t, this.viewer = e;
1236
1271
  }
1237
1272
  startDrawing(t) {
@@ -1271,7 +1306,7 @@ class Yt {
1271
1306
  lng: this.Cesium.Math.toDegrees(s.longitude),
1272
1307
  lat: this.Cesium.Math.toDegrees(s.latitude),
1273
1308
  height: s.height
1274
- }, r = (t == null ? void 0 : t.step) || 1, l = [], c = [];
1309
+ }, r = (t == null ? void 0 : t.step) || 1, h = [], c = [];
1275
1310
  for (let m = 0; m < 360; m += r) {
1276
1311
  const g = this.Cesium.Math.toRadians(m), p = new this.Cesium.EllipsoidGeodesic();
1277
1312
  p.setEndPoints(
@@ -1282,7 +1317,7 @@ class Yt {
1282
1317
  )
1283
1318
  );
1284
1319
  const f = p.interpolateUsingSurfaceDistance(n), w = this.Cesium.Ellipsoid.WGS84.cartographicToCartesian(f);
1285
- l.push(w);
1320
+ h.push(w);
1286
1321
  const y = this.Cesium.Cartographic.fromCartesian(w);
1287
1322
  c.push({
1288
1323
  lng: this.Cesium.Math.toDegrees(y.longitude),
@@ -1303,7 +1338,7 @@ class Yt {
1303
1338
  entity: this.entity,
1304
1339
  positions: this.positions,
1305
1340
  lnglats: d,
1306
- circlePoints: l,
1341
+ circlePoints: h,
1307
1342
  circleLnglats: c,
1308
1343
  center: o,
1309
1344
  radius: n,
@@ -1319,16 +1354,18 @@ class Yt {
1319
1354
  this.stopDrawing(), this.entity && (this.viewer.entities.remove(this.entity), this.entity = null), this.positions = [], this.currentRadius = 0;
1320
1355
  }
1321
1356
  }
1322
- class Vt {
1357
+ class Kt {
1323
1358
  constructor(t, e) {
1324
- h(this, "Cesium");
1325
- h(this, "viewer");
1326
- h(this, "handler", null);
1327
- h(this, "positions", []);
1328
- h(this, "lnglats", []);
1329
- h(this, "entity", null);
1330
- h(this, "tooltip", null);
1331
- h(this, "tempPoints", []);
1359
+ l(this, "Cesium");
1360
+ l(this, "viewer");
1361
+ l(this, "handler", null);
1362
+ l(this, "positions", []);
1363
+ l(this, "lnglats", []);
1364
+ l(this, "entity", null);
1365
+ l(this, "tooltip", null);
1366
+ l(this, "tempPoints", []);
1367
+ l(this, "options", null);
1368
+ l(this, "keydownHandler", null);
1332
1369
  this.Cesium = t, this.viewer = e;
1333
1370
  }
1334
1371
  isHelperPick(t) {
@@ -1349,7 +1386,7 @@ class Vt {
1349
1386
  }
1350
1387
  }
1351
1388
  getPickPosition(t) {
1352
- var r, l, c, d;
1389
+ var r, h, c, d;
1353
1390
  const { viewer: e } = this, i = e == null ? void 0 : e.scene;
1354
1391
  if (!i || !t) return null;
1355
1392
  let n = null;
@@ -1360,14 +1397,49 @@ class Vt {
1360
1397
  console.warn("[PolygonDrawer] pickPosition failed:", u);
1361
1398
  }
1362
1399
  if (!n) {
1363
- const u = (l = (r = e.camera) == null ? void 0 : r.getPickRay) == null ? void 0 : l.call(r, t);
1400
+ const u = (h = (r = e.camera) == null ? void 0 : r.getPickRay) == null ? void 0 : h.call(r, t);
1364
1401
  u && (n = ((d = (c = i.globe) == null ? void 0 : c.pick) == null ? void 0 : d.call(c, u, i)) || null);
1365
1402
  }
1366
1403
  return n;
1367
1404
  }
1405
+ syncEntity() {
1406
+ this.entity && this.positions.length === 0 && (this.viewer.entities.remove(this.entity), this.entity = null);
1407
+ }
1408
+ undoLastPoint() {
1409
+ if (this.positions.length === 0) return;
1410
+ this.positions.pop(), this.lnglats.pop();
1411
+ const t = this.tempPoints.pop();
1412
+ t && this.viewer.entities.remove(t), this.syncEntity();
1413
+ }
1414
+ finishDrawing(t = !1) {
1415
+ var i, n, s;
1416
+ if (t && this.positions.length > 0) {
1417
+ this.positions.length = this.positions.length - 1, this.lnglats.length = this.lnglats.length - 1;
1418
+ const o = this.tempPoints.pop();
1419
+ o && this.viewer.entities.remove(o);
1420
+ }
1421
+ if (this.syncEntity(), this.stopDrawing(), (i = this.tooltip) == null || i.hide(), this.tooltip = null, this.positions.length < 3) return;
1422
+ const e = {
1423
+ entity: this.entity,
1424
+ positions: this.positions,
1425
+ lnglats: this.lnglats.slice(),
1426
+ clear: () => {
1427
+ this.clear();
1428
+ }
1429
+ };
1430
+ (s = (n = this.options) == null ? void 0 : n.onComplete) == null || s.call(n, e);
1431
+ }
1432
+ bindKeyboardEvents() {
1433
+ this.unbindKeyboardEvents(), this.keydownHandler = (t) => {
1434
+ t.key === "Escape" && (t.preventDefault(), this.finishDrawing(!1));
1435
+ }, document.addEventListener("keydown", this.keydownHandler);
1436
+ }
1437
+ unbindKeyboardEvents() {
1438
+ this.keydownHandler && (document.removeEventListener("keydown", this.keydownHandler), this.keydownHandler = null);
1439
+ }
1368
1440
  startDrawing(t) {
1369
1441
  const { Cesium: e, viewer: i } = this;
1370
- this.positions = [], this.lnglats = [], this.tempPoints = [], this.entity = null, this.tooltip = new ze(), this.tooltip.show("单击左键添加点,双击左键结束"), this.handler = new e.ScreenSpaceEventHandler(i.canvas), this.handler.setInputAction((n) => {
1442
+ this.options = t, this.positions = [], this.lnglats = [], this.tempPoints = [], this.entity = null, this.tooltip = new ye(), this.tooltip.show("单击左键添加点,右键撤销,双击左键或 Esc 结束"), this.handler = new e.ScreenSpaceEventHandler(i.canvas), this.bindKeyboardEvents(), this.handler.setInputAction((n) => {
1371
1443
  const s = this.getPickPosition(n.position);
1372
1444
  if (!s) return;
1373
1445
  this.positions.push(s);
@@ -1397,54 +1469,45 @@ class Vt {
1397
1469
  }
1398
1470
  }), this.entity._drawHelper = !0);
1399
1471
  }, e.ScreenSpaceEventType.LEFT_CLICK), this.handler.setInputAction(() => {
1400
- var o, r;
1401
- if (this.stopDrawing(), (o = this.tooltip) == null || o.hide(), this.tooltip = null, this.positions.length < 3) return;
1402
- this.positions.length = this.positions.length - 1, this.lnglats.length = this.lnglats.length - 1;
1403
- const n = this.lnglats.slice(), s = {
1404
- entity: this.entity,
1405
- positions: this.positions,
1406
- lnglats: n,
1407
- clear: () => {
1408
- this.clear();
1409
- }
1410
- };
1411
- (r = t.onComplete) == null || r.call(t, s);
1472
+ this.undoLastPoint();
1473
+ }, e.ScreenSpaceEventType.RIGHT_CLICK), this.handler.setInputAction(() => {
1474
+ this.finishDrawing(!0);
1412
1475
  }, e.ScreenSpaceEventType.LEFT_DOUBLE_CLICK);
1413
1476
  }
1414
1477
  stopDrawing() {
1415
1478
  var t;
1416
- (t = this.handler) == null || t.destroy(), this.handler = null;
1479
+ this.unbindKeyboardEvents(), (t = this.handler) == null || t.destroy(), this.handler = null;
1417
1480
  }
1418
1481
  clear() {
1419
1482
  var e;
1420
1483
  const { viewer: t } = this;
1421
- this.entity && (t.entities.remove(this.entity), this.entity = null), this.tempPoints.forEach((i) => t.entities.remove(i)), this.tempPoints = [], (e = this.tooltip) == null || e.hide(), this.tooltip = null, this.positions = [], this.lnglats = [], this.stopDrawing();
1484
+ this.entity && (t.entities.remove(this.entity), this.entity = null), this.tempPoints.forEach((i) => t.entities.remove(i)), this.tempPoints = [], (e = this.tooltip) == null || e.hide(), this.tooltip = null, this.positions = [], this.lnglats = [], this.options = null, this.stopDrawing();
1422
1485
  }
1423
1486
  }
1424
- class Mn {
1487
+ class xo {
1425
1488
  constructor(t, e) {
1426
- h(this, "viewer");
1427
- h(this, "Cesium");
1428
- h(this, "activeDrawer", null);
1489
+ l(this, "viewer");
1490
+ l(this, "Cesium");
1491
+ l(this, "activeDrawer", null);
1429
1492
  this.viewer = e, this.Cesium = t;
1430
1493
  }
1431
1494
  draw(t, e) {
1432
1495
  var i;
1433
1496
  switch (this.clear(), t) {
1434
1497
  case "point":
1435
- this.activeDrawer = new Gt(this.Cesium, this.viewer);
1498
+ this.activeDrawer = new Yt(this.Cesium, this.viewer);
1436
1499
  break;
1437
1500
  case "line":
1438
- this.activeDrawer = new Bt(this.Cesium, this.viewer);
1501
+ this.activeDrawer = new Vt(this.Cesium, this.viewer);
1439
1502
  break;
1440
1503
  case "rectangle":
1441
- this.activeDrawer = new jt(this.Cesium, this.viewer);
1504
+ this.activeDrawer = new Wt(this.Cesium, this.viewer);
1442
1505
  break;
1443
1506
  case "circle":
1444
- this.activeDrawer = new Yt(this.Cesium, this.viewer);
1507
+ this.activeDrawer = new Ut(this.Cesium, this.viewer);
1445
1508
  break;
1446
1509
  case "polygon":
1447
- this.activeDrawer = new Vt(this.Cesium, this.viewer);
1510
+ this.activeDrawer = new Kt(this.Cesium, this.viewer);
1448
1511
  break;
1449
1512
  default:
1450
1513
  throw new Error(`Unsupported draw type: ${t}`);
@@ -1458,52 +1521,52 @@ class Mn {
1458
1521
  this.clear();
1459
1522
  }
1460
1523
  }
1461
- var Ct = typeof global == "object" && global && global.Object === Object && global, Wt = typeof self == "object" && self && self.Object === Object && self, ie = Ct || Wt || Function("return this")(), ge = ie.Symbol, bt = Object.prototype, Ut = bt.hasOwnProperty, qt = bt.toString, Ce = ge ? ge.toStringTag : void 0;
1462
- function Kt(a) {
1463
- var t = Ut.call(a, Ce), e = a[Ce];
1524
+ var Lt = typeof global == "object" && global && global.Object === Object && global, qt = typeof self == "object" && self && self.Object === Object && self, ie = Lt || qt || Function("return this")(), ge = ie.Symbol, Et = Object.prototype, Xt = Et.hasOwnProperty, Jt = Et.toString, be = ge ? ge.toStringTag : void 0;
1525
+ function Zt(a) {
1526
+ var t = Xt.call(a, be), e = a[be];
1464
1527
  try {
1465
- a[Ce] = void 0;
1528
+ a[be] = void 0;
1466
1529
  var i = !0;
1467
1530
  } catch {
1468
1531
  }
1469
- var n = qt.call(a);
1470
- return i && (t ? a[Ce] = e : delete a[Ce]), n;
1471
- }
1472
- var Xt = Object.prototype, Jt = Xt.toString;
1473
- function Zt(a) {
1474
- return Jt.call(a);
1532
+ var n = Jt.call(a);
1533
+ return i && (t ? a[be] = e : delete a[be]), n;
1475
1534
  }
1476
- var Qt = "[object Null]", ei = "[object Undefined]", Be = ge ? ge.toStringTag : void 0;
1477
- function Ee(a) {
1478
- return a == null ? a === void 0 ? ei : Qt : Be && Be in Object(a) ? Kt(a) : Zt(a);
1535
+ var Qt = Object.prototype, ei = Qt.toString;
1536
+ function ti(a) {
1537
+ return ei.call(a);
1479
1538
  }
1539
+ var ii = "[object Null]", si = "[object Undefined]", Ke = ge ? ge.toStringTag : void 0;
1480
1540
  function Me(a) {
1541
+ return a == null ? a === void 0 ? si : ii : Ke && Ke in Object(a) ? Zt(a) : ti(a);
1542
+ }
1543
+ function Ie(a) {
1481
1544
  return a != null && typeof a == "object";
1482
1545
  }
1483
- var _e = Array.isArray;
1484
- function De(a) {
1546
+ var He = Array.isArray;
1547
+ function Fe(a) {
1485
1548
  var t = typeof a;
1486
1549
  return a != null && (t == "object" || t == "function");
1487
1550
  }
1488
- var ti = "[object AsyncFunction]", ii = "[object Function]", si = "[object GeneratorFunction]", oi = "[object Proxy]";
1489
- function Pt(a) {
1490
- if (!De(a))
1551
+ var ni = "[object AsyncFunction]", oi = "[object Function]", ri = "[object GeneratorFunction]", ai = "[object Proxy]";
1552
+ function Mt(a) {
1553
+ if (!Fe(a))
1491
1554
  return !1;
1492
- var t = Ee(a);
1493
- return t == ii || t == si || t == ti || t == oi;
1555
+ var t = Me(a);
1556
+ return t == oi || t == ri || t == ni || t == ai;
1494
1557
  }
1495
- var $e = ie["__core-js_shared__"], je = (function() {
1496
- var a = /[^.]+$/.exec($e && $e.keys && $e.keys.IE_PROTO || "");
1558
+ var Ne = ie["__core-js_shared__"], qe = (function() {
1559
+ var a = /[^.]+$/.exec(Ne && Ne.keys && Ne.keys.IE_PROTO || "");
1497
1560
  return a ? "Symbol(src)_1." + a : "";
1498
1561
  })();
1499
- function ni(a) {
1500
- return !!je && je in a;
1562
+ function li(a) {
1563
+ return !!qe && qe in a;
1501
1564
  }
1502
- var ri = Function.prototype, ai = ri.toString;
1565
+ var hi = Function.prototype, ci = hi.toString;
1503
1566
  function ce(a) {
1504
1567
  if (a != null) {
1505
1568
  try {
1506
- return ai.call(a);
1569
+ return ci.call(a);
1507
1570
  } catch {
1508
1571
  }
1509
1572
  try {
@@ -1513,167 +1576,167 @@ function ce(a) {
1513
1576
  }
1514
1577
  return "";
1515
1578
  }
1516
- var li = /[\\^$.*+?()[\]{}|]/g, hi = /^\[object .+?Constructor\]$/, ci = Function.prototype, di = Object.prototype, pi = ci.toString, ui = di.hasOwnProperty, mi = RegExp(
1517
- "^" + pi.call(ui).replace(li, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
1579
+ var di = /[\\^$.*+?()[\]{}|]/g, pi = /^\[object .+?Constructor\]$/, ui = Function.prototype, mi = Object.prototype, gi = ui.toString, fi = mi.hasOwnProperty, yi = RegExp(
1580
+ "^" + gi.call(fi).replace(di, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
1518
1581
  );
1519
- function gi(a) {
1520
- if (!De(a) || ni(a))
1582
+ function wi(a) {
1583
+ if (!Fe(a) || li(a))
1521
1584
  return !1;
1522
- var t = Pt(a) ? mi : hi;
1585
+ var t = Mt(a) ? yi : pi;
1523
1586
  return t.test(ce(a));
1524
1587
  }
1525
- function fi(a, t) {
1588
+ function vi(a, t) {
1526
1589
  return a == null ? void 0 : a[t];
1527
1590
  }
1528
1591
  function de(a, t) {
1529
- var e = fi(a, t);
1530
- return gi(e) ? e : void 0;
1592
+ var e = vi(a, t);
1593
+ return wi(e) ? e : void 0;
1531
1594
  }
1532
- var ke = de(ie, "WeakMap"), Ye = Object.create, yi = /* @__PURE__ */ (function() {
1595
+ var Be = de(ie, "WeakMap"), Xe = Object.create, Ci = /* @__PURE__ */ (function() {
1533
1596
  function a() {
1534
1597
  }
1535
1598
  return function(t) {
1536
- if (!De(t))
1599
+ if (!Fe(t))
1537
1600
  return {};
1538
- if (Ye)
1539
- return Ye(t);
1601
+ if (Xe)
1602
+ return Xe(t);
1540
1603
  a.prototype = t;
1541
1604
  var e = new a();
1542
1605
  return a.prototype = void 0, e;
1543
1606
  };
1544
- })(), Ve = (function() {
1607
+ })(), Je = (function() {
1545
1608
  try {
1546
1609
  var a = de(Object, "defineProperty");
1547
1610
  return a({}, "", {}), a;
1548
1611
  } catch {
1549
1612
  }
1550
1613
  })();
1551
- function wi(a, t) {
1614
+ function bi(a, t) {
1552
1615
  for (var e = -1, i = a == null ? 0 : a.length; ++e < i && t(a[e], e, a) !== !1; )
1553
1616
  ;
1554
1617
  return a;
1555
1618
  }
1556
- var vi = 9007199254740991, Ci = /^(?:0|[1-9]\d*)$/;
1557
- function bi(a, t) {
1619
+ var Pi = 9007199254740991, Li = /^(?:0|[1-9]\d*)$/;
1620
+ function Ei(a, t) {
1558
1621
  var e = typeof a;
1559
- return t = t ?? vi, !!t && (e == "number" || e != "symbol" && Ci.test(a)) && a > -1 && a % 1 == 0 && a < t;
1622
+ return t = t ?? Pi, !!t && (e == "number" || e != "symbol" && Li.test(a)) && a > -1 && a % 1 == 0 && a < t;
1560
1623
  }
1561
- function Pi(a, t, e) {
1562
- t == "__proto__" && Ve ? Ve(a, t, {
1624
+ function Mi(a, t, e) {
1625
+ t == "__proto__" && Je ? Je(a, t, {
1563
1626
  configurable: !0,
1564
1627
  enumerable: !0,
1565
1628
  value: e,
1566
1629
  writable: !0
1567
1630
  }) : a[t] = e;
1568
1631
  }
1569
- function Lt(a, t) {
1632
+ function It(a, t) {
1570
1633
  return a === t || a !== a && t !== t;
1571
1634
  }
1572
- var Li = Object.prototype, Ei = Li.hasOwnProperty;
1573
- function Mi(a, t, e) {
1635
+ var Ii = Object.prototype, Ti = Ii.hasOwnProperty;
1636
+ function xi(a, t, e) {
1574
1637
  var i = a[t];
1575
- (!(Ei.call(a, t) && Lt(i, e)) || e === void 0 && !(t in a)) && Pi(a, t, e);
1638
+ (!(Ti.call(a, t) && It(i, e)) || e === void 0 && !(t in a)) && Mi(a, t, e);
1576
1639
  }
1577
- var Ii = 9007199254740991;
1578
- function Et(a) {
1579
- return typeof a == "number" && a > -1 && a % 1 == 0 && a <= Ii;
1640
+ var _i = 9007199254740991;
1641
+ function Tt(a) {
1642
+ return typeof a == "number" && a > -1 && a % 1 == 0 && a <= _i;
1580
1643
  }
1581
- function Ti(a) {
1582
- return a != null && Et(a.length) && !Pt(a);
1644
+ function Di(a) {
1645
+ return a != null && Tt(a.length) && !Mt(a);
1583
1646
  }
1584
- var xi = Object.prototype;
1585
- function Mt(a) {
1586
- var t = a && a.constructor, e = typeof t == "function" && t.prototype || xi;
1647
+ var Si = Object.prototype;
1648
+ function xt(a) {
1649
+ var t = a && a.constructor, e = typeof t == "function" && t.prototype || Si;
1587
1650
  return a === e;
1588
1651
  }
1589
- function _i(a, t) {
1652
+ function Ai(a, t) {
1590
1653
  for (var e = -1, i = Array(a); ++e < a; )
1591
1654
  i[e] = t(e);
1592
1655
  return i;
1593
1656
  }
1594
- var Di = "[object Arguments]";
1595
- function We(a) {
1596
- return Me(a) && Ee(a) == Di;
1657
+ var $i = "[object Arguments]";
1658
+ function Ze(a) {
1659
+ return Ie(a) && Me(a) == $i;
1597
1660
  }
1598
- var It = Object.prototype, Si = It.hasOwnProperty, Ai = It.propertyIsEnumerable, $i = We(/* @__PURE__ */ (function() {
1661
+ var _t = Object.prototype, ki = _t.hasOwnProperty, Oi = _t.propertyIsEnumerable, Hi = Ze(/* @__PURE__ */ (function() {
1599
1662
  return arguments;
1600
- })()) ? We : function(a) {
1601
- return Me(a) && Si.call(a, "callee") && !Ai.call(a, "callee");
1663
+ })()) ? Ze : function(a) {
1664
+ return Ie(a) && ki.call(a, "callee") && !Oi.call(a, "callee");
1602
1665
  };
1603
- function Oi() {
1666
+ function Fi() {
1604
1667
  return !1;
1605
1668
  }
1606
- var Tt = typeof exports == "object" && exports && !exports.nodeType && exports, Ue = Tt && typeof module == "object" && module && !module.nodeType && module, ki = Ue && Ue.exports === Tt, qe = ki ? ie.Buffer : void 0, Fi = qe ? qe.isBuffer : void 0, xt = Fi || Oi, Ri = "[object Arguments]", Hi = "[object Array]", zi = "[object Boolean]", Ni = "[object Date]", Gi = "[object Error]", Bi = "[object Function]", ji = "[object Map]", Yi = "[object Number]", Vi = "[object Object]", Wi = "[object RegExp]", Ui = "[object Set]", qi = "[object String]", Ki = "[object WeakMap]", Xi = "[object ArrayBuffer]", Ji = "[object DataView]", Zi = "[object Float32Array]", Qi = "[object Float64Array]", es = "[object Int8Array]", ts = "[object Int16Array]", is = "[object Int32Array]", ss = "[object Uint8Array]", os = "[object Uint8ClampedArray]", ns = "[object Uint16Array]", rs = "[object Uint32Array]", H = {};
1607
- H[Zi] = H[Qi] = H[es] = H[ts] = H[is] = H[ss] = H[os] = H[ns] = H[rs] = !0;
1608
- H[Ri] = H[Hi] = H[Xi] = H[zi] = H[Ji] = H[Ni] = H[Gi] = H[Bi] = H[ji] = H[Yi] = H[Vi] = H[Wi] = H[Ui] = H[qi] = H[Ki] = !1;
1609
- function as(a) {
1610
- return Me(a) && Et(a.length) && !!H[Ee(a)];
1669
+ var Dt = typeof exports == "object" && exports && !exports.nodeType && exports, Qe = Dt && typeof module == "object" && module && !module.nodeType && module, Ri = Qe && Qe.exports === Dt, et = Ri ? ie.Buffer : void 0, zi = et ? et.isBuffer : void 0, St = zi || Fi, Ni = "[object Arguments]", Gi = "[object Array]", Bi = "[object Boolean]", ji = "[object Date]", Yi = "[object Error]", Vi = "[object Function]", Wi = "[object Map]", Ui = "[object Number]", Ki = "[object Object]", qi = "[object RegExp]", Xi = "[object Set]", Ji = "[object String]", Zi = "[object WeakMap]", Qi = "[object ArrayBuffer]", es = "[object DataView]", ts = "[object Float32Array]", is = "[object Float64Array]", ss = "[object Int8Array]", ns = "[object Int16Array]", os = "[object Int32Array]", rs = "[object Uint8Array]", as = "[object Uint8ClampedArray]", ls = "[object Uint16Array]", hs = "[object Uint32Array]", R = {};
1670
+ R[ts] = R[is] = R[ss] = R[ns] = R[os] = R[rs] = R[as] = R[ls] = R[hs] = !0;
1671
+ R[Ni] = R[Gi] = R[Qi] = R[Bi] = R[es] = R[ji] = R[Yi] = R[Vi] = R[Wi] = R[Ui] = R[Ki] = R[qi] = R[Xi] = R[Ji] = R[Zi] = !1;
1672
+ function cs(a) {
1673
+ return Ie(a) && Tt(a.length) && !!R[Me(a)];
1611
1674
  }
1612
- function Ne(a) {
1675
+ function We(a) {
1613
1676
  return function(t) {
1614
1677
  return a(t);
1615
1678
  };
1616
1679
  }
1617
- var _t = typeof exports == "object" && exports && !exports.nodeType && exports, be = _t && typeof module == "object" && module && !module.nodeType && module, ls = be && be.exports === _t, Oe = ls && Ct.process, fe = (function() {
1680
+ var At = typeof exports == "object" && exports && !exports.nodeType && exports, Pe = At && typeof module == "object" && module && !module.nodeType && module, ds = Pe && Pe.exports === At, Ge = ds && Lt.process, fe = (function() {
1618
1681
  try {
1619
- var a = be && be.require && be.require("util").types;
1620
- return a || Oe && Oe.binding && Oe.binding("util");
1682
+ var a = Pe && Pe.require && Pe.require("util").types;
1683
+ return a || Ge && Ge.binding && Ge.binding("util");
1621
1684
  } catch {
1622
1685
  }
1623
- })(), Ke = fe && fe.isTypedArray, hs = Ke ? Ne(Ke) : as, cs = Object.prototype, ds = cs.hasOwnProperty;
1624
- function ps(a, t) {
1625
- var e = _e(a), i = !e && $i(a), n = !e && !i && xt(a), s = !e && !i && !n && hs(a), o = e || i || n || s, r = o ? _i(a.length, String) : [], l = r.length;
1686
+ })(), tt = fe && fe.isTypedArray, ps = tt ? We(tt) : cs, us = Object.prototype, ms = us.hasOwnProperty;
1687
+ function gs(a, t) {
1688
+ var e = He(a), i = !e && Hi(a), n = !e && !i && St(a), s = !e && !i && !n && ps(a), o = e || i || n || s, r = o ? Ai(a.length, String) : [], h = r.length;
1626
1689
  for (var c in a)
1627
- ds.call(a, c) && !(o && // Safari 9 has enumerable `arguments.length` in strict mode.
1690
+ ms.call(a, c) && !(o && // Safari 9 has enumerable `arguments.length` in strict mode.
1628
1691
  (c == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
1629
1692
  n && (c == "offset" || c == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
1630
1693
  s && (c == "buffer" || c == "byteLength" || c == "byteOffset") || // Skip index properties.
1631
- bi(c, l))) && r.push(c);
1694
+ Ei(c, h))) && r.push(c);
1632
1695
  return r;
1633
1696
  }
1634
- function Dt(a, t) {
1697
+ function $t(a, t) {
1635
1698
  return function(e) {
1636
1699
  return a(t(e));
1637
1700
  };
1638
1701
  }
1639
- var us = Dt(Object.keys, Object), ms = Object.prototype, gs = ms.hasOwnProperty;
1640
- function fs(a) {
1641
- if (!Mt(a))
1642
- return us(a);
1702
+ var fs = $t(Object.keys, Object), ys = Object.prototype, ws = ys.hasOwnProperty;
1703
+ function vs(a) {
1704
+ if (!xt(a))
1705
+ return fs(a);
1643
1706
  var t = [];
1644
1707
  for (var e in Object(a))
1645
- gs.call(a, e) && e != "constructor" && t.push(e);
1708
+ ws.call(a, e) && e != "constructor" && t.push(e);
1646
1709
  return t;
1647
1710
  }
1648
- function ys(a) {
1649
- return Ti(a) ? ps(a) : fs(a);
1711
+ function Cs(a) {
1712
+ return Di(a) ? gs(a) : vs(a);
1650
1713
  }
1651
- var Pe = de(Object, "create");
1652
- function ws() {
1653
- this.__data__ = Pe ? Pe(null) : {}, this.size = 0;
1714
+ var Le = de(Object, "create");
1715
+ function bs() {
1716
+ this.__data__ = Le ? Le(null) : {}, this.size = 0;
1654
1717
  }
1655
- function vs(a) {
1718
+ function Ps(a) {
1656
1719
  var t = this.has(a) && delete this.__data__[a];
1657
1720
  return this.size -= t ? 1 : 0, t;
1658
1721
  }
1659
- var Cs = "__lodash_hash_undefined__", bs = Object.prototype, Ps = bs.hasOwnProperty;
1660
- function Ls(a) {
1722
+ var Ls = "__lodash_hash_undefined__", Es = Object.prototype, Ms = Es.hasOwnProperty;
1723
+ function Is(a) {
1661
1724
  var t = this.__data__;
1662
- if (Pe) {
1725
+ if (Le) {
1663
1726
  var e = t[a];
1664
- return e === Cs ? void 0 : e;
1727
+ return e === Ls ? void 0 : e;
1665
1728
  }
1666
- return Ps.call(t, a) ? t[a] : void 0;
1729
+ return Ms.call(t, a) ? t[a] : void 0;
1667
1730
  }
1668
- var Es = Object.prototype, Ms = Es.hasOwnProperty;
1669
- function Is(a) {
1731
+ var Ts = Object.prototype, xs = Ts.hasOwnProperty;
1732
+ function _s(a) {
1670
1733
  var t = this.__data__;
1671
- return Pe ? t[a] !== void 0 : Ms.call(t, a);
1734
+ return Le ? t[a] !== void 0 : xs.call(t, a);
1672
1735
  }
1673
- var Ts = "__lodash_hash_undefined__";
1674
- function xs(a, t) {
1736
+ var Ds = "__lodash_hash_undefined__";
1737
+ function Ss(a, t) {
1675
1738
  var e = this.__data__;
1676
- return this.size += this.has(a) ? 0 : 1, e[a] = Pe && t === void 0 ? Ts : t, this;
1739
+ return this.size += this.has(a) ? 0 : 1, e[a] = Le && t === void 0 ? Ds : t, this;
1677
1740
  }
1678
1741
  function he(a) {
1679
1742
  var t = -1, e = a == null ? 0 : a.length;
@@ -1682,37 +1745,37 @@ function he(a) {
1682
1745
  this.set(i[0], i[1]);
1683
1746
  }
1684
1747
  }
1685
- he.prototype.clear = ws;
1686
- he.prototype.delete = vs;
1687
- he.prototype.get = Ls;
1688
- he.prototype.has = Is;
1689
- he.prototype.set = xs;
1690
- function _s() {
1748
+ he.prototype.clear = bs;
1749
+ he.prototype.delete = Ps;
1750
+ he.prototype.get = Is;
1751
+ he.prototype.has = _s;
1752
+ he.prototype.set = Ss;
1753
+ function As() {
1691
1754
  this.__data__ = [], this.size = 0;
1692
1755
  }
1693
- function Se(a, t) {
1756
+ function Re(a, t) {
1694
1757
  for (var e = a.length; e--; )
1695
- if (Lt(a[e][0], t))
1758
+ if (It(a[e][0], t))
1696
1759
  return e;
1697
1760
  return -1;
1698
1761
  }
1699
- var Ds = Array.prototype, Ss = Ds.splice;
1700
- function As(a) {
1701
- var t = this.__data__, e = Se(t, a);
1762
+ var $s = Array.prototype, ks = $s.splice;
1763
+ function Os(a) {
1764
+ var t = this.__data__, e = Re(t, a);
1702
1765
  if (e < 0)
1703
1766
  return !1;
1704
1767
  var i = t.length - 1;
1705
- return e == i ? t.pop() : Ss.call(t, e, 1), --this.size, !0;
1768
+ return e == i ? t.pop() : ks.call(t, e, 1), --this.size, !0;
1706
1769
  }
1707
- function $s(a) {
1708
- var t = this.__data__, e = Se(t, a);
1770
+ function Hs(a) {
1771
+ var t = this.__data__, e = Re(t, a);
1709
1772
  return e < 0 ? void 0 : t[e][1];
1710
1773
  }
1711
- function Os(a) {
1712
- return Se(this.__data__, a) > -1;
1774
+ function Fs(a) {
1775
+ return Re(this.__data__, a) > -1;
1713
1776
  }
1714
- function ks(a, t) {
1715
- var e = this.__data__, i = Se(e, a);
1777
+ function Rs(a, t) {
1778
+ var e = this.__data__, i = Re(e, a);
1716
1779
  return i < 0 ? (++this.size, e.push([a, t])) : e[i][1] = t, this;
1717
1780
  }
1718
1781
  function ae(a) {
@@ -1722,265 +1785,265 @@ function ae(a) {
1722
1785
  this.set(i[0], i[1]);
1723
1786
  }
1724
1787
  }
1725
- ae.prototype.clear = _s;
1726
- ae.prototype.delete = As;
1727
- ae.prototype.get = $s;
1728
- ae.prototype.has = Os;
1729
- ae.prototype.set = ks;
1730
- var Le = de(ie, "Map");
1731
- function Fs() {
1788
+ ae.prototype.clear = As;
1789
+ ae.prototype.delete = Os;
1790
+ ae.prototype.get = Hs;
1791
+ ae.prototype.has = Fs;
1792
+ ae.prototype.set = Rs;
1793
+ var Ee = de(ie, "Map");
1794
+ function zs() {
1732
1795
  this.size = 0, this.__data__ = {
1733
1796
  hash: new he(),
1734
- map: new (Le || ae)(),
1797
+ map: new (Ee || ae)(),
1735
1798
  string: new he()
1736
1799
  };
1737
1800
  }
1738
- function Rs(a) {
1801
+ function Ns(a) {
1739
1802
  var t = typeof a;
1740
1803
  return t == "string" || t == "number" || t == "symbol" || t == "boolean" ? a !== "__proto__" : a === null;
1741
1804
  }
1742
- function Ae(a, t) {
1805
+ function ze(a, t) {
1743
1806
  var e = a.__data__;
1744
- return Rs(t) ? e[typeof t == "string" ? "string" : "hash"] : e.map;
1807
+ return Ns(t) ? e[typeof t == "string" ? "string" : "hash"] : e.map;
1745
1808
  }
1746
- function Hs(a) {
1747
- var t = Ae(this, a).delete(a);
1809
+ function Gs(a) {
1810
+ var t = ze(this, a).delete(a);
1748
1811
  return this.size -= t ? 1 : 0, t;
1749
1812
  }
1750
- function zs(a) {
1751
- return Ae(this, a).get(a);
1813
+ function Bs(a) {
1814
+ return ze(this, a).get(a);
1752
1815
  }
1753
- function Ns(a) {
1754
- return Ae(this, a).has(a);
1816
+ function js(a) {
1817
+ return ze(this, a).has(a);
1755
1818
  }
1756
- function Gs(a, t) {
1757
- var e = Ae(this, a), i = e.size;
1819
+ function Ys(a, t) {
1820
+ var e = ze(this, a), i = e.size;
1758
1821
  return e.set(a, t), this.size += e.size == i ? 0 : 1, this;
1759
1822
  }
1760
- function ye(a) {
1823
+ function we(a) {
1761
1824
  var t = -1, e = a == null ? 0 : a.length;
1762
1825
  for (this.clear(); ++t < e; ) {
1763
1826
  var i = a[t];
1764
1827
  this.set(i[0], i[1]);
1765
1828
  }
1766
1829
  }
1767
- ye.prototype.clear = Fs;
1768
- ye.prototype.delete = Hs;
1769
- ye.prototype.get = zs;
1770
- ye.prototype.has = Ns;
1771
- ye.prototype.set = Gs;
1772
- function Bs(a, t) {
1830
+ we.prototype.clear = zs;
1831
+ we.prototype.delete = Gs;
1832
+ we.prototype.get = Bs;
1833
+ we.prototype.has = js;
1834
+ we.prototype.set = Ys;
1835
+ function Vs(a, t) {
1773
1836
  for (var e = -1, i = t.length, n = a.length; ++e < i; )
1774
1837
  a[n + e] = t[e];
1775
1838
  return a;
1776
1839
  }
1777
- var js = Dt(Object.getPrototypeOf, Object);
1778
- function Ys() {
1840
+ var Ws = $t(Object.getPrototypeOf, Object);
1841
+ function Us() {
1779
1842
  this.__data__ = new ae(), this.size = 0;
1780
1843
  }
1781
- function Vs(a) {
1844
+ function Ks(a) {
1782
1845
  var t = this.__data__, e = t.delete(a);
1783
1846
  return this.size = t.size, e;
1784
1847
  }
1785
- function Ws(a) {
1848
+ function qs(a) {
1786
1849
  return this.__data__.get(a);
1787
1850
  }
1788
- function Us(a) {
1851
+ function Xs(a) {
1789
1852
  return this.__data__.has(a);
1790
1853
  }
1791
- var qs = 200;
1792
- function Ks(a, t) {
1854
+ var Js = 200;
1855
+ function Zs(a, t) {
1793
1856
  var e = this.__data__;
1794
1857
  if (e instanceof ae) {
1795
1858
  var i = e.__data__;
1796
- if (!Le || i.length < qs - 1)
1859
+ if (!Ee || i.length < Js - 1)
1797
1860
  return i.push([a, t]), this.size = ++e.size, this;
1798
- e = this.__data__ = new ye(i);
1861
+ e = this.__data__ = new we(i);
1799
1862
  }
1800
1863
  return e.set(a, t), this.size = e.size, this;
1801
1864
  }
1802
- function we(a) {
1865
+ function ve(a) {
1803
1866
  var t = this.__data__ = new ae(a);
1804
1867
  this.size = t.size;
1805
1868
  }
1806
- we.prototype.clear = Ys;
1807
- we.prototype.delete = Vs;
1808
- we.prototype.get = Ws;
1809
- we.prototype.has = Us;
1810
- we.prototype.set = Ks;
1811
- var St = typeof exports == "object" && exports && !exports.nodeType && exports, Xe = St && typeof module == "object" && module && !module.nodeType && module, Xs = Xe && Xe.exports === St, Je = Xs ? ie.Buffer : void 0;
1812
- Je && Je.allocUnsafe;
1813
- function Js(a, t) {
1869
+ ve.prototype.clear = Us;
1870
+ ve.prototype.delete = Ks;
1871
+ ve.prototype.get = qs;
1872
+ ve.prototype.has = Xs;
1873
+ ve.prototype.set = Zs;
1874
+ var kt = typeof exports == "object" && exports && !exports.nodeType && exports, it = kt && typeof module == "object" && module && !module.nodeType && module, Qs = it && it.exports === kt, st = Qs ? ie.Buffer : void 0;
1875
+ st && st.allocUnsafe;
1876
+ function en(a, t) {
1814
1877
  return a.slice();
1815
1878
  }
1816
- function Zs(a, t) {
1879
+ function tn(a, t) {
1817
1880
  for (var e = -1, i = a == null ? 0 : a.length, n = 0, s = []; ++e < i; ) {
1818
1881
  var o = a[e];
1819
1882
  t(o, e, a) && (s[n++] = o);
1820
1883
  }
1821
1884
  return s;
1822
1885
  }
1823
- function Qs() {
1886
+ function sn() {
1824
1887
  return [];
1825
1888
  }
1826
- var eo = Object.prototype, to = eo.propertyIsEnumerable, Ze = Object.getOwnPropertySymbols, io = Ze ? function(a) {
1827
- return a == null ? [] : (a = Object(a), Zs(Ze(a), function(t) {
1828
- return to.call(a, t);
1889
+ var nn = Object.prototype, on = nn.propertyIsEnumerable, nt = Object.getOwnPropertySymbols, rn = nt ? function(a) {
1890
+ return a == null ? [] : (a = Object(a), tn(nt(a), function(t) {
1891
+ return on.call(a, t);
1829
1892
  }));
1830
- } : Qs;
1831
- function so(a, t, e) {
1893
+ } : sn;
1894
+ function an(a, t, e) {
1832
1895
  var i = t(a);
1833
- return _e(a) ? i : Bs(i, e(a));
1896
+ return He(a) ? i : Vs(i, e(a));
1834
1897
  }
1835
- function oo(a) {
1836
- return so(a, ys, io);
1898
+ function ln(a) {
1899
+ return an(a, Cs, rn);
1837
1900
  }
1838
- var Fe = de(ie, "DataView"), Re = de(ie, "Promise"), He = de(ie, "Set"), Qe = "[object Map]", no = "[object Object]", et = "[object Promise]", tt = "[object Set]", it = "[object WeakMap]", st = "[object DataView]", ro = ce(Fe), ao = ce(Le), lo = ce(Re), ho = ce(He), co = ce(ke), re = Ee;
1839
- (Fe && re(new Fe(new ArrayBuffer(1))) != st || Le && re(new Le()) != Qe || Re && re(Re.resolve()) != et || He && re(new He()) != tt || ke && re(new ke()) != it) && (re = function(a) {
1840
- var t = Ee(a), e = t == no ? a.constructor : void 0, i = e ? ce(e) : "";
1901
+ var je = de(ie, "DataView"), Ye = de(ie, "Promise"), Ve = de(ie, "Set"), ot = "[object Map]", hn = "[object Object]", rt = "[object Promise]", at = "[object Set]", lt = "[object WeakMap]", ht = "[object DataView]", cn = ce(je), dn = ce(Ee), pn = ce(Ye), un = ce(Ve), mn = ce(Be), re = Me;
1902
+ (je && re(new je(new ArrayBuffer(1))) != ht || Ee && re(new Ee()) != ot || Ye && re(Ye.resolve()) != rt || Ve && re(new Ve()) != at || Be && re(new Be()) != lt) && (re = function(a) {
1903
+ var t = Me(a), e = t == hn ? a.constructor : void 0, i = e ? ce(e) : "";
1841
1904
  if (i)
1842
1905
  switch (i) {
1843
- case ro:
1844
- return st;
1845
- case ao:
1846
- return Qe;
1847
- case lo:
1848
- return et;
1849
- case ho:
1850
- return tt;
1851
- case co:
1852
- return it;
1906
+ case cn:
1907
+ return ht;
1908
+ case dn:
1909
+ return ot;
1910
+ case pn:
1911
+ return rt;
1912
+ case un:
1913
+ return at;
1914
+ case mn:
1915
+ return lt;
1853
1916
  }
1854
1917
  return t;
1855
1918
  });
1856
- var po = Object.prototype, uo = po.hasOwnProperty;
1857
- function mo(a) {
1919
+ var gn = Object.prototype, fn = gn.hasOwnProperty;
1920
+ function yn(a) {
1858
1921
  var t = a.length, e = new a.constructor(t);
1859
- return t && typeof a[0] == "string" && uo.call(a, "index") && (e.index = a.index, e.input = a.input), e;
1922
+ return t && typeof a[0] == "string" && fn.call(a, "index") && (e.index = a.index, e.input = a.input), e;
1860
1923
  }
1861
- var ot = ie.Uint8Array;
1862
- function Ge(a) {
1924
+ var ct = ie.Uint8Array;
1925
+ function Ue(a) {
1863
1926
  var t = new a.constructor(a.byteLength);
1864
- return new ot(t).set(new ot(a)), t;
1927
+ return new ct(t).set(new ct(a)), t;
1865
1928
  }
1866
- function go(a, t) {
1867
- var e = Ge(a.buffer);
1929
+ function wn(a, t) {
1930
+ var e = Ue(a.buffer);
1868
1931
  return new a.constructor(e, a.byteOffset, a.byteLength);
1869
1932
  }
1870
- var fo = /\w*$/;
1871
- function yo(a) {
1872
- var t = new a.constructor(a.source, fo.exec(a));
1933
+ var vn = /\w*$/;
1934
+ function Cn(a) {
1935
+ var t = new a.constructor(a.source, vn.exec(a));
1873
1936
  return t.lastIndex = a.lastIndex, t;
1874
1937
  }
1875
- var nt = ge ? ge.prototype : void 0, rt = nt ? nt.valueOf : void 0;
1876
- function wo(a) {
1877
- return rt ? Object(rt.call(a)) : {};
1938
+ var dt = ge ? ge.prototype : void 0, pt = dt ? dt.valueOf : void 0;
1939
+ function bn(a) {
1940
+ return pt ? Object(pt.call(a)) : {};
1878
1941
  }
1879
- function vo(a, t) {
1880
- var e = Ge(a.buffer);
1942
+ function Pn(a, t) {
1943
+ var e = Ue(a.buffer);
1881
1944
  return new a.constructor(e, a.byteOffset, a.length);
1882
1945
  }
1883
- var Co = "[object Boolean]", bo = "[object Date]", Po = "[object Map]", Lo = "[object Number]", Eo = "[object RegExp]", Mo = "[object Set]", Io = "[object String]", To = "[object Symbol]", xo = "[object ArrayBuffer]", _o = "[object DataView]", Do = "[object Float32Array]", So = "[object Float64Array]", Ao = "[object Int8Array]", $o = "[object Int16Array]", Oo = "[object Int32Array]", ko = "[object Uint8Array]", Fo = "[object Uint8ClampedArray]", Ro = "[object Uint16Array]", Ho = "[object Uint32Array]";
1884
- function zo(a, t, e) {
1946
+ var Ln = "[object Boolean]", En = "[object Date]", Mn = "[object Map]", In = "[object Number]", Tn = "[object RegExp]", xn = "[object Set]", _n = "[object String]", Dn = "[object Symbol]", Sn = "[object ArrayBuffer]", An = "[object DataView]", $n = "[object Float32Array]", kn = "[object Float64Array]", On = "[object Int8Array]", Hn = "[object Int16Array]", Fn = "[object Int32Array]", Rn = "[object Uint8Array]", zn = "[object Uint8ClampedArray]", Nn = "[object Uint16Array]", Gn = "[object Uint32Array]";
1947
+ function Bn(a, t, e) {
1885
1948
  var i = a.constructor;
1886
1949
  switch (t) {
1887
- case xo:
1888
- return Ge(a);
1889
- case Co:
1890
- case bo:
1950
+ case Sn:
1951
+ return Ue(a);
1952
+ case Ln:
1953
+ case En:
1891
1954
  return new i(+a);
1892
- case _o:
1893
- return go(a);
1894
- case Do:
1895
- case So:
1896
- case Ao:
1897
- case $o:
1898
- case Oo:
1899
- case ko:
1900
- case Fo:
1901
- case Ro:
1902
- case Ho:
1903
- return vo(a);
1904
- case Po:
1955
+ case An:
1956
+ return wn(a);
1957
+ case $n:
1958
+ case kn:
1959
+ case On:
1960
+ case Hn:
1961
+ case Fn:
1962
+ case Rn:
1963
+ case zn:
1964
+ case Nn:
1965
+ case Gn:
1966
+ return Pn(a);
1967
+ case Mn:
1905
1968
  return new i();
1906
- case Lo:
1907
- case Io:
1969
+ case In:
1970
+ case _n:
1908
1971
  return new i(a);
1909
- case Eo:
1910
- return yo(a);
1911
- case Mo:
1972
+ case Tn:
1973
+ return Cn(a);
1974
+ case xn:
1912
1975
  return new i();
1913
- case To:
1914
- return wo(a);
1976
+ case Dn:
1977
+ return bn(a);
1915
1978
  }
1916
1979
  }
1917
- function No(a) {
1918
- return typeof a.constructor == "function" && !Mt(a) ? yi(js(a)) : {};
1980
+ function jn(a) {
1981
+ return typeof a.constructor == "function" && !xt(a) ? Ci(Ws(a)) : {};
1919
1982
  }
1920
- var Go = "[object Map]";
1921
- function Bo(a) {
1922
- return Me(a) && re(a) == Go;
1983
+ var Yn = "[object Map]";
1984
+ function Vn(a) {
1985
+ return Ie(a) && re(a) == Yn;
1923
1986
  }
1924
- var at = fe && fe.isMap, jo = at ? Ne(at) : Bo, Yo = "[object Set]";
1925
- function Vo(a) {
1926
- return Me(a) && re(a) == Yo;
1987
+ var ut = fe && fe.isMap, Wn = ut ? We(ut) : Vn, Un = "[object Set]";
1988
+ function Kn(a) {
1989
+ return Ie(a) && re(a) == Un;
1927
1990
  }
1928
- var lt = fe && fe.isSet, Wo = lt ? Ne(lt) : Vo, At = "[object Arguments]", Uo = "[object Array]", qo = "[object Boolean]", Ko = "[object Date]", Xo = "[object Error]", $t = "[object Function]", Jo = "[object GeneratorFunction]", Zo = "[object Map]", Qo = "[object Number]", Ot = "[object Object]", en = "[object RegExp]", tn = "[object Set]", sn = "[object String]", on = "[object Symbol]", nn = "[object WeakMap]", rn = "[object ArrayBuffer]", an = "[object DataView]", ln = "[object Float32Array]", hn = "[object Float64Array]", cn = "[object Int8Array]", dn = "[object Int16Array]", pn = "[object Int32Array]", un = "[object Uint8Array]", mn = "[object Uint8ClampedArray]", gn = "[object Uint16Array]", fn = "[object Uint32Array]", R = {};
1929
- R[At] = R[Uo] = R[rn] = R[an] = R[qo] = R[Ko] = R[ln] = R[hn] = R[cn] = R[dn] = R[pn] = R[Zo] = R[Qo] = R[Ot] = R[en] = R[tn] = R[sn] = R[on] = R[un] = R[mn] = R[gn] = R[fn] = !0;
1930
- R[Xo] = R[$t] = R[nn] = !1;
1931
- function xe(a, t, e, i, n, s) {
1991
+ var mt = fe && fe.isSet, qn = mt ? We(mt) : Kn, Ot = "[object Arguments]", Xn = "[object Array]", Jn = "[object Boolean]", Zn = "[object Date]", Qn = "[object Error]", Ht = "[object Function]", eo = "[object GeneratorFunction]", to = "[object Map]", io = "[object Number]", Ft = "[object Object]", so = "[object RegExp]", no = "[object Set]", oo = "[object String]", ro = "[object Symbol]", ao = "[object WeakMap]", lo = "[object ArrayBuffer]", ho = "[object DataView]", co = "[object Float32Array]", po = "[object Float64Array]", uo = "[object Int8Array]", mo = "[object Int16Array]", go = "[object Int32Array]", fo = "[object Uint8Array]", yo = "[object Uint8ClampedArray]", wo = "[object Uint16Array]", vo = "[object Uint32Array]", F = {};
1992
+ F[Ot] = F[Xn] = F[lo] = F[ho] = F[Jn] = F[Zn] = F[co] = F[po] = F[uo] = F[mo] = F[go] = F[to] = F[io] = F[Ft] = F[so] = F[no] = F[oo] = F[ro] = F[fo] = F[yo] = F[wo] = F[vo] = !0;
1993
+ F[Qn] = F[Ht] = F[ao] = !1;
1994
+ function _e(a, t, e, i, n, s) {
1932
1995
  var o;
1933
1996
  if (o !== void 0)
1934
1997
  return o;
1935
- if (!De(a))
1998
+ if (!Fe(a))
1936
1999
  return a;
1937
- var r = _e(a);
2000
+ var r = He(a);
1938
2001
  if (r)
1939
- o = mo(a);
2002
+ o = yn(a);
1940
2003
  else {
1941
- var l = re(a), c = l == $t || l == Jo;
1942
- if (xt(a))
1943
- return Js(a);
1944
- if (l == Ot || l == At || c && !n)
1945
- o = c ? {} : No(a);
2004
+ var h = re(a), c = h == Ht || h == eo;
2005
+ if (St(a))
2006
+ return en(a);
2007
+ if (h == Ft || h == Ot || c && !n)
2008
+ o = c ? {} : jn(a);
1946
2009
  else {
1947
- if (!R[l])
2010
+ if (!F[h])
1948
2011
  return n ? a : {};
1949
- o = zo(a, l);
2012
+ o = Bn(a, h);
1950
2013
  }
1951
2014
  }
1952
- s || (s = new we());
2015
+ s || (s = new ve());
1953
2016
  var d = s.get(a);
1954
2017
  if (d)
1955
2018
  return d;
1956
- s.set(a, o), Wo(a) ? a.forEach(function(g) {
1957
- o.add(xe(g, t, e, g, a, s));
1958
- }) : jo(a) && a.forEach(function(g, p) {
1959
- o.set(p, xe(g, t, e, p, a, s));
2019
+ s.set(a, o), qn(a) ? a.forEach(function(g) {
2020
+ o.add(_e(g, t, e, g, a, s));
2021
+ }) : Wn(a) && a.forEach(function(g, p) {
2022
+ o.set(p, _e(g, t, e, p, a, s));
1960
2023
  });
1961
- var u = oo, m = r ? void 0 : u(a);
1962
- return wi(m || a, function(g, p) {
1963
- m && (p = g, g = a[p]), Mi(o, p, xe(g, t, e, p, a, s));
2024
+ var u = ln, m = r ? void 0 : u(a);
2025
+ return bi(m || a, function(g, p) {
2026
+ m && (p = g, g = a[p]), xi(o, p, _e(g, t, e, p, a, s));
1964
2027
  }), o;
1965
2028
  }
1966
- var yn = 1, wn = 4;
1967
- function Te(a) {
1968
- return xe(a, yn | wn);
2029
+ var Co = 1, bo = 4;
2030
+ function xe(a) {
2031
+ return _e(a, Co | bo);
1969
2032
  }
1970
- var vn = /* @__PURE__ */ ((a) => (a.Rotate = "rotate", a.Move = "move", a.Scale = "scale", a.MoveHeight = "moveHeight", a.Empty = "", a))(vn || {}), Cn = /* @__PURE__ */ ((a) => (a.Scale = "addScale", a.Rotate = "rotate", a.Translation = "translation", a.Remove = "removeById", a.Add = "add", a))(Cn || {});
1971
- class In {
2033
+ var Po = /* @__PURE__ */ ((a) => (a.Rotate = "rotate", a.Move = "move", a.Scale = "scale", a.MoveHeight = "moveHeight", a.Empty = "", a))(Po || {}), Lo = /* @__PURE__ */ ((a) => (a.Scale = "addScale", a.Rotate = "rotate", a.Translation = "translation", a.Remove = "removeById", a.Add = "add", a))(Lo || {});
2034
+ class _o {
1972
2035
  constructor(t) {
1973
- h(this, "primitives", /* @__PURE__ */ new Map());
1974
- h(this, "eventListener", /* @__PURE__ */ new Map());
1975
- h(this, "Cesium");
1976
- h(this, "viewer");
1977
- h(this, "handler");
1978
- h(this, "rotationRing");
1979
- h(this, "translationSquare");
1980
- h(this, "heightArrow");
1981
- h(this, "editMode", "");
2036
+ l(this, "primitives", /* @__PURE__ */ new Map());
2037
+ l(this, "eventListener", /* @__PURE__ */ new Map());
2038
+ l(this, "Cesium");
2039
+ l(this, "viewer");
2040
+ l(this, "handler");
2041
+ l(this, "rotationRing");
2042
+ l(this, "translationSquare");
2043
+ l(this, "heightArrow");
2044
+ l(this, "editMode", "");
1982
2045
  // 默认是移动模式
1983
- h(this, "dragEndCallbackMap", /* @__PURE__ */ new Map());
2046
+ l(this, "dragEndCallbackMap", /* @__PURE__ */ new Map());
1984
2047
  this.Cesium = t.Cesium, this.viewer = t.viewer, this.handler = new this.Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas);
1985
2048
  }
1986
2049
  /**
@@ -2006,9 +2069,9 @@ class In {
2006
2069
  */
2007
2070
  add(t, e = !0) {
2008
2071
  var u, m, g;
2009
- const i = this.viewer, n = this.Cesium, s = n.Math.toRadians(((u = t.headingPitchRoll) == null ? void 0 : u.heading) || 0), o = n.Math.toRadians(((m = t.headingPitchRoll) == null ? void 0 : m.pitch) || 0), r = n.Math.toRadians(((g = t.headingPitchRoll) == null ? void 0 : g.roll) || 0), l = new n.HeadingPitchRoll(s, o, r), c = n.Transforms.headingPitchRollToFixedFrame(
2072
+ const i = this.viewer, n = this.Cesium, s = n.Math.toRadians(((u = t.headingPitchRoll) == null ? void 0 : u.heading) || 0), o = n.Math.toRadians(((m = t.headingPitchRoll) == null ? void 0 : m.pitch) || 0), r = n.Math.toRadians(((g = t.headingPitchRoll) == null ? void 0 : g.roll) || 0), h = new n.HeadingPitchRoll(s, o, r), c = n.Transforms.headingPitchRollToFixedFrame(
2010
2073
  t.position,
2011
- l,
2074
+ h,
2012
2075
  i.scene.globe.ellipsoid,
2013
2076
  n.Transforms.eastNorthUpToFixedFrame,
2014
2077
  new n.Matrix4()
@@ -2164,9 +2227,9 @@ class In {
2164
2227
  */
2165
2228
  initEditBox(t) {
2166
2229
  const e = this.Cesium, i = this.viewer, n = i.scene;
2167
- let s = null, o = null, r = null, l = null, c = null;
2230
+ let s = null, o = null, r = null, h = null, c = null;
2168
2231
  const d = () => {
2169
- s = null, o = null, r = null, c = null, l = null, this.setEditMode(
2232
+ s = null, o = null, r = null, c = null, h = null, this.setEditMode(
2170
2233
  ""
2171
2234
  /* Empty */
2172
2235
  ), this.unlockCamera();
@@ -2179,7 +2242,7 @@ class In {
2179
2242
  );
2180
2243
  r = this.toCartographic(p), c = g.position;
2181
2244
  const f = n.globe.pick(i.camera.getPickRay(g.position), n);
2182
- l = this.toCartographic(f), this.lockCamera();
2245
+ h = this.toCartographic(f), this.lockCamera();
2183
2246
  }
2184
2247
  };
2185
2248
  this.handler.setInputAction((m) => {
@@ -2221,7 +2284,7 @@ class In {
2221
2284
  let w = 0;
2222
2285
  if (this.editMode === "rotate") {
2223
2286
  let y = this.calculateHeading(r, f);
2224
- w = this.calculateHeading(r, l) - y, this.rotateModel(s, o, w);
2287
+ w = this.calculateHeading(r, h) - y, this.rotateModel(s, o, w);
2225
2288
  } else this.editMode === "move" ? this.moveModel(s, o, m) : this.editMode === "moveHeight" && this.moveModelHeight(s, o, m, c);
2226
2289
  }
2227
2290
  }, e.ScreenSpaceEventType.MOUSE_MOVE), this.handler.setInputAction(() => {
@@ -2257,7 +2320,7 @@ class In {
2257
2320
  this.rotationRing && i.scene.primitives.remove(this.rotationRing);
2258
2321
  const n = [];
2259
2322
  for (let r = 0; r <= 360; r += 3) {
2260
- const l = Math.sin(e.Math.toRadians(r)), c = Math.cos(e.Math.toRadians(r)), d = t.boundingSphere.radius * c, u = t.boundingSphere.radius * l;
2323
+ const h = Math.sin(e.Math.toRadians(r)), c = Math.cos(e.Math.toRadians(r)), d = t.boundingSphere.radius * c, u = t.boundingSphere.radius * h;
2261
2324
  n.push(new e.Cartesian3(d, u, 0));
2262
2325
  }
2263
2326
  const s = new e.PolylineGeometry({
@@ -2318,7 +2381,7 @@ class In {
2318
2381
  createHeightArrow(t) {
2319
2382
  const e = this.Cesium, i = this.viewer;
2320
2383
  this.heightArrow && i.scene.primitives.remove(this.heightArrow);
2321
- let n = e.Color.GREEN, s = Math.max(t.boundingSphere.radius * 0.025, 1), o = 2 * s, r = t.boundingSphere.radius + 50, l = r * 0.1;
2384
+ let n = e.Color.GREEN, s = Math.max(t.boundingSphere.radius * 0.025, 1), o = 2 * s, r = t.boundingSphere.radius + 50, h = r * 0.1;
2322
2385
  const c = Math.max(t.boundingSphere.radius * 0.2, 1), d = e.CylinderGeometry.createGeometry(
2323
2386
  new e.CylinderGeometry({
2324
2387
  length: r,
@@ -2327,7 +2390,7 @@ class In {
2327
2390
  })
2328
2391
  ), u = e.CylinderGeometry.createGeometry(
2329
2392
  new e.CylinderGeometry({
2330
- length: l,
2393
+ length: h,
2331
2394
  topRadius: 0,
2332
2395
  bottomRadius: o
2333
2396
  })
@@ -2361,7 +2424,7 @@ class In {
2361
2424
  translate(t, e) {
2362
2425
  let i = this.Cesium;
2363
2426
  const n = new i.Cartesian3();
2364
- _e(e) ? (n.x = e[0], n.y = e[1], n.z = e[2]) : i.Cartesian3.clone(e, n);
2427
+ He(e) ? (n.x = e[0], n.y = e[1], n.z = e[2]) : i.Cartesian3.clone(e, n);
2365
2428
  for (let s = 0; s < t.attributes.position.values.length; s += 3)
2366
2429
  t.attributes.position.values[s] += n.x, t.attributes.position.values[s + 1] += n.y, t.attributes.position.values[s + 2] += n.z;
2367
2430
  }
@@ -2383,10 +2446,10 @@ class In {
2383
2446
  moveModel(t, e, i) {
2384
2447
  const n = this.Cesium, s = this.viewer, o = s.scene, r = o.globe.pick(s.camera.getPickRay(i.endPosition), o);
2385
2448
  if (r) {
2386
- const l = n.Matrix4.getTranslation(
2449
+ const h = n.Matrix4.getTranslation(
2387
2450
  e,
2388
2451
  new n.Cartesian3()
2389
- ), c = n.Cartographic.fromCartesian(l), d = n.Cartographic.fromCartesian(r), u = new n.Cartographic(
2452
+ ), c = n.Cartographic.fromCartesian(h), d = n.Cartographic.fromCartesian(r), u = new n.Cartographic(
2390
2453
  d.longitude,
2391
2454
  d.latitude,
2392
2455
  c.height
@@ -2411,7 +2474,7 @@ class In {
2411
2474
  * @return {*}
2412
2475
  */
2413
2476
  moveModelHeight(t, e, i, n) {
2414
- const s = this.Cesium, o = this.viewer, r = o.scene, l = n.y - i.endPosition.y;
2477
+ const s = this.Cesium, o = this.viewer, r = o.scene, h = n.y - i.endPosition.y;
2415
2478
  if (r.globe.pick(o.camera.getPickRay(i.endPosition), r)) {
2416
2479
  const d = s.Matrix4.getTranslation(
2417
2480
  e,
@@ -2419,7 +2482,7 @@ class In {
2419
2482
  ), u = s.Cartographic.fromCartesian(d), m = new s.Cartographic(
2420
2483
  u.longitude,
2421
2484
  u.latitude,
2422
- u.height + l * 1e-3 * Math.max(o.camera.positionCartographic.height, 1)
2485
+ u.height + h * 1e-3 * Math.max(o.camera.positionCartographic.height, 1)
2423
2486
  ), g = s.Cartographic.toCartesian(m), p = s.Matrix4.getRotation(e, new s.Matrix3()), f = s.Matrix4.fromRotationTranslation(p, g);
2424
2487
  t.modelMatrix = f, this.updatedTool(f);
2425
2488
  let w = new s.Cartesian3(
@@ -2441,13 +2504,13 @@ class In {
2441
2504
  * @return {*}
2442
2505
  */
2443
2506
  rotateModel(t, e, i) {
2444
- const n = this.Cesium, s = this.viewer, o = this.getModelHeadingPitchRoll(e), r = o.heading + i, l = new n.HeadingPitchRoll(
2507
+ const n = this.Cesium, s = this.viewer, o = this.getModelHeadingPitchRoll(e), r = o.heading + i, h = new n.HeadingPitchRoll(
2445
2508
  r,
2446
2509
  o.pitch,
2447
2510
  o.roll
2448
2511
  ), c = n.Transforms.headingPitchRollToFixedFrame(
2449
2512
  n.Matrix4.getTranslation(t.modelMatrix, new n.Cartesian3()),
2450
- l,
2513
+ h,
2451
2514
  s.scene.globe.ellipsoid,
2452
2515
  n.Transforms.eastNorthUpToFixedFrame,
2453
2516
  new n.Matrix4()
@@ -2467,7 +2530,7 @@ class In {
2467
2530
  this.handler && (this.handler.destroy(), this.handler = null);
2468
2531
  }
2469
2532
  }
2470
- function Tn(a, t) {
2533
+ function Do(a, t) {
2471
2534
  const e = t.materialType || "DynamicImgMaterial" + Date.now() + Math.floor(Math.random() * 1e3);
2472
2535
  function i(s) {
2473
2536
  this._definitionChanged = new a.Event(), this._color = s.color, this._colorSubscription = void 0, this.color = s.color, this.duration = s.duration, this._time = Date.now();
@@ -2530,7 +2593,7 @@ function Tn(a, t) {
2530
2593
  }
2531
2594
  }), new i(t);
2532
2595
  }
2533
- function xn(a, t) {
2596
+ function So(a, t) {
2534
2597
  const e = t.MaterialType || "wallType" + (/* @__PURE__ */ new Date()).getTime() + parseInt(Math.random() * 1e3 + "");
2535
2598
  function i(s) {
2536
2599
  this._definitionChanged = new a.Event(), this._color = void 0, this._colorSubscription = void 0, this.color = s.color, this.duration = s.duration, this._time = (/* @__PURE__ */ new Date()).getTime();
@@ -2593,11 +2656,11 @@ function xn(a, t) {
2593
2656
  }
2594
2657
  }), new i(t);
2595
2658
  }
2596
- function _n(a, t) {
2597
- const e = a.Color, i = Object.defineProperties, n = a.Event, s = a.createPropertyDescriptor, o = a.Property, r = (u, m) => u === void 0 ? m : u, l = {};
2659
+ function Ao(a, t) {
2660
+ const e = a.Color, i = Object.defineProperties, n = a.Event, s = a.createPropertyDescriptor, o = a.Property, r = (u, m) => u === void 0 ? m : u, h = {};
2598
2661
  let c = t.materialType || "PolylineFlow" + Date.now() + Math.floor(Math.random() * 1e3);
2599
2662
  function d(u) {
2600
- u = r(u, l), this._definitionChanged = new n(), this._color = void 0, this._colorSubscription = void 0, this.color = u.color || e.fromBytes(0, 255, 255, 255), this._duration = void 0, this._durationSubscription = void 0, this.duration = r(u.duration, 45);
2663
+ u = r(u, h), this._definitionChanged = new n(), this._color = void 0, this._colorSubscription = void 0, this.color = u.color || e.fromBytes(0, 255, 255, 255), this._duration = void 0, this._durationSubscription = void 0, this.duration = r(u.duration, 45);
2601
2664
  }
2602
2665
  return i(d.prototype, {
2603
2666
  isConstant: {
@@ -2656,10 +2719,10 @@ function _n(a, t) {
2656
2719
  }
2657
2720
  }), new d(t);
2658
2721
  }
2659
- class Dn {
2722
+ class $o {
2660
2723
  constructor() {
2661
- h(this, "categoryMap", /* @__PURE__ */ new Map());
2662
- h(this, "CategoryGet", {});
2724
+ l(this, "categoryMap", /* @__PURE__ */ new Map());
2725
+ l(this, "CategoryGet", {});
2663
2726
  }
2664
2727
  registerCategoryGet(t, e) {
2665
2728
  if (!t) return console.warn("分类不能为空");
@@ -2753,14 +2816,14 @@ class Dn {
2753
2816
  return [...this.categoryMap.keys()];
2754
2817
  }
2755
2818
  }
2756
- class bn {
2819
+ class Eo {
2757
2820
  constructor(t) {
2758
- h(this, "id");
2759
- h(this, "entities", []);
2760
- h(this, "primitives", []);
2761
- h(this, "dataItem", {});
2762
- h(this, "aggregator");
2763
- h(this, "cardPool");
2821
+ l(this, "id");
2822
+ l(this, "entities", []);
2823
+ l(this, "primitives", []);
2824
+ l(this, "dataItem", {});
2825
+ l(this, "aggregator");
2826
+ l(this, "cardPool");
2764
2827
  const { id: e, entities: i = [], primitives: n = [], dataItem: s = {}, aggregator: o, cardPool: r } = t;
2765
2828
  this.id = e, this.entities = i, this.primitives = n, this.dataItem = s, this.aggregator = o, this.cardPool = r;
2766
2829
  }
@@ -2793,22 +2856,22 @@ class bn {
2793
2856
  }), this.primitives = [], e && this.aggregator && Array.isArray(this.dataItem.billboard) && this.aggregator.removePointsById([this.dataItem.id]), e && this.cardPool && this.dataItem.card && this.cardPool.removeByIds([this.dataItem.id]), this.dataItem.id;
2794
2857
  }
2795
2858
  }
2796
- class Pn {
2859
+ class Mo {
2797
2860
  constructor(t, e, i, n, s, o) {
2798
- h(this, "id");
2799
- h(this, "groupMap", /* @__PURE__ */ new Map());
2800
- h(this, "Cesium");
2801
- h(this, "viewer");
2802
- h(this, "materialManager");
2803
- h(this, "aggregator");
2804
- h(this, "cardPool");
2861
+ l(this, "id");
2862
+ l(this, "groupMap", /* @__PURE__ */ new Map());
2863
+ l(this, "Cesium");
2864
+ l(this, "viewer");
2865
+ l(this, "materialManager");
2866
+ l(this, "aggregator");
2867
+ l(this, "cardPool");
2805
2868
  this.id = t, this.Cesium = e, this.viewer = i, this.materialManager = n, this.aggregator = s, this.cardPool = o, this.aggregator.labelPool.eventBus.addListener(te.Click, {
2806
2869
  name: "BufferedHierarchicalAggregator_maker_click",
2807
- fn: (l, c) => {
2808
- this.cardPool.showByIds([l.data.id]);
2870
+ fn: (h, c) => {
2871
+ this.cardPool.showByIds([h.data.id]);
2809
2872
  }
2810
2873
  }), new e.ScreenSpaceEventHandler(i.scene.canvas).setInputAction(() => {
2811
- this.cardPool.hideFilter((l) => !l.initShow);
2874
+ this.cardPool.hideFilter((h) => !h.initShow);
2812
2875
  }, e.ScreenSpaceEventType.LEFT_CLICK);
2813
2876
  }
2814
2877
  /** ====== 下面是抽出的创建函数 ====== */
@@ -2839,7 +2902,7 @@ class Pn {
2839
2902
  }), n = (v, C = 0) => {
2840
2903
  const b = Number(v);
2841
2904
  return Number.isFinite(b) ? b : C;
2842
- }, s = t.positions.map((v) => n(v == null ? void 0 : v[2], 0)), o = n(t.minHeight, 0), r = n(t.maxHeight, 0), l = (v) => Array.isArray(v) && v.length === t.positions.length && v.every((C) => Math.abs(n(C, 0)) < 1e-6), c = s.some((v) => Math.abs(v) > 1e-6), m = (Array.isArray(t.minimumHeights) && t.minimumHeights.length === t.positions.length && !(l(t.minimumHeights) && c) ? t.minimumHeights.map((v) => n(v, 0)) : s).map((v) => v - o), f = (Array.isArray(t.maximumHeights) && t.maximumHeights.length === t.positions.length && !(l(t.maximumHeights) && c) ? t.maximumHeights.map((v) => n(v, 0)) : s).map((v) => v + r), w = t.positions.map(
2905
+ }, s = t.positions.map((v) => n(v == null ? void 0 : v[2], 0)), o = n(t.minHeight, 0), r = n(t.maxHeight, 0), h = (v) => Array.isArray(v) && v.length === t.positions.length && v.every((C) => Math.abs(n(C, 0)) < 1e-6), c = s.some((v) => Math.abs(v) > 1e-6), m = (Array.isArray(t.minimumHeights) && t.minimumHeights.length === t.positions.length && !(h(t.minimumHeights) && c) ? t.minimumHeights.map((v) => n(v, 0)) : s).map((v) => v - o), f = (Array.isArray(t.maximumHeights) && t.maximumHeights.length === t.positions.length && !(h(t.maximumHeights) && c) ? t.maximumHeights.map((v) => n(v, 0)) : s).map((v) => v + r), w = t.positions.map(
2843
2906
  (v) => this.Cesium.Cartesian3.fromDegrees(v[0], v[1], v[2] || 0)
2844
2907
  );
2845
2908
  let y = {
@@ -2866,12 +2929,12 @@ class Pn {
2866
2929
  let u = Array.isArray(d[0]) ? t.hierarchy.flat() : t.hole;
2867
2930
  return this.Cesium.Cartesian3.fromDegreesArrayHeights(u.flat());
2868
2931
  })) || [], r = new this.Cesium.PolygonHierarchy(s, o);
2869
- let l = {
2932
+ let h = {
2870
2933
  ...t
2871
2934
  };
2872
- return i && (l.material = i), this.viewer.entities.add({
2935
+ return i && (h.material = i), this.viewer.entities.add({
2873
2936
  polygon: {
2874
- ...l,
2937
+ ...h,
2875
2938
  hierarchy: r
2876
2939
  // 使用构建好的 PolygonHierarchy
2877
2940
  },
@@ -2912,19 +2975,19 @@ class Pn {
2912
2975
  const i = t.id || `${Date.now()}`;
2913
2976
  this.removeGroup(i);
2914
2977
  const n = [], s = t.show !== !1;
2915
- (t.polyline || []).forEach((l) => {
2916
- const c = this.createPolyline(l, s);
2978
+ (t.polyline || []).forEach((h) => {
2979
+ const c = this.createPolyline(h, s);
2917
2980
  c && n.push(c);
2918
- }), (t.wall || []).forEach((l) => {
2919
- const c = this.createWall(l, s);
2981
+ }), (t.wall || []).forEach((h) => {
2982
+ const c = this.createWall(h, s);
2920
2983
  c && n.push(c);
2921
- }), (t.polygon || []).forEach((l) => {
2922
- const c = this.createPolygon(l, s);
2984
+ }), (t.polygon || []).forEach((h) => {
2985
+ const c = this.createPolygon(h, s);
2923
2986
  c && n.push(c);
2924
2987
  });
2925
2988
  const o = this.createBillboardPoints(t);
2926
2989
  o.length && e && this.aggregator.appendPoints(o, !1), this.createCard(t);
2927
- const r = new bn({
2990
+ const r = new Eo({
2928
2991
  id: i,
2929
2992
  entities: n,
2930
2993
  primitives: [],
@@ -2973,20 +3036,20 @@ class Pn {
2973
3036
  this.groupMap.forEach((t) => t.removeAll(this.viewer)), this.groupMap.clear();
2974
3037
  }
2975
3038
  }
2976
- class Sn {
3039
+ class ko {
2977
3040
  constructor(t, e, i, n, s) {
2978
- h(this, "Cesium");
2979
- h(this, "viewer");
2980
- h(this, "layerMap", /* @__PURE__ */ new Map());
2981
- h(this, "materialManager");
2982
- h(this, "aggregator");
2983
- h(this, "cardPool");
3041
+ l(this, "Cesium");
3042
+ l(this, "viewer");
3043
+ l(this, "layerMap", /* @__PURE__ */ new Map());
3044
+ l(this, "materialManager");
3045
+ l(this, "aggregator");
3046
+ l(this, "cardPool");
2984
3047
  this.Cesium = t, this.viewer = e, this.materialManager = i, this.aggregator = n, this.cardPool = s;
2985
3048
  }
2986
3049
  addLayer(t) {
2987
3050
  this.layerMap.has(t) || this.layerMap.set(
2988
3051
  t,
2989
- new Pn(
3052
+ new Mo(
2990
3053
  t,
2991
3054
  this.Cesium,
2992
3055
  this.viewer,
@@ -3024,7 +3087,7 @@ class Sn {
3024
3087
  (i = this.layerMap.get(t)) == null || i.removeGroups(e);
3025
3088
  }
3026
3089
  }
3027
- function An(a) {
3090
+ function Oo(a) {
3028
3091
  const t = [];
3029
3092
  return a.features.forEach((e, i) => {
3030
3093
  if (e.geometry && e.properties) {
@@ -3101,17 +3164,17 @@ function An(a) {
3101
3164
  }
3102
3165
  }), t;
3103
3166
  }
3104
- class $n {
3167
+ class Ho {
3105
3168
  constructor(t) {
3106
- h(this, "Cesium");
3107
- h(this, "viewer");
3169
+ l(this, "Cesium");
3170
+ l(this, "viewer");
3108
3171
  // Cesium.Viewer
3109
- h(this, "layerMap");
3110
- h(this, "hideLayerMap");
3111
- h(this, "entityLayerManager");
3112
- h(this, "PrimitiveThemeMap");
3172
+ l(this, "layerMap");
3173
+ l(this, "hideLayerMap");
3174
+ l(this, "entityLayerManager");
3175
+ l(this, "PrimitiveThemeMap");
3113
3176
  // theme -> 合并后的 Primitive 和图元 ID 的映射
3114
- h(this, "materialManager");
3177
+ l(this, "materialManager");
3115
3178
  let { Cesium: e, viewer: i, materialManager: n, entityLayerManager: s } = t;
3116
3179
  this.Cesium = e, this.viewer = i, this.layerMap = /* @__PURE__ */ new Map(), this.PrimitiveThemeMap = /* @__PURE__ */ new Map(), this.hideLayerMap = /* @__PURE__ */ new Map(), this.materialManager = n, this.entityLayerManager = s;
3117
3180
  }
@@ -3122,7 +3185,7 @@ class $n {
3122
3185
  }
3123
3186
  // 创建或获取 材质图元组
3124
3187
  carateThemePrimitive(t) {
3125
- let e = Te(t), i = this.PrimitiveThemeMap.get(e.theme);
3188
+ let e = xe(t), i = this.PrimitiveThemeMap.get(e.theme);
3126
3189
  if (!i) {
3127
3190
  this.initTheme(e);
3128
3191
  let n = this.createAppearance(e);
@@ -3137,13 +3200,13 @@ class $n {
3137
3200
  }
3138
3201
  //注册主题
3139
3202
  initTheme(t) {
3140
- var n, s, o, r, l, c, d, u, m, g, p, f;
3203
+ var n, s, o, r, h, c, d, u, m, g, p, f;
3141
3204
  let e = this.materialManager, i = this.Cesium;
3142
3205
  if (t.category == "polyline") {
3143
3206
  const w = ((s = (n = t.properties) == null ? void 0 : n.lineType) == null ? void 0 : s.pattern) && ((r = (o = t.properties) == null ? void 0 : o.lineType) == null ? void 0 : r.patternLength);
3144
3207
  let y = "";
3145
3208
  if (w) {
3146
- const v = ((c = (l = t.properties) == null ? void 0 : l.lineType) == null ? void 0 : c.pattern) || [0.25, -0.125], C = ((u = (d = t.properties) == null ? void 0 : d.lineType) == null ? void 0 : u.patternLength) || 0.375;
3209
+ const v = ((c = (h = t.properties) == null ? void 0 : h.lineType) == null ? void 0 : c.pattern) || [0.25, -0.125], C = ((u = (d = t.properties) == null ? void 0 : d.lineType) == null ? void 0 : u.patternLength) || 0.375;
3147
3210
  let b = this.convertCadPatternToCesiumDash(v, C);
3148
3211
  y = `DashedLineMaterial_pattern_${b.dashPattern}_dashLength_${b.dashLength}_color_${(m = t.properties) == null ? void 0 : m.color}`, e.has(y) || e.register({
3149
3212
  themeKey: y,
@@ -3181,8 +3244,8 @@ class $n {
3181
3244
  convertCadPatternToCesiumDash(t, e) {
3182
3245
  const n = e / 16;
3183
3246
  let s = [], o = 0;
3184
- for (let l of t) {
3185
- const c = Math.floor(Math.abs(l) / n), d = l >= 0 ? 1 : 0;
3247
+ for (let h of t) {
3248
+ const c = Math.floor(Math.abs(h) / n), d = h >= 0 ? 1 : 0;
3186
3249
  for (let u = 0; u < c && (s.push(d), o++, !(o >= 16)); u++)
3187
3250
  ;
3188
3251
  if (o >= 16) break;
@@ -3191,8 +3254,8 @@ class $n {
3191
3254
  s.push(0);
3192
3255
  s.length > 16 && (s.length = 16);
3193
3256
  let r = 0;
3194
- for (let l = 0; l < 16; l++)
3195
- r = r << 1 | s[l];
3257
+ for (let h = 0; h < 16; h++)
3258
+ r = r << 1 | s[h];
3196
3259
  return {
3197
3260
  dashPattern: r,
3198
3261
  dashLength: e
@@ -3203,11 +3266,11 @@ class $n {
3203
3266
  const e = /* @__PURE__ */ new Map();
3204
3267
  t.forEach((i) => {
3205
3268
  let { layerId: n, dataList: s } = i;
3206
- Te(s).forEach((r) => {
3207
- let l = this.createGeometryInstance(r);
3208
- if (l) {
3269
+ xe(s).forEach((r) => {
3270
+ let h = this.createGeometryInstance(r);
3271
+ if (h) {
3209
3272
  let c = this.carateThemePrimitive(r);
3210
- c.ids.set(r.id, r), c.geometryInstances.set(r.id, l);
3273
+ c.ids.set(r.id, r), c.geometryInstances.set(r.id, h);
3211
3274
  const d = this.layerMap.get(n);
3212
3275
  if (d)
3213
3276
  d.set(r.id, r);
@@ -3238,7 +3301,7 @@ class $n {
3238
3301
  createPolygon(t) {
3239
3302
  var o;
3240
3303
  const e = Array.isArray(t.hierarchy[0]) ? t.hierarchy.flat() : t.hierarchy, i = this.Cesium.Cartesian3.fromDegreesArrayHeights(e), n = ((o = t.holes) == null ? void 0 : o.map((r) => {
3241
- let l = Array.isArray(r[0]) ? r.flat() : r, c = this.Cesium.Cartesian3.fromDegreesArrayHeights(l.flat());
3304
+ let h = Array.isArray(r[0]) ? r.flat() : r, c = this.Cesium.Cartesian3.fromDegreesArrayHeights(h.flat());
3242
3305
  return new this.Cesium.PolygonHierarchy(c);
3243
3306
  })) || [], s = new this.Cesium.PolygonHierarchy(i, n);
3244
3307
  return new this.Cesium.GeometryInstance({
@@ -3261,7 +3324,7 @@ class $n {
3261
3324
  }
3262
3325
  // 更新图元
3263
3326
  updateGeometryInstance(t) {
3264
- let e = Te(t);
3327
+ let e = xe(t);
3265
3328
  const i = this.layerMap.get(e.layerId);
3266
3329
  if (!i) {
3267
3330
  console.warn(`没有找到图层 ${e.layerId}`);
@@ -3293,13 +3356,13 @@ class $n {
3293
3356
  return;
3294
3357
  }
3295
3358
  s.forEach((r) => {
3296
- let l = o.get(r);
3297
- if (!l) {
3359
+ let h = o.get(r);
3360
+ if (!h) {
3298
3361
  console.warn(`没有找到图元 ${r} 在图层 ${n} 中`);
3299
3362
  return;
3300
3363
  }
3301
- let c = this.PrimitiveThemeMap.get(l.theme);
3302
- c && (c.geometryInstances.delete(l.id), c.ids.delete(l.id), e.add(l));
3364
+ let c = this.PrimitiveThemeMap.get(h.theme);
3365
+ c && (c.geometryInstances.delete(h.id), c.ids.delete(h.id), e.add(h));
3303
3366
  });
3304
3367
  }), Array.from(e.values()).forEach((i) => {
3305
3368
  this.updatePrimitive(i);
@@ -3307,7 +3370,7 @@ class $n {
3307
3370
  }
3308
3371
  // 添加图元
3309
3372
  addGeometryInstance(t) {
3310
- let e = Te(t);
3373
+ let e = xe(t);
3311
3374
  const i = this.layerMap.get(e.layerId);
3312
3375
  if (!i) {
3313
3376
  console.warn(`没有找到图层 ${e.layerId}`);
@@ -3363,8 +3426,8 @@ class $n {
3363
3426
  let { layerId: n, ids: s } = i, o = this.hideLayerMap.get(n);
3364
3427
  o || (o = /* @__PURE__ */ new Set(), this.hideLayerMap.set(n, o)), s.forEach((r) => {
3365
3428
  o.add(r);
3366
- let l = this.getGeometryInstanceInfo(n, r);
3367
- l && e.set(l.theme, l);
3429
+ let h = this.getGeometryInstanceInfo(n, r);
3430
+ h && e.set(h.theme, h);
3368
3431
  });
3369
3432
  }), Array.from(e.values()).forEach((i) => {
3370
3433
  this.updatePrimitive(i);
@@ -3377,8 +3440,8 @@ class $n {
3377
3440
  let { layerId: n, ids: s } = i, o = this.hideLayerMap.get(n);
3378
3441
  o || (o = /* @__PURE__ */ new Set(), this.hideLayerMap.set(n, o)), s.forEach((r) => {
3379
3442
  o.delete(r);
3380
- let l = this.getGeometryInstanceInfo(n, r);
3381
- l && e.set(l.theme, l);
3443
+ let h = this.getGeometryInstanceInfo(n, r);
3444
+ h && e.set(h.theme, h);
3382
3445
  });
3383
3446
  }), Array.from(e.values()).forEach((i) => {
3384
3447
  this.updatePrimitive(i);
@@ -3421,10 +3484,10 @@ class $n {
3421
3484
  console.warn(`没有找到图元的几何体 ${e}`);
3422
3485
  return;
3423
3486
  }
3424
- const r = o.geometry, l = r._positions || r._polygonHierarchy.positions;
3425
- if (l && l.length > 0) {
3426
- let c = l[0].x, d = l[0].y, u = l[0].z, m = l[0].x, g = l[0].y, p = l[0].z;
3427
- l.forEach((C) => {
3487
+ const r = o.geometry, h = r._positions || r._polygonHierarchy.positions;
3488
+ if (h && h.length > 0) {
3489
+ let c = h[0].x, d = h[0].y, u = h[0].z, m = h[0].x, g = h[0].y, p = h[0].z;
3490
+ h.forEach((C) => {
3428
3491
  c = Math.min(c, C.x), d = Math.min(d, C.y), u = Math.min(u, C.z), m = Math.max(m, C.x), g = Math.max(g, C.y), p = Math.max(p, C.z);
3429
3492
  });
3430
3493
  const f = new this.Cesium.Cartesian3(
@@ -3446,26 +3509,32 @@ class $n {
3446
3509
  console.warn(`无法获取图元 ${e} 的顶点信息`);
3447
3510
  }
3448
3511
  }
3449
- class ht {
3512
+ const $e = class $e {
3450
3513
  constructor(t, e) {
3451
- h(this, "Cesium");
3452
- h(this, "viewer");
3453
- h(this, "handler", null);
3454
- h(this, "positions", []);
3455
- h(this, "tempPoints", []);
3456
- h(this, "segmentEntities", []);
3457
- h(this, "segmentLabelIds", []);
3458
- h(this, "previewEntity", null);
3459
- h(this, "previewGroundEntity", null);
3460
- h(this, "hoverPos", null);
3461
- h(this, "htmlLabelPool", null);
3462
- h(this, "totalLabelId", null);
3463
- h(this, "previewLabelId", null);
3464
- h(this, "labelEntity", null);
3465
- h(this, "firstHeight", null);
3466
- h(this, "groundLineEntities", []);
3467
- h(this, "previewPos", null);
3468
- h(this, "previewGroundPos", null);
3514
+ l(this, "Cesium");
3515
+ l(this, "viewer");
3516
+ l(this, "handler", null);
3517
+ l(this, "positions", []);
3518
+ l(this, "tempPoints", []);
3519
+ l(this, "segmentEntities", []);
3520
+ l(this, "segmentLabelIds", []);
3521
+ l(this, "previewEntity", null);
3522
+ l(this, "previewGroundEntity", null);
3523
+ l(this, "hoverPos", null);
3524
+ l(this, "htmlLabelPool", null);
3525
+ l(this, "totalLabelId", null);
3526
+ l(this, "previewLabelId", null);
3527
+ l(this, "labelEntity", null);
3528
+ l(this, "firstHeight", null);
3529
+ l(this, "groundLineEntities", []);
3530
+ l(this, "previewPos", null);
3531
+ l(this, "previewGroundPos", null);
3532
+ l(this, "tooltip", null);
3533
+ l(this, "moveFrameId", null);
3534
+ l(this, "pendingMove", null);
3535
+ l(this, "lastMoveKey", null);
3536
+ l(this, "keydownHandler", null);
3537
+ l(this, "contextMenuHandler", null);
3469
3538
  this.Cesium = t, this.viewer = e;
3470
3539
  }
3471
3540
  start(t) {
@@ -3487,13 +3556,13 @@ class ht {
3487
3556
  options: { offset: { x: 0, y: -10 } }
3488
3557
  });
3489
3558
  }
3490
- this.handler = new e.ScreenSpaceEventHandler(i.canvas), this.handler.setInputAction((n) => {
3491
- var f, w, y, v;
3559
+ this.tooltip = new ye(), this.tooltip.show($e.TIP_TEXT), this._bindGlobalEvents(t, e, i), this.handler = new e.ScreenSpaceEventHandler(i.canvas), this.handler.setInputAction((n) => {
3560
+ var p, f, w, y;
3492
3561
  const s = i.scene.pickPosition(n.position);
3493
3562
  if (!s) return;
3494
- const o = e.Cartographic.fromCartesian(s), r = e.Math.toDegrees(o.longitude), l = e.Math.toDegrees(o.latitude);
3563
+ const o = e.Cartographic.fromCartesian(s), r = e.Math.toDegrees(o.longitude), h = e.Math.toDegrees(o.latitude);
3495
3564
  this.positions.length === 0 && (this.firstHeight = o.height || 0);
3496
- const c = e.Cartesian3.fromDegrees(r, l, this.firstHeight || 0);
3565
+ const c = e.Cartesian3.fromDegrees(r, h, this.firstHeight || 0);
3497
3566
  this.positions.push(c);
3498
3567
  const d = i.entities.add({
3499
3568
  position: c,
@@ -3504,141 +3573,189 @@ class ht {
3504
3573
  }
3505
3574
  });
3506
3575
  this.tempPoints.push(d);
3507
- const u = i.scene.globe.getHeight(new e.Cartographic(o.longitude, o.latitude, 0)) || 0, m = e.Cartesian3.fromDegrees(r, l, u), g = ((w = (f = t.dashLineColor || t.lineColor || t.color || e.Color.RED).withAlpha) == null ? void 0 : w.call(f, 0.9)) || e.Color.RED, p = i.entities.add({
3576
+ const u = s, m = ((f = (p = t.dashLineColor || t.lineColor || t.color || e.Color.RED).withAlpha) == null ? void 0 : f.call(p, 0.9)) || e.Color.RED, g = i.entities.add({
3508
3577
  polyline: {
3509
- positions: [m, c],
3578
+ positions: [u, c],
3510
3579
  width: t.width || 3,
3511
3580
  material: new e.PolylineDashMaterialProperty({
3512
- color: g,
3581
+ color: m,
3513
3582
  dashLength: 12,
3514
3583
  dashPattern: 255
3515
3584
  })
3516
3585
  }
3517
3586
  });
3518
- if (this.groundLineEntities.push(p), this.positions.length >= 2) {
3519
- const C = this.positions[this.positions.length - 2], b = this.positions[this.positions.length - 1], M = e.Cartographic.fromCartesian(C), P = e.Cartographic.fromCartesian(b), L = i.entities.add({
3587
+ if (this.groundLineEntities.push(g), this.positions.length >= 2) {
3588
+ const v = this.positions[this.positions.length - 2], C = this.positions[this.positions.length - 1], b = e.Cartographic.fromCartesian(v), M = e.Cartographic.fromCartesian(C), P = i.entities.add({
3520
3589
  polyline: {
3521
- positions: [C, b],
3590
+ positions: [v, C],
3522
3591
  width: t.width || 3,
3523
3592
  material: t.lineColor || t.color || e.Color.YELLOW,
3524
3593
  depthFailMaterial: new e.PolylineDashMaterialProperty({
3525
- color: ((v = (y = t.dashLineColor || t.lineColor || t.color || e.Color.RED).withAlpha) == null ? void 0 : v.call(y, 0.9)) || e.Color.RED,
3594
+ color: ((y = (w = t.dashLineColor || t.lineColor || t.color || e.Color.RED).withAlpha) == null ? void 0 : y.call(w, 0.9)) || e.Color.RED,
3526
3595
  dashLength: 12,
3527
3596
  dashPattern: 255
3528
3597
  })
3529
3598
  }
3530
3599
  });
3531
- this.segmentEntities.push(L);
3532
- const I = new e.EllipsoidGeodesic(M, P).surfaceDistance, S = new e.Cartesian3(
3533
- (C.x + b.x) / 2,
3534
- (C.y + b.y) / 2,
3535
- (C.z + b.z) / 2
3536
- ), _ = e.Cartographic.fromCartesian(S), T = `measure_horizontal_seg_${this.segmentLabelIds.length}_${Date.now()}`;
3537
- this.segmentLabelIds.push(T), this.htmlLabelPool.add(
3538
- { text: `${I.toFixed(2)} m` },
3600
+ this.segmentEntities.push(P);
3601
+ const E = new e.EllipsoidGeodesic(b, M).surfaceDistance, I = new e.Cartesian3(
3602
+ (v.x + C.x) / 2,
3603
+ (v.y + C.y) / 2,
3604
+ (v.z + C.z) / 2
3605
+ ), D = e.Cartographic.fromCartesian(I), _ = `measure_horizontal_seg_${this.segmentLabelIds.length}_${Date.now()}`;
3606
+ this.segmentLabelIds.push(_), this.htmlLabelPool.add(
3607
+ { text: `${E.toFixed(2)} m` },
3539
3608
  {
3540
- id: T,
3541
- lon: e.Math.toDegrees(_.longitude),
3542
- lat: e.Math.toDegrees(_.latitude),
3543
- height: _.height || this.firstHeight || 0,
3609
+ id: _,
3610
+ lon: e.Math.toDegrees(D.longitude),
3611
+ lat: e.Math.toDegrees(D.latitude),
3612
+ height: D.height || this.firstHeight || 0,
3544
3613
  theme: "measure-horizontal-seg",
3545
3614
  show: !0
3546
3615
  }
3547
3616
  );
3548
3617
  }
3549
3618
  }, e.ScreenSpaceEventType.LEFT_CLICK), this.handler.setInputAction(() => {
3550
- var c;
3551
- if (this.positions.length < 2) {
3552
- this.stop();
3553
- return;
3554
- }
3555
- this.stop(), this.previewLabelId && (this.htmlLabelPool.removeByIds([this.previewLabelId]), this.previewLabelId = null), this.hoverPos && (this.hoverPos = null), this.previewEntity && (this.viewer.entities.remove(this.previewEntity), this.previewEntity = null), this.previewGroundEntity && (this.viewer.entities.remove(this.previewGroundEntity), this.previewGroundEntity = null);
3556
- let n = 0;
3557
- for (let d = 1; d < this.positions.length; d++) {
3558
- const u = this.positions[d - 1], m = this.positions[d], g = e.Cartographic.fromCartesian(u), p = e.Cartographic.fromCartesian(m), f = new e.EllipsoidGeodesic(g, p);
3559
- n += f.surfaceDistance;
3560
- }
3561
- const s = this.positions[this.positions.length - 1], o = e.Cartographic.fromCartesian(s), r = this.totalLabelId || `measure_horizontal_total_${Date.now()}`;
3562
- this.totalLabelId = r, this.htmlLabelPool.add(
3563
- { text: `${n.toFixed(2)} m` },
3564
- {
3565
- id: r,
3566
- lon: e.Math.toDegrees(o.longitude),
3567
- lat: e.Math.toDegrees(o.latitude),
3568
- height: o.height || this.firstHeight || 0,
3569
- theme: "measure-horizontal-total",
3570
- show: !0
3571
- }
3572
- ), this.labelEntity = this.totalLabelId;
3573
- const l = {
3574
- entity: this.segmentEntities,
3575
- label: this.labelEntity,
3576
- segmentLabels: this.segmentLabelIds,
3577
- positions: this.positions,
3578
- distance: n,
3579
- clear: () => this.clear()
3580
- };
3581
- (c = t.onComplete) == null || c.call(t, l);
3582
- }, e.ScreenSpaceEventType.LEFT_DOUBLE_CLICK), this.handler.setInputAction((n) => {
3583
- var M, P, L, E;
3584
- if (this.positions.length === 0) return;
3585
- const s = i.scene.pickPosition(n.endPosition);
3586
- if (!s) return;
3587
- this.hoverPos = s;
3588
- const o = e.Cartographic.fromCartesian(s), r = e.Math.toDegrees(o.longitude), l = e.Math.toDegrees(o.latitude), c = e.Cartesian3.fromDegrees(r, l, this.firstHeight || 0);
3589
- this.previewPos = c;
3590
- const d = i.scene.globe.getHeight(new e.Cartographic(o.longitude, o.latitude, 0)) || 0, u = e.Cartesian3.fromDegrees(r, l, d);
3591
- this.previewGroundPos = u;
3592
- const m = this.positions[this.positions.length - 1], g = e.Cartographic.fromCartesian(m), p = e.Cartographic.fromCartesian(c), w = new e.EllipsoidGeodesic(g, p).surfaceDistance, y = new e.Cartesian3(
3593
- (m.x + c.x) / 2,
3594
- (m.y + c.y) / 2,
3595
- (m.z + c.z) / 2
3596
- ), v = e.Cartographic.fromCartesian(y), C = this.previewLabelId || "measure_horizontal_preview";
3597
- this.previewLabelId = C, this.htmlLabelPool.add(
3598
- { text: `${w.toFixed(2)} m` },
3599
- {
3600
- id: C,
3601
- lon: e.Math.toDegrees(v.longitude),
3602
- lat: e.Math.toDegrees(v.latitude),
3603
- height: v.height || this.firstHeight || 0,
3604
- theme: "measure-horizontal-seg",
3605
- show: !0
3606
- }
3607
- );
3608
- const b = ((P = (M = t.dashLineColor || t.lineColor || t.color || e.Color.RED).withAlpha) == null ? void 0 : P.call(M, 0.9)) || e.Color.RED;
3609
- this.previewGroundEntity || (this.previewGroundEntity = i.entities.add({
3610
- polyline: {
3611
- positions: new e.CallbackProperty(() => !this.previewPos || !this.previewGroundPos ? [] : [this.previewGroundPos, this.previewPos], !1),
3612
- width: t.width || 3,
3613
- material: new e.PolylineDashMaterialProperty({
3614
- color: b,
3615
- dashLength: 12,
3616
- dashPattern: 255
3617
- })
3618
- }
3619
- })), this.previewEntity || (this.previewEntity = i.entities.add({
3620
- polyline: {
3621
- positions: new e.CallbackProperty(() => !this.previewPos || !this.positions.length ? [] : [this.positions[this.positions.length - 1], this.previewPos], !1),
3622
- width: t.width || 3,
3623
- material: t.lineColor || t.color || e.Color.YELLOW,
3624
- depthFailMaterial: new e.PolylineDashMaterialProperty({
3625
- color: ((E = (L = t.dashLineColor || t.lineColor || t.color || e.Color.RED).withAlpha) == null ? void 0 : E.call(L, 0.9)) || e.Color.RED,
3626
- dashLength: 12,
3627
- dashPattern: 255
3628
- })
3619
+ this._finishMeasurement(t, e);
3620
+ }, e.ScreenSpaceEventType.LEFT_DOUBLE_CLICK), this.handler.setInputAction(() => {
3621
+ this._undoLastPoint();
3622
+ }, e.ScreenSpaceEventType.RIGHT_CLICK), this.handler.setInputAction((n) => {
3623
+ var s, o;
3624
+ this.pendingMove = {
3625
+ endPosition: {
3626
+ x: (s = n.endPosition) == null ? void 0 : s.x,
3627
+ y: (o = n.endPosition) == null ? void 0 : o.y
3629
3628
  }
3629
+ }, this.moveFrameId == null && (this.moveFrameId = window.requestAnimationFrame(() => {
3630
+ this.moveFrameId = null;
3631
+ const r = this.pendingMove;
3632
+ if (this.pendingMove = null, !(r != null && r.endPosition)) return;
3633
+ const h = `${r.endPosition.x}_${r.endPosition.y}`;
3634
+ h !== this.lastMoveKey && (this.lastMoveKey = h, this._handlePreviewMove(r, t, e, i));
3630
3635
  }));
3631
3636
  }, e.ScreenSpaceEventType.MOUSE_MOVE);
3632
3637
  }
3638
+ _handlePreviewMove(t, e, i, n) {
3639
+ var C, b, M, P;
3640
+ if (this.positions.length === 0) return;
3641
+ const s = n.scene.pickPosition(t.endPosition);
3642
+ if (!s) return;
3643
+ this.hoverPos = s;
3644
+ const o = i.Cartographic.fromCartesian(s), r = i.Math.toDegrees(o.longitude), h = i.Math.toDegrees(o.latitude), c = i.Cartesian3.fromDegrees(r, h, this.firstHeight || 0);
3645
+ this.previewPos = c, this.previewGroundPos = s;
3646
+ const d = this.positions[this.positions.length - 1], u = i.Cartographic.fromCartesian(d), m = i.Cartographic.fromCartesian(c), p = new i.EllipsoidGeodesic(u, m).surfaceDistance, f = new i.Cartesian3(
3647
+ (d.x + c.x) / 2,
3648
+ (d.y + c.y) / 2,
3649
+ (d.z + c.z) / 2
3650
+ ), w = i.Cartographic.fromCartesian(f), y = this.previewLabelId || "measure_horizontal_preview";
3651
+ this.previewLabelId = y, this.htmlLabelPool.add(
3652
+ { text: `${p.toFixed(2)} m` },
3653
+ {
3654
+ id: y,
3655
+ lon: i.Math.toDegrees(w.longitude),
3656
+ lat: i.Math.toDegrees(w.latitude),
3657
+ height: w.height || this.firstHeight || 0,
3658
+ theme: "measure-horizontal-seg",
3659
+ show: !0
3660
+ }
3661
+ );
3662
+ const v = ((b = (C = e.dashLineColor || e.lineColor || e.color || i.Color.RED).withAlpha) == null ? void 0 : b.call(C, 0.9)) || i.Color.RED;
3663
+ this.previewGroundEntity || (this.previewGroundEntity = n.entities.add({
3664
+ polyline: {
3665
+ positions: new i.CallbackProperty(() => !this.previewPos || !this.previewGroundPos ? [] : [this.previewGroundPos, this.previewPos], !1),
3666
+ width: e.width || 3,
3667
+ material: new i.PolylineDashMaterialProperty({
3668
+ color: v,
3669
+ dashLength: 12,
3670
+ dashPattern: 255
3671
+ })
3672
+ }
3673
+ })), this.previewEntity || (this.previewEntity = n.entities.add({
3674
+ polyline: {
3675
+ positions: new i.CallbackProperty(() => !this.previewPos || !this.positions.length ? [] : [this.positions[this.positions.length - 1], this.previewPos], !1),
3676
+ width: e.width || 3,
3677
+ material: e.lineColor || e.color || i.Color.YELLOW,
3678
+ depthFailMaterial: new i.PolylineDashMaterialProperty({
3679
+ color: ((P = (M = e.dashLineColor || e.lineColor || e.color || i.Color.RED).withAlpha) == null ? void 0 : P.call(M, 0.9)) || i.Color.RED,
3680
+ dashLength: 12,
3681
+ dashPattern: 255
3682
+ })
3683
+ }
3684
+ }));
3685
+ }
3686
+ _clearPreviewState() {
3687
+ this.previewLabelId && this.htmlLabelPool && (this.htmlLabelPool.removeByIds([this.previewLabelId]), this.previewLabelId = null), this.previewEntity && (this.viewer.entities.remove(this.previewEntity), this.previewEntity = null), this.previewGroundEntity && (this.viewer.entities.remove(this.previewGroundEntity), this.previewGroundEntity = null), this.previewPos = null, this.previewGroundPos = null, this.hoverPos = null;
3688
+ }
3689
+ _undoLastPoint() {
3690
+ if (!this.positions.length) return;
3691
+ this.positions.pop();
3692
+ const t = this.tempPoints.pop();
3693
+ t && this.viewer.entities.remove(t);
3694
+ const e = this.groundLineEntities.pop();
3695
+ if (e && this.viewer.entities.remove(e), this.segmentEntities.length > this.positions.length - 1) {
3696
+ const i = this.segmentEntities.pop();
3697
+ i && this.viewer.entities.remove(i);
3698
+ }
3699
+ if (this.segmentLabelIds.length > this.positions.length - 1 && this.htmlLabelPool) {
3700
+ const i = this.segmentLabelIds.pop();
3701
+ i && this.htmlLabelPool.removeByIds([i]);
3702
+ }
3703
+ if (!this.positions.length) {
3704
+ this.firstHeight = null, this._clearPreviewState();
3705
+ return;
3706
+ }
3707
+ this.totalLabelId && this.htmlLabelPool && (this.htmlLabelPool.removeByIds([this.totalLabelId]), this.totalLabelId = null), this.previewLabelId && this.htmlLabelPool && (this.htmlLabelPool.removeByIds([this.previewLabelId]), this.previewLabelId = null);
3708
+ }
3709
+ _finishMeasurement(t, e) {
3710
+ var h;
3711
+ if (this.positions.length < 2) {
3712
+ this.clear();
3713
+ return;
3714
+ }
3715
+ this.stop(), this._clearPreviewState();
3716
+ let i = 0;
3717
+ for (let c = 1; c < this.positions.length; c++) {
3718
+ const d = this.positions[c - 1], u = this.positions[c], m = e.Cartographic.fromCartesian(d), g = e.Cartographic.fromCartesian(u), p = new e.EllipsoidGeodesic(m, g);
3719
+ i += p.surfaceDistance;
3720
+ }
3721
+ const n = this.positions[this.positions.length - 1], s = e.Cartographic.fromCartesian(n), o = this.totalLabelId || `measure_horizontal_total_${Date.now()}`;
3722
+ this.totalLabelId = o, this.htmlLabelPool.add(
3723
+ { text: `${i.toFixed(2)} m` },
3724
+ {
3725
+ id: o,
3726
+ lon: e.Math.toDegrees(s.longitude),
3727
+ lat: e.Math.toDegrees(s.latitude),
3728
+ height: s.height || this.firstHeight || 0,
3729
+ theme: "measure-horizontal-total",
3730
+ show: !0
3731
+ }
3732
+ ), this.labelEntity = this.totalLabelId;
3733
+ const r = {
3734
+ entity: this.segmentEntities,
3735
+ label: this.labelEntity,
3736
+ segmentLabels: this.segmentLabelIds,
3737
+ positions: this.positions,
3738
+ distance: i,
3739
+ clear: () => this.clear()
3740
+ };
3741
+ (h = t.onComplete) == null || h.call(t, r);
3742
+ }
3743
+ _bindGlobalEvents(t, e, i) {
3744
+ this.keydownHandler = (n) => {
3745
+ n.key === "Escape" && (n.preventDefault(), this._finishMeasurement(t, e));
3746
+ }, window.addEventListener("keydown", this.keydownHandler), this.contextMenuHandler = (n) => {
3747
+ n.preventDefault();
3748
+ }, i.canvas.addEventListener("contextmenu", this.contextMenuHandler);
3749
+ }
3633
3750
  stop() {
3634
- this.handler && (this.handler.destroy(), this.handler = null);
3751
+ this.moveFrameId != null && (cancelAnimationFrame(this.moveFrameId), this.moveFrameId = null), this.pendingMove = null, this.lastMoveKey = null, this.keydownHandler && (window.removeEventListener("keydown", this.keydownHandler), this.keydownHandler = null), this.contextMenuHandler && (this.viewer.canvas.removeEventListener("contextmenu", this.contextMenuHandler), this.contextMenuHandler = null), this.handler && (this.handler.destroy(), this.handler = null), this.tooltip && (this.tooltip.destroy(), this.tooltip = null);
3635
3752
  }
3636
3753
  clear() {
3637
3754
  this.stop(), this.segmentEntities.forEach((t) => this.viewer.entities.remove(t)), this.segmentEntities = [], this.groundLineEntities.forEach((t) => this.viewer.entities.remove(t)), this.groundLineEntities = [], this.tempPoints.forEach((t) => this.viewer.entities.remove(t)), this.tempPoints = [], this.totalLabelId && this.htmlLabelPool && (this.htmlLabelPool.removeByIds([this.totalLabelId]), this.totalLabelId = null), this.previewEntity && (this.viewer.entities.remove(this.previewEntity), this.previewEntity = null), this.previewGroundEntity && (this.viewer.entities.remove(this.previewGroundEntity), this.previewGroundEntity = null), this.previewLabelId && this.htmlLabelPool && (this.htmlLabelPool.removeByIds([this.previewLabelId]), this.previewLabelId = null), this.segmentLabelIds.length && this.htmlLabelPool && this.htmlLabelPool.removeByIds(this.segmentLabelIds.slice()), this.segmentLabelIds = [], this.positions = [], this.hoverPos = null, this.labelEntity = null, this.firstHeight = null, this.previewPos = null, this.previewGroundPos = null;
3638
3755
  }
3639
3756
  rehydrate(t, e) {
3640
3757
  var p, f;
3641
- const i = this.Cesium, n = this.viewer, s = t.options || {}, o = s.lineColor || s.color || i.Color.YELLOW, r = ((f = (p = s.dashLineColor || s.lineColor || s.color || i.Color.RED).withAlpha) == null ? void 0 : f.call(p, 0.9)) || i.Color.RED, l = s.width || 3, c = (t.positions || []).map((w) => new i.Cartesian3(w[0], w[1], w[2]));
3758
+ const i = this.Cesium, n = this.viewer, s = t.options || {}, o = s.lineColor || s.color || i.Color.YELLOW, r = ((f = (p = s.dashLineColor || s.lineColor || s.color || i.Color.RED).withAlpha) == null ? void 0 : f.call(p, 0.9)) || i.Color.RED, h = s.width || 3, c = (t.positions || []).map((w) => new i.Cartesian3(w[0], w[1], w[2]));
3642
3759
  if (!c.length) return;
3643
3760
  if (!this.htmlLabelPool) {
3644
3761
  const w = s.overlayContainerId || "html-label-container";
@@ -3662,7 +3779,7 @@ class ht {
3662
3779
  const v = i.Cartographic.fromCartesian(w), C = i.Math.toDegrees(v.longitude), b = i.Math.toDegrees(v.latitude), M = n.scene.globe.getHeight(new i.Cartographic(v.longitude, v.latitude, 0)) || 0, P = i.Cartesian3.fromDegrees(C, b, M), L = n.entities.add({
3663
3780
  polyline: {
3664
3781
  positions: [P, w],
3665
- width: l,
3782
+ width: h,
3666
3783
  material: new i.PolylineDashMaterialProperty({ color: r, dashLength: 12, dashPattern: 255 })
3667
3784
  }
3668
3785
  });
@@ -3672,15 +3789,15 @@ class ht {
3672
3789
  const y = c[w - 1], v = c[w], C = n.entities.add({
3673
3790
  polyline: {
3674
3791
  positions: [y, v],
3675
- width: l,
3792
+ width: h,
3676
3793
  material: o,
3677
3794
  depthFailMaterial: new i.PolylineDashMaterialProperty({ color: r, dashLength: 12, dashPattern: 255 })
3678
3795
  }
3679
3796
  });
3680
3797
  this.segmentEntities.push(C);
3681
- const b = i.Cartographic.fromCartesian(y), M = i.Cartographic.fromCartesian(v), L = new i.EllipsoidGeodesic(b, M).surfaceDistance, E = new i.Cartesian3((y.x + v.x) / 2, (y.y + v.y) / 2, (y.z + v.z) / 2), I = i.Cartographic.fromCartesian(E), S = t.id + `_seg_${w - 1}`;
3682
- this.segmentLabelIds.push(S), this.htmlLabelPool.add({ text: `${L.toFixed(2)} m` }, {
3683
- id: S,
3798
+ const b = i.Cartographic.fromCartesian(y), M = i.Cartographic.fromCartesian(v), L = new i.EllipsoidGeodesic(b, M).surfaceDistance, E = new i.Cartesian3((y.x + v.x) / 2, (y.y + v.y) / 2, (y.z + v.z) / 2), I = i.Cartographic.fromCartesian(E), D = t.id + `_seg_${w - 1}`;
3799
+ this.segmentLabelIds.push(D), this.htmlLabelPool.add({ text: `${L.toFixed(2)} m` }, {
3800
+ id: D,
3684
3801
  lon: i.Math.toDegrees(I.longitude),
3685
3802
  lat: i.Math.toDegrees(I.latitude),
3686
3803
  height: I.height || 0,
@@ -3705,23 +3822,25 @@ class ht {
3705
3822
  style: { pointerEvents: "none", userSelect: "none", cursor: "default" }
3706
3823
  });
3707
3824
  }
3708
- }
3709
- class ct {
3825
+ };
3826
+ l($e, "TIP_TEXT", "单击左键添加点,右键撤销,双击左键或Esc结束");
3827
+ let De = $e;
3828
+ class gt {
3710
3829
  constructor(t, e) {
3711
- h(this, "Cesium");
3712
- h(this, "viewer");
3713
- h(this, "handler", null);
3714
- h(this, "entity", null);
3715
- h(this, "labelEntity", null);
3716
- h(this, "positions", []);
3717
- h(this, "htmlLabelPool", null);
3718
- h(this, "htmlLabelId", null);
3719
- h(this, "previewLabelId", null);
3720
- h(this, "baseCarto", null);
3721
- h(this, "baseUp", null);
3722
- h(this, "tempPoints", []);
3723
- h(this, "previewPointEntity", null);
3724
- h(this, "previewEntity", null);
3830
+ l(this, "Cesium");
3831
+ l(this, "viewer");
3832
+ l(this, "handler", null);
3833
+ l(this, "entity", null);
3834
+ l(this, "labelEntity", null);
3835
+ l(this, "positions", []);
3836
+ l(this, "htmlLabelPool", null);
3837
+ l(this, "htmlLabelId", null);
3838
+ l(this, "previewLabelId", null);
3839
+ l(this, "baseCarto", null);
3840
+ l(this, "baseUp", null);
3841
+ l(this, "tempPoints", []);
3842
+ l(this, "previewPointEntity", null);
3843
+ l(this, "previewEntity", null);
3725
3844
  this.Cesium = t, this.viewer = e;
3726
3845
  }
3727
3846
  start(t) {
@@ -3738,7 +3857,7 @@ class ct {
3738
3857
  });
3739
3858
  }
3740
3859
  this.handler = new e.ScreenSpaceEventHandler(i.canvas), this.handler.setInputAction((n) => {
3741
- var r, l, c, d, u;
3860
+ var r, h, c, d, u;
3742
3861
  const s = i.camera.getPickRay(n.position);
3743
3862
  let o = s ? i.scene.globe.pick(s, i.scene) : null;
3744
3863
  if (o || (o = i.camera.pickEllipsoid(n.position, e.Ellipsoid.WGS84)), o || (o = i.scene.pickPosition(n.position)), !!o)
@@ -3756,7 +3875,7 @@ class ct {
3756
3875
  }
3757
3876
  });
3758
3877
  this.tempPoints.push(p);
3759
- const f = t.lineColor || t.color || e.Color.CYAN, w = ((l = (r = t.dashLineColor || t.lineColor || t.color || e.Color.RED).withAlpha) == null ? void 0 : l.call(r, 0.9)) || e.Color.RED;
3878
+ const f = t.lineColor || t.color || e.Color.CYAN, w = ((h = (r = t.dashLineColor || t.lineColor || t.color || e.Color.RED).withAlpha) == null ? void 0 : h.call(r, 0.9)) || e.Color.RED;
3760
3879
  this.previewEntity = i.entities.add({
3761
3880
  polyline: {
3762
3881
  positions: [g, g],
@@ -3775,16 +3894,16 @@ class ct {
3775
3894
  if (!g) return;
3776
3895
  const p = g.origin, f = e.Cartesian3.normalize(g.direction, new e.Cartesian3()), w = m, y = this.baseUp, v = e.Cartesian3.subtract(p, w, new e.Cartesian3()), C = e.Cartesian3.dot(f, f), b = -e.Cartesian3.dot(f, y), M = e.Cartesian3.dot(y, y), P = -e.Cartesian3.dot(f, v), L = e.Cartesian3.dot(y, v), E = C * M - b * b;
3777
3896
  if (Math.abs(E) < 1e-6) return;
3778
- const I = (C * L - b * P) / E, S = e.Cartesian3.add(
3897
+ const I = (C * L - b * P) / E, D = e.Cartesian3.add(
3779
3898
  w,
3780
3899
  e.Cartesian3.multiplyByScalar(y, I, new e.Cartesian3()),
3781
3900
  new e.Cartesian3()
3782
3901
  );
3783
- this.positions[1] = S, this.stop(), this.previewEntity && (this.viewer.entities.remove(this.previewEntity), this.previewEntity = null), this.previewPointEntity && (this.viewer.entities.remove(this.previewPointEntity), this.previewPointEntity = null);
3902
+ this.positions[1] = D, this.stop(), this.previewEntity && (this.viewer.entities.remove(this.previewEntity), this.previewEntity = null), this.previewPointEntity && (this.viewer.entities.remove(this.previewPointEntity), this.previewPointEntity = null);
3784
3903
  const _ = t.lineColor || t.color || e.Color.CYAN, T = ((d = (c = t.dashLineColor || t.lineColor || t.color || e.Color.RED).withAlpha) == null ? void 0 : d.call(c, 0.9)) || e.Color.RED;
3785
3904
  this.entity = i.entities.add({
3786
3905
  polyline: {
3787
- positions: [m, S],
3906
+ positions: [m, D],
3788
3907
  width: t.width || 3,
3789
3908
  material: _,
3790
3909
  depthFailMaterial: new e.PolylineDashMaterialProperty({
@@ -3795,7 +3914,7 @@ class ct {
3795
3914
  }
3796
3915
  });
3797
3916
  const A = i.entities.add({
3798
- position: S,
3917
+ position: D,
3799
3918
  point: {
3800
3919
  pixelSize: 8,
3801
3920
  color: t.pointColor || t.color || e.Color.YELLOW,
@@ -3803,20 +3922,20 @@ class ct {
3803
3922
  }
3804
3923
  });
3805
3924
  this.tempPoints.push(A);
3806
- const D = this.baseCarto, O = e.Cartographic.fromCartesian(S), x = Math.abs((O.height || 0) - (D.height || 0)), $ = new e.Cartesian3(
3925
+ const S = this.baseCarto, k = e.Cartographic.fromCartesian(D), x = Math.abs((k.height || 0) - (S.height || 0)), $ = new e.Cartesian3(
3807
3926
  (this.positions[0].x + this.positions[1].x) / 2,
3808
3927
  (this.positions[0].y + this.positions[1].y) / 2,
3809
3928
  (this.positions[0].z + this.positions[1].z) / 2
3810
- ), F = e.Cartographic.fromCartesian($);
3929
+ ), H = e.Cartographic.fromCartesian($);
3811
3930
  this.previewLabelId && this.htmlLabelPool && (this.htmlLabelPool.removeByIds([this.previewLabelId]), this.previewLabelId = null);
3812
3931
  const z = this.htmlLabelId || `measure_vertical_${Date.now()}`;
3813
3932
  this.htmlLabelId = z, this.htmlLabelPool.add(
3814
3933
  { text: `${x.toFixed(2)} m` },
3815
3934
  {
3816
3935
  id: z,
3817
- lon: e.Math.toDegrees(F.longitude),
3818
- lat: e.Math.toDegrees(F.latitude),
3819
- height: F.height || 0,
3936
+ lon: e.Math.toDegrees(H.longitude),
3937
+ lat: e.Math.toDegrees(H.latitude),
3938
+ height: H.height || 0,
3820
3939
  theme: "measure-vertical",
3821
3940
  show: !0,
3822
3941
  style: { pointerEvents: "none", userSelect: "none", cursor: "default" }
@@ -3832,7 +3951,7 @@ class ct {
3832
3951
  (u = t.onComplete) == null || u.call(t, G);
3833
3952
  }
3834
3953
  }, e.ScreenSpaceEventType.LEFT_CLICK), this.handler.setInputAction((n) => {
3835
- var S, _;
3954
+ var D, _;
3836
3955
  if (this.positions.length < 1) return;
3837
3956
  if (!this.baseCarto || !this.baseUp) {
3838
3957
  const T = e.Cartographic.fromCartesian(this.positions[0]);
@@ -3840,7 +3959,7 @@ class ct {
3840
3959
  }
3841
3960
  const s = this.positions[0], o = i.camera.getPickRay(n.endPosition);
3842
3961
  if (!o) return;
3843
- const r = o.origin, l = e.Cartesian3.normalize(o.direction, new e.Cartesian3()), c = s, d = this.baseUp, u = e.Cartesian3.subtract(r, c, new e.Cartesian3()), m = e.Cartesian3.dot(l, l), g = -e.Cartesian3.dot(l, d), p = e.Cartesian3.dot(d, d), f = -e.Cartesian3.dot(l, u), w = e.Cartesian3.dot(d, u), y = m * p - g * g;
3962
+ const r = o.origin, h = e.Cartesian3.normalize(o.direction, new e.Cartesian3()), c = s, d = this.baseUp, u = e.Cartesian3.subtract(r, c, new e.Cartesian3()), m = e.Cartesian3.dot(h, h), g = -e.Cartesian3.dot(h, d), p = e.Cartesian3.dot(d, d), f = -e.Cartesian3.dot(h, u), w = e.Cartesian3.dot(d, u), y = m * p - g * g;
3844
3963
  if (Math.abs(y) < 1e-6) return;
3845
3964
  const v = (m * w - g * f) / y, C = e.Cartesian3.add(
3846
3965
  c,
@@ -3848,7 +3967,7 @@ class ct {
3848
3967
  new e.Cartesian3()
3849
3968
  );
3850
3969
  if (this.positions[1] = C, !this.previewEntity) {
3851
- const T = t.lineColor || t.color || e.Color.CYAN, A = ((_ = (S = t.dashLineColor || t.lineColor || t.color || e.Color.RED).withAlpha) == null ? void 0 : _.call(S, 0.9)) || e.Color.RED;
3970
+ const T = t.lineColor || t.color || e.Color.CYAN, A = ((_ = (D = t.dashLineColor || t.lineColor || t.color || e.Color.RED).withAlpha) == null ? void 0 : _.call(D, 0.9)) || e.Color.RED;
3852
3971
  this.previewEntity = i.entities.add({
3853
3972
  polyline: {
3854
3973
  positions: new e.CallbackProperty(() => this.positions.length < 2 ? [] : [this.positions[0], this.positions[1]], !1),
@@ -3897,7 +4016,7 @@ class ct {
3897
4016
  }
3898
4017
  rehydrate(t, e) {
3899
4018
  var b, M;
3900
- const i = this.Cesium, n = this.viewer, s = t.options || {}, o = s.lineColor || s.color || i.Color.CYAN, r = ((M = (b = s.dashLineColor || s.lineColor || s.color || i.Color.RED).withAlpha) == null ? void 0 : M.call(b, 0.9)) || i.Color.RED, l = s.width || 3, c = (t.positions || []).map((P) => new i.Cartesian3(P[0], P[1], P[2]));
4019
+ const i = this.Cesium, n = this.viewer, s = t.options || {}, o = s.lineColor || s.color || i.Color.CYAN, r = ((M = (b = s.dashLineColor || s.lineColor || s.color || i.Color.RED).withAlpha) == null ? void 0 : M.call(b, 0.9)) || i.Color.RED, h = s.width || 3, c = (t.positions || []).map((P) => new i.Cartesian3(P[0], P[1], P[2]));
3901
4020
  if (c.length < 2) return;
3902
4021
  if (!this.htmlLabelPool) {
3903
4022
  const P = s.overlayContainerId || "html-label-container";
@@ -3910,7 +4029,7 @@ class ct {
3910
4029
  });
3911
4030
  }
3912
4031
  const d = c[0], u = c[1], m = n.entities.add({ position: d, point: { pixelSize: 8, color: s.pointColor || s.color || i.Color.YELLOW, disableDepthTestDistance: Number.POSITIVE_INFINITY } }), g = n.entities.add({ position: u, point: { pixelSize: 8, color: s.pointColor || s.color || i.Color.YELLOW, disableDepthTestDistance: Number.POSITIVE_INFINITY } });
3913
- this.tempPoints.push(m), this.tempPoints.push(g), this.entity = n.entities.add({ polyline: { positions: [d, u], width: l, material: o, depthFailMaterial: new i.PolylineDashMaterialProperty({ color: r, dashLength: 12, dashPattern: 255 }) } });
4032
+ this.tempPoints.push(m), this.tempPoints.push(g), this.entity = n.entities.add({ polyline: { positions: [d, u], width: h, material: o, depthFailMaterial: new i.PolylineDashMaterialProperty({ color: r, dashLength: 12, dashPattern: 255 }) } });
3914
4033
  const p = i.Cartographic.fromCartesian(d), f = i.Cartographic.fromCartesian(u), w = Math.abs((f.height || 0) - (p.height || 0)), y = new i.Cartesian3((d.x + u.x) / 2, (d.y + u.y) / 2, (d.z + u.z) / 2), v = i.Cartographic.fromCartesian(y), C = t.id + "_label";
3915
4034
  this.htmlLabelId = C, this.htmlLabelPool.add({ text: `${w.toFixed(2)} m` }, {
3916
4035
  id: C,
@@ -3923,29 +4042,29 @@ class ct {
3923
4042
  });
3924
4043
  }
3925
4044
  }
3926
- class dt {
4045
+ class ft {
3927
4046
  constructor(t, e) {
3928
- h(this, "Cesium");
3929
- h(this, "viewer");
3930
- h(this, "handler", null);
3931
- h(this, "positions", []);
3932
- h(this, "htmlLabelPool", null);
3933
- h(this, "htmlLabelId", null);
3934
- h(this, "segmentEntities", []);
3935
- h(this, "angleMarkerEntities", []);
3936
- h(this, "pointEntities", []);
3937
- h(this, "segmentLabelIds", []);
3938
- h(this, "angleLabelIds", []);
3939
- h(this, "previewLabelId", null);
3940
- h(this, "previewSegmentEntities", []);
3941
- h(this, "previewAngleMarkerEntities", []);
3942
- h(this, "previewPointEntity", null);
3943
- h(this, "previewLow", null);
3944
- h(this, "previewHigh", null);
3945
- h(this, "previewThird", null);
3946
- h(this, "previewMarkerP1", null);
3947
- h(this, "previewMarkerP2", null);
3948
- h(this, "previewMarkerCorner", null);
4047
+ l(this, "Cesium");
4048
+ l(this, "viewer");
4049
+ l(this, "handler", null);
4050
+ l(this, "positions", []);
4051
+ l(this, "htmlLabelPool", null);
4052
+ l(this, "htmlLabelId", null);
4053
+ l(this, "segmentEntities", []);
4054
+ l(this, "angleMarkerEntities", []);
4055
+ l(this, "pointEntities", []);
4056
+ l(this, "segmentLabelIds", []);
4057
+ l(this, "angleLabelIds", []);
4058
+ l(this, "previewLabelId", null);
4059
+ l(this, "previewSegmentEntities", []);
4060
+ l(this, "previewAngleMarkerEntities", []);
4061
+ l(this, "previewPointEntity", null);
4062
+ l(this, "previewLow", null);
4063
+ l(this, "previewHigh", null);
4064
+ l(this, "previewThird", null);
4065
+ l(this, "previewMarkerP1", null);
4066
+ l(this, "previewMarkerP2", null);
4067
+ l(this, "previewMarkerCorner", null);
3949
4068
  this.Cesium = t, this.viewer = e;
3950
4069
  }
3951
4070
  start(t) {
@@ -3974,7 +4093,7 @@ class dt {
3974
4093
  });
3975
4094
  }
3976
4095
  this.handler = new e.ScreenSpaceEventHandler(i.canvas), this.handler.setInputAction((n) => {
3977
- var r, l, c;
4096
+ var r, h, c;
3978
4097
  const s = i.scene.pickPosition(n.position);
3979
4098
  if (!s) return;
3980
4099
  this.positions.push(s);
@@ -3987,14 +4106,14 @@ class dt {
3987
4106
  }
3988
4107
  });
3989
4108
  if (this.pointEntities.push(o), this.positions.length === 2) {
3990
- this.stop(), this.previewSegmentEntities.forEach((K) => i.entities.remove(K)), this.previewSegmentEntities = [], this.previewAngleMarkerEntities.forEach((K) => i.entities.remove(K)), this.previewAngleMarkerEntities = [], this.previewPointEntity && (i.entities.remove(this.previewPointEntity), this.previewPointEntity = null);
4109
+ this.stop(), this.previewSegmentEntities.forEach((q) => i.entities.remove(q)), this.previewSegmentEntities = [], this.previewAngleMarkerEntities.forEach((q) => i.entities.remove(q)), this.previewAngleMarkerEntities = [], this.previewPointEntity && (i.entities.remove(this.previewPointEntity), this.previewPointEntity = null);
3991
4110
  const d = e.Cartographic.fromCartesian(this.positions[0]), u = e.Cartographic.fromCartesian(this.positions[1]), m = d.height || 0, g = u.height || 0, p = m <= g ? this.positions[0] : this.positions[1], f = m > g ? this.positions[0] : this.positions[1], w = e.Cartographic.fromCartesian(p);
3992
4111
  e.Cartographic.fromCartesian(f);
3993
4112
  const y = Math.max(m, g), v = e.Cartesian3.fromDegrees(
3994
4113
  e.Math.toDegrees(w.longitude),
3995
4114
  e.Math.toDegrees(w.latitude),
3996
4115
  y
3997
- ), C = t.lineColor || t.color || e.Color.YELLOW, b = ((l = (r = t.dashLineColor || t.lineColor || t.color || e.Color.RED).withAlpha) == null ? void 0 : l.call(r, 0.9)) || e.Color.RED, M = i.entities.add({
4116
+ ), C = t.lineColor || t.color || e.Color.YELLOW, b = ((h = (r = t.dashLineColor || t.lineColor || t.color || e.Color.RED).withAlpha) == null ? void 0 : h.call(r, 0.9)) || e.Color.RED, M = i.entities.add({
3998
4117
  polyline: {
3999
4118
  positions: [p, v],
4000
4119
  width: t.width || 3,
@@ -4017,30 +4136,30 @@ class dt {
4017
4136
  }
4018
4137
  });
4019
4138
  this.segmentEntities.push(M, P, L);
4020
- const E = e.Cartesian3.distance(p, v), I = e.Cartesian3.distance(v, f), S = e.Cartesian3.distance(p, f), _ = new e.Cartesian3((p.x + v.x) / 2, (p.y + v.y) / 2, (p.z + v.z) / 2), T = new e.Cartesian3((v.x + f.x) / 2, (v.y + f.y) / 2, (v.z + f.z) / 2), A = new e.Cartesian3((p.x + f.x) / 2, (p.y + f.y) / 2, (p.z + f.z) / 2), D = e.Cartographic.fromCartesian(_), O = e.Cartographic.fromCartesian(T), x = e.Cartographic.fromCartesian(A), $ = "measure_triangle_seg_v", F = "measure_triangle_seg_h", z = "measure_triangle_seg_hyp";
4021
- this.segmentLabelIds = [$, F, z], this.htmlLabelPool.add({ text: `${E.toFixed(2)} m` }, { id: $, lon: e.Math.toDegrees(D.longitude), lat: e.Math.toDegrees(D.latitude), height: D.height || 0, theme: "measure-triangle-seg", show: !0, style: { pointerEvents: "none", userSelect: "none", cursor: "default" } }), this.htmlLabelPool.add({ text: `${I.toFixed(2)} m` }, { id: F, lon: e.Math.toDegrees(O.longitude), lat: e.Math.toDegrees(O.latitude), height: O.height || 0, theme: "measure-triangle-seg", show: !0, style: { pointerEvents: "none", userSelect: "none", cursor: "default" } }), this.htmlLabelPool.add({ text: `${S.toFixed(2)} m` }, { id: z, lon: e.Math.toDegrees(x.longitude), lat: e.Math.toDegrees(x.latitude), height: x.height || 0, theme: "measure-triangle-seg", show: !0, style: { pointerEvents: "none", userSelect: "none", cursor: "default" } });
4022
- const G = e.Cartesian3.subtract(f, p, new e.Cartesian3()), B = e.Cartesian3.subtract(v, p, new e.Cartesian3()), q = e.Cartesian3.subtract(v, f, new e.Cartesian3()), X = e.Cartesian3.subtract(p, f, new e.Cartesian3()), se = e.Cartesian3.dot(G, B), pe = Math.sqrt(e.Cartesian3.dot(G, G)) * Math.sqrt(e.Cartesian3.dot(B, B)), ue = e.Cartesian3.dot(q, X), ve = Math.sqrt(e.Cartesian3.dot(q, q)) * Math.sqrt(e.Cartesian3.dot(X, X)), j = Math.acos(Math.min(Math.max(se / (pe || 1), -1), 1)), le = Math.acos(Math.min(Math.max(ue / (ve || 1), -1), 1)), ee = e.Cartographic.fromCartesian(p), Y = e.Cartographic.fromCartesian(f), J = "measure_triangle_angle_a", oe = "measure_triangle_angle_b";
4023
- this.angleLabelIds = [J, oe], this.htmlLabelPool.add({ text: `${(j * 180 / Math.PI).toFixed(2)}°` }, { id: J, lon: e.Math.toDegrees(ee.longitude), lat: e.Math.toDegrees(ee.latitude), height: ee.height || 0, theme: "measure-triangle-angle", show: !0, style: { pointerEvents: "none", userSelect: "none", cursor: "default" } }), this.htmlLabelPool.add({ text: `${(le * 180 / Math.PI).toFixed(2)}°` }, { id: oe, lon: e.Math.toDegrees(Y.longitude), lat: e.Math.toDegrees(Y.latitude), height: Y.height || 0, theme: "measure-triangle-angle", show: !0, style: { pointerEvents: "none", userSelect: "none", cursor: "default" } });
4139
+ const E = e.Cartesian3.distance(p, v), I = e.Cartesian3.distance(v, f), D = e.Cartesian3.distance(p, f), _ = new e.Cartesian3((p.x + v.x) / 2, (p.y + v.y) / 2, (p.z + v.z) / 2), T = new e.Cartesian3((v.x + f.x) / 2, (v.y + f.y) / 2, (v.z + f.z) / 2), A = new e.Cartesian3((p.x + f.x) / 2, (p.y + f.y) / 2, (p.z + f.z) / 2), S = e.Cartographic.fromCartesian(_), k = e.Cartographic.fromCartesian(T), x = e.Cartographic.fromCartesian(A), $ = "measure_triangle_seg_v", H = "measure_triangle_seg_h", z = "measure_triangle_seg_hyp";
4140
+ this.segmentLabelIds = [$, H, z], this.htmlLabelPool.add({ text: `${E.toFixed(2)} m` }, { id: $, lon: e.Math.toDegrees(S.longitude), lat: e.Math.toDegrees(S.latitude), height: S.height || 0, theme: "measure-triangle-seg", show: !0, style: { pointerEvents: "none", userSelect: "none", cursor: "default" } }), this.htmlLabelPool.add({ text: `${I.toFixed(2)} m` }, { id: H, lon: e.Math.toDegrees(k.longitude), lat: e.Math.toDegrees(k.latitude), height: k.height || 0, theme: "measure-triangle-seg", show: !0, style: { pointerEvents: "none", userSelect: "none", cursor: "default" } }), this.htmlLabelPool.add({ text: `${D.toFixed(2)} m` }, { id: z, lon: e.Math.toDegrees(x.longitude), lat: e.Math.toDegrees(x.latitude), height: x.height || 0, theme: "measure-triangle-seg", show: !0, style: { pointerEvents: "none", userSelect: "none", cursor: "default" } });
4141
+ const G = e.Cartesian3.subtract(f, p, new e.Cartesian3()), B = e.Cartesian3.subtract(v, p, new e.Cartesian3()), K = e.Cartesian3.subtract(v, f, new e.Cartesian3()), X = e.Cartesian3.subtract(p, f, new e.Cartesian3()), se = e.Cartesian3.dot(G, B), pe = Math.sqrt(e.Cartesian3.dot(G, G)) * Math.sqrt(e.Cartesian3.dot(B, B)), ue = e.Cartesian3.dot(K, X), Ce = Math.sqrt(e.Cartesian3.dot(K, K)) * Math.sqrt(e.Cartesian3.dot(X, X)), j = Math.acos(Math.min(Math.max(se / (pe || 1), -1), 1)), le = Math.acos(Math.min(Math.max(ue / (Ce || 1), -1), 1)), ee = e.Cartographic.fromCartesian(p), Y = e.Cartographic.fromCartesian(f), J = "measure_triangle_angle_a", ne = "measure_triangle_angle_b";
4142
+ this.angleLabelIds = [J, ne], this.htmlLabelPool.add({ text: `${(j * 180 / Math.PI).toFixed(2)}°` }, { id: J, lon: e.Math.toDegrees(ee.longitude), lat: e.Math.toDegrees(ee.latitude), height: ee.height || 0, theme: "measure-triangle-angle", show: !0, style: { pointerEvents: "none", userSelect: "none", cursor: "default" } }), this.htmlLabelPool.add({ text: `${(le * 180 / Math.PI).toFixed(2)}°` }, { id: ne, lon: e.Math.toDegrees(Y.longitude), lat: e.Math.toDegrees(Y.latitude), height: Y.height || 0, theme: "measure-triangle-angle", show: !0, style: { pointerEvents: "none", userSelect: "none", cursor: "default" } });
4024
4143
  const me = Math.max(0.01, Math.min(0.5, t.angleMarkerRatio ?? 0.2)), V = Math.min(E, I) * me;
4025
4144
  if (E > 1e-3 && I > 1e-3) {
4026
- const K = e.Cartesian3.normalize(
4145
+ const q = e.Cartesian3.normalize(
4027
4146
  e.Cartesian3.subtract(p, v, new e.Cartesian3()),
4028
4147
  new e.Cartesian3()
4029
- ), ne = e.Cartesian3.normalize(
4148
+ ), oe = e.Cartesian3.normalize(
4030
4149
  e.Cartesian3.subtract(f, v, new e.Cartesian3()),
4031
4150
  new e.Cartesian3()
4032
4151
  ), Z = new e.Cartesian3(
4033
- v.x + K.x * V,
4034
- v.y + K.y * V,
4035
- v.z + K.z * V
4036
- ), k = new e.Cartesian3(
4037
- v.x + ne.x * V,
4038
- v.y + ne.y * V,
4039
- v.z + ne.z * V
4152
+ v.x + q.x * V,
4153
+ v.y + q.y * V,
4154
+ v.z + q.z * V
4155
+ ), O = new e.Cartesian3(
4156
+ v.x + oe.x * V,
4157
+ v.y + oe.y * V,
4158
+ v.z + oe.z * V
4040
4159
  ), U = new e.Cartesian3(
4041
- v.x + K.x * V + ne.x * V,
4042
- v.y + K.y * V + ne.y * V,
4043
- v.z + K.z * V + ne.z * V
4160
+ v.x + q.x * V + oe.x * V,
4161
+ v.y + q.y * V + oe.y * V,
4162
+ v.z + q.z * V + oe.z * V
4044
4163
  ), Q = i.entities.add({
4045
4164
  polyline: {
4046
4165
  positions: [Z, U],
@@ -4048,21 +4167,21 @@ class dt {
4048
4167
  material: C,
4049
4168
  depthFailMaterial: new e.PolylineDashMaterialProperty({ color: b, dashLength: 12, dashPattern: 255 })
4050
4169
  }
4051
- }), Ie = i.entities.add({
4170
+ }), Te = i.entities.add({
4052
4171
  polyline: {
4053
- positions: [k, U],
4172
+ positions: [O, U],
4054
4173
  width: t.width || 3,
4055
4174
  material: C,
4056
4175
  depthFailMaterial: new e.PolylineDashMaterialProperty({ color: b, dashLength: 12, dashPattern: 255 })
4057
4176
  }
4058
4177
  });
4059
- this.angleMarkerEntities.push(Q, Ie);
4178
+ this.angleMarkerEntities.push(Q, Te);
4060
4179
  }
4061
4180
  this.previewLabelId && this.htmlLabelPool && (this.htmlLabelPool.removeByIds([this.previewLabelId]), this.previewLabelId = null);
4062
4181
  const W = {
4063
4182
  entity: this.segmentEntities,
4064
4183
  positions: [p, f, v],
4065
- lengths: { vertical: E, horizontal: I, hypotenuse: S },
4184
+ lengths: { vertical: E, horizontal: I, hypotenuse: D },
4066
4185
  angles: { acuteA: j, acuteB: le },
4067
4186
  clear: () => this.clear()
4068
4187
  };
@@ -4073,7 +4192,7 @@ class dt {
4073
4192
  if (this.positions.length !== 1) return;
4074
4193
  const s = i.scene.pickPosition(n.endPosition);
4075
4194
  if (!s) return;
4076
- const o = e.Cartographic.fromCartesian(this.positions[0]), r = e.Cartographic.fromCartesian(s), l = o.height || 0, c = r.height || 0, d = l <= c ? this.positions[0] : s, u = l > c ? this.positions[0] : s, m = e.Cartographic.fromCartesian(d), g = Math.max(l, c), p = e.Cartesian3.fromDegrees(
4195
+ const o = e.Cartographic.fromCartesian(this.positions[0]), r = e.Cartographic.fromCartesian(s), h = o.height || 0, c = r.height || 0, d = h <= c ? this.positions[0] : s, u = h > c ? this.positions[0] : s, m = e.Cartographic.fromCartesian(d), g = Math.max(h, c), p = e.Cartesian3.fromDegrees(
4077
4196
  this.Cesium.Math.toDegrees(m.longitude),
4078
4197
  this.Cesium.Math.toDegrees(m.latitude),
4079
4198
  g
@@ -4102,7 +4221,7 @@ class dt {
4102
4221
  material: f,
4103
4222
  depthFailMaterial: new e.PolylineDashMaterialProperty({ color: w, dashLength: 12, dashPattern: 255 })
4104
4223
  }
4105
- }), oe = i.entities.add({
4224
+ }), ne = i.entities.add({
4106
4225
  polyline: {
4107
4226
  positions: new e.CallbackProperty(() => !this.previewLow || !this.previewHigh ? [] : [this.previewLow, this.previewHigh], !1),
4108
4227
  width: t.width || 3,
@@ -4110,11 +4229,11 @@ class dt {
4110
4229
  depthFailMaterial: new e.PolylineDashMaterialProperty({ color: w, dashLength: 12, dashPattern: 255 })
4111
4230
  }
4112
4231
  });
4113
- this.previewSegmentEntities.push(Y, J, oe);
4232
+ this.previewSegmentEntities.push(Y, J, ne);
4114
4233
  }
4115
- const y = e.Cartesian3.distance(d, p), v = e.Cartesian3.distance(p, u), C = e.Cartesian3.distance(d, u), b = e.Cartesian3.subtract(u, d, new e.Cartesian3()), M = e.Cartesian3.subtract(p, d, new e.Cartesian3()), P = e.Cartesian3.subtract(p, u, new e.Cartesian3()), L = e.Cartesian3.subtract(d, u, new e.Cartesian3()), E = e.Cartesian3.dot(b, M), I = Math.sqrt(e.Cartesian3.dot(b, b)) * Math.sqrt(e.Cartesian3.dot(M, M)), S = e.Cartesian3.dot(P, L), _ = Math.sqrt(e.Cartesian3.dot(P, P)) * Math.sqrt(e.Cartesian3.dot(L, L)), T = Math.acos(Math.min(Math.max(E / (I || 1), -1), 1)), A = Math.acos(Math.min(Math.max(S / (_ || 1), -1), 1)), D = new e.Cartesian3((d.x + p.x) / 2, (d.y + p.y) / 2, (d.z + p.z) / 2), O = new e.Cartesian3((p.x + u.x) / 2, (p.y + u.y) / 2, (p.z + u.z) / 2), x = new e.Cartesian3((d.x + u.x) / 2, (d.y + u.y) / 2, (d.z + u.z) / 2), $ = e.Cartographic.fromCartesian(D), F = e.Cartographic.fromCartesian(O), z = e.Cartographic.fromCartesian(x), G = e.Cartographic.fromCartesian(d), B = e.Cartographic.fromCartesian(u), q = "measure_triangle_seg_v", X = "measure_triangle_seg_h", se = "measure_triangle_seg_hyp", pe = "measure_triangle_angle_a", ue = "measure_triangle_angle_b";
4116
- this.segmentLabelIds.length === 0 && (this.segmentLabelIds = [q, X, se]), this.angleLabelIds.length === 0 && (this.angleLabelIds = [pe, ue]), this.htmlLabelPool.add({ text: `${y.toFixed(2)} m` }, { id: q, lon: e.Math.toDegrees($.longitude), lat: e.Math.toDegrees($.latitude), height: $.height || 0, theme: "measure-triangle-seg", show: !0, style: { pointerEvents: "none", userSelect: "none", cursor: "default" } }), this.htmlLabelPool.add({ text: `${v.toFixed(2)} m` }, { id: X, lon: e.Math.toDegrees(F.longitude), lat: e.Math.toDegrees(F.latitude), height: F.height || 0, theme: "measure-triangle-seg", show: !0, style: { pointerEvents: "none", userSelect: "none", cursor: "default" } }), this.htmlLabelPool.add({ text: `${C.toFixed(2)} m` }, { id: se, lon: e.Math.toDegrees(z.longitude), lat: e.Math.toDegrees(z.latitude), height: z.height || 0, theme: "measure-triangle-seg", show: !0, style: { pointerEvents: "none", userSelect: "none", cursor: "default" } }), this.htmlLabelPool.add({ text: `${(T * 180 / Math.PI).toFixed(2)}°` }, { id: pe, lon: e.Math.toDegrees(G.longitude), lat: e.Math.toDegrees(G.latitude), height: G.height || 0, theme: "measure-triangle-angle", show: !0, style: { pointerEvents: "none", userSelect: "none", cursor: "default" } }), this.htmlLabelPool.add({ text: `${(A * 180 / Math.PI).toFixed(2)}°` }, { id: ue, lon: e.Math.toDegrees(B.longitude), lat: e.Math.toDegrees(B.latitude), height: B.height || 0, theme: "measure-triangle-angle", show: !0, style: { pointerEvents: "none", userSelect: "none", cursor: "default" } });
4117
- const ve = Math.max(0.01, Math.min(0.5, t.angleMarkerRatio ?? 0.2)), j = Math.min(y, v) * ve;
4234
+ const y = e.Cartesian3.distance(d, p), v = e.Cartesian3.distance(p, u), C = e.Cartesian3.distance(d, u), b = e.Cartesian3.subtract(u, d, new e.Cartesian3()), M = e.Cartesian3.subtract(p, d, new e.Cartesian3()), P = e.Cartesian3.subtract(p, u, new e.Cartesian3()), L = e.Cartesian3.subtract(d, u, new e.Cartesian3()), E = e.Cartesian3.dot(b, M), I = Math.sqrt(e.Cartesian3.dot(b, b)) * Math.sqrt(e.Cartesian3.dot(M, M)), D = e.Cartesian3.dot(P, L), _ = Math.sqrt(e.Cartesian3.dot(P, P)) * Math.sqrt(e.Cartesian3.dot(L, L)), T = Math.acos(Math.min(Math.max(E / (I || 1), -1), 1)), A = Math.acos(Math.min(Math.max(D / (_ || 1), -1), 1)), S = new e.Cartesian3((d.x + p.x) / 2, (d.y + p.y) / 2, (d.z + p.z) / 2), k = new e.Cartesian3((p.x + u.x) / 2, (p.y + u.y) / 2, (p.z + u.z) / 2), x = new e.Cartesian3((d.x + u.x) / 2, (d.y + u.y) / 2, (d.z + u.z) / 2), $ = e.Cartographic.fromCartesian(S), H = e.Cartographic.fromCartesian(k), z = e.Cartographic.fromCartesian(x), G = e.Cartographic.fromCartesian(d), B = e.Cartographic.fromCartesian(u), K = "measure_triangle_seg_v", X = "measure_triangle_seg_h", se = "measure_triangle_seg_hyp", pe = "measure_triangle_angle_a", ue = "measure_triangle_angle_b";
4235
+ this.segmentLabelIds.length === 0 && (this.segmentLabelIds = [K, X, se]), this.angleLabelIds.length === 0 && (this.angleLabelIds = [pe, ue]), this.htmlLabelPool.add({ text: `${y.toFixed(2)} m` }, { id: K, lon: e.Math.toDegrees($.longitude), lat: e.Math.toDegrees($.latitude), height: $.height || 0, theme: "measure-triangle-seg", show: !0, style: { pointerEvents: "none", userSelect: "none", cursor: "default" } }), this.htmlLabelPool.add({ text: `${v.toFixed(2)} m` }, { id: X, lon: e.Math.toDegrees(H.longitude), lat: e.Math.toDegrees(H.latitude), height: H.height || 0, theme: "measure-triangle-seg", show: !0, style: { pointerEvents: "none", userSelect: "none", cursor: "default" } }), this.htmlLabelPool.add({ text: `${C.toFixed(2)} m` }, { id: se, lon: e.Math.toDegrees(z.longitude), lat: e.Math.toDegrees(z.latitude), height: z.height || 0, theme: "measure-triangle-seg", show: !0, style: { pointerEvents: "none", userSelect: "none", cursor: "default" } }), this.htmlLabelPool.add({ text: `${(T * 180 / Math.PI).toFixed(2)}°` }, { id: pe, lon: e.Math.toDegrees(G.longitude), lat: e.Math.toDegrees(G.latitude), height: G.height || 0, theme: "measure-triangle-angle", show: !0, style: { pointerEvents: "none", userSelect: "none", cursor: "default" } }), this.htmlLabelPool.add({ text: `${(A * 180 / Math.PI).toFixed(2)}°` }, { id: ue, lon: e.Math.toDegrees(B.longitude), lat: e.Math.toDegrees(B.latitude), height: B.height || 0, theme: "measure-triangle-angle", show: !0, style: { pointerEvents: "none", userSelect: "none", cursor: "default" } });
4236
+ const Ce = Math.max(0.01, Math.min(0.5, t.angleMarkerRatio ?? 0.2)), j = Math.min(y, v) * Ce;
4118
4237
  if (y > 1e-3 && v > 1e-3) {
4119
4238
  const Y = e.Cartesian3.normalize(
4120
4239
  e.Cartesian3.subtract(d, p, new e.Cartesian3()),
@@ -4122,7 +4241,7 @@ class dt {
4122
4241
  ), J = e.Cartesian3.normalize(
4123
4242
  e.Cartesian3.subtract(u, p, new e.Cartesian3()),
4124
4243
  new e.Cartesian3()
4125
- ), oe = new e.Cartesian3(
4244
+ ), ne = new e.Cartesian3(
4126
4245
  p.x + Y.x * j,
4127
4246
  p.y + Y.y * j,
4128
4247
  p.z + Y.z * j
@@ -4135,7 +4254,7 @@ class dt {
4135
4254
  p.y + Y.y * j + J.y * j,
4136
4255
  p.z + Y.z * j + J.z * j
4137
4256
  );
4138
- if (this.previewMarkerP1 = oe, this.previewMarkerP2 = me, this.previewMarkerCorner = V, !this.previewAngleMarkerEntities.length) {
4257
+ if (this.previewMarkerP1 = ne, this.previewMarkerP2 = me, this.previewMarkerCorner = V, !this.previewAngleMarkerEntities.length) {
4139
4258
  const W = i.entities.add({
4140
4259
  polyline: {
4141
4260
  positions: new e.CallbackProperty(() => !this.previewMarkerP1 || !this.previewMarkerCorner ? [] : [this.previewMarkerP1, this.previewMarkerCorner], !1),
@@ -4143,7 +4262,7 @@ class dt {
4143
4262
  material: f,
4144
4263
  depthFailMaterial: new e.PolylineDashMaterialProperty({ color: w, dashLength: 12, dashPattern: 255 })
4145
4264
  }
4146
- }), K = i.entities.add({
4265
+ }), q = i.entities.add({
4147
4266
  polyline: {
4148
4267
  positions: new e.CallbackProperty(() => !this.previewMarkerP2 || !this.previewMarkerCorner ? [] : [this.previewMarkerP2, this.previewMarkerCorner], !1),
4149
4268
  width: t.width || 3,
@@ -4151,7 +4270,7 @@ class dt {
4151
4270
  depthFailMaterial: new e.PolylineDashMaterialProperty({ color: w, dashLength: 12, dashPattern: 255 })
4152
4271
  }
4153
4272
  });
4154
- this.previewAngleMarkerEntities.push(W, K);
4273
+ this.previewAngleMarkerEntities.push(W, q);
4155
4274
  }
4156
4275
  }
4157
4276
  }, e.ScreenSpaceEventType.MOUSE_MOVE);
@@ -4163,27 +4282,27 @@ class dt {
4163
4282
  this.stop(), this.segmentEntities.forEach((t) => this.viewer.entities.remove(t)), this.segmentEntities = [], this.angleMarkerEntities.forEach((t) => this.viewer.entities.remove(t)), this.angleMarkerEntities = [], this.pointEntities.forEach((t) => this.viewer.entities.remove(t)), this.pointEntities = [], this.previewSegmentEntities.forEach((t) => this.viewer.entities.remove(t)), this.previewSegmentEntities = [], this.previewAngleMarkerEntities.forEach((t) => this.viewer.entities.remove(t)), this.previewAngleMarkerEntities = [], this.previewPointEntity && (this.viewer.entities.remove(this.previewPointEntity), this.previewPointEntity = null), this.htmlLabelPool && this.htmlLabelId && (this.htmlLabelPool.removeByIds([this.htmlLabelId]), this.htmlLabelId = null), this.previewLabelId && this.htmlLabelPool && (this.htmlLabelPool.removeByIds([this.previewLabelId]), this.previewLabelId = null), this.segmentLabelIds.length && this.htmlLabelPool && this.htmlLabelPool.removeByIds(this.segmentLabelIds.slice()), this.angleLabelIds.length && this.htmlLabelPool && this.htmlLabelPool.removeByIds(this.angleLabelIds.slice()), this.segmentLabelIds = [], this.angleLabelIds = [], this.positions = [];
4164
4283
  }
4165
4284
  rehydrate(t, e) {
4166
- var K, ne;
4167
- const i = this.Cesium, n = this.viewer, s = t.options || {}, o = s.lineColor || s.color || i.Color.YELLOW, r = ((ne = (K = s.dashLineColor || s.lineColor || s.color || i.Color.RED).withAlpha) == null ? void 0 : ne.call(K, 0.9)) || i.Color.RED, l = s.width || 3, c = (t.positions || []).map((Z) => new i.Cartesian3(Z[0], Z[1], Z[2]));
4285
+ var q, oe;
4286
+ const i = this.Cesium, n = this.viewer, s = t.options || {}, o = s.lineColor || s.color || i.Color.YELLOW, r = ((oe = (q = s.dashLineColor || s.lineColor || s.color || i.Color.RED).withAlpha) == null ? void 0 : oe.call(q, 0.9)) || i.Color.RED, h = s.width || 3, c = (t.positions || []).map((Z) => new i.Cartesian3(Z[0], Z[1], Z[2]));
4168
4287
  if (c.length < 2) return;
4169
4288
  if (!this.htmlLabelPool) {
4170
4289
  const Z = s.overlayContainerId || "html-label-container";
4171
4290
  this.htmlLabelPool = e || new N(i, n, Z), this.htmlLabelPool.registerTheme("measure-triangle", {
4172
- createElement: (k, U) => {
4291
+ createElement: (O, U) => {
4173
4292
  var Q;
4174
- k.innerHTML = String(((Q = U == null ? void 0 : U.data) == null ? void 0 : Q.text) || ""), k.style.background = "rgba(0,0,0,0.6)", k.style.color = "#fff", k.style.font = "14px sans-serif", k.style.padding = "4px 6px", k.style.borderRadius = "4px", k.style.whiteSpace = "pre";
4293
+ O.innerHTML = String(((Q = U == null ? void 0 : U.data) == null ? void 0 : Q.text) || ""), O.style.background = "rgba(0,0,0,0.6)", O.style.color = "#fff", O.style.font = "14px sans-serif", O.style.padding = "4px 6px", O.style.borderRadius = "4px", O.style.whiteSpace = "pre";
4175
4294
  },
4176
4295
  options: { offset: { x: 0, y: -10 } }
4177
4296
  }), this.htmlLabelPool.registerTheme("measure-triangle-seg", {
4178
- createElement: (k, U) => {
4297
+ createElement: (O, U) => {
4179
4298
  var Q;
4180
- k.innerHTML = String(((Q = U == null ? void 0 : U.data) == null ? void 0 : Q.text) || ""), k.style.background = "rgba(0,0,0,0.6)", k.style.color = "#fff", k.style.font = "14px sans-serif", k.style.padding = "4px 6px", k.style.borderRadius = "4px", k.style.whiteSpace = "pre";
4299
+ O.innerHTML = String(((Q = U == null ? void 0 : U.data) == null ? void 0 : Q.text) || ""), O.style.background = "rgba(0,0,0,0.6)", O.style.color = "#fff", O.style.font = "14px sans-serif", O.style.padding = "4px 6px", O.style.borderRadius = "4px", O.style.whiteSpace = "pre";
4181
4300
  },
4182
4301
  options: { offset: { x: 0, y: -10 } }
4183
4302
  }), this.htmlLabelPool.registerTheme("measure-triangle-angle", {
4184
- createElement: (k, U) => {
4303
+ createElement: (O, U) => {
4185
4304
  var Q;
4186
- k.innerHTML = String(((Q = U == null ? void 0 : U.data) == null ? void 0 : Q.text) || ""), k.style.background = "rgba(0,0,0,0.6)", k.style.color = "#fff", k.style.font = "14px sans-serif", k.style.padding = "4px 6px", k.style.borderRadius = "4px", k.style.whiteSpace = "pre";
4305
+ O.innerHTML = String(((Q = U == null ? void 0 : U.data) == null ? void 0 : Q.text) || ""), O.style.background = "rgba(0,0,0,0.6)", O.style.color = "#fff", O.style.font = "14px sans-serif", O.style.padding = "4px 6px", O.style.borderRadius = "4px", O.style.whiteSpace = "pre";
4187
4306
  },
4188
4307
  options: { offset: { x: 0, y: -10 } }
4189
4308
  });
@@ -4195,38 +4314,38 @@ class dt {
4195
4314
  i.Math.toDegrees(v.latitude),
4196
4315
  C
4197
4316
  ), M = n.entities.add({
4198
- polyline: { positions: [p, b], width: l, material: o, depthFailMaterial: new i.PolylineDashMaterialProperty({ color: r, dashLength: 12, dashPattern: 255 }) }
4317
+ polyline: { positions: [p, b], width: h, material: o, depthFailMaterial: new i.PolylineDashMaterialProperty({ color: r, dashLength: 12, dashPattern: 255 }) }
4199
4318
  }), P = n.entities.add({
4200
- polyline: { positions: [b, f], width: l, material: o, depthFailMaterial: new i.PolylineDashMaterialProperty({ color: r, dashLength: 12, dashPattern: 255 }) }
4319
+ polyline: { positions: [b, f], width: h, material: o, depthFailMaterial: new i.PolylineDashMaterialProperty({ color: r, dashLength: 12, dashPattern: 255 }) }
4201
4320
  }), L = n.entities.add({
4202
- polyline: { positions: [p, f], width: l, material: o, depthFailMaterial: new i.PolylineDashMaterialProperty({ color: r, dashLength: 12, dashPattern: 255 }) }
4321
+ polyline: { positions: [p, f], width: h, material: o, depthFailMaterial: new i.PolylineDashMaterialProperty({ color: r, dashLength: 12, dashPattern: 255 }) }
4203
4322
  });
4204
4323
  this.segmentEntities.push(M, P, L);
4205
- const E = i.Cartesian3.distance(p, b), I = i.Cartesian3.distance(b, f), S = i.Cartesian3.distance(p, f), _ = new i.Cartesian3((p.x + b.x) / 2, (p.y + b.y) / 2, (p.z + b.z) / 2), T = new i.Cartesian3((b.x + f.x) / 2, (b.y + f.y) / 2, (b.z + f.z) / 2), A = new i.Cartesian3((p.x + f.x) / 2, (p.y + f.y) / 2, (p.z + f.z) / 2), D = i.Cartographic.fromCartesian(_), O = i.Cartographic.fromCartesian(T), x = i.Cartographic.fromCartesian(A), $ = t.id + "_tri_v", F = t.id + "_tri_h", z = t.id + "_tri_hyp";
4206
- this.segmentLabelIds = [$, F, z], this.htmlLabelPool.add({ text: `${E.toFixed(2)} m` }, { id: $, lon: i.Math.toDegrees(D.longitude), lat: i.Math.toDegrees(D.latitude), height: D.height || 0, theme: "measure-triangle-seg", show: !0, style: { pointerEvents: "none", userSelect: "none", cursor: "default" } }), this.htmlLabelPool.add({ text: `${I.toFixed(2)} m` }, { id: F, lon: i.Math.toDegrees(O.longitude), lat: i.Math.toDegrees(O.latitude), height: O.height || 0, theme: "measure-triangle-seg", show: !0, style: { pointerEvents: "none", userSelect: "none", cursor: "default" } }), this.htmlLabelPool.add({ text: `${S.toFixed(2)} m` }, { id: z, lon: i.Math.toDegrees(x.longitude), lat: i.Math.toDegrees(x.latitude), height: x.height || 0, theme: "measure-triangle-seg", show: !0, style: { pointerEvents: "none", userSelect: "none", cursor: "default" } });
4207
- const G = i.Cartesian3.subtract(f, p, new i.Cartesian3()), B = i.Cartesian3.subtract(b, p, new i.Cartesian3()), q = i.Cartesian3.subtract(b, f, new i.Cartesian3()), X = i.Cartesian3.subtract(p, f, new i.Cartesian3()), se = i.Cartesian3.dot(G, B), pe = Math.sqrt(i.Cartesian3.dot(G, G)) * Math.sqrt(i.Cartesian3.dot(B, B)), ue = i.Cartesian3.dot(q, X), ve = Math.sqrt(i.Cartesian3.dot(q, q)) * Math.sqrt(i.Cartesian3.dot(X, X)), j = Math.acos(Math.min(Math.max(se / (pe || 1), -1), 1)), le = Math.acos(Math.min(Math.max(ue / (ve || 1), -1), 1)), ee = i.Cartographic.fromCartesian(p), Y = i.Cartographic.fromCartesian(f), J = s.labelText || { angle: "角度" }, oe = t.id + "_tri_angA", me = t.id + "_tri_angB";
4208
- this.angleLabelIds = [oe, me], this.htmlLabelPool.add({ text: `${J.angle}:${(j * 180 / Math.PI).toFixed(2)}°` }, { id: oe, lon: i.Math.toDegrees(ee.longitude), lat: i.Math.toDegrees(ee.latitude), height: ee.height || 0, theme: "measure-triangle-angle", show: !0, style: { pointerEvents: "none", userSelect: "none", cursor: "default" } }), this.htmlLabelPool.add({ text: `${J.angle}:${(le * 180 / Math.PI).toFixed(2)}°` }, { id: me, lon: i.Math.toDegrees(Y.longitude), lat: i.Math.toDegrees(Y.latitude), height: Y.height || 0, theme: "measure-triangle-angle", show: !0, style: { pointerEvents: "none", userSelect: "none", cursor: "default" } });
4324
+ const E = i.Cartesian3.distance(p, b), I = i.Cartesian3.distance(b, f), D = i.Cartesian3.distance(p, f), _ = new i.Cartesian3((p.x + b.x) / 2, (p.y + b.y) / 2, (p.z + b.z) / 2), T = new i.Cartesian3((b.x + f.x) / 2, (b.y + f.y) / 2, (b.z + f.z) / 2), A = new i.Cartesian3((p.x + f.x) / 2, (p.y + f.y) / 2, (p.z + f.z) / 2), S = i.Cartographic.fromCartesian(_), k = i.Cartographic.fromCartesian(T), x = i.Cartographic.fromCartesian(A), $ = t.id + "_tri_v", H = t.id + "_tri_h", z = t.id + "_tri_hyp";
4325
+ this.segmentLabelIds = [$, H, z], this.htmlLabelPool.add({ text: `${E.toFixed(2)} m` }, { id: $, lon: i.Math.toDegrees(S.longitude), lat: i.Math.toDegrees(S.latitude), height: S.height || 0, theme: "measure-triangle-seg", show: !0, style: { pointerEvents: "none", userSelect: "none", cursor: "default" } }), this.htmlLabelPool.add({ text: `${I.toFixed(2)} m` }, { id: H, lon: i.Math.toDegrees(k.longitude), lat: i.Math.toDegrees(k.latitude), height: k.height || 0, theme: "measure-triangle-seg", show: !0, style: { pointerEvents: "none", userSelect: "none", cursor: "default" } }), this.htmlLabelPool.add({ text: `${D.toFixed(2)} m` }, { id: z, lon: i.Math.toDegrees(x.longitude), lat: i.Math.toDegrees(x.latitude), height: x.height || 0, theme: "measure-triangle-seg", show: !0, style: { pointerEvents: "none", userSelect: "none", cursor: "default" } });
4326
+ const G = i.Cartesian3.subtract(f, p, new i.Cartesian3()), B = i.Cartesian3.subtract(b, p, new i.Cartesian3()), K = i.Cartesian3.subtract(b, f, new i.Cartesian3()), X = i.Cartesian3.subtract(p, f, new i.Cartesian3()), se = i.Cartesian3.dot(G, B), pe = Math.sqrt(i.Cartesian3.dot(G, G)) * Math.sqrt(i.Cartesian3.dot(B, B)), ue = i.Cartesian3.dot(K, X), Ce = Math.sqrt(i.Cartesian3.dot(K, K)) * Math.sqrt(i.Cartesian3.dot(X, X)), j = Math.acos(Math.min(Math.max(se / (pe || 1), -1), 1)), le = Math.acos(Math.min(Math.max(ue / (Ce || 1), -1), 1)), ee = i.Cartographic.fromCartesian(p), Y = i.Cartographic.fromCartesian(f), J = s.labelText || { angle: "角度" }, ne = t.id + "_tri_angA", me = t.id + "_tri_angB";
4327
+ this.angleLabelIds = [ne, me], this.htmlLabelPool.add({ text: `${J.angle}:${(j * 180 / Math.PI).toFixed(2)}°` }, { id: ne, lon: i.Math.toDegrees(ee.longitude), lat: i.Math.toDegrees(ee.latitude), height: ee.height || 0, theme: "measure-triangle-angle", show: !0, style: { pointerEvents: "none", userSelect: "none", cursor: "default" } }), this.htmlLabelPool.add({ text: `${J.angle}:${(le * 180 / Math.PI).toFixed(2)}°` }, { id: me, lon: i.Math.toDegrees(Y.longitude), lat: i.Math.toDegrees(Y.latitude), height: Y.height || 0, theme: "measure-triangle-angle", show: !0, style: { pointerEvents: "none", userSelect: "none", cursor: "default" } });
4209
4328
  const V = Math.max(0.01, Math.min(0.5, s.angleMarkerRatio ?? 0.2)), W = Math.min(E, I) * V;
4210
4329
  if (E > 1e-3 && I > 1e-3) {
4211
- const Z = i.Cartesian3.normalize(i.Cartesian3.subtract(p, b, new i.Cartesian3()), new i.Cartesian3()), k = i.Cartesian3.normalize(i.Cartesian3.subtract(f, b, new i.Cartesian3()), new i.Cartesian3()), U = new i.Cartesian3(b.x + Z.x * W, b.y + Z.y * W, b.z + Z.z * W), Q = new i.Cartesian3(b.x + k.x * W, b.y + k.y * W, b.z + k.z * W), Ie = new i.Cartesian3(b.x + Z.x * W + k.x * W, b.y + Z.y * W + k.y * W, b.z + Z.z * W + k.z * W), kt = n.entities.add({ polyline: { positions: [U, Ie], width: l, material: o, depthFailMaterial: new i.PolylineDashMaterialProperty({ color: r, dashLength: 12, dashPattern: 255 }) } }), Ft = n.entities.add({ polyline: { positions: [Q, Ie], width: l, material: o, depthFailMaterial: new i.PolylineDashMaterialProperty({ color: r, dashLength: 12, dashPattern: 255 }) } });
4212
- this.angleMarkerEntities.push(kt, Ft);
4330
+ const Z = i.Cartesian3.normalize(i.Cartesian3.subtract(p, b, new i.Cartesian3()), new i.Cartesian3()), O = i.Cartesian3.normalize(i.Cartesian3.subtract(f, b, new i.Cartesian3()), new i.Cartesian3()), U = new i.Cartesian3(b.x + Z.x * W, b.y + Z.y * W, b.z + Z.z * W), Q = new i.Cartesian3(b.x + O.x * W, b.y + O.y * W, b.z + O.z * W), Te = new i.Cartesian3(b.x + Z.x * W + O.x * W, b.y + Z.y * W + O.y * W, b.z + Z.z * W + O.z * W), Rt = n.entities.add({ polyline: { positions: [U, Te], width: h, material: o, depthFailMaterial: new i.PolylineDashMaterialProperty({ color: r, dashLength: 12, dashPattern: 255 }) } }), zt = n.entities.add({ polyline: { positions: [Q, Te], width: h, material: o, depthFailMaterial: new i.PolylineDashMaterialProperty({ color: r, dashLength: 12, dashPattern: 255 }) } });
4331
+ this.angleMarkerEntities.push(Rt, zt);
4213
4332
  }
4214
4333
  }
4215
4334
  }
4216
- class pt {
4335
+ class yt {
4217
4336
  constructor(t, e) {
4218
- h(this, "Cesium");
4219
- h(this, "viewer");
4220
- h(this, "handler", null);
4221
- h(this, "entity", null);
4222
- h(this, "labelEntity", null);
4223
- h(this, "positions", []);
4224
- h(this, "tempPoints", []);
4225
- h(this, "htmlLabelPool", null);
4226
- h(this, "htmlLabelId", null);
4227
- h(this, "previewEntity", null);
4228
- h(this, "previewPos", null);
4229
- h(this, "previewLabelId", null);
4337
+ l(this, "Cesium");
4338
+ l(this, "viewer");
4339
+ l(this, "handler", null);
4340
+ l(this, "entity", null);
4341
+ l(this, "labelEntity", null);
4342
+ l(this, "positions", []);
4343
+ l(this, "tempPoints", []);
4344
+ l(this, "htmlLabelPool", null);
4345
+ l(this, "htmlLabelId", null);
4346
+ l(this, "previewEntity", null);
4347
+ l(this, "previewPos", null);
4348
+ l(this, "previewLabelId", null);
4230
4349
  this.Cesium = t, this.viewer = e;
4231
4350
  }
4232
4351
  start(t) {
@@ -4243,7 +4362,7 @@ class pt {
4243
4362
  });
4244
4363
  }
4245
4364
  this.handler = new e.ScreenSpaceEventHandler(i.canvas), this.handler.setInputAction((n) => {
4246
- var r, l, c;
4365
+ var r, h, c;
4247
4366
  const s = i.scene.pickPosition(n.position);
4248
4367
  if (!s) return;
4249
4368
  this.positions.push(s);
@@ -4257,7 +4376,7 @@ class pt {
4257
4376
  });
4258
4377
  if (this.tempPoints.push(o), this.positions.length === 2) {
4259
4378
  this.stop(), this.previewEntity && (this.viewer.entities.remove(this.previewEntity), this.previewEntity = null), this.previewLabelId && this.htmlLabelPool && (this.htmlLabelPool.removeByIds([this.previewLabelId]), this.previewLabelId = null);
4260
- const d = this.positions[0], u = this.positions[1], m = t.lineColor || t.color || e.Color.YELLOW, g = ((l = (r = t.dashLineColor || t.lineColor || t.color || e.Color.RED).withAlpha) == null ? void 0 : l.call(r, 0.9)) || e.Color.RED;
4379
+ const d = this.positions[0], u = this.positions[1], m = t.lineColor || t.color || e.Color.YELLOW, g = ((h = (r = t.dashLineColor || t.lineColor || t.color || e.Color.RED).withAlpha) == null ? void 0 : h.call(r, 0.9)) || e.Color.RED;
4261
4380
  this.entity = i.entities.add({
4262
4381
  polyline: {
4263
4382
  positions: [d, u],
@@ -4298,11 +4417,11 @@ class pt {
4298
4417
  const s = i.scene.pickPosition(n.endPosition);
4299
4418
  if (!s) return;
4300
4419
  this.previewPos = s;
4301
- const o = this.positions[0], r = e.Cartesian3.distance(o, s), l = new e.Cartesian3(
4420
+ const o = this.positions[0], r = e.Cartesian3.distance(o, s), h = new e.Cartesian3(
4302
4421
  (o.x + s.x) / 2,
4303
4422
  (o.y + s.y) / 2,
4304
4423
  (o.z + s.z) / 2
4305
- ), c = e.Cartographic.fromCartesian(l), d = this.previewLabelId || "measure_space_preview";
4424
+ ), c = e.Cartographic.fromCartesian(h), d = this.previewLabelId || "measure_space_preview";
4306
4425
  this.previewLabelId = d, this.htmlLabelPool.add(
4307
4426
  { text: `${r.toFixed(2)} m` },
4308
4427
  {
@@ -4338,7 +4457,7 @@ class pt {
4338
4457
  }
4339
4458
  rehydrate(t, e) {
4340
4459
  var d, u;
4341
- const i = this.Cesium, n = this.viewer, s = t.options || {}, o = s.lineColor || s.color || i.Color.YELLOW, r = ((u = (d = s.dashLineColor || s.lineColor || s.color || i.Color.RED).withAlpha) == null ? void 0 : u.call(d, 0.9)) || i.Color.RED, l = s.width || 3, c = (t.positions || []).map((m) => new i.Cartesian3(m[0], m[1], m[2]));
4460
+ const i = this.Cesium, n = this.viewer, s = t.options || {}, o = s.lineColor || s.color || i.Color.YELLOW, r = ((u = (d = s.dashLineColor || s.lineColor || s.color || i.Color.RED).withAlpha) == null ? void 0 : u.call(d, 0.9)) || i.Color.RED, h = s.width || 3, c = (t.positions || []).map((m) => new i.Cartesian3(m[0], m[1], m[2]));
4342
4461
  if (c.length) {
4343
4462
  if (!this.htmlLabelPool) {
4344
4463
  const m = s.overlayContainerId || "html-label-container";
@@ -4359,7 +4478,7 @@ class pt {
4359
4478
  this.tempPoints.push(m), this.entity = n.entities.add({
4360
4479
  polyline: {
4361
4480
  positions: [c[0], c[1]],
4362
- width: l,
4481
+ width: h,
4363
4482
  material: o,
4364
4483
  depthFailMaterial: new i.PolylineDashMaterialProperty({ color: r, dashLength: 12, dashPattern: 255 })
4365
4484
  }
@@ -4378,27 +4497,30 @@ class pt {
4378
4497
  }
4379
4498
  }
4380
4499
  }
4381
- class ut {
4500
+ const ke = class ke {
4382
4501
  constructor(t, e) {
4383
- h(this, "Cesium");
4384
- h(this, "viewer");
4385
- h(this, "handler", null);
4386
- h(this, "entity", null);
4387
- h(this, "labelEntity", null);
4388
- h(this, "positions", []);
4389
- h(this, "tempPoints", []);
4390
- h(this, "primitive", null);
4391
- h(this, "previewEntity", null);
4392
- h(this, "previewPos", null);
4393
- h(this, "edgeEntities", []);
4394
- h(this, "pointEntities", []);
4395
- h(this, "previewEdgeEntity", null);
4396
- h(this, "previewPointEntities", []);
4397
- h(this, "htmlLabelPool", null);
4398
- h(this, "htmlLabelId", null);
4399
- h(this, "previewLabelId", null);
4400
- h(this, "segmentLabelIds", []);
4401
- h(this, "angleLabelIds", []);
4502
+ l(this, "Cesium");
4503
+ l(this, "viewer");
4504
+ l(this, "handler", null);
4505
+ l(this, "entity", null);
4506
+ l(this, "labelEntity", null);
4507
+ l(this, "positions", []);
4508
+ l(this, "tempPoints", []);
4509
+ l(this, "primitive", null);
4510
+ l(this, "previewEntity", null);
4511
+ l(this, "previewPos", null);
4512
+ l(this, "edgeEntities", []);
4513
+ l(this, "pointEntities", []);
4514
+ l(this, "previewEdgeEntity", null);
4515
+ l(this, "previewPointEntities", []);
4516
+ l(this, "htmlLabelPool", null);
4517
+ l(this, "htmlLabelId", null);
4518
+ l(this, "previewLabelId", null);
4519
+ l(this, "segmentLabelIds", []);
4520
+ l(this, "angleLabelIds", []);
4521
+ l(this, "tooltip", null);
4522
+ l(this, "keydownHandler", null);
4523
+ l(this, "contextMenuHandler", null);
4402
4524
  this.Cesium = t, this.viewer = e;
4403
4525
  }
4404
4526
  start(t) {
@@ -4426,7 +4548,7 @@ class ut {
4426
4548
  options: { offset: { x: 0, y: -10 } }
4427
4549
  });
4428
4550
  }
4429
- this.handler = new e.ScreenSpaceEventHandler(i.canvas), this.handler.setInputAction((n) => {
4551
+ this.tooltip = new ye(), this.tooltip.show(ke.TIP_TEXT), this._bindGlobalEvents(t, e, i), this.handler = new e.ScreenSpaceEventHandler(i.canvas), this.handler.setInputAction((n) => {
4430
4552
  var m, g;
4431
4553
  const s = i.scene.pickPosition(n.position);
4432
4554
  if (!s) return;
@@ -4440,12 +4562,12 @@ class ut {
4440
4562
  }
4441
4563
  });
4442
4564
  this.tempPoints.push(o), this.primitive && (i.scene.primitives.remove(this.primitive), this.primitive = null);
4443
- const r = new e.PolygonHierarchy(this.positions.slice()), l = new e.PolygonGeometry({
4565
+ const r = new e.PolygonHierarchy(this.positions.slice()), h = new e.PolygonGeometry({
4444
4566
  polygonHierarchy: r,
4445
4567
  vertexFormat: e.MaterialAppearance.VERTEX_FORMAT,
4446
4568
  perPositionHeight: !0,
4447
4569
  arcType: e.ArcType.NONE
4448
- }), c = new e.GeometryInstance({ geometry: l }), d = t.color || e.Color.YELLOW.withAlpha(0.4), u = t.color && t.color.withAlpha ? t.color.withAlpha(0.25) : e.Color.RED.withAlpha(0.4);
4570
+ }), c = new e.GeometryInstance({ geometry: h }), d = t.color || e.Color.YELLOW.withAlpha(0.4), u = t.color && t.color.withAlpha ? t.color.withAlpha(0.25) : e.Color.RED.withAlpha(0.4);
4449
4571
  if (this.primitive = new e.Primitive({
4450
4572
  geometryInstances: c,
4451
4573
  appearance: new e.MaterialAppearance({
@@ -4553,93 +4675,13 @@ class ut {
4553
4675
  this.previewPointEntities.push(b);
4554
4676
  }
4555
4677
  }, e.ScreenSpaceEventType.MOUSE_MOVE), this.handler.setInputAction(() => {
4556
- var g;
4557
- if (this.positions.length < 3) {
4558
- this.stop();
4559
- return;
4560
- }
4561
- if (this.positions.length >= 3) {
4562
- this.positions.pop();
4563
- const p = this.tempPoints.pop();
4564
- p && this.viewer.entities.remove(p);
4565
- }
4566
- if (this.previewEntity && (this.viewer.entities.remove(this.previewEntity), this.previewEntity = null), this.previewEdgeEntity && (this.viewer.entities.remove(this.previewEdgeEntity), this.previewEdgeEntity = null), this.previewPointEntities.length) {
4567
- for (const p of this.previewPointEntities)
4568
- try {
4569
- this.viewer.entities.remove(p);
4570
- } catch {
4571
- }
4572
- this.previewPointEntities = [];
4573
- }
4574
- this.previewPos = null, this.stop();
4575
- const n = new e.Cartesian3(
4576
- this.positions.reduce((p, f) => p + f.x, 0) / this.positions.length,
4577
- this.positions.reduce((p, f) => p + f.y, 0) / this.positions.length,
4578
- this.positions.reduce((p, f) => p + f.z, 0) / this.positions.length
4579
- ), o = new e.EllipsoidTangentPlane(n, e.Ellipsoid.WGS84).projectPointsOntoPlane(this.positions);
4580
- let r = 0;
4581
- for (let p = 0; p < o.length; p++) {
4582
- const f = (p + 1) % o.length;
4583
- r += o[p].x * o[f].y - o[f].x * o[p].y;
4584
- }
4585
- r = Math.abs(r) / 2;
4586
- const l = e.Cartographic.fromCartesian(n), c = this.htmlLabelId || `measure_area_${Date.now()}`;
4587
- this.htmlLabelId = c;
4588
- const d = t.labelText || { area: "面积", side: "边长", angle: "角度" };
4589
- this.previewLabelId && this.htmlLabelPool && (this.htmlLabelPool.removeByIds([this.previewLabelId]), this.previewLabelId = null), this.htmlLabelPool.add(
4590
- { text: `${d.area}:${r.toFixed(2)} m²` },
4591
- {
4592
- id: c,
4593
- lon: e.Math.toDegrees(l.longitude),
4594
- lat: e.Math.toDegrees(l.latitude),
4595
- height: l.height || 0,
4596
- theme: "measure-area",
4597
- show: !0
4598
- }
4599
- ), this.labelEntity = this.htmlLabelId;
4600
- for (let p = 0; p < this.positions.length; p++) {
4601
- const f = (p + 1) % this.positions.length, w = this.positions[p], y = this.positions[f], v = e.Cartographic.fromCartesian(w), C = e.Cartographic.fromCartesian(y), M = new e.EllipsoidGeodesic(v, C).surfaceDistance, P = new e.Cartesian3((w.x + y.x) / 2, (w.y + y.y) / 2, (w.z + y.z) / 2), L = e.Cartographic.fromCartesian(P), E = `measure_area_seg_${Date.now()}_${p}`;
4602
- this.segmentLabelIds.push(E), this.htmlLabelPool.add(
4603
- { text: `${d.side}:${M.toFixed(2)} m` },
4604
- {
4605
- id: E,
4606
- lon: e.Math.toDegrees(L.longitude),
4607
- lat: e.Math.toDegrees(L.latitude),
4608
- height: L.height || 0,
4609
- theme: "measure-area-seg",
4610
- show: !0
4611
- }
4612
- );
4613
- }
4614
- const u = o;
4615
- for (let p = 0; p < u.length; p++) {
4616
- const f = u[(p - 1 + u.length) % u.length], w = u[p], y = u[(p + 1) % u.length], v = f.x - w.x, C = f.y - w.y, b = y.x - w.x, M = y.y - w.y, P = Math.sqrt(v * v + C * C), L = Math.sqrt(b * b + M * M);
4617
- if (!P || !L) continue;
4618
- const E = v / P * (b / L) + C / P * (M / L), I = Math.acos(Math.min(1, Math.max(-1, E))) * (180 / Math.PI), S = e.Cartographic.fromCartesian(this.positions[p]), _ = `measure_area_angle_${Date.now()}_${p}`;
4619
- this.angleLabelIds.push(_), this.htmlLabelPool.add(
4620
- { text: `${d.angle}:${I.toFixed(2)} °` },
4621
- {
4622
- id: _,
4623
- lon: e.Math.toDegrees(S.longitude),
4624
- lat: e.Math.toDegrees(S.latitude),
4625
- height: S.height || 0,
4626
- theme: "measure-area-angle",
4627
- show: !0
4628
- }
4629
- );
4630
- }
4631
- const m = {
4632
- entity: this.primitive,
4633
- label: this.labelEntity,
4634
- positions: this.positions,
4635
- area: r,
4636
- clear: () => this.clear()
4637
- };
4638
- (g = t.onComplete) == null || g.call(t, m);
4639
- }, e.ScreenSpaceEventType.LEFT_DOUBLE_CLICK);
4678
+ this._finishMeasurement(t, e, !0);
4679
+ }, e.ScreenSpaceEventType.LEFT_DOUBLE_CLICK), this.handler.setInputAction(() => {
4680
+ this._undoLastPoint(t, e, i);
4681
+ }, e.ScreenSpaceEventType.RIGHT_CLICK);
4640
4682
  }
4641
4683
  stop() {
4642
- this.handler && (this.handler.destroy(), this.handler = null);
4684
+ this.keydownHandler && (window.removeEventListener("keydown", this.keydownHandler), this.keydownHandler = null), this.contextMenuHandler && (this.viewer.canvas.removeEventListener("contextmenu", this.contextMenuHandler), this.contextMenuHandler = null), this.handler && (this.handler.destroy(), this.handler = null), this.tooltip && (this.tooltip.destroy(), this.tooltip = null);
4643
4685
  }
4644
4686
  clear() {
4645
4687
  if (this.stop(), this.entity && (this.viewer.entities.remove(this.entity), this.entity = null), this.primitive && (this.viewer.scene.primitives.remove(this.primitive), this.primitive = null), this.edgeEntities.length) {
@@ -4668,6 +4710,154 @@ class ut {
4668
4710
  }
4669
4711
  this.labelEntity && (this.viewer.entities.remove(this.labelEntity), this.labelEntity = null), this.htmlLabelPool && this.htmlLabelId && (this.htmlLabelPool.removeByIds([this.htmlLabelId]), this.htmlLabelId = null), this.previewLabelId && this.htmlLabelPool && (this.htmlLabelPool.removeByIds([this.previewLabelId]), this.previewLabelId = null), this.segmentLabelIds.length && this.htmlLabelPool && this.htmlLabelPool.removeByIds(this.segmentLabelIds.slice()), this.angleLabelIds.length && this.htmlLabelPool && this.htmlLabelPool.removeByIds(this.angleLabelIds.slice()), this.segmentLabelIds = [], this.angleLabelIds = [], this.tempPoints.forEach((t) => this.viewer.entities.remove(t)), this.tempPoints = [], this.positions = [];
4670
4712
  }
4713
+ _clearPreviewState() {
4714
+ if (this.previewEntity && (this.viewer.entities.remove(this.previewEntity), this.previewEntity = null), this.previewEdgeEntity && (this.viewer.entities.remove(this.previewEdgeEntity), this.previewEdgeEntity = null), this.previewPointEntities.length) {
4715
+ for (const t of this.previewPointEntities)
4716
+ try {
4717
+ this.viewer.entities.remove(t);
4718
+ } catch {
4719
+ }
4720
+ this.previewPointEntities = [];
4721
+ }
4722
+ this.previewLabelId && this.htmlLabelPool && (this.htmlLabelPool.removeByIds([this.previewLabelId]), this.previewLabelId = null), this.previewPos = null;
4723
+ }
4724
+ _rebuildShape(t, e, i) {
4725
+ var c, d;
4726
+ if (this.primitive && (i.scene.primitives.remove(this.primitive), this.primitive = null), this.edgeEntities.length) {
4727
+ for (const u of this.edgeEntities)
4728
+ try {
4729
+ i.entities.remove(u);
4730
+ } catch {
4731
+ }
4732
+ this.edgeEntities = [];
4733
+ }
4734
+ if (!this.positions.length) return;
4735
+ const n = new e.PolygonHierarchy(this.positions.slice()), s = new e.PolygonGeometry({
4736
+ polygonHierarchy: n,
4737
+ vertexFormat: e.MaterialAppearance.VERTEX_FORMAT,
4738
+ perPositionHeight: !0,
4739
+ arcType: e.ArcType.NONE
4740
+ }), o = new e.GeometryInstance({ geometry: s }), r = t.color || e.Color.YELLOW.withAlpha(0.4), h = t.color && t.color.withAlpha ? t.color.withAlpha(0.25) : e.Color.RED.withAlpha(0.4);
4741
+ if (this.primitive = new e.Primitive({
4742
+ geometryInstances: o,
4743
+ appearance: new e.MaterialAppearance({
4744
+ material: e.Material.fromType("Color", { color: r }),
4745
+ translucent: !0,
4746
+ closed: !0
4747
+ }),
4748
+ depthFailAppearance: new e.MaterialAppearance({
4749
+ material: e.Material.fromType("Color", { color: h }),
4750
+ translucent: !0,
4751
+ closed: !0
4752
+ })
4753
+ }), i.scene.primitives.add(this.primitive), this.positions.length >= 2) {
4754
+ const u = t.lineColor || t.color || e.Color.YELLOW, m = ((d = (c = t.dashLineColor || t.lineColor || t.color || e.Color.RED).withAlpha) == null ? void 0 : d.call(c, 0.9)) || e.Color.RED, g = this.positions.concat([this.positions[0]]), p = i.entities.add({
4755
+ polyline: {
4756
+ positions: g,
4757
+ width: t.width || 2,
4758
+ material: u,
4759
+ clampToGround: !1,
4760
+ arcType: e.ArcType.NONE,
4761
+ depthFailMaterial: new e.PolylineDashMaterialProperty({
4762
+ color: m,
4763
+ dashLength: 12,
4764
+ dashPattern: 255
4765
+ })
4766
+ }
4767
+ });
4768
+ this.edgeEntities.push(p);
4769
+ }
4770
+ }
4771
+ _undoLastPoint(t, e, i) {
4772
+ if (!this.positions.length) return;
4773
+ this.positions.pop();
4774
+ const n = this.tempPoints.pop();
4775
+ n && i.entities.remove(n), this._clearPreviewState(), this._rebuildShape(t, e, i);
4776
+ }
4777
+ _finishMeasurement(t, e, i) {
4778
+ var g;
4779
+ if (i && this.positions.length >= 3) {
4780
+ this.positions.pop();
4781
+ const p = this.tempPoints.pop();
4782
+ p && this.viewer.entities.remove(p);
4783
+ }
4784
+ if (this.positions.length < 3) {
4785
+ this.clear();
4786
+ return;
4787
+ }
4788
+ this._clearPreviewState(), this.stop();
4789
+ const n = new e.Cartesian3(
4790
+ this.positions.reduce((p, f) => p + f.x, 0) / this.positions.length,
4791
+ this.positions.reduce((p, f) => p + f.y, 0) / this.positions.length,
4792
+ this.positions.reduce((p, f) => p + f.z, 0) / this.positions.length
4793
+ ), o = new e.EllipsoidTangentPlane(n, e.Ellipsoid.WGS84).projectPointsOntoPlane(this.positions);
4794
+ let r = 0;
4795
+ for (let p = 0; p < o.length; p++) {
4796
+ const f = (p + 1) % o.length;
4797
+ r += o[p].x * o[f].y - o[f].x * o[p].y;
4798
+ }
4799
+ r = Math.abs(r) / 2;
4800
+ const h = e.Cartographic.fromCartesian(n), c = this.htmlLabelId || `measure_area_${Date.now()}`;
4801
+ this.htmlLabelId = c;
4802
+ const d = t.labelText || { area: "面积", side: "边长", angle: "角度" };
4803
+ this.htmlLabelPool.add(
4804
+ { text: `${d.area}:${r.toFixed(2)} m²` },
4805
+ {
4806
+ id: c,
4807
+ lon: e.Math.toDegrees(h.longitude),
4808
+ lat: e.Math.toDegrees(h.latitude),
4809
+ height: h.height || 0,
4810
+ theme: "measure-area",
4811
+ show: !0
4812
+ }
4813
+ ), this.labelEntity = this.htmlLabelId;
4814
+ for (let p = 0; p < this.positions.length; p++) {
4815
+ const f = (p + 1) % this.positions.length, w = this.positions[p], y = this.positions[f], v = e.Cartographic.fromCartesian(w), C = e.Cartographic.fromCartesian(y), M = new e.EllipsoidGeodesic(v, C).surfaceDistance, P = new e.Cartesian3((w.x + y.x) / 2, (w.y + y.y) / 2, (w.z + y.z) / 2), L = e.Cartographic.fromCartesian(P), E = `measure_area_seg_${Date.now()}_${p}`;
4816
+ this.segmentLabelIds.push(E), this.htmlLabelPool.add(
4817
+ { text: `${d.side}:${M.toFixed(2)} m` },
4818
+ {
4819
+ id: E,
4820
+ lon: e.Math.toDegrees(L.longitude),
4821
+ lat: e.Math.toDegrees(L.latitude),
4822
+ height: L.height || 0,
4823
+ theme: "measure-area-seg",
4824
+ show: !0
4825
+ }
4826
+ );
4827
+ }
4828
+ const u = o;
4829
+ for (let p = 0; p < u.length; p++) {
4830
+ const f = u[(p - 1 + u.length) % u.length], w = u[p], y = u[(p + 1) % u.length], v = f.x - w.x, C = f.y - w.y, b = y.x - w.x, M = y.y - w.y, P = Math.sqrt(v * v + C * C), L = Math.sqrt(b * b + M * M);
4831
+ if (!P || !L) continue;
4832
+ const E = v / P * (b / L) + C / P * (M / L), I = Math.acos(Math.min(1, Math.max(-1, E))) * (180 / Math.PI), D = e.Cartographic.fromCartesian(this.positions[p]), _ = `measure_area_angle_${Date.now()}_${p}`;
4833
+ this.angleLabelIds.push(_), this.htmlLabelPool.add(
4834
+ { text: `${d.angle}:${I.toFixed(2)} °` },
4835
+ {
4836
+ id: _,
4837
+ lon: e.Math.toDegrees(D.longitude),
4838
+ lat: e.Math.toDegrees(D.latitude),
4839
+ height: D.height || 0,
4840
+ theme: "measure-area-angle",
4841
+ show: !0
4842
+ }
4843
+ );
4844
+ }
4845
+ const m = {
4846
+ entity: this.primitive,
4847
+ label: this.labelEntity,
4848
+ positions: this.positions,
4849
+ area: r,
4850
+ clear: () => this.clear()
4851
+ };
4852
+ (g = t.onComplete) == null || g.call(t, m);
4853
+ }
4854
+ _bindGlobalEvents(t, e, i) {
4855
+ this.keydownHandler = (n) => {
4856
+ n.key === "Escape" && (n.preventDefault(), this._finishMeasurement(t, e, !1));
4857
+ }, window.addEventListener("keydown", this.keydownHandler), this.contextMenuHandler = (n) => {
4858
+ n.preventDefault();
4859
+ }, i.canvas.addEventListener("contextmenu", this.contextMenuHandler);
4860
+ }
4671
4861
  rehydrate(t, e) {
4672
4862
  const i = this.Cesium, n = this.viewer, s = t.options || {}, o = (t.positions || []).map((M) => new i.Cartesian3(M[0], M[1], M[2]));
4673
4863
  if (o.length < 3) return;
@@ -4726,33 +4916,35 @@ class ut {
4726
4916
  });
4727
4917
  n.scene.primitives.add(C), this.primitive = C;
4728
4918
  for (let M = 0; M < o.length; M++) {
4729
- const P = (M + 1) % o.length, L = o[M], E = o[P], I = i.Cartographic.fromCartesian(L), S = i.Cartographic.fromCartesian(E), T = new i.EllipsoidGeodesic(I, S).surfaceDistance, A = new i.Cartesian3((L.x + E.x) / 2, (L.y + E.y) / 2, (L.z + E.z) / 2), D = i.Cartographic.fromCartesian(A), O = t.id + `_area_seg_${M}`;
4730
- this.segmentLabelIds.push(O), this.htmlLabelPool.add({ text: `${g.side}:${T.toFixed(2)} m` }, { id: O, lon: i.Math.toDegrees(D.longitude), lat: i.Math.toDegrees(D.latitude), height: D.height || 0, theme: "measure-area-seg", show: !0 });
4919
+ const P = (M + 1) % o.length, L = o[M], E = o[P], I = i.Cartographic.fromCartesian(L), D = i.Cartographic.fromCartesian(E), T = new i.EllipsoidGeodesic(I, D).surfaceDistance, A = new i.Cartesian3((L.x + E.x) / 2, (L.y + E.y) / 2, (L.z + E.z) / 2), S = i.Cartographic.fromCartesian(A), k = t.id + `_area_seg_${M}`;
4920
+ this.segmentLabelIds.push(k), this.htmlLabelPool.add({ text: `${g.side}:${T.toFixed(2)} m` }, { id: k, lon: i.Math.toDegrees(S.longitude), lat: i.Math.toDegrees(S.latitude), height: S.height || 0, theme: "measure-area-seg", show: !0 });
4731
4921
  }
4732
4922
  const b = c;
4733
4923
  for (let M = 0; M < b.length; M++) {
4734
- const P = b[(M - 1 + b.length) % b.length], L = b[M], E = b[(M + 1) % b.length], I = P.x - L.x, S = P.y - L.y, _ = E.x - L.x, T = E.y - L.y, A = Math.sqrt(I * I + S * S), D = Math.sqrt(_ * _ + T * T);
4735
- if (!A || !D) continue;
4736
- const O = I / A * (_ / D) + S / A * (T / D), x = Math.acos(Math.min(1, Math.max(-1, O))) * (180 / Math.PI), $ = i.Cartographic.fromCartesian(o[M]), F = t.id + `_area_angle_${M}`;
4737
- this.angleLabelIds.push(F), this.htmlLabelPool.add({ text: `${g.angle}:${x.toFixed(2)} °` }, { id: F, lon: i.Math.toDegrees($.longitude), lat: i.Math.toDegrees($.latitude), height: $.height || 0, theme: "measure-area-angle", show: !0 });
4924
+ const P = b[(M - 1 + b.length) % b.length], L = b[M], E = b[(M + 1) % b.length], I = P.x - L.x, D = P.y - L.y, _ = E.x - L.x, T = E.y - L.y, A = Math.sqrt(I * I + D * D), S = Math.sqrt(_ * _ + T * T);
4925
+ if (!A || !S) continue;
4926
+ const k = I / A * (_ / S) + D / A * (T / S), x = Math.acos(Math.min(1, Math.max(-1, k))) * (180 / Math.PI), $ = i.Cartographic.fromCartesian(o[M]), H = t.id + `_area_angle_${M}`;
4927
+ this.angleLabelIds.push(H), this.htmlLabelPool.add({ text: `${g.angle}:${x.toFixed(2)} °` }, { id: H, lon: i.Math.toDegrees($.longitude), lat: i.Math.toDegrees($.latitude), height: $.height || 0, theme: "measure-area-angle", show: !0 });
4738
4928
  }
4739
4929
  }
4740
- }
4741
- class mt {
4930
+ };
4931
+ l(ke, "TIP_TEXT", "单击左键添加点,右键撤销,双击左键或Esc结束");
4932
+ let Se = ke;
4933
+ class wt {
4742
4934
  constructor(t, e) {
4743
- h(this, "Cesium");
4744
- h(this, "viewer");
4745
- h(this, "handler", null);
4746
- h(this, "entity", null);
4747
- h(this, "positions", []);
4748
- h(this, "currentRadius", 0);
4749
- h(this, "labelEntity", null);
4750
- h(this, "previewLabel", null);
4751
- h(this, "ellipsePrimitive", null);
4752
- h(this, "previewEntity", null);
4753
- h(this, "isPrimitive", !1);
4754
- h(this, "htmlLabelPool", null);
4755
- h(this, "htmlLabelId", null);
4935
+ l(this, "Cesium");
4936
+ l(this, "viewer");
4937
+ l(this, "handler", null);
4938
+ l(this, "entity", null);
4939
+ l(this, "positions", []);
4940
+ l(this, "currentRadius", 0);
4941
+ l(this, "labelEntity", null);
4942
+ l(this, "previewLabel", null);
4943
+ l(this, "ellipsePrimitive", null);
4944
+ l(this, "previewEntity", null);
4945
+ l(this, "isPrimitive", !1);
4946
+ l(this, "htmlLabelPool", null);
4947
+ l(this, "htmlLabelId", null);
4756
4948
  this.Cesium = t, this.viewer = e;
4757
4949
  }
4758
4950
  start(t) {
@@ -4762,8 +4954,8 @@ class mt {
4762
4954
  const n = t.overlayContainerId || "html-label-container";
4763
4955
  this.htmlLabelPool = new N(e, i, n), this.htmlLabelPool.registerTheme("measure-circle", {
4764
4956
  createElement: (s, o) => {
4765
- var l;
4766
- const r = ((l = o == null ? void 0 : o.data) == null ? void 0 : l.text) || "";
4957
+ var h;
4958
+ const r = ((h = o == null ? void 0 : o.data) == null ? void 0 : h.text) || "";
4767
4959
  s.innerHTML = String(r), s.style.background = "rgba(0,0,0,0.6)", s.style.color = "#fff", s.style.font = "14px sans-serif", s.style.padding = "4px 6px", s.style.borderRadius = "4px", s.style.whiteSpace = "pre";
4768
4960
  },
4769
4961
  options: { offset: { x: 0, y: -10 } }
@@ -4774,7 +4966,7 @@ class mt {
4774
4966
  const s = i.scene.pickPosition(n.position);
4775
4967
  if (s && (this.positions.push(s), this.positions.length === 2)) {
4776
4968
  this.stop();
4777
- const r = this.positions[0], l = this.positions[1], c = e.Cartesian3.distance(r, l), d = Math.PI * c * c, u = 2 * Math.PI * c, m = t.labelText || { radius: "半径", area: "面积", circumference: "周长" }, g = r;
4969
+ const r = this.positions[0], h = this.positions[1], c = e.Cartesian3.distance(r, h), d = Math.PI * c * c, u = 2 * Math.PI * c, m = t.labelText || { radius: "半径", area: "面积", circumference: "周长" }, g = r;
4778
4970
  this.labelEntity ? (this.labelEntity.position = g, this.labelEntity.label.text = `${m.radius}:${c.toFixed(2)} m
4779
4971
  ${m.area}:${d.toFixed(2)} m²
4780
4972
  ${m.circumference}:${u.toFixed(2)} m`) : this.labelEntity = i.entities.add({
@@ -4838,15 +5030,15 @@ ${m.circumference}:${u.toFixed(2)} m`;
4838
5030
  if (this.positions.length !== 1) return;
4839
5031
  const s = this.positions[0], o = i.camera.getPickRay(n.endPosition), r = i.scene.globe.pick(o, i.scene);
4840
5032
  if (!r) return;
4841
- const l = e.Cartesian3.distance(s, r);
4842
- this.currentRadius = l;
4843
- const c = e.Cartographic.fromCartesian(s), d = Math.PI * l * l, u = 2 * Math.PI * l, m = t.labelText || { radius: "半径", area: "面积", circumference: "周长" }, g = s;
4844
- this.labelEntity ? (this.labelEntity.position = g, this.labelEntity.label.text = `${m.radius}:${l.toFixed(2)} m
5033
+ const h = e.Cartesian3.distance(s, r);
5034
+ this.currentRadius = h;
5035
+ const c = e.Cartographic.fromCartesian(s), d = Math.PI * h * h, u = 2 * Math.PI * h, m = t.labelText || { radius: "半径", area: "面积", circumference: "周长" }, g = s;
5036
+ this.labelEntity ? (this.labelEntity.position = g, this.labelEntity.label.text = `${m.radius}:${h.toFixed(2)} m
4845
5037
  ${m.area}:${d.toFixed(2)} m²
4846
5038
  ${m.circumference}:${u.toFixed(2)} m`) : this.labelEntity = i.entities.add({
4847
5039
  position: g,
4848
5040
  label: {
4849
- text: `${m.radius}:${l.toFixed(2)} m
5041
+ text: `${m.radius}:${h.toFixed(2)} m
4850
5042
  ${m.area}:${d.toFixed(2)} m²
4851
5043
  ${m.circumference}:${u.toFixed(2)} m`,
4852
5044
  font: "14px sans-serif",
@@ -4865,7 +5057,7 @@ ${m.circumference}:${u.toFixed(2)} m`,
4865
5057
  });
4866
5058
  const p = e.Cartographic.fromCartesian(s), f = e.Math.toDegrees(p.longitude), w = e.Math.toDegrees(p.latitude), y = p.height || 0, v = this.htmlLabelId || `measure_circle_${Date.now()}`;
4867
5059
  this.htmlLabelId = v;
4868
- const C = `${m.radius}:${l.toFixed(2)} m
5060
+ const C = `${m.radius}:${h.toFixed(2)} m
4869
5061
  ${m.area}:${d.toFixed(2)} m²
4870
5062
  ${m.circumference}:${u.toFixed(2)} m`;
4871
5063
  if (this.htmlLabelPool.add({ text: C }, { id: v, lon: f, lat: w, height: y, theme: "measure-circle", show: !0 }), !this.previewEntity) {
@@ -4895,14 +5087,14 @@ ${m.circumference}:${u.toFixed(2)} m`;
4895
5087
  const P = s.overlayContainerId || "html-label-container";
4896
5088
  this.htmlLabelPool = e || new N(i, n, P), this.htmlLabelPool.registerTheme("measure-circle", {
4897
5089
  createElement: (L, E) => {
4898
- var S;
4899
- const I = ((S = E == null ? void 0 : E.data) == null ? void 0 : S.text) || "";
5090
+ var D;
5091
+ const I = ((D = E == null ? void 0 : E.data) == null ? void 0 : D.text) || "";
4900
5092
  L.innerHTML = String(I), L.style.background = "rgba(0,0,0,0.6)", L.style.color = "#fff", L.style.font = "14px sans-serif", L.style.padding = "4px 6px", L.style.borderRadius = "4px", L.style.whiteSpace = "pre";
4901
5093
  },
4902
5094
  options: { offset: { x: 0, y: -10 } }
4903
5095
  });
4904
5096
  }
4905
- const r = o[0], l = o[1], c = i.Cartesian3.distance(r, l), d = Math.PI * c * c, u = 2 * Math.PI * c, m = i.Cartographic.fromCartesian(r), g = new i.EllipseGeometry({ center: r, semiMajorAxis: c, semiMinorAxis: c, height: m.height || 0, vertexFormat: i.MaterialAppearance.VERTEX_FORMAT }), p = new i.GeometryInstance({ geometry: g }), f = s.color || i.Color.YELLOW.withAlpha(0.5), w = s.color && s.color.withAlpha ? s.color.withAlpha(0.25) : i.Color.RED.withAlpha(0.4), y = new i.Primitive({
5097
+ const r = o[0], h = o[1], c = i.Cartesian3.distance(r, h), d = Math.PI * c * c, u = 2 * Math.PI * c, m = i.Cartographic.fromCartesian(r), g = new i.EllipseGeometry({ center: r, semiMajorAxis: c, semiMinorAxis: c, height: m.height || 0, vertexFormat: i.MaterialAppearance.VERTEX_FORMAT }), p = new i.GeometryInstance({ geometry: g }), f = s.color || i.Color.YELLOW.withAlpha(0.5), w = s.color && s.color.withAlpha ? s.color.withAlpha(0.25) : i.Color.RED.withAlpha(0.4), y = new i.Primitive({
4906
5098
  geometryInstances: p,
4907
5099
  appearance: new i.MaterialAppearance({ material: i.Material.fromType("Color", { color: f }), translucent: !0, closed: !0 }),
4908
5100
  depthFailAppearance: new i.MaterialAppearance({ material: i.Material.fromType("Color", { color: w }), translucent: !0, closed: !0 })
@@ -4916,24 +5108,27 @@ ${b.circumference}:${u.toFixed(2)} m`;
4916
5108
  this.htmlLabelPool.add({ text: M }, { id: C, lon: i.Math.toDegrees(v.longitude), lat: i.Math.toDegrees(v.latitude), height: v.height || 0, theme: "measure-circle", show: !0 });
4917
5109
  }
4918
5110
  }
4919
- class gt {
5111
+ const Oe = class Oe {
4920
5112
  constructor(t, e) {
4921
- h(this, "Cesium");
4922
- h(this, "viewer");
4923
- h(this, "handler", null);
4924
- h(this, "entity", null);
4925
- h(this, "labelEntity", null);
4926
- h(this, "positions", []);
4927
- h(this, "tempPoints", []);
4928
- h(this, "segmentLabels", []);
4929
- h(this, "hoverPos", null);
4930
- h(this, "previewPos", null);
4931
- h(this, "previewLabel", null);
4932
- h(this, "previewEntity", null);
4933
- h(this, "htmlLabelPool", null);
4934
- h(this, "totalLabelId", null);
4935
- h(this, "segmentLabelIds", []);
4936
- h(this, "previewLabelId", null);
5113
+ l(this, "Cesium");
5114
+ l(this, "viewer");
5115
+ l(this, "handler", null);
5116
+ l(this, "entity", null);
5117
+ l(this, "labelEntity", null);
5118
+ l(this, "positions", []);
5119
+ l(this, "tempPoints", []);
5120
+ l(this, "segmentLabels", []);
5121
+ l(this, "hoverPos", null);
5122
+ l(this, "previewPos", null);
5123
+ l(this, "previewLabel", null);
5124
+ l(this, "previewEntity", null);
5125
+ l(this, "htmlLabelPool", null);
5126
+ l(this, "totalLabelId", null);
5127
+ l(this, "segmentLabelIds", []);
5128
+ l(this, "previewLabelId", null);
5129
+ l(this, "tooltip", null);
5130
+ l(this, "keydownHandler", null);
5131
+ l(this, "contextMenuHandler", null);
4937
5132
  this.Cesium = t, this.viewer = e;
4938
5133
  }
4939
5134
  start(t) {
@@ -4955,8 +5150,8 @@ class gt {
4955
5150
  options: { offset: { x: 0, y: -10 } }
4956
5151
  });
4957
5152
  }
4958
- this.handler = new e.ScreenSpaceEventHandler(i.canvas), this.handler.setInputAction((n) => {
4959
- var r, l;
5153
+ this.tooltip = new ye(), this.tooltip.show(Oe.TIP_TEXT), this._bindGlobalEvents(t, e, i), this.handler = new e.ScreenSpaceEventHandler(i.canvas), this.handler.setInputAction((n) => {
5154
+ var r, h;
4960
5155
  const s = i.scene.pickPosition(n.position);
4961
5156
  if (!s) return;
4962
5157
  this.positions.push(s);
@@ -4974,7 +5169,7 @@ class gt {
4974
5169
  width: t.width || 3,
4975
5170
  material: t.lineColor || t.color || e.Color.YELLOW,
4976
5171
  depthFailMaterial: new e.PolylineDashMaterialProperty({
4977
- color: ((l = (r = t.dashLineColor || t.lineColor || t.color || e.Color.RED).withAlpha) == null ? void 0 : l.call(r, 0.9)) || e.Color.RED,
5172
+ color: ((h = (r = t.dashLineColor || t.lineColor || t.color || e.Color.RED).withAlpha) == null ? void 0 : h.call(r, 0.9)) || e.Color.RED,
4978
5173
  dashLength: 12,
4979
5174
  dashPattern: 255
4980
5175
  })
@@ -4998,55 +5193,16 @@ class gt {
4998
5193
  );
4999
5194
  }
5000
5195
  }, e.ScreenSpaceEventType.LEFT_CLICK), this.handler.setInputAction(() => {
5001
- var c;
5002
- if (this.positions.length < 2) {
5003
- this.stop();
5004
- return;
5005
- }
5006
- if (this.stop(), this.previewLabelId && (this.htmlLabelPool.removeByIds([this.previewLabelId]), this.previewLabelId = null), this.hoverPos && (this.hoverPos = null), this.previewEntity && (this.viewer.entities.remove(this.previewEntity), this.previewEntity = null), this.positions.length >= 2 && this.tempPoints.length >= 2) {
5007
- const d = this.tempPoints[this.tempPoints.length - 1];
5008
- this.viewer.entities.remove(d), this.tempPoints.pop();
5009
- }
5010
- if (this.segmentLabelIds.length >= 1) {
5011
- const d = this.segmentLabelIds[this.segmentLabelIds.length - 1];
5012
- d && (this.htmlLabelPool.removeByIds([d]), this.segmentLabelIds.pop());
5013
- }
5014
- this.positions.length >= 2 && this.positions.pop();
5015
- let n = 0;
5016
- for (let d = 1; d < this.positions.length; d++) {
5017
- const u = this.positions[d - 1], m = this.positions[d], g = e.Cartographic.fromCartesian(u), p = e.Cartographic.fromCartesian(m), w = new e.EllipsoidGeodesic(g, p).surfaceDistance;
5018
- n += w;
5019
- }
5020
- const s = this.positions[this.positions.length - 1];
5021
- this.entity && this.entity.polyline && (this.entity.polyline.positions = this.positions);
5022
- const o = e.Cartographic.fromCartesian(s), r = this.totalLabelId || `measure_polyline_total_${Date.now()}`;
5023
- this.totalLabelId = r, this.htmlLabelPool.add(
5024
- { text: `${n.toFixed(2)} m` },
5025
- {
5026
- id: r,
5027
- lon: e.Math.toDegrees(o.longitude),
5028
- lat: e.Math.toDegrees(o.latitude),
5029
- height: o.height || 0,
5030
- theme: "measure-polyline-total",
5031
- show: !0
5032
- }
5033
- ), this.labelEntity = this.totalLabelId;
5034
- const l = {
5035
- entity: this.entity,
5036
- label: this.labelEntity,
5037
- segmentLabels: this.segmentLabelIds,
5038
- positions: this.positions,
5039
- distance: n,
5040
- clear: () => this.clear()
5041
- };
5042
- (c = t.onComplete) == null || c.call(t, l);
5043
- }, e.ScreenSpaceEventType.LEFT_DOUBLE_CLICK), this.handler.setInputAction((n) => {
5196
+ this._finishMeasurement(t, e, !0);
5197
+ }, e.ScreenSpaceEventType.LEFT_DOUBLE_CLICK), this.handler.setInputAction(() => {
5198
+ this._undoLastPoint();
5199
+ }, e.ScreenSpaceEventType.RIGHT_CLICK), this.handler.setInputAction((n) => {
5044
5200
  var p, f;
5045
5201
  if (this.positions.length === 0) return;
5046
5202
  const s = i.scene.pickPosition(n.endPosition);
5047
5203
  if (!s) return;
5048
5204
  this.hoverPos = s, this.previewPos = s;
5049
- const o = this.positions[this.positions.length - 1], r = e.Cartographic.fromCartesian(o), l = e.Cartographic.fromCartesian(s), d = new e.EllipsoidGeodesic(r, l).surfaceDistance, u = new e.Cartesian3(
5205
+ const o = this.positions[this.positions.length - 1], r = e.Cartographic.fromCartesian(o), h = e.Cartographic.fromCartesian(s), d = new e.EllipsoidGeodesic(r, h).surfaceDistance, u = new e.Cartesian3(
5050
5206
  (o.x + s.x) / 2,
5051
5207
  (o.y + s.y) / 2,
5052
5208
  (o.z + s.z) / 2
@@ -5076,14 +5232,82 @@ class gt {
5076
5232
  }, e.ScreenSpaceEventType.MOUSE_MOVE);
5077
5233
  }
5078
5234
  stop() {
5079
- this.handler && (this.handler.destroy(), this.handler = null);
5235
+ this.keydownHandler && (window.removeEventListener("keydown", this.keydownHandler), this.keydownHandler = null), this.contextMenuHandler && (this.viewer.canvas.removeEventListener("contextmenu", this.contextMenuHandler), this.contextMenuHandler = null), this.handler && (this.handler.destroy(), this.handler = null), this.tooltip && (this.tooltip.destroy(), this.tooltip = null);
5080
5236
  }
5081
5237
  clear() {
5082
5238
  this.stop(), this.entity && (this.viewer.entities.remove(this.entity), this.entity = null), this.totalLabelId && this.htmlLabelPool && (this.htmlLabelPool.removeByIds([this.totalLabelId]), this.totalLabelId = null), this.previewEntity && (this.viewer.entities.remove(this.previewEntity), this.previewEntity = null), this.previewLabelId && this.htmlLabelPool && (this.htmlLabelPool.removeByIds([this.previewLabelId]), this.previewLabelId = null), this.hoverPos = null, this.segmentLabelIds.length && this.htmlLabelPool && this.htmlLabelPool.removeByIds(this.segmentLabelIds.slice()), this.segmentLabelIds = [], this.tempPoints.forEach((t) => this.viewer.entities.remove(t)), this.tempPoints = [], this.positions = [];
5083
5239
  }
5240
+ _clearPreviewState() {
5241
+ this.previewEntity && (this.viewer.entities.remove(this.previewEntity), this.previewEntity = null), this.previewLabelId && this.htmlLabelPool && (this.htmlLabelPool.removeByIds([this.previewLabelId]), this.previewLabelId = null), this.previewPos = null, this.hoverPos = null;
5242
+ }
5243
+ _undoLastPoint() {
5244
+ var e;
5245
+ if (!this.positions.length) return;
5246
+ this.positions.pop();
5247
+ const t = this.tempPoints.pop();
5248
+ if (t && this.viewer.entities.remove(t), this.segmentLabelIds.length > this.positions.length - 1 && this.htmlLabelPool) {
5249
+ const i = this.segmentLabelIds.pop();
5250
+ i && this.htmlLabelPool.removeByIds([i]);
5251
+ }
5252
+ (e = this.entity) != null && e.polyline && (this.entity.polyline.positions = this.positions.slice()), this.positions.length ? this.previewLabelId && this.htmlLabelPool && (this.htmlLabelPool.removeByIds([this.previewLabelId]), this.previewLabelId = null) : (this.entity && (this.viewer.entities.remove(this.entity), this.entity = null), this._clearPreviewState());
5253
+ }
5254
+ _finishMeasurement(t, e, i) {
5255
+ var c;
5256
+ if (i) {
5257
+ if (this.positions.length >= 2 && this.tempPoints.length >= 2) {
5258
+ const d = this.tempPoints[this.tempPoints.length - 1];
5259
+ this.viewer.entities.remove(d), this.tempPoints.pop();
5260
+ }
5261
+ if (this.segmentLabelIds.length >= 1) {
5262
+ const d = this.segmentLabelIds[this.segmentLabelIds.length - 1];
5263
+ d && (this.htmlLabelPool.removeByIds([d]), this.segmentLabelIds.pop());
5264
+ }
5265
+ this.positions.length >= 2 && this.positions.pop();
5266
+ }
5267
+ if (this.positions.length < 2) {
5268
+ this.clear();
5269
+ return;
5270
+ }
5271
+ this.stop(), this._clearPreviewState();
5272
+ let n = 0;
5273
+ for (let d = 1; d < this.positions.length; d++) {
5274
+ const u = this.positions[d - 1], m = this.positions[d], g = e.Cartographic.fromCartesian(u), p = e.Cartographic.fromCartesian(m), f = new e.EllipsoidGeodesic(g, p);
5275
+ n += f.surfaceDistance;
5276
+ }
5277
+ const s = this.positions[this.positions.length - 1];
5278
+ this.entity && this.entity.polyline && (this.entity.polyline.positions = this.positions);
5279
+ const o = e.Cartographic.fromCartesian(s), r = this.totalLabelId || `measure_polyline_total_${Date.now()}`;
5280
+ this.totalLabelId = r, this.htmlLabelPool.add(
5281
+ { text: `${n.toFixed(2)} m` },
5282
+ {
5283
+ id: r,
5284
+ lon: e.Math.toDegrees(o.longitude),
5285
+ lat: e.Math.toDegrees(o.latitude),
5286
+ height: o.height || 0,
5287
+ theme: "measure-polyline-total",
5288
+ show: !0
5289
+ }
5290
+ ), this.labelEntity = this.totalLabelId;
5291
+ const h = {
5292
+ entity: this.entity,
5293
+ label: this.labelEntity,
5294
+ segmentLabels: this.segmentLabelIds,
5295
+ positions: this.positions,
5296
+ distance: n,
5297
+ clear: () => this.clear()
5298
+ };
5299
+ (c = t.onComplete) == null || c.call(t, h);
5300
+ }
5301
+ _bindGlobalEvents(t, e, i) {
5302
+ this.keydownHandler = (n) => {
5303
+ n.key === "Escape" && (n.preventDefault(), this._finishMeasurement(t, e, !1));
5304
+ }, window.addEventListener("keydown", this.keydownHandler), this.contextMenuHandler = (n) => {
5305
+ n.preventDefault();
5306
+ }, i.canvas.addEventListener("contextmenu", this.contextMenuHandler);
5307
+ }
5084
5308
  rehydrate(t, e) {
5085
5309
  var p, f;
5086
- const i = this.Cesium, n = this.viewer, s = t.options || {}, o = s.lineColor || s.color || i.Color.YELLOW, r = ((f = (p = s.dashLineColor || s.lineColor || s.color || i.Color.RED).withAlpha) == null ? void 0 : f.call(p, 0.9)) || i.Color.RED, l = s.width || 3, c = (t.positions || []).map((w) => new i.Cartesian3(w[0], w[1], w[2]));
5310
+ const i = this.Cesium, n = this.viewer, s = t.options || {}, o = s.lineColor || s.color || i.Color.YELLOW, r = ((f = (p = s.dashLineColor || s.lineColor || s.color || i.Color.RED).withAlpha) == null ? void 0 : f.call(p, 0.9)) || i.Color.RED, h = s.width || 3, c = (t.positions || []).map((w) => new i.Cartesian3(w[0], w[1], w[2]));
5087
5311
  if (c.length < 2) return;
5088
5312
  if (!this.htmlLabelPool) {
5089
5313
  const w = s.overlayContainerId || "html-label-container";
@@ -5105,7 +5329,7 @@ class gt {
5105
5329
  const y = n.entities.add({ position: w, point: { pixelSize: 8, color: s.pointColor || s.color || i.Color.YELLOW, disableDepthTestDistance: Number.POSITIVE_INFINITY } });
5106
5330
  this.tempPoints.push(y);
5107
5331
  }
5108
- this.entity = n.entities.add({ polyline: { positions: c, width: l, material: o, depthFailMaterial: new i.PolylineDashMaterialProperty({ color: r, dashLength: 12, dashPattern: 255 }) } });
5332
+ this.entity = n.entities.add({ polyline: { positions: c, width: h, material: o, depthFailMaterial: new i.PolylineDashMaterialProperty({ color: r, dashLength: 12, dashPattern: 255 }) } });
5109
5333
  let d = 0;
5110
5334
  for (let w = 1; w < c.length; w++) {
5111
5335
  const y = i.Cartographic.fromCartesian(c[w - 1]), v = i.Cartographic.fromCartesian(c[w]), C = new i.EllipsoidGeodesic(y, v);
@@ -5132,18 +5356,20 @@ class gt {
5132
5356
  style: { pointerEvents: "none", userSelect: "none", cursor: "default" }
5133
5357
  });
5134
5358
  }
5135
- }
5136
- class ft {
5359
+ };
5360
+ l(Oe, "TIP_TEXT", "单击左键添加点,右键撤销,双击左键或Esc结束");
5361
+ let Ae = Oe;
5362
+ class vt {
5137
5363
  constructor(t, e) {
5138
- h(this, "Cesium");
5139
- h(this, "viewer");
5140
- h(this, "handler", null);
5141
- h(this, "labelEntity", null);
5142
- h(this, "htmlLabelPool", null);
5143
- h(this, "htmlLabelId", null);
5144
- h(this, "topPoint", null);
5145
- h(this, "zeroPoint", null);
5146
- h(this, "lineEntity", null);
5364
+ l(this, "Cesium");
5365
+ l(this, "viewer");
5366
+ l(this, "handler", null);
5367
+ l(this, "labelEntity", null);
5368
+ l(this, "htmlLabelPool", null);
5369
+ l(this, "htmlLabelId", null);
5370
+ l(this, "topPoint", null);
5371
+ l(this, "zeroPoint", null);
5372
+ l(this, "lineEntity", null);
5147
5373
  this.Cesium = t, this.viewer = e;
5148
5374
  }
5149
5375
  start(t) {
@@ -5165,7 +5391,7 @@ class ft {
5165
5391
  if (!s) return;
5166
5392
  const o = e.Cartographic.fromCartesian(s), r = i.scene.globe.getHeight(
5167
5393
  new e.Cartographic(o.longitude, o.latitude, 0)
5168
- ) || 0, l = e.Math.toDegrees(o.longitude), c = e.Math.toDegrees(o.latitude), d = e.Cartesian3.fromDegrees(l, c, r);
5394
+ ) || 0, h = e.Math.toDegrees(o.longitude), c = e.Math.toDegrees(o.latitude), d = e.Cartesian3.fromDegrees(h, c, r);
5169
5395
  this.topPoint = i.entities.add({
5170
5396
  position: s,
5171
5397
  point: {
@@ -5197,7 +5423,7 @@ class ft {
5197
5423
  { text: g },
5198
5424
  {
5199
5425
  id: p,
5200
- lon: l,
5426
+ lon: h,
5201
5427
  lat: c,
5202
5428
  height: o.height || 0,
5203
5429
  theme: "measure-terrainHeight",
@@ -5239,21 +5465,21 @@ class ft {
5239
5465
  options: { offset: { x: 0, y: -10 } }
5240
5466
  });
5241
5467
  }
5242
- const r = o[0], l = i.Cartographic.fromCartesian(r), c = n.scene.globe.getHeight(new i.Cartographic(l.longitude, l.latitude, 0)) || 0, d = i.Math.toDegrees(l.longitude), u = i.Math.toDegrees(l.latitude), m = i.Cartesian3.fromDegrees(d, u, c);
5468
+ const r = o[0], h = i.Cartographic.fromCartesian(r), c = n.scene.globe.getHeight(new i.Cartographic(h.longitude, h.latitude, 0)) || 0, d = i.Math.toDegrees(h.longitude), u = i.Math.toDegrees(h.latitude), m = i.Cartesian3.fromDegrees(d, u, c);
5243
5469
  this.topPoint = n.entities.add({ position: r, point: { pixelSize: 8, color: s.color || i.Color.YELLOW, disableDepthTestDistance: Number.POSITIVE_INFINITY } }), this.zeroPoint = n.entities.add({ position: m, point: { pixelSize: 8, color: i.Color.YELLOW, disableDepthTestDistance: Number.POSITIVE_INFINITY } }), this.lineEntity = n.entities.add({ polyline: { positions: [m, r], width: s.width || 3, material: s.color || i.Color.YELLOW, depthFailMaterial: new i.PolylineDashMaterialProperty({ color: i.Color.RED, dashLength: 12, dashPattern: 255 }) } });
5244
- const g = s.labelText || { height: "高差" }, p = (l.height || 0) - c, f = t.id + "_terrain";
5245
- this.htmlLabelId = f, this.htmlLabelPool.add({ text: `${g.height}:${p.toFixed(2)} m` }, { id: f, lon: d, lat: u, height: l.height || 0, theme: "measure-terrainHeight", show: !0 });
5470
+ const g = s.labelText || { height: "高差" }, p = (h.height || 0) - c, f = t.id + "_terrain";
5471
+ this.htmlLabelId = f, this.htmlLabelPool.add({ text: `${g.height}:${p.toFixed(2)} m` }, { id: f, lon: d, lat: u, height: h.height || 0, theme: "measure-terrainHeight", show: !0 });
5246
5472
  }
5247
5473
  }
5248
- class yt {
5474
+ class Ct {
5249
5475
  constructor(t, e) {
5250
- h(this, "Cesium");
5251
- h(this, "viewer");
5252
- h(this, "handler", null);
5253
- h(this, "entity", null);
5254
- h(this, "labelEntity", null);
5255
- h(this, "htmlLabelPool", null);
5256
- h(this, "htmlLabelId", null);
5476
+ l(this, "Cesium");
5477
+ l(this, "viewer");
5478
+ l(this, "handler", null);
5479
+ l(this, "entity", null);
5480
+ l(this, "labelEntity", null);
5481
+ l(this, "htmlLabelPool", null);
5482
+ l(this, "htmlLabelId", null);
5257
5483
  this.Cesium = t, this.viewer = e;
5258
5484
  }
5259
5485
  start(t) {
@@ -5273,7 +5499,7 @@ class yt {
5273
5499
  var g;
5274
5500
  const s = i.scene.pickPosition(n.position);
5275
5501
  if (!s) return;
5276
- const o = e.Cartographic.fromCartesian(s), r = e.Math.toDegrees(o.longitude), l = e.Math.toDegrees(o.latitude), c = o.height || 0;
5502
+ const o = e.Cartographic.fromCartesian(s), r = e.Math.toDegrees(o.longitude), h = e.Math.toDegrees(o.latitude), c = o.height || 0;
5277
5503
  this.entity = i.entities.add({
5278
5504
  position: s,
5279
5505
  point: {
@@ -5287,12 +5513,12 @@ class yt {
5287
5513
  const u = t.labelText || { lng: "经", lat: "纬", height: "高" };
5288
5514
  this.htmlLabelPool.add(
5289
5515
  { text: `${u.lng}:${r.toFixed(6)}
5290
- ${u.lat}:${l.toFixed(6)}
5516
+ ${u.lat}:${h.toFixed(6)}
5291
5517
  ${u.height}:${c.toFixed(2)} m` },
5292
5518
  {
5293
5519
  id: d,
5294
5520
  lon: r,
5295
- lat: l,
5521
+ lat: h,
5296
5522
  height: c,
5297
5523
  theme: "measure-coordinate",
5298
5524
  show: !0
@@ -5301,7 +5527,7 @@ ${u.height}:${c.toFixed(2)} m` },
5301
5527
  const m = {
5302
5528
  entity: this.entity,
5303
5529
  label: this.labelEntity,
5304
- lnglat: { lng: r, lat: l, height: c },
5530
+ lnglat: { lng: r, lat: h, height: c },
5305
5531
  clear: () => this.clear()
5306
5532
  };
5307
5533
  (g = t.onComplete) == null || g.call(t, m), this.stop();
@@ -5334,7 +5560,7 @@ ${u.height}:${c.toFixed(2)} m` },
5334
5560
  options: { offset: { x: 0, y: -10 } }
5335
5561
  });
5336
5562
  }
5337
- const r = o[0], l = i.Cartographic.fromCartesian(r), c = i.Math.toDegrees(l.longitude), d = i.Math.toDegrees(l.latitude), u = l.height || 0;
5563
+ const r = o[0], h = i.Cartographic.fromCartesian(r), c = i.Math.toDegrees(h.longitude), d = i.Math.toDegrees(h.latitude), u = h.height || 0;
5338
5564
  this.entity = n.entities.add({ position: r, point: { pixelSize: 10, color: s.color || i.Color.YELLOW, disableDepthTestDistance: Number.POSITIVE_INFINITY } });
5339
5565
  const m = t.id + "_coord";
5340
5566
  this.htmlLabelId = m;
@@ -5344,27 +5570,27 @@ ${g.lat}:${d.toFixed(6)}
5344
5570
  ${g.height}:${u.toFixed(2)} m` }, { id: m, lon: c, lat: d, height: u, theme: "measure-coordinate", show: !0 });
5345
5571
  }
5346
5572
  }
5347
- class wt {
5573
+ class bt {
5348
5574
  constructor(t, e) {
5349
- h(this, "Cesium");
5350
- h(this, "viewer");
5351
- h(this, "handler", null);
5352
- h(this, "startPoint", null);
5353
- h(this, "endPoint", null);
5354
- h(this, "secondPoint", null);
5355
- h(this, "currentCorners", []);
5356
- h(this, "edgeEntities", []);
5357
- h(this, "pointEntities", []);
5358
- h(this, "previewEdgeEntity", null);
5359
- h(this, "previewPointEntities", []);
5360
- h(this, "entity", null);
5361
- h(this, "labelEntity", null);
5362
- h(this, "primitive", null);
5363
- h(this, "previewEntity", null);
5364
- h(this, "htmlLabelPool", null);
5365
- h(this, "htmlLabelId", null);
5366
- h(this, "segmentLabelIds", []);
5367
- h(this, "previewLabelId", null);
5575
+ l(this, "Cesium");
5576
+ l(this, "viewer");
5577
+ l(this, "handler", null);
5578
+ l(this, "startPoint", null);
5579
+ l(this, "endPoint", null);
5580
+ l(this, "secondPoint", null);
5581
+ l(this, "currentCorners", []);
5582
+ l(this, "edgeEntities", []);
5583
+ l(this, "pointEntities", []);
5584
+ l(this, "previewEdgeEntity", null);
5585
+ l(this, "previewPointEntities", []);
5586
+ l(this, "entity", null);
5587
+ l(this, "labelEntity", null);
5588
+ l(this, "primitive", null);
5589
+ l(this, "previewEntity", null);
5590
+ l(this, "htmlLabelPool", null);
5591
+ l(this, "htmlLabelId", null);
5592
+ l(this, "segmentLabelIds", []);
5593
+ l(this, "previewLabelId", null);
5368
5594
  this.Cesium = t, this.viewer = e;
5369
5595
  }
5370
5596
  start(t) {
@@ -5387,7 +5613,7 @@ class wt {
5387
5613
  });
5388
5614
  }
5389
5615
  this.handler = new e.ScreenSpaceEventHandler(i.canvas), this.handler.setInputAction((n) => {
5390
- var A, D, O;
5616
+ var A, S, k;
5391
5617
  const s = i.scene.pickPosition(n.position);
5392
5618
  if (!s) return;
5393
5619
  if (!this.startPoint) {
@@ -5404,7 +5630,7 @@ class wt {
5404
5630
  return;
5405
5631
  }
5406
5632
  this.stop();
5407
- const { corners: l, center: c, width: d, height: u, area: m } = r;
5633
+ const { corners: h, center: c, width: d, height: u, area: m } = r;
5408
5634
  this.previewEntity && (i.entities.remove(this.previewEntity), this.previewEntity = null), this.primitive && (i.scene.primitives.remove(this.primitive), this.primitive = null), this.entity && (i.entities.remove(this.entity), this.entity = null);
5409
5635
  const g = this.htmlLabelId || `measure_rectangle_${Date.now()}`;
5410
5636
  this.htmlLabelId = g;
@@ -5423,17 +5649,17 @@ ${f.area}:${m.toFixed(2)} m²` },
5423
5649
  }
5424
5650
  );
5425
5651
  const w = [
5426
- [l[0], l[1]],
5427
- [l[1], l[2]],
5428
- [l[2], l[3]],
5429
- [l[3], l[0]]
5652
+ [h[0], h[1]],
5653
+ [h[1], h[2]],
5654
+ [h[2], h[3]],
5655
+ [h[3], h[0]]
5430
5656
  ];
5431
5657
  for (let x = 0; x < w.length; x++) {
5432
- const [$, F] = w[x], z = x === 0 || x === 2 ? d : u, G = new e.Cartesian3(($.x + F.x) / 2, ($.y + F.y) / 2, ($.z + F.z) / 2), B = e.Cartographic.fromCartesian(G), q = `measure_rectangle_seg_${Date.now()}_${x}`;
5433
- this.segmentLabelIds.push(q), this.htmlLabelPool.add(
5658
+ const [$, H] = w[x], z = x === 0 || x === 2 ? d : u, G = new e.Cartesian3(($.x + H.x) / 2, ($.y + H.y) / 2, ($.z + H.z) / 2), B = e.Cartographic.fromCartesian(G), K = `measure_rectangle_seg_${Date.now()}_${x}`;
5659
+ this.segmentLabelIds.push(K), this.htmlLabelPool.add(
5434
5660
  { text: `${f.side}:${Number(z).toFixed(2)} m` },
5435
5661
  {
5436
- id: q,
5662
+ id: K,
5437
5663
  lon: e.Math.toDegrees(B.longitude),
5438
5664
  lat: e.Math.toDegrees(B.latitude),
5439
5665
  height: B.height || 0,
@@ -5442,7 +5668,7 @@ ${f.area}:${m.toFixed(2)} m²` },
5442
5668
  }
5443
5669
  );
5444
5670
  }
5445
- const y = this.buildSurfaceRectanglePositions(l), v = new e.PolygonHierarchy(y), C = new e.PolygonGeometry({
5671
+ const y = this.buildSurfaceRectanglePositions(h), v = new e.PolygonHierarchy(y), C = new e.PolygonGeometry({
5446
5672
  polygonHierarchy: v,
5447
5673
  vertexFormat: e.MaterialAppearance.VERTEX_FORMAT,
5448
5674
  perPositionHeight: !0,
@@ -5461,7 +5687,7 @@ ${f.area}:${m.toFixed(2)} m²` },
5461
5687
  closed: !0
5462
5688
  })
5463
5689
  }), i.scene.primitives.add(this.primitive);
5464
- const L = t.lineColor || t.color || e.Color.YELLOW, E = ((D = (A = t.dashLineColor || t.lineColor || t.color || e.Color.RED).withAlpha) == null ? void 0 : D.call(A, 0.9)) || e.Color.RED, I = [...y, y[0]], S = i.entities.add({
5690
+ const L = t.lineColor || t.color || e.Color.YELLOW, E = ((S = (A = t.dashLineColor || t.lineColor || t.color || e.Color.RED).withAlpha) == null ? void 0 : S.call(A, 0.9)) || e.Color.RED, I = [...y, y[0]], D = i.entities.add({
5465
5691
  polyline: {
5466
5692
  positions: I,
5467
5693
  width: t.width || 2,
@@ -5475,9 +5701,9 @@ ${f.area}:${m.toFixed(2)} m²` },
5475
5701
  })
5476
5702
  }
5477
5703
  });
5478
- this.edgeEntities.push(S);
5704
+ this.edgeEntities.push(D);
5479
5705
  const _ = t.pointColor || t.color || e.Color.YELLOW;
5480
- for (const x of l) {
5706
+ for (const x of h) {
5481
5707
  const $ = i.entities.add({
5482
5708
  position: x,
5483
5709
  point: {
@@ -5497,7 +5723,7 @@ ${f.area}:${m.toFixed(2)} m²` },
5497
5723
  area: m,
5498
5724
  clear: () => this.clear()
5499
5725
  };
5500
- (O = t.onComplete) == null || O.call(t, T);
5726
+ (k = t.onComplete) == null || k.call(t, T);
5501
5727
  }, e.ScreenSpaceEventType.LEFT_CLICK), this.handler.setInputAction((n) => {
5502
5728
  var w, y;
5503
5729
  const s = i.scene.pickPosition(n.endPosition);
@@ -5541,9 +5767,9 @@ ${f.area}:${m.toFixed(2)} m²` },
5541
5767
  if (!this.startPoint || !this.secondPoint) return;
5542
5768
  const o = this.computeRectangle(this.startPoint, this.secondPoint, s);
5543
5769
  if (!o) return;
5544
- const { corners: r, center: l, width: c, height: d, area: u } = o, m = this.buildSurfaceRectanglePositions(r);
5770
+ const { corners: r, center: h, width: c, height: d, area: u } = o, m = this.buildSurfaceRectanglePositions(r);
5545
5771
  this.currentCorners = m;
5546
- const g = e.Cartographic.fromCartesian(l), p = this.previewLabelId || "measure_rectangle_preview";
5772
+ const g = e.Cartographic.fromCartesian(h), p = this.previewLabelId || "measure_rectangle_preview";
5547
5773
  this.previewLabelId = p;
5548
5774
  const f = t.labelText || { width: "宽", heightLabel: "高", area: "面积" };
5549
5775
  if (this.htmlLabelPool.add(
@@ -5614,35 +5840,35 @@ ${f.area}:${u.toFixed(2)} m²` },
5614
5840
  const _ = s.overlayContainerId || "html-label-container";
5615
5841
  this.htmlLabelPool = e || new N(i, n, _), this.htmlLabelPool.registerTheme("measure-rectangle", {
5616
5842
  createElement: (T, A) => {
5617
- var D;
5618
- T.innerHTML = String(((D = A == null ? void 0 : A.data) == null ? void 0 : D.text) || ""), T.style.background = "rgba(0,0,0,0.6)", T.style.color = "#fff", T.style.font = "14px sans-serif", T.style.padding = "4px 6px", T.style.borderRadius = "4px", T.style.whiteSpace = "pre";
5843
+ var S;
5844
+ T.innerHTML = String(((S = A == null ? void 0 : A.data) == null ? void 0 : S.text) || ""), T.style.background = "rgba(0,0,0,0.6)", T.style.color = "#fff", T.style.font = "14px sans-serif", T.style.padding = "4px 6px", T.style.borderRadius = "4px", T.style.whiteSpace = "pre";
5619
5845
  },
5620
5846
  options: { offset: { x: 0, y: -10 } }
5621
5847
  }), this.htmlLabelPool.registerTheme("measure-rectangle-seg", {
5622
5848
  createElement: (T, A) => {
5623
- var D;
5624
- T.innerHTML = String(((D = A == null ? void 0 : A.data) == null ? void 0 : D.text) || ""), T.style.background = "rgba(0,0,0,0.6)", T.style.color = "#fff", T.style.font = "14px sans-serif", T.style.padding = "4px 6px", T.style.borderRadius = "4px", T.style.whiteSpace = "pre";
5849
+ var S;
5850
+ T.innerHTML = String(((S = A == null ? void 0 : A.data) == null ? void 0 : S.text) || ""), T.style.background = "rgba(0,0,0,0.6)", T.style.color = "#fff", T.style.font = "14px sans-serif", T.style.padding = "4px 6px", T.style.borderRadius = "4px", T.style.whiteSpace = "pre";
5625
5851
  },
5626
5852
  options: { offset: { x: 0, y: -10 } }
5627
5853
  });
5628
5854
  }
5629
5855
  const r = this.computeRectangle(o[0], o[1], o[2]);
5630
5856
  if (!r) return;
5631
- const l = r.corners, c = r.center, d = r.width, u = r.height, m = r.area, g = i.Cartographic.fromCartesian(c), p = t.id + "_rectangle", f = s.labelText || { width: "宽", heightLabel: "高", area: "面积", side: "边长" };
5857
+ const h = r.corners, c = r.center, d = r.width, u = r.height, m = r.area, g = i.Cartographic.fromCartesian(c), p = t.id + "_rectangle", f = s.labelText || { width: "宽", heightLabel: "高", area: "面积", side: "边长" };
5632
5858
  this.htmlLabelId = p, this.htmlLabelPool.add({ text: `${f.width}:${d.toFixed(2)} m
5633
5859
  ${f.heightLabel}:${u.toFixed(2)} m
5634
5860
  ${f.area}:${m.toFixed(2)} m²` }, { id: p, lon: i.Math.toDegrees(g.longitude), lat: i.Math.toDegrees(g.latitude), height: g.height || 0, theme: "measure-rectangle", show: !0 });
5635
5861
  const w = [
5636
- [l[0], l[1]],
5637
- [l[1], l[2]],
5638
- [l[2], l[3]],
5639
- [l[3], l[0]]
5862
+ [h[0], h[1]],
5863
+ [h[1], h[2]],
5864
+ [h[2], h[3]],
5865
+ [h[3], h[0]]
5640
5866
  ];
5641
5867
  for (let _ = 0; _ < w.length; _++) {
5642
- const [T, A] = w[_], D = _ === 0 || _ === 2 ? d : u, O = new i.Cartesian3((T.x + A.x) / 2, (T.y + A.y) / 2, (T.z + A.z) / 2), x = i.Cartographic.fromCartesian(O), $ = t.id + `_rectangle_seg_${_}`;
5643
- this.segmentLabelIds.push($), this.htmlLabelPool.add({ text: `${f.side}:${Number(D).toFixed(2)} m` }, { id: $, lon: i.Math.toDegrees(x.longitude), lat: i.Math.toDegrees(x.latitude), height: x.height || 0, theme: "measure-rectangle-seg", show: !0 });
5868
+ const [T, A] = w[_], S = _ === 0 || _ === 2 ? d : u, k = new i.Cartesian3((T.x + A.x) / 2, (T.y + A.y) / 2, (T.z + A.z) / 2), x = i.Cartographic.fromCartesian(k), $ = t.id + `_rectangle_seg_${_}`;
5869
+ this.segmentLabelIds.push($), this.htmlLabelPool.add({ text: `${f.side}:${Number(S).toFixed(2)} m` }, { id: $, lon: i.Math.toDegrees(x.longitude), lat: i.Math.toDegrees(x.latitude), height: x.height || 0, theme: "measure-rectangle-seg", show: !0 });
5644
5870
  }
5645
- const y = new i.PolygonHierarchy(l), v = new i.PolygonGeometry({
5871
+ const y = new i.PolygonHierarchy(h), v = new i.PolygonGeometry({
5646
5872
  polygonHierarchy: y,
5647
5873
  vertexFormat: i.MaterialAppearance.VERTEX_FORMAT,
5648
5874
  perPositionHeight: !0,
@@ -5653,7 +5879,7 @@ ${f.area}:${m.toFixed(2)} m²` }, { id: p, lon: i.Math.toDegrees(g.longitude), l
5653
5879
  depthFailAppearance: new i.MaterialAppearance({ material: i.Material.fromType("Color", { color: M }), translucent: !0, closed: !0 })
5654
5880
  });
5655
5881
  this.primitive = P, n.scene.primitives.add(this.primitive);
5656
- const L = s.lineColor || b, E = [...l, l[0]], I = n.entities.add({
5882
+ const L = s.lineColor || b, E = [...h, h[0]], I = n.entities.add({
5657
5883
  polyline: {
5658
5884
  positions: E,
5659
5885
  width: s.width || 2,
@@ -5663,13 +5889,13 @@ ${f.area}:${m.toFixed(2)} m²` }, { id: p, lon: i.Math.toDegrees(g.longitude), l
5663
5889
  }
5664
5890
  });
5665
5891
  this.edgeEntities.push(I);
5666
- const S = s.pointColor || b;
5667
- for (const _ of l) {
5892
+ const D = s.pointColor || b;
5893
+ for (const _ of h) {
5668
5894
  const T = n.entities.add({
5669
5895
  position: _,
5670
5896
  point: {
5671
5897
  pixelSize: 8,
5672
- color: S,
5898
+ color: D,
5673
5899
  disableDepthTestDistance: Number.POSITIVE_INFINITY
5674
5900
  }
5675
5901
  });
@@ -5679,45 +5905,45 @@ ${f.area}:${m.toFixed(2)} m²` }, { id: p, lon: i.Math.toDegrees(g.longitude), l
5679
5905
  computeRectangle(t, e, i) {
5680
5906
  const n = this.Cesium, s = new n.EllipsoidTangentPlane(t, n.Ellipsoid.WGS84), o = s.projectPointsOntoPlane([t, e, i]);
5681
5907
  if (!o || o.length < 3) return null;
5682
- const r = o[0], l = o[1], c = o[2], d = l.x - r.x, u = l.y - r.y, m = Math.sqrt(d * d + u * u);
5908
+ const r = o[0], h = o[1], c = o[2], d = h.x - r.x, u = h.y - r.y, m = Math.sqrt(d * d + u * u);
5683
5909
  if (!m) return null;
5684
- const g = d / m, f = -(u / m), w = g, y = c.x - l.x, v = c.y - l.y, C = y * f + v * w;
5910
+ const g = d / m, f = -(u / m), w = g, y = c.x - h.x, v = c.y - h.y, C = y * f + v * w;
5685
5911
  if (!C) return null;
5686
- const b = new n.Cartesian2(l.x + f * C, l.y + w * C), M = new n.Cartesian2(r.x + f * C, r.y + w * C), P = s.projectPointsOntoEllipsoid([r, l, b, M]);
5912
+ const b = new n.Cartesian2(h.x + f * C, h.y + w * C), M = new n.Cartesian2(r.x + f * C, r.y + w * C), P = s.projectPointsOntoEllipsoid([r, h, b, M]);
5687
5913
  if (!P || P.length < 4) return null;
5688
- const L = P, E = L[0], I = L[2], S = Math.abs(m), _ = Math.abs(C), T = new n.Cartesian3(
5914
+ const L = P, E = L[0], I = L[2], D = Math.abs(m), _ = Math.abs(C), T = new n.Cartesian3(
5689
5915
  (E.x + I.x) / 2,
5690
5916
  (E.y + I.y) / 2,
5691
5917
  (E.z + I.z) / 2
5692
- ), D = new n.EllipsoidTangentPlane(T, n.Ellipsoid.WGS84).projectPointsOntoPlane(L);
5693
- let O = 0;
5694
- for (let $ = 0; $ < D.length; $++) {
5695
- const F = ($ + 1) % D.length;
5696
- O += D[$].x * D[F].y - D[F].x * D[$].y;
5918
+ ), S = new n.EllipsoidTangentPlane(T, n.Ellipsoid.WGS84).projectPointsOntoPlane(L);
5919
+ let k = 0;
5920
+ for (let $ = 0; $ < S.length; $++) {
5921
+ const H = ($ + 1) % S.length;
5922
+ k += S[$].x * S[H].y - S[H].x * S[$].y;
5697
5923
  }
5698
- const x = Math.abs(O) / 2;
5699
- return { corners: L, center: T, width: S, height: _, area: x };
5924
+ const x = Math.abs(k) / 2;
5925
+ return { corners: L, center: T, width: D, height: _, area: x };
5700
5926
  }
5701
5927
  }
5702
- class vt {
5928
+ class Pt {
5703
5929
  constructor(t, e) {
5704
- h(this, "Cesium");
5705
- h(this, "viewer");
5706
- h(this, "handler", null);
5707
- h(this, "entity", null);
5708
- h(this, "positions", []);
5709
- h(this, "labelEntity", null);
5710
- h(this, "currentPoints", []);
5711
- h(this, "primitive", null);
5712
- h(this, "previewEntity", null);
5713
- h(this, "edgeEntities", []);
5714
- h(this, "pointEntities", []);
5715
- h(this, "previewEdgeEntity", null);
5716
- h(this, "previewPointEntities", []);
5717
- h(this, "htmlLabelPool", null);
5718
- h(this, "htmlLabelId", null);
5719
- h(this, "segmentLabelIds", []);
5720
- h(this, "previewLabelId", null);
5930
+ l(this, "Cesium");
5931
+ l(this, "viewer");
5932
+ l(this, "handler", null);
5933
+ l(this, "entity", null);
5934
+ l(this, "positions", []);
5935
+ l(this, "labelEntity", null);
5936
+ l(this, "currentPoints", []);
5937
+ l(this, "primitive", null);
5938
+ l(this, "previewEntity", null);
5939
+ l(this, "edgeEntities", []);
5940
+ l(this, "pointEntities", []);
5941
+ l(this, "previewEdgeEntity", null);
5942
+ l(this, "previewPointEntities", []);
5943
+ l(this, "htmlLabelPool", null);
5944
+ l(this, "htmlLabelId", null);
5945
+ l(this, "segmentLabelIds", []);
5946
+ l(this, "previewLabelId", null);
5721
5947
  this.Cesium = t, this.viewer = e;
5722
5948
  }
5723
5949
  start(t) {
@@ -5727,20 +5953,20 @@ class vt {
5727
5953
  const s = t.overlayContainerId || "html-label-container";
5728
5954
  this.htmlLabelPool = new N(e, i, s), this.htmlLabelPool.registerTheme("measure-regular", {
5729
5955
  createElement: (o, r) => {
5730
- var l;
5731
- o.innerHTML = String(((l = r == null ? void 0 : r.data) == null ? void 0 : l.text) || ""), o.style.background = "rgba(0,0,0,0.6)", o.style.color = "#fff", o.style.font = "14px sans-serif", o.style.padding = "4px 6px", o.style.borderRadius = "4px", o.style.whiteSpace = "pre";
5956
+ var h;
5957
+ o.innerHTML = String(((h = r == null ? void 0 : r.data) == null ? void 0 : h.text) || ""), o.style.background = "rgba(0,0,0,0.6)", o.style.color = "#fff", o.style.font = "14px sans-serif", o.style.padding = "4px 6px", o.style.borderRadius = "4px", o.style.whiteSpace = "pre";
5732
5958
  },
5733
5959
  options: { offset: { x: 0, y: -10 } }
5734
5960
  }), this.htmlLabelPool.registerTheme("measure-regular-seg", {
5735
5961
  createElement: (o, r) => {
5736
- var l;
5737
- o.innerHTML = String(((l = r == null ? void 0 : r.data) == null ? void 0 : l.text) || ""), o.style.background = "rgba(0,0,0,0.6)", o.style.color = "#fff", o.style.font = "14px sans-serif", o.style.padding = "4px 6px", o.style.borderRadius = "4px", o.style.whiteSpace = "pre";
5962
+ var h;
5963
+ o.innerHTML = String(((h = r == null ? void 0 : r.data) == null ? void 0 : h.text) || ""), o.style.background = "rgba(0,0,0,0.6)", o.style.color = "#fff", o.style.font = "14px sans-serif", o.style.padding = "4px 6px", o.style.borderRadius = "4px", o.style.whiteSpace = "pre";
5738
5964
  },
5739
5965
  options: { offset: { x: 0, y: -10 } }
5740
5966
  });
5741
5967
  }
5742
5968
  this.handler = new e.ScreenSpaceEventHandler(i.canvas), this.handler.setInputAction((s) => {
5743
- var r, l, c;
5969
+ var r, h, c;
5744
5970
  const o = i.scene.pickPosition(s.position);
5745
5971
  if (o && (this.positions.push(o), this.positions.length === 2)) {
5746
5972
  this.stop();
@@ -5765,7 +5991,7 @@ class vt {
5765
5991
  closed: !0
5766
5992
  })
5767
5993
  }), i.scene.primitives.add(this.primitive);
5768
- const C = t.lineColor || y, b = ((l = (r = t.dashLineColor || t.lineColor || t.color || e.Color.RED).withAlpha) == null ? void 0 : l.call(r, 0.9)) || e.Color.RED, M = g.slice(), P = i.entities.add({
5994
+ const C = t.lineColor || y, b = ((h = (r = t.dashLineColor || t.lineColor || t.color || e.Color.RED).withAlpha) == null ? void 0 : h.call(r, 0.9)) || e.Color.RED, M = g.slice(), P = i.entities.add({
5769
5995
  polyline: {
5770
5996
  positions: M,
5771
5997
  width: t.width || 2,
@@ -5781,9 +6007,9 @@ class vt {
5781
6007
  });
5782
6008
  this.edgeEntities.push(P);
5783
6009
  const L = t.pointColor || y, E = g.slice(0, g.length - 1);
5784
- for (const O of E) {
6010
+ for (const k of E) {
5785
6011
  const x = i.entities.add({
5786
- position: O,
6012
+ position: k,
5787
6013
  point: {
5788
6014
  pixelSize: 8,
5789
6015
  color: L,
@@ -5792,15 +6018,15 @@ class vt {
5792
6018
  });
5793
6019
  this.pointEntities.push(x);
5794
6020
  }
5795
- const I = this.computeAreaByPlane(g), S = e.Cartographic.fromCartesian(d), _ = this.htmlLabelId || `measure_regular_${Date.now()}`;
6021
+ const I = this.computeAreaByPlane(g), D = e.Cartographic.fromCartesian(d), _ = this.htmlLabelId || `measure_regular_${Date.now()}`;
5796
6022
  this.htmlLabelId = _;
5797
6023
  const T = t.labelText || { sides: "边数", radius: "半径", circumference: "周长", area: "面积", side: "边长" };
5798
6024
  this.previewLabelId && this.htmlLabelPool && (this.htmlLabelPool.removeByIds([this.previewLabelId]), this.previewLabelId = null);
5799
6025
  let A = 0;
5800
- for (let O = 1; O < g.length; O++) {
5801
- const x = g[O - 1], $ = g[O], F = e.Cartographic.fromCartesian(x), z = e.Cartographic.fromCartesian($), B = new e.EllipsoidGeodesic(F, z).surfaceDistance;
6026
+ for (let k = 1; k < g.length; k++) {
6027
+ const x = g[k - 1], $ = g[k], H = e.Cartographic.fromCartesian(x), z = e.Cartographic.fromCartesian($), B = new e.EllipsoidGeodesic(H, z).surfaceDistance;
5802
6028
  A += B;
5803
- const q = new e.Cartesian3((x.x + $.x) / 2, (x.y + $.y) / 2, (x.z + $.z) / 2), X = e.Cartographic.fromCartesian(q), se = `measure_regular_seg_${Date.now()}_${O - 1}`;
6029
+ const K = new e.Cartesian3((x.x + $.x) / 2, (x.y + $.y) / 2, (x.z + $.z) / 2), X = e.Cartographic.fromCartesian(K), se = `measure_regular_seg_${Date.now()}_${k - 1}`;
5804
6030
  this.segmentLabelIds.push(se), this.htmlLabelPool.add(
5805
6031
  { text: `${T.side}:${B.toFixed(2)} m` },
5806
6032
  {
@@ -5820,14 +6046,14 @@ ${T.circumference}:${A.toFixed(2)} m
5820
6046
  ${T.area}:${I.toFixed(2)} m²` },
5821
6047
  {
5822
6048
  id: _,
5823
- lon: e.Math.toDegrees(S.longitude),
5824
- lat: e.Math.toDegrees(S.latitude),
5825
- height: S.height || 0,
6049
+ lon: e.Math.toDegrees(D.longitude),
6050
+ lat: e.Math.toDegrees(D.latitude),
6051
+ height: D.height || 0,
5826
6052
  theme: "measure-regular",
5827
6053
  show: !0
5828
6054
  }
5829
6055
  );
5830
- const D = {
6056
+ const S = {
5831
6057
  entity: this.primitive,
5832
6058
  label: this.labelEntity,
5833
6059
  positions: g,
@@ -5837,14 +6063,14 @@ ${T.area}:${I.toFixed(2)} m²` },
5837
6063
  area: I,
5838
6064
  clear: () => this.clear()
5839
6065
  };
5840
- (c = t.onComplete) == null || c.call(t, D);
6066
+ (c = t.onComplete) == null || c.call(t, S);
5841
6067
  }
5842
6068
  }, e.ScreenSpaceEventType.LEFT_CLICK), this.handler.setInputAction((s) => {
5843
6069
  var f, w;
5844
6070
  if (this.positions.length !== 1) return;
5845
- const o = this.positions[0], r = i.camera.getPickRay(s.endPosition), l = i.scene.globe.pick(r, i.scene);
5846
- if (!l) return;
5847
- const c = e.Cartesian3.distance(o, l);
6071
+ const o = this.positions[0], r = i.camera.getPickRay(s.endPosition), h = i.scene.globe.pick(r, i.scene);
6072
+ if (!h) return;
6073
+ const c = e.Cartesian3.distance(o, h);
5848
6074
  if (this.currentPoints = this.buildRegularPolygonPoints(o, c, n), !this.previewEntity) {
5849
6075
  const y = t.color || e.Color.YELLOW.withAlpha(0.4);
5850
6076
  this.previewEntity = i.entities.add({
@@ -5881,7 +6107,7 @@ ${T.area}:${I.toFixed(2)} m²` },
5881
6107
  disableDepthTestDistance: Number.POSITIVE_INFINITY
5882
6108
  }
5883
6109
  }), P = i.entities.add({
5884
- position: new e.CallbackProperty(() => l || o, !1),
6110
+ position: new e.CallbackProperty(() => h || o, !1),
5885
6111
  point: {
5886
6112
  pixelSize: 8,
5887
6113
  color: b,
@@ -5952,42 +6178,42 @@ ${p.area}:${u.toFixed(2)} m²` },
5952
6178
  const L = s.overlayContainerId || "html-label-container";
5953
6179
  this.htmlLabelPool = e || new N(i, n, L), this.htmlLabelPool.registerTheme("measure-regular", {
5954
6180
  createElement: (E, I) => {
5955
- var S;
5956
- E.innerHTML = String(((S = I == null ? void 0 : I.data) == null ? void 0 : S.text) || ""), E.style.background = "rgba(0,0,0,0.6)", E.style.color = "#fff", E.style.font = "14px sans-serif", E.style.padding = "4px 6px", E.style.borderRadius = "4px", E.style.whiteSpace = "pre";
6181
+ var D;
6182
+ E.innerHTML = String(((D = I == null ? void 0 : I.data) == null ? void 0 : D.text) || ""), E.style.background = "rgba(0,0,0,0.6)", E.style.color = "#fff", E.style.font = "14px sans-serif", E.style.padding = "4px 6px", E.style.borderRadius = "4px", E.style.whiteSpace = "pre";
5957
6183
  },
5958
6184
  options: { offset: { x: 0, y: -10 } }
5959
6185
  }), this.htmlLabelPool.registerTheme("measure-regular-seg", {
5960
6186
  createElement: (E, I) => {
5961
- var S;
5962
- E.innerHTML = String(((S = I == null ? void 0 : I.data) == null ? void 0 : S.text) || ""), E.style.background = "rgba(0,0,0,0.6)", E.style.color = "#fff", E.style.font = "14px sans-serif", E.style.padding = "4px 6px", E.style.borderRadius = "4px", E.style.whiteSpace = "pre";
6187
+ var D;
6188
+ E.innerHTML = String(((D = I == null ? void 0 : I.data) == null ? void 0 : D.text) || ""), E.style.background = "rgba(0,0,0,0.6)", E.style.color = "#fff", E.style.font = "14px sans-serif", E.style.padding = "4px 6px", E.style.borderRadius = "4px", E.style.whiteSpace = "pre";
5963
6189
  },
5964
6190
  options: { offset: { x: 0, y: -10 } }
5965
6191
  });
5966
6192
  }
5967
- let l = [], c = r[0], d = 0;
6193
+ let h = [], c = r[0], d = 0;
5968
6194
  if (r.length >= 3) {
5969
- l = r.slice(), c = new i.Cartesian3(
5970
- l.reduce((E, I) => E + I.x, 0) / l.length,
5971
- l.reduce((E, I) => E + I.y, 0) / l.length,
5972
- l.reduce((E, I) => E + I.z, 0) / l.length
6195
+ h = r.slice(), c = new i.Cartesian3(
6196
+ h.reduce((E, I) => E + I.x, 0) / h.length,
6197
+ h.reduce((E, I) => E + I.y, 0) / h.length,
6198
+ h.reduce((E, I) => E + I.z, 0) / h.length
5973
6199
  );
5974
- const L = l[0];
5975
- l[Math.floor(l.length / 2)] || l[1], d = i.Cartesian3.distance(c, L);
6200
+ const L = h[0];
6201
+ h[Math.floor(h.length / 2)] || h[1], d = i.Cartesian3.distance(c, L);
5976
6202
  } else {
5977
6203
  const L = r[1];
5978
- d = i.Cartesian3.distance(c, L), l = this.buildRegularPolygonPoints(c, d, Math.max(o, 3));
6204
+ d = i.Cartesian3.distance(c, L), h = this.buildRegularPolygonPoints(c, d, Math.max(o, 3));
5979
6205
  }
5980
- const u = new i.PolygonHierarchy(l), m = new i.PolygonGeometry({ polygonHierarchy: u, vertexFormat: i.MaterialAppearance.VERTEX_FORMAT, perPositionHeight: !0 }), g = new i.GeometryInstance({ geometry: m }), p = s.color || i.Color.YELLOW.withAlpha(0.4), f = s.color && s.color.withAlpha ? s.color.withAlpha(0.25) : i.Color.RED.withAlpha(0.4), w = new i.Primitive({ geometryInstances: g, appearance: new i.MaterialAppearance({ material: i.Material.fromType("Color", { color: p }), translucent: !0, closed: !0 }), depthFailAppearance: new i.MaterialAppearance({ material: i.Material.fromType("Color", { color: f }), translucent: !0, closed: !0 }) });
6206
+ const u = new i.PolygonHierarchy(h), m = new i.PolygonGeometry({ polygonHierarchy: u, vertexFormat: i.MaterialAppearance.VERTEX_FORMAT, perPositionHeight: !0 }), g = new i.GeometryInstance({ geometry: m }), p = s.color || i.Color.YELLOW.withAlpha(0.4), f = s.color && s.color.withAlpha ? s.color.withAlpha(0.25) : i.Color.RED.withAlpha(0.4), w = new i.Primitive({ geometryInstances: g, appearance: new i.MaterialAppearance({ material: i.Material.fromType("Color", { color: p }), translucent: !0, closed: !0 }), depthFailAppearance: new i.MaterialAppearance({ material: i.Material.fromType("Color", { color: f }), translucent: !0, closed: !0 }) });
5981
6207
  n.scene.primitives.add(w), this.primitive = w;
5982
- const y = this.computeAreaByPlane(l), v = i.Cartographic.fromCartesian(c), C = t.id + "_regular";
6208
+ const y = this.computeAreaByPlane(h), v = i.Cartographic.fromCartesian(c), C = t.id + "_regular";
5983
6209
  this.htmlLabelId = C;
5984
6210
  const b = s.labelText || { sides: "边数", radius: "半径", circumference: "周长", area: "面积", side: "边长" };
5985
6211
  let M = 0;
5986
- for (let L = 1; L < l.length; L++) {
5987
- const E = l[L - 1], I = l[L], S = i.Cartographic.fromCartesian(E), _ = i.Cartographic.fromCartesian(I), A = new i.EllipsoidGeodesic(S, _).surfaceDistance;
6212
+ for (let L = 1; L < h.length; L++) {
6213
+ const E = h[L - 1], I = h[L], D = i.Cartographic.fromCartesian(E), _ = i.Cartographic.fromCartesian(I), A = new i.EllipsoidGeodesic(D, _).surfaceDistance;
5988
6214
  M += A;
5989
- const D = new i.Cartesian3((E.x + I.x) / 2, (E.y + I.y) / 2, (E.z + I.z) / 2), O = i.Cartographic.fromCartesian(D), x = t.id + `_regular_seg_${L - 1}`;
5990
- this.segmentLabelIds.push(x), this.htmlLabelPool.add({ text: `${b.side}:${A.toFixed(2)} m` }, { id: x, lon: i.Math.toDegrees(O.longitude), lat: i.Math.toDegrees(O.latitude), height: O.height || 0, theme: "measure-regular-seg", show: !0 });
6215
+ const S = new i.Cartesian3((E.x + I.x) / 2, (E.y + I.y) / 2, (E.z + I.z) / 2), k = i.Cartographic.fromCartesian(S), x = t.id + `_regular_seg_${L - 1}`;
6216
+ this.segmentLabelIds.push(x), this.htmlLabelPool.add({ text: `${b.side}:${A.toFixed(2)} m` }, { id: x, lon: i.Math.toDegrees(k.longitude), lat: i.Math.toDegrees(k.latitude), height: k.height || 0, theme: "measure-regular-seg", show: !0 });
5991
6217
  }
5992
6218
  this.htmlLabelPool.add({ text: `${b.sides}:${Math.max(o, 3)}
5993
6219
  ${b.radius}:${d.toFixed(2)} m
@@ -6005,66 +6231,66 @@ ${b.area}:${y.toFixed(2)} m²` }, { id: C, lon: i.Math.toDegrees(v.longitude), l
6005
6231
  }
6006
6232
  computeAreaByPlane(t) {
6007
6233
  const e = this.Cesium, i = new e.Cartesian3(
6008
- t.reduce((r, l) => r + l.x, 0) / t.length,
6009
- t.reduce((r, l) => r + l.y, 0) / t.length,
6010
- t.reduce((r, l) => r + l.z, 0) / t.length
6234
+ t.reduce((r, h) => r + h.x, 0) / t.length,
6235
+ t.reduce((r, h) => r + h.y, 0) / t.length,
6236
+ t.reduce((r, h) => r + h.z, 0) / t.length
6011
6237
  ), s = new e.EllipsoidTangentPlane(i, e.Ellipsoid.WGS84).projectPointsOntoPlane(t);
6012
6238
  let o = 0;
6013
6239
  for (let r = 0; r < s.length; r++) {
6014
- const l = (r + 1) % s.length;
6015
- o += s[r].x * s[l].y - s[l].x * s[r].y;
6240
+ const h = (r + 1) % s.length;
6241
+ o += s[r].x * s[h].y - s[h].x * s[r].y;
6016
6242
  }
6017
6243
  return Math.abs(o) / 2;
6018
6244
  }
6019
6245
  }
6020
- class On {
6246
+ class Fo {
6021
6247
  constructor({ Cesium: t, viewer: e }) {
6022
- h(this, "Cesium");
6023
- h(this, "viewer");
6024
- h(this, "actives", []);
6025
- h(this, "measurements", []);
6026
- h(this, "htmlLabelPool", null);
6027
- h(this, "recordHandlers", /* @__PURE__ */ new Map());
6028
- h(this, "specifiedClear", !1);
6029
- h(this, "deleteLabelPool", null);
6030
- h(this, "deleteLabelIds", /* @__PURE__ */ new Map());
6248
+ l(this, "Cesium");
6249
+ l(this, "viewer");
6250
+ l(this, "actives", []);
6251
+ l(this, "measurements", []);
6252
+ l(this, "htmlLabelPool", null);
6253
+ l(this, "recordHandlers", /* @__PURE__ */ new Map());
6254
+ l(this, "specifiedClear", !1);
6255
+ l(this, "deleteLabelPool", null);
6256
+ l(this, "deleteLabelIds", /* @__PURE__ */ new Map());
6031
6257
  this.Cesium = t, this.viewer = e, e.screenSpaceEventHandler.removeInputAction(t.ScreenSpaceEventType.LEFT_DOUBLE_CLICK);
6032
6258
  }
6033
6259
  measure(t, e) {
6034
6260
  let i = null;
6035
6261
  switch (t) {
6036
6262
  case "horizontal":
6037
- i = new ht(this.Cesium, this.viewer);
6263
+ i = new De(this.Cesium, this.viewer);
6038
6264
  break;
6039
6265
  case "vertical":
6040
- i = new ct(this.Cesium, this.viewer);
6266
+ i = new gt(this.Cesium, this.viewer);
6041
6267
  break;
6042
6268
  case "triangle":
6043
- i = new dt(this.Cesium, this.viewer);
6269
+ i = new ft(this.Cesium, this.viewer);
6044
6270
  break;
6045
6271
  case "space":
6046
- i = new pt(this.Cesium, this.viewer);
6272
+ i = new yt(this.Cesium, this.viewer);
6047
6273
  break;
6048
6274
  case "area":
6049
- i = new ut(this.Cesium, this.viewer);
6275
+ i = new Se(this.Cesium, this.viewer);
6050
6276
  break;
6051
6277
  case "circle":
6052
- i = new mt(this.Cesium, this.viewer);
6278
+ i = new wt(this.Cesium, this.viewer);
6053
6279
  break;
6054
6280
  case "polyline":
6055
- i = new gt(this.Cesium, this.viewer);
6281
+ i = new Ae(this.Cesium, this.viewer);
6056
6282
  break;
6057
6283
  case "terrainHeight":
6058
- i = new ft(this.Cesium, this.viewer);
6284
+ i = new vt(this.Cesium, this.viewer);
6059
6285
  break;
6060
6286
  case "coordinate":
6061
- i = new yt(this.Cesium, this.viewer);
6287
+ i = new Ct(this.Cesium, this.viewer);
6062
6288
  break;
6063
6289
  case "rectangle":
6064
- i = new wt(this.Cesium, this.viewer);
6290
+ i = new bt(this.Cesium, this.viewer);
6065
6291
  break;
6066
6292
  case "regularPolygon":
6067
- i = new vt(this.Cesium, this.viewer);
6293
+ i = new Pt(this.Cesium, this.viewer);
6068
6294
  break;
6069
6295
  default:
6070
6296
  throw new Error(`Unsupported measurement type: ${t}`);
@@ -6105,8 +6331,8 @@ class On {
6105
6331
  data: this._serializeMetrics(t, o)
6106
6332
  };
6107
6333
  this.measurements.push(r), n && this.recordHandlers.set(r.id, n), this.specifiedClear && this._showDeleteLabels("html-label-container"), (c = e.onComplete) == null || c.call(e, o);
6108
- const l = this.actives.indexOf(n);
6109
- l >= 0 && this.actives.splice(l, 1);
6334
+ const h = this.actives.indexOf(n);
6335
+ h >= 0 && this.actives.splice(h, 1);
6110
6336
  }
6111
6337
  };
6112
6338
  i.start(s);
@@ -6156,37 +6382,37 @@ class On {
6156
6382
  let s = null;
6157
6383
  switch (n.type) {
6158
6384
  case "horizontal":
6159
- s = new ht(this.Cesium, this.viewer);
6385
+ s = new De(this.Cesium, this.viewer);
6160
6386
  break;
6161
6387
  case "vertical":
6162
- s = new ct(this.Cesium, this.viewer);
6388
+ s = new gt(this.Cesium, this.viewer);
6163
6389
  break;
6164
6390
  case "triangle":
6165
- s = new dt(this.Cesium, this.viewer);
6391
+ s = new ft(this.Cesium, this.viewer);
6166
6392
  break;
6167
6393
  case "space":
6168
- s = new pt(this.Cesium, this.viewer);
6394
+ s = new yt(this.Cesium, this.viewer);
6169
6395
  break;
6170
6396
  case "area":
6171
- s = new ut(this.Cesium, this.viewer);
6397
+ s = new Se(this.Cesium, this.viewer);
6172
6398
  break;
6173
6399
  case "circle":
6174
- s = new mt(this.Cesium, this.viewer);
6400
+ s = new wt(this.Cesium, this.viewer);
6175
6401
  break;
6176
6402
  case "polyline":
6177
- s = new gt(this.Cesium, this.viewer);
6403
+ s = new Ae(this.Cesium, this.viewer);
6178
6404
  break;
6179
6405
  case "terrainHeight":
6180
- s = new ft(this.Cesium, this.viewer);
6406
+ s = new vt(this.Cesium, this.viewer);
6181
6407
  break;
6182
6408
  case "coordinate":
6183
- s = new yt(this.Cesium, this.viewer);
6409
+ s = new Ct(this.Cesium, this.viewer);
6184
6410
  break;
6185
6411
  case "rectangle":
6186
- s = new wt(this.Cesium, this.viewer);
6412
+ s = new bt(this.Cesium, this.viewer);
6187
6413
  break;
6188
6414
  case "regularPolygon":
6189
- s = new vt(this.Cesium, this.viewer);
6415
+ s = new Pt(this.Cesium, this.viewer);
6190
6416
  break;
6191
6417
  default:
6192
6418
  s = null;
@@ -6305,13 +6531,13 @@ class On {
6305
6531
  if (this.deleteLabelIds.has(i.id)) continue;
6306
6532
  const s = this._computeRecordCenter(i);
6307
6533
  if (!s) continue;
6308
- const o = e.Cartographic.fromCartesian(s), r = e.Math.toDegrees(o.longitude), l = e.Math.toDegrees(o.latitude), c = o.height || 0;
6534
+ const o = e.Cartographic.fromCartesian(s), r = e.Math.toDegrees(o.longitude), h = e.Math.toDegrees(o.latitude), c = o.height || 0;
6309
6535
  this.deleteLabelPool.add(
6310
6536
  { recordId: i.id },
6311
6537
  {
6312
6538
  id: n,
6313
6539
  lon: r,
6314
- lat: l,
6540
+ lat: h,
6315
6541
  height: c,
6316
6542
  theme: "measure-delete-label",
6317
6543
  show: !0,
@@ -6331,12 +6557,12 @@ class On {
6331
6557
  var n, s;
6332
6558
  const e = this.Cesium, i = (t.positions || []).map((o) => this._toCartesian(o));
6333
6559
  if (i.length > 0) {
6334
- const o = i.reduce((c, d) => c + d.x, 0) / i.length, r = i.reduce((c, d) => c + d.y, 0) / i.length, l = i.reduce((c, d) => c + d.z, 0) / i.length;
6335
- return new e.Cartesian3(o, r, l);
6560
+ const o = i.reduce((c, d) => c + d.x, 0) / i.length, r = i.reduce((c, d) => c + d.y, 0) / i.length, h = i.reduce((c, d) => c + d.z, 0) / i.length;
6561
+ return new e.Cartesian3(o, r, h);
6336
6562
  }
6337
6563
  if (t.type === "coordinate" && ((n = t.data) != null && n.lnglat)) {
6338
- const o = t.data.lnglat.lng, r = t.data.lnglat.lat, l = t.data.lnglat.height || 0;
6339
- return e.Cartesian3.fromDegrees(o, r, l);
6564
+ const o = t.data.lnglat.lng, r = t.data.lnglat.lat, h = t.data.lnglat.height || 0;
6565
+ return e.Cartesian3.fromDegrees(o, r, h);
6340
6566
  }
6341
6567
  if (t.type === "terrainHeight" && ((s = t.data) != null && s.position)) {
6342
6568
  const o = t.data.position;
@@ -6345,18 +6571,18 @@ class On {
6345
6571
  return null;
6346
6572
  }
6347
6573
  }
6348
- class kn {
6574
+ class Ro {
6349
6575
  constructor({ Cesium: t, viewer: e }) {
6350
- h(this, "Cesium");
6351
- h(this, "viewer");
6352
- h(this, "options", null);
6353
- h(this, "entity", null);
6354
- h(this, "viewEntities", []);
6355
- h(this, "startTime", null);
6356
- h(this, "stopTime", null);
6357
- h(this, "isPaused", !1);
6358
- h(this, "lastTime", null);
6359
- h(this, "onTick", (t) => {
6576
+ l(this, "Cesium");
6577
+ l(this, "viewer");
6578
+ l(this, "options", null);
6579
+ l(this, "entity", null);
6580
+ l(this, "viewEntities", []);
6581
+ l(this, "startTime", null);
6582
+ l(this, "stopTime", null);
6583
+ l(this, "isPaused", !1);
6584
+ l(this, "lastTime", null);
6585
+ l(this, "onTick", (t) => {
6360
6586
  if (!this.options || !this.entity) return;
6361
6587
  const e = t.currentTime;
6362
6588
  if (this.Cesium.JulianDate.lessThan(e, this.startTime) || this.Cesium.JulianDate.greaterThan(e, this.stopTime)) {
@@ -6411,14 +6637,14 @@ class kn {
6411
6637
  s.push({ position: m, orientation: p });
6412
6638
  }
6413
6639
  const o = this.Cesium.JulianDate.now(), r = t.speed || 100;
6414
- let l = 0;
6640
+ let h = 0;
6415
6641
  const c = [];
6416
6642
  for (let u = 0; u < s.length; u++) {
6417
6643
  if (u === 0)
6418
6644
  c.push(o.clone());
6419
6645
  else {
6420
6646
  const g = this.Cesium.Cartesian3.distance(s[u - 1].position, s[u].position) / Math.max(r, 0.1);
6421
- l += g, c.push(this.Cesium.JulianDate.addSeconds(o, l, new this.Cesium.JulianDate()));
6647
+ h += g, c.push(this.Cesium.JulianDate.addSeconds(o, h, new this.Cesium.JulianDate()));
6422
6648
  }
6423
6649
  i.addSample(c[u], s[u].position), n.addSample(c[u], s[u].orientation);
6424
6650
  }
@@ -6498,17 +6724,17 @@ class kn {
6498
6724
  // Legacy/Helper methods compatibility if needed, but we are refactoring.
6499
6725
  // We'll keep minimal interface compliance.
6500
6726
  }
6501
- class Fn {
6727
+ class zo {
6502
6728
  constructor({ Cesium: t, viewer: e }) {
6503
- h(this, "Cesium");
6504
- h(this, "viewer");
6505
- h(this, "entity", null);
6506
- h(this, "positionProperty", null);
6507
- h(this, "startTime", null);
6508
- h(this, "stopTime", null);
6509
- h(this, "options", null);
6510
- h(this, "cameraOffset", null);
6511
- h(this, "onTick", (t) => {
6729
+ l(this, "Cesium");
6730
+ l(this, "viewer");
6731
+ l(this, "entity", null);
6732
+ l(this, "positionProperty", null);
6733
+ l(this, "startTime", null);
6734
+ l(this, "stopTime", null);
6735
+ l(this, "options", null);
6736
+ l(this, "cameraOffset", null);
6737
+ l(this, "onTick", (t) => {
6512
6738
  if (!this.options || !this.positionProperty) return;
6513
6739
  const e = t.currentTime, i = this.positionProperty.getValue(e);
6514
6740
  if (this.options.followCamera && this.options.initialView && i) {
@@ -6545,13 +6771,13 @@ class Fn {
6545
6771
  for (let g = 0; g < e.length; g++)
6546
6772
  s.addSample(n[g], e[g]);
6547
6773
  this.positionProperty = s;
6548
- const o = new this.Cesium.VelocityOrientationProperty(s), r = t.showPath ?? !0, l = t.pathColor ?? this.Cesium.Color.YELLOW, c = t.pathWidth ?? 3, d = t.pointColor ?? this.Cesium.Color.RED, u = t.pointPixelSize ?? 8, m = {
6774
+ const o = new this.Cesium.VelocityOrientationProperty(s), r = t.showPath ?? !0, h = t.pathColor ?? this.Cesium.Color.YELLOW, c = t.pathWidth ?? 3, d = t.pointColor ?? this.Cesium.Color.RED, u = t.pointPixelSize ?? 8, m = {
6549
6775
  availability: new this.Cesium.TimeIntervalCollection([
6550
6776
  new this.Cesium.TimeInterval({ start: this.startTime, stop: this.stopTime })
6551
6777
  ]),
6552
6778
  position: s,
6553
6779
  orientation: o,
6554
- path: r ? { material: l, width: c, leadTime: 0 } : void 0
6780
+ path: r ? { material: h, width: c, leadTime: 0 } : void 0
6555
6781
  };
6556
6782
  t.modelUrl ? m.model = {
6557
6783
  uri: t.modelUrl,
@@ -6596,36 +6822,36 @@ class Fn {
6596
6822
  }
6597
6823
  }
6598
6824
  export {
6599
- ut as AreaMeasure,
6600
- En as BufferedHierarchicalAggregator,
6601
- kn as CameraRoamTool,
6602
- mt as CircleMeasure,
6603
- yt as CoordinateMeasure,
6604
- Nt as DOM_EVENT_MAP,
6605
- Mn as DrawTool,
6606
- vn as EditMode,
6607
- Sn as EntityLayerManager,
6608
- In as GLTFManage,
6609
- Cn as GLTFManageEventKey,
6610
- ht as HorizontalMeasure,
6825
+ Se as AreaMeasure,
6826
+ To as BufferedHierarchicalAggregator,
6827
+ Ro as CameraRoamTool,
6828
+ wt as CircleMeasure,
6829
+ Ct as CoordinateMeasure,
6830
+ jt as DOM_EVENT_MAP,
6831
+ xo as DrawTool,
6832
+ Po as EditMode,
6833
+ ko as EntityLayerManager,
6834
+ _o as GLTFManage,
6835
+ Lo as GLTFManageEventKey,
6836
+ De as HorizontalMeasure,
6611
6837
  N as HtmlOverlayLabelPool,
6612
- zt as MarkerEventBus,
6838
+ Bt as MarkerEventBus,
6613
6839
  te as MarkerEventKey,
6614
- Dn as MaterialManager,
6615
- On as MeasurementTool,
6616
- Fn as PathRoamTool,
6617
- gt as PolylineDistanceMeasure,
6618
- $n as PrimitiveManager,
6619
- wt as RectangleMeasure,
6620
- vt as RegularPolygonMeasure,
6621
- pt as SpaceMeasure,
6622
- ft as TerrainHeightMeasure,
6623
- ze as TooltipManager,
6624
- dt as TriangleMeasure,
6625
- ct as VerticalMeasure,
6626
- An as convertGeoJsonToEntityData,
6627
- Tn as getDynamicImgMaterial,
6628
- _n as getPolylineFlowMaterialProperty,
6629
- xn as getWallMaterial
6840
+ $o as MaterialManager,
6841
+ Fo as MeasurementTool,
6842
+ zo as PathRoamTool,
6843
+ Ae as PolylineDistanceMeasure,
6844
+ Ho as PrimitiveManager,
6845
+ bt as RectangleMeasure,
6846
+ Pt as RegularPolygonMeasure,
6847
+ yt as SpaceMeasure,
6848
+ vt as TerrainHeightMeasure,
6849
+ ye as TooltipManager,
6850
+ ft as TriangleMeasure,
6851
+ gt as VerticalMeasure,
6852
+ Oo as convertGeoJsonToEntityData,
6853
+ Do as getDynamicImgMaterial,
6854
+ Ao as getPolylineFlowMaterialProperty,
6855
+ So as getWallMaterial
6630
6856
  };
6631
6857
  //# sourceMappingURL=cesium-core.mjs.map