leiting-bim 2.1.100 → 2.1.103
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/leiting-bim.es.js +1 -1
- package/leiting-bim.umd.js +2 -2
- package/package.json +1 -1
- package/plugins/cesium-core/dist/cesium-core.mjs +352 -337
- package/plugins/cesium-core/dist/cesium-core.mjs.map +1 -1
- package/plugins/cesium-core/dist/cesium-core.umd.js +20 -20
- package/plugins/cesium-core/dist/cesium-core.umd.js.map +1 -1
- package/plugins/cesium-core/dist/components/BufferedHierarchicalAggregator.d.ts +6 -0
- package/plugins/cesium-vue/dist/cesium-vue/src/components/marker-default/index.d.ts +9 -0
- package/plugins/cesium-vue/dist/components/marker-default.js +25 -19
- package/plugins/cesium-vue/dist/components/marker-default.js.map +1 -1
- package/plugins/cesium-vue/dist/components/marker-manage.js +262 -245
- package/plugins/cesium-vue/dist/components/marker-manage.js.map +1 -1
|
@@ -30,17 +30,15 @@ class Lr {
|
|
|
30
30
|
h(this, "_cameraDirty", !1);
|
|
31
31
|
h(this, "_tileLoadListener", null);
|
|
32
32
|
h(this, "_cameraChangedHandler", null);
|
|
33
|
+
// 默认显示的地图层级区间(兼容旧数据)
|
|
34
|
+
h(this, "defaultMinLevel", 0);
|
|
35
|
+
h(this, "defaultMaxLevel", 28);
|
|
33
36
|
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;
|
|
34
37
|
const r = this.viewer.scene && this.viewer.scene.globe, s = r && r._surface, o = s && s._tileProvider, n = (o == null ? void 0 : o.tilingScheme) || new this.Cesium.GeographicTilingScheme();
|
|
35
38
|
this._lastTileProvider = o, this.tilingScheme = n, this.levels = this._createLevels(), this._buildLevels(), this._updateFn = this._update.bind(this), r && (this._tileLoadListener = (l) => {
|
|
36
39
|
l === 0 && this._cameraDirty && (this._cameraDirty = !1, this._scheduleUpdate());
|
|
37
40
|
}, r.tileLoadProgressEvent.addEventListener(this._tileLoadListener)), this._cameraChangedHandler = () => {
|
|
38
|
-
|
|
39
|
-
if (!c) {
|
|
40
|
-
this._scheduleUpdate();
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
this._cameraDirty = !0, c.tilesLoaded && (this._cameraDirty = !1, this._scheduleUpdate());
|
|
41
|
+
this._update();
|
|
44
42
|
}, this.viewer.camera.changed.addEventListener(this._cameraChangedHandler);
|
|
45
43
|
}
|
|
46
44
|
setGroupByTheme(t, e = !0, i = !0) {
|
|
@@ -83,14 +81,14 @@ class Lr {
|
|
|
83
81
|
}
|
|
84
82
|
appendPoints(t, e = !0) {
|
|
85
83
|
for (const i of t)
|
|
86
|
-
this.points.push(i);
|
|
84
|
+
this._preparePointLevelRange(i), this.points.push(i);
|
|
87
85
|
for (const i of t)
|
|
88
86
|
this._addPointToGrid(i);
|
|
89
87
|
e && this._scheduleUpdate();
|
|
90
88
|
}
|
|
91
89
|
_scheduleUpdate() {
|
|
92
90
|
this._updateTimer !== null && clearTimeout(this._updateTimer), this._updateTimer = window.setTimeout(() => {
|
|
93
|
-
this._update(), this._updateTimer = null;
|
|
91
|
+
this._update(), this._cameraDirty = !0, this._updateTimer = null;
|
|
94
92
|
}, this._updateDelay);
|
|
95
93
|
}
|
|
96
94
|
updatePoint(t) {
|
|
@@ -116,7 +114,7 @@ class Lr {
|
|
|
116
114
|
} else {
|
|
117
115
|
const f = this.groupByTheme ? (o = i.data) == null ? void 0 : o.theme : this.clusterTheme, w = g.groups.get(f);
|
|
118
116
|
if (w) {
|
|
119
|
-
const y = w.findIndex((
|
|
117
|
+
const y = w.findIndex((v) => v.id === t.id);
|
|
120
118
|
y !== -1 && w.splice(y, 1), w.length === 0 && g.groups.delete(f);
|
|
121
119
|
}
|
|
122
120
|
}
|
|
@@ -174,74 +172,91 @@ class Lr {
|
|
|
174
172
|
}
|
|
175
173
|
}
|
|
176
174
|
}
|
|
175
|
+
// 在添加/更新点时预计算并缓存地图层级区间
|
|
176
|
+
_preparePointLevelRange(t) {
|
|
177
|
+
const e = t.data || {};
|
|
178
|
+
let i = e.minLevel, r = e.maxLevel;
|
|
179
|
+
const s = e.levelRange;
|
|
180
|
+
Array.isArray(s) ? (s.length > 0 && i == null && (i = s[0]), s.length > 1 && r == null && (r = s[1])) : s && typeof s == "object" && (i == null && typeof s.min == "number" && (i = s.min), r == null && typeof s.max == "number" && (r = s.max));
|
|
181
|
+
const o = i == null ? this.defaultMinLevel : Number(i) || this.defaultMinLevel, n = r == null ? this.defaultMaxLevel : Number(r) || this.defaultMaxLevel;
|
|
182
|
+
t.__minLevel = o, t.__maxLevel = n;
|
|
183
|
+
}
|
|
184
|
+
_isVisibleAtLevel(t, e) {
|
|
185
|
+
if (e == null) return !0;
|
|
186
|
+
(t.__minLevel === void 0 || t.__maxLevel === void 0) && this._preparePointLevelRange(t);
|
|
187
|
+
const i = t.__minLevel ?? this.defaultMinLevel, r = t.__maxLevel ?? this.defaultMaxLevel;
|
|
188
|
+
return e >= i && e <= r;
|
|
189
|
+
}
|
|
177
190
|
_update() {
|
|
178
191
|
var r, s, o, n;
|
|
179
192
|
if (!this.labelPool) return;
|
|
180
193
|
this._syncTilingSchemeAndLevels(), this.labelPool.reset(), this.debugCurrentGrids && this._clearDebugGrids();
|
|
181
194
|
const t = this.points.length < this.minGlobalPointCount ? 1 / 0 : this.threshold;
|
|
182
195
|
let e = 0;
|
|
183
|
-
const i = (l, c, d) => {
|
|
184
|
-
var
|
|
196
|
+
const i = (l, c, d, u) => {
|
|
197
|
+
var _, S, T, D, x, A, O, $, k, j, Y, G, q, X, se, le, he;
|
|
185
198
|
if (e >= this.displayLimit || l < 0) return;
|
|
186
199
|
l >= this.levels.length && (l = this.levels.length - 1);
|
|
187
|
-
const
|
|
188
|
-
if (!
|
|
189
|
-
const
|
|
190
|
-
if (!
|
|
191
|
-
const
|
|
192
|
-
for (const B of
|
|
193
|
-
if (((
|
|
200
|
+
const m = this.levels[l], g = l === this.levels.length - 1, p = m.level, f = this.gridLayers.get(p);
|
|
201
|
+
if (!f) return;
|
|
202
|
+
const w = `${c}_${d}`, y = f.get(w);
|
|
203
|
+
if (!y) return;
|
|
204
|
+
const v = this.tilingScheme.tileXYToRectangle(c, d, p), b = this.Cesium.Math.toDegrees(v.west), C = this.Cesium.Math.toDegrees(v.south), M = this.Cesium.Math.toDegrees(v.east), P = this.Cesium.Math.toDegrees(v.north), L = (b + M) / 2, E = (C + P) / 2, I = u;
|
|
205
|
+
for (const B of y.skipPoints)
|
|
206
|
+
if (((_ = B.data) == null ? void 0 : _.show) !== !1) {
|
|
194
207
|
if (e >= this.displayLimit) break;
|
|
195
|
-
this.labelPool.add(B.data, {
|
|
208
|
+
this._isVisibleAtLevel(B, I) && (this.labelPool.add(B.data, {
|
|
196
209
|
id: `point-${B.id}`,
|
|
197
210
|
lon: B.lon,
|
|
198
211
|
lat: B.lat,
|
|
199
212
|
height: B.height,
|
|
200
|
-
theme: ((
|
|
213
|
+
theme: ((D = (T = (S = B.data) == null ? void 0 : S.billboard) == null ? void 0 : T[0]) == null ? void 0 : D.theme) || this.pointTheme,
|
|
201
214
|
style: B.style
|
|
202
|
-
}), e
|
|
215
|
+
}), e++);
|
|
203
216
|
}
|
|
204
217
|
if (e >= this.displayLimit) {
|
|
205
|
-
this.debugCurrentGrids && this._drawDebugGrid(
|
|
218
|
+
this.debugCurrentGrids && this._drawDebugGrid(b, C, M, P, w);
|
|
206
219
|
return;
|
|
207
220
|
}
|
|
208
|
-
for (const [B,
|
|
209
|
-
const
|
|
210
|
-
var
|
|
211
|
-
return ((
|
|
221
|
+
for (const [B, V] of y.groups) {
|
|
222
|
+
const J = V.filter((R) => {
|
|
223
|
+
var re;
|
|
224
|
+
return ((re = R.data) == null ? void 0 : re.show) !== !1;
|
|
212
225
|
});
|
|
213
|
-
if (
|
|
214
|
-
let
|
|
215
|
-
if (this.centralPointMode == "firstPoint" && (
|
|
216
|
-
for (const R of
|
|
226
|
+
if (J.length === 0) continue;
|
|
227
|
+
let ie = L, W = E, Q = ((x = J[0]) == null ? void 0 : x.height) || 0;
|
|
228
|
+
if (this.centralPointMode == "firstPoint" && (ie = ((A = J[0]) == null ? void 0 : A.lon) || 0, W = ((O = J[0]) == null ? void 0 : O.lat) || 0, Q = (($ = J[0]) == null ? void 0 : $.height) || 0), g || J.length < t)
|
|
229
|
+
for (const R of J) {
|
|
217
230
|
if (e >= this.displayLimit) break;
|
|
218
|
-
this.labelPool.add(R.data, {
|
|
231
|
+
this._isVisibleAtLevel(R, I) && (this.labelPool.add(R.data, {
|
|
219
232
|
id: `point-${R.id}`,
|
|
220
233
|
lon: R.lon,
|
|
221
234
|
lat: R.lat,
|
|
222
235
|
height: R.height,
|
|
223
|
-
theme: ((
|
|
236
|
+
theme: ((Y = (j = (k = R.data) == null ? void 0 : k.billboard) == null ? void 0 : j[0]) == null ? void 0 : Y.theme) || this.pointTheme,
|
|
224
237
|
style: R.style
|
|
225
|
-
}), e
|
|
238
|
+
}), e++);
|
|
226
239
|
}
|
|
227
240
|
else {
|
|
228
241
|
if (e >= this.displayLimit) break;
|
|
229
|
-
const
|
|
242
|
+
const R = I == null ? J : J.filter((Z) => this._isVisibleAtLevel(Z, I));
|
|
243
|
+
if (!R.length) continue;
|
|
244
|
+
const K = ((se = (X = (q = (G = R[0]) == null ? void 0 : G.data) == null ? void 0 : q.billboard) == null ? void 0 : X[0]) == null ? void 0 : se.theme) || this.clusterTheme, U = this.groupByTheme ? `cluster-${l}-${c}-${d}-${B}` : `cluster-${l}-${c}-${d}`;
|
|
230
245
|
this.labelPool.add(
|
|
231
246
|
{
|
|
232
|
-
id:
|
|
233
|
-
billboard: ((
|
|
234
|
-
count:
|
|
235
|
-
gridKey:
|
|
236
|
-
points:
|
|
247
|
+
id: U,
|
|
248
|
+
billboard: ((he = (le = R[0]) == null ? void 0 : le.data) == null ? void 0 : he.billboard) || [],
|
|
249
|
+
count: R.length,
|
|
250
|
+
gridKey: w,
|
|
251
|
+
points: R,
|
|
237
252
|
aggregationGroup: B
|
|
238
253
|
},
|
|
239
254
|
{
|
|
240
|
-
id:
|
|
241
|
-
lon:
|
|
242
|
-
lat:
|
|
243
|
-
height:
|
|
244
|
-
theme:
|
|
255
|
+
id: U,
|
|
256
|
+
lon: ie,
|
|
257
|
+
lat: W,
|
|
258
|
+
height: Q,
|
|
259
|
+
theme: K
|
|
245
260
|
}
|
|
246
261
|
), e++;
|
|
247
262
|
}
|
|
@@ -249,10 +264,10 @@ class Lr {
|
|
|
249
264
|
if (this.debugCurrentGrids) {
|
|
250
265
|
const B = this.levels[l].level;
|
|
251
266
|
this._drawDebugGrid(
|
|
252
|
-
C,
|
|
253
267
|
b,
|
|
254
|
-
|
|
268
|
+
C,
|
|
255
269
|
M,
|
|
270
|
+
P,
|
|
256
271
|
`L:${B} X:${c} Y:${d}`
|
|
257
272
|
);
|
|
258
273
|
}
|
|
@@ -298,27 +313,27 @@ class Lr {
|
|
|
298
313
|
}
|
|
299
314
|
}
|
|
300
315
|
if (f === void 0) continue;
|
|
301
|
-
const w = this.levels[f].level, y = m._x ?? m.x,
|
|
302
|
-
if (typeof y == "number" && typeof
|
|
303
|
-
let D = y, x =
|
|
316
|
+
const w = this.levels[f].level, y = m._x ?? m.x, v = m._y ?? m.y;
|
|
317
|
+
if (typeof y == "number" && typeof v == "number") {
|
|
318
|
+
let D = y, x = v;
|
|
304
319
|
const A = p - w;
|
|
305
320
|
if (A > 0) {
|
|
306
321
|
const $ = 1 << A;
|
|
307
|
-
D = Math.floor(y / $), x = Math.floor(
|
|
322
|
+
D = Math.floor(y / $), x = Math.floor(v / $);
|
|
308
323
|
} else if (A < 0) {
|
|
309
324
|
const $ = 1 << -A;
|
|
310
|
-
D = y * $, x =
|
|
325
|
+
D = y * $, x = v * $;
|
|
311
326
|
}
|
|
312
327
|
const O = `${w}_${D}_${x}`;
|
|
313
328
|
if (u.has(O)) continue;
|
|
314
|
-
u.add(O), i(f, D, x);
|
|
329
|
+
u.add(O), i(f, D, x, p);
|
|
315
330
|
continue;
|
|
316
331
|
}
|
|
317
|
-
const
|
|
332
|
+
const C = this.levels[f].size, M = this.Cesium.Math.toDegrees(g.west), P = this.Cesium.Math.toDegrees(g.east), L = this.Cesium.Math.toDegrees(g.south), E = this.Cesium.Math.toDegrees(g.north), I = Math.floor((M - -180) / C), _ = Math.floor((P - -180) / C), S = Math.floor((L - -90) / C), T = Math.floor((E - -90) / C);
|
|
318
333
|
for (let D = I; D <= _; D++)
|
|
319
334
|
for (let x = S; x <= T; x++) {
|
|
320
335
|
const A = `${w}_${D}_${x}`;
|
|
321
|
-
u.has(A) || (u.add(A), i(f, D, x));
|
|
336
|
+
u.has(A) || (u.add(A), i(f, D, x, p));
|
|
322
337
|
}
|
|
323
338
|
}
|
|
324
339
|
} catch {
|
|
@@ -499,19 +514,19 @@ class N {
|
|
|
499
514
|
...e.style || {}
|
|
500
515
|
});
|
|
501
516
|
for (const [f, w] of Object.entries(Nt)) {
|
|
502
|
-
g.addEventListener(w, (
|
|
503
|
-
|
|
517
|
+
g.addEventListener(w, (v) => {
|
|
518
|
+
v.stopPropagation();
|
|
504
519
|
const b = this.labels.get(i);
|
|
505
|
-
this.eventBus.runListener(f, b,
|
|
520
|
+
this.eventBus.runListener(f, b, v);
|
|
506
521
|
});
|
|
507
522
|
let y = 0;
|
|
508
|
-
g.addEventListener("wheel", (
|
|
523
|
+
g.addEventListener("wheel", (v) => {
|
|
509
524
|
if (!this.openWheel) return;
|
|
510
|
-
const b =
|
|
525
|
+
const b = v.currentTarget;
|
|
511
526
|
y = Date.now();
|
|
512
|
-
const
|
|
527
|
+
const C = y;
|
|
513
528
|
b.style.pointerEvents = "none", setTimeout(() => {
|
|
514
|
-
y ===
|
|
529
|
+
y === C && (b.style.pointerEvents = "auto");
|
|
515
530
|
}, 2e3);
|
|
516
531
|
});
|
|
517
532
|
}
|
|
@@ -1107,16 +1122,16 @@ class Er {
|
|
|
1107
1122
|
this.clear();
|
|
1108
1123
|
}
|
|
1109
1124
|
}
|
|
1110
|
-
var
|
|
1125
|
+
var Ct = typeof global == "object" && global && global.Object === Object && global, Wt = typeof self == "object" && self && self.Object === Object && self, ae = Ct || Wt || Function("return this")(), fe = ae.Symbol, bt = Object.prototype, Ut = bt.hasOwnProperty, qt = bt.toString, Ce = fe ? fe.toStringTag : void 0;
|
|
1111
1126
|
function Kt(a) {
|
|
1112
|
-
var t = Ut.call(a,
|
|
1127
|
+
var t = Ut.call(a, Ce), e = a[Ce];
|
|
1113
1128
|
try {
|
|
1114
|
-
a[
|
|
1129
|
+
a[Ce] = void 0;
|
|
1115
1130
|
var i = !0;
|
|
1116
1131
|
} catch {
|
|
1117
1132
|
}
|
|
1118
1133
|
var r = qt.call(a);
|
|
1119
|
-
return i && (t ? a[
|
|
1134
|
+
return i && (t ? a[Ce] = e : delete a[Ce]), r;
|
|
1120
1135
|
}
|
|
1121
1136
|
var Xt = Object.prototype, Jt = Xt.toString;
|
|
1122
1137
|
function Qt(a) {
|
|
@@ -1149,7 +1164,7 @@ function ri(a) {
|
|
|
1149
1164
|
return !!je && je in a;
|
|
1150
1165
|
}
|
|
1151
1166
|
var ni = Function.prototype, ai = ni.toString;
|
|
1152
|
-
function
|
|
1167
|
+
function me(a) {
|
|
1153
1168
|
if (a != null) {
|
|
1154
1169
|
try {
|
|
1155
1170
|
return ai.call(a);
|
|
@@ -1169,16 +1184,16 @@ function gi(a) {
|
|
|
1169
1184
|
if (!De(a) || ri(a))
|
|
1170
1185
|
return !1;
|
|
1171
1186
|
var t = Pt(a) ? mi : hi;
|
|
1172
|
-
return t.test(
|
|
1187
|
+
return t.test(me(a));
|
|
1173
1188
|
}
|
|
1174
1189
|
function fi(a, t) {
|
|
1175
1190
|
return a == null ? void 0 : a[t];
|
|
1176
1191
|
}
|
|
1177
|
-
function
|
|
1192
|
+
function ge(a, t) {
|
|
1178
1193
|
var e = fi(a, t);
|
|
1179
1194
|
return gi(e) ? e : void 0;
|
|
1180
1195
|
}
|
|
1181
|
-
var Fe =
|
|
1196
|
+
var Fe = ge(ae, "WeakMap"), Ye = Object.create, yi = /* @__PURE__ */ (function() {
|
|
1182
1197
|
function a() {
|
|
1183
1198
|
}
|
|
1184
1199
|
return function(t) {
|
|
@@ -1192,7 +1207,7 @@ var Fe = me(ae, "WeakMap"), Ye = Object.create, yi = /* @__PURE__ */ (function()
|
|
|
1192
1207
|
};
|
|
1193
1208
|
})(), Ve = (function() {
|
|
1194
1209
|
try {
|
|
1195
|
-
var a =
|
|
1210
|
+
var a = ge(Object, "defineProperty");
|
|
1196
1211
|
return a({}, "", {}), a;
|
|
1197
1212
|
} catch {
|
|
1198
1213
|
}
|
|
@@ -1202,10 +1217,10 @@ function wi(a, t) {
|
|
|
1202
1217
|
;
|
|
1203
1218
|
return a;
|
|
1204
1219
|
}
|
|
1205
|
-
var
|
|
1220
|
+
var vi = 9007199254740991, Ci = /^(?:0|[1-9]\d*)$/;
|
|
1206
1221
|
function bi(a, t) {
|
|
1207
1222
|
var e = typeof a;
|
|
1208
|
-
return t = t ??
|
|
1223
|
+
return t = t ?? vi, !!t && (e == "number" || e != "symbol" && Ci.test(a)) && a > -1 && a % 1 == 0 && a < t;
|
|
1209
1224
|
}
|
|
1210
1225
|
function Pi(a, t, e) {
|
|
1211
1226
|
t == "__proto__" && Ve ? Ve(a, t, {
|
|
@@ -1263,7 +1278,7 @@ function Ne(a) {
|
|
|
1263
1278
|
return a(t);
|
|
1264
1279
|
};
|
|
1265
1280
|
}
|
|
1266
|
-
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 &&
|
|
1281
|
+
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, ye = (function() {
|
|
1267
1282
|
try {
|
|
1268
1283
|
var a = be && be.require && be.require("util").types;
|
|
1269
1284
|
return a || Oe && Oe.binding && Oe.binding("util");
|
|
@@ -1297,20 +1312,20 @@ function fs(a) {
|
|
|
1297
1312
|
function ys(a) {
|
|
1298
1313
|
return Ti(a) ? ps(a) : fs(a);
|
|
1299
1314
|
}
|
|
1300
|
-
var Pe =
|
|
1315
|
+
var Pe = ge(Object, "create");
|
|
1301
1316
|
function ws() {
|
|
1302
1317
|
this.__data__ = Pe ? Pe(null) : {}, this.size = 0;
|
|
1303
1318
|
}
|
|
1304
|
-
function
|
|
1319
|
+
function vs(a) {
|
|
1305
1320
|
var t = this.has(a) && delete this.__data__[a];
|
|
1306
1321
|
return this.size -= t ? 1 : 0, t;
|
|
1307
1322
|
}
|
|
1308
|
-
var
|
|
1323
|
+
var Cs = "__lodash_hash_undefined__", bs = Object.prototype, Ps = bs.hasOwnProperty;
|
|
1309
1324
|
function Ls(a) {
|
|
1310
1325
|
var t = this.__data__;
|
|
1311
1326
|
if (Pe) {
|
|
1312
1327
|
var e = t[a];
|
|
1313
|
-
return e ===
|
|
1328
|
+
return e === Cs ? void 0 : e;
|
|
1314
1329
|
}
|
|
1315
1330
|
return Ps.call(t, a) ? t[a] : void 0;
|
|
1316
1331
|
}
|
|
@@ -1324,18 +1339,18 @@ function xs(a, t) {
|
|
|
1324
1339
|
var e = this.__data__;
|
|
1325
1340
|
return this.size += this.has(a) ? 0 : 1, e[a] = Pe && t === void 0 ? Ts : t, this;
|
|
1326
1341
|
}
|
|
1327
|
-
function
|
|
1342
|
+
function ue(a) {
|
|
1328
1343
|
var t = -1, e = a == null ? 0 : a.length;
|
|
1329
1344
|
for (this.clear(); ++t < e; ) {
|
|
1330
1345
|
var i = a[t];
|
|
1331
1346
|
this.set(i[0], i[1]);
|
|
1332
1347
|
}
|
|
1333
1348
|
}
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1349
|
+
ue.prototype.clear = ws;
|
|
1350
|
+
ue.prototype.delete = vs;
|
|
1351
|
+
ue.prototype.get = Ls;
|
|
1352
|
+
ue.prototype.has = Is;
|
|
1353
|
+
ue.prototype.set = xs;
|
|
1339
1354
|
function _s() {
|
|
1340
1355
|
this.__data__ = [], this.size = 0;
|
|
1341
1356
|
}
|
|
@@ -1364,24 +1379,24 @@ function Fs(a, t) {
|
|
|
1364
1379
|
var e = this.__data__, i = Se(e, a);
|
|
1365
1380
|
return i < 0 ? (++this.size, e.push([a, t])) : e[i][1] = t, this;
|
|
1366
1381
|
}
|
|
1367
|
-
function
|
|
1382
|
+
function pe(a) {
|
|
1368
1383
|
var t = -1, e = a == null ? 0 : a.length;
|
|
1369
1384
|
for (this.clear(); ++t < e; ) {
|
|
1370
1385
|
var i = a[t];
|
|
1371
1386
|
this.set(i[0], i[1]);
|
|
1372
1387
|
}
|
|
1373
1388
|
}
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
var Le =
|
|
1389
|
+
pe.prototype.clear = _s;
|
|
1390
|
+
pe.prototype.delete = As;
|
|
1391
|
+
pe.prototype.get = $s;
|
|
1392
|
+
pe.prototype.has = Os;
|
|
1393
|
+
pe.prototype.set = Fs;
|
|
1394
|
+
var Le = ge(ae, "Map");
|
|
1380
1395
|
function ks() {
|
|
1381
1396
|
this.size = 0, this.__data__ = {
|
|
1382
|
-
hash: new
|
|
1383
|
-
map: new (Le ||
|
|
1384
|
-
string: new
|
|
1397
|
+
hash: new ue(),
|
|
1398
|
+
map: new (Le || pe)(),
|
|
1399
|
+
string: new ue()
|
|
1385
1400
|
};
|
|
1386
1401
|
}
|
|
1387
1402
|
function Rs(a) {
|
|
@@ -1425,7 +1440,7 @@ function Bs(a, t) {
|
|
|
1425
1440
|
}
|
|
1426
1441
|
var js = Dt(Object.getPrototypeOf, Object);
|
|
1427
1442
|
function Ys() {
|
|
1428
|
-
this.__data__ = new
|
|
1443
|
+
this.__data__ = new pe(), this.size = 0;
|
|
1429
1444
|
}
|
|
1430
1445
|
function Vs(a) {
|
|
1431
1446
|
var t = this.__data__, e = t.delete(a);
|
|
@@ -1440,7 +1455,7 @@ function Us(a) {
|
|
|
1440
1455
|
var qs = 200;
|
|
1441
1456
|
function Ks(a, t) {
|
|
1442
1457
|
var e = this.__data__;
|
|
1443
|
-
if (e instanceof
|
|
1458
|
+
if (e instanceof pe) {
|
|
1444
1459
|
var i = e.__data__;
|
|
1445
1460
|
if (!Le || i.length < qs - 1)
|
|
1446
1461
|
return i.push([a, t]), this.size = ++e.size, this;
|
|
@@ -1448,15 +1463,15 @@ function Ks(a, t) {
|
|
|
1448
1463
|
}
|
|
1449
1464
|
return e.set(a, t), this.size = e.size, this;
|
|
1450
1465
|
}
|
|
1451
|
-
function
|
|
1452
|
-
var t = this.__data__ = new
|
|
1466
|
+
function ve(a) {
|
|
1467
|
+
var t = this.__data__ = new pe(a);
|
|
1453
1468
|
this.size = t.size;
|
|
1454
1469
|
}
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1470
|
+
ve.prototype.clear = Ys;
|
|
1471
|
+
ve.prototype.delete = Vs;
|
|
1472
|
+
ve.prototype.get = Ws;
|
|
1473
|
+
ve.prototype.has = Us;
|
|
1474
|
+
ve.prototype.set = Ks;
|
|
1460
1475
|
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 ? ae.Buffer : void 0;
|
|
1461
1476
|
Je && Je.allocUnsafe;
|
|
1462
1477
|
function Js(a, t) {
|
|
@@ -1484,9 +1499,9 @@ function so(a, t, e) {
|
|
|
1484
1499
|
function oo(a) {
|
|
1485
1500
|
return so(a, ys, io);
|
|
1486
1501
|
}
|
|
1487
|
-
var ke =
|
|
1488
|
-
(ke &&
|
|
1489
|
-
var t = Ee(a), e = t == ro ? a.constructor : void 0, i = e ?
|
|
1502
|
+
var ke = ge(ae, "DataView"), Re = ge(ae, "Promise"), He = ge(ae, "Set"), Ze = "[object Map]", ro = "[object Object]", et = "[object Promise]", tt = "[object Set]", it = "[object WeakMap]", st = "[object DataView]", no = me(ke), ao = me(Le), lo = me(Re), ho = me(He), co = me(Fe), de = Ee;
|
|
1503
|
+
(ke && de(new ke(new ArrayBuffer(1))) != st || Le && de(new Le()) != Ze || Re && de(Re.resolve()) != et || He && de(new He()) != tt || Fe && de(new Fe()) != it) && (de = function(a) {
|
|
1504
|
+
var t = Ee(a), e = t == ro ? a.constructor : void 0, i = e ? me(e) : "";
|
|
1490
1505
|
if (i)
|
|
1491
1506
|
switch (i) {
|
|
1492
1507
|
case no:
|
|
@@ -1525,17 +1540,17 @@ var rt = fe ? fe.prototype : void 0, nt = rt ? rt.valueOf : void 0;
|
|
|
1525
1540
|
function wo(a) {
|
|
1526
1541
|
return nt ? Object(nt.call(a)) : {};
|
|
1527
1542
|
}
|
|
1528
|
-
function
|
|
1543
|
+
function vo(a, t) {
|
|
1529
1544
|
var e = Ge(a.buffer);
|
|
1530
1545
|
return new a.constructor(e, a.byteOffset, a.length);
|
|
1531
1546
|
}
|
|
1532
|
-
var
|
|
1547
|
+
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]", Fo = "[object Uint8Array]", ko = "[object Uint8ClampedArray]", Ro = "[object Uint16Array]", Ho = "[object Uint32Array]";
|
|
1533
1548
|
function zo(a, t, e) {
|
|
1534
1549
|
var i = a.constructor;
|
|
1535
1550
|
switch (t) {
|
|
1536
1551
|
case xo:
|
|
1537
1552
|
return Ge(a);
|
|
1538
|
-
case
|
|
1553
|
+
case Co:
|
|
1539
1554
|
case bo:
|
|
1540
1555
|
return new i(+a);
|
|
1541
1556
|
case _o:
|
|
@@ -1549,7 +1564,7 @@ function zo(a, t, e) {
|
|
|
1549
1564
|
case ko:
|
|
1550
1565
|
case Ro:
|
|
1551
1566
|
case Ho:
|
|
1552
|
-
return
|
|
1567
|
+
return vo(a);
|
|
1553
1568
|
case Po:
|
|
1554
1569
|
return new i();
|
|
1555
1570
|
case Lo:
|
|
@@ -1568,11 +1583,11 @@ function No(a) {
|
|
|
1568
1583
|
}
|
|
1569
1584
|
var Go = "[object Map]";
|
|
1570
1585
|
function Bo(a) {
|
|
1571
|
-
return Me(a) &&
|
|
1586
|
+
return Me(a) && de(a) == Go;
|
|
1572
1587
|
}
|
|
1573
1588
|
var at = ye && ye.isMap, jo = at ? Ne(at) : Bo, Yo = "[object Set]";
|
|
1574
1589
|
function Vo(a) {
|
|
1575
|
-
return Me(a) &&
|
|
1590
|
+
return Me(a) && de(a) == Yo;
|
|
1576
1591
|
}
|
|
1577
1592
|
var lt = ye && ye.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]", er = "[object RegExp]", tr = "[object Set]", ir = "[object String]", sr = "[object Symbol]", or = "[object WeakMap]", rr = "[object ArrayBuffer]", nr = "[object DataView]", ar = "[object Float32Array]", lr = "[object Float64Array]", hr = "[object Int8Array]", cr = "[object Int16Array]", dr = "[object Int32Array]", pr = "[object Uint8Array]", ur = "[object Uint8ClampedArray]", mr = "[object Uint16Array]", gr = "[object Uint32Array]", H = {};
|
|
1578
1593
|
H[At] = H[Uo] = H[rr] = H[nr] = H[qo] = H[Ko] = H[ar] = H[lr] = H[hr] = H[cr] = H[dr] = H[Qo] = H[Zo] = H[Ot] = H[er] = H[tr] = H[ir] = H[sr] = H[pr] = H[ur] = H[mr] = H[gr] = !0;
|
|
@@ -1587,7 +1602,7 @@ function xe(a, t, e, i, r, s) {
|
|
|
1587
1602
|
if (n)
|
|
1588
1603
|
o = mo(a);
|
|
1589
1604
|
else {
|
|
1590
|
-
var l =
|
|
1605
|
+
var l = de(a), c = l == $t || l == Jo;
|
|
1591
1606
|
if (xt(a))
|
|
1592
1607
|
return Js(a);
|
|
1593
1608
|
if (l == Ot || l == At || c && !r)
|
|
@@ -1598,7 +1613,7 @@ function xe(a, t, e, i, r, s) {
|
|
|
1598
1613
|
o = zo(a, l);
|
|
1599
1614
|
}
|
|
1600
1615
|
}
|
|
1601
|
-
s || (s = new
|
|
1616
|
+
s || (s = new ve());
|
|
1602
1617
|
var d = s.get(a);
|
|
1603
1618
|
if (d)
|
|
1604
1619
|
return d;
|
|
@@ -1616,7 +1631,7 @@ var fr = 1, yr = 4;
|
|
|
1616
1631
|
function Te(a) {
|
|
1617
1632
|
return xe(a, fr | yr);
|
|
1618
1633
|
}
|
|
1619
|
-
var wr = /* @__PURE__ */ ((a) => (a.Rotate = "rotate", a.Move = "move", a.Scale = "scale", a.MoveHeight = "moveHeight", a.Empty = "", a))(wr || {}),
|
|
1634
|
+
var wr = /* @__PURE__ */ ((a) => (a.Rotate = "rotate", a.Move = "move", a.Scale = "scale", a.MoveHeight = "moveHeight", a.Empty = "", a))(wr || {}), vr = /* @__PURE__ */ ((a) => (a.Scale = "addScale", a.Rotate = "rotate", a.Translation = "translation", a.Remove = "removeById", a.Add = "add", a))(vr || {});
|
|
1620
1635
|
class Mr {
|
|
1621
1636
|
constructor(t) {
|
|
1622
1637
|
h(this, "primitives", /* @__PURE__ */ new Map());
|
|
@@ -1832,7 +1847,7 @@ class Mr {
|
|
|
1832
1847
|
}
|
|
1833
1848
|
};
|
|
1834
1849
|
this.handler.setInputAction((m) => {
|
|
1835
|
-
var f, w, y,
|
|
1850
|
+
var f, w, y, v, b, C, M, P, L, E;
|
|
1836
1851
|
if (!t()) return;
|
|
1837
1852
|
const p = r.pick(m.position);
|
|
1838
1853
|
if (p && p.id && ((f = p.id) != null && f.includes("rotationRing"))) {
|
|
@@ -1853,7 +1868,7 @@ class Mr {
|
|
|
1853
1868
|
"moveHeight"
|
|
1854
1869
|
/* MoveHeight */
|
|
1855
1870
|
), u(I, m);
|
|
1856
|
-
} else if (p && p.id && ((
|
|
1871
|
+
} else if (p && p.id && ((v = p.id) != null && v.includes("heightArrow-arrow_"))) {
|
|
1857
1872
|
let I = p.id.split("heightArrow-arrow_")[1];
|
|
1858
1873
|
this.setEditMode(
|
|
1859
1874
|
"moveHeight"
|
|
@@ -1861,7 +1876,7 @@ class Mr {
|
|
|
1861
1876
|
), u(I, m);
|
|
1862
1877
|
} else if (p && p.id) {
|
|
1863
1878
|
if (s = this.primitives.get(p.id), !s) return;
|
|
1864
|
-
(!this.rotationRing || !((
|
|
1879
|
+
(!this.rotationRing || !((C = (b = this.rotationRing) == null ? void 0 : b._instanceIds) != null && C.includes(`rotationRing_${s.id}`))) && this.createRotationRing(s), (!this.translationSquare || !((P = (M = this.translationSquare) == null ? void 0 : M._instanceIds) != null && P.includes(`translationSquare_${s.id}`))) && this.createTranslationSquare(s), (!this.heightArrow || !((E = (L = this.heightArrow) == null ? void 0 : L._instanceIds) != null && E.includes(`heightArrow_${s.id}`))) && this.createHeightArrow(s);
|
|
1865
1880
|
} else
|
|
1866
1881
|
d();
|
|
1867
1882
|
}, e.ScreenSpaceEventType.LEFT_DOWN), this.handler.setInputAction((m) => {
|
|
@@ -2399,7 +2414,7 @@ class _r {
|
|
|
2399
2414
|
return [...this.categoryMap.keys()];
|
|
2400
2415
|
}
|
|
2401
2416
|
}
|
|
2402
|
-
class
|
|
2417
|
+
class Cr {
|
|
2403
2418
|
constructor(t) {
|
|
2404
2419
|
h(this, "id");
|
|
2405
2420
|
h(this, "entities", []);
|
|
@@ -2568,7 +2583,7 @@ class br {
|
|
|
2568
2583
|
});
|
|
2569
2584
|
const o = this.createBillboardPoints(t);
|
|
2570
2585
|
o.length && e && this.aggregator.appendPoints(o, !1), this.createCard(t);
|
|
2571
|
-
const n = new
|
|
2586
|
+
const n = new Cr({
|
|
2572
2587
|
id: i,
|
|
2573
2588
|
entities: r,
|
|
2574
2589
|
primitives: [],
|
|
@@ -2787,17 +2802,17 @@ class Ar {
|
|
|
2787
2802
|
const w = ((s = (r = t.properties) == null ? void 0 : r.lineType) == null ? void 0 : s.pattern) && ((n = (o = t.properties) == null ? void 0 : o.lineType) == null ? void 0 : n.patternLength);
|
|
2788
2803
|
let y = "";
|
|
2789
2804
|
if (w) {
|
|
2790
|
-
const
|
|
2791
|
-
let
|
|
2792
|
-
y = `DashedLineMaterial_pattern_${
|
|
2805
|
+
const v = ((c = (l = t.properties) == null ? void 0 : l.lineType) == null ? void 0 : c.pattern) || [0.25, -0.125], b = ((u = (d = t.properties) == null ? void 0 : d.lineType) == null ? void 0 : u.patternLength) || 0.375;
|
|
2806
|
+
let C = this.convertCadPatternToCesiumDash(v, b);
|
|
2807
|
+
y = `DashedLineMaterial_pattern_${C.dashPattern}_dashLength_${C.dashLength}_color_${(m = t.properties) == null ? void 0 : m.color}`, e.has(y) || e.register({
|
|
2793
2808
|
themeKey: y,
|
|
2794
2809
|
material: i.Material.fromType("PolylineDash", {
|
|
2795
2810
|
color: i.Color.fromCssColorString(t.properties.color || "#FFFFFF").withAlpha(
|
|
2796
2811
|
0.8
|
|
2797
2812
|
),
|
|
2798
|
-
dashLength:
|
|
2813
|
+
dashLength: C.dashLength,
|
|
2799
2814
|
// ← 注意,这里填总长度
|
|
2800
|
-
dashPattern:
|
|
2815
|
+
dashPattern: C.dashPattern
|
|
2801
2816
|
// ← 这里才是 16-bit 掩码
|
|
2802
2817
|
})
|
|
2803
2818
|
});
|
|
@@ -3075,7 +3090,7 @@ class Ar {
|
|
|
3075
3090
|
(c + m) / 2,
|
|
3076
3091
|
(d + g) / 2,
|
|
3077
3092
|
(u + p) / 2
|
|
3078
|
-
), y = new this.Cesium.Cartesian3(m - c, g - d, p - u).z,
|
|
3093
|
+
), y = new this.Cesium.Cartesian3(m - c, g - d, p - u).z, v = Math.abs(y || 1) * 1.5;
|
|
3079
3094
|
this.viewer.camera.flyTo({
|
|
3080
3095
|
destination: f,
|
|
3081
3096
|
duration: 2,
|
|
@@ -3083,7 +3098,7 @@ class Ar {
|
|
|
3083
3098
|
complete: () => {
|
|
3084
3099
|
console.log(`已定位到图元 ${e}`);
|
|
3085
3100
|
},
|
|
3086
|
-
offset: new this.Cesium.Cartesian3(0, 0,
|
|
3101
|
+
offset: new this.Cesium.Cartesian3(0, 0, v)
|
|
3087
3102
|
// 使用动态计算的偏移高度
|
|
3088
3103
|
});
|
|
3089
3104
|
} else
|
|
@@ -3132,7 +3147,7 @@ class ht {
|
|
|
3132
3147
|
});
|
|
3133
3148
|
}
|
|
3134
3149
|
this.handler = new e.ScreenSpaceEventHandler(i.canvas), this.handler.setInputAction((r) => {
|
|
3135
|
-
var f, w, y,
|
|
3150
|
+
var f, w, y, v;
|
|
3136
3151
|
const s = i.scene.pickPosition(r.position);
|
|
3137
3152
|
if (!s) return;
|
|
3138
3153
|
const o = e.Cartographic.fromCartesian(s), n = e.Math.toDegrees(o.longitude), l = e.Math.toDegrees(o.latitude);
|
|
@@ -3160,13 +3175,13 @@ class ht {
|
|
|
3160
3175
|
}
|
|
3161
3176
|
});
|
|
3162
3177
|
if (this.groundLineEntities.push(p), this.positions.length >= 2) {
|
|
3163
|
-
const b = this.positions[this.positions.length - 2],
|
|
3178
|
+
const b = this.positions[this.positions.length - 2], C = this.positions[this.positions.length - 1], M = e.Cartographic.fromCartesian(b), P = e.Cartographic.fromCartesian(C), L = i.entities.add({
|
|
3164
3179
|
polyline: {
|
|
3165
|
-
positions: [b,
|
|
3180
|
+
positions: [b, C],
|
|
3166
3181
|
width: t.width || 3,
|
|
3167
3182
|
material: t.lineColor || t.color || e.Color.YELLOW,
|
|
3168
3183
|
depthFailMaterial: new e.PolylineDashMaterialProperty({
|
|
3169
|
-
color: ((
|
|
3184
|
+
color: ((v = (y = t.dashLineColor || t.lineColor || t.color || e.Color.RED).withAlpha) == null ? void 0 : v.call(y, 0.9)) || e.Color.RED,
|
|
3170
3185
|
dashLength: 12,
|
|
3171
3186
|
dashPattern: 255
|
|
3172
3187
|
})
|
|
@@ -3174,9 +3189,9 @@ class ht {
|
|
|
3174
3189
|
});
|
|
3175
3190
|
this.segmentEntities.push(L);
|
|
3176
3191
|
const I = new e.EllipsoidGeodesic(M, P).surfaceDistance, _ = new e.Cartesian3(
|
|
3177
|
-
(b.x +
|
|
3178
|
-
(b.y +
|
|
3179
|
-
(b.z +
|
|
3192
|
+
(b.x + C.x) / 2,
|
|
3193
|
+
(b.y + C.y) / 2,
|
|
3194
|
+
(b.z + C.z) / 2
|
|
3180
3195
|
), S = e.Cartographic.fromCartesian(_), T = `measure_horizontal_seg_${this.segmentLabelIds.length}_${Date.now()}`;
|
|
3181
3196
|
this.segmentLabelIds.push(T), this.htmlLabelPool.add(
|
|
3182
3197
|
{ text: `${I.toFixed(2)} m` },
|
|
@@ -3237,25 +3252,25 @@ class ht {
|
|
|
3237
3252
|
(m.x + c.x) / 2,
|
|
3238
3253
|
(m.y + c.y) / 2,
|
|
3239
3254
|
(m.z + c.z) / 2
|
|
3240
|
-
),
|
|
3255
|
+
), v = e.Cartographic.fromCartesian(y), b = this.previewLabelId || "measure_horizontal_preview";
|
|
3241
3256
|
this.previewLabelId = b, this.htmlLabelPool.add(
|
|
3242
3257
|
{ text: `${w.toFixed(2)} m` },
|
|
3243
3258
|
{
|
|
3244
3259
|
id: b,
|
|
3245
|
-
lon: e.Math.toDegrees(
|
|
3246
|
-
lat: e.Math.toDegrees(
|
|
3247
|
-
height:
|
|
3260
|
+
lon: e.Math.toDegrees(v.longitude),
|
|
3261
|
+
lat: e.Math.toDegrees(v.latitude),
|
|
3262
|
+
height: v.height || this.firstHeight || 0,
|
|
3248
3263
|
theme: "measure-horizontal-seg",
|
|
3249
3264
|
show: !0
|
|
3250
3265
|
}
|
|
3251
3266
|
);
|
|
3252
|
-
const
|
|
3267
|
+
const C = ((P = (M = t.dashLineColor || t.lineColor || t.color || e.Color.RED).withAlpha) == null ? void 0 : P.call(M, 0.9)) || e.Color.RED;
|
|
3253
3268
|
this.previewGroundEntity || (this.previewGroundEntity = i.entities.add({
|
|
3254
3269
|
polyline: {
|
|
3255
3270
|
positions: new e.CallbackProperty(() => !this.previewPos || !this.previewGroundPos ? [] : [this.previewGroundPos, this.previewPos], !1),
|
|
3256
3271
|
width: t.width || 3,
|
|
3257
3272
|
material: new e.PolylineDashMaterialProperty({
|
|
3258
|
-
color:
|
|
3273
|
+
color: C,
|
|
3259
3274
|
dashLength: 12,
|
|
3260
3275
|
dashPattern: 255
|
|
3261
3276
|
})
|
|
@@ -3287,15 +3302,15 @@ class ht {
|
|
|
3287
3302
|
if (!this.htmlLabelPool) {
|
|
3288
3303
|
const w = s.overlayContainerId || "html-label-container";
|
|
3289
3304
|
this.htmlLabelPool = e || new N(i, r, w), this.htmlLabelPool.registerTheme("measure-horizontal-total", {
|
|
3290
|
-
createElement: (y,
|
|
3305
|
+
createElement: (y, v) => {
|
|
3291
3306
|
var b;
|
|
3292
|
-
y.innerHTML = String(((b =
|
|
3307
|
+
y.innerHTML = String(((b = v == null ? void 0 : v.data) == null ? void 0 : b.text) || ""), y.style.background = "rgba(0,0,0,0.6)", y.style.color = "#fff", y.style.font = "14px sans-serif", y.style.padding = "4px 6px", y.style.borderRadius = "4px", y.style.whiteSpace = "pre";
|
|
3293
3308
|
},
|
|
3294
3309
|
options: { offset: { x: 0, y: -10 } }
|
|
3295
3310
|
}), this.htmlLabelPool.registerTheme("measure-horizontal-seg", {
|
|
3296
|
-
createElement: (y,
|
|
3311
|
+
createElement: (y, v) => {
|
|
3297
3312
|
var b;
|
|
3298
|
-
y.innerHTML = String(((b =
|
|
3313
|
+
y.innerHTML = String(((b = v == null ? void 0 : v.data) == null ? void 0 : b.text) || ""), y.style.background = "rgba(0,0,0,0.6)", y.style.color = "#fff", y.style.font = "14px sans-serif", y.style.padding = "4px 6px", y.style.borderRadius = "4px", y.style.whiteSpace = "pre";
|
|
3299
3314
|
},
|
|
3300
3315
|
options: { offset: { x: 0, y: -10 } }
|
|
3301
3316
|
});
|
|
@@ -3303,7 +3318,7 @@ class ht {
|
|
|
3303
3318
|
for (const w of c) {
|
|
3304
3319
|
const y = r.entities.add({ position: w, point: { pixelSize: 8, color: s.pointColor || s.color || i.Color.YELLOW, disableDepthTestDistance: Number.POSITIVE_INFINITY } });
|
|
3305
3320
|
this.tempPoints.push(y);
|
|
3306
|
-
const
|
|
3321
|
+
const v = i.Cartographic.fromCartesian(w), b = i.Math.toDegrees(v.longitude), C = i.Math.toDegrees(v.latitude), M = r.scene.globe.getHeight(new i.Cartographic(v.longitude, v.latitude, 0)) || 0, P = i.Cartesian3.fromDegrees(b, C, M), L = r.entities.add({
|
|
3307
3322
|
polyline: {
|
|
3308
3323
|
positions: [P, w],
|
|
3309
3324
|
width: l,
|
|
@@ -3313,16 +3328,16 @@ class ht {
|
|
|
3313
3328
|
this.groundLineEntities.push(L);
|
|
3314
3329
|
}
|
|
3315
3330
|
for (let w = 1; w < c.length; w++) {
|
|
3316
|
-
const y = c[w - 1],
|
|
3331
|
+
const y = c[w - 1], v = c[w], b = r.entities.add({
|
|
3317
3332
|
polyline: {
|
|
3318
|
-
positions: [y,
|
|
3333
|
+
positions: [y, v],
|
|
3319
3334
|
width: l,
|
|
3320
3335
|
material: o,
|
|
3321
3336
|
depthFailMaterial: new i.PolylineDashMaterialProperty({ color: n, dashLength: 12, dashPattern: 255 })
|
|
3322
3337
|
}
|
|
3323
3338
|
});
|
|
3324
3339
|
this.segmentEntities.push(b);
|
|
3325
|
-
const
|
|
3340
|
+
const C = i.Cartographic.fromCartesian(y), M = i.Cartographic.fromCartesian(v), L = new i.EllipsoidGeodesic(C, 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), _ = t.id + `_seg_${w - 1}`;
|
|
3326
3341
|
this.segmentLabelIds.push(_), this.htmlLabelPool.add({ text: `${L.toFixed(2)} m` }, {
|
|
3327
3342
|
id: _,
|
|
3328
3343
|
lon: i.Math.toDegrees(I.longitude),
|
|
@@ -3335,7 +3350,7 @@ class ht {
|
|
|
3335
3350
|
}
|
|
3336
3351
|
let d = 0;
|
|
3337
3352
|
for (let w = 1; w < c.length; w++) {
|
|
3338
|
-
const y = i.Cartographic.fromCartesian(c[w - 1]),
|
|
3353
|
+
const y = i.Cartographic.fromCartesian(c[w - 1]), v = i.Cartographic.fromCartesian(c[w]), b = new i.EllipsoidGeodesic(y, v);
|
|
3339
3354
|
d += b.surfaceDistance;
|
|
3340
3355
|
}
|
|
3341
3356
|
const u = c[c.length - 1], m = i.Cartographic.fromCartesian(u), g = t.id + "_total";
|
|
@@ -3417,9 +3432,9 @@ class ct {
|
|
|
3417
3432
|
if (!this.baseCarto || !this.baseUp) return;
|
|
3418
3433
|
const m = this.positions[0], g = i.camera.getPickRay(r.position);
|
|
3419
3434
|
if (!g) return;
|
|
3420
|
-
const p = g.origin, f = e.Cartesian3.normalize(g.direction, new e.Cartesian3()), w = m, y = this.baseUp,
|
|
3435
|
+
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()), b = e.Cartesian3.dot(f, f), C = -e.Cartesian3.dot(f, y), M = e.Cartesian3.dot(y, y), P = -e.Cartesian3.dot(f, v), L = e.Cartesian3.dot(y, v), E = b * M - C * C;
|
|
3421
3436
|
if (Math.abs(E) < 1e-6) return;
|
|
3422
|
-
const I = (b * L -
|
|
3437
|
+
const I = (b * L - C * P) / E, _ = e.Cartesian3.add(
|
|
3423
3438
|
w,
|
|
3424
3439
|
e.Cartesian3.multiplyByScalar(y, I, new e.Cartesian3()),
|
|
3425
3440
|
new e.Cartesian3()
|
|
@@ -3453,11 +3468,11 @@ class ct {
|
|
|
3453
3468
|
(this.positions[0].z + this.positions[1].z) / 2
|
|
3454
3469
|
), k = e.Cartographic.fromCartesian($);
|
|
3455
3470
|
this.previewLabelId && this.htmlLabelPool && (this.htmlLabelPool.removeByIds([this.previewLabelId]), this.previewLabelId = null);
|
|
3456
|
-
const
|
|
3457
|
-
this.htmlLabelId =
|
|
3471
|
+
const j = this.htmlLabelId || `measure_vertical_${Date.now()}`;
|
|
3472
|
+
this.htmlLabelId = j, this.htmlLabelPool.add(
|
|
3458
3473
|
{ text: `${O.toFixed(2)} m` },
|
|
3459
3474
|
{
|
|
3460
|
-
id:
|
|
3475
|
+
id: j,
|
|
3461
3476
|
lon: e.Math.toDegrees(k.longitude),
|
|
3462
3477
|
lat: e.Math.toDegrees(k.latitude),
|
|
3463
3478
|
height: k.height || 0,
|
|
@@ -3466,14 +3481,14 @@ class ct {
|
|
|
3466
3481
|
style: { pointerEvents: "none", userSelect: "none", cursor: "default" }
|
|
3467
3482
|
}
|
|
3468
3483
|
);
|
|
3469
|
-
const
|
|
3484
|
+
const Y = {
|
|
3470
3485
|
entity: this.entity,
|
|
3471
3486
|
label: this.labelEntity,
|
|
3472
3487
|
positions: this.positions,
|
|
3473
3488
|
vertical: O,
|
|
3474
3489
|
clear: () => this.clear()
|
|
3475
3490
|
};
|
|
3476
|
-
(u = t.onComplete) == null || u.call(t,
|
|
3491
|
+
(u = t.onComplete) == null || u.call(t, Y);
|
|
3477
3492
|
}
|
|
3478
3493
|
}, e.ScreenSpaceEventType.LEFT_CLICK), this.handler.setInputAction((r) => {
|
|
3479
3494
|
var _, S;
|
|
@@ -3486,9 +3501,9 @@ class ct {
|
|
|
3486
3501
|
if (!o) return;
|
|
3487
3502
|
const n = o.origin, l = e.Cartesian3.normalize(o.direction, new e.Cartesian3()), c = s, d = this.baseUp, u = e.Cartesian3.subtract(n, 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;
|
|
3488
3503
|
if (Math.abs(y) < 1e-6) return;
|
|
3489
|
-
const
|
|
3504
|
+
const v = (m * w - g * f) / y, b = e.Cartesian3.add(
|
|
3490
3505
|
c,
|
|
3491
|
-
e.Cartesian3.multiplyByScalar(d,
|
|
3506
|
+
e.Cartesian3.multiplyByScalar(d, v, new e.Cartesian3()),
|
|
3492
3507
|
new e.Cartesian3()
|
|
3493
3508
|
);
|
|
3494
3509
|
if (this.positions[1] = b, !this.previewEntity) {
|
|
@@ -3514,7 +3529,7 @@ class ct {
|
|
|
3514
3529
|
disableDepthTestDistance: Number.POSITIVE_INFINITY
|
|
3515
3530
|
}
|
|
3516
3531
|
});
|
|
3517
|
-
const
|
|
3532
|
+
const C = this.baseCarto, M = e.Cartographic.fromCartesian(b), P = Math.abs((M.height || 0) - (C.height || 0)), L = new e.Cartesian3(
|
|
3518
3533
|
(this.positions[0].x + b.x) / 2,
|
|
3519
3534
|
(this.positions[0].y + b.y) / 2,
|
|
3520
3535
|
(this.positions[0].z + b.z) / 2
|
|
@@ -3540,8 +3555,8 @@ class ct {
|
|
|
3540
3555
|
this.stop(), this.entity && (this.viewer.entities.remove(this.entity), this.entity = null), this.labelEntity && (this.viewer.entities.remove(this.labelEntity), this.labelEntity = null), this.tempPoints.forEach((t) => this.viewer.entities.remove(t)), this.tempPoints = [], this.previewPointEntity && (this.viewer.entities.remove(this.previewPointEntity), this.previewPointEntity = null), this.previewEntity && (this.viewer.entities.remove(this.previewEntity), this.previewEntity = 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.positions = [];
|
|
3541
3556
|
}
|
|
3542
3557
|
rehydrate(t, e) {
|
|
3543
|
-
var
|
|
3544
|
-
const i = this.Cesium, r = this.viewer, s = t.options || {}, o = s.lineColor || s.color || i.Color.CYAN, n = ((M = (
|
|
3558
|
+
var C, M;
|
|
3559
|
+
const i = this.Cesium, r = this.viewer, s = t.options || {}, o = s.lineColor || s.color || i.Color.CYAN, n = ((M = (C = s.dashLineColor || s.lineColor || s.color || i.Color.RED).withAlpha) == null ? void 0 : M.call(C, 0.9)) || i.Color.RED, l = s.width || 3, c = (t.positions || []).map((P) => new i.Cartesian3(P[0], P[1], P[2]));
|
|
3545
3560
|
if (c.length < 2) return;
|
|
3546
3561
|
if (!this.htmlLabelPool) {
|
|
3547
3562
|
const P = s.overlayContainerId || "html-label-container";
|
|
@@ -3555,12 +3570,12 @@ class ct {
|
|
|
3555
3570
|
}
|
|
3556
3571
|
const d = c[0], u = c[1], m = r.entities.add({ position: d, point: { pixelSize: 8, color: s.pointColor || s.color || i.Color.YELLOW, disableDepthTestDistance: Number.POSITIVE_INFINITY } }), g = r.entities.add({ position: u, point: { pixelSize: 8, color: s.pointColor || s.color || i.Color.YELLOW, disableDepthTestDistance: Number.POSITIVE_INFINITY } });
|
|
3557
3572
|
this.tempPoints.push(m), this.tempPoints.push(g), this.entity = r.entities.add({ polyline: { positions: [d, u], width: l, material: o, depthFailMaterial: new i.PolylineDashMaterialProperty({ color: n, dashLength: 12, dashPattern: 255 }) } });
|
|
3558
|
-
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),
|
|
3573
|
+
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), b = t.id + "_label";
|
|
3559
3574
|
this.htmlLabelId = b, this.htmlLabelPool.add({ text: `${w.toFixed(2)} m` }, {
|
|
3560
3575
|
id: b,
|
|
3561
|
-
lon: i.Math.toDegrees(
|
|
3562
|
-
lat: i.Math.toDegrees(
|
|
3563
|
-
height:
|
|
3576
|
+
lon: i.Math.toDegrees(v.longitude),
|
|
3577
|
+
lat: i.Math.toDegrees(v.latitude),
|
|
3578
|
+
height: v.height || 0,
|
|
3564
3579
|
theme: "measure-vertical",
|
|
3565
3580
|
show: !0,
|
|
3566
3581
|
style: { pointerEvents: "none", userSelect: "none", cursor: "default" }
|
|
@@ -3634,86 +3649,86 @@ class dt {
|
|
|
3634
3649
|
this.stop(), this.previewSegmentEntities.forEach((Z) => i.entities.remove(Z)), this.previewSegmentEntities = [], this.previewAngleMarkerEntities.forEach((Z) => i.entities.remove(Z)), this.previewAngleMarkerEntities = [], this.previewPointEntity && (i.entities.remove(this.previewPointEntity), this.previewPointEntity = null);
|
|
3635
3650
|
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);
|
|
3636
3651
|
e.Cartographic.fromCartesian(f);
|
|
3637
|
-
const y = Math.max(m, g),
|
|
3652
|
+
const y = Math.max(m, g), v = e.Cartesian3.fromDegrees(
|
|
3638
3653
|
e.Math.toDegrees(w.longitude),
|
|
3639
3654
|
e.Math.toDegrees(w.latitude),
|
|
3640
3655
|
y
|
|
3641
|
-
), b = t.lineColor || t.color || e.Color.YELLOW,
|
|
3656
|
+
), b = t.lineColor || t.color || e.Color.YELLOW, C = ((l = (n = t.dashLineColor || t.lineColor || t.color || e.Color.RED).withAlpha) == null ? void 0 : l.call(n, 0.9)) || e.Color.RED, M = i.entities.add({
|
|
3642
3657
|
polyline: {
|
|
3643
|
-
positions: [p,
|
|
3658
|
+
positions: [p, v],
|
|
3644
3659
|
width: t.width || 3,
|
|
3645
3660
|
material: b,
|
|
3646
|
-
depthFailMaterial: new e.PolylineDashMaterialProperty({ color:
|
|
3661
|
+
depthFailMaterial: new e.PolylineDashMaterialProperty({ color: C, dashLength: 12, dashPattern: 255 })
|
|
3647
3662
|
}
|
|
3648
3663
|
}), P = i.entities.add({
|
|
3649
3664
|
polyline: {
|
|
3650
|
-
positions: [
|
|
3665
|
+
positions: [v, f],
|
|
3651
3666
|
width: t.width || 3,
|
|
3652
3667
|
material: b,
|
|
3653
|
-
depthFailMaterial: new e.PolylineDashMaterialProperty({ color:
|
|
3668
|
+
depthFailMaterial: new e.PolylineDashMaterialProperty({ color: C, dashLength: 12, dashPattern: 255 })
|
|
3654
3669
|
}
|
|
3655
3670
|
}), L = i.entities.add({
|
|
3656
3671
|
polyline: {
|
|
3657
3672
|
positions: [p, f],
|
|
3658
3673
|
width: t.width || 3,
|
|
3659
3674
|
material: b,
|
|
3660
|
-
depthFailMaterial: new e.PolylineDashMaterialProperty({ color:
|
|
3675
|
+
depthFailMaterial: new e.PolylineDashMaterialProperty({ color: C, dashLength: 12, dashPattern: 255 })
|
|
3661
3676
|
}
|
|
3662
3677
|
});
|
|
3663
3678
|
this.segmentEntities.push(M, P, L);
|
|
3664
|
-
const E = e.Cartesian3.distance(p,
|
|
3665
|
-
this.segmentLabelIds = [$, k,
|
|
3666
|
-
const
|
|
3667
|
-
this.angleLabelIds = [
|
|
3668
|
-
const
|
|
3679
|
+
const E = e.Cartesian3.distance(p, v), I = e.Cartesian3.distance(v, f), _ = e.Cartesian3.distance(p, f), S = 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), D = new e.Cartesian3((p.x + f.x) / 2, (p.y + f.y) / 2, (p.z + f.z) / 2), x = e.Cartographic.fromCartesian(S), A = e.Cartographic.fromCartesian(T), O = e.Cartographic.fromCartesian(D), $ = "measure_triangle_seg_v", k = "measure_triangle_seg_h", j = "measure_triangle_seg_hyp";
|
|
3680
|
+
this.segmentLabelIds = [$, k, j], this.htmlLabelPool.add({ text: `${E.toFixed(2)} m` }, { id: $, 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" } }), this.htmlLabelPool.add({ text: `${I.toFixed(2)} m` }, { id: k, lon: e.Math.toDegrees(A.longitude), lat: e.Math.toDegrees(A.latitude), height: A.height || 0, theme: "measure-triangle-seg", show: !0, style: { pointerEvents: "none", userSelect: "none", cursor: "default" } }), this.htmlLabelPool.add({ text: `${_.toFixed(2)} m` }, { id: j, 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" } });
|
|
3681
|
+
const Y = e.Cartesian3.subtract(f, p, new e.Cartesian3()), G = 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(Y, G), le = Math.sqrt(e.Cartesian3.dot(Y, Y)) * Math.sqrt(e.Cartesian3.dot(G, G)), he = e.Cartesian3.dot(q, X), B = Math.sqrt(e.Cartesian3.dot(q, q)) * Math.sqrt(e.Cartesian3.dot(X, X)), V = Math.acos(Math.min(Math.max(se / (le || 1), -1), 1)), J = Math.acos(Math.min(Math.max(he / (B || 1), -1), 1)), ie = e.Cartographic.fromCartesian(p), W = e.Cartographic.fromCartesian(f), Q = "measure_triangle_angle_a", R = "measure_triangle_angle_b";
|
|
3682
|
+
this.angleLabelIds = [Q, R], this.htmlLabelPool.add({ text: `${(V * 180 / Math.PI).toFixed(2)}°` }, { id: Q, lon: e.Math.toDegrees(ie.longitude), lat: e.Math.toDegrees(ie.latitude), height: ie.height || 0, theme: "measure-triangle-angle", show: !0, style: { pointerEvents: "none", userSelect: "none", cursor: "default" } }), this.htmlLabelPool.add({ text: `${(J * 180 / Math.PI).toFixed(2)}°` }, { id: R, lon: e.Math.toDegrees(W.longitude), lat: e.Math.toDegrees(W.latitude), height: W.height || 0, theme: "measure-triangle-angle", show: !0, style: { pointerEvents: "none", userSelect: "none", cursor: "default" } });
|
|
3683
|
+
const re = Math.max(0.01, Math.min(0.5, t.angleMarkerRatio ?? 0.2)), K = Math.min(E, I) * re;
|
|
3669
3684
|
if (E > 1e-3 && I > 1e-3) {
|
|
3670
3685
|
const Z = e.Cartesian3.normalize(
|
|
3671
|
-
e.Cartesian3.subtract(p,
|
|
3686
|
+
e.Cartesian3.subtract(p, v, new e.Cartesian3()),
|
|
3672
3687
|
new e.Cartesian3()
|
|
3673
|
-
),
|
|
3674
|
-
e.Cartesian3.subtract(f,
|
|
3688
|
+
), ce = e.Cartesian3.normalize(
|
|
3689
|
+
e.Cartesian3.subtract(f, v, new e.Cartesian3()),
|
|
3675
3690
|
new e.Cartesian3()
|
|
3676
|
-
),
|
|
3677
|
-
|
|
3678
|
-
|
|
3679
|
-
|
|
3691
|
+
), te = new e.Cartesian3(
|
|
3692
|
+
v.x + Z.x * K,
|
|
3693
|
+
v.y + Z.y * K,
|
|
3694
|
+
v.z + Z.z * K
|
|
3680
3695
|
), F = new e.Cartesian3(
|
|
3681
|
-
|
|
3682
|
-
|
|
3683
|
-
|
|
3684
|
-
),
|
|
3685
|
-
|
|
3686
|
-
|
|
3687
|
-
|
|
3696
|
+
v.x + ce.x * K,
|
|
3697
|
+
v.y + ce.y * K,
|
|
3698
|
+
v.z + ce.z * K
|
|
3699
|
+
), ee = new e.Cartesian3(
|
|
3700
|
+
v.x + Z.x * K + ce.x * K,
|
|
3701
|
+
v.y + Z.y * K + ce.y * K,
|
|
3702
|
+
v.z + Z.z * K + ce.z * K
|
|
3688
3703
|
), oe = i.entities.add({
|
|
3689
3704
|
polyline: {
|
|
3690
|
-
positions: [
|
|
3705
|
+
positions: [te, ee],
|
|
3691
3706
|
width: t.width || 3,
|
|
3692
3707
|
material: b,
|
|
3693
|
-
depthFailMaterial: new e.PolylineDashMaterialProperty({ color:
|
|
3708
|
+
depthFailMaterial: new e.PolylineDashMaterialProperty({ color: C, dashLength: 12, dashPattern: 255 })
|
|
3694
3709
|
}
|
|
3695
3710
|
}), Ie = i.entities.add({
|
|
3696
3711
|
polyline: {
|
|
3697
|
-
positions: [F,
|
|
3712
|
+
positions: [F, ee],
|
|
3698
3713
|
width: t.width || 3,
|
|
3699
3714
|
material: b,
|
|
3700
|
-
depthFailMaterial: new e.PolylineDashMaterialProperty({ color:
|
|
3715
|
+
depthFailMaterial: new e.PolylineDashMaterialProperty({ color: C, dashLength: 12, dashPattern: 255 })
|
|
3701
3716
|
}
|
|
3702
3717
|
});
|
|
3703
3718
|
this.angleMarkerEntities.push(oe, Ie);
|
|
3704
3719
|
}
|
|
3705
3720
|
this.previewLabelId && this.htmlLabelPool && (this.htmlLabelPool.removeByIds([this.previewLabelId]), this.previewLabelId = null);
|
|
3706
|
-
const
|
|
3721
|
+
const U = {
|
|
3707
3722
|
entity: this.segmentEntities,
|
|
3708
|
-
positions: [p, f,
|
|
3723
|
+
positions: [p, f, v],
|
|
3709
3724
|
lengths: { vertical: E, horizontal: I, hypotenuse: _ },
|
|
3710
|
-
angles: { acuteA:
|
|
3725
|
+
angles: { acuteA: V, acuteB: J },
|
|
3711
3726
|
clear: () => this.clear()
|
|
3712
3727
|
};
|
|
3713
|
-
(c = t.onComplete) == null || c.call(t,
|
|
3728
|
+
(c = t.onComplete) == null || c.call(t, U);
|
|
3714
3729
|
}
|
|
3715
3730
|
}, e.ScreenSpaceEventType.LEFT_CLICK), this.handler.setInputAction((r) => {
|
|
3716
|
-
var
|
|
3731
|
+
var J, ie;
|
|
3717
3732
|
if (this.positions.length !== 1) return;
|
|
3718
3733
|
const s = i.scene.pickPosition(r.endPosition);
|
|
3719
3734
|
if (!s) return;
|
|
@@ -3723,7 +3738,7 @@ class dt {
|
|
|
3723
3738
|
g
|
|
3724
3739
|
);
|
|
3725
3740
|
this.previewLow = d, this.previewHigh = u, this.previewThird = p;
|
|
3726
|
-
const f = t.lineColor || t.color || e.Color.YELLOW, w = ((
|
|
3741
|
+
const f = t.lineColor || t.color || e.Color.YELLOW, w = ((ie = (J = t.dashLineColor || t.lineColor || t.color || e.Color.RED).withAlpha) == null ? void 0 : ie.call(J, 0.9)) || e.Color.RED;
|
|
3727
3742
|
if (this.previewPointEntity ? this.previewPointEntity.position = s : this.previewPointEntity = i.entities.add({
|
|
3728
3743
|
position: s,
|
|
3729
3744
|
point: {
|
|
@@ -3732,21 +3747,21 @@ class dt {
|
|
|
3732
3747
|
disableDepthTestDistance: Number.POSITIVE_INFINITY
|
|
3733
3748
|
}
|
|
3734
3749
|
}), !this.previewSegmentEntities.length) {
|
|
3735
|
-
const
|
|
3750
|
+
const W = i.entities.add({
|
|
3736
3751
|
polyline: {
|
|
3737
3752
|
positions: new e.CallbackProperty(() => !this.previewLow || !this.previewThird ? [] : [this.previewLow, this.previewThird], !1),
|
|
3738
3753
|
width: t.width || 3,
|
|
3739
3754
|
material: f,
|
|
3740
3755
|
depthFailMaterial: new e.PolylineDashMaterialProperty({ color: w, dashLength: 12, dashPattern: 255 })
|
|
3741
3756
|
}
|
|
3742
|
-
}),
|
|
3757
|
+
}), Q = i.entities.add({
|
|
3743
3758
|
polyline: {
|
|
3744
3759
|
positions: new e.CallbackProperty(() => !this.previewThird || !this.previewHigh ? [] : [this.previewThird, this.previewHigh], !1),
|
|
3745
3760
|
width: t.width || 3,
|
|
3746
3761
|
material: f,
|
|
3747
3762
|
depthFailMaterial: new e.PolylineDashMaterialProperty({ color: w, dashLength: 12, dashPattern: 255 })
|
|
3748
3763
|
}
|
|
3749
|
-
}),
|
|
3764
|
+
}), R = i.entities.add({
|
|
3750
3765
|
polyline: {
|
|
3751
3766
|
positions: new e.CallbackProperty(() => !this.previewLow || !this.previewHigh ? [] : [this.previewLow, this.previewHigh], !1),
|
|
3752
3767
|
width: t.width || 3,
|
|
@@ -3754,33 +3769,33 @@ class dt {
|
|
|
3754
3769
|
depthFailMaterial: new e.PolylineDashMaterialProperty({ color: w, dashLength: 12, dashPattern: 255 })
|
|
3755
3770
|
}
|
|
3756
3771
|
});
|
|
3757
|
-
this.previewSegmentEntities.push(
|
|
3772
|
+
this.previewSegmentEntities.push(W, Q, R);
|
|
3758
3773
|
}
|
|
3759
|
-
const y = e.Cartesian3.distance(d, p),
|
|
3760
|
-
this.segmentLabelIds.length === 0 && (this.segmentLabelIds = [
|
|
3761
|
-
const
|
|
3762
|
-
if (y > 1e-3 &&
|
|
3763
|
-
const
|
|
3774
|
+
const y = e.Cartesian3.distance(d, p), v = e.Cartesian3.distance(p, u), b = e.Cartesian3.distance(d, u), C = 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(C, M), I = Math.sqrt(e.Cartesian3.dot(C, C)) * Math.sqrt(e.Cartesian3.dot(M, M)), _ = e.Cartesian3.dot(P, L), S = 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)), D = Math.acos(Math.min(Math.max(_ / (S || 1), -1), 1)), x = new e.Cartesian3((d.x + p.x) / 2, (d.y + p.y) / 2, (d.z + p.z) / 2), A = new e.Cartesian3((p.x + u.x) / 2, (p.y + u.y) / 2, (p.z + u.z) / 2), O = new e.Cartesian3((d.x + u.x) / 2, (d.y + u.y) / 2, (d.z + u.z) / 2), $ = e.Cartographic.fromCartesian(x), k = e.Cartographic.fromCartesian(A), j = e.Cartographic.fromCartesian(O), Y = e.Cartographic.fromCartesian(d), G = e.Cartographic.fromCartesian(u), q = "measure_triangle_seg_v", X = "measure_triangle_seg_h", se = "measure_triangle_seg_hyp", le = "measure_triangle_angle_a", he = "measure_triangle_angle_b";
|
|
3775
|
+
this.segmentLabelIds.length === 0 && (this.segmentLabelIds = [q, X, se]), this.angleLabelIds.length === 0 && (this.angleLabelIds = [le, he]), 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(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: `${b.toFixed(2)} m` }, { id: se, lon: e.Math.toDegrees(j.longitude), lat: e.Math.toDegrees(j.latitude), height: j.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: le, 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" } }), this.htmlLabelPool.add({ text: `${(D * 180 / Math.PI).toFixed(2)}°` }, { id: he, 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" } });
|
|
3776
|
+
const B = Math.max(0.01, Math.min(0.5, t.angleMarkerRatio ?? 0.2)), V = Math.min(y, v) * B;
|
|
3777
|
+
if (y > 1e-3 && v > 1e-3) {
|
|
3778
|
+
const W = e.Cartesian3.normalize(
|
|
3764
3779
|
e.Cartesian3.subtract(d, p, new e.Cartesian3()),
|
|
3765
3780
|
new e.Cartesian3()
|
|
3766
|
-
),
|
|
3781
|
+
), Q = e.Cartesian3.normalize(
|
|
3767
3782
|
e.Cartesian3.subtract(u, p, new e.Cartesian3()),
|
|
3768
3783
|
new e.Cartesian3()
|
|
3769
|
-
),
|
|
3770
|
-
p.x +
|
|
3771
|
-
p.y +
|
|
3772
|
-
p.z +
|
|
3773
|
-
),
|
|
3774
|
-
p.x +
|
|
3775
|
-
p.y +
|
|
3776
|
-
p.z +
|
|
3777
|
-
),
|
|
3778
|
-
p.x +
|
|
3779
|
-
p.y +
|
|
3780
|
-
p.z +
|
|
3784
|
+
), R = new e.Cartesian3(
|
|
3785
|
+
p.x + W.x * V,
|
|
3786
|
+
p.y + W.y * V,
|
|
3787
|
+
p.z + W.z * V
|
|
3788
|
+
), re = new e.Cartesian3(
|
|
3789
|
+
p.x + Q.x * V,
|
|
3790
|
+
p.y + Q.y * V,
|
|
3791
|
+
p.z + Q.z * V
|
|
3792
|
+
), K = new e.Cartesian3(
|
|
3793
|
+
p.x + W.x * V + Q.x * V,
|
|
3794
|
+
p.y + W.y * V + Q.y * V,
|
|
3795
|
+
p.z + W.z * V + Q.z * V
|
|
3781
3796
|
);
|
|
3782
|
-
if (this.previewMarkerP1 =
|
|
3783
|
-
const
|
|
3797
|
+
if (this.previewMarkerP1 = R, this.previewMarkerP2 = re, this.previewMarkerCorner = K, !this.previewAngleMarkerEntities.length) {
|
|
3798
|
+
const U = i.entities.add({
|
|
3784
3799
|
polyline: {
|
|
3785
3800
|
positions: new e.CallbackProperty(() => !this.previewMarkerP1 || !this.previewMarkerCorner ? [] : [this.previewMarkerP1, this.previewMarkerCorner], !1),
|
|
3786
3801
|
width: t.width || 3,
|
|
@@ -3795,7 +3810,7 @@ class dt {
|
|
|
3795
3810
|
depthFailMaterial: new e.PolylineDashMaterialProperty({ color: w, dashLength: 12, dashPattern: 255 })
|
|
3796
3811
|
}
|
|
3797
3812
|
});
|
|
3798
|
-
this.previewAngleMarkerEntities.push(
|
|
3813
|
+
this.previewAngleMarkerEntities.push(U, Z);
|
|
3799
3814
|
}
|
|
3800
3815
|
}
|
|
3801
3816
|
}, e.ScreenSpaceEventType.MOUSE_MOVE);
|
|
@@ -3807,52 +3822,52 @@ class dt {
|
|
|
3807
3822
|
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 = [];
|
|
3808
3823
|
}
|
|
3809
3824
|
rehydrate(t, e) {
|
|
3810
|
-
var Z,
|
|
3811
|
-
const i = this.Cesium, r = this.viewer, s = t.options || {}, o = s.lineColor || s.color || i.Color.YELLOW, n = ((
|
|
3825
|
+
var Z, ce;
|
|
3826
|
+
const i = this.Cesium, r = this.viewer, s = t.options || {}, o = s.lineColor || s.color || i.Color.YELLOW, n = ((ce = (Z = s.dashLineColor || s.lineColor || s.color || i.Color.RED).withAlpha) == null ? void 0 : ce.call(Z, 0.9)) || i.Color.RED, l = s.width || 3, c = (t.positions || []).map((te) => new i.Cartesian3(te[0], te[1], te[2]));
|
|
3812
3827
|
if (c.length < 2) return;
|
|
3813
3828
|
if (!this.htmlLabelPool) {
|
|
3814
|
-
const
|
|
3815
|
-
this.htmlLabelPool = e || new N(i, r,
|
|
3816
|
-
createElement: (F,
|
|
3829
|
+
const te = s.overlayContainerId || "html-label-container";
|
|
3830
|
+
this.htmlLabelPool = e || new N(i, r, te), this.htmlLabelPool.registerTheme("measure-triangle", {
|
|
3831
|
+
createElement: (F, ee) => {
|
|
3817
3832
|
var oe;
|
|
3818
|
-
F.innerHTML = String(((oe =
|
|
3833
|
+
F.innerHTML = String(((oe = ee == null ? void 0 : ee.data) == null ? void 0 : oe.text) || ""), F.style.background = "rgba(0,0,0,0.6)", F.style.color = "#fff", F.style.font = "14px sans-serif", F.style.padding = "4px 6px", F.style.borderRadius = "4px", F.style.whiteSpace = "pre";
|
|
3819
3834
|
},
|
|
3820
3835
|
options: { offset: { x: 0, y: -10 } }
|
|
3821
3836
|
}), this.htmlLabelPool.registerTheme("measure-triangle-seg", {
|
|
3822
|
-
createElement: (F,
|
|
3837
|
+
createElement: (F, ee) => {
|
|
3823
3838
|
var oe;
|
|
3824
|
-
F.innerHTML = String(((oe =
|
|
3839
|
+
F.innerHTML = String(((oe = ee == null ? void 0 : ee.data) == null ? void 0 : oe.text) || ""), F.style.background = "rgba(0,0,0,0.6)", F.style.color = "#fff", F.style.font = "14px sans-serif", F.style.padding = "4px 6px", F.style.borderRadius = "4px", F.style.whiteSpace = "pre";
|
|
3825
3840
|
},
|
|
3826
3841
|
options: { offset: { x: 0, y: -10 } }
|
|
3827
3842
|
}), this.htmlLabelPool.registerTheme("measure-triangle-angle", {
|
|
3828
|
-
createElement: (F,
|
|
3843
|
+
createElement: (F, ee) => {
|
|
3829
3844
|
var oe;
|
|
3830
|
-
F.innerHTML = String(((oe =
|
|
3845
|
+
F.innerHTML = String(((oe = ee == null ? void 0 : ee.data) == null ? void 0 : oe.text) || ""), F.style.background = "rgba(0,0,0,0.6)", F.style.color = "#fff", F.style.font = "14px sans-serif", F.style.padding = "4px 6px", F.style.borderRadius = "4px", F.style.whiteSpace = "pre";
|
|
3831
3846
|
},
|
|
3832
3847
|
options: { offset: { x: 0, y: -10 } }
|
|
3833
3848
|
});
|
|
3834
3849
|
}
|
|
3835
3850
|
const d = i.Cartographic.fromCartesian(c[0]), u = i.Cartographic.fromCartesian(c[1]), m = d.height || 0, g = u.height || 0, p = m <= g ? c[0] : c[1], f = m > g ? c[0] : c[1], w = r.entities.add({ position: p, point: { pixelSize: 8, color: s.pointColor || s.color || i.Color.YELLOW, disableDepthTestDistance: Number.POSITIVE_INFINITY } }), y = r.entities.add({ position: f, point: { pixelSize: 8, color: s.pointColor || s.color || i.Color.YELLOW, disableDepthTestDistance: Number.POSITIVE_INFINITY } });
|
|
3836
3851
|
this.pointEntities.push(w, y);
|
|
3837
|
-
const
|
|
3838
|
-
i.Math.toDegrees(
|
|
3839
|
-
i.Math.toDegrees(
|
|
3852
|
+
const v = i.Cartographic.fromCartesian(p), b = Math.max(m, g), C = i.Cartesian3.fromDegrees(
|
|
3853
|
+
i.Math.toDegrees(v.longitude),
|
|
3854
|
+
i.Math.toDegrees(v.latitude),
|
|
3840
3855
|
b
|
|
3841
3856
|
), M = r.entities.add({
|
|
3842
|
-
polyline: { positions: [p,
|
|
3857
|
+
polyline: { positions: [p, C], width: l, material: o, depthFailMaterial: new i.PolylineDashMaterialProperty({ color: n, dashLength: 12, dashPattern: 255 }) }
|
|
3843
3858
|
}), P = r.entities.add({
|
|
3844
|
-
polyline: { positions: [
|
|
3859
|
+
polyline: { positions: [C, f], width: l, material: o, depthFailMaterial: new i.PolylineDashMaterialProperty({ color: n, dashLength: 12, dashPattern: 255 }) }
|
|
3845
3860
|
}), L = r.entities.add({
|
|
3846
3861
|
polyline: { positions: [p, f], width: l, material: o, depthFailMaterial: new i.PolylineDashMaterialProperty({ color: n, dashLength: 12, dashPattern: 255 }) }
|
|
3847
3862
|
});
|
|
3848
3863
|
this.segmentEntities.push(M, P, L);
|
|
3849
|
-
const E = i.Cartesian3.distance(p,
|
|
3850
|
-
this.segmentLabelIds = [$, k,
|
|
3851
|
-
const
|
|
3852
|
-
this.angleLabelIds = [
|
|
3853
|
-
const
|
|
3864
|
+
const E = i.Cartesian3.distance(p, C), I = i.Cartesian3.distance(C, f), _ = i.Cartesian3.distance(p, f), S = new i.Cartesian3((p.x + C.x) / 2, (p.y + C.y) / 2, (p.z + C.z) / 2), T = new i.Cartesian3((C.x + f.x) / 2, (C.y + f.y) / 2, (C.z + f.z) / 2), D = new i.Cartesian3((p.x + f.x) / 2, (p.y + f.y) / 2, (p.z + f.z) / 2), x = i.Cartographic.fromCartesian(S), A = i.Cartographic.fromCartesian(T), O = i.Cartographic.fromCartesian(D), $ = t.id + "_tri_v", k = t.id + "_tri_h", j = t.id + "_tri_hyp";
|
|
3865
|
+
this.segmentLabelIds = [$, k, j], this.htmlLabelPool.add({ text: `${E.toFixed(2)} m` }, { id: $, 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" } }), this.htmlLabelPool.add({ text: `${I.toFixed(2)} m` }, { id: k, lon: i.Math.toDegrees(A.longitude), lat: i.Math.toDegrees(A.latitude), height: A.height || 0, theme: "measure-triangle-seg", show: !0, style: { pointerEvents: "none", userSelect: "none", cursor: "default" } }), this.htmlLabelPool.add({ text: `${_.toFixed(2)} m` }, { id: j, 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" } });
|
|
3866
|
+
const Y = i.Cartesian3.subtract(f, p, new i.Cartesian3()), G = i.Cartesian3.subtract(C, p, new i.Cartesian3()), q = i.Cartesian3.subtract(C, f, new i.Cartesian3()), X = i.Cartesian3.subtract(p, f, new i.Cartesian3()), se = i.Cartesian3.dot(Y, G), le = Math.sqrt(i.Cartesian3.dot(Y, Y)) * Math.sqrt(i.Cartesian3.dot(G, G)), he = i.Cartesian3.dot(q, X), B = Math.sqrt(i.Cartesian3.dot(q, q)) * Math.sqrt(i.Cartesian3.dot(X, X)), V = Math.acos(Math.min(Math.max(se / (le || 1), -1), 1)), J = Math.acos(Math.min(Math.max(he / (B || 1), -1), 1)), ie = i.Cartographic.fromCartesian(p), W = i.Cartographic.fromCartesian(f), Q = s.labelText || { angle: "角度" }, R = t.id + "_tri_angA", re = t.id + "_tri_angB";
|
|
3867
|
+
this.angleLabelIds = [R, re], this.htmlLabelPool.add({ text: `${Q.angle}:${(V * 180 / Math.PI).toFixed(2)}°` }, { id: R, lon: i.Math.toDegrees(ie.longitude), lat: i.Math.toDegrees(ie.latitude), height: ie.height || 0, theme: "measure-triangle-angle", show: !0, style: { pointerEvents: "none", userSelect: "none", cursor: "default" } }), this.htmlLabelPool.add({ text: `${Q.angle}:${(J * 180 / Math.PI).toFixed(2)}°` }, { id: re, lon: i.Math.toDegrees(W.longitude), lat: i.Math.toDegrees(W.latitude), height: W.height || 0, theme: "measure-triangle-angle", show: !0, style: { pointerEvents: "none", userSelect: "none", cursor: "default" } });
|
|
3868
|
+
const K = Math.max(0.01, Math.min(0.5, s.angleMarkerRatio ?? 0.2)), U = Math.min(E, I) * K;
|
|
3854
3869
|
if (E > 1e-3 && I > 1e-3) {
|
|
3855
|
-
const
|
|
3870
|
+
const te = i.Cartesian3.normalize(i.Cartesian3.subtract(p, C, new i.Cartesian3()), new i.Cartesian3()), F = i.Cartesian3.normalize(i.Cartesian3.subtract(f, C, new i.Cartesian3()), new i.Cartesian3()), ee = new i.Cartesian3(C.x + te.x * U, C.y + te.y * U, C.z + te.z * U), oe = new i.Cartesian3(C.x + F.x * U, C.y + F.y * U, C.z + F.z * U), Ie = new i.Cartesian3(C.x + te.x * U + F.x * U, C.y + te.y * U + F.y * U, C.z + te.z * U + F.z * U), Ft = r.entities.add({ polyline: { positions: [ee, Ie], width: l, material: o, depthFailMaterial: new i.PolylineDashMaterialProperty({ color: n, dashLength: 12, dashPattern: 255 }) } }), kt = r.entities.add({ polyline: { positions: [oe, Ie], width: l, material: o, depthFailMaterial: new i.PolylineDashMaterialProperty({ color: n, dashLength: 12, dashPattern: 255 }) } });
|
|
3856
3871
|
this.angleMarkerEntities.push(Ft, kt);
|
|
3857
3872
|
}
|
|
3858
3873
|
}
|
|
@@ -3927,14 +3942,14 @@ class pt {
|
|
|
3927
3942
|
style: { pointerEvents: "none", userSelect: "none", cursor: "default" }
|
|
3928
3943
|
}
|
|
3929
3944
|
);
|
|
3930
|
-
const
|
|
3945
|
+
const v = {
|
|
3931
3946
|
entity: this.entity,
|
|
3932
3947
|
label: this.labelEntity,
|
|
3933
3948
|
positions: this.positions,
|
|
3934
3949
|
distance: p,
|
|
3935
3950
|
clear: () => this.clear()
|
|
3936
3951
|
};
|
|
3937
|
-
(c = t.onComplete) == null || c.call(t,
|
|
3952
|
+
(c = t.onComplete) == null || c.call(t, v);
|
|
3938
3953
|
}
|
|
3939
3954
|
}, e.ScreenSpaceEventType.LEFT_CLICK), this.handler.setInputAction((r) => {
|
|
3940
3955
|
var g, p;
|
|
@@ -4104,9 +4119,9 @@ class ut {
|
|
|
4104
4119
|
})
|
|
4105
4120
|
}), i.scene.primitives.add(this.primitive), this.positions.length >= 2) {
|
|
4106
4121
|
if (this.edgeEntities.length) {
|
|
4107
|
-
for (const
|
|
4122
|
+
for (const v of this.edgeEntities)
|
|
4108
4123
|
try {
|
|
4109
|
-
i.entities.remove(
|
|
4124
|
+
i.entities.remove(v);
|
|
4110
4125
|
} catch {
|
|
4111
4126
|
}
|
|
4112
4127
|
this.edgeEntities = [];
|
|
@@ -4171,7 +4186,7 @@ class ut {
|
|
|
4171
4186
|
arcType: e.ArcType.NONE
|
|
4172
4187
|
}
|
|
4173
4188
|
});
|
|
4174
|
-
const y = t.lineColor || t.color || e.Color.YELLOW,
|
|
4189
|
+
const y = t.lineColor || t.color || e.Color.YELLOW, v = ((f = (p = t.dashLineColor || t.lineColor || t.color || e.Color.RED).withAlpha) == null ? void 0 : f.call(p, 0.9)) || e.Color.RED;
|
|
4175
4190
|
this.previewEdgeEntity = i.entities.add({
|
|
4176
4191
|
polyline: {
|
|
4177
4192
|
positions: new e.CallbackProperty(() => !this.previewPos || !this.positions.length ? [] : this.positions.concat([this.previewPos, this.positions[0]]), !1),
|
|
@@ -4180,13 +4195,13 @@ class ut {
|
|
|
4180
4195
|
clampToGround: !1,
|
|
4181
4196
|
arcType: e.ArcType.NONE,
|
|
4182
4197
|
depthFailMaterial: new e.PolylineDashMaterialProperty({
|
|
4183
|
-
color:
|
|
4198
|
+
color: v,
|
|
4184
4199
|
dashLength: 12,
|
|
4185
4200
|
dashPattern: 255
|
|
4186
4201
|
})
|
|
4187
4202
|
}
|
|
4188
4203
|
});
|
|
4189
|
-
const b = t.pointColor || t.color || e.Color.YELLOW,
|
|
4204
|
+
const b = t.pointColor || t.color || e.Color.YELLOW, C = i.entities.add({
|
|
4190
4205
|
position: new e.CallbackProperty(() => this.previewPos || this.positions[this.positions.length - 1], !1),
|
|
4191
4206
|
point: {
|
|
4192
4207
|
pixelSize: 8,
|
|
@@ -4194,7 +4209,7 @@ class ut {
|
|
|
4194
4209
|
disableDepthTestDistance: Number.POSITIVE_INFINITY
|
|
4195
4210
|
}
|
|
4196
4211
|
});
|
|
4197
|
-
this.previewPointEntities.push(
|
|
4212
|
+
this.previewPointEntities.push(C);
|
|
4198
4213
|
}
|
|
4199
4214
|
}, e.ScreenSpaceEventType.MOUSE_MOVE), this.handler.setInputAction(() => {
|
|
4200
4215
|
var g;
|
|
@@ -4242,7 +4257,7 @@ class ut {
|
|
|
4242
4257
|
}
|
|
4243
4258
|
), this.labelEntity = this.htmlLabelId;
|
|
4244
4259
|
for (let p = 0; p < this.positions.length; p++) {
|
|
4245
|
-
const f = (p + 1) % this.positions.length, w = this.positions[p], y = this.positions[f],
|
|
4260
|
+
const f = (p + 1) % this.positions.length, w = this.positions[p], y = this.positions[f], v = e.Cartographic.fromCartesian(w), b = e.Cartographic.fromCartesian(y), M = new e.EllipsoidGeodesic(v, b).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}`;
|
|
4246
4261
|
this.segmentLabelIds.push(E), this.htmlLabelPool.add(
|
|
4247
4262
|
{ text: `${d.side}:${M.toFixed(2)} m` },
|
|
4248
4263
|
{
|
|
@@ -4257,9 +4272,9 @@ class ut {
|
|
|
4257
4272
|
}
|
|
4258
4273
|
const u = o;
|
|
4259
4274
|
for (let p = 0; p < u.length; p++) {
|
|
4260
|
-
const f = u[(p - 1 + u.length) % u.length], w = u[p], y = u[(p + 1) % u.length],
|
|
4275
|
+
const f = u[(p - 1 + u.length) % u.length], w = u[p], y = u[(p + 1) % u.length], v = f.x - w.x, b = f.y - w.y, C = y.x - w.x, M = y.y - w.y, P = Math.sqrt(v * v + b * b), L = Math.sqrt(C * C + M * M);
|
|
4261
4276
|
if (!P || !L) continue;
|
|
4262
|
-
const E =
|
|
4277
|
+
const E = v / P * (C / L) + b / P * (M / L), I = Math.acos(Math.min(1, Math.max(-1, E))) * (180 / Math.PI), _ = e.Cartographic.fromCartesian(this.positions[p]), S = `measure_area_angle_${Date.now()}_${p}`;
|
|
4263
4278
|
this.angleLabelIds.push(S), this.htmlLabelPool.add(
|
|
4264
4279
|
{ text: `${d.angle}:${I.toFixed(2)} °` },
|
|
4265
4280
|
{
|
|
@@ -4363,19 +4378,19 @@ class ut {
|
|
|
4363
4378
|
theme: "measure-area",
|
|
4364
4379
|
show: !0
|
|
4365
4380
|
});
|
|
4366
|
-
const p = new i.PolygonHierarchy(o), f = new i.PolygonGeometry({ polygonHierarchy: p, vertexFormat: i.MaterialAppearance.VERTEX_FORMAT, perPositionHeight: !0 }), w = new i.GeometryInstance({ geometry: f }), y = s.color || i.Color.YELLOW.withAlpha(0.4),
|
|
4381
|
+
const p = new i.PolygonHierarchy(o), f = new i.PolygonGeometry({ polygonHierarchy: p, vertexFormat: i.MaterialAppearance.VERTEX_FORMAT, perPositionHeight: !0 }), w = new i.GeometryInstance({ geometry: f }), y = s.color || i.Color.YELLOW.withAlpha(0.4), v = s.color && s.color.withAlpha ? s.color.withAlpha(0.25) : i.Color.RED.withAlpha(0.4), b = new i.Primitive({
|
|
4367
4382
|
geometryInstances: w,
|
|
4368
4383
|
appearance: new i.MaterialAppearance({ material: i.Material.fromType("Color", { color: y }), translucent: !0, closed: !0 }),
|
|
4369
|
-
depthFailAppearance: new i.MaterialAppearance({ material: i.Material.fromType("Color", { color:
|
|
4384
|
+
depthFailAppearance: new i.MaterialAppearance({ material: i.Material.fromType("Color", { color: v }), translucent: !0, closed: !0 })
|
|
4370
4385
|
});
|
|
4371
4386
|
r.scene.primitives.add(b), this.primitive = b;
|
|
4372
4387
|
for (let M = 0; M < o.length; M++) {
|
|
4373
4388
|
const P = (M + 1) % o.length, L = o[M], E = o[P], I = i.Cartographic.fromCartesian(L), _ = i.Cartographic.fromCartesian(E), T = new i.EllipsoidGeodesic(I, _).surfaceDistance, D = new i.Cartesian3((L.x + E.x) / 2, (L.y + E.y) / 2, (L.z + E.z) / 2), x = i.Cartographic.fromCartesian(D), A = t.id + `_area_seg_${M}`;
|
|
4374
4389
|
this.segmentLabelIds.push(A), this.htmlLabelPool.add({ text: `${g.side}:${T.toFixed(2)} m` }, { id: A, lon: i.Math.toDegrees(x.longitude), lat: i.Math.toDegrees(x.latitude), height: x.height || 0, theme: "measure-area-seg", show: !0 });
|
|
4375
4390
|
}
|
|
4376
|
-
const
|
|
4377
|
-
for (let M = 0; M <
|
|
4378
|
-
const P =
|
|
4391
|
+
const C = c;
|
|
4392
|
+
for (let M = 0; M < C.length; M++) {
|
|
4393
|
+
const P = C[(M - 1 + C.length) % C.length], L = C[M], E = C[(M + 1) % C.length], I = P.x - L.x, _ = P.y - L.y, S = E.x - L.x, T = E.y - L.y, D = Math.sqrt(I * I + _ * _), x = Math.sqrt(S * S + T * T);
|
|
4379
4394
|
if (!D || !x) continue;
|
|
4380
4395
|
const A = I / D * (S / x) + _ / D * (T / x), O = Math.acos(Math.min(1, Math.max(-1, A))) * (180 / Math.PI), $ = i.Cartographic.fromCartesian(o[M]), k = t.id + `_area_angle_${M}`;
|
|
4381
4396
|
this.angleLabelIds.push(k), this.htmlLabelPool.add({ text: `${g.angle}:${O.toFixed(2)} °` }, { id: k, lon: i.Math.toDegrees($.longitude), lat: i.Math.toDegrees($.latitude), height: $.height || 0, theme: "measure-area-angle", show: !0 });
|
|
@@ -4447,7 +4462,7 @@ ${m.circumference}:${u.toFixed(2)} m`,
|
|
|
4447
4462
|
semiMinorAxis: c,
|
|
4448
4463
|
height: p.height || 0,
|
|
4449
4464
|
vertexFormat: e.MaterialAppearance.VERTEX_FORMAT
|
|
4450
|
-
}), w = new e.GeometryInstance({ geometry: f }), y = t.color || e.Color.YELLOW.withAlpha(0.5),
|
|
4465
|
+
}), w = new e.GeometryInstance({ geometry: f }), y = t.color || e.Color.YELLOW.withAlpha(0.5), v = t.color && t.color.withAlpha ? t.color.withAlpha(0.25) : e.Color.RED.withAlpha(0.4);
|
|
4451
4466
|
this.ellipsePrimitive && (i.scene.primitives.remove(this.ellipsePrimitive), this.ellipsePrimitive = null), this.ellipsePrimitive = new e.Primitive({
|
|
4452
4467
|
geometryInstances: w,
|
|
4453
4468
|
appearance: new e.MaterialAppearance({
|
|
@@ -4456,17 +4471,17 @@ ${m.circumference}:${u.toFixed(2)} m`,
|
|
|
4456
4471
|
closed: !0
|
|
4457
4472
|
}),
|
|
4458
4473
|
depthFailAppearance: new e.MaterialAppearance({
|
|
4459
|
-
material: e.Material.fromType("Color", { color:
|
|
4474
|
+
material: e.Material.fromType("Color", { color: v }),
|
|
4460
4475
|
translucent: !0,
|
|
4461
4476
|
closed: !0
|
|
4462
4477
|
})
|
|
4463
4478
|
}), i.scene.primitives.add(this.ellipsePrimitive), this.entity = this.ellipsePrimitive, this.isPrimitive = !0;
|
|
4464
|
-
const b = e.Cartographic.fromCartesian(n),
|
|
4479
|
+
const b = e.Cartographic.fromCartesian(n), C = e.Math.toDegrees(b.longitude), M = e.Math.toDegrees(b.latitude), P = b.height || 0, L = this.htmlLabelId || `measure_circle_${Date.now()}`;
|
|
4465
4480
|
this.htmlLabelId = L;
|
|
4466
4481
|
const E = `${m.radius}:${c.toFixed(2)} m
|
|
4467
4482
|
${m.area}:${d.toFixed(2)} m²
|
|
4468
4483
|
${m.circumference}:${u.toFixed(2)} m`;
|
|
4469
|
-
this.htmlLabelPool.add({ text: E }, { id: L, lon:
|
|
4484
|
+
this.htmlLabelPool.add({ text: E }, { id: L, lon: C, lat: M, height: P, theme: "measure-circle", show: !0 });
|
|
4470
4485
|
const I = {
|
|
4471
4486
|
entity: this.entity,
|
|
4472
4487
|
label: this.labelEntity,
|
|
@@ -4507,20 +4522,20 @@ ${m.circumference}:${u.toFixed(2)} m`,
|
|
|
4507
4522
|
show: !1
|
|
4508
4523
|
}
|
|
4509
4524
|
});
|
|
4510
|
-
const p = e.Cartographic.fromCartesian(s), f = e.Math.toDegrees(p.longitude), w = e.Math.toDegrees(p.latitude), y = p.height || 0,
|
|
4511
|
-
this.htmlLabelId =
|
|
4525
|
+
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()}`;
|
|
4526
|
+
this.htmlLabelId = v;
|
|
4512
4527
|
const b = `${m.radius}:${l.toFixed(2)} m
|
|
4513
4528
|
${m.area}:${d.toFixed(2)} m²
|
|
4514
4529
|
${m.circumference}:${u.toFixed(2)} m`;
|
|
4515
|
-
if (this.htmlLabelPool.add({ text: b }, { id:
|
|
4516
|
-
const
|
|
4530
|
+
if (this.htmlLabelPool.add({ text: b }, { id: v, lon: f, lat: w, height: y, theme: "measure-circle", show: !0 }), !this.previewEntity) {
|
|
4531
|
+
const C = t.color || e.Color.YELLOW.withAlpha(0.5);
|
|
4517
4532
|
this.previewEntity = i.entities.add({
|
|
4518
4533
|
position: s,
|
|
4519
4534
|
ellipse: {
|
|
4520
4535
|
semiMajorAxis: new e.CallbackProperty(() => this.currentRadius, !1),
|
|
4521
4536
|
semiMinorAxis: new e.CallbackProperty(() => this.currentRadius, !1),
|
|
4522
4537
|
height: c.height || 0,
|
|
4523
|
-
material:
|
|
4538
|
+
material: C
|
|
4524
4539
|
}
|
|
4525
4540
|
});
|
|
4526
4541
|
}
|
|
@@ -4552,12 +4567,12 @@ ${m.circumference}:${u.toFixed(2)} m`;
|
|
|
4552
4567
|
depthFailAppearance: new i.MaterialAppearance({ material: i.Material.fromType("Color", { color: w }), translucent: !0, closed: !0 })
|
|
4553
4568
|
});
|
|
4554
4569
|
r.scene.primitives.add(y), this.ellipsePrimitive = y, this.entity = y, this.isPrimitive = !0;
|
|
4555
|
-
const
|
|
4570
|
+
const v = i.Cartographic.fromCartesian(n), b = t.id + "_circle";
|
|
4556
4571
|
this.htmlLabelId = b;
|
|
4557
|
-
const
|
|
4558
|
-
${
|
|
4559
|
-
${
|
|
4560
|
-
this.htmlLabelPool.add({ text: M }, { id: b, lon: i.Math.toDegrees(
|
|
4572
|
+
const C = s.labelText || { radius: "半径", area: "面积", circumference: "周长" }, M = `${C.radius}:${c.toFixed(2)} m
|
|
4573
|
+
${C.area}:${d.toFixed(2)} m²
|
|
4574
|
+
${C.circumference}:${u.toFixed(2)} m`;
|
|
4575
|
+
this.htmlLabelPool.add({ text: M }, { id: b, lon: i.Math.toDegrees(v.longitude), lat: i.Math.toDegrees(v.latitude), height: v.height || 0, theme: "measure-circle", show: !0 });
|
|
4561
4576
|
}
|
|
4562
4577
|
}
|
|
4563
4578
|
class gt {
|
|
@@ -4732,15 +4747,15 @@ class gt {
|
|
|
4732
4747
|
if (!this.htmlLabelPool) {
|
|
4733
4748
|
const w = s.overlayContainerId || "html-label-container";
|
|
4734
4749
|
this.htmlLabelPool = e || new N(i, r, w), this.htmlLabelPool.registerTheme("measure-polyline-total", {
|
|
4735
|
-
createElement: (y,
|
|
4750
|
+
createElement: (y, v) => {
|
|
4736
4751
|
var b;
|
|
4737
|
-
y.innerHTML = String(((b =
|
|
4752
|
+
y.innerHTML = String(((b = v == null ? void 0 : v.data) == null ? void 0 : b.text) || ""), y.style.background = "rgba(0,0,0,0.6)", y.style.color = "#fff", y.style.font = "14px sans-serif", y.style.padding = "4px 6px", y.style.borderRadius = "4px", y.style.whiteSpace = "pre";
|
|
4738
4753
|
},
|
|
4739
4754
|
options: { offset: { x: 0, y: -10 } }
|
|
4740
4755
|
}), this.htmlLabelPool.registerTheme("measure-polyline-seg", {
|
|
4741
|
-
createElement: (y,
|
|
4756
|
+
createElement: (y, v) => {
|
|
4742
4757
|
var b;
|
|
4743
|
-
y.innerHTML = String(((b =
|
|
4758
|
+
y.innerHTML = String(((b = v == null ? void 0 : v.data) == null ? void 0 : b.text) || ""), y.style.background = "rgba(0,0,0,0.6)", y.style.color = "#fff", y.style.font = "14px sans-serif", y.style.padding = "4px 6px", y.style.borderRadius = "4px", y.style.whiteSpace = "pre";
|
|
4744
4759
|
},
|
|
4745
4760
|
options: { offset: { x: 0, y: -10 } }
|
|
4746
4761
|
});
|
|
@@ -4752,9 +4767,9 @@ class gt {
|
|
|
4752
4767
|
this.entity = r.entities.add({ polyline: { positions: c, width: l, material: o, depthFailMaterial: new i.PolylineDashMaterialProperty({ color: n, dashLength: 12, dashPattern: 255 }) } });
|
|
4753
4768
|
let d = 0;
|
|
4754
4769
|
for (let w = 1; w < c.length; w++) {
|
|
4755
|
-
const y = i.Cartographic.fromCartesian(c[w - 1]),
|
|
4770
|
+
const y = i.Cartographic.fromCartesian(c[w - 1]), v = i.Cartographic.fromCartesian(c[w]), b = new i.EllipsoidGeodesic(y, v);
|
|
4756
4771
|
d += b.surfaceDistance;
|
|
4757
|
-
const
|
|
4772
|
+
const C = c[w - 1], M = c[w], P = new i.Cartesian3((C.x + M.x) / 2, (C.y + M.y) / 2, (C.z + M.z) / 2), L = i.Cartographic.fromCartesian(P), E = t.id + `_seg_${w - 1}`;
|
|
4758
4773
|
this.segmentLabelIds.push(E), this.htmlLabelPool.add({ text: `${b.surfaceDistance.toFixed(2)} m` }, {
|
|
4759
4774
|
id: E,
|
|
4760
4775
|
lon: i.Math.toDegrees(L.longitude),
|
|
@@ -4876,9 +4891,9 @@ class ft {
|
|
|
4876
4891
|
if (!this.htmlLabelPool) {
|
|
4877
4892
|
const w = s.overlayContainerId || "html-label-container";
|
|
4878
4893
|
this.htmlLabelPool = e || new N(i, r, w), this.htmlLabelPool.registerTheme("measure-terrainHeight", {
|
|
4879
|
-
createElement: (y,
|
|
4894
|
+
createElement: (y, v) => {
|
|
4880
4895
|
var b;
|
|
4881
|
-
y.innerHTML = String(((b =
|
|
4896
|
+
y.innerHTML = String(((b = v == null ? void 0 : v.data) == null ? void 0 : b.text) || ""), y.style.background = "rgba(0,0,0,0.6)", y.style.color = "#fff", y.style.font = "14px sans-serif", y.style.padding = "4px 6px", y.style.borderRadius = "4px", y.style.whiteSpace = "pre";
|
|
4882
4897
|
},
|
|
4883
4898
|
options: { offset: { x: 0, y: -10 } }
|
|
4884
4899
|
});
|
|
@@ -4972,8 +4987,8 @@ ${u.height}:${c.toFixed(2)} m` },
|
|
|
4972
4987
|
const f = s.overlayContainerId || "html-label-container";
|
|
4973
4988
|
this.htmlLabelPool = e || new N(i, r, f), this.htmlLabelPool.registerTheme("measure-coordinate", {
|
|
4974
4989
|
createElement: (w, y) => {
|
|
4975
|
-
var
|
|
4976
|
-
w.innerHTML = String(((
|
|
4990
|
+
var v;
|
|
4991
|
+
w.innerHTML = String(((v = y == null ? void 0 : y.data) == null ? void 0 : v.text) || ""), w.style.background = "rgba(0,0,0,0.6)", w.style.color = "#fff", w.style.font = "14px sans-serif", w.style.padding = "4px 6px", w.style.borderRadius = "4px", w.style.whiteSpace = "pre";
|
|
4977
4992
|
},
|
|
4978
4993
|
options: { offset: { x: 0, y: -10 } }
|
|
4979
4994
|
});
|
|
@@ -5073,11 +5088,11 @@ ${f.area}:${m.toFixed(2)} m²` },
|
|
|
5073
5088
|
[l[3], l[0]]
|
|
5074
5089
|
];
|
|
5075
5090
|
for (let O = 0; O < w.length; O++) {
|
|
5076
|
-
const [$, k] = w[O],
|
|
5077
|
-
this.segmentLabelIds.push(
|
|
5078
|
-
{ text: `${f.side}:${Number(
|
|
5091
|
+
const [$, k] = w[O], j = O === 0 || O === 2 ? d : u, Y = new e.Cartesian3(($.x + k.x) / 2, ($.y + k.y) / 2, ($.z + k.z) / 2), G = e.Cartographic.fromCartesian(Y), q = `measure_rectangle_seg_${Date.now()}_${O}`;
|
|
5092
|
+
this.segmentLabelIds.push(q), this.htmlLabelPool.add(
|
|
5093
|
+
{ text: `${f.side}:${Number(j).toFixed(2)} m` },
|
|
5079
5094
|
{
|
|
5080
|
-
id:
|
|
5095
|
+
id: q,
|
|
5081
5096
|
lon: e.Math.toDegrees(G.longitude),
|
|
5082
5097
|
lat: e.Math.toDegrees(G.latitude),
|
|
5083
5098
|
height: G.height || 0,
|
|
@@ -5086,14 +5101,14 @@ ${f.area}:${m.toFixed(2)} m²` },
|
|
|
5086
5101
|
}
|
|
5087
5102
|
);
|
|
5088
5103
|
}
|
|
5089
|
-
const y = this.buildSurfaceRectanglePositions(l),
|
|
5090
|
-
polygonHierarchy:
|
|
5104
|
+
const y = this.buildSurfaceRectanglePositions(l), v = new e.PolygonHierarchy(y), b = new e.PolygonGeometry({
|
|
5105
|
+
polygonHierarchy: v,
|
|
5091
5106
|
vertexFormat: e.MaterialAppearance.VERTEX_FORMAT,
|
|
5092
5107
|
perPositionHeight: !0,
|
|
5093
5108
|
arcType: e.ArcType.NONE
|
|
5094
|
-
}),
|
|
5109
|
+
}), C = new e.GeometryInstance({ geometry: b }), M = t.color || e.Color.YELLOW.withAlpha(0.4), P = t.color && t.color.withAlpha ? t.color.withAlpha(0.25) : e.Color.RED.withAlpha(0.4);
|
|
5095
5110
|
this.primitive = new e.Primitive({
|
|
5096
|
-
geometryInstances:
|
|
5111
|
+
geometryInstances: C,
|
|
5097
5112
|
appearance: new e.MaterialAppearance({
|
|
5098
5113
|
material: e.Material.fromType("Color", { color: M }),
|
|
5099
5114
|
translucent: !0,
|
|
@@ -5148,12 +5163,12 @@ ${f.area}:${m.toFixed(2)} m²` },
|
|
|
5148
5163
|
if (!s) return;
|
|
5149
5164
|
if (this.startPoint && !this.secondPoint) {
|
|
5150
5165
|
if (this.endPoint = s, !this.previewEdgeEntity) {
|
|
5151
|
-
const
|
|
5166
|
+
const v = t.lineColor || t.color || e.Color.YELLOW, b = ((y = (w = t.dashLineColor || t.lineColor || t.color || e.Color.RED).withAlpha) == null ? void 0 : y.call(w, 0.9)) || e.Color.RED;
|
|
5152
5167
|
this.previewEdgeEntity = i.entities.add({
|
|
5153
5168
|
polyline: {
|
|
5154
5169
|
positions: new e.CallbackProperty(() => !this.startPoint || !this.endPoint ? [] : [this.startPoint, this.endPoint], !1),
|
|
5155
5170
|
width: t.width || 2,
|
|
5156
|
-
material:
|
|
5171
|
+
material: v,
|
|
5157
5172
|
clampToGround: !1,
|
|
5158
5173
|
arcType: e.ArcType.NONE,
|
|
5159
5174
|
depthFailMaterial: new e.PolylineDashMaterialProperty({
|
|
@@ -5163,18 +5178,18 @@ ${f.area}:${m.toFixed(2)} m²` },
|
|
|
5163
5178
|
})
|
|
5164
5179
|
}
|
|
5165
5180
|
});
|
|
5166
|
-
const
|
|
5181
|
+
const C = t.pointColor || t.color || e.Color.YELLOW, M = i.entities.add({
|
|
5167
5182
|
position: this.startPoint,
|
|
5168
5183
|
point: {
|
|
5169
5184
|
pixelSize: 8,
|
|
5170
|
-
color:
|
|
5185
|
+
color: C,
|
|
5171
5186
|
disableDepthTestDistance: Number.POSITIVE_INFINITY
|
|
5172
5187
|
}
|
|
5173
5188
|
}), P = i.entities.add({
|
|
5174
5189
|
position: new e.CallbackProperty(() => this.endPoint || this.startPoint, !1),
|
|
5175
5190
|
point: {
|
|
5176
5191
|
pixelSize: 8,
|
|
5177
|
-
color:
|
|
5192
|
+
color: C,
|
|
5178
5193
|
disableDepthTestDistance: Number.POSITIVE_INFINITY
|
|
5179
5194
|
}
|
|
5180
5195
|
});
|
|
@@ -5203,14 +5218,14 @@ ${f.area}:${u.toFixed(2)} m²` },
|
|
|
5203
5218
|
show: !0
|
|
5204
5219
|
}
|
|
5205
5220
|
), !this.previewEntity) {
|
|
5206
|
-
const
|
|
5221
|
+
const v = t.color || e.Color.YELLOW.withAlpha(0.4);
|
|
5207
5222
|
this.previewEntity = i.entities.add({
|
|
5208
5223
|
polygon: {
|
|
5209
5224
|
hierarchy: new e.CallbackProperty(() => {
|
|
5210
5225
|
if (!(!this.startPoint || !this.secondPoint || !this.currentCorners.length))
|
|
5211
5226
|
return new e.PolygonHierarchy(this.currentCorners);
|
|
5212
5227
|
}, !1),
|
|
5213
|
-
material:
|
|
5228
|
+
material: v,
|
|
5214
5229
|
perPositionHeight: !0,
|
|
5215
5230
|
arcType: e.ArcType.NONE
|
|
5216
5231
|
}
|
|
@@ -5286,18 +5301,18 @@ ${f.area}:${m.toFixed(2)} m²` }, { id: p, lon: i.Math.toDegrees(g.longitude), l
|
|
|
5286
5301
|
const [T, D] = w[S], x = S === 0 || S === 2 ? d : u, A = new i.Cartesian3((T.x + D.x) / 2, (T.y + D.y) / 2, (T.z + D.z) / 2), O = i.Cartographic.fromCartesian(A), $ = t.id + `_rectangle_seg_${S}`;
|
|
5287
5302
|
this.segmentLabelIds.push($), this.htmlLabelPool.add({ text: `${f.side}:${Number(x).toFixed(2)} m` }, { id: $, lon: i.Math.toDegrees(O.longitude), lat: i.Math.toDegrees(O.latitude), height: O.height || 0, theme: "measure-rectangle-seg", show: !0 });
|
|
5288
5303
|
}
|
|
5289
|
-
const y = new i.PolygonHierarchy(l),
|
|
5304
|
+
const y = new i.PolygonHierarchy(l), v = new i.PolygonGeometry({
|
|
5290
5305
|
polygonHierarchy: y,
|
|
5291
5306
|
vertexFormat: i.MaterialAppearance.VERTEX_FORMAT,
|
|
5292
5307
|
perPositionHeight: !0,
|
|
5293
5308
|
arcType: i.ArcType.NONE
|
|
5294
|
-
}), b = new i.GeometryInstance({ geometry:
|
|
5309
|
+
}), b = new i.GeometryInstance({ geometry: v }), C = s.color || i.Color.YELLOW.withAlpha(0.4), M = s.color && s.color.withAlpha ? s.color.withAlpha(0.25) : i.Color.RED.withAlpha(0.4), P = new i.Primitive({
|
|
5295
5310
|
geometryInstances: b,
|
|
5296
|
-
appearance: new i.MaterialAppearance({ material: i.Material.fromType("Color", { color:
|
|
5311
|
+
appearance: new i.MaterialAppearance({ material: i.Material.fromType("Color", { color: C }), translucent: !0, closed: !0 }),
|
|
5297
5312
|
depthFailAppearance: new i.MaterialAppearance({ material: i.Material.fromType("Color", { color: M }), translucent: !0, closed: !0 })
|
|
5298
5313
|
});
|
|
5299
5314
|
this.primitive = P, r.scene.primitives.add(this.primitive);
|
|
5300
|
-
const L = s.lineColor ||
|
|
5315
|
+
const L = s.lineColor || C, E = [...l, l[0]], I = r.entities.add({
|
|
5301
5316
|
polyline: {
|
|
5302
5317
|
positions: E,
|
|
5303
5318
|
width: s.width || 2,
|
|
@@ -5307,7 +5322,7 @@ ${f.area}:${m.toFixed(2)} m²` }, { id: p, lon: i.Math.toDegrees(g.longitude), l
|
|
|
5307
5322
|
}
|
|
5308
5323
|
});
|
|
5309
5324
|
this.edgeEntities.push(I);
|
|
5310
|
-
const _ = s.pointColor ||
|
|
5325
|
+
const _ = s.pointColor || C;
|
|
5311
5326
|
for (const S of l) {
|
|
5312
5327
|
const T = r.entities.add({
|
|
5313
5328
|
position: S,
|
|
@@ -5325,9 +5340,9 @@ ${f.area}:${m.toFixed(2)} m²` }, { id: p, lon: i.Math.toDegrees(g.longitude), l
|
|
|
5325
5340
|
if (!o || o.length < 3) return null;
|
|
5326
5341
|
const n = o[0], l = o[1], c = o[2], d = l.x - n.x, u = l.y - n.y, m = Math.sqrt(d * d + u * u);
|
|
5327
5342
|
if (!m) return null;
|
|
5328
|
-
const g = d / m, f = -(u / m), w = g, y = c.x - l.x,
|
|
5343
|
+
const g = d / m, f = -(u / m), w = g, y = c.x - l.x, v = c.y - l.y, b = y * f + v * w;
|
|
5329
5344
|
if (!b) return null;
|
|
5330
|
-
const
|
|
5345
|
+
const C = new r.Cartesian2(l.x + f * b, l.y + w * b), M = new r.Cartesian2(n.x + f * b, n.y + w * b), P = s.projectPointsOntoEllipsoid([n, l, C, M]);
|
|
5331
5346
|
if (!P || P.length < 4) return null;
|
|
5332
5347
|
const L = P, E = L[0], I = L[2], _ = Math.abs(m), S = Math.abs(b), T = new r.Cartesian3(
|
|
5333
5348
|
(E.x + I.x) / 2,
|
|
@@ -5343,7 +5358,7 @@ ${f.area}:${m.toFixed(2)} m²` }, { id: p, lon: i.Math.toDegrees(g.longitude), l
|
|
|
5343
5358
|
return { corners: L, center: T, width: _, height: S, area: O };
|
|
5344
5359
|
}
|
|
5345
5360
|
}
|
|
5346
|
-
class
|
|
5361
|
+
class vt {
|
|
5347
5362
|
constructor(t, e) {
|
|
5348
5363
|
h(this, "Cesium");
|
|
5349
5364
|
h(this, "viewer");
|
|
@@ -5395,7 +5410,7 @@ class Ct {
|
|
|
5395
5410
|
vertexFormat: e.MaterialAppearance.VERTEX_FORMAT,
|
|
5396
5411
|
perPositionHeight: !0,
|
|
5397
5412
|
arcType: e.ArcType.NONE
|
|
5398
|
-
}), w = new e.GeometryInstance({ geometry: f }), y = t.color || e.Color.YELLOW.withAlpha(0.4),
|
|
5413
|
+
}), w = new e.GeometryInstance({ geometry: f }), y = t.color || e.Color.YELLOW.withAlpha(0.4), v = t.color && t.color.withAlpha ? t.color.withAlpha(0.25) : e.Color.RED.withAlpha(0.4);
|
|
5399
5414
|
this.primitive = new e.Primitive({
|
|
5400
5415
|
geometryInstances: w,
|
|
5401
5416
|
appearance: new e.MaterialAppearance({
|
|
@@ -5404,12 +5419,12 @@ class Ct {
|
|
|
5404
5419
|
closed: !0
|
|
5405
5420
|
}),
|
|
5406
5421
|
depthFailAppearance: new e.MaterialAppearance({
|
|
5407
|
-
material: e.Material.fromType("Color", { color:
|
|
5422
|
+
material: e.Material.fromType("Color", { color: v }),
|
|
5408
5423
|
translucent: !0,
|
|
5409
5424
|
closed: !0
|
|
5410
5425
|
})
|
|
5411
5426
|
}), i.scene.primitives.add(this.primitive);
|
|
5412
|
-
const b = t.lineColor || y,
|
|
5427
|
+
const b = t.lineColor || y, C = ((l = (n = t.dashLineColor || t.lineColor || t.color || e.Color.RED).withAlpha) == null ? void 0 : l.call(n, 0.9)) || e.Color.RED, M = g.slice(), P = i.entities.add({
|
|
5413
5428
|
polyline: {
|
|
5414
5429
|
positions: M,
|
|
5415
5430
|
width: t.width || 2,
|
|
@@ -5417,7 +5432,7 @@ class Ct {
|
|
|
5417
5432
|
clampToGround: !1,
|
|
5418
5433
|
arcType: e.ArcType.NONE,
|
|
5419
5434
|
depthFailMaterial: new e.PolylineDashMaterialProperty({
|
|
5420
|
-
color:
|
|
5435
|
+
color: C,
|
|
5421
5436
|
dashLength: 12,
|
|
5422
5437
|
dashPattern: 255
|
|
5423
5438
|
})
|
|
@@ -5442,16 +5457,16 @@ class Ct {
|
|
|
5442
5457
|
this.previewLabelId && this.htmlLabelPool && (this.htmlLabelPool.removeByIds([this.previewLabelId]), this.previewLabelId = null);
|
|
5443
5458
|
let D = 0;
|
|
5444
5459
|
for (let A = 1; A < g.length; A++) {
|
|
5445
|
-
const O = g[A - 1], $ = g[A], k = e.Cartographic.fromCartesian(O),
|
|
5460
|
+
const O = g[A - 1], $ = g[A], k = e.Cartographic.fromCartesian(O), j = e.Cartographic.fromCartesian($), G = new e.EllipsoidGeodesic(k, j).surfaceDistance;
|
|
5446
5461
|
D += G;
|
|
5447
|
-
const
|
|
5448
|
-
this.segmentLabelIds.push(
|
|
5462
|
+
const q = new e.Cartesian3((O.x + $.x) / 2, (O.y + $.y) / 2, (O.z + $.z) / 2), X = e.Cartographic.fromCartesian(q), se = `measure_regular_seg_${Date.now()}_${A - 1}`;
|
|
5463
|
+
this.segmentLabelIds.push(se), this.htmlLabelPool.add(
|
|
5449
5464
|
{ text: `${T.side}:${G.toFixed(2)} m` },
|
|
5450
5465
|
{
|
|
5451
|
-
id:
|
|
5452
|
-
lon: e.Math.toDegrees(
|
|
5453
|
-
lat: e.Math.toDegrees(
|
|
5454
|
-
height:
|
|
5466
|
+
id: se,
|
|
5467
|
+
lon: e.Math.toDegrees(X.longitude),
|
|
5468
|
+
lat: e.Math.toDegrees(X.latitude),
|
|
5469
|
+
height: X.height || 0,
|
|
5455
5470
|
theme: "measure-regular-seg",
|
|
5456
5471
|
show: !0
|
|
5457
5472
|
}
|
|
@@ -5502,12 +5517,12 @@ ${T.area}:${I.toFixed(2)} m²` },
|
|
|
5502
5517
|
arcType: e.ArcType.NONE
|
|
5503
5518
|
}
|
|
5504
5519
|
});
|
|
5505
|
-
const
|
|
5520
|
+
const v = t.lineColor || t.color || e.Color.YELLOW, b = ((w = (f = t.dashLineColor || t.lineColor || t.color || e.Color.RED).withAlpha) == null ? void 0 : w.call(f, 0.9)) || e.Color.RED;
|
|
5506
5521
|
this.previewEdgeEntity = i.entities.add({
|
|
5507
5522
|
polyline: {
|
|
5508
5523
|
positions: new e.CallbackProperty(() => !this.currentPoints || this.currentPoints.length === 0 ? [] : this.currentPoints.slice(), !1),
|
|
5509
5524
|
width: t.width || 2,
|
|
5510
|
-
material:
|
|
5525
|
+
material: v,
|
|
5511
5526
|
clampToGround: !1,
|
|
5512
5527
|
arcType: e.ArcType.NONE,
|
|
5513
5528
|
depthFailMaterial: new e.PolylineDashMaterialProperty({
|
|
@@ -5517,18 +5532,18 @@ ${T.area}:${I.toFixed(2)} m²` },
|
|
|
5517
5532
|
})
|
|
5518
5533
|
}
|
|
5519
5534
|
});
|
|
5520
|
-
const
|
|
5535
|
+
const C = t.pointColor || t.color || e.Color.YELLOW, M = i.entities.add({
|
|
5521
5536
|
position: o,
|
|
5522
5537
|
point: {
|
|
5523
5538
|
pixelSize: 8,
|
|
5524
|
-
color:
|
|
5539
|
+
color: C,
|
|
5525
5540
|
disableDepthTestDistance: Number.POSITIVE_INFINITY
|
|
5526
5541
|
}
|
|
5527
5542
|
}), P = i.entities.add({
|
|
5528
5543
|
position: new e.CallbackProperty(() => l || o, !1),
|
|
5529
5544
|
point: {
|
|
5530
5545
|
pixelSize: 8,
|
|
5531
|
-
color:
|
|
5546
|
+
color: C,
|
|
5532
5547
|
disableDepthTestDistance: Number.POSITIVE_INFINITY
|
|
5533
5548
|
}
|
|
5534
5549
|
});
|
|
@@ -5536,7 +5551,7 @@ ${T.area}:${I.toFixed(2)} m²` },
|
|
|
5536
5551
|
}
|
|
5537
5552
|
let d = 0;
|
|
5538
5553
|
for (let y = 1; y < this.currentPoints.length; y++) {
|
|
5539
|
-
const
|
|
5554
|
+
const v = this.currentPoints[y - 1], b = this.currentPoints[y], C = e.Cartographic.fromCartesian(v), M = e.Cartographic.fromCartesian(b), P = new e.EllipsoidGeodesic(C, M);
|
|
5540
5555
|
d += P.surfaceDistance;
|
|
5541
5556
|
}
|
|
5542
5557
|
const u = this.computeAreaByPlane(this.currentPoints), m = e.Cartographic.fromCartesian(o), g = this.previewLabelId || "measure_regular_preview";
|
|
@@ -5623,20 +5638,20 @@ ${p.area}:${u.toFixed(2)} m²` },
|
|
|
5623
5638
|
}
|
|
5624
5639
|
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 }) });
|
|
5625
5640
|
r.scene.primitives.add(w), this.primitive = w;
|
|
5626
|
-
const y = this.computeAreaByPlane(l),
|
|
5641
|
+
const y = this.computeAreaByPlane(l), v = i.Cartographic.fromCartesian(c), b = t.id + "_regular";
|
|
5627
5642
|
this.htmlLabelId = b;
|
|
5628
|
-
const
|
|
5643
|
+
const C = s.labelText || { sides: "边数", radius: "半径", circumference: "周长", area: "面积", side: "边长" };
|
|
5629
5644
|
let M = 0;
|
|
5630
5645
|
for (let L = 1; L < l.length; L++) {
|
|
5631
5646
|
const E = l[L - 1], I = l[L], _ = i.Cartographic.fromCartesian(E), S = i.Cartographic.fromCartesian(I), D = new i.EllipsoidGeodesic(_, S).surfaceDistance;
|
|
5632
5647
|
M += D;
|
|
5633
5648
|
const x = new i.Cartesian3((E.x + I.x) / 2, (E.y + I.y) / 2, (E.z + I.z) / 2), A = i.Cartographic.fromCartesian(x), O = t.id + `_regular_seg_${L - 1}`;
|
|
5634
|
-
this.segmentLabelIds.push(O), this.htmlLabelPool.add({ text: `${
|
|
5649
|
+
this.segmentLabelIds.push(O), this.htmlLabelPool.add({ text: `${C.side}:${D.toFixed(2)} m` }, { id: O, lon: i.Math.toDegrees(A.longitude), lat: i.Math.toDegrees(A.latitude), height: A.height || 0, theme: "measure-regular-seg", show: !0 });
|
|
5635
5650
|
}
|
|
5636
|
-
this.htmlLabelPool.add({ text: `${
|
|
5637
|
-
${
|
|
5638
|
-
${
|
|
5639
|
-
${
|
|
5651
|
+
this.htmlLabelPool.add({ text: `${C.sides}:${Math.max(o, 3)}
|
|
5652
|
+
${C.radius}:${d.toFixed(2)} m
|
|
5653
|
+
${C.circumference}:${M.toFixed(2)} m
|
|
5654
|
+
${C.area}:${y.toFixed(2)} m²` }, { id: b, lon: i.Math.toDegrees(v.longitude), lat: i.Math.toDegrees(v.latitude), height: v.height || 0, theme: "measure-regular", show: !0 });
|
|
5640
5655
|
}
|
|
5641
5656
|
buildRegularPolygonPoints(t, e, i) {
|
|
5642
5657
|
const r = this.Cesium, s = new r.EllipsoidTangentPlane(t, r.Ellipsoid.WGS84), o = 2 * Math.PI / i, n = [];
|
|
@@ -5708,7 +5723,7 @@ class $r {
|
|
|
5708
5723
|
i = new wt(this.Cesium, this.viewer);
|
|
5709
5724
|
break;
|
|
5710
5725
|
case "regularPolygon":
|
|
5711
|
-
i = new
|
|
5726
|
+
i = new vt(this.Cesium, this.viewer);
|
|
5712
5727
|
break;
|
|
5713
5728
|
default:
|
|
5714
5729
|
throw new Error(`Unsupported measurement type: ${t}`);
|
|
@@ -5830,7 +5845,7 @@ class $r {
|
|
|
5830
5845
|
s = new wt(this.Cesium, this.viewer);
|
|
5831
5846
|
break;
|
|
5832
5847
|
case "regularPolygon":
|
|
5833
|
-
s = new
|
|
5848
|
+
s = new vt(this.Cesium, this.viewer);
|
|
5834
5849
|
break;
|
|
5835
5850
|
default:
|
|
5836
5851
|
s = null;
|
|
@@ -6250,7 +6265,7 @@ export {
|
|
|
6250
6265
|
wr as EditMode,
|
|
6251
6266
|
Dr as EntityLayerManager,
|
|
6252
6267
|
Mr as GLTFManage,
|
|
6253
|
-
|
|
6268
|
+
vr as GLTFManageEventKey,
|
|
6254
6269
|
ht as HorizontalMeasure,
|
|
6255
6270
|
N as HtmlOverlayLabelPool,
|
|
6256
6271
|
zt as MarkerEventBus,
|
|
@@ -6261,7 +6276,7 @@ export {
|
|
|
6261
6276
|
gt as PolylineDistanceMeasure,
|
|
6262
6277
|
Ar as PrimitiveManager,
|
|
6263
6278
|
wt as RectangleMeasure,
|
|
6264
|
-
|
|
6279
|
+
vt as RegularPolygonMeasure,
|
|
6265
6280
|
pt as SpaceMeasure,
|
|
6266
6281
|
ft as TerrainHeightMeasure,
|
|
6267
6282
|
ze as TooltipManager,
|