leiting-bim 2.1.157 → 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,24 +1521,24 @@ 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;
1473
- function Qt(a) {
1536
+ function Zt(a) {
1474
1537
  return Jt.call(a);
1475
1538
  }
1476
- var Zt = "[object Null]", ei = "[object Undefined]", Be = ge ? ge.toStringTag : void 0;
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 : Zt : Be && Be in Object(a) ? Kt(a) : Qt(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]", Qi = "[object Float32Array]", Zi = "[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[Qi] = H[Zi] = 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;
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 = {};
1670
+ H[Zi] = H[Qi] = H[es] = H[ts] = H[is] = H[ss] = H[os] = H[ns] = H[rs] = !0;
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,27 +1870,27 @@ 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) {
1814
1877
  return a.slice();
1815
1878
  }
1816
- function Qs(a, t) {
1879
+ function Zs(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 Zs() {
1886
+ function Qs() {
1824
1887
  return [];
1825
1888
  }
1826
- var eo = Object.prototype, to = eo.propertyIsEnumerable, Qe = Object.getOwnPropertySymbols, io = Qe ? function(a) {
1827
- return a == null ? [] : (a = Object(a), Qs(Qe(a), function(t) {
1889
+ var eo = Object.prototype, to = eo.propertyIsEnumerable, Ze = Object.getOwnPropertySymbols, io = Ze ? function(a) {
1890
+ return a == null ? [] : (a = Object(a), Zs(Ze(a), function(t) {
1828
1891
  return to.call(a, t);
1829
1892
  }));
1830
- } : Zs;
1893
+ } : Qs;
1831
1894
  function so(a, t, e) {
1832
1895
  var i = t(a);
1833
1896
  return _e(a) ? i : Bs(i, e(a));
@@ -1835,15 +1898,15 @@ function so(a, t, e) {
1835
1898
  function oo(a) {
1836
1899
  return so(a, ys, io);
1837
1900
  }
1838
- var Fe = de(ie, "DataView"), Re = de(ie, "Promise"), He = de(ie, "Set"), Ze = "[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()) != Ze || Re && re(Re.resolve()) != et || He && re(new He()) != tt || ke && re(new ke()) != it) && (re = function(a) {
1901
+ 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;
1902
+ (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
1903
  var t = Ee(a), e = t == no ? a.constructor : void 0, i = e ? ce(e) : "";
1841
1904
  if (i)
1842
1905
  switch (i) {
1843
1906
  case ro:
1844
1907
  return st;
1845
1908
  case ao:
1846
- return Ze;
1909
+ return Qe;
1847
1910
  case lo:
1848
1911
  return et;
1849
1912
  case ho:
@@ -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]", Qo = "[object Map]", Zo = "[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[Qo] = R[Zo] = 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;
@@ -2691,12 +2754,15 @@ class Dn {
2691
2754
  category: e,
2692
2755
  options: i
2693
2756
  }) {
2694
- var n;
2695
- return e = e || "default", this.CategoryGet[e] ? this.CategoryGet[e]({
2696
- themeKey: t,
2697
- materialMap: this.categoryMap,
2698
- options: i || {}
2699
- }) : (n = this.categoryMap.get(e)) == null ? void 0 : n.get(t);
2757
+ var s;
2758
+ if (e = e || "default", this.CategoryGet[e])
2759
+ return this.CategoryGet[e]({
2760
+ themeKey: t,
2761
+ materialMap: this.categoryMap,
2762
+ options: i || {}
2763
+ });
2764
+ const n = (s = this.categoryMap.get(e)) == null ? void 0 : s.get(t);
2765
+ return typeof n == "function" && n.__materialFactory === !0 ? n(i || {}) : n;
2700
2766
  }
2701
2767
  /**
2702
2768
  * 是否存在
@@ -2828,24 +2894,26 @@ class Pn {
2828
2894
  });
2829
2895
  }
2830
2896
  createWall(t, e) {
2831
- var l, c;
2832
2897
  if (!t.positions || t.positions.length < 1) return null;
2833
2898
  const i = this.materialManager.get({
2834
2899
  themeKey: t.theme,
2835
2900
  category: "wall",
2836
2901
  options: t
2837
- }), n = t.positions.length === ((l = t.minimumHeights) == null ? void 0 : l.length) ? t.minimumHeights.map((d) => d - Number(t.minHeight || 0)) : t.positions.map((d) => (d[2] || 0) - Number(t.minHeight || 0)), s = t.positions.length === ((c = t.maximumHeights) == null ? void 0 : c.length) ? t.maximumHeights.map((d) => d + Number(t.maxHeight || 0)) : t.positions.map((d) => (d[2] || 0) + Number(t.maxHeight || 0)), o = t.positions.map(
2838
- (d) => this.Cesium.Cartesian3.fromDegrees(d[0], d[1], d[2] || 0)
2902
+ }), n = (v, C = 0) => {
2903
+ const b = Number(v);
2904
+ return Number.isFinite(b) ? b : C;
2905
+ }, 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(
2906
+ (v) => this.Cesium.Cartesian3.fromDegrees(v[0], v[1], v[2] || 0)
2839
2907
  );
2840
- let r = {
2908
+ let y = {
2841
2909
  ...t
2842
2910
  };
2843
- return i && (r.material = i), this.viewer.entities.add({
2911
+ return i && (y.material = i), this.viewer.entities.add({
2844
2912
  wall: {
2845
- ...r,
2846
- positions: o,
2847
- minimumHeights: n,
2848
- maximumHeights: s
2913
+ ...y,
2914
+ positions: w,
2915
+ minimumHeights: m,
2916
+ maximumHeights: f
2849
2917
  },
2850
2918
  show: (t.show ?? !0) && e
2851
2919
  });
@@ -3982,7 +4050,7 @@ class dt {
3982
4050
  }
3983
4051
  });
3984
4052
  if (this.pointEntities.push(o), this.positions.length === 2) {
3985
- 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);
3986
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);
3987
4055
  e.Cartographic.fromCartesian(f);
3988
4056
  const y = Math.max(m, g), v = e.Cartesian3.fromDegrees(
@@ -4014,31 +4082,31 @@ class dt {
4014
4082
  this.segmentEntities.push(M, P, L);
4015
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";
4016
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" } });
4017
- 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";
4018
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" } });
4019
4087
  const me = Math.max(0.01, Math.min(0.5, t.angleMarkerRatio ?? 0.2)), V = Math.min(E, I) * me;
4020
4088
  if (E > 1e-3 && I > 1e-3) {
4021
- const K = e.Cartesian3.normalize(
4089
+ const q = e.Cartesian3.normalize(
4022
4090
  e.Cartesian3.subtract(p, v, new e.Cartesian3()),
4023
4091
  new e.Cartesian3()
4024
4092
  ), ne = e.Cartesian3.normalize(
4025
4093
  e.Cartesian3.subtract(f, v, new e.Cartesian3()),
4026
4094
  new e.Cartesian3()
4027
- ), Q = new e.Cartesian3(
4028
- v.x + K.x * V,
4029
- v.y + K.y * V,
4030
- v.z + K.z * V
4095
+ ), Z = new e.Cartesian3(
4096
+ v.x + q.x * V,
4097
+ v.y + q.y * V,
4098
+ v.z + q.z * V
4031
4099
  ), k = new e.Cartesian3(
4032
4100
  v.x + ne.x * V,
4033
4101
  v.y + ne.y * V,
4034
4102
  v.z + ne.z * V
4035
4103
  ), U = new e.Cartesian3(
4036
- v.x + K.x * V + ne.x * V,
4037
- v.y + K.y * V + ne.y * V,
4038
- v.z + K.z * V + ne.z * V
4039
- ), Z = i.entities.add({
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
4107
+ ), Q = i.entities.add({
4040
4108
  polyline: {
4041
- positions: [Q, U],
4109
+ positions: [Z, U],
4042
4110
  width: t.width || 3,
4043
4111
  material: C,
4044
4112
  depthFailMaterial: new e.PolylineDashMaterialProperty({ color: b, dashLength: 12, dashPattern: 255 })
@@ -4051,7 +4119,7 @@ class dt {
4051
4119
  depthFailMaterial: new e.PolylineDashMaterialProperty({ color: b, dashLength: 12, dashPattern: 255 })
4052
4120
  }
4053
4121
  });
4054
- this.angleMarkerEntities.push(Z, Ie);
4122
+ this.angleMarkerEntities.push(Q, Ie);
4055
4123
  }
4056
4124
  this.previewLabelId && this.htmlLabelPool && (this.htmlLabelPool.removeByIds([this.previewLabelId]), this.previewLabelId = null);
4057
4125
  const W = {
@@ -4107,8 +4175,8 @@ class dt {
4107
4175
  });
4108
4176
  this.previewSegmentEntities.push(Y, J, oe);
4109
4177
  }
4110
- 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";
4111
- 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" } });
4112
4180
  const ve = Math.max(0.01, Math.min(0.5, t.angleMarkerRatio ?? 0.2)), j = Math.min(y, v) * ve;
4113
4181
  if (y > 1e-3 && v > 1e-3) {
4114
4182
  const Y = e.Cartesian3.normalize(
@@ -4138,7 +4206,7 @@ class dt {
4138
4206
  material: f,
4139
4207
  depthFailMaterial: new e.PolylineDashMaterialProperty({ color: w, dashLength: 12, dashPattern: 255 })
4140
4208
  }
4141
- }), K = i.entities.add({
4209
+ }), q = i.entities.add({
4142
4210
  polyline: {
4143
4211
  positions: new e.CallbackProperty(() => !this.previewMarkerP2 || !this.previewMarkerCorner ? [] : [this.previewMarkerP2, this.previewMarkerCorner], !1),
4144
4212
  width: t.width || 3,
@@ -4146,7 +4214,7 @@ class dt {
4146
4214
  depthFailMaterial: new e.PolylineDashMaterialProperty({ color: w, dashLength: 12, dashPattern: 255 })
4147
4215
  }
4148
4216
  });
4149
- this.previewAngleMarkerEntities.push(W, K);
4217
+ this.previewAngleMarkerEntities.push(W, q);
4150
4218
  }
4151
4219
  }
4152
4220
  }, e.ScreenSpaceEventType.MOUSE_MOVE);
@@ -4158,27 +4226,27 @@ class dt {
4158
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 = [];
4159
4227
  }
4160
4228
  rehydrate(t, e) {
4161
- var K, ne;
4162
- 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((Q) => new i.Cartesian3(Q[0], Q[1], Q[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]));
4163
4231
  if (c.length < 2) return;
4164
4232
  if (!this.htmlLabelPool) {
4165
- const Q = s.overlayContainerId || "html-label-container";
4166
- this.htmlLabelPool = e || new N(i, n, Q), this.htmlLabelPool.registerTheme("measure-triangle", {
4233
+ const Z = s.overlayContainerId || "html-label-container";
4234
+ this.htmlLabelPool = e || new N(i, n, Z), this.htmlLabelPool.registerTheme("measure-triangle", {
4167
4235
  createElement: (k, U) => {
4168
- var Z;
4169
- k.innerHTML = String(((Z = U == null ? void 0 : U.data) == null ? void 0 : Z.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";
4236
+ var Q;
4237
+ 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";
4170
4238
  },
4171
4239
  options: { offset: { x: 0, y: -10 } }
4172
4240
  }), this.htmlLabelPool.registerTheme("measure-triangle-seg", {
4173
4241
  createElement: (k, U) => {
4174
- var Z;
4175
- k.innerHTML = String(((Z = U == null ? void 0 : U.data) == null ? void 0 : Z.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";
4242
+ var Q;
4243
+ 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";
4176
4244
  },
4177
4245
  options: { offset: { x: 0, y: -10 } }
4178
4246
  }), this.htmlLabelPool.registerTheme("measure-triangle-angle", {
4179
4247
  createElement: (k, U) => {
4180
- var Z;
4181
- k.innerHTML = String(((Z = U == null ? void 0 : U.data) == null ? void 0 : Z.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";
4248
+ var Q;
4249
+ 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";
4182
4250
  },
4183
4251
  options: { offset: { x: 0, y: -10 } }
4184
4252
  });
@@ -4199,11 +4267,11 @@ class dt {
4199
4267
  this.segmentEntities.push(M, P, L);
4200
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";
4201
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" } });
4202
- 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";
4203
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" } });
4204
4272
  const V = Math.max(0.01, Math.min(0.5, s.angleMarkerRatio ?? 0.2)), W = Math.min(E, I) * V;
4205
4273
  if (E > 1e-3 && I > 1e-3) {
4206
- const Q = 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 + Q.x * W, b.y + Q.y * W, b.z + Q.z * W), Z = new i.Cartesian3(b.x + k.x * W, b.y + k.y * W, b.z + k.z * W), Ie = new i.Cartesian3(b.x + Q.x * W + k.x * W, b.y + Q.y * W + k.y * W, b.z + Q.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: [Z, Ie], width: l, material: o, depthFailMaterial: new i.PolylineDashMaterialProperty({ color: r, dashLength: 12, dashPattern: 255 }) } });
4274
+ 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 }) } });
4207
4275
  this.angleMarkerEntities.push(kt, Ft);
4208
4276
  }
4209
4277
  }
@@ -5424,11 +5492,11 @@ ${f.area}:${m.toFixed(2)} m²` },
5424
5492
  [l[3], l[0]]
5425
5493
  ];
5426
5494
  for (let x = 0; x < w.length; x++) {
5427
- 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}`;
5428
- 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(
5429
5497
  { text: `${f.side}:${Number(z).toFixed(2)} m` },
5430
5498
  {
5431
- id: q,
5499
+ id: K,
5432
5500
  lon: e.Math.toDegrees(B.longitude),
5433
5501
  lat: e.Math.toDegrees(B.latitude),
5434
5502
  height: B.height || 0,
@@ -5795,7 +5863,7 @@ class vt {
5795
5863
  for (let O = 1; O < g.length; O++) {
5796
5864
  const x = g[O - 1], $ = g[O], F = e.Cartographic.fromCartesian(x), z = e.Cartographic.fromCartesian($), B = new e.EllipsoidGeodesic(F, z).surfaceDistance;
5797
5865
  A += B;
5798
- 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}`;
5799
5867
  this.segmentLabelIds.push(se), this.htmlLabelPool.add(
5800
5868
  { text: `${T.side}:${B.toFixed(2)} m` },
5801
5869
  {