leiting-bim 2.1.159 → 2.1.160

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.
@@ -1075,6 +1075,8 @@ class Bt {
1075
1075
  h(this, "entity", null);
1076
1076
  h(this, "tooltip", null);
1077
1077
  h(this, "tempPoints", []);
1078
+ h(this, "options", null);
1079
+ h(this, "keydownHandler", null);
1078
1080
  this.Cesium = t, this.viewer = e;
1079
1081
  }
1080
1082
  getPickPosition(t) {
@@ -1093,9 +1095,58 @@ class Bt {
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 l = this.tempPoints.pop();
1119
+ l && this.viewer.entities.remove(l);
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((l) => {
1123
+ const c = e.Cartographic.fromCartesian(l);
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) => {
1149
+ this.options = t, this.positions = [], this.tempPoints = [], this.entity = null, this.tooltip = new ze(), this.tooltip.show("单击左键添加点,右键撤销,双击左键或 Esc 结束"), this.handler = new e.ScreenSpaceEventHandler(i.canvas), this.bindKeyboardEvents(), this.handler.setInputAction((n) => {
1099
1150
  var r, l;
1100
1151
  const s = this.getPickPosition(n.position);
1101
1152
  if (!s) return;
@@ -1117,35 +1168,19 @@ class Bt {
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
1186
  class jt {
@@ -1329,6 +1364,8 @@ class Vt {
1329
1364
  h(this, "entity", null);
1330
1365
  h(this, "tooltip", null);
1331
1366
  h(this, "tempPoints", []);
1367
+ h(this, "options", null);
1368
+ h(this, "keydownHandler", null);
1332
1369
  this.Cesium = t, this.viewer = e;
1333
1370
  }
1334
1371
  isHelperPick(t) {
@@ -1365,9 +1402,44 @@ class Vt {
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 ze(), 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,28 +1469,19 @@ 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
1487
  class Mn {
@@ -1458,15 +1521,15 @@ 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) {
1524
+ 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, Kt = bt.toString, Ce = ge ? ge.toStringTag : void 0;
1525
+ function qt(a) {
1463
1526
  var t = Ut.call(a, Ce), e = a[Ce];
1464
1527
  try {
1465
1528
  a[Ce] = void 0;
1466
1529
  var i = !0;
1467
1530
  } catch {
1468
1531
  }
1469
- var n = qt.call(a);
1532
+ var n = Kt.call(a);
1470
1533
  return i && (t ? a[Ce] = e : delete a[Ce]), n;
1471
1534
  }
1472
1535
  var Xt = Object.prototype, Jt = Xt.toString;
@@ -1475,7 +1538,7 @@ function Zt(a) {
1475
1538
  }
1476
1539
  var Qt = "[object Null]", ei = "[object Undefined]", Be = ge ? ge.toStringTag : void 0;
1477
1540
  function Ee(a) {
1478
- return a == null ? a === void 0 ? ei : Qt : Be && Be in Object(a) ? Kt(a) : Zt(a);
1541
+ return a == null ? a === void 0 ? ei : Qt : Be && Be in Object(a) ? qt(a) : Zt(a);
1479
1542
  }
1480
1543
  function Me(a) {
1481
1544
  return a != null && typeof a == "object";
@@ -1603,9 +1666,9 @@ var It = Object.prototype, Si = It.hasOwnProperty, Ai = It.propertyIsEnumerable,
1603
1666
  function Oi() {
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 = {};
1669
+ var Tt = typeof exports == "object" && exports && !exports.nodeType && exports, Ue = Tt && typeof module == "object" && module && !module.nodeType && module, ki = Ue && Ue.exports === Tt, Ke = ki ? ie.Buffer : void 0, Fi = Ke ? Ke.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]", Ki = "[object String]", qi = "[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
1670
  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;
1671
+ 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[Ki] = H[qi] = !1;
1609
1672
  function as(a) {
1610
1673
  return Me(a) && Et(a.length) && !!H[Ee(a)];
1611
1674
  }
@@ -1620,7 +1683,7 @@ var _t = typeof exports == "object" && exports && !exports.nodeType && exports,
1620
1683
  return a || Oe && Oe.binding && Oe.binding("util");
1621
1684
  } catch {
1622
1685
  }
1623
- })(), Ke = fe && fe.isTypedArray, hs = Ke ? Ne(Ke) : as, cs = Object.prototype, ds = cs.hasOwnProperty;
1686
+ })(), qe = fe && fe.isTypedArray, hs = qe ? Ne(qe) : as, cs = Object.prototype, ds = cs.hasOwnProperty;
1624
1687
  function ps(a, t) {
1625
1688
  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;
1626
1689
  for (var c in a)
@@ -1788,12 +1851,12 @@ function Ws(a) {
1788
1851
  function Us(a) {
1789
1852
  return this.__data__.has(a);
1790
1853
  }
1791
- var qs = 200;
1792
- function Ks(a, t) {
1854
+ var Ks = 200;
1855
+ function qs(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 (!Le || i.length < Ks - 1)
1797
1860
  return i.push([a, t]), this.size = ++e.size, this;
1798
1861
  e = this.__data__ = new ye(i);
1799
1862
  }
@@ -1807,7 +1870,7 @@ we.prototype.clear = Ys;
1807
1870
  we.prototype.delete = Vs;
1808
1871
  we.prototype.get = Ws;
1809
1872
  we.prototype.has = Us;
1810
- we.prototype.set = Ks;
1873
+ we.prototype.set = qs;
1811
1874
  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
1875
  Je && Je.allocUnsafe;
1813
1876
  function Js(a, t) {
@@ -1925,8 +1988,8 @@ var at = fe && fe.isMap, jo = at ? Ne(at) : Bo, Yo = "[object Set]";
1925
1988
  function Vo(a) {
1926
1989
  return Me(a) && re(a) == Yo;
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;
1991
+ var lt = fe && fe.isSet, Wo = lt ? Ne(lt) : Vo, At = "[object Arguments]", Uo = "[object Array]", Ko = "[object Boolean]", qo = "[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 = {};
1992
+ R[At] = R[Uo] = R[rn] = R[an] = R[Ko] = R[qo] = 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
1993
  R[Xo] = R[$t] = R[nn] = !1;
1931
1994
  function xe(a, t, e, i, n, s) {
1932
1995
  var o;
@@ -3987,7 +4050,7 @@ class dt {
3987
4050
  }
3988
4051
  });
3989
4052
  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);
4053
+ 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
4054
  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
4055
  e.Cartographic.fromCartesian(f);
3993
4056
  const y = Math.max(m, g), v = e.Cartesian3.fromDegrees(
@@ -4019,28 +4082,28 @@ class dt {
4019
4082
  this.segmentEntities.push(M, P, L);
4020
4083
  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
4084
  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";
4085
+ 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), ve = 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 / (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
4086
  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" } });
4024
4087
  const me = Math.max(0.01, Math.min(0.5, t.angleMarkerRatio ?? 0.2)), V = Math.min(E, I) * me;
4025
4088
  if (E > 1e-3 && I > 1e-3) {
4026
- const K = e.Cartesian3.normalize(
4089
+ const q = e.Cartesian3.normalize(
4027
4090
  e.Cartesian3.subtract(p, v, new e.Cartesian3()),
4028
4091
  new e.Cartesian3()
4029
4092
  ), ne = e.Cartesian3.normalize(
4030
4093
  e.Cartesian3.subtract(f, v, new e.Cartesian3()),
4031
4094
  new e.Cartesian3()
4032
4095
  ), Z = new e.Cartesian3(
4033
- v.x + K.x * V,
4034
- v.y + K.y * V,
4035
- v.z + K.z * V
4096
+ v.x + q.x * V,
4097
+ v.y + q.y * V,
4098
+ v.z + q.z * V
4036
4099
  ), k = new e.Cartesian3(
4037
4100
  v.x + ne.x * V,
4038
4101
  v.y + ne.y * V,
4039
4102
  v.z + ne.z * V
4040
4103
  ), 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
4104
+ v.x + q.x * V + ne.x * V,
4105
+ v.y + q.y * V + ne.y * V,
4106
+ v.z + q.z * V + ne.z * V
4044
4107
  ), Q = i.entities.add({
4045
4108
  polyline: {
4046
4109
  positions: [Z, U],
@@ -4112,8 +4175,8 @@ class dt {
4112
4175
  });
4113
4176
  this.previewSegmentEntities.push(Y, J, oe);
4114
4177
  }
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" } });
4178
+ 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), 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";
4179
+ 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(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
4180
  const ve = Math.max(0.01, Math.min(0.5, t.angleMarkerRatio ?? 0.2)), j = Math.min(y, v) * ve;
4118
4181
  if (y > 1e-3 && v > 1e-3) {
4119
4182
  const Y = e.Cartesian3.normalize(
@@ -4143,7 +4206,7 @@ class dt {
4143
4206
  material: f,
4144
4207
  depthFailMaterial: new e.PolylineDashMaterialProperty({ color: w, dashLength: 12, dashPattern: 255 })
4145
4208
  }
4146
- }), K = i.entities.add({
4209
+ }), q = i.entities.add({
4147
4210
  polyline: {
4148
4211
  positions: new e.CallbackProperty(() => !this.previewMarkerP2 || !this.previewMarkerCorner ? [] : [this.previewMarkerP2, this.previewMarkerCorner], !1),
4149
4212
  width: t.width || 3,
@@ -4151,7 +4214,7 @@ class dt {
4151
4214
  depthFailMaterial: new e.PolylineDashMaterialProperty({ color: w, dashLength: 12, dashPattern: 255 })
4152
4215
  }
4153
4216
  });
4154
- this.previewAngleMarkerEntities.push(W, K);
4217
+ this.previewAngleMarkerEntities.push(W, q);
4155
4218
  }
4156
4219
  }
4157
4220
  }, e.ScreenSpaceEventType.MOUSE_MOVE);
@@ -4163,8 +4226,8 @@ class dt {
4163
4226
  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
4227
  }
4165
4228
  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]));
4229
+ var q, ne;
4230
+ const i = this.Cesium, n = this.viewer, s = t.options || {}, o = s.lineColor || s.color || i.Color.YELLOW, r = ((ne = (q = s.dashLineColor || s.lineColor || s.color || i.Color.RED).withAlpha) == null ? void 0 : ne.call(q, 0.9)) || i.Color.RED, l = s.width || 3, c = (t.positions || []).map((Z) => new i.Cartesian3(Z[0], Z[1], Z[2]));
4168
4231
  if (c.length < 2) return;
4169
4232
  if (!this.htmlLabelPool) {
4170
4233
  const Z = s.overlayContainerId || "html-label-container";
@@ -4204,7 +4267,7 @@ class dt {
4204
4267
  this.segmentEntities.push(M, P, L);
4205
4268
  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
4269
  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";
4270
+ 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), ve = 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 / (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
4271
  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" } });
4209
4272
  const V = Math.max(0.01, Math.min(0.5, s.angleMarkerRatio ?? 0.2)), W = Math.min(E, I) * V;
4210
4273
  if (E > 1e-3 && I > 1e-3) {
@@ -5429,11 +5492,11 @@ ${f.area}:${m.toFixed(2)} m²` },
5429
5492
  [l[3], l[0]]
5430
5493
  ];
5431
5494
  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(
5495
+ 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), K = `measure_rectangle_seg_${Date.now()}_${x}`;
5496
+ this.segmentLabelIds.push(K), this.htmlLabelPool.add(
5434
5497
  { text: `${f.side}:${Number(z).toFixed(2)} m` },
5435
5498
  {
5436
- id: q,
5499
+ id: K,
5437
5500
  lon: e.Math.toDegrees(B.longitude),
5438
5501
  lat: e.Math.toDegrees(B.latitude),
5439
5502
  height: B.height || 0,
@@ -5800,7 +5863,7 @@ class vt {
5800
5863
  for (let O = 1; O < g.length; O++) {
5801
5864
  const x = g[O - 1], $ = g[O], F = e.Cartographic.fromCartesian(x), z = e.Cartographic.fromCartesian($), B = new e.EllipsoidGeodesic(F, z).surfaceDistance;
5802
5865
  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}`;
5866
+ 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()}_${O - 1}`;
5804
5867
  this.segmentLabelIds.push(se), this.htmlLabelPool.add(
5805
5868
  { text: `${T.side}:${B.toFixed(2)} m` },
5806
5869
  {