leiting-bim 2.2.70 → 2.2.71
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/package.json +1 -1
- package/plugins/cesium-core/dist/cesium-core.mjs +599 -530
- package/plugins/cesium-core/dist/cesium-core.umd.js +25 -25
- package/plugins/cesium-core/dist/components/BufferedHierarchicalAggregator.d.ts +14 -0
- package/plugins/cesium-core/dist/components/HtmlOverlayLabelPool.d.ts +4 -0
|
@@ -40,21 +40,28 @@ class _o {
|
|
|
40
40
|
c(this, "_cameraDirty", !1);
|
|
41
41
|
c(this, "_tileLoadListener", null);
|
|
42
42
|
c(this, "_cameraChangedHandler", null);
|
|
43
|
+
c(this, "_globeAvailabilityHandler", null);
|
|
44
|
+
/** Globe 关闭时使用逐点标签的显式降级状态。 */
|
|
45
|
+
c(this, "aggregationFallbackActive", !1);
|
|
46
|
+
c(this, "fallbackLabelIds", /* @__PURE__ */ new Set());
|
|
43
47
|
// 默认显示的地图层级区间(兼容旧数据)
|
|
44
48
|
c(this, "defaultMinLevel", 0);
|
|
45
49
|
c(this, "defaultMaxLevel", 28);
|
|
46
50
|
// 单次从视图层级向下细分到聚合层级时,最多细分的层级数
|
|
47
51
|
c(this, "maxRefineLevels", 2);
|
|
52
|
+
var a, l;
|
|
48
53
|
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.debugHeightBounds = i.debugHeightBounds ?? !1, this.debugCurrentGrids = i.debugCurrentGrids ?? this.debugHeightBounds, this.clusterTheme = i.clusterTheme ?? "cluster-label", this.pointTheme = i.pointTheme ?? "point-label", this.centralPointMode = i.centralPointMode ?? "central", this.minGlobalPointCount = i.minGlobalPointCount ?? 0, this.groupByTheme = i.groupByTheme ?? !1, this.terrainLevelOffset = i.terrainLevelOffset ?? 2, this.heightCandidateNeighborRing = Math.max(
|
|
49
54
|
0,
|
|
50
55
|
Math.floor(i.heightCandidateNeighborRing ?? 1)
|
|
51
56
|
), this.heightBoxRetentionEnabled = i.heightBoxRetentionEnabled ?? !0;
|
|
52
57
|
const n = this.viewer.scene && this.viewer.scene.globe, s = n && n._surface, o = s && s._tileProvider, r = (o == null ? void 0 : o.tilingScheme) || new this.Cesium.GeographicTilingScheme();
|
|
53
|
-
this._lastTileProvider = o, this.tilingScheme = r, this.levels = this._createLevels(), this._buildLevels(), this._updateFn = this._update.bind(this), this.debugCurrentGrids && this._ensureDebugImageryLayer(), n && (this._tileLoadListener = (
|
|
54
|
-
|
|
58
|
+
this._lastTileProvider = o, this.tilingScheme = r, this.levels = this._createLevels(), this._buildLevels(), this._updateFn = this._update.bind(this), this.debugCurrentGrids && this._ensureDebugImageryLayer(), n && (this._tileLoadListener = (d) => {
|
|
59
|
+
d === 0 && this._cameraDirty && (this._cameraDirty = !1, this._scheduleUpdate());
|
|
55
60
|
}, n.tileLoadProgressEvent.addEventListener(this._tileLoadListener)), this._cameraChangedHandler = () => {
|
|
56
61
|
this._update();
|
|
57
|
-
}, this.viewer.camera.changed.addEventListener(this._cameraChangedHandler), this.
|
|
62
|
+
}, this.viewer.camera.changed.addEventListener(this._cameraChangedHandler), this._globeAvailabilityHandler = () => {
|
|
63
|
+
this._isAggregationFallbackRequired() !== this.aggregationFallbackActive && this._update();
|
|
64
|
+
}, (l = (a = this.viewer.scene) == null ? void 0 : a.preRender) == null || l.addEventListener(this._globeAvailabilityHandler), this._exposeDebugInstance();
|
|
58
65
|
}
|
|
59
66
|
/** 临时调试入口:供浏览器控制台直接查看和操纵当前聚合器实例。 */
|
|
60
67
|
_exposeDebugInstance() {
|
|
@@ -149,20 +156,20 @@ class _o {
|
|
|
149
156
|
new this.Cesium.Cartesian2()
|
|
150
157
|
);
|
|
151
158
|
if (!l) continue;
|
|
152
|
-
const d = `${l.x}_${l.y}`,
|
|
153
|
-
if (
|
|
154
|
-
const g =
|
|
155
|
-
if (g !== -1 &&
|
|
156
|
-
const
|
|
157
|
-
|
|
159
|
+
const d = `${l.x}_${l.y}`, p = r.get(d);
|
|
160
|
+
if (p) {
|
|
161
|
+
const g = p.allPoints.findIndex((m) => m.id === t.id);
|
|
162
|
+
if (g !== -1 && p.allPoints.splice(g, 1), this._shouldSkipAggregation(i.data)) {
|
|
163
|
+
const m = p.skipPoints.findIndex((u) => u.id === t.id);
|
|
164
|
+
m !== -1 && p.skipPoints.splice(m, 1);
|
|
158
165
|
} else {
|
|
159
|
-
const
|
|
160
|
-
if (
|
|
161
|
-
const f =
|
|
162
|
-
f !== -1 &&
|
|
166
|
+
const m = this.groupByTheme ? this._getBillboardTheme(i.data) : this.clusterTheme, u = p.groups.get(m);
|
|
167
|
+
if (u) {
|
|
168
|
+
const f = u.findIndex((y) => y.id === t.id);
|
|
169
|
+
f !== -1 && u.splice(f, 1), u.length === 0 && p.groups.delete(m);
|
|
163
170
|
}
|
|
164
171
|
}
|
|
165
|
-
|
|
172
|
+
p.heightRangeDirty = !0;
|
|
166
173
|
}
|
|
167
174
|
}
|
|
168
175
|
const n = { ...i, ...t };
|
|
@@ -240,7 +247,11 @@ class _o {
|
|
|
240
247
|
}
|
|
241
248
|
_update() {
|
|
242
249
|
if (!this.labelPool) return;
|
|
243
|
-
|
|
250
|
+
if (this._isAggregationFallbackRequired()) {
|
|
251
|
+
this._updateWithoutAggregation();
|
|
252
|
+
return;
|
|
253
|
+
}
|
|
254
|
+
this._clearAggregationFallbackLabels(), this._syncTilingSchemeAndLevels(), this.labelPool.beginUpdate(), this.debugCurrentGrids && (this._ensureDebugImageryLayer(), this._clearDebugGrids());
|
|
244
255
|
const t = this.points.length < this.minGlobalPointCount ? 1 / 0 : this.threshold;
|
|
245
256
|
let e = 0;
|
|
246
257
|
const i = /* @__PURE__ */ new Map(), n = (s, o, r, a) => {
|
|
@@ -276,6 +287,45 @@ class _o {
|
|
|
276
287
|
if (e)
|
|
277
288
|
return e._tilesToRender || e._tilesToRenderByTextureCount;
|
|
278
289
|
}
|
|
290
|
+
/** 聚合视域依赖 Globe 地表瓦片;关闭 Globe 时必须绕开其私有 tile 状态。 */
|
|
291
|
+
_isAggregationFallbackRequired() {
|
|
292
|
+
var e, i;
|
|
293
|
+
const t = (i = (e = this.viewer) == null ? void 0 : e.scene) == null ? void 0 : i.globe;
|
|
294
|
+
return !t || t.show === !1;
|
|
295
|
+
}
|
|
296
|
+
/**
|
|
297
|
+
* Globe 关闭时不聚合、不读取 _tilesToRender,改为逐点展示。
|
|
298
|
+
* 逐点标签禁用遮挡检测:没有 Globe 时 scene.pickPosition 会返回空值,若继续
|
|
299
|
+
* 执行遮挡检测会把所有标签误判成被遮挡。
|
|
300
|
+
*/
|
|
301
|
+
_updateWithoutAggregation() {
|
|
302
|
+
var n;
|
|
303
|
+
this.heightRetainedCells.clear(), this._tilesRetryCount = 0, this.labelPool.beginUpdate(), this.debugCurrentGrids && (this._clearDebugGrids(), this._removeDebugImageryLayer());
|
|
304
|
+
const t = this.fallbackLabelIds;
|
|
305
|
+
this.fallbackLabelIds = /* @__PURE__ */ new Set();
|
|
306
|
+
let e = 0;
|
|
307
|
+
for (const s of this.points) {
|
|
308
|
+
if (((n = s.data) == null ? void 0 : n.show) === !1 || e >= this.displayLimit) continue;
|
|
309
|
+
const o = `point-${s.id}`;
|
|
310
|
+
this.labelPool.add(s.data, {
|
|
311
|
+
id: o,
|
|
312
|
+
lon: s.lon,
|
|
313
|
+
lat: s.lat,
|
|
314
|
+
height: s.height,
|
|
315
|
+
theme: this._getBillboardTheme(s.data) || this.pointTheme,
|
|
316
|
+
style: s.style,
|
|
317
|
+
skipOcclusion: !0
|
|
318
|
+
}), this.fallbackLabelIds.add(o), e++;
|
|
319
|
+
}
|
|
320
|
+
const i = Array.from(t).filter(
|
|
321
|
+
(s) => !this.fallbackLabelIds.has(s)
|
|
322
|
+
);
|
|
323
|
+
i.length && this.labelPool.removeByIds(i), this.labelPool.cleanup(), this.aggregationFallbackActive = !0;
|
|
324
|
+
}
|
|
325
|
+
/** Globe 恢复后释放降级标签,让格网聚合重新接管。 */
|
|
326
|
+
_clearAggregationFallbackLabels() {
|
|
327
|
+
!this.aggregationFallbackActive && this.fallbackLabelIds.size === 0 || (this.fallbackLabelIds.size && (this.labelPool.removeByIds(Array.from(this.fallbackLabelIds)), this.fallbackLabelIds.clear()), this.aggregationFallbackActive = !1);
|
|
328
|
+
}
|
|
279
329
|
_handleNoSurfaceTiles(t) {
|
|
280
330
|
var e;
|
|
281
331
|
for (const i of this.points) {
|
|
@@ -361,18 +411,18 @@ class _o {
|
|
|
361
411
|
* [minHeight, maxHeight] 构造 OBB,再同时进行视锥和椭球遮挡判断。
|
|
362
412
|
*/
|
|
363
413
|
_isHeightBoxVisible(t, e, i, n, s) {
|
|
364
|
-
var d,
|
|
414
|
+
var d, p, g, m, u, f, y, w, v;
|
|
365
415
|
const o = this.levels[t], r = o && ((d = this.gridLayers.get(o.level)) == null ? void 0 : d.get(`${e}_${i}`));
|
|
366
416
|
if (!o || !r || r.allPoints.length === 0) return !1;
|
|
367
417
|
const { minHeight: a, maxHeight: l } = this._getCellHeightRange(r);
|
|
368
418
|
if (a === 0 && l === 0) return !1;
|
|
369
419
|
try {
|
|
370
|
-
const P = this.tilingScheme.tileXYToRectangle(e, i, o.level), b = (y = (
|
|
371
|
-
|
|
420
|
+
const P = this.tilingScheme.tileXYToRectangle(e, i, o.level), b = (y = (p = this.Cesium.OrientedBoundingBox) == null ? void 0 : p.fromRectangle) == null ? void 0 : y.call(
|
|
421
|
+
p,
|
|
372
422
|
P,
|
|
373
423
|
a,
|
|
374
424
|
l,
|
|
375
|
-
((
|
|
425
|
+
((u = (m = (g = this.viewer) == null ? void 0 : g.scene) == null ? void 0 : m.globe) == null ? void 0 : u.ellipsoid) || ((f = this.Cesium.Ellipsoid) == null ? void 0 : f.WGS84)
|
|
376
426
|
);
|
|
377
427
|
if (!b) return !0;
|
|
378
428
|
const C = n || this._createCameraCullingVolume();
|
|
@@ -402,42 +452,42 @@ class _o {
|
|
|
402
452
|
* 因此不会因简单邻域扩展而显示真实离屏的点。
|
|
403
453
|
*/
|
|
404
454
|
_appendHeightVisibleCells(t) {
|
|
405
|
-
var l, d,
|
|
455
|
+
var l, d, p, g;
|
|
406
456
|
if (!this.heightBoxRetentionEnabled) {
|
|
407
457
|
this.heightRetainedCells.clear();
|
|
408
458
|
return;
|
|
409
459
|
}
|
|
410
460
|
const e = this._createCameraCullingVolume(), i = this._createGlobeOccluder(), n = [], s = /* @__PURE__ */ new Set(), o = Array.from(t.values());
|
|
411
|
-
for (const [
|
|
412
|
-
if (t.has(
|
|
413
|
-
this.heightRetainedCells.delete(
|
|
461
|
+
for (const [m, u] of Array.from(this.heightRetainedCells.entries())) {
|
|
462
|
+
if (t.has(m)) {
|
|
463
|
+
this.heightRetainedCells.delete(m);
|
|
414
464
|
continue;
|
|
415
465
|
}
|
|
416
466
|
if (o.some(
|
|
417
|
-
(y) => y.levelIdx !==
|
|
467
|
+
(y) => y.levelIdx !== u.levelIdx && this._doCellsOverlap(u, y)
|
|
418
468
|
) || !this._isHeightBoxVisible(
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
469
|
+
u.levelIdx,
|
|
470
|
+
u.lonIdx,
|
|
471
|
+
u.latIdx,
|
|
422
472
|
e,
|
|
423
473
|
i
|
|
424
474
|
)) {
|
|
425
|
-
this.heightRetainedCells.delete(
|
|
475
|
+
this.heightRetainedCells.delete(m);
|
|
426
476
|
continue;
|
|
427
477
|
}
|
|
428
|
-
t.set(
|
|
478
|
+
t.set(m, u);
|
|
429
479
|
}
|
|
430
480
|
if (this.heightCandidateNeighborRing <= 0) return;
|
|
431
481
|
const r = /* @__PURE__ */ new Map();
|
|
432
|
-
for (const
|
|
433
|
-
const
|
|
434
|
-
|
|
482
|
+
for (const m of o) {
|
|
483
|
+
const u = r.get(m.levelIdx) || [];
|
|
484
|
+
u.push(m), r.set(m.levelIdx, u);
|
|
435
485
|
}
|
|
436
|
-
for (const [
|
|
437
|
-
const f = this.levels[
|
|
486
|
+
for (const [m, u] of r) {
|
|
487
|
+
const f = this.levels[m], y = f && this.gridLayers.get(f.level), w = f && ((d = (l = this.tilingScheme).getNumberOfXTilesAtLevel) == null ? void 0 : d.call(l, f.level)), v = f && ((g = (p = this.tilingScheme).getNumberOfYTilesAtLevel) == null ? void 0 : g.call(p, f.level));
|
|
438
488
|
if (!y || !Number.isFinite(w) || !Number.isFinite(v)) continue;
|
|
439
|
-
const P = new Set(
|
|
440
|
-
let b =
|
|
489
|
+
const P = new Set(u.map((C) => `${C.lonIdx}_${C.latIdx}`));
|
|
490
|
+
let b = u.map((C) => ({ ...C }));
|
|
441
491
|
for (let C = 1; C <= this.heightCandidateNeighborRing; C++) {
|
|
442
492
|
const L = /* @__PURE__ */ new Map();
|
|
443
493
|
for (const E of b)
|
|
@@ -452,61 +502,61 @@ class _o {
|
|
|
452
502
|
const S = { ...E, lonIdx: D, latIdx: I };
|
|
453
503
|
L.set(T, S);
|
|
454
504
|
const _ = `${f.level}_${D}_${I}`;
|
|
455
|
-
t.has(_) || s.has(_) || y.get(T) && this._isHeightBoxVisible(
|
|
505
|
+
t.has(_) || s.has(_) || y.get(T) && this._isHeightBoxVisible(m, D, I, e, i) && (n.push(S), s.add(_));
|
|
456
506
|
}
|
|
457
507
|
b = Array.from(L.values());
|
|
458
508
|
}
|
|
459
509
|
}
|
|
460
|
-
n.sort((
|
|
510
|
+
n.sort((m, u) => u.levelIdx - m.levelIdx);
|
|
461
511
|
const a = [];
|
|
462
|
-
for (const
|
|
463
|
-
const
|
|
464
|
-
(v) => v.levelIdx !==
|
|
512
|
+
for (const m of n) {
|
|
513
|
+
const u = Array.from(t.values()).some(
|
|
514
|
+
(v) => v.levelIdx !== m.levelIdx && this._doCellsOverlap(m, v)
|
|
465
515
|
), f = a.some(
|
|
466
|
-
(v) => v.levelIdx !==
|
|
516
|
+
(v) => v.levelIdx !== m.levelIdx && this._doCellsOverlap(m, v)
|
|
467
517
|
);
|
|
468
|
-
if (
|
|
469
|
-
a.push(
|
|
470
|
-
const w = `${this.levels[
|
|
471
|
-
t.set(w,
|
|
518
|
+
if (u || f) continue;
|
|
519
|
+
a.push(m);
|
|
520
|
+
const w = `${this.levels[m.levelIdx].level}_${m.lonIdx}_${m.latIdx}`;
|
|
521
|
+
t.set(w, m), this.heightRetainedCells.set(w, m);
|
|
472
522
|
}
|
|
473
523
|
}
|
|
474
524
|
_processTiles(t, e) {
|
|
475
|
-
const i = /* @__PURE__ */ new Set(), n = !this._isTerrainEnabled(), s = this.viewer.scene, o = s && s.globe, r = o && o.ellipsoid, a = r && s.camera.computeViewRectangle(r), l = (d,
|
|
525
|
+
const i = /* @__PURE__ */ new Set(), n = !this._isTerrainEnabled(), s = this.viewer.scene, o = s && s.globe, r = o && o.ellipsoid, a = r && s.camera.computeViewRectangle(r), l = (d, p, g) => {
|
|
476
526
|
if (!n || !a) return !0;
|
|
477
|
-
const
|
|
478
|
-
return !(!
|
|
527
|
+
const m = this.tilingScheme.tileXYToRectangle(d, p, g);
|
|
528
|
+
return !(!m || m.east <= a.west || m.west >= a.east || m.north <= a.south || m.south >= a.north);
|
|
479
529
|
};
|
|
480
530
|
for (const d of t) {
|
|
481
|
-
const
|
|
482
|
-
if (!
|
|
483
|
-
const
|
|
484
|
-
if (
|
|
485
|
-
const f = this.levels[
|
|
531
|
+
const p = d.rectangle, g = d._level ?? d.level;
|
|
532
|
+
if (!p || typeof g != "number") continue;
|
|
533
|
+
const m = this._getGridRefLevel(g), u = this._resolveLevelIndex(m);
|
|
534
|
+
if (u === void 0) continue;
|
|
535
|
+
const f = this.levels[u].level, y = d._x ?? d.x, w = d._y ?? d.y;
|
|
486
536
|
if (typeof y == "number" && typeof w == "number") {
|
|
487
537
|
const T = g - f;
|
|
488
538
|
if (T >= 0) {
|
|
489
539
|
const S = 1 << T, _ = Math.floor(y / S), k = Math.floor(w / S), A = `${f}_${_}_${k}`;
|
|
490
540
|
if (i.has(A)) continue;
|
|
491
|
-
i.add(A), e(
|
|
541
|
+
i.add(A), e(u, _, k, g);
|
|
492
542
|
} else {
|
|
493
543
|
const _ = 1 << Math.min(-T, this.maxRefineLevels), k = y * _, A = w * _;
|
|
494
544
|
for (let R = 0; R < _; R++)
|
|
495
|
-
for (let
|
|
496
|
-
const B = k + R, Y = A +
|
|
545
|
+
for (let $ = 0; $ < _; $++) {
|
|
546
|
+
const B = k + R, Y = A + $;
|
|
497
547
|
if (!l(B, Y, f)) continue;
|
|
498
548
|
const N = `${f}_${B}_${Y}`;
|
|
499
|
-
i.has(N) || (i.add(N), e(
|
|
549
|
+
i.has(N) || (i.add(N), e(u, B, Y, g));
|
|
500
550
|
}
|
|
501
551
|
}
|
|
502
552
|
continue;
|
|
503
553
|
}
|
|
504
|
-
const P = this.levels[
|
|
554
|
+
const P = this.levels[u].size, b = this.Cesium.Math.toDegrees(p.west), C = this.Cesium.Math.toDegrees(p.east), L = this.Cesium.Math.toDegrees(p.south), E = this.Cesium.Math.toDegrees(p.north), M = Math.floor((b - -180) / P), x = Math.floor((C - -180) / P), I = Math.floor((L - -90) / P), D = Math.floor((E - -90) / P);
|
|
505
555
|
for (let T = M; T <= x; T++)
|
|
506
556
|
for (let S = I; S <= D; S++) {
|
|
507
557
|
if (!l(T, S, f)) continue;
|
|
508
558
|
const _ = `${f}_${T}_${S}`;
|
|
509
|
-
i.has(_) || (i.add(_), e(
|
|
559
|
+
i.has(_) || (i.add(_), e(u, T, S, g));
|
|
510
560
|
}
|
|
511
561
|
}
|
|
512
562
|
}
|
|
@@ -521,7 +571,7 @@ class _o {
|
|
|
521
571
|
if (!r) return null;
|
|
522
572
|
const a = `${e}_${i}`, l = r.get(a);
|
|
523
573
|
if (!l) return null;
|
|
524
|
-
const d = this.tilingScheme.tileXYToRectangle(e, i, o),
|
|
574
|
+
const d = this.tilingScheme.tileXYToRectangle(e, i, o), p = this.Cesium.Math.toDegrees(d.west), g = this.Cesium.Math.toDegrees(d.south), m = this.Cesium.Math.toDegrees(d.east), u = this.Cesium.Math.toDegrees(d.north), f = (p + m) / 2, y = (g + u) / 2;
|
|
525
575
|
return {
|
|
526
576
|
levelIdx: t,
|
|
527
577
|
tileLevel: o,
|
|
@@ -530,10 +580,10 @@ class _o {
|
|
|
530
580
|
key: a,
|
|
531
581
|
cell: l,
|
|
532
582
|
rect: d,
|
|
533
|
-
west:
|
|
583
|
+
west: p,
|
|
534
584
|
south: g,
|
|
535
|
-
east:
|
|
536
|
-
north:
|
|
585
|
+
east: m,
|
|
586
|
+
north: u,
|
|
537
587
|
centerLon: f,
|
|
538
588
|
centerLat: y,
|
|
539
589
|
viewTileLevel: n
|
|
@@ -557,7 +607,7 @@ class _o {
|
|
|
557
607
|
return e;
|
|
558
608
|
}
|
|
559
609
|
_processCellGroups(t, e, i) {
|
|
560
|
-
var g,
|
|
610
|
+
var g, m, u, f, y, w, v;
|
|
561
611
|
const {
|
|
562
612
|
levelIdx: n,
|
|
563
613
|
lonIdx: s,
|
|
@@ -566,7 +616,7 @@ class _o {
|
|
|
566
616
|
centerLon: a,
|
|
567
617
|
centerLat: l,
|
|
568
618
|
viewTileLevel: d
|
|
569
|
-
} = t,
|
|
619
|
+
} = t, p = d;
|
|
570
620
|
for (const [P, b] of r.groups) {
|
|
571
621
|
const C = b.filter((I) => {
|
|
572
622
|
var D;
|
|
@@ -574,10 +624,10 @@ class _o {
|
|
|
574
624
|
});
|
|
575
625
|
if (C.length === 0) continue;
|
|
576
626
|
let L = a, E = l, M = ((g = C[0]) == null ? void 0 : g.height) || 0;
|
|
577
|
-
if (this.centralPointMode == "firstPoint" && (L = ((
|
|
627
|
+
if (this.centralPointMode == "firstPoint" && (L = ((m = C[0]) == null ? void 0 : m.lon) || 0, E = ((u = C[0]) == null ? void 0 : u.lat) || 0, M = ((f = C[0]) == null ? void 0 : f.height) || 0), n === this.levels.length - 1 || C.length < e)
|
|
578
628
|
for (const I of C) {
|
|
579
629
|
if (i >= this.displayLimit) break;
|
|
580
|
-
this._isVisibleAtLevel(I,
|
|
630
|
+
this._isVisibleAtLevel(I, p) && (this.labelPool.add(I.data, {
|
|
581
631
|
id: `point-${I.id}`,
|
|
582
632
|
lon: I.lon,
|
|
583
633
|
lat: I.lat,
|
|
@@ -589,7 +639,7 @@ class _o {
|
|
|
589
639
|
else {
|
|
590
640
|
if (i >= this.displayLimit)
|
|
591
641
|
return i;
|
|
592
|
-
const I =
|
|
642
|
+
const I = p == null ? C : C.filter((_) => this._isVisibleAtLevel(_, p));
|
|
593
643
|
if (!I.length) return i;
|
|
594
644
|
const T = this._getBillboardTheme((y = I[0]) == null ? void 0 : y.data) || this.clusterTheme, S = this.groupByTheme ? `cluster-${n}-${s}-${o}-${P}` : `cluster-${n}-${s}-${o}`;
|
|
595
645
|
this.labelPool.add(
|
|
@@ -615,7 +665,7 @@ class _o {
|
|
|
615
665
|
}
|
|
616
666
|
_debugDrawCell(t) {
|
|
617
667
|
if (!this.debugCurrentGrids) return;
|
|
618
|
-
const { levelIdx: e, west: i, south: n, east: s, north: o, lonIdx: r, latIdx: a, cell: l } = t, d = this.levels[e].level,
|
|
668
|
+
const { levelIdx: e, west: i, south: n, east: s, north: o, lonIdx: r, latIdx: a, cell: l } = t, d = this.levels[e].level, p = this.heightRetainedCells.has(
|
|
619
669
|
`${d}_${r}_${a}`
|
|
620
670
|
);
|
|
621
671
|
this._drawDebugGrid(
|
|
@@ -625,7 +675,7 @@ class _o {
|
|
|
625
675
|
o,
|
|
626
676
|
`L:${d} X:${r} Y:${a}`,
|
|
627
677
|
l,
|
|
628
|
-
|
|
678
|
+
p
|
|
629
679
|
);
|
|
630
680
|
}
|
|
631
681
|
refresh() {
|
|
@@ -678,13 +728,13 @@ class _o {
|
|
|
678
728
|
* 便于确认“地表离屏但高程标记仍可见”的候选格网是否被正确选中。
|
|
679
729
|
*/
|
|
680
730
|
_drawDebugHeightBounds(t, e, i, n, s, o, r) {
|
|
681
|
-
var
|
|
682
|
-
const { minHeight: a, maxHeight: l } = this._getCellHeightRange(o), d = this.Cesium.Rectangle.fromDegrees(t, e, i, n),
|
|
731
|
+
var m, u, f, y, w, v;
|
|
732
|
+
const { minHeight: a, maxHeight: l } = this._getCellHeightRange(o), d = this.Cesium.Rectangle.fromDegrees(t, e, i, n), p = ((f = (u = (m = this.viewer) == null ? void 0 : m.scene) == null ? void 0 : u.globe) == null ? void 0 : f.ellipsoid) || ((y = this.Cesium.Ellipsoid) == null ? void 0 : y.WGS84), g = (v = (w = this.Cesium.OrientedBoundingBox) == null ? void 0 : w.fromRectangle) == null ? void 0 : v.call(
|
|
683
733
|
w,
|
|
684
734
|
d,
|
|
685
735
|
a,
|
|
686
736
|
l,
|
|
687
|
-
|
|
737
|
+
p
|
|
688
738
|
);
|
|
689
739
|
if (g)
|
|
690
740
|
try {
|
|
@@ -728,7 +778,7 @@ class _o {
|
|
|
728
778
|
g.center,
|
|
729
779
|
C,
|
|
730
780
|
new this.Cesium.Cartesian3()
|
|
731
|
-
),
|
|
781
|
+
), $ = this.viewer.entities.add({
|
|
732
782
|
position: R,
|
|
733
783
|
label: {
|
|
734
784
|
text: `${s}
|
|
@@ -745,7 +795,7 @@ H: ${a.toFixed(1)} ~ ${l.toFixed(1)}m`,
|
|
|
745
795
|
disableDepthTestDistance: Number.POSITIVE_INFINITY
|
|
746
796
|
}
|
|
747
797
|
});
|
|
748
|
-
this.debugGrids.push(
|
|
798
|
+
this.debugGrids.push($);
|
|
749
799
|
} catch {
|
|
750
800
|
}
|
|
751
801
|
}
|
|
@@ -773,9 +823,12 @@ H: ${a.toFixed(1)} ~ ${l.toFixed(1)}m`,
|
|
|
773
823
|
}
|
|
774
824
|
}
|
|
775
825
|
destroy() {
|
|
826
|
+
var i;
|
|
776
827
|
this._cameraChangedHandler && (this.viewer.camera.changed.removeEventListener(this._cameraChangedHandler), this._cameraChangedHandler = null);
|
|
777
|
-
const t = this.viewer.scene
|
|
778
|
-
|
|
828
|
+
const t = this.viewer.scene;
|
|
829
|
+
t && this._globeAvailabilityHandler && ((i = t.preRender) == null || i.removeEventListener(this._globeAvailabilityHandler), this._globeAvailabilityHandler = null);
|
|
830
|
+
const e = t && t.globe;
|
|
831
|
+
e && this._tileLoadListener && (e.tileLoadProgressEvent.removeEventListener(this._tileLoadListener), this._tileLoadListener = null), this._updateTimer !== null && (clearTimeout(this._updateTimer), this._updateTimer = null), this.labelPool.reset(), this.heightRetainedCells.clear(), this.fallbackLabelIds.clear(), this._clearDebugGrids(), this._removeDebugImageryLayer(), typeof window < "u" && window.__cesiumBufferedHierarchicalAggregator === this && delete window.__cesiumBufferedHierarchicalAggregator;
|
|
779
832
|
}
|
|
780
833
|
}
|
|
781
834
|
var te = /* @__PURE__ */ ((h) => (h.Click = "marker:click", h.DoubleClick = "marker:dblclick", h.RightClick = "marker:rightclick", h.MouseEnter = "marker:mouseenter", h.MouseLeave = "marker:mouseleave", h.MouseDown = "marker:mousedown", h.MouseUp = "marker:mouseup", h))(te || {});
|
|
@@ -931,59 +984,69 @@ class G {
|
|
|
931
984
|
show: a = !0,
|
|
932
985
|
notCreateElement: l = !1,
|
|
933
986
|
persistent: d = !1,
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
987
|
+
skipOcclusion: p = !1,
|
|
988
|
+
style: g
|
|
989
|
+
} = e, m = this.themes[r];
|
|
990
|
+
if (!m) {
|
|
937
991
|
console.warn(`Theme "${r}" not registered`);
|
|
938
992
|
return;
|
|
939
993
|
}
|
|
940
|
-
let
|
|
941
|
-
if (
|
|
942
|
-
const
|
|
943
|
-
if (
|
|
994
|
+
let u = this.labels.get(i);
|
|
995
|
+
if (u) {
|
|
996
|
+
const f = u.theme !== r || u.data !== t || u.notCreateElement !== l || !u.el.parentNode;
|
|
997
|
+
if (u.theme = r, u.data = t, u.notCreateElement = l, u.persistent = d, u.skipOcclusion = p, f)
|
|
944
998
|
try {
|
|
945
|
-
typeof
|
|
946
|
-
} catch (
|
|
947
|
-
console.error(`Error updating label element for id "${i}":`,
|
|
999
|
+
typeof u.unload == "function" && u.unload(), u.el.replaceChildren(), u.unload = m.createElement(u.el, { id: i, theme: r, data: t }, m) || {};
|
|
1000
|
+
} catch (y) {
|
|
1001
|
+
console.error(`Error updating label element for id "${i}":`, y);
|
|
948
1002
|
}
|
|
949
|
-
(!l || a) &&
|
|
1003
|
+
(!l || a) && u.el.parentNode !== this.container && this.container.appendChild(u.el);
|
|
950
1004
|
} else {
|
|
951
|
-
const
|
|
952
|
-
Object.assign(
|
|
1005
|
+
const f = document.createElement("div");
|
|
1006
|
+
Object.assign(f.style, {
|
|
953
1007
|
position: "absolute",
|
|
954
1008
|
transform: "translate(0, 0)",
|
|
955
1009
|
pointerEvents: "auto",
|
|
956
1010
|
...e.style || {}
|
|
957
1011
|
});
|
|
958
|
-
for (const [
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
const
|
|
962
|
-
this.eventBus.runListener(
|
|
1012
|
+
for (const [w, v] of Object.entries(Yt)) {
|
|
1013
|
+
f.addEventListener(v, (b) => {
|
|
1014
|
+
b.stopPropagation();
|
|
1015
|
+
const C = this.labels.get(i);
|
|
1016
|
+
this.eventBus.runListener(w, C, b);
|
|
963
1017
|
});
|
|
964
|
-
let
|
|
965
|
-
|
|
1018
|
+
let P = 0;
|
|
1019
|
+
f.addEventListener("wheel", (b) => {
|
|
966
1020
|
if (!this.openWheel) return;
|
|
967
|
-
const
|
|
968
|
-
|
|
969
|
-
const
|
|
970
|
-
|
|
971
|
-
|
|
1021
|
+
const C = b.currentTarget;
|
|
1022
|
+
P = Date.now();
|
|
1023
|
+
const L = P;
|
|
1024
|
+
C.style.pointerEvents = "none", setTimeout(() => {
|
|
1025
|
+
P === L && (C.style.pointerEvents = "auto");
|
|
972
1026
|
}, 2e3);
|
|
973
1027
|
});
|
|
974
1028
|
}
|
|
975
|
-
let
|
|
1029
|
+
let y = null;
|
|
976
1030
|
if (!l || a) {
|
|
977
1031
|
try {
|
|
978
|
-
|
|
979
|
-
} catch (
|
|
980
|
-
console.error(`Error updating label element for id "${i}":`,
|
|
1032
|
+
y = m.createElement(f, { id: i, theme: r, data: t }, m) || {};
|
|
1033
|
+
} catch (w) {
|
|
1034
|
+
console.error(`Error updating label element for id "${i}":`, w);
|
|
981
1035
|
}
|
|
982
|
-
this.container.appendChild(
|
|
1036
|
+
this.container.appendChild(f);
|
|
983
1037
|
}
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
1038
|
+
u = {
|
|
1039
|
+
id: i,
|
|
1040
|
+
el: f,
|
|
1041
|
+
theme: r,
|
|
1042
|
+
data: t,
|
|
1043
|
+
notCreateElement: l,
|
|
1044
|
+
persistent: d,
|
|
1045
|
+
skipOcclusion: p,
|
|
1046
|
+
unload: y
|
|
1047
|
+
}, this.labels.set(i, u);
|
|
1048
|
+
}
|
|
1049
|
+
u.el.dataset.lon = String(n), u.el.dataset.lat = String(s), u.el.dataset.height = String(o), u.offset = e.offset, u.anchor = e.anchor || "top-left", Object.assign(u.el.style, e.style || {}), u.el.style.zIndex = (g == null ? void 0 : g.zIndex) || "1", u.el.style.display = a ? "block" : "none", a && this.activeIds.add(i), a ? (p && this.occludedIds.delete(i), this._scheduleOcclusionCheck()) : (this.activeIds.delete(i), this.occludedIds.delete(i));
|
|
987
1050
|
}
|
|
988
1051
|
/**
|
|
989
1052
|
* 批量添加标签
|
|
@@ -1175,10 +1238,10 @@ class G {
|
|
|
1175
1238
|
}
|
|
1176
1239
|
const r = this.Cesium.Cartesian3.fromDegrees(n, s, o), a = this.toWindowCoordinates(r);
|
|
1177
1240
|
if (this.Cesium.defined(a)) {
|
|
1178
|
-
const l = this.themes[i.theme], d = i.offset || ((t = l.options) == null ? void 0 : t.offset) || {},
|
|
1241
|
+
const l = this.themes[i.theme], d = i.offset || ((t = l.options) == null ? void 0 : t.offset) || {}, p = d.x || 0, g = d.y || 0, m = this.occludedIds.has(e);
|
|
1179
1242
|
i.el.style.left = `${a.x}px`, i.el.style.top = `${a.y}px`;
|
|
1180
|
-
const
|
|
1181
|
-
i.el.style.transform = `${
|
|
1243
|
+
const u = this.getAnchorTransform(i.anchor);
|
|
1244
|
+
i.el.style.transform = `${u}${u ? " " : ""}translate(${p}px, ${g}px)`, i.el.style.display = m ? "none" : "block";
|
|
1182
1245
|
} else
|
|
1183
1246
|
i.el.style.display = "none";
|
|
1184
1247
|
}
|
|
@@ -1198,8 +1261,8 @@ class G {
|
|
|
1198
1261
|
this.occlusionLogEnabled && (this.occlusionCheckLogs.push(t), this.occlusionCheckLogs.length > this.occlusionLogMax && this.occlusionCheckLogs.splice(0, this.occlusionCheckLogs.length - this.occlusionLogMax));
|
|
1199
1262
|
}
|
|
1200
1263
|
_computeLabelOccluded(t, e, i, n, s, o) {
|
|
1201
|
-
var d,
|
|
1202
|
-
const r = (d = this.viewer) == null ? void 0 : d.scene, a = (
|
|
1264
|
+
var d, p;
|
|
1265
|
+
const r = (d = this.viewer) == null ? void 0 : d.scene, a = (p = this.viewer) == null ? void 0 : p.camera, l = this.Cesium;
|
|
1203
1266
|
if (!r || !a || !l)
|
|
1204
1267
|
return this._pushOcclusionLog({
|
|
1205
1268
|
timestamp: Date.now(),
|
|
@@ -1232,7 +1295,7 @@ class G {
|
|
|
1232
1295
|
occluded: !0,
|
|
1233
1296
|
reason: "pick-empty"
|
|
1234
1297
|
}), !0;
|
|
1235
|
-
const
|
|
1298
|
+
const m = Number(this.occlusionOptions.distanceEpsilon) || 0, u = l.Cartesian3.distance(a.positionWC, e), f = l.Cartesian3.distance(a.positionWC, g), y = f + m < u;
|
|
1236
1299
|
return this._pushOcclusionLog({
|
|
1237
1300
|
timestamp: Date.now(),
|
|
1238
1301
|
id: t,
|
|
@@ -1241,8 +1304,8 @@ class G {
|
|
|
1241
1304
|
height: o,
|
|
1242
1305
|
occluded: y,
|
|
1243
1306
|
reason: "distance-compare",
|
|
1244
|
-
epsilon:
|
|
1245
|
-
labelDistance:
|
|
1307
|
+
epsilon: m,
|
|
1308
|
+
labelDistance: u,
|
|
1246
1309
|
pickedDistance: f
|
|
1247
1310
|
}), y;
|
|
1248
1311
|
} catch {
|
|
@@ -1279,6 +1342,10 @@ class G {
|
|
|
1279
1342
|
});
|
|
1280
1343
|
continue;
|
|
1281
1344
|
}
|
|
1345
|
+
if (e.skipOcclusion) {
|
|
1346
|
+
this.occludedIds.delete(t);
|
|
1347
|
+
continue;
|
|
1348
|
+
}
|
|
1282
1349
|
const i = parseFloat(e.el.dataset.lon), n = parseFloat(e.el.dataset.lat), s = parseFloat(e.el.dataset.height || "0");
|
|
1283
1350
|
if (!this._isValidCoordinate(i, n)) {
|
|
1284
1351
|
this.occludedIds.delete(t), this._pushOcclusionLog({
|
|
@@ -1367,7 +1434,7 @@ class Wt {
|
|
|
1367
1434
|
startDrawing(t) {
|
|
1368
1435
|
const { Cesium: e, viewer: i } = this;
|
|
1369
1436
|
this.tooltip = new ce(), this.tooltip.show("左键添加点"), this.handler = new e.ScreenSpaceEventHandler(i.canvas), this.handler.setInputAction((n) => {
|
|
1370
|
-
var g,
|
|
1437
|
+
var g, m;
|
|
1371
1438
|
const s = i.scene.pickPosition(n.position);
|
|
1372
1439
|
if (!s) return;
|
|
1373
1440
|
const o = e.Cartographic.fromCartesian(s), r = e.Math.toDegrees(o.longitude), a = e.Math.toDegrees(o.latitude), l = o.height, d = i.entities.add({
|
|
@@ -1379,7 +1446,7 @@ class Wt {
|
|
|
1379
1446
|
}
|
|
1380
1447
|
});
|
|
1381
1448
|
this.entity = d;
|
|
1382
|
-
const
|
|
1449
|
+
const p = {
|
|
1383
1450
|
entity: d,
|
|
1384
1451
|
position: s,
|
|
1385
1452
|
lnglat: { lng: r, lat: a, height: l },
|
|
@@ -1387,7 +1454,7 @@ class Wt {
|
|
|
1387
1454
|
this.clear();
|
|
1388
1455
|
}
|
|
1389
1456
|
};
|
|
1390
|
-
(g = t.onComplete) == null || g.call(t,
|
|
1457
|
+
(g = t.onComplete) == null || g.call(t, p), this.stopDrawing(), (m = this.tooltip) == null || m.hide(), this.tooltip = null;
|
|
1391
1458
|
}, e.ScreenSpaceEventType.LEFT_CLICK);
|
|
1392
1459
|
}
|
|
1393
1460
|
stopDrawing() {
|
|
@@ -1538,8 +1605,8 @@ class Kt {
|
|
|
1538
1605
|
coordinates: new e.CallbackProperty(() => {
|
|
1539
1606
|
if (!(!this.startPoint || !this.endPoint))
|
|
1540
1607
|
try {
|
|
1541
|
-
const r = e.Cartographic.fromCartesian(this.startPoint), a = e.Cartographic.fromCartesian(this.endPoint), l = Math.min(r.longitude, a.longitude), d = Math.max(r.longitude, a.longitude),
|
|
1542
|
-
return new e.Rectangle(l,
|
|
1608
|
+
const r = e.Cartographic.fromCartesian(this.startPoint), a = e.Cartographic.fromCartesian(this.endPoint), l = Math.min(r.longitude, a.longitude), d = Math.max(r.longitude, a.longitude), p = Math.min(r.latitude, a.latitude), g = Math.max(r.latitude, a.latitude);
|
|
1609
|
+
return new e.Rectangle(l, p, d, g);
|
|
1543
1610
|
} catch (r) {
|
|
1544
1611
|
console.warn("Rectangle calculation error:", r);
|
|
1545
1612
|
return;
|
|
@@ -1561,7 +1628,7 @@ class Kt {
|
|
|
1561
1628
|
lng: e.Math.toDegrees(Math.max(r.longitude, a.longitude)),
|
|
1562
1629
|
lat: e.Math.toDegrees(Math.max(r.latitude, a.latitude)),
|
|
1563
1630
|
height: 0
|
|
1564
|
-
},
|
|
1631
|
+
}, p = {
|
|
1565
1632
|
entity: this.entity,
|
|
1566
1633
|
position: this.startPoint,
|
|
1567
1634
|
lnglat: {
|
|
@@ -1575,7 +1642,7 @@ class Kt {
|
|
|
1575
1642
|
this.clear();
|
|
1576
1643
|
}
|
|
1577
1644
|
};
|
|
1578
|
-
(o = t.onComplete) == null || o.call(t,
|
|
1645
|
+
(o = t.onComplete) == null || o.call(t, p);
|
|
1579
1646
|
}
|
|
1580
1647
|
}, e.ScreenSpaceEventType.LEFT_CLICK), this.handler.setInputAction((n) => {
|
|
1581
1648
|
if (!this.startPoint) return;
|
|
@@ -1634,22 +1701,22 @@ class Xt {
|
|
|
1634
1701
|
}
|
|
1635
1702
|
}
|
|
1636
1703
|
drawFinalCircle(t) {
|
|
1637
|
-
var
|
|
1704
|
+
var p;
|
|
1638
1705
|
const [e, i] = this.positions, n = this.Cesium.Cartesian3.distance(e, i), s = this.Cesium.Cartographic.fromCartesian(e), o = {
|
|
1639
1706
|
lng: this.Cesium.Math.toDegrees(s.longitude),
|
|
1640
1707
|
lat: this.Cesium.Math.toDegrees(s.latitude),
|
|
1641
1708
|
height: s.height
|
|
1642
1709
|
}, r = (t == null ? void 0 : t.step) || 1, a = [], l = [];
|
|
1643
1710
|
for (let g = 0; g < 360; g += r) {
|
|
1644
|
-
const
|
|
1645
|
-
|
|
1711
|
+
const m = this.Cesium.Math.toRadians(g), u = new this.Cesium.EllipsoidGeodesic();
|
|
1712
|
+
u.setEndPoints(
|
|
1646
1713
|
s,
|
|
1647
1714
|
new this.Cesium.Cartographic(
|
|
1648
|
-
s.longitude + 1e-4 * Math.cos(
|
|
1649
|
-
s.latitude + 1e-4 * Math.sin(
|
|
1715
|
+
s.longitude + 1e-4 * Math.cos(m),
|
|
1716
|
+
s.latitude + 1e-4 * Math.sin(m)
|
|
1650
1717
|
)
|
|
1651
1718
|
);
|
|
1652
|
-
const f =
|
|
1719
|
+
const f = u.interpolateUsingSurfaceDistance(n), y = this.Cesium.Ellipsoid.WGS84.cartographicToCartesian(f);
|
|
1653
1720
|
a.push(y);
|
|
1654
1721
|
const w = this.Cesium.Cartographic.fromCartesian(y);
|
|
1655
1722
|
l.push({
|
|
@@ -1660,14 +1727,14 @@ class Xt {
|
|
|
1660
1727
|
}
|
|
1661
1728
|
l.push(l[0]);
|
|
1662
1729
|
const d = this.positions.map((g) => {
|
|
1663
|
-
const
|
|
1730
|
+
const m = this.Cesium.Cartographic.fromCartesian(g);
|
|
1664
1731
|
return {
|
|
1665
|
-
lng: this.Cesium.Math.toDegrees(
|
|
1666
|
-
lat: this.Cesium.Math.toDegrees(
|
|
1667
|
-
height:
|
|
1732
|
+
lng: this.Cesium.Math.toDegrees(m.longitude),
|
|
1733
|
+
lat: this.Cesium.Math.toDegrees(m.latitude),
|
|
1734
|
+
height: m.height
|
|
1668
1735
|
};
|
|
1669
1736
|
});
|
|
1670
|
-
(
|
|
1737
|
+
(p = t.onComplete) == null || p.call(t, {
|
|
1671
1738
|
entity: this.entity,
|
|
1672
1739
|
positions: this.positions,
|
|
1673
1740
|
lnglats: d,
|
|
@@ -1726,12 +1793,12 @@ class qt {
|
|
|
1726
1793
|
const s = i.pick(t), o = this.isHelperPick(s);
|
|
1727
1794
|
try {
|
|
1728
1795
|
i.pickPositionSupported && (n = o ? this.withHiddenHelpers(() => i.pickPosition(t)) : i.pickPosition(t));
|
|
1729
|
-
} catch (
|
|
1730
|
-
console.warn("[PolygonDrawer] pickPosition failed:",
|
|
1796
|
+
} catch (p) {
|
|
1797
|
+
console.warn("[PolygonDrawer] pickPosition failed:", p);
|
|
1731
1798
|
}
|
|
1732
1799
|
if (!n) {
|
|
1733
|
-
const
|
|
1734
|
-
|
|
1800
|
+
const p = (a = (r = e.camera) == null ? void 0 : r.getPickRay) == null ? void 0 : a.call(r, t);
|
|
1801
|
+
p && (n = ((d = (l = i.globe) == null ? void 0 : l.pick) == null ? void 0 : d.call(l, p, i)) || null);
|
|
1735
1802
|
}
|
|
1736
1803
|
return n;
|
|
1737
1804
|
}
|
|
@@ -1987,14 +2054,14 @@ function Ri(h, t) {
|
|
|
1987
2054
|
i[e] = t(e);
|
|
1988
2055
|
return i;
|
|
1989
2056
|
}
|
|
1990
|
-
var
|
|
2057
|
+
var Hi = "[object Arguments]";
|
|
1991
2058
|
function Je(h) {
|
|
1992
|
-
return Ie(h) && xe(h) ==
|
|
2059
|
+
return Ie(h) && xe(h) == Hi;
|
|
1993
2060
|
}
|
|
1994
|
-
var _t = Object.prototype,
|
|
2061
|
+
var _t = Object.prototype, $i = _t.hasOwnProperty, Oi = _t.propertyIsEnumerable, Fi = Je(/* @__PURE__ */ (function() {
|
|
1995
2062
|
return arguments;
|
|
1996
2063
|
})()) ? Je : function(h) {
|
|
1997
|
-
return Ie(h) &&
|
|
2064
|
+
return Ie(h) && $i.call(h, "callee") && !Oi.call(h, "callee");
|
|
1998
2065
|
};
|
|
1999
2066
|
function Ni() {
|
|
2000
2067
|
return !1;
|
|
@@ -2092,13 +2159,13 @@ function Fe(h, t) {
|
|
|
2092
2159
|
return e;
|
|
2093
2160
|
return -1;
|
|
2094
2161
|
}
|
|
2095
|
-
var
|
|
2162
|
+
var Hs = Array.prototype, $s = Hs.splice;
|
|
2096
2163
|
function Os(h) {
|
|
2097
2164
|
var t = this.__data__, e = Fe(t, h);
|
|
2098
2165
|
if (e < 0)
|
|
2099
2166
|
return !1;
|
|
2100
2167
|
var i = t.length - 1;
|
|
2101
|
-
return e == i ? t.pop() :
|
|
2168
|
+
return e == i ? t.pop() : $s.call(t, e, 1), --this.size, !0;
|
|
2102
2169
|
}
|
|
2103
2170
|
function Fs(h) {
|
|
2104
2171
|
var t = this.__data__, e = Fe(t, h);
|
|
@@ -2276,7 +2343,7 @@ function En(h, t) {
|
|
|
2276
2343
|
var e = Ue(h.buffer);
|
|
2277
2344
|
return new h.constructor(e, h.byteOffset, h.length);
|
|
2278
2345
|
}
|
|
2279
|
-
var Mn = "[object Boolean]", xn = "[object Date]", In = "[object Map]", Tn = "[object Number]", _n = "[object RegExp]", Dn = "[object Set]", Sn = "[object String]", An = "[object Symbol]", kn = "[object ArrayBuffer]", Rn = "[object DataView]",
|
|
2346
|
+
var Mn = "[object Boolean]", xn = "[object Date]", In = "[object Map]", Tn = "[object Number]", _n = "[object RegExp]", Dn = "[object Set]", Sn = "[object String]", An = "[object Symbol]", kn = "[object ArrayBuffer]", Rn = "[object DataView]", Hn = "[object Float32Array]", $n = "[object Float64Array]", On = "[object Int8Array]", Fn = "[object Int16Array]", Nn = "[object Int32Array]", zn = "[object Uint8Array]", Gn = "[object Uint8ClampedArray]", Bn = "[object Uint16Array]", Yn = "[object Uint32Array]";
|
|
2280
2347
|
function Vn(h, t, e) {
|
|
2281
2348
|
var i = h.constructor;
|
|
2282
2349
|
switch (t) {
|
|
@@ -2287,8 +2354,8 @@ function Vn(h, t, e) {
|
|
|
2287
2354
|
return new i(+h);
|
|
2288
2355
|
case Rn:
|
|
2289
2356
|
return Cn(h);
|
|
2290
|
-
case $n:
|
|
2291
2357
|
case Hn:
|
|
2358
|
+
case $n:
|
|
2292
2359
|
case On:
|
|
2293
2360
|
case Fn:
|
|
2294
2361
|
case Nn:
|
|
@@ -2321,9 +2388,9 @@ var pt = ye && ye.isMap, Kn = pt ? We(pt) : Un, Xn = "[object Set]";
|
|
|
2321
2388
|
function qn(h) {
|
|
2322
2389
|
return Ie(h) && re(h) == Xn;
|
|
2323
2390
|
}
|
|
2324
|
-
var mt = ye && ye.isSet, Zn = mt ? We(mt) : qn,
|
|
2325
|
-
O[
|
|
2326
|
-
O[to] = O[
|
|
2391
|
+
var mt = ye && ye.isSet, Zn = mt ? We(mt) : qn, Ht = "[object Arguments]", Jn = "[object Array]", Qn = "[object Boolean]", eo = "[object Date]", to = "[object Error]", $t = "[object Function]", io = "[object GeneratorFunction]", so = "[object Map]", no = "[object Number]", Ot = "[object Object]", oo = "[object RegExp]", ro = "[object Set]", ao = "[object String]", lo = "[object Symbol]", ho = "[object WeakMap]", co = "[object ArrayBuffer]", uo = "[object DataView]", po = "[object Float32Array]", mo = "[object Float64Array]", go = "[object Int8Array]", fo = "[object Int16Array]", yo = "[object Int32Array]", wo = "[object Uint8Array]", vo = "[object Uint8ClampedArray]", Co = "[object Uint16Array]", bo = "[object Uint32Array]", O = {};
|
|
2392
|
+
O[Ht] = O[Jn] = O[co] = O[uo] = O[Qn] = O[eo] = O[po] = O[mo] = O[go] = O[fo] = O[yo] = O[so] = O[no] = O[Ot] = O[oo] = O[ro] = O[ao] = O[lo] = O[wo] = O[vo] = O[Co] = O[bo] = !0;
|
|
2393
|
+
O[to] = O[$t] = O[ho] = !1;
|
|
2327
2394
|
function De(h, t, e, i, n, s) {
|
|
2328
2395
|
var o;
|
|
2329
2396
|
if (o !== void 0)
|
|
@@ -2334,10 +2401,10 @@ function De(h, t, e, i, n, s) {
|
|
|
2334
2401
|
if (r)
|
|
2335
2402
|
o = vn(h);
|
|
2336
2403
|
else {
|
|
2337
|
-
var a = re(h), l = a ==
|
|
2404
|
+
var a = re(h), l = a == $t || a == io;
|
|
2338
2405
|
if (St(h))
|
|
2339
2406
|
return sn(h);
|
|
2340
|
-
if (a == Ot || a ==
|
|
2407
|
+
if (a == Ot || a == Ht || l && !n)
|
|
2341
2408
|
o = l ? {} : jn(h);
|
|
2342
2409
|
else {
|
|
2343
2410
|
if (!O[a])
|
|
@@ -2349,14 +2416,14 @@ function De(h, t, e, i, n, s) {
|
|
|
2349
2416
|
var d = s.get(h);
|
|
2350
2417
|
if (d)
|
|
2351
2418
|
return d;
|
|
2352
|
-
s.set(h, o), Zn(h) ? h.forEach(function(
|
|
2353
|
-
o.add(De(
|
|
2354
|
-
}) : Kn(h) && h.forEach(function(
|
|
2355
|
-
o.set(
|
|
2419
|
+
s.set(h, o), Zn(h) ? h.forEach(function(m) {
|
|
2420
|
+
o.add(De(m, t, e, m, h, s));
|
|
2421
|
+
}) : Kn(h) && h.forEach(function(m, u) {
|
|
2422
|
+
o.set(u, De(m, t, e, u, h, s));
|
|
2356
2423
|
});
|
|
2357
|
-
var
|
|
2358
|
-
return Li(g || h, function(
|
|
2359
|
-
g && (
|
|
2424
|
+
var p = cn, g = r ? void 0 : p(h);
|
|
2425
|
+
return Li(g || h, function(m, u) {
|
|
2426
|
+
g && (u = m, m = h[u]), Di(o, u, De(m, t, e, u, h, s));
|
|
2360
2427
|
}), o;
|
|
2361
2428
|
}
|
|
2362
2429
|
var Po = 1, Lo = 4;
|
|
@@ -2466,21 +2533,21 @@ class So {
|
|
|
2466
2533
|
* @return {*}
|
|
2467
2534
|
*/
|
|
2468
2535
|
async add(t, e = !0) {
|
|
2469
|
-
var
|
|
2470
|
-
const i = this.viewer, n = this.Cesium, s = n.Math.toRadians(((
|
|
2536
|
+
var m, u, f, y, w;
|
|
2537
|
+
const i = this.viewer, n = this.Cesium, s = n.Math.toRadians(((m = t.headingPitchRoll) == null ? void 0 : m.heading) || 0), o = n.Math.toRadians(((u = t.headingPitchRoll) == null ? void 0 : u.pitch) || 0), r = n.Math.toRadians(((f = t.headingPitchRoll) == null ? void 0 : f.roll) || 0), a = new n.HeadingPitchRoll(s, o, r);
|
|
2471
2538
|
let l = t.position;
|
|
2472
2539
|
if (Le(l) ? l = n.Cartesian3.fromDegrees(l[0], l[1], l[2] || 0) : l && typeof l == "object" && typeof l.lng < "u" && typeof l.lat < "u" && (l = n.Cartesian3.fromDegrees(l.lng, l.lat, l.height || 0)), !l)
|
|
2473
2540
|
throw new Error("GLTFManage.add 缺少有效 position");
|
|
2474
|
-
const d = this.composeModelMatrix(l, a, t.scale),
|
|
2541
|
+
const d = this.composeModelMatrix(l, a, t.scale), p = {
|
|
2475
2542
|
id: t.id,
|
|
2476
2543
|
...t.model,
|
|
2477
2544
|
modelMatrix: d
|
|
2478
2545
|
};
|
|
2479
2546
|
let g;
|
|
2480
2547
|
if (typeof ((y = n == null ? void 0 : n.Model) == null ? void 0 : y.fromGltf) == "function")
|
|
2481
|
-
g = i.scene.primitives.add(n.Model.fromGltf(
|
|
2548
|
+
g = i.scene.primitives.add(n.Model.fromGltf(p));
|
|
2482
2549
|
else if (typeof ((w = n == null ? void 0 : n.Model) == null ? void 0 : w.fromGltfAsync) == "function") {
|
|
2483
|
-
const v = await n.Model.fromGltfAsync(
|
|
2550
|
+
const v = await n.Model.fromGltfAsync(p);
|
|
2484
2551
|
g = i.scene.primitives.add(v);
|
|
2485
2552
|
} else
|
|
2486
2553
|
throw new Error("Cesium.Model.fromGltf / fromGltfAsync 均不可用");
|
|
@@ -2710,17 +2777,17 @@ class So {
|
|
|
2710
2777
|
n.Matrix4.fromScale(l),
|
|
2711
2778
|
new n.Matrix4()
|
|
2712
2779
|
);
|
|
2713
|
-
const
|
|
2780
|
+
const p = this.getPrimitiveScale(t), g = this.getPrimitiveRuntimeRadius(t), m = this.getPrimitiveEffectiveRadius(t);
|
|
2714
2781
|
return this.debugLog("applyScaleToPrimitive", {
|
|
2715
2782
|
id: t == null ? void 0 : t.id,
|
|
2716
2783
|
inputScale: e,
|
|
2717
2784
|
unitRadius: a,
|
|
2718
2785
|
beforeScale: s,
|
|
2719
|
-
afterScale:
|
|
2786
|
+
afterScale: p,
|
|
2720
2787
|
beforeRadius: o,
|
|
2721
2788
|
afterRadius: g,
|
|
2722
2789
|
beforeEffectiveRadius: r,
|
|
2723
|
-
afterEffectiveRadius:
|
|
2790
|
+
afterEffectiveRadius: m
|
|
2724
2791
|
}), t.modelMatrix;
|
|
2725
2792
|
}
|
|
2726
2793
|
getGizmoModelMatrix(t) {
|
|
@@ -2804,9 +2871,9 @@ class So {
|
|
|
2804
2871
|
*/
|
|
2805
2872
|
initEditBox(t) {
|
|
2806
2873
|
const e = this.Cesium, i = this.viewer, n = i.scene;
|
|
2807
|
-
let s = null, o = null, r = null, a = null, l = "", d = "",
|
|
2874
|
+
let s = null, o = null, r = null, a = null, l = "", d = "", p = null, g = null, m = null, u = null;
|
|
2808
2875
|
const f = () => {
|
|
2809
|
-
s = null, o = null, r = null, a = null, l = "", d = "",
|
|
2876
|
+
s = null, o = null, r = null, a = null, l = "", d = "", p = null, g = null, m = null, u = null, this.hideFeedback(), this.unlockCamera();
|
|
2810
2877
|
}, y = (P) => {
|
|
2811
2878
|
const b = (C) => (P.split(C)[1] || "").split("_");
|
|
2812
2879
|
if (P.includes("moveAxis_")) {
|
|
@@ -2854,19 +2921,19 @@ class So {
|
|
|
2854
2921
|
o,
|
|
2855
2922
|
new e.Cartesian3()
|
|
2856
2923
|
);
|
|
2857
|
-
|
|
2924
|
+
m = e.Cartesian3.clone(E), r = e.Cartesian2.clone(
|
|
2858
2925
|
b.position || b.endPosition,
|
|
2859
2926
|
new e.Cartesian2()
|
|
2860
2927
|
);
|
|
2861
|
-
const M = e.Transforms.eastNorthUpToFixedFrame(
|
|
2928
|
+
const M = e.Transforms.eastNorthUpToFixedFrame(m);
|
|
2862
2929
|
let x = new e.Cartesian3();
|
|
2863
|
-
C === "move" ? L === "XY" ? e.Matrix4.getColumn(M, 2, x) : L === "YZ" ? e.Matrix4.getColumn(M, 0, x) : L === "ZX" ? e.Matrix4.getColumn(M, 1, x) : x = e.Cartesian3.clone(i.scene.camera.direction) : C === "rotate" ? (L === "X" && e.Matrix4.getColumn(M, 0, x), L === "Y" && e.Matrix4.getColumn(M, 1, x), L === "Z" && e.Matrix4.getColumn(M, 2, x)) : x = e.Cartesian3.clone(i.scene.camera.direction), e.Cartesian3.normalize(x, x),
|
|
2930
|
+
C === "move" ? L === "XY" ? e.Matrix4.getColumn(M, 2, x) : L === "YZ" ? e.Matrix4.getColumn(M, 0, x) : L === "ZX" ? e.Matrix4.getColumn(M, 1, x) : x = e.Cartesian3.clone(i.scene.camera.direction) : C === "rotate" ? (L === "X" && e.Matrix4.getColumn(M, 0, x), L === "Y" && e.Matrix4.getColumn(M, 1, x), L === "Z" && e.Matrix4.getColumn(M, 2, x)) : x = e.Cartesian3.clone(i.scene.camera.direction), e.Cartesian3.normalize(x, x), p = e.Plane.fromPointNormal(m, x);
|
|
2864
2931
|
const I = i.camera.getPickRay(b.position || b.endPosition);
|
|
2865
|
-
g = I &&
|
|
2932
|
+
g = I && p ? e.IntersectionTests.rayPlane(I, p) : null, g && (u = e.Cartesian3.subtract(
|
|
2866
2933
|
g,
|
|
2867
|
-
|
|
2934
|
+
m,
|
|
2868
2935
|
new e.Cartesian3()
|
|
2869
|
-
), e.Cartesian3.magnitudeSquared(
|
|
2936
|
+
), e.Cartesian3.magnitudeSquared(u) > 0 && e.Cartesian3.normalize(u, u)), this.lockCamera();
|
|
2870
2937
|
}
|
|
2871
2938
|
};
|
|
2872
2939
|
this.handler.setInputAction((P) => {
|
|
@@ -2892,14 +2959,14 @@ class So {
|
|
|
2892
2959
|
startMousePosition: P.position
|
|
2893
2960
|
}));
|
|
2894
2961
|
}, e.ScreenSpaceEventType.LEFT_DOWN), this.handler.setInputAction((P) => {
|
|
2895
|
-
if (t() && (l === "" ? w(P.endPosition) ? this.showHoverModeHint("向上拖放大,向下拖缩小") : this.scaleCenterHintVisible && this.hideModeHint() : this.scaleCenterHintVisible && this.hideModeHint(), l != "" && s &&
|
|
2896
|
-
const C = i.camera.getPickRay(P.endPosition), L = C ? e.IntersectionTests.rayPlane(C,
|
|
2962
|
+
if (t() && (l === "" ? w(P.endPosition) ? this.showHoverModeHint("向上拖放大,向下拖缩小") : this.scaleCenterHintVisible && this.hideModeHint() : this.scaleCenterHintVisible && this.hideModeHint(), l != "" && s && p && m && g)) {
|
|
2963
|
+
const C = i.camera.getPickRay(P.endPosition), L = C ? e.IntersectionTests.rayPlane(C, p) : null;
|
|
2897
2964
|
if (!L) return;
|
|
2898
|
-
l === "rotate" ? this.rotateModel(s, o, d,
|
|
2965
|
+
l === "rotate" ? this.rotateModel(s, o, d, m, u, L) : l === "move" ? this.moveModel(s, o, d, m, g, L) : l === "scale" && this.moveModelScale(
|
|
2899
2966
|
s,
|
|
2900
2967
|
o,
|
|
2901
2968
|
d,
|
|
2902
|
-
|
|
2969
|
+
m,
|
|
2903
2970
|
r,
|
|
2904
2971
|
g,
|
|
2905
2972
|
a,
|
|
@@ -3093,19 +3160,19 @@ class So {
|
|
|
3093
3160
|
}
|
|
3094
3161
|
const o = s.center, r = (e = (t = this.viewer) == null ? void 0 : t.scene) == null ? void 0 : e.canvas, a = Number((r == null ? void 0 : r.clientWidth) || (r == null ? void 0 : r.width) || 0), l = Number((r == null ? void 0 : r.clientHeight) || (r == null ? void 0 : r.height) || 0);
|
|
3095
3162
|
if (this.modeToolbarEl && this.modeToolbarEl.style.display !== "none") {
|
|
3096
|
-
const d = Number(this.modeToolbarEl.offsetWidth || 58),
|
|
3097
|
-
let
|
|
3098
|
-
|
|
3099
|
-
const
|
|
3100
|
-
|
|
3163
|
+
const d = Number(this.modeToolbarEl.offsetWidth || 58), p = Number(this.modeToolbarEl.offsetHeight || 176), g = 18;
|
|
3164
|
+
let m = s.maxX + g;
|
|
3165
|
+
m + d > a - 12 && (m = s.minX - d - g), m = n.Math.clamp(m, 12, Math.max(12, a - d - 12));
|
|
3166
|
+
const u = (s.minY + s.maxY) / 2, f = n.Math.clamp(
|
|
3167
|
+
u - p / 2,
|
|
3101
3168
|
12,
|
|
3102
|
-
Math.max(12, l -
|
|
3169
|
+
Math.max(12, l - p - 12)
|
|
3103
3170
|
);
|
|
3104
|
-
this.modeToolbarEl.style.left = `${
|
|
3171
|
+
this.modeToolbarEl.style.left = `${m}px`, this.modeToolbarEl.style.top = `${f + p / 2}px`;
|
|
3105
3172
|
}
|
|
3106
3173
|
if (this.feedbackLabelEl && this.feedbackLabelEl.style.display !== "none") {
|
|
3107
|
-
const d = this.feedbackAnchor || o,
|
|
3108
|
-
|
|
3174
|
+
const d = this.feedbackAnchor || o, p = this.toWindowCoordinates(d);
|
|
3175
|
+
p && (this.feedbackLabelEl.style.left = `${p.x}px`, this.feedbackLabelEl.style.top = `${p.y}px`);
|
|
3109
3176
|
}
|
|
3110
3177
|
} catch {
|
|
3111
3178
|
this.hideModeToolbar(), this.hideFeedback();
|
|
@@ -3150,7 +3217,7 @@ class So {
|
|
|
3150
3217
|
});
|
|
3151
3218
|
}
|
|
3152
3219
|
getGizmoMetrics(t) {
|
|
3153
|
-
const e = Math.max(this.getPrimitiveEffectiveRadius(t), 8), i = Math.max(e * 0.08, 2.2), n = Math.max(e * 1.25, 20), s = Math.max(e * 0.28, 6), o = Math.max(e * 0.065, 1.8), r = Math.max(e * 0.028, 1.1), a = Math.max(i * 2.2, e * 0.18), l = Math.max(e * 0.62, a + 6), d = Math.max(e * 0.018, 0.8),
|
|
3220
|
+
const e = Math.max(this.getPrimitiveEffectiveRadius(t), 8), i = Math.max(e * 0.08, 2.2), n = Math.max(e * 1.25, 20), s = Math.max(e * 0.28, 6), o = Math.max(e * 0.065, 1.8), r = Math.max(e * 0.028, 1.1), a = Math.max(i * 2.2, e * 0.18), l = Math.max(e * 0.62, a + 6), d = Math.max(e * 0.018, 0.8), p = Math.max(e * 1.02, 18), g = Math.max(e * 0.024, 1.15), m = Math.max(e * 1.06, 18), u = Math.max(e * 0.075, 2.4);
|
|
3154
3221
|
return {
|
|
3155
3222
|
centerRadius: i,
|
|
3156
3223
|
axisLength: n,
|
|
@@ -3160,18 +3227,18 @@ class So {
|
|
|
3160
3227
|
planeStart: a,
|
|
3161
3228
|
planeEnd: l,
|
|
3162
3229
|
planeThickness: d,
|
|
3163
|
-
rotationRadius:
|
|
3230
|
+
rotationRadius: p,
|
|
3164
3231
|
rotationThickness: g,
|
|
3165
|
-
scaleOffset:
|
|
3166
|
-
scaleHandleRadius:
|
|
3232
|
+
scaleOffset: m,
|
|
3233
|
+
scaleHandleRadius: u
|
|
3167
3234
|
};
|
|
3168
3235
|
}
|
|
3169
3236
|
createSegmentInstance(t, e, i, n, s) {
|
|
3170
3237
|
const o = this.Cesium, r = o.Cartesian3.subtract(i, e, new o.Cartesian3()), a = o.Cartesian3.magnitude(r);
|
|
3171
3238
|
if (!Number.isFinite(a) || a <= 0) return null;
|
|
3172
|
-
const l = o.Cartesian3.normalize(r, new o.Cartesian3()), d = o.Cartesian3.midpoint(e, i, new o.Cartesian3()),
|
|
3239
|
+
const l = o.Cartesian3.normalize(r, new o.Cartesian3()), d = o.Cartesian3.midpoint(e, i, new o.Cartesian3()), p = o.Cartesian3.UNIT_X, g = o.Cartesian3.cross(p, l, new o.Cartesian3()), m = o.Cartesian3.magnitude(g), u = o.Math.clamp(o.Cartesian3.dot(p, l), -1, 1);
|
|
3173
3240
|
let f = o.Quaternion.clone(o.Quaternion.IDENTITY);
|
|
3174
|
-
return
|
|
3241
|
+
return m > 1e-6 ? (o.Cartesian3.normalize(g, g), f = o.Quaternion.fromAxisAngle(g, Math.acos(u))) : u < 0 && (f = o.Quaternion.fromAxisAngle(o.Cartesian3.UNIT_Z, Math.PI)), new o.GeometryInstance({
|
|
3175
3242
|
id: t,
|
|
3176
3243
|
geometry: this.createUnitBoxGeometry(),
|
|
3177
3244
|
modelMatrix: o.Matrix4.fromTranslationQuaternionRotationScale(
|
|
@@ -3376,28 +3443,28 @@ class So {
|
|
|
3376
3443
|
plane: "xy",
|
|
3377
3444
|
color: e.Color.YELLOW.withAlpha(0.92)
|
|
3378
3445
|
}
|
|
3379
|
-
].flatMap((
|
|
3446
|
+
].flatMap((p) => {
|
|
3380
3447
|
const g = [];
|
|
3381
|
-
for (let
|
|
3382
|
-
const
|
|
3383
|
-
|
|
3448
|
+
for (let m = 0; m < 90; m += s) {
|
|
3449
|
+
const u = e.Math.toRadians(m), f = e.Math.toRadians(m + s), y = this.getRotationPlanePoint(
|
|
3450
|
+
p.plane,
|
|
3384
3451
|
n.rotationRadius,
|
|
3385
|
-
|
|
3386
|
-
), w = this.getRotationPlanePoint(
|
|
3387
|
-
`rotationArc_${t.id}_${
|
|
3452
|
+
u
|
|
3453
|
+
), w = this.getRotationPlanePoint(p.plane, n.rotationRadius, f), v = this.createSegmentInstance(
|
|
3454
|
+
`rotationArc_${t.id}_${p.axis}_${m}`,
|
|
3388
3455
|
y,
|
|
3389
3456
|
w,
|
|
3390
3457
|
n.rotationThickness,
|
|
3391
|
-
|
|
3458
|
+
p.color
|
|
3392
3459
|
);
|
|
3393
3460
|
v && g.push(v);
|
|
3394
3461
|
for (let P = 0; P < o; P += 1) {
|
|
3395
|
-
const b = r + l * (P + 0.5), C = this.getRotationPlanePoint(
|
|
3396
|
-
`rotationSector_${t.id}_${
|
|
3462
|
+
const b = r + l * (P + 0.5), C = this.getRotationPlanePoint(p.plane, b, u), L = this.getRotationPlanePoint(p.plane, b, f), E = this.createSegmentInstance(
|
|
3463
|
+
`rotationSector_${t.id}_${p.axis}_${P}_${m}`,
|
|
3397
3464
|
C,
|
|
3398
3465
|
L,
|
|
3399
3466
|
Math.max(l * 0.92, n.rotationThickness * 1.4),
|
|
3400
|
-
|
|
3467
|
+
p.color.withAlpha(0.04)
|
|
3401
3468
|
);
|
|
3402
3469
|
E && g.push(E);
|
|
3403
3470
|
}
|
|
@@ -3482,7 +3549,7 @@ class So {
|
|
|
3482
3549
|
const e = this.Cesium, i = this.viewer, n = Math.max(this.getPrimitiveEffectiveRadius(t), 8);
|
|
3483
3550
|
this.heightArrow && i.scene.primitives.remove(this.heightArrow);
|
|
3484
3551
|
let s = e.Color.GREEN, o = Math.max(n * 0.03, 1.5), r = 2 * o, a = Math.max(n * 1.6, 36), l = a * 0.1;
|
|
3485
|
-
const d = Math.max(n * 0.2, 2),
|
|
3552
|
+
const d = Math.max(n * 0.2, 2), p = e.CylinderGeometry.createGeometry(
|
|
3486
3553
|
new e.CylinderGeometry({
|
|
3487
3554
|
length: a,
|
|
3488
3555
|
topRadius: o,
|
|
@@ -3495,13 +3562,13 @@ class So {
|
|
|
3495
3562
|
bottomRadius: r
|
|
3496
3563
|
})
|
|
3497
3564
|
);
|
|
3498
|
-
let
|
|
3499
|
-
this.translate(
|
|
3565
|
+
let m = a + d, u = (a + d) / 2;
|
|
3566
|
+
this.translate(p, [0, 0, u]), this.translate(g, [0, 0, m]), this.heightArrow = new e.Primitive({
|
|
3500
3567
|
modelMatrix: t.modelMatrix,
|
|
3501
3568
|
geometryInstances: [
|
|
3502
3569
|
new e.GeometryInstance({
|
|
3503
3570
|
id: `heightArrow-line_${t.id}`,
|
|
3504
|
-
geometry:
|
|
3571
|
+
geometry: p,
|
|
3505
3572
|
attributes: {
|
|
3506
3573
|
color: e.ColorGeometryInstanceAttribute.fromColor(s.withAlpha(0.9))
|
|
3507
3574
|
}
|
|
@@ -3638,14 +3705,14 @@ class So {
|
|
|
3638
3705
|
new r.Cartesian3()
|
|
3639
3706
|
);
|
|
3640
3707
|
}
|
|
3641
|
-
const
|
|
3708
|
+
const p = r.Matrix4.multiply(
|
|
3642
3709
|
r.Matrix4.fromTranslation(d),
|
|
3643
3710
|
e,
|
|
3644
3711
|
new r.Matrix4()
|
|
3645
3712
|
);
|
|
3646
|
-
t.modelMatrix =
|
|
3647
|
-
const g = r.Matrix4.getTranslation(
|
|
3648
|
-
this.showFeedback(`${
|
|
3713
|
+
t.modelMatrix = p, this.updatedTool(p);
|
|
3714
|
+
const g = r.Matrix4.getTranslation(p, new r.Cartesian3()), m = r.Cartesian3.magnitude(d), u = ["XY", "YZ", "ZX"].includes(i) ? i : `${i}轴`;
|
|
3715
|
+
this.showFeedback(`${u} ${m.toFixed(2)} m`, g), this.writeDragEndPayload(t.id, "translation", {
|
|
3649
3716
|
id: t.id,
|
|
3650
3717
|
position: g
|
|
3651
3718
|
});
|
|
@@ -3668,19 +3735,19 @@ class So {
|
|
|
3668
3735
|
o.longitude,
|
|
3669
3736
|
o.latitude,
|
|
3670
3737
|
(l == null ? void 0 : l.height) || o.height || 0
|
|
3671
|
-
),
|
|
3672
|
-
t.modelMatrix =
|
|
3738
|
+
), p = r.Cartographic.toCartesian(d), g = r.Matrix4.getRotation(e, new r.Matrix3()), m = r.Matrix4.fromRotationTranslation(g, p);
|
|
3739
|
+
t.modelMatrix = m, this.updatedTool(m), this.showFeedback(
|
|
3673
3740
|
`${(((l == null ? void 0 : l.height) || 0) - (o.height || 0)).toFixed(2)} m`,
|
|
3674
|
-
|
|
3741
|
+
p
|
|
3675
3742
|
);
|
|
3676
|
-
let
|
|
3677
|
-
|
|
3678
|
-
|
|
3679
|
-
|
|
3743
|
+
let u = new r.Cartesian3(
|
|
3744
|
+
m[12],
|
|
3745
|
+
m[13],
|
|
3746
|
+
m[14]
|
|
3680
3747
|
), f = this.dragEndCallbackMap.get(t.id);
|
|
3681
3748
|
f || (f = /* @__PURE__ */ new Map(), this.dragEndCallbackMap.set(t.id, f)), f.set("translation", {
|
|
3682
3749
|
id: t.id,
|
|
3683
|
-
position:
|
|
3750
|
+
position: u
|
|
3684
3751
|
});
|
|
3685
3752
|
}
|
|
3686
3753
|
}
|
|
@@ -3689,9 +3756,9 @@ class So {
|
|
|
3689
3756
|
if (!t || !e || !i) return null;
|
|
3690
3757
|
const o = s.camera.getPickRay(t);
|
|
3691
3758
|
if (!o) return null;
|
|
3692
|
-
const r = o.origin, a = n.Cartesian3.normalize(o.direction, new n.Cartesian3()), l = e, d = i,
|
|
3759
|
+
const r = o.origin, a = n.Cartesian3.normalize(o.direction, new n.Cartesian3()), l = e, d = i, p = n.Cartesian3.subtract(r, l, new n.Cartesian3()), g = n.Cartesian3.dot(a, a), m = -n.Cartesian3.dot(a, d), u = n.Cartesian3.dot(d, d), f = -n.Cartesian3.dot(a, p), y = n.Cartesian3.dot(d, p), w = g * u - m * m;
|
|
3693
3760
|
if (Math.abs(w) < 1e-6) return null;
|
|
3694
|
-
const v = (g * y -
|
|
3761
|
+
const v = (g * y - m * f) / w;
|
|
3695
3762
|
return n.Cartesian3.add(
|
|
3696
3763
|
l,
|
|
3697
3764
|
n.Cartesian3.multiplyByScalar(d, v, new n.Cartesian3()),
|
|
@@ -3715,13 +3782,13 @@ class So {
|
|
|
3715
3782
|
);
|
|
3716
3783
|
if (r.Cartesian3.magnitudeSquared(a) <= 1e-6) return;
|
|
3717
3784
|
r.Cartesian3.normalize(a, a);
|
|
3718
|
-
const l = r.Transforms.eastNorthUpToFixedFrame(n), d = this.getAxisVector(l, i),
|
|
3785
|
+
const l = r.Transforms.eastNorthUpToFixedFrame(n), d = this.getAxisVector(l, i), p = r.Math.clamp(r.Cartesian3.dot(s, a), -1, 1), g = Math.acos(p);
|
|
3719
3786
|
if (!Number.isFinite(g) || g <= 1e-6) return;
|
|
3720
|
-
const
|
|
3787
|
+
const m = r.Cartesian3.cross(
|
|
3721
3788
|
s,
|
|
3722
3789
|
a,
|
|
3723
3790
|
new r.Cartesian3()
|
|
3724
|
-
),
|
|
3791
|
+
), u = r.Cartesian3.dot(m, d) >= 0 ? 1 : -1, f = g * u, y = r.Quaternion.fromAxisAngle(d, f), w = r.Matrix4.fromRotationTranslation(
|
|
3725
3792
|
r.Matrix3.fromQuaternion(y)
|
|
3726
3793
|
), v = this.applyTransformAroundCenter(
|
|
3727
3794
|
e,
|
|
@@ -3746,12 +3813,12 @@ class So {
|
|
|
3746
3813
|
moveModelScale(t, e, i, n, s, o, r, a, l) {
|
|
3747
3814
|
const d = this.Cesium;
|
|
3748
3815
|
if (!r) return;
|
|
3749
|
-
const
|
|
3750
|
-
let
|
|
3816
|
+
const p = this.getGizmoMetrics(t), g = d.Transforms.eastNorthUpToFixedFrame(n), m = Math.max(p.scaleOffset * 0.7, 8);
|
|
3817
|
+
let u = 0;
|
|
3751
3818
|
if (i === "CENTER") {
|
|
3752
3819
|
if (!s || !a) return;
|
|
3753
3820
|
const b = Number(s.y || 0) - Number(a.y || 0);
|
|
3754
|
-
|
|
3821
|
+
u = Math.pow(2, b / 180) - 1;
|
|
3755
3822
|
} else {
|
|
3756
3823
|
if (!o || !l) return;
|
|
3757
3824
|
const b = d.Cartesian3.subtract(
|
|
@@ -3759,9 +3826,9 @@ class So {
|
|
|
3759
3826
|
o,
|
|
3760
3827
|
new d.Cartesian3()
|
|
3761
3828
|
), C = this.getAxisVector(g, i);
|
|
3762
|
-
|
|
3829
|
+
u = d.Cartesian3.dot(b, C) / m;
|
|
3763
3830
|
}
|
|
3764
|
-
const f = Math.max(0.05, 1 +
|
|
3831
|
+
const f = Math.max(0.05, 1 + u), y = {
|
|
3765
3832
|
x: r.x,
|
|
3766
3833
|
y: r.y,
|
|
3767
3834
|
z: r.z
|
|
@@ -3787,7 +3854,7 @@ class So {
|
|
|
3787
3854
|
z: Number((r == null ? void 0 : r.z) || 1)
|
|
3788
3855
|
},
|
|
3789
3856
|
nextScale: y,
|
|
3790
|
-
deltaFactor:
|
|
3857
|
+
deltaFactor: u,
|
|
3791
3858
|
factor: f,
|
|
3792
3859
|
runtimeRadius: this.getPrimitiveRuntimeRadius(t)
|
|
3793
3860
|
}), this.showFeedback(P, v), this.writeDragEndPayload(t.id, "addScale", {
|
|
@@ -3927,10 +3994,10 @@ function ko(h, t) {
|
|
|
3927
3994
|
}), new i(t);
|
|
3928
3995
|
}
|
|
3929
3996
|
function Ro(h, t) {
|
|
3930
|
-
const e = h.Color, i = Object.defineProperties, n = h.Event, s = h.createPropertyDescriptor, o = h.Property, r = (
|
|
3997
|
+
const e = h.Color, i = Object.defineProperties, n = h.Event, s = h.createPropertyDescriptor, o = h.Property, r = (p, g) => p === void 0 ? g : p, a = {};
|
|
3931
3998
|
let l = t.materialType || "PolylineFlow" + Date.now() + Math.floor(Math.random() * 1e3);
|
|
3932
|
-
function d(
|
|
3933
|
-
|
|
3999
|
+
function d(p) {
|
|
4000
|
+
p = r(p, a), this._definitionChanged = new n(), this._color = void 0, this._colorSubscription = void 0, this.color = p.color || e.fromBytes(0, 255, 255, 255), this._duration = void 0, this._durationSubscription = void 0, this.duration = r(p.duration, 45);
|
|
3934
4001
|
}
|
|
3935
4002
|
return i(d.prototype, {
|
|
3936
4003
|
isConstant: {
|
|
@@ -3943,17 +4010,17 @@ function Ro(h, t) {
|
|
|
3943
4010
|
return this._definitionChanged;
|
|
3944
4011
|
}
|
|
3945
4012
|
}
|
|
3946
|
-
}), d.prototype.getType = function(
|
|
4013
|
+
}), d.prototype.getType = function(p) {
|
|
3947
4014
|
return l;
|
|
3948
|
-
}, d.prototype.getValue = function(
|
|
4015
|
+
}, d.prototype.getValue = function(p, g) {
|
|
3949
4016
|
return g || (g = {}), g.color = o.getValueOrClonedDefault(
|
|
3950
4017
|
this._color,
|
|
3951
|
-
|
|
4018
|
+
p,
|
|
3952
4019
|
h.Color.WHITE,
|
|
3953
4020
|
g.color
|
|
3954
4021
|
), g.duration = this._duration, g;
|
|
3955
|
-
}, d.prototype.equals = function(
|
|
3956
|
-
return this ===
|
|
4022
|
+
}, d.prototype.equals = function(p) {
|
|
4023
|
+
return this === p || p instanceof d && o.equals(this._color, p._color);
|
|
3957
4024
|
}, i(d.prototype, {
|
|
3958
4025
|
color: s("color"),
|
|
3959
4026
|
duration: s("duration")
|
|
@@ -3989,7 +4056,7 @@ function Ro(h, t) {
|
|
|
3989
4056
|
}
|
|
3990
4057
|
}), new d(t);
|
|
3991
4058
|
}
|
|
3992
|
-
class
|
|
4059
|
+
class Ho {
|
|
3993
4060
|
constructor() {
|
|
3994
4061
|
c(this, "categoryMap", /* @__PURE__ */ new Map());
|
|
3995
4062
|
c(this, "CategoryGet", {});
|
|
@@ -4222,8 +4289,8 @@ class Io {
|
|
|
4222
4289
|
category: "polygon",
|
|
4223
4290
|
options: t
|
|
4224
4291
|
}), n = Array.isArray(t.hierarchy[0]) ? t.hierarchy.flat() : t.hierarchy, s = this.Cesium.Cartesian3.fromDegreesArrayHeights(n), o = ((l = t.holes) == null ? void 0 : l.map((d) => {
|
|
4225
|
-
let
|
|
4226
|
-
return this.Cesium.Cartesian3.fromDegreesArrayHeights(
|
|
4292
|
+
let p = Array.isArray(d[0]) ? t.hierarchy.flat() : t.hole;
|
|
4293
|
+
return this.Cesium.Cartesian3.fromDegreesArrayHeights(p.flat());
|
|
4227
4294
|
})) || [], r = new this.Cesium.PolygonHierarchy(s, o);
|
|
4228
4295
|
let a = {
|
|
4229
4296
|
...t
|
|
@@ -4264,7 +4331,9 @@ class Io {
|
|
|
4264
4331
|
id: t.id,
|
|
4265
4332
|
lon: t.card.position[0],
|
|
4266
4333
|
lat: t.card.position[1],
|
|
4267
|
-
|
|
4334
|
+
// card.position 与 billboard.position 均为 [lon, lat, height]。
|
|
4335
|
+
// 取第三项,确保卡片与标记使用同一世界坐标高度参与屏幕投影。
|
|
4336
|
+
height: t.card.position[2] || 0,
|
|
4268
4337
|
theme: t.card.theme,
|
|
4269
4338
|
show: t.show ? t.card.initShow ?? !1 : !1,
|
|
4270
4339
|
notCreateElement: !0,
|
|
@@ -4345,7 +4414,7 @@ class Io {
|
|
|
4345
4414
|
this.groupMap.forEach((t) => t.removeAll(this.viewer)), this.groupMap.clear();
|
|
4346
4415
|
}
|
|
4347
4416
|
}
|
|
4348
|
-
class
|
|
4417
|
+
class $o {
|
|
4349
4418
|
constructor(t, e, i, n, s) {
|
|
4350
4419
|
c(this, "Cesium");
|
|
4351
4420
|
c(this, "viewer");
|
|
@@ -4509,13 +4578,13 @@ class Fo {
|
|
|
4509
4578
|
}
|
|
4510
4579
|
//注册主题
|
|
4511
4580
|
initTheme(t) {
|
|
4512
|
-
var n, s, o, r, a, l, d,
|
|
4581
|
+
var n, s, o, r, a, l, d, p, g, m, u, f;
|
|
4513
4582
|
let e = this.materialManager, i = this.Cesium;
|
|
4514
4583
|
if (t.category == "polyline") {
|
|
4515
4584
|
const y = ((s = (n = t.properties) == null ? void 0 : n.lineType) == null ? void 0 : s.pattern) && ((r = (o = t.properties) == null ? void 0 : o.lineType) == null ? void 0 : r.patternLength);
|
|
4516
4585
|
let w = "";
|
|
4517
4586
|
if (y) {
|
|
4518
|
-
const v = ((l = (a = t.properties) == null ? void 0 : a.lineType) == null ? void 0 : l.pattern) || [0.25, -0.125], P = ((
|
|
4587
|
+
const v = ((l = (a = t.properties) == null ? void 0 : a.lineType) == null ? void 0 : l.pattern) || [0.25, -0.125], P = ((p = (d = t.properties) == null ? void 0 : d.lineType) == null ? void 0 : p.patternLength) || 0.375;
|
|
4519
4588
|
let b = this.convertCadPatternToCesiumDash(v, P);
|
|
4520
4589
|
w = `DashedLineMaterial_pattern_${b.dashPattern}_dashLength_${b.dashLength}_color_${(g = t.properties) == null ? void 0 : g.color}`, e.has(w) || e.register({
|
|
4521
4590
|
themeKey: w,
|
|
@@ -4530,7 +4599,7 @@ class Fo {
|
|
|
4530
4599
|
})
|
|
4531
4600
|
});
|
|
4532
4601
|
} else
|
|
4533
|
-
w = `LineMaterial_color_${(
|
|
4602
|
+
w = `LineMaterial_color_${(m = t.properties) == null ? void 0 : m.color}`, e.has(w) || e.register({
|
|
4534
4603
|
themeKey: w,
|
|
4535
4604
|
material: i.Material.fromType("Color", {
|
|
4536
4605
|
color: i.Color.fromCssColorString(t.properties.color || "#FFFFFF").withAlpha(
|
|
@@ -4539,7 +4608,7 @@ class Fo {
|
|
|
4539
4608
|
})
|
|
4540
4609
|
});
|
|
4541
4610
|
} else if (t.category == "polygon") {
|
|
4542
|
-
let y = `polygonMaterial_color_${(
|
|
4611
|
+
let y = `polygonMaterial_color_${(u = t.properties) == null ? void 0 : u.color}`;
|
|
4543
4612
|
e.has(y) || e.register({
|
|
4544
4613
|
themeKey: y,
|
|
4545
4614
|
material: i.Material.fromType("Color", {
|
|
@@ -4555,7 +4624,7 @@ class Fo {
|
|
|
4555
4624
|
let s = [], o = 0;
|
|
4556
4625
|
for (let a of t) {
|
|
4557
4626
|
const l = Math.floor(Math.abs(a) / n), d = a >= 0 ? 1 : 0;
|
|
4558
|
-
for (let
|
|
4627
|
+
for (let p = 0; p < l && (s.push(d), o++, !(o >= 16)); p++)
|
|
4559
4628
|
;
|
|
4560
4629
|
if (o >= 16) break;
|
|
4561
4630
|
}
|
|
@@ -4584,8 +4653,8 @@ class Fo {
|
|
|
4584
4653
|
if (d)
|
|
4585
4654
|
d.set(r.id, r);
|
|
4586
4655
|
else {
|
|
4587
|
-
let
|
|
4588
|
-
this.layerMap.set(n,
|
|
4656
|
+
let p = /* @__PURE__ */ new Map();
|
|
4657
|
+
this.layerMap.set(n, p), p.set(r.id, r);
|
|
4589
4658
|
}
|
|
4590
4659
|
e.set(r.theme, r);
|
|
4591
4660
|
}
|
|
@@ -4795,15 +4864,15 @@ class Fo {
|
|
|
4795
4864
|
}
|
|
4796
4865
|
const r = o.geometry, a = r._positions || r._polygonHierarchy.positions;
|
|
4797
4866
|
if (a && a.length > 0) {
|
|
4798
|
-
let l = a[0].x, d = a[0].y,
|
|
4867
|
+
let l = a[0].x, d = a[0].y, p = a[0].z, g = a[0].x, m = a[0].y, u = a[0].z;
|
|
4799
4868
|
a.forEach((P) => {
|
|
4800
|
-
l = Math.min(l, P.x), d = Math.min(d, P.y),
|
|
4869
|
+
l = Math.min(l, P.x), d = Math.min(d, P.y), p = Math.min(p, P.z), g = Math.max(g, P.x), m = Math.max(m, P.y), u = Math.max(u, P.z);
|
|
4801
4870
|
});
|
|
4802
4871
|
const f = new this.Cesium.Cartesian3(
|
|
4803
4872
|
(l + g) / 2,
|
|
4804
|
-
(d +
|
|
4805
|
-
(
|
|
4806
|
-
), w = new this.Cesium.Cartesian3(g - l,
|
|
4873
|
+
(d + m) / 2,
|
|
4874
|
+
(p + u) / 2
|
|
4875
|
+
), w = new this.Cesium.Cartesian3(g - l, m - d, u - p).z, v = Math.abs(w || 1) * 1.5;
|
|
4807
4876
|
this.viewer.camera.flyTo({
|
|
4808
4877
|
destination: f,
|
|
4809
4878
|
duration: 2,
|
|
@@ -4866,7 +4935,7 @@ const Re = class Re {
|
|
|
4866
4935
|
});
|
|
4867
4936
|
}
|
|
4868
4937
|
this.tooltip = new ce(), this.tooltip.show(Re.TIP_TEXT), this._bindGlobalEvents(t, e, i), this.handler = new e.ScreenSpaceEventHandler(i.canvas), this.handler.setInputAction((n) => {
|
|
4869
|
-
var
|
|
4938
|
+
var u, f, y, w;
|
|
4870
4939
|
const s = i.scene.pickPosition(n.position);
|
|
4871
4940
|
if (!s) return;
|
|
4872
4941
|
const o = e.Cartographic.fromCartesian(s), r = e.Math.toDegrees(o.longitude), a = e.Math.toDegrees(o.latitude);
|
|
@@ -4882,9 +4951,9 @@ const Re = class Re {
|
|
|
4882
4951
|
}
|
|
4883
4952
|
});
|
|
4884
4953
|
this.tempPoints.push(d);
|
|
4885
|
-
const
|
|
4954
|
+
const p = s, g = ((f = (u = t.dashLineColor || t.lineColor || t.color || e.Color.RED).withAlpha) == null ? void 0 : f.call(u, 0.9)) || e.Color.RED, m = i.entities.add({
|
|
4886
4955
|
polyline: {
|
|
4887
|
-
positions: [
|
|
4956
|
+
positions: [p, l],
|
|
4888
4957
|
width: t.width || 3,
|
|
4889
4958
|
material: new e.PolylineDashMaterialProperty({
|
|
4890
4959
|
color: g,
|
|
@@ -4893,7 +4962,7 @@ const Re = class Re {
|
|
|
4893
4962
|
})
|
|
4894
4963
|
}
|
|
4895
4964
|
});
|
|
4896
|
-
if (this.groundLineEntities.push(
|
|
4965
|
+
if (this.groundLineEntities.push(m), this.positions.length >= 2) {
|
|
4897
4966
|
const v = this.positions[this.positions.length - 2], P = this.positions[this.positions.length - 1], b = e.Cartographic.fromCartesian(v), C = e.Cartographic.fromCartesian(P), L = i.entities.add({
|
|
4898
4967
|
polyline: {
|
|
4899
4968
|
positions: [v, P],
|
|
@@ -4952,13 +5021,13 @@ const Re = class Re {
|
|
|
4952
5021
|
this.hoverPos = s;
|
|
4953
5022
|
const o = i.Cartographic.fromCartesian(s), r = i.Math.toDegrees(o.longitude), a = i.Math.toDegrees(o.latitude), l = i.Cartesian3.fromDegrees(r, a, this.firstHeight || 0);
|
|
4954
5023
|
this.previewPos = l, this.previewGroundPos = s;
|
|
4955
|
-
const d = this.positions[this.positions.length - 1],
|
|
5024
|
+
const d = this.positions[this.positions.length - 1], p = i.Cartographic.fromCartesian(d), g = i.Cartographic.fromCartesian(l), u = new i.EllipsoidGeodesic(p, g).surfaceDistance, f = new i.Cartesian3(
|
|
4956
5025
|
(d.x + l.x) / 2,
|
|
4957
5026
|
(d.y + l.y) / 2,
|
|
4958
5027
|
(d.z + l.z) / 2
|
|
4959
5028
|
), y = i.Cartographic.fromCartesian(f), w = this.previewLabelId || "measure_horizontal_preview";
|
|
4960
5029
|
this.previewLabelId = w, this.htmlLabelPool.add(
|
|
4961
|
-
{ text: `${
|
|
5030
|
+
{ text: `${u.toFixed(2)} m` },
|
|
4962
5031
|
{
|
|
4963
5032
|
id: w,
|
|
4964
5033
|
lon: i.Math.toDegrees(y.longitude),
|
|
@@ -5024,8 +5093,8 @@ const Re = class Re {
|
|
|
5024
5093
|
this.stop(), this._clearPreviewState();
|
|
5025
5094
|
let i = 0;
|
|
5026
5095
|
for (let l = 1; l < this.positions.length; l++) {
|
|
5027
|
-
const d = this.positions[l - 1],
|
|
5028
|
-
i +=
|
|
5096
|
+
const d = this.positions[l - 1], p = this.positions[l], g = e.Cartographic.fromCartesian(d), m = e.Cartographic.fromCartesian(p), u = new e.EllipsoidGeodesic(g, m);
|
|
5097
|
+
i += u.surfaceDistance;
|
|
5029
5098
|
}
|
|
5030
5099
|
const n = this.positions[this.positions.length - 1], s = e.Cartographic.fromCartesian(n), o = this.totalLabelId || `measure_horizontal_total_${Date.now()}`;
|
|
5031
5100
|
this.totalLabelId = o, this.htmlLabelPool.add(
|
|
@@ -5063,8 +5132,8 @@ const Re = class Re {
|
|
|
5063
5132
|
this.stop(), this.segmentEntities.forEach((t) => this.viewer.entities.remove(t)), this.segmentEntities = [], this.groundLineEntities.forEach((t) => this.viewer.entities.remove(t)), this.groundLineEntities = [], this.tempPoints.forEach((t) => this.viewer.entities.remove(t)), this.tempPoints = [], this.totalLabelId && this.htmlLabelPool && (this.htmlLabelPool.removeByIds([this.totalLabelId]), this.totalLabelId = null), this.previewEntity && (this.viewer.entities.remove(this.previewEntity), this.previewEntity = null), this.previewGroundEntity && (this.viewer.entities.remove(this.previewGroundEntity), this.previewGroundEntity = null), this.previewLabelId && this.htmlLabelPool && (this.htmlLabelPool.removeByIds([this.previewLabelId]), this.previewLabelId = null), this.segmentLabelIds.length && this.htmlLabelPool && this.htmlLabelPool.removeByIds(this.segmentLabelIds.slice()), this.segmentLabelIds = [], this.positions = [], this.hoverPos = null, this.labelEntity = null, this.firstHeight = null, this.previewPos = null, this.previewGroundPos = null;
|
|
5064
5133
|
}
|
|
5065
5134
|
rehydrate(t, e) {
|
|
5066
|
-
var
|
|
5067
|
-
const i = this.Cesium, n = this.viewer, s = t.options || {}, o = s.lineColor || s.color || i.Color.YELLOW, r = ((f = (
|
|
5135
|
+
var u, f;
|
|
5136
|
+
const i = this.Cesium, n = this.viewer, s = t.options || {}, o = s.lineColor || s.color || i.Color.YELLOW, r = ((f = (u = s.dashLineColor || s.lineColor || s.color || i.Color.RED).withAlpha) == null ? void 0 : f.call(u, 0.9)) || i.Color.RED, a = s.width || 3, l = (t.positions || []).map((y) => new i.Cartesian3(y[0], y[1], y[2]));
|
|
5068
5137
|
if (!l.length) return;
|
|
5069
5138
|
if (!this.htmlLabelPool) {
|
|
5070
5139
|
const y = s.overlayContainerId || "html-label-container";
|
|
@@ -5120,9 +5189,9 @@ const Re = class Re {
|
|
|
5120
5189
|
const w = i.Cartographic.fromCartesian(l[y - 1]), v = i.Cartographic.fromCartesian(l[y]), P = new i.EllipsoidGeodesic(w, v);
|
|
5121
5190
|
d += P.surfaceDistance;
|
|
5122
5191
|
}
|
|
5123
|
-
const
|
|
5124
|
-
this.totalLabelId =
|
|
5125
|
-
id:
|
|
5192
|
+
const p = l[l.length - 1], g = i.Cartographic.fromCartesian(p), m = t.id + "_total";
|
|
5193
|
+
this.totalLabelId = m, this.htmlLabelPool.add({ text: `${d.toFixed(2)} m` }, {
|
|
5194
|
+
id: m,
|
|
5126
5195
|
lon: i.Math.toDegrees(g.longitude),
|
|
5127
5196
|
lat: i.Math.toDegrees(g.latitude),
|
|
5128
5197
|
height: g.height || 0,
|
|
@@ -5166,28 +5235,28 @@ class gt {
|
|
|
5166
5235
|
});
|
|
5167
5236
|
}
|
|
5168
5237
|
this.handler = new e.ScreenSpaceEventHandler(i.canvas), this.handler.setInputAction((n) => {
|
|
5169
|
-
var r, a, l, d,
|
|
5238
|
+
var r, a, l, d, p;
|
|
5170
5239
|
const s = i.camera.getPickRay(n.position);
|
|
5171
5240
|
let o = s ? i.scene.globe.pick(s, i.scene) : null;
|
|
5172
5241
|
if (o || (o = i.camera.pickEllipsoid(n.position, e.Ellipsoid.WGS84)), o || (o = i.scene.pickPosition(n.position)), !!o)
|
|
5173
5242
|
if (this.positions.length === 0) {
|
|
5174
5243
|
const g = e.Cartographic.fromCartesian(o);
|
|
5175
5244
|
this.baseCarto = new e.Cartographic(g.longitude, g.latitude, 0);
|
|
5176
|
-
const
|
|
5177
|
-
this.baseUp = e.Ellipsoid.WGS84.geodeticSurfaceNormalCartographic(this.baseCarto), this.positions.push(
|
|
5178
|
-
const
|
|
5179
|
-
position:
|
|
5245
|
+
const m = e.Ellipsoid.WGS84.cartographicToCartesian(this.baseCarto);
|
|
5246
|
+
this.baseUp = e.Ellipsoid.WGS84.geodeticSurfaceNormalCartographic(this.baseCarto), this.positions.push(m);
|
|
5247
|
+
const u = i.entities.add({
|
|
5248
|
+
position: m,
|
|
5180
5249
|
point: {
|
|
5181
5250
|
pixelSize: 8,
|
|
5182
5251
|
color: t.pointColor || t.color || e.Color.YELLOW,
|
|
5183
5252
|
disableDepthTestDistance: Number.POSITIVE_INFINITY
|
|
5184
5253
|
}
|
|
5185
5254
|
});
|
|
5186
|
-
this.tempPoints.push(
|
|
5255
|
+
this.tempPoints.push(u);
|
|
5187
5256
|
const f = t.lineColor || t.color || e.Color.CYAN, y = ((a = (r = t.dashLineColor || t.lineColor || t.color || e.Color.RED).withAlpha) == null ? void 0 : a.call(r, 0.9)) || e.Color.RED;
|
|
5188
5257
|
this.previewEntity = i.entities.add({
|
|
5189
5258
|
polyline: {
|
|
5190
|
-
positions: [
|
|
5259
|
+
positions: [m, m],
|
|
5191
5260
|
width: t.width || 3,
|
|
5192
5261
|
material: f,
|
|
5193
5262
|
depthFailMaterial: new e.PolylineDashMaterialProperty({
|
|
@@ -5199,9 +5268,9 @@ class gt {
|
|
|
5199
5268
|
});
|
|
5200
5269
|
} else {
|
|
5201
5270
|
if (!this.baseCarto || !this.baseUp) return;
|
|
5202
|
-
const g = this.positions[0],
|
|
5203
|
-
if (!
|
|
5204
|
-
const
|
|
5271
|
+
const g = this.positions[0], m = i.camera.getPickRay(n.position);
|
|
5272
|
+
if (!m) return;
|
|
5273
|
+
const u = m.origin, f = e.Cartesian3.normalize(m.direction, new e.Cartesian3()), y = g, w = this.baseUp, v = e.Cartesian3.subtract(u, y, new e.Cartesian3()), P = e.Cartesian3.dot(f, f), b = -e.Cartesian3.dot(f, w), C = e.Cartesian3.dot(w, w), L = -e.Cartesian3.dot(f, v), E = e.Cartesian3.dot(w, v), M = P * C - b * b;
|
|
5205
5274
|
if (Math.abs(M) < 1e-6) return;
|
|
5206
5275
|
const x = (P * E - b * L) / M, I = e.Cartesian3.add(
|
|
5207
5276
|
y,
|
|
@@ -5235,16 +5304,16 @@ class gt {
|
|
|
5235
5304
|
(this.positions[0].x + this.positions[1].x) / 2,
|
|
5236
5305
|
(this.positions[0].y + this.positions[1].y) / 2,
|
|
5237
5306
|
(this.positions[0].z + this.positions[1].z) / 2
|
|
5238
|
-
),
|
|
5307
|
+
), $ = e.Cartographic.fromCartesian(R);
|
|
5239
5308
|
this.previewLabelId && this.htmlLabelPool && (this.htmlLabelPool.removeByIds([this.previewLabelId]), this.previewLabelId = null);
|
|
5240
5309
|
const B = this.htmlLabelId || `measure_vertical_${Date.now()}`;
|
|
5241
5310
|
this.htmlLabelId = B, this.htmlLabelPool.add(
|
|
5242
5311
|
{ text: `${A.toFixed(2)} m` },
|
|
5243
5312
|
{
|
|
5244
5313
|
id: B,
|
|
5245
|
-
lon: e.Math.toDegrees(
|
|
5246
|
-
lat: e.Math.toDegrees(
|
|
5247
|
-
height:
|
|
5314
|
+
lon: e.Math.toDegrees($.longitude),
|
|
5315
|
+
lat: e.Math.toDegrees($.latitude),
|
|
5316
|
+
height: $.height || 0,
|
|
5248
5317
|
theme: "measure-vertical",
|
|
5249
5318
|
show: !0,
|
|
5250
5319
|
style: { pointerEvents: "none", userSelect: "none", cursor: "default" }
|
|
@@ -5257,7 +5326,7 @@ class gt {
|
|
|
5257
5326
|
vertical: A,
|
|
5258
5327
|
clear: () => this.clear()
|
|
5259
5328
|
};
|
|
5260
|
-
(
|
|
5329
|
+
(p = t.onComplete) == null || p.call(t, Y);
|
|
5261
5330
|
}
|
|
5262
5331
|
}, e.ScreenSpaceEventType.LEFT_CLICK), this.handler.setInputAction((n) => {
|
|
5263
5332
|
var I, D;
|
|
@@ -5268,9 +5337,9 @@ class gt {
|
|
|
5268
5337
|
}
|
|
5269
5338
|
const s = this.positions[0], o = i.camera.getPickRay(n.endPosition);
|
|
5270
5339
|
if (!o) return;
|
|
5271
|
-
const r = o.origin, a = e.Cartesian3.normalize(o.direction, new e.Cartesian3()), l = s, d = this.baseUp,
|
|
5340
|
+
const r = o.origin, a = e.Cartesian3.normalize(o.direction, new e.Cartesian3()), l = s, d = this.baseUp, p = e.Cartesian3.subtract(r, l, new e.Cartesian3()), g = e.Cartesian3.dot(a, a), m = -e.Cartesian3.dot(a, d), u = e.Cartesian3.dot(d, d), f = -e.Cartesian3.dot(a, p), y = e.Cartesian3.dot(d, p), w = g * u - m * m;
|
|
5272
5341
|
if (Math.abs(w) < 1e-6) return;
|
|
5273
|
-
const v = (g * y -
|
|
5342
|
+
const v = (g * y - m * f) / w, P = e.Cartesian3.add(
|
|
5274
5343
|
l,
|
|
5275
5344
|
e.Cartesian3.multiplyByScalar(d, v, new e.Cartesian3()),
|
|
5276
5345
|
new e.Cartesian3()
|
|
@@ -5337,9 +5406,9 @@ class gt {
|
|
|
5337
5406
|
options: { offset: { x: 0, y: -10 } }
|
|
5338
5407
|
});
|
|
5339
5408
|
}
|
|
5340
|
-
const d = l[0],
|
|
5341
|
-
this.tempPoints.push(g), this.tempPoints.push(
|
|
5342
|
-
const
|
|
5409
|
+
const d = l[0], p = l[1], g = n.entities.add({ position: d, point: { pixelSize: 8, color: s.pointColor || s.color || i.Color.YELLOW, disableDepthTestDistance: Number.POSITIVE_INFINITY } }), m = n.entities.add({ position: p, point: { pixelSize: 8, color: s.pointColor || s.color || i.Color.YELLOW, disableDepthTestDistance: Number.POSITIVE_INFINITY } });
|
|
5410
|
+
this.tempPoints.push(g), this.tempPoints.push(m), this.entity = n.entities.add({ polyline: { positions: [d, p], width: a, material: o, depthFailMaterial: new i.PolylineDashMaterialProperty({ color: r, dashLength: 12, dashPattern: 255 }) } });
|
|
5411
|
+
const u = i.Cartographic.fromCartesian(d), f = i.Cartographic.fromCartesian(p), y = Math.abs((f.height || 0) - (u.height || 0)), w = new i.Cartesian3((d.x + p.x) / 2, (d.y + p.y) / 2, (d.z + p.z) / 2), v = i.Cartographic.fromCartesian(w), P = t.id + "_label";
|
|
5343
5412
|
this.htmlLabelId = P, this.htmlLabelPool.add({ text: `${y.toFixed(2)} m` }, {
|
|
5344
5413
|
id: P,
|
|
5345
5414
|
lon: i.Math.toDegrees(v.longitude),
|
|
@@ -5416,15 +5485,15 @@ class ft {
|
|
|
5416
5485
|
});
|
|
5417
5486
|
if (this.pointEntities.push(o), this.positions.length === 2) {
|
|
5418
5487
|
this.stop(), this.previewSegmentEntities.forEach((q) => i.entities.remove(q)), this.previewSegmentEntities = [], this.previewAngleMarkerEntities.forEach((q) => i.entities.remove(q)), this.previewAngleMarkerEntities = [], this.previewPointEntity && (i.entities.remove(this.previewPointEntity), this.previewPointEntity = null);
|
|
5419
|
-
const d = e.Cartographic.fromCartesian(this.positions[0]),
|
|
5488
|
+
const d = e.Cartographic.fromCartesian(this.positions[0]), p = e.Cartographic.fromCartesian(this.positions[1]), g = d.height || 0, m = p.height || 0, u = g <= m ? this.positions[0] : this.positions[1], f = g > m ? this.positions[0] : this.positions[1], y = e.Cartographic.fromCartesian(u);
|
|
5420
5489
|
e.Cartographic.fromCartesian(f);
|
|
5421
|
-
const w = Math.max(g,
|
|
5490
|
+
const w = Math.max(g, m), v = e.Cartesian3.fromDegrees(
|
|
5422
5491
|
e.Math.toDegrees(y.longitude),
|
|
5423
5492
|
e.Math.toDegrees(y.latitude),
|
|
5424
5493
|
w
|
|
5425
5494
|
), P = t.lineColor || t.color || e.Color.YELLOW, b = ((a = (r = t.dashLineColor || t.lineColor || t.color || e.Color.RED).withAlpha) == null ? void 0 : a.call(r, 0.9)) || e.Color.RED, C = i.entities.add({
|
|
5426
5495
|
polyline: {
|
|
5427
|
-
positions: [
|
|
5496
|
+
positions: [u, v],
|
|
5428
5497
|
width: t.width || 3,
|
|
5429
5498
|
material: P,
|
|
5430
5499
|
depthFailMaterial: new e.PolylineDashMaterialProperty({ color: b, dashLength: 12, dashPattern: 255 })
|
|
@@ -5438,21 +5507,21 @@ class ft {
|
|
|
5438
5507
|
}
|
|
5439
5508
|
}), E = i.entities.add({
|
|
5440
5509
|
polyline: {
|
|
5441
|
-
positions: [
|
|
5510
|
+
positions: [u, f],
|
|
5442
5511
|
width: t.width || 3,
|
|
5443
5512
|
material: P,
|
|
5444
5513
|
depthFailMaterial: new e.PolylineDashMaterialProperty({ color: b, dashLength: 12, dashPattern: 255 })
|
|
5445
5514
|
}
|
|
5446
5515
|
});
|
|
5447
5516
|
this.segmentEntities.push(C, L, E);
|
|
5448
|
-
const M = e.Cartesian3.distance(
|
|
5449
|
-
this.segmentLabelIds = [R,
|
|
5450
|
-
const Y = e.Cartesian3.subtract(f,
|
|
5517
|
+
const M = e.Cartesian3.distance(u, v), x = e.Cartesian3.distance(v, f), I = e.Cartesian3.distance(u, f), D = new e.Cartesian3((u.x + v.x) / 2, (u.y + v.y) / 2, (u.z + v.z) / 2), T = new e.Cartesian3((v.x + f.x) / 2, (v.y + f.y) / 2, (v.z + f.z) / 2), S = new e.Cartesian3((u.x + f.x) / 2, (u.y + f.y) / 2, (u.z + f.z) / 2), _ = e.Cartographic.fromCartesian(D), k = e.Cartographic.fromCartesian(T), A = e.Cartographic.fromCartesian(S), R = "measure_triangle_seg_v", $ = "measure_triangle_seg_h", B = "measure_triangle_seg_hyp";
|
|
5518
|
+
this.segmentLabelIds = [R, $, B], this.htmlLabelPool.add({ text: `${M.toFixed(2)} m` }, { id: R, 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: `${x.toFixed(2)} m` }, { id: $, 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: `${I.toFixed(2)} m` }, { id: B, 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" } });
|
|
5519
|
+
const Y = e.Cartesian3.subtract(f, u, new e.Cartesian3()), N = e.Cartesian3.subtract(v, u, new e.Cartesian3()), z = e.Cartesian3.subtract(v, f, new e.Cartesian3()), V = e.Cartesian3.subtract(u, f, new e.Cartesian3()), se = e.Cartesian3.dot(Y, N), pe = Math.sqrt(e.Cartesian3.dot(Y, Y)) * Math.sqrt(e.Cartesian3.dot(N, N)), me = e.Cartesian3.dot(z, V), Ce = Math.sqrt(e.Cartesian3.dot(z, z)) * Math.sqrt(e.Cartesian3.dot(V, V)), j = Math.acos(Math.min(Math.max(se / (pe || 1), -1), 1)), le = Math.acos(Math.min(Math.max(me / (Ce || 1), -1), 1)), ee = e.Cartographic.fromCartesian(u), W = e.Cartographic.fromCartesian(f), Z = "measure_triangle_angle_a", ne = "measure_triangle_angle_b";
|
|
5451
5520
|
this.angleLabelIds = [Z, ne], this.htmlLabelPool.add({ text: `${(j * 180 / Math.PI).toFixed(2)}°` }, { id: Z, lon: e.Math.toDegrees(ee.longitude), lat: e.Math.toDegrees(ee.latitude), height: ee.height || 0, theme: "measure-triangle-angle", show: !0, style: { pointerEvents: "none", userSelect: "none", cursor: "default" } }), this.htmlLabelPool.add({ text: `${(le * 180 / Math.PI).toFixed(2)}°` }, { id: ne, lon: e.Math.toDegrees(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" } });
|
|
5452
5521
|
const ge = Math.max(0.01, Math.min(0.5, t.angleMarkerRatio ?? 0.2)), U = Math.min(M, x) * ge;
|
|
5453
5522
|
if (M > 1e-3 && x > 1e-3) {
|
|
5454
5523
|
const q = e.Cartesian3.normalize(
|
|
5455
|
-
e.Cartesian3.subtract(
|
|
5524
|
+
e.Cartesian3.subtract(u, v, new e.Cartesian3()),
|
|
5456
5525
|
new e.Cartesian3()
|
|
5457
5526
|
), oe = e.Cartesian3.normalize(
|
|
5458
5527
|
e.Cartesian3.subtract(f, v, new e.Cartesian3()),
|
|
@@ -5461,7 +5530,7 @@ class ft {
|
|
|
5461
5530
|
v.x + q.x * U,
|
|
5462
5531
|
v.y + q.y * U,
|
|
5463
5532
|
v.z + q.z * U
|
|
5464
|
-
),
|
|
5533
|
+
), H = new e.Cartesian3(
|
|
5465
5534
|
v.x + oe.x * U,
|
|
5466
5535
|
v.y + oe.y * U,
|
|
5467
5536
|
v.z + oe.z * U
|
|
@@ -5478,7 +5547,7 @@ class ft {
|
|
|
5478
5547
|
}
|
|
5479
5548
|
}), Te = i.entities.add({
|
|
5480
5549
|
polyline: {
|
|
5481
|
-
positions: [
|
|
5550
|
+
positions: [H, X],
|
|
5482
5551
|
width: t.width || 3,
|
|
5483
5552
|
material: P,
|
|
5484
5553
|
depthFailMaterial: new e.PolylineDashMaterialProperty({ color: b, dashLength: 12, dashPattern: 255 })
|
|
@@ -5489,7 +5558,7 @@ class ft {
|
|
|
5489
5558
|
this.previewLabelId && this.htmlLabelPool && (this.htmlLabelPool.removeByIds([this.previewLabelId]), this.previewLabelId = null);
|
|
5490
5559
|
const K = {
|
|
5491
5560
|
entity: this.segmentEntities,
|
|
5492
|
-
positions: [
|
|
5561
|
+
positions: [u, f, v],
|
|
5493
5562
|
lengths: { vertical: M, horizontal: x, hypotenuse: I },
|
|
5494
5563
|
angles: { acuteA: j, acuteB: le },
|
|
5495
5564
|
clear: () => this.clear()
|
|
@@ -5501,12 +5570,12 @@ class ft {
|
|
|
5501
5570
|
if (this.positions.length !== 1) return;
|
|
5502
5571
|
const s = i.scene.pickPosition(n.endPosition);
|
|
5503
5572
|
if (!s) return;
|
|
5504
|
-
const o = e.Cartographic.fromCartesian(this.positions[0]), r = e.Cartographic.fromCartesian(s), a = o.height || 0, l = r.height || 0, d = a <= l ? this.positions[0] : s,
|
|
5573
|
+
const o = e.Cartographic.fromCartesian(this.positions[0]), r = e.Cartographic.fromCartesian(s), a = o.height || 0, l = r.height || 0, d = a <= l ? this.positions[0] : s, p = a > l ? this.positions[0] : s, g = e.Cartographic.fromCartesian(d), m = Math.max(a, l), u = e.Cartesian3.fromDegrees(
|
|
5505
5574
|
this.Cesium.Math.toDegrees(g.longitude),
|
|
5506
5575
|
this.Cesium.Math.toDegrees(g.latitude),
|
|
5507
|
-
|
|
5576
|
+
m
|
|
5508
5577
|
);
|
|
5509
|
-
this.previewLow = d, this.previewHigh =
|
|
5578
|
+
this.previewLow = d, this.previewHigh = p, this.previewThird = u;
|
|
5510
5579
|
const f = t.lineColor || t.color || e.Color.YELLOW, y = ((ee = (le = t.dashLineColor || t.lineColor || t.color || e.Color.RED).withAlpha) == null ? void 0 : ee.call(le, 0.9)) || e.Color.RED;
|
|
5511
5580
|
if (this.previewPointEntity ? this.previewPointEntity.position = s : this.previewPointEntity = i.entities.add({
|
|
5512
5581
|
position: s,
|
|
@@ -5540,28 +5609,28 @@ class ft {
|
|
|
5540
5609
|
});
|
|
5541
5610
|
this.previewSegmentEntities.push(W, Z, ne);
|
|
5542
5611
|
}
|
|
5543
|
-
const w = e.Cartesian3.distance(d,
|
|
5544
|
-
this.segmentLabelIds.length === 0 && (this.segmentLabelIds = [z, V, se]), this.angleLabelIds.length === 0 && (this.angleLabelIds = [pe, me]), this.htmlLabelPool.add({ text: `${w.toFixed(2)} m` }, { id: z, lon: e.Math.toDegrees(R.longitude), lat: e.Math.toDegrees(R.latitude), height: R.height || 0, theme: "measure-triangle-seg", show: !0, style: { pointerEvents: "none", userSelect: "none", cursor: "default" } }), this.htmlLabelPool.add({ text: `${v.toFixed(2)} m` }, { id: V, lon: e.Math.toDegrees(
|
|
5612
|
+
const w = e.Cartesian3.distance(d, u), v = e.Cartesian3.distance(u, p), P = e.Cartesian3.distance(d, p), b = e.Cartesian3.subtract(p, d, new e.Cartesian3()), C = e.Cartesian3.subtract(u, d, new e.Cartesian3()), L = e.Cartesian3.subtract(u, p, new e.Cartesian3()), E = e.Cartesian3.subtract(d, p, new e.Cartesian3()), M = e.Cartesian3.dot(b, C), x = Math.sqrt(e.Cartesian3.dot(b, b)) * Math.sqrt(e.Cartesian3.dot(C, C)), I = e.Cartesian3.dot(L, E), D = Math.sqrt(e.Cartesian3.dot(L, L)) * Math.sqrt(e.Cartesian3.dot(E, E)), T = Math.acos(Math.min(Math.max(M / (x || 1), -1), 1)), S = Math.acos(Math.min(Math.max(I / (D || 1), -1), 1)), _ = new e.Cartesian3((d.x + u.x) / 2, (d.y + u.y) / 2, (d.z + u.z) / 2), k = new e.Cartesian3((u.x + p.x) / 2, (u.y + p.y) / 2, (u.z + p.z) / 2), A = new e.Cartesian3((d.x + p.x) / 2, (d.y + p.y) / 2, (d.z + p.z) / 2), R = e.Cartographic.fromCartesian(_), $ = e.Cartographic.fromCartesian(k), B = e.Cartographic.fromCartesian(A), Y = e.Cartographic.fromCartesian(d), N = e.Cartographic.fromCartesian(p), z = "measure_triangle_seg_v", V = "measure_triangle_seg_h", se = "measure_triangle_seg_hyp", pe = "measure_triangle_angle_a", me = "measure_triangle_angle_b";
|
|
5613
|
+
this.segmentLabelIds.length === 0 && (this.segmentLabelIds = [z, V, se]), this.angleLabelIds.length === 0 && (this.angleLabelIds = [pe, me]), this.htmlLabelPool.add({ text: `${w.toFixed(2)} m` }, { id: z, lon: e.Math.toDegrees(R.longitude), lat: e.Math.toDegrees(R.latitude), height: R.height || 0, theme: "measure-triangle-seg", show: !0, style: { pointerEvents: "none", userSelect: "none", cursor: "default" } }), this.htmlLabelPool.add({ text: `${v.toFixed(2)} m` }, { id: V, 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: `${P.toFixed(2)} m` }, { id: se, lon: e.Math.toDegrees(B.longitude), lat: e.Math.toDegrees(B.latitude), height: B.height || 0, theme: "measure-triangle-seg", show: !0, style: { pointerEvents: "none", userSelect: "none", cursor: "default" } }), this.htmlLabelPool.add({ text: `${(T * 180 / Math.PI).toFixed(2)}°` }, { id: pe, lon: e.Math.toDegrees(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: `${(S * 180 / Math.PI).toFixed(2)}°` }, { id: me, lon: e.Math.toDegrees(N.longitude), lat: e.Math.toDegrees(N.latitude), height: N.height || 0, theme: "measure-triangle-angle", show: !0, style: { pointerEvents: "none", userSelect: "none", cursor: "default" } });
|
|
5545
5614
|
const Ce = Math.max(0.01, Math.min(0.5, t.angleMarkerRatio ?? 0.2)), j = Math.min(w, v) * Ce;
|
|
5546
5615
|
if (w > 1e-3 && v > 1e-3) {
|
|
5547
5616
|
const W = e.Cartesian3.normalize(
|
|
5548
|
-
e.Cartesian3.subtract(d,
|
|
5617
|
+
e.Cartesian3.subtract(d, u, new e.Cartesian3()),
|
|
5549
5618
|
new e.Cartesian3()
|
|
5550
5619
|
), Z = e.Cartesian3.normalize(
|
|
5551
|
-
e.Cartesian3.subtract(
|
|
5620
|
+
e.Cartesian3.subtract(p, u, new e.Cartesian3()),
|
|
5552
5621
|
new e.Cartesian3()
|
|
5553
5622
|
), ne = new e.Cartesian3(
|
|
5554
|
-
|
|
5555
|
-
|
|
5556
|
-
|
|
5623
|
+
u.x + W.x * j,
|
|
5624
|
+
u.y + W.y * j,
|
|
5625
|
+
u.z + W.z * j
|
|
5557
5626
|
), ge = new e.Cartesian3(
|
|
5558
|
-
|
|
5559
|
-
|
|
5560
|
-
|
|
5627
|
+
u.x + Z.x * j,
|
|
5628
|
+
u.y + Z.y * j,
|
|
5629
|
+
u.z + Z.z * j
|
|
5561
5630
|
), U = new e.Cartesian3(
|
|
5562
|
-
|
|
5563
|
-
|
|
5564
|
-
|
|
5631
|
+
u.x + W.x * j + Z.x * j,
|
|
5632
|
+
u.y + W.y * j + Z.y * j,
|
|
5633
|
+
u.z + W.z * j + Z.z * j
|
|
5565
5634
|
);
|
|
5566
5635
|
if (this.previewMarkerP1 = ne, this.previewMarkerP2 = ge, this.previewMarkerCorner = U, !this.previewAngleMarkerEntities.length) {
|
|
5567
5636
|
const K = i.entities.add({
|
|
@@ -5597,46 +5666,46 @@ class ft {
|
|
|
5597
5666
|
if (!this.htmlLabelPool) {
|
|
5598
5667
|
const J = s.overlayContainerId || "html-label-container";
|
|
5599
5668
|
this.htmlLabelPool = e || new G(i, n, J), this.htmlLabelPool.registerTheme("measure-triangle", {
|
|
5600
|
-
createElement: (
|
|
5669
|
+
createElement: (H, X) => {
|
|
5601
5670
|
var Q;
|
|
5602
|
-
|
|
5671
|
+
H.innerHTML = String(((Q = X == null ? void 0 : X.data) == null ? void 0 : Q.text) || ""), H.style.background = "rgba(0,0,0,0.6)", H.style.color = "#fff", H.style.font = "14px sans-serif", H.style.padding = "4px 6px", H.style.borderRadius = "4px", H.style.whiteSpace = "pre";
|
|
5603
5672
|
},
|
|
5604
5673
|
options: { offset: { x: 0, y: -10 } }
|
|
5605
5674
|
}), this.htmlLabelPool.registerTheme("measure-triangle-seg", {
|
|
5606
|
-
createElement: (
|
|
5675
|
+
createElement: (H, X) => {
|
|
5607
5676
|
var Q;
|
|
5608
|
-
|
|
5677
|
+
H.innerHTML = String(((Q = X == null ? void 0 : X.data) == null ? void 0 : Q.text) || ""), H.style.background = "rgba(0,0,0,0.6)", H.style.color = "#fff", H.style.font = "14px sans-serif", H.style.padding = "4px 6px", H.style.borderRadius = "4px", H.style.whiteSpace = "pre";
|
|
5609
5678
|
},
|
|
5610
5679
|
options: { offset: { x: 0, y: -10 } }
|
|
5611
5680
|
}), this.htmlLabelPool.registerTheme("measure-triangle-angle", {
|
|
5612
|
-
createElement: (
|
|
5681
|
+
createElement: (H, X) => {
|
|
5613
5682
|
var Q;
|
|
5614
|
-
|
|
5683
|
+
H.innerHTML = String(((Q = X == null ? void 0 : X.data) == null ? void 0 : Q.text) || ""), H.style.background = "rgba(0,0,0,0.6)", H.style.color = "#fff", H.style.font = "14px sans-serif", H.style.padding = "4px 6px", H.style.borderRadius = "4px", H.style.whiteSpace = "pre";
|
|
5615
5684
|
},
|
|
5616
5685
|
options: { offset: { x: 0, y: -10 } }
|
|
5617
5686
|
});
|
|
5618
5687
|
}
|
|
5619
|
-
const d = i.Cartographic.fromCartesian(l[0]),
|
|
5688
|
+
const d = i.Cartographic.fromCartesian(l[0]), p = i.Cartographic.fromCartesian(l[1]), g = d.height || 0, m = p.height || 0, u = g <= m ? l[0] : l[1], f = g > m ? l[0] : l[1], y = n.entities.add({ position: u, point: { pixelSize: 8, color: s.pointColor || s.color || i.Color.YELLOW, disableDepthTestDistance: Number.POSITIVE_INFINITY } }), w = n.entities.add({ position: f, point: { pixelSize: 8, color: s.pointColor || s.color || i.Color.YELLOW, disableDepthTestDistance: Number.POSITIVE_INFINITY } });
|
|
5620
5689
|
this.pointEntities.push(y, w);
|
|
5621
|
-
const v = i.Cartographic.fromCartesian(
|
|
5690
|
+
const v = i.Cartographic.fromCartesian(u), P = Math.max(g, m), b = i.Cartesian3.fromDegrees(
|
|
5622
5691
|
i.Math.toDegrees(v.longitude),
|
|
5623
5692
|
i.Math.toDegrees(v.latitude),
|
|
5624
5693
|
P
|
|
5625
5694
|
), C = n.entities.add({
|
|
5626
|
-
polyline: { positions: [
|
|
5695
|
+
polyline: { positions: [u, b], width: a, material: o, depthFailMaterial: new i.PolylineDashMaterialProperty({ color: r, dashLength: 12, dashPattern: 255 }) }
|
|
5627
5696
|
}), L = n.entities.add({
|
|
5628
5697
|
polyline: { positions: [b, f], width: a, material: o, depthFailMaterial: new i.PolylineDashMaterialProperty({ color: r, dashLength: 12, dashPattern: 255 }) }
|
|
5629
5698
|
}), E = n.entities.add({
|
|
5630
|
-
polyline: { positions: [
|
|
5699
|
+
polyline: { positions: [u, f], width: a, material: o, depthFailMaterial: new i.PolylineDashMaterialProperty({ color: r, dashLength: 12, dashPattern: 255 }) }
|
|
5631
5700
|
});
|
|
5632
5701
|
this.segmentEntities.push(C, L, E);
|
|
5633
|
-
const M = i.Cartesian3.distance(
|
|
5634
|
-
this.segmentLabelIds = [R,
|
|
5635
|
-
const Y = i.Cartesian3.subtract(f,
|
|
5702
|
+
const M = i.Cartesian3.distance(u, b), x = i.Cartesian3.distance(b, f), I = i.Cartesian3.distance(u, f), D = new i.Cartesian3((u.x + b.x) / 2, (u.y + b.y) / 2, (u.z + b.z) / 2), T = new i.Cartesian3((b.x + f.x) / 2, (b.y + f.y) / 2, (b.z + f.z) / 2), S = new i.Cartesian3((u.x + f.x) / 2, (u.y + f.y) / 2, (u.z + f.z) / 2), _ = i.Cartographic.fromCartesian(D), k = i.Cartographic.fromCartesian(T), A = i.Cartographic.fromCartesian(S), R = t.id + "_tri_v", $ = t.id + "_tri_h", B = t.id + "_tri_hyp";
|
|
5703
|
+
this.segmentLabelIds = [R, $, B], this.htmlLabelPool.add({ text: `${M.toFixed(2)} m` }, { id: R, lon: i.Math.toDegrees(_.longitude), lat: i.Math.toDegrees(_.latitude), height: _.height || 0, theme: "measure-triangle-seg", show: !0, style: { pointerEvents: "none", userSelect: "none", cursor: "default" } }), this.htmlLabelPool.add({ text: `${x.toFixed(2)} m` }, { id: $, lon: i.Math.toDegrees(k.longitude), lat: i.Math.toDegrees(k.latitude), height: k.height || 0, theme: "measure-triangle-seg", show: !0, style: { pointerEvents: "none", userSelect: "none", cursor: "default" } }), this.htmlLabelPool.add({ text: `${I.toFixed(2)} m` }, { id: B, 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" } });
|
|
5704
|
+
const Y = i.Cartesian3.subtract(f, u, new i.Cartesian3()), N = i.Cartesian3.subtract(b, u, new i.Cartesian3()), z = i.Cartesian3.subtract(b, f, new i.Cartesian3()), V = i.Cartesian3.subtract(u, f, new i.Cartesian3()), se = i.Cartesian3.dot(Y, N), pe = Math.sqrt(i.Cartesian3.dot(Y, Y)) * Math.sqrt(i.Cartesian3.dot(N, N)), me = i.Cartesian3.dot(z, V), Ce = Math.sqrt(i.Cartesian3.dot(z, z)) * Math.sqrt(i.Cartesian3.dot(V, V)), j = Math.acos(Math.min(Math.max(se / (pe || 1), -1), 1)), le = Math.acos(Math.min(Math.max(me / (Ce || 1), -1), 1)), ee = i.Cartographic.fromCartesian(u), W = i.Cartographic.fromCartesian(f), Z = s.labelText || { angle: "角度" }, ne = t.id + "_tri_angA", ge = t.id + "_tri_angB";
|
|
5636
5705
|
this.angleLabelIds = [ne, ge], this.htmlLabelPool.add({ text: `${Z.angle}:${(j * 180 / Math.PI).toFixed(2)}°` }, { id: ne, lon: i.Math.toDegrees(ee.longitude), lat: i.Math.toDegrees(ee.latitude), height: ee.height || 0, theme: "measure-triangle-angle", show: !0, style: { pointerEvents: "none", userSelect: "none", cursor: "default" } }), this.htmlLabelPool.add({ text: `${Z.angle}:${(le * 180 / Math.PI).toFixed(2)}°` }, { id: ge, 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" } });
|
|
5637
5706
|
const U = Math.max(0.01, Math.min(0.5, s.angleMarkerRatio ?? 0.2)), K = Math.min(M, x) * U;
|
|
5638
5707
|
if (M > 1e-3 && x > 1e-3) {
|
|
5639
|
-
const J = i.Cartesian3.normalize(i.Cartesian3.subtract(
|
|
5708
|
+
const J = i.Cartesian3.normalize(i.Cartesian3.subtract(u, b, new i.Cartesian3()), new i.Cartesian3()), H = i.Cartesian3.normalize(i.Cartesian3.subtract(f, b, new i.Cartesian3()), new i.Cartesian3()), X = new i.Cartesian3(b.x + J.x * K, b.y + J.y * K, b.z + J.z * K), Q = new i.Cartesian3(b.x + H.x * K, b.y + H.y * K, b.z + H.z * K), Te = new i.Cartesian3(b.x + J.x * K + H.x * K, b.y + J.y * K + H.y * K, b.z + J.z * K + H.z * K), Ft = n.entities.add({ polyline: { positions: [X, Te], width: a, material: o, depthFailMaterial: new i.PolylineDashMaterialProperty({ color: r, dashLength: 12, dashPattern: 255 }) } }), Nt = n.entities.add({ polyline: { positions: [Q, Te], width: a, material: o, depthFailMaterial: new i.PolylineDashMaterialProperty({ color: r, dashLength: 12, dashPattern: 255 }) } });
|
|
5640
5709
|
this.angleMarkerEntities.push(Ft, Nt);
|
|
5641
5710
|
}
|
|
5642
5711
|
}
|
|
@@ -5685,22 +5754,22 @@ class yt {
|
|
|
5685
5754
|
});
|
|
5686
5755
|
if (this.tempPoints.push(o), this.positions.length === 2) {
|
|
5687
5756
|
this.stop(), this.previewEntity && (this.viewer.entities.remove(this.previewEntity), this.previewEntity = null), this.previewLabelId && this.htmlLabelPool && (this.htmlLabelPool.removeByIds([this.previewLabelId]), this.previewLabelId = null);
|
|
5688
|
-
const d = this.positions[0],
|
|
5757
|
+
const d = this.positions[0], p = this.positions[1], g = t.lineColor || t.color || e.Color.YELLOW, m = ((a = (r = t.dashLineColor || t.lineColor || t.color || e.Color.RED).withAlpha) == null ? void 0 : a.call(r, 0.9)) || e.Color.RED;
|
|
5689
5758
|
this.entity = i.entities.add({
|
|
5690
5759
|
polyline: {
|
|
5691
|
-
positions: [d,
|
|
5760
|
+
positions: [d, p],
|
|
5692
5761
|
width: t.width || 3,
|
|
5693
5762
|
material: g,
|
|
5694
5763
|
depthFailMaterial: new e.PolylineDashMaterialProperty({
|
|
5695
|
-
color:
|
|
5764
|
+
color: m,
|
|
5696
5765
|
dashLength: 12,
|
|
5697
5766
|
dashPattern: 255
|
|
5698
5767
|
})
|
|
5699
5768
|
}
|
|
5700
5769
|
});
|
|
5701
|
-
const
|
|
5770
|
+
const u = e.Cartesian3.distance(d, p), f = p, y = e.Cartographic.fromCartesian(f), w = this.htmlLabelId || `measure_space_${Date.now()}`;
|
|
5702
5771
|
this.htmlLabelId = w, this.htmlLabelPool.add(
|
|
5703
|
-
{ text: `${
|
|
5772
|
+
{ text: `${u.toFixed(2)} m` },
|
|
5704
5773
|
{
|
|
5705
5774
|
id: w,
|
|
5706
5775
|
lon: e.Math.toDegrees(y.longitude),
|
|
@@ -5715,13 +5784,13 @@ class yt {
|
|
|
5715
5784
|
entity: this.entity,
|
|
5716
5785
|
label: this.labelEntity,
|
|
5717
5786
|
positions: this.positions,
|
|
5718
|
-
distance:
|
|
5787
|
+
distance: u,
|
|
5719
5788
|
clear: () => this.clear()
|
|
5720
5789
|
};
|
|
5721
5790
|
(l = t.onComplete) == null || l.call(t, v);
|
|
5722
5791
|
}
|
|
5723
5792
|
}, e.ScreenSpaceEventType.LEFT_CLICK), this.handler.setInputAction((n) => {
|
|
5724
|
-
var
|
|
5793
|
+
var m, u;
|
|
5725
5794
|
if (this.positions.length !== 1) return;
|
|
5726
5795
|
const s = i.scene.pickPosition(n.endPosition);
|
|
5727
5796
|
if (!s) return;
|
|
@@ -5743,12 +5812,12 @@ class yt {
|
|
|
5743
5812
|
style: { pointerEvents: "none", userSelect: "none", cursor: "default" }
|
|
5744
5813
|
}
|
|
5745
5814
|
);
|
|
5746
|
-
const
|
|
5815
|
+
const p = t.lineColor || t.color || e.Color.YELLOW, g = ((u = (m = t.dashLineColor || t.lineColor || t.color || e.Color.RED).withAlpha) == null ? void 0 : u.call(m, 0.9)) || e.Color.RED;
|
|
5747
5816
|
this.previewEntity || (this.previewEntity = i.entities.add({
|
|
5748
5817
|
polyline: {
|
|
5749
5818
|
positions: new e.CallbackProperty(() => !this.previewPos || !this.positions.length ? [] : [this.positions[0], this.previewPos], !1),
|
|
5750
5819
|
width: t.width || 3,
|
|
5751
|
-
material:
|
|
5820
|
+
material: p,
|
|
5752
5821
|
depthFailMaterial: new e.PolylineDashMaterialProperty({
|
|
5753
5822
|
color: g,
|
|
5754
5823
|
dashLength: 12,
|
|
@@ -5765,15 +5834,15 @@ class yt {
|
|
|
5765
5834
|
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.htmlLabelPool && this.htmlLabelId && (this.htmlLabelPool.removeByIds([this.htmlLabelId]), this.htmlLabelId = null), this.previewEntity && (this.viewer.entities.remove(this.previewEntity), this.previewEntity = null), this.previewLabelId && this.htmlLabelPool && (this.htmlLabelPool.removeByIds([this.previewLabelId]), this.previewLabelId = null), this.tempPoints.forEach((t) => this.viewer.entities.remove(t)), this.tempPoints = [], this.positions = [];
|
|
5766
5835
|
}
|
|
5767
5836
|
rehydrate(t, e) {
|
|
5768
|
-
var d,
|
|
5769
|
-
const i = this.Cesium, n = this.viewer, s = t.options || {}, o = s.lineColor || s.color || i.Color.YELLOW, r = ((
|
|
5837
|
+
var d, p;
|
|
5838
|
+
const i = this.Cesium, n = this.viewer, s = t.options || {}, o = s.lineColor || s.color || i.Color.YELLOW, r = ((p = (d = s.dashLineColor || s.lineColor || s.color || i.Color.RED).withAlpha) == null ? void 0 : p.call(d, 0.9)) || i.Color.RED, a = s.width || 3, l = (t.positions || []).map((g) => new i.Cartesian3(g[0], g[1], g[2]));
|
|
5770
5839
|
if (l.length) {
|
|
5771
5840
|
if (!this.htmlLabelPool) {
|
|
5772
5841
|
const g = s.overlayContainerId || "html-label-container";
|
|
5773
5842
|
this.htmlLabelPool = e || new G(i, n, g), this.htmlLabelPool.registerTheme("measure-space", {
|
|
5774
|
-
createElement: (
|
|
5843
|
+
createElement: (m, u) => {
|
|
5775
5844
|
var f;
|
|
5776
|
-
|
|
5845
|
+
m.innerHTML = String(((f = u == null ? void 0 : u.data) == null ? void 0 : f.text) || ""), m.style.background = "rgba(0,0,0,0.6)", m.style.color = "#fff", m.style.font = "14px sans-serif", m.style.padding = "4px 6px", m.style.borderRadius = "4px", m.style.whiteSpace = "pre";
|
|
5777
5846
|
},
|
|
5778
5847
|
options: { offset: { x: 0, y: -10 } }
|
|
5779
5848
|
});
|
|
@@ -5792,12 +5861,12 @@ class yt {
|
|
|
5792
5861
|
depthFailMaterial: new i.PolylineDashMaterialProperty({ color: r, dashLength: 12, dashPattern: 255 })
|
|
5793
5862
|
}
|
|
5794
5863
|
});
|
|
5795
|
-
const
|
|
5796
|
-
this.htmlLabelId = f, this.htmlLabelPool.add({ text: `${
|
|
5864
|
+
const m = i.Cartesian3.distance(l[0], l[1]), u = i.Cartographic.fromCartesian(l[1]), f = t.id + "_label";
|
|
5865
|
+
this.htmlLabelId = f, this.htmlLabelPool.add({ text: `${m.toFixed(2)} m` }, {
|
|
5797
5866
|
id: f,
|
|
5798
|
-
lon: i.Math.toDegrees(
|
|
5799
|
-
lat: i.Math.toDegrees(
|
|
5800
|
-
height:
|
|
5867
|
+
lon: i.Math.toDegrees(u.longitude),
|
|
5868
|
+
lat: i.Math.toDegrees(u.latitude),
|
|
5869
|
+
height: u.height || 0,
|
|
5801
5870
|
theme: "measure-space",
|
|
5802
5871
|
show: !0,
|
|
5803
5872
|
style: { pointerEvents: "none", userSelect: "none", cursor: "default" }
|
|
@@ -5806,7 +5875,7 @@ class yt {
|
|
|
5806
5875
|
}
|
|
5807
5876
|
}
|
|
5808
5877
|
}
|
|
5809
|
-
const
|
|
5878
|
+
const He = class He {
|
|
5810
5879
|
constructor(t, e) {
|
|
5811
5880
|
c(this, "Cesium");
|
|
5812
5881
|
c(this, "viewer");
|
|
@@ -5857,8 +5926,8 @@ const $e = class $e {
|
|
|
5857
5926
|
options: { offset: { x: 0, y: -10 } }
|
|
5858
5927
|
});
|
|
5859
5928
|
}
|
|
5860
|
-
this.tooltip = new ce(), this.tooltip.show(
|
|
5861
|
-
var g,
|
|
5929
|
+
this.tooltip = new ce(), this.tooltip.show(He.TIP_TEXT), this._bindGlobalEvents(t, e, i), this.handler = new e.ScreenSpaceEventHandler(i.canvas), this.handler.setInputAction((n) => {
|
|
5930
|
+
var g, m;
|
|
5862
5931
|
const s = i.scene.pickPosition(n.position);
|
|
5863
5932
|
if (!s) return;
|
|
5864
5933
|
this.positions.push(s);
|
|
@@ -5876,7 +5945,7 @@ const $e = class $e {
|
|
|
5876
5945
|
vertexFormat: e.MaterialAppearance.VERTEX_FORMAT,
|
|
5877
5946
|
perPositionHeight: !0,
|
|
5878
5947
|
arcType: e.ArcType.NONE
|
|
5879
|
-
}), l = new e.GeometryInstance({ geometry: a }), d = t.color || e.Color.YELLOW.withAlpha(0.4),
|
|
5948
|
+
}), l = new e.GeometryInstance({ geometry: a }), d = 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);
|
|
5880
5949
|
if (this.primitive = new e.Primitive({
|
|
5881
5950
|
geometryInstances: l,
|
|
5882
5951
|
appearance: new e.MaterialAppearance({
|
|
@@ -5885,7 +5954,7 @@ const $e = class $e {
|
|
|
5885
5954
|
closed: !0
|
|
5886
5955
|
}),
|
|
5887
5956
|
depthFailAppearance: new e.MaterialAppearance({
|
|
5888
|
-
material: e.Material.fromType("Color", { color:
|
|
5957
|
+
material: e.Material.fromType("Color", { color: p }),
|
|
5889
5958
|
translucent: !0,
|
|
5890
5959
|
closed: !0
|
|
5891
5960
|
})
|
|
@@ -5898,11 +5967,11 @@ const $e = class $e {
|
|
|
5898
5967
|
}
|
|
5899
5968
|
this.edgeEntities = [];
|
|
5900
5969
|
}
|
|
5901
|
-
const
|
|
5970
|
+
const u = t.lineColor || t.color || e.Color.YELLOW, f = ((m = (g = t.dashLineColor || t.lineColor || t.color || e.Color.RED).withAlpha) == null ? void 0 : m.call(g, 0.9)) || e.Color.RED, y = this.positions.concat([this.positions[0]]), w = i.entities.add({
|
|
5902
5971
|
polyline: {
|
|
5903
5972
|
positions: y,
|
|
5904
5973
|
width: t.width || 2,
|
|
5905
|
-
material:
|
|
5974
|
+
material: u,
|
|
5906
5975
|
clampToGround: !1,
|
|
5907
5976
|
arcType: e.ArcType.NONE,
|
|
5908
5977
|
depthFailMaterial: new e.PolylineDashMaterialProperty({
|
|
@@ -5915,7 +5984,7 @@ const $e = class $e {
|
|
|
5915
5984
|
this.edgeEntities.push(w);
|
|
5916
5985
|
}
|
|
5917
5986
|
}, e.ScreenSpaceEventType.LEFT_CLICK), this.handler.setInputAction((n) => {
|
|
5918
|
-
var
|
|
5987
|
+
var u, f;
|
|
5919
5988
|
if (this.positions.length === 0) return;
|
|
5920
5989
|
const s = i.scene.pickPosition(n.endPosition);
|
|
5921
5990
|
if (!s) return;
|
|
@@ -5931,16 +6000,16 @@ const $e = class $e {
|
|
|
5931
6000
|
d += l[y].x * l[w].y - l[w].x * l[y].y;
|
|
5932
6001
|
}
|
|
5933
6002
|
d = Math.abs(d) / 2;
|
|
5934
|
-
const
|
|
6003
|
+
const p = e.Cartographic.fromCartesian(r), g = this.previewLabelId || "measure_area_preview";
|
|
5935
6004
|
this.previewLabelId = g;
|
|
5936
|
-
const
|
|
6005
|
+
const m = t.labelText || { area: "面积" };
|
|
5937
6006
|
if (this.htmlLabelPool.add(
|
|
5938
|
-
{ text: `${
|
|
6007
|
+
{ text: `${m.area}:${d.toFixed(2)} m²` },
|
|
5939
6008
|
{
|
|
5940
6009
|
id: g,
|
|
5941
|
-
lon: e.Math.toDegrees(
|
|
5942
|
-
lat: e.Math.toDegrees(
|
|
5943
|
-
height:
|
|
6010
|
+
lon: e.Math.toDegrees(p.longitude),
|
|
6011
|
+
lat: e.Math.toDegrees(p.latitude),
|
|
6012
|
+
height: p.height || 0,
|
|
5944
6013
|
theme: "measure-area",
|
|
5945
6014
|
show: !0
|
|
5946
6015
|
}
|
|
@@ -5958,7 +6027,7 @@ const $e = class $e {
|
|
|
5958
6027
|
arcType: e.ArcType.NONE
|
|
5959
6028
|
}
|
|
5960
6029
|
});
|
|
5961
|
-
const w = t.lineColor || t.color || e.Color.YELLOW, v = ((f = (
|
|
6030
|
+
const w = t.lineColor || t.color || e.Color.YELLOW, v = ((f = (u = t.dashLineColor || t.lineColor || t.color || e.Color.RED).withAlpha) == null ? void 0 : f.call(u, 0.9)) || e.Color.RED;
|
|
5962
6031
|
this.previewEdgeEntity = i.entities.add({
|
|
5963
6032
|
polyline: {
|
|
5964
6033
|
positions: new e.CallbackProperty(() => !this.previewPos || !this.positions.length ? [] : this.positions.concat([this.previewPos, this.positions[0]]), !1),
|
|
@@ -6033,9 +6102,9 @@ const $e = class $e {
|
|
|
6033
6102
|
_rebuildShape(t, e, i) {
|
|
6034
6103
|
var l, d;
|
|
6035
6104
|
if (this.primitive && (i.scene.primitives.remove(this.primitive), this.primitive = null), this.edgeEntities.length) {
|
|
6036
|
-
for (const
|
|
6105
|
+
for (const p of this.edgeEntities)
|
|
6037
6106
|
try {
|
|
6038
|
-
i.entities.remove(
|
|
6107
|
+
i.entities.remove(p);
|
|
6039
6108
|
} catch {
|
|
6040
6109
|
}
|
|
6041
6110
|
this.edgeEntities = [];
|
|
@@ -6060,11 +6129,11 @@ const $e = class $e {
|
|
|
6060
6129
|
closed: !0
|
|
6061
6130
|
})
|
|
6062
6131
|
}), i.scene.primitives.add(this.primitive), this.positions.length >= 2) {
|
|
6063
|
-
const
|
|
6132
|
+
const p = t.lineColor || t.color || e.Color.YELLOW, g = ((d = (l = t.dashLineColor || t.lineColor || t.color || e.Color.RED).withAlpha) == null ? void 0 : d.call(l, 0.9)) || e.Color.RED, m = this.positions.concat([this.positions[0]]), u = i.entities.add({
|
|
6064
6133
|
polyline: {
|
|
6065
|
-
positions:
|
|
6134
|
+
positions: m,
|
|
6066
6135
|
width: t.width || 2,
|
|
6067
|
-
material:
|
|
6136
|
+
material: p,
|
|
6068
6137
|
clampToGround: !1,
|
|
6069
6138
|
arcType: e.ArcType.NONE,
|
|
6070
6139
|
depthFailMaterial: new e.PolylineDashMaterialProperty({
|
|
@@ -6074,7 +6143,7 @@ const $e = class $e {
|
|
|
6074
6143
|
})
|
|
6075
6144
|
}
|
|
6076
6145
|
});
|
|
6077
|
-
this.edgeEntities.push(
|
|
6146
|
+
this.edgeEntities.push(u);
|
|
6078
6147
|
}
|
|
6079
6148
|
}
|
|
6080
6149
|
_undoLastPoint(t, e, i) {
|
|
@@ -6084,11 +6153,11 @@ const $e = class $e {
|
|
|
6084
6153
|
n && i.entities.remove(n), this._clearPreviewState(), this._rebuildShape(t, e, i);
|
|
6085
6154
|
}
|
|
6086
6155
|
_finishMeasurement(t, e, i) {
|
|
6087
|
-
var
|
|
6156
|
+
var m;
|
|
6088
6157
|
if (i && this.positions.length >= 3) {
|
|
6089
6158
|
this.positions.pop();
|
|
6090
|
-
const
|
|
6091
|
-
|
|
6159
|
+
const u = this.tempPoints.pop();
|
|
6160
|
+
u && this.viewer.entities.remove(u);
|
|
6092
6161
|
}
|
|
6093
6162
|
if (this.positions.length < 3) {
|
|
6094
6163
|
this.clear();
|
|
@@ -6096,14 +6165,14 @@ const $e = class $e {
|
|
|
6096
6165
|
}
|
|
6097
6166
|
this._clearPreviewState(), this.stop();
|
|
6098
6167
|
const n = new e.Cartesian3(
|
|
6099
|
-
this.positions.reduce((
|
|
6100
|
-
this.positions.reduce((
|
|
6101
|
-
this.positions.reduce((
|
|
6168
|
+
this.positions.reduce((u, f) => u + f.x, 0) / this.positions.length,
|
|
6169
|
+
this.positions.reduce((u, f) => u + f.y, 0) / this.positions.length,
|
|
6170
|
+
this.positions.reduce((u, f) => u + f.z, 0) / this.positions.length
|
|
6102
6171
|
), o = new e.EllipsoidTangentPlane(n, e.Ellipsoid.WGS84).projectPointsOntoPlane(this.positions);
|
|
6103
6172
|
let r = 0;
|
|
6104
|
-
for (let
|
|
6105
|
-
const f = (
|
|
6106
|
-
r += o[
|
|
6173
|
+
for (let u = 0; u < o.length; u++) {
|
|
6174
|
+
const f = (u + 1) % o.length;
|
|
6175
|
+
r += o[u].x * o[f].y - o[f].x * o[u].y;
|
|
6107
6176
|
}
|
|
6108
6177
|
r = Math.abs(r) / 2;
|
|
6109
6178
|
const a = e.Cartographic.fromCartesian(n), l = this.htmlLabelId || `measure_area_${Date.now()}`;
|
|
@@ -6120,8 +6189,8 @@ const $e = class $e {
|
|
|
6120
6189
|
show: !0
|
|
6121
6190
|
}
|
|
6122
6191
|
), this.labelEntity = this.htmlLabelId;
|
|
6123
|
-
for (let
|
|
6124
|
-
const f = (
|
|
6192
|
+
for (let u = 0; u < this.positions.length; u++) {
|
|
6193
|
+
const f = (u + 1) % this.positions.length, y = this.positions[u], w = this.positions[f], v = e.Cartographic.fromCartesian(y), P = e.Cartographic.fromCartesian(w), C = new e.EllipsoidGeodesic(v, P).surfaceDistance, L = new e.Cartesian3((y.x + w.x) / 2, (y.y + w.y) / 2, (y.z + w.z) / 2), E = e.Cartographic.fromCartesian(L), M = `measure_area_seg_${Date.now()}_${u}`;
|
|
6125
6194
|
this.segmentLabelIds.push(M), this.htmlLabelPool.add(
|
|
6126
6195
|
{ text: `${d.side}:${C.toFixed(2)} m` },
|
|
6127
6196
|
{
|
|
@@ -6134,11 +6203,11 @@ const $e = class $e {
|
|
|
6134
6203
|
}
|
|
6135
6204
|
);
|
|
6136
6205
|
}
|
|
6137
|
-
const
|
|
6138
|
-
for (let
|
|
6139
|
-
const f =
|
|
6206
|
+
const p = o;
|
|
6207
|
+
for (let u = 0; u < p.length; u++) {
|
|
6208
|
+
const f = p[(u - 1 + p.length) % p.length], y = p[u], w = p[(u + 1) % p.length], v = f.x - y.x, P = f.y - y.y, b = w.x - y.x, C = w.y - y.y, L = Math.sqrt(v * v + P * P), E = Math.sqrt(b * b + C * C);
|
|
6140
6209
|
if (!L || !E) continue;
|
|
6141
|
-
const M = v / L * (b / E) + P / L * (C / E), x = Math.acos(Math.min(1, Math.max(-1, M))) * (180 / Math.PI), I = e.Cartographic.fromCartesian(this.positions[
|
|
6210
|
+
const M = v / L * (b / E) + P / L * (C / E), x = Math.acos(Math.min(1, Math.max(-1, M))) * (180 / Math.PI), I = e.Cartographic.fromCartesian(this.positions[u]), D = `measure_area_angle_${Date.now()}_${u}`;
|
|
6142
6211
|
this.angleLabelIds.push(D), this.htmlLabelPool.add(
|
|
6143
6212
|
{ text: `${d.angle}:${x.toFixed(2)} °` },
|
|
6144
6213
|
{
|
|
@@ -6158,7 +6227,7 @@ const $e = class $e {
|
|
|
6158
6227
|
area: r,
|
|
6159
6228
|
clear: () => this.clear()
|
|
6160
6229
|
};
|
|
6161
|
-
(
|
|
6230
|
+
(m = t.onComplete) == null || m.call(t, g);
|
|
6162
6231
|
}
|
|
6163
6232
|
_bindGlobalEvents(t, e, i) {
|
|
6164
6233
|
this.keydownHandler = (n) => {
|
|
@@ -6207,18 +6276,18 @@ const $e = class $e {
|
|
|
6207
6276
|
d += l[C].x * l[L].y - l[L].x * l[C].y;
|
|
6208
6277
|
}
|
|
6209
6278
|
d = Math.abs(d) / 2;
|
|
6210
|
-
const
|
|
6279
|
+
const p = i.Cartographic.fromCartesian(r), g = t.id + "_area";
|
|
6211
6280
|
this.htmlLabelId = g;
|
|
6212
|
-
const
|
|
6213
|
-
this.htmlLabelPool.add({ text: `${
|
|
6281
|
+
const m = s.labelText || { area: "面积", side: "边长", angle: "角度" };
|
|
6282
|
+
this.htmlLabelPool.add({ text: `${m.area}:${d.toFixed(2)} m²` }, {
|
|
6214
6283
|
id: g,
|
|
6215
|
-
lon: i.Math.toDegrees(
|
|
6216
|
-
lat: i.Math.toDegrees(
|
|
6217
|
-
height:
|
|
6284
|
+
lon: i.Math.toDegrees(p.longitude),
|
|
6285
|
+
lat: i.Math.toDegrees(p.latitude),
|
|
6286
|
+
height: p.height || 0,
|
|
6218
6287
|
theme: "measure-area",
|
|
6219
6288
|
show: !0
|
|
6220
6289
|
});
|
|
6221
|
-
const
|
|
6290
|
+
const u = new i.PolygonHierarchy(o), f = new i.PolygonGeometry({ polygonHierarchy: u, vertexFormat: i.MaterialAppearance.VERTEX_FORMAT, perPositionHeight: !0 }), y = new i.GeometryInstance({ geometry: f }), w = 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), P = new i.Primitive({
|
|
6222
6291
|
geometryInstances: y,
|
|
6223
6292
|
appearance: new i.MaterialAppearance({ material: i.Material.fromType("Color", { color: w }), translucent: !0, closed: !0 }),
|
|
6224
6293
|
depthFailAppearance: new i.MaterialAppearance({ material: i.Material.fromType("Color", { color: v }), translucent: !0, closed: !0 })
|
|
@@ -6226,19 +6295,19 @@ const $e = class $e {
|
|
|
6226
6295
|
n.scene.primitives.add(P), this.primitive = P;
|
|
6227
6296
|
for (let C = 0; C < o.length; C++) {
|
|
6228
6297
|
const L = (C + 1) % o.length, E = o[C], M = o[L], x = i.Cartographic.fromCartesian(E), I = i.Cartographic.fromCartesian(M), T = new i.EllipsoidGeodesic(x, I).surfaceDistance, S = new i.Cartesian3((E.x + M.x) / 2, (E.y + M.y) / 2, (E.z + M.z) / 2), _ = i.Cartographic.fromCartesian(S), k = t.id + `_area_seg_${C}`;
|
|
6229
|
-
this.segmentLabelIds.push(k), this.htmlLabelPool.add({ text: `${
|
|
6298
|
+
this.segmentLabelIds.push(k), this.htmlLabelPool.add({ text: `${m.side}:${T.toFixed(2)} m` }, { id: k, lon: i.Math.toDegrees(_.longitude), lat: i.Math.toDegrees(_.latitude), height: _.height || 0, theme: "measure-area-seg", show: !0 });
|
|
6230
6299
|
}
|
|
6231
6300
|
const b = l;
|
|
6232
6301
|
for (let C = 0; C < b.length; C++) {
|
|
6233
6302
|
const L = b[(C - 1 + b.length) % b.length], E = b[C], M = b[(C + 1) % b.length], x = L.x - E.x, I = L.y - E.y, D = M.x - E.x, T = M.y - E.y, S = Math.sqrt(x * x + I * I), _ = Math.sqrt(D * D + T * T);
|
|
6234
6303
|
if (!S || !_) continue;
|
|
6235
|
-
const k = x / S * (D / _) + I / S * (T / _), A = Math.acos(Math.min(1, Math.max(-1, k))) * (180 / Math.PI), R = i.Cartographic.fromCartesian(o[C]),
|
|
6236
|
-
this.angleLabelIds.push(
|
|
6304
|
+
const k = x / S * (D / _) + I / S * (T / _), A = Math.acos(Math.min(1, Math.max(-1, k))) * (180 / Math.PI), R = i.Cartographic.fromCartesian(o[C]), $ = t.id + `_area_angle_${C}`;
|
|
6305
|
+
this.angleLabelIds.push($), this.htmlLabelPool.add({ text: `${m.angle}:${A.toFixed(2)} °` }, { id: $, lon: i.Math.toDegrees(R.longitude), lat: i.Math.toDegrees(R.latitude), height: R.height || 0, theme: "measure-area-angle", show: !0 });
|
|
6237
6306
|
}
|
|
6238
6307
|
}
|
|
6239
6308
|
};
|
|
6240
|
-
c(
|
|
6241
|
-
let Ae =
|
|
6309
|
+
c(He, "TIP_TEXT", "单击左键添加点,右键撤销,双击左键或Esc结束");
|
|
6310
|
+
let Ae = He;
|
|
6242
6311
|
class wt {
|
|
6243
6312
|
constructor(t, e) {
|
|
6244
6313
|
c(this, "Cesium");
|
|
@@ -6275,15 +6344,15 @@ class wt {
|
|
|
6275
6344
|
const s = i.scene.pickPosition(n.position);
|
|
6276
6345
|
if (s && (this.positions.push(s), this.positions.length === 2)) {
|
|
6277
6346
|
this.stop();
|
|
6278
|
-
const r = this.positions[0], a = this.positions[1], l = e.Cartesian3.distance(r, a), d = Math.PI * l * l,
|
|
6279
|
-
this.labelEntity ? (this.labelEntity.position =
|
|
6347
|
+
const r = this.positions[0], a = this.positions[1], l = e.Cartesian3.distance(r, a), d = Math.PI * l * l, p = 2 * Math.PI * l, g = t.labelText || { radius: "半径", area: "面积", circumference: "周长" }, m = r;
|
|
6348
|
+
this.labelEntity ? (this.labelEntity.position = m, this.labelEntity.label.text = `${g.radius}:${l.toFixed(2)} m
|
|
6280
6349
|
${g.area}:${d.toFixed(2)} m²
|
|
6281
|
-
${g.circumference}:${
|
|
6282
|
-
position:
|
|
6350
|
+
${g.circumference}:${p.toFixed(2)} m`) : this.labelEntity = i.entities.add({
|
|
6351
|
+
position: m,
|
|
6283
6352
|
label: {
|
|
6284
6353
|
text: `${g.radius}:${l.toFixed(2)} m
|
|
6285
6354
|
${g.area}:${d.toFixed(2)} m²
|
|
6286
|
-
${g.circumference}:${
|
|
6355
|
+
${g.circumference}:${p.toFixed(2)} m`,
|
|
6287
6356
|
font: "14px sans-serif",
|
|
6288
6357
|
fillColor: e.Color.WHITE,
|
|
6289
6358
|
outlineColor: e.Color.BLACK,
|
|
@@ -6298,11 +6367,11 @@ ${g.circumference}:${u.toFixed(2)} m`,
|
|
|
6298
6367
|
show: !1
|
|
6299
6368
|
}
|
|
6300
6369
|
}), this.previewEntity && (i.entities.remove(this.previewEntity), this.previewEntity = null);
|
|
6301
|
-
const
|
|
6370
|
+
const u = e.Cartographic.fromCartesian(r), f = new e.EllipseGeometry({
|
|
6302
6371
|
center: r,
|
|
6303
6372
|
semiMajorAxis: l,
|
|
6304
6373
|
semiMinorAxis: l,
|
|
6305
|
-
height:
|
|
6374
|
+
height: u.height || 0,
|
|
6306
6375
|
vertexFormat: e.MaterialAppearance.VERTEX_FORMAT
|
|
6307
6376
|
}), y = new e.GeometryInstance({ geometry: f }), w = 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);
|
|
6308
6377
|
this.ellipsePrimitive && (i.scene.primitives.remove(this.ellipsePrimitive), this.ellipsePrimitive = null), this.ellipsePrimitive = new e.Primitive({
|
|
@@ -6322,7 +6391,7 @@ ${g.circumference}:${u.toFixed(2)} m`,
|
|
|
6322
6391
|
this.htmlLabelId = E;
|
|
6323
6392
|
const M = `${g.radius}:${l.toFixed(2)} m
|
|
6324
6393
|
${g.area}:${d.toFixed(2)} m²
|
|
6325
|
-
${g.circumference}:${
|
|
6394
|
+
${g.circumference}:${p.toFixed(2)} m`;
|
|
6326
6395
|
this.htmlLabelPool.add({ text: M }, { id: E, lon: b, lat: C, height: L, theme: "measure-circle", show: !0 });
|
|
6327
6396
|
const x = {
|
|
6328
6397
|
entity: this.entity,
|
|
@@ -6330,7 +6399,7 @@ ${g.circumference}:${u.toFixed(2)} m`;
|
|
|
6330
6399
|
positions: this.positions,
|
|
6331
6400
|
radius: l,
|
|
6332
6401
|
area: d,
|
|
6333
|
-
perimeter:
|
|
6402
|
+
perimeter: p,
|
|
6334
6403
|
clear: () => this.clear()
|
|
6335
6404
|
};
|
|
6336
6405
|
(o = t.onComplete) == null || o.call(t, x);
|
|
@@ -6341,15 +6410,15 @@ ${g.circumference}:${u.toFixed(2)} m`;
|
|
|
6341
6410
|
if (!r) return;
|
|
6342
6411
|
const a = e.Cartesian3.distance(s, r);
|
|
6343
6412
|
this.currentRadius = a;
|
|
6344
|
-
const l = e.Cartographic.fromCartesian(s), d = Math.PI * a * a,
|
|
6345
|
-
this.labelEntity ? (this.labelEntity.position =
|
|
6413
|
+
const l = e.Cartographic.fromCartesian(s), d = Math.PI * a * a, p = 2 * Math.PI * a, g = t.labelText || { radius: "半径", area: "面积", circumference: "周长" }, m = s;
|
|
6414
|
+
this.labelEntity ? (this.labelEntity.position = m, this.labelEntity.label.text = `${g.radius}:${a.toFixed(2)} m
|
|
6346
6415
|
${g.area}:${d.toFixed(2)} m²
|
|
6347
|
-
${g.circumference}:${
|
|
6348
|
-
position:
|
|
6416
|
+
${g.circumference}:${p.toFixed(2)} m`) : this.labelEntity = i.entities.add({
|
|
6417
|
+
position: m,
|
|
6349
6418
|
label: {
|
|
6350
6419
|
text: `${g.radius}:${a.toFixed(2)} m
|
|
6351
6420
|
${g.area}:${d.toFixed(2)} m²
|
|
6352
|
-
${g.circumference}:${
|
|
6421
|
+
${g.circumference}:${p.toFixed(2)} m`,
|
|
6353
6422
|
font: "14px sans-serif",
|
|
6354
6423
|
fillColor: e.Color.WHITE,
|
|
6355
6424
|
outlineColor: e.Color.BLACK,
|
|
@@ -6364,11 +6433,11 @@ ${g.circumference}:${u.toFixed(2)} m`,
|
|
|
6364
6433
|
show: !1
|
|
6365
6434
|
}
|
|
6366
6435
|
});
|
|
6367
|
-
const
|
|
6436
|
+
const u = e.Cartographic.fromCartesian(s), f = e.Math.toDegrees(u.longitude), y = e.Math.toDegrees(u.latitude), w = u.height || 0, v = this.htmlLabelId || `measure_circle_${Date.now()}`;
|
|
6368
6437
|
this.htmlLabelId = v;
|
|
6369
6438
|
const P = `${g.radius}:${a.toFixed(2)} m
|
|
6370
6439
|
${g.area}:${d.toFixed(2)} m²
|
|
6371
|
-
${g.circumference}:${
|
|
6440
|
+
${g.circumference}:${p.toFixed(2)} m`;
|
|
6372
6441
|
if (this.htmlLabelPool.add({ text: P }, { id: v, lon: f, lat: y, height: w, theme: "measure-circle", show: !0 }), !this.previewEntity) {
|
|
6373
6442
|
const b = t.color || e.Color.YELLOW.withAlpha(0.5);
|
|
6374
6443
|
this.previewEntity = i.entities.add({
|
|
@@ -6403,8 +6472,8 @@ ${g.circumference}:${u.toFixed(2)} m`;
|
|
|
6403
6472
|
options: { offset: { x: 0, y: -10 } }
|
|
6404
6473
|
});
|
|
6405
6474
|
}
|
|
6406
|
-
const r = o[0], a = o[1], l = i.Cartesian3.distance(r, a), d = Math.PI * l * l,
|
|
6407
|
-
geometryInstances:
|
|
6475
|
+
const r = o[0], a = o[1], l = i.Cartesian3.distance(r, a), d = Math.PI * l * l, p = 2 * Math.PI * l, g = i.Cartographic.fromCartesian(r), m = new i.EllipseGeometry({ center: r, semiMajorAxis: l, semiMinorAxis: l, height: g.height || 0, vertexFormat: i.MaterialAppearance.VERTEX_FORMAT }), u = new i.GeometryInstance({ geometry: m }), f = s.color || i.Color.YELLOW.withAlpha(0.5), y = s.color && s.color.withAlpha ? s.color.withAlpha(0.25) : i.Color.RED.withAlpha(0.4), w = new i.Primitive({
|
|
6476
|
+
geometryInstances: u,
|
|
6408
6477
|
appearance: new i.MaterialAppearance({ material: i.Material.fromType("Color", { color: f }), translucent: !0, closed: !0 }),
|
|
6409
6478
|
depthFailAppearance: new i.MaterialAppearance({ material: i.Material.fromType("Color", { color: y }), translucent: !0, closed: !0 })
|
|
6410
6479
|
});
|
|
@@ -6413,11 +6482,11 @@ ${g.circumference}:${u.toFixed(2)} m`;
|
|
|
6413
6482
|
this.htmlLabelId = P;
|
|
6414
6483
|
const b = s.labelText || { radius: "半径", area: "面积", circumference: "周长" }, C = `${b.radius}:${l.toFixed(2)} m
|
|
6415
6484
|
${b.area}:${d.toFixed(2)} m²
|
|
6416
|
-
${b.circumference}:${
|
|
6485
|
+
${b.circumference}:${p.toFixed(2)} m`;
|
|
6417
6486
|
this.htmlLabelPool.add({ text: C }, { id: P, lon: i.Math.toDegrees(v.longitude), lat: i.Math.toDegrees(v.latitude), height: v.height || 0, theme: "measure-circle", show: !0 });
|
|
6418
6487
|
}
|
|
6419
6488
|
}
|
|
6420
|
-
const
|
|
6489
|
+
const $e = class $e {
|
|
6421
6490
|
constructor(t, e) {
|
|
6422
6491
|
c(this, "Cesium");
|
|
6423
6492
|
c(this, "viewer");
|
|
@@ -6459,7 +6528,7 @@ const He = class He {
|
|
|
6459
6528
|
options: { offset: { x: 0, y: -10 } }
|
|
6460
6529
|
});
|
|
6461
6530
|
}
|
|
6462
|
-
this.tooltip = new ce(), this.tooltip.show(
|
|
6531
|
+
this.tooltip = new ce(), this.tooltip.show($e.TIP_TEXT), this._bindGlobalEvents(t, e, i), this.handler = new e.ScreenSpaceEventHandler(i.canvas), this.handler.setInputAction((n) => {
|
|
6463
6532
|
var r, a;
|
|
6464
6533
|
const s = i.scene.pickPosition(n.position);
|
|
6465
6534
|
if (!s) return;
|
|
@@ -6484,13 +6553,13 @@ const He = class He {
|
|
|
6484
6553
|
})
|
|
6485
6554
|
}
|
|
6486
6555
|
}), this.positions.length >= 2) {
|
|
6487
|
-
const l = this.positions[this.positions.length - 2], d = this.positions[this.positions.length - 1],
|
|
6556
|
+
const l = this.positions[this.positions.length - 2], d = this.positions[this.positions.length - 1], p = e.Cartographic.fromCartesian(l), g = e.Cartographic.fromCartesian(d), u = new e.EllipsoidGeodesic(p, g).surfaceDistance, f = new e.Cartesian3(
|
|
6488
6557
|
(l.x + d.x) / 2,
|
|
6489
6558
|
(l.y + d.y) / 2,
|
|
6490
6559
|
(l.z + d.z) / 2
|
|
6491
6560
|
), y = e.Cartographic.fromCartesian(f), w = `measure_polyline_seg_${this.segmentLabelIds.length}_${Date.now()}`;
|
|
6492
6561
|
this.segmentLabelIds.push(w), this.htmlLabelPool.add(
|
|
6493
|
-
{ text: `${
|
|
6562
|
+
{ text: `${u.toFixed(2)} m` },
|
|
6494
6563
|
{
|
|
6495
6564
|
id: w,
|
|
6496
6565
|
lon: e.Math.toDegrees(y.longitude),
|
|
@@ -6506,20 +6575,20 @@ const He = class He {
|
|
|
6506
6575
|
}, e.ScreenSpaceEventType.LEFT_DOUBLE_CLICK), this.handler.setInputAction(() => {
|
|
6507
6576
|
this._undoLastPoint();
|
|
6508
6577
|
}, e.ScreenSpaceEventType.RIGHT_CLICK), this.handler.setInputAction((n) => {
|
|
6509
|
-
var
|
|
6578
|
+
var u, f;
|
|
6510
6579
|
if (this.positions.length === 0) return;
|
|
6511
6580
|
const s = i.scene.pickPosition(n.endPosition);
|
|
6512
6581
|
if (!s) return;
|
|
6513
6582
|
this.hoverPos = s, this.previewPos = s;
|
|
6514
|
-
const o = this.positions[this.positions.length - 1], r = e.Cartographic.fromCartesian(o), a = e.Cartographic.fromCartesian(s), d = new e.EllipsoidGeodesic(r, a).surfaceDistance,
|
|
6583
|
+
const o = this.positions[this.positions.length - 1], r = e.Cartographic.fromCartesian(o), a = e.Cartographic.fromCartesian(s), d = new e.EllipsoidGeodesic(r, a).surfaceDistance, p = new e.Cartesian3(
|
|
6515
6584
|
(o.x + s.x) / 2,
|
|
6516
6585
|
(o.y + s.y) / 2,
|
|
6517
6586
|
(o.z + s.z) / 2
|
|
6518
|
-
), g = e.Cartographic.fromCartesian(
|
|
6519
|
-
this.previewLabelId =
|
|
6587
|
+
), g = e.Cartographic.fromCartesian(p), m = this.previewLabelId || "measure_polyline_preview";
|
|
6588
|
+
this.previewLabelId = m, this.htmlLabelPool.add(
|
|
6520
6589
|
{ text: `${d.toFixed(2)} m` },
|
|
6521
6590
|
{
|
|
6522
|
-
id:
|
|
6591
|
+
id: m,
|
|
6523
6592
|
lon: e.Math.toDegrees(g.longitude),
|
|
6524
6593
|
lat: e.Math.toDegrees(g.latitude),
|
|
6525
6594
|
height: g.height || 0,
|
|
@@ -6532,7 +6601,7 @@ const He = class He {
|
|
|
6532
6601
|
width: t.width || 3,
|
|
6533
6602
|
material: t.lineColor || t.color || e.Color.YELLOW,
|
|
6534
6603
|
depthFailMaterial: new e.PolylineDashMaterialProperty({
|
|
6535
|
-
color: ((f = (
|
|
6604
|
+
color: ((f = (u = t.dashLineColor || t.lineColor || t.color || e.Color.RED).withAlpha) == null ? void 0 : f.call(u, 0.9)) || e.Color.RED,
|
|
6536
6605
|
dashLength: 12,
|
|
6537
6606
|
dashPattern: 255
|
|
6538
6607
|
})
|
|
@@ -6580,7 +6649,7 @@ const He = class He {
|
|
|
6580
6649
|
this.stop(), this._clearPreviewState();
|
|
6581
6650
|
let n = 0;
|
|
6582
6651
|
for (let d = 1; d < this.positions.length; d++) {
|
|
6583
|
-
const
|
|
6652
|
+
const p = this.positions[d - 1], g = this.positions[d], m = e.Cartographic.fromCartesian(p), u = e.Cartographic.fromCartesian(g), f = new e.EllipsoidGeodesic(m, u);
|
|
6584
6653
|
n += f.surfaceDistance;
|
|
6585
6654
|
}
|
|
6586
6655
|
const s = this.positions[this.positions.length - 1];
|
|
@@ -6615,8 +6684,8 @@ const He = class He {
|
|
|
6615
6684
|
}, i.canvas.addEventListener("contextmenu", this.contextMenuHandler);
|
|
6616
6685
|
}
|
|
6617
6686
|
rehydrate(t, e) {
|
|
6618
|
-
var
|
|
6619
|
-
const i = this.Cesium, n = this.viewer, s = t.options || {}, o = s.lineColor || s.color || i.Color.YELLOW, r = ((f = (
|
|
6687
|
+
var u, f;
|
|
6688
|
+
const i = this.Cesium, n = this.viewer, s = t.options || {}, o = s.lineColor || s.color || i.Color.YELLOW, r = ((f = (u = s.dashLineColor || s.lineColor || s.color || i.Color.RED).withAlpha) == null ? void 0 : f.call(u, 0.9)) || i.Color.RED, a = s.width || 3, l = (t.positions || []).map((y) => new i.Cartesian3(y[0], y[1], y[2]));
|
|
6620
6689
|
if (l.length < 2) return;
|
|
6621
6690
|
if (!this.htmlLabelPool) {
|
|
6622
6691
|
const y = s.overlayContainerId || "html-label-container";
|
|
@@ -6654,9 +6723,9 @@ const He = class He {
|
|
|
6654
6723
|
style: { pointerEvents: "none", userSelect: "none", cursor: "default" }
|
|
6655
6724
|
});
|
|
6656
6725
|
}
|
|
6657
|
-
const
|
|
6658
|
-
this.totalLabelId =
|
|
6659
|
-
id:
|
|
6726
|
+
const p = l[l.length - 1], g = i.Cartographic.fromCartesian(p), m = t.id + "_total";
|
|
6727
|
+
this.totalLabelId = m, this.htmlLabelPool.add({ text: `${d.toFixed(2)} m` }, {
|
|
6728
|
+
id: m,
|
|
6660
6729
|
lon: i.Math.toDegrees(g.longitude),
|
|
6661
6730
|
lat: i.Math.toDegrees(g.latitude),
|
|
6662
6731
|
height: g.height || 0,
|
|
@@ -6666,8 +6735,8 @@ const He = class He {
|
|
|
6666
6735
|
});
|
|
6667
6736
|
}
|
|
6668
6737
|
};
|
|
6669
|
-
c(
|
|
6670
|
-
let ke =
|
|
6738
|
+
c($e, "TIP_TEXT", "单击左键添加点,右键撤销,双击左键或Esc结束");
|
|
6739
|
+
let ke = $e;
|
|
6671
6740
|
class vt {
|
|
6672
6741
|
constructor(t, e) {
|
|
6673
6742
|
c(this, "Cesium");
|
|
@@ -6727,11 +6796,11 @@ class vt {
|
|
|
6727
6796
|
})
|
|
6728
6797
|
}
|
|
6729
6798
|
});
|
|
6730
|
-
const
|
|
6731
|
-
this.htmlLabelId =
|
|
6732
|
-
{ text:
|
|
6799
|
+
const p = t.labelText || { height: "高程" }, g = (o.height || 0) - r, m = `${p.height}:${r.toFixed(2)} m`, u = this.htmlLabelId || `measure_terrain_${Date.now()}`;
|
|
6800
|
+
this.htmlLabelId = u, this.htmlLabelPool.add(
|
|
6801
|
+
{ text: m },
|
|
6733
6802
|
{
|
|
6734
|
-
id:
|
|
6803
|
+
id: u,
|
|
6735
6804
|
lon: a,
|
|
6736
6805
|
lat: l,
|
|
6737
6806
|
height: o.height || 0,
|
|
@@ -6774,12 +6843,12 @@ class vt {
|
|
|
6774
6843
|
options: { offset: { x: 0, y: -10 } }
|
|
6775
6844
|
});
|
|
6776
6845
|
}
|
|
6777
|
-
const r = o[0], a = i.Cartographic.fromCartesian(r), l = n.scene.globe.getHeight(new i.Cartographic(a.longitude, a.latitude, 0)) || 0, d = i.Math.toDegrees(a.longitude),
|
|
6846
|
+
const r = o[0], a = i.Cartographic.fromCartesian(r), l = n.scene.globe.getHeight(new i.Cartographic(a.longitude, a.latitude, 0)) || 0, d = i.Math.toDegrees(a.longitude), p = i.Math.toDegrees(a.latitude), g = i.Cartesian3.fromDegrees(d, p, l);
|
|
6778
6847
|
this.topPoint = n.entities.add({ position: r, point: { pixelSize: 8, color: s.color || i.Color.YELLOW, disableDepthTestDistance: Number.POSITIVE_INFINITY } }), this.zeroPoint = n.entities.add({ position: g, point: { pixelSize: 8, color: i.Color.YELLOW, disableDepthTestDistance: Number.POSITIVE_INFINITY } }), this.lineEntity = n.entities.add({ polyline: { positions: [g, r], width: s.width || 3, material: s.color || i.Color.YELLOW, depthFailMaterial: new i.PolylineDashMaterialProperty({ color: i.Color.RED, dashLength: 12, dashPattern: 255 }) } });
|
|
6779
|
-
const
|
|
6848
|
+
const m = s.labelText || { height: "高程" };
|
|
6780
6849
|
(a.height || 0) - l;
|
|
6781
|
-
const
|
|
6782
|
-
this.htmlLabelId =
|
|
6850
|
+
const u = t.id + "_terrain";
|
|
6851
|
+
this.htmlLabelId = u, this.htmlLabelPool.add({ text: `${m.height}:${l.toFixed(2)} m` }, { id: u, lon: d, lat: p, height: a.height || 0, theme: "measure-terrainHeight", show: !0 });
|
|
6783
6852
|
}
|
|
6784
6853
|
}
|
|
6785
6854
|
class Ct {
|
|
@@ -6807,7 +6876,7 @@ class Ct {
|
|
|
6807
6876
|
});
|
|
6808
6877
|
}
|
|
6809
6878
|
this.handler = new e.ScreenSpaceEventHandler(i.canvas), this.handler.setInputAction((n) => {
|
|
6810
|
-
var
|
|
6879
|
+
var m;
|
|
6811
6880
|
const s = i.scene.pickPosition(n.position);
|
|
6812
6881
|
if (!s) return;
|
|
6813
6882
|
const o = e.Cartographic.fromCartesian(s), r = e.Math.toDegrees(o.longitude), a = e.Math.toDegrees(o.latitude), l = o.height || 0;
|
|
@@ -6821,11 +6890,11 @@ class Ct {
|
|
|
6821
6890
|
});
|
|
6822
6891
|
const d = this.htmlLabelId || `measure_coordinate_${Date.now()}`;
|
|
6823
6892
|
this.htmlLabelId = d;
|
|
6824
|
-
const
|
|
6893
|
+
const p = t.labelText || { lng: "经", lat: "纬", height: "高" };
|
|
6825
6894
|
this.htmlLabelPool.add(
|
|
6826
|
-
{ text: `${
|
|
6827
|
-
${
|
|
6828
|
-
${
|
|
6895
|
+
{ text: `${p.lng}:${r.toFixed(6)}
|
|
6896
|
+
${p.lat}:${a.toFixed(6)}
|
|
6897
|
+
${p.height}:${l.toFixed(2)} m` },
|
|
6829
6898
|
{
|
|
6830
6899
|
id: d,
|
|
6831
6900
|
lon: r,
|
|
@@ -6841,7 +6910,7 @@ ${u.height}:${l.toFixed(2)} m` },
|
|
|
6841
6910
|
lnglat: { lng: r, lat: a, height: l },
|
|
6842
6911
|
clear: () => this.clear()
|
|
6843
6912
|
};
|
|
6844
|
-
(
|
|
6913
|
+
(m = t.onComplete) == null || m.call(t, g), this.stop();
|
|
6845
6914
|
}, e.ScreenSpaceEventType.LEFT_CLICK);
|
|
6846
6915
|
}
|
|
6847
6916
|
stop() {
|
|
@@ -6851,10 +6920,10 @@ ${u.height}:${l.toFixed(2)} m` },
|
|
|
6851
6920
|
this.stop(), this.entity && (this.viewer.entities.remove(this.entity), this.entity = null), this.htmlLabelId && this.htmlLabelPool && (this.htmlLabelPool.removeByIds([this.htmlLabelId]), this.htmlLabelId = null);
|
|
6852
6921
|
}
|
|
6853
6922
|
rehydrate(t, e) {
|
|
6854
|
-
var
|
|
6923
|
+
var u;
|
|
6855
6924
|
const i = this.Cesium, n = this.viewer, s = t.options || {}, o = (t.positions || []).map((f) => new i.Cartesian3(f[0], f[1], f[2]));
|
|
6856
6925
|
if (!o.length) {
|
|
6857
|
-
const f = (
|
|
6926
|
+
const f = (u = t.data) == null ? void 0 : u.lnglat;
|
|
6858
6927
|
if (f && typeof f.lng == "number" && typeof f.lat == "number") {
|
|
6859
6928
|
const y = i.Cartesian3.fromDegrees(f.lng, f.lat, f.height || 0);
|
|
6860
6929
|
o.push(y);
|
|
@@ -6871,14 +6940,14 @@ ${u.height}:${l.toFixed(2)} m` },
|
|
|
6871
6940
|
options: { offset: { x: 0, y: -10 } }
|
|
6872
6941
|
});
|
|
6873
6942
|
}
|
|
6874
|
-
const r = o[0], a = i.Cartographic.fromCartesian(r), l = i.Math.toDegrees(a.longitude), d = i.Math.toDegrees(a.latitude),
|
|
6943
|
+
const r = o[0], a = i.Cartographic.fromCartesian(r), l = i.Math.toDegrees(a.longitude), d = i.Math.toDegrees(a.latitude), p = a.height || 0;
|
|
6875
6944
|
this.entity = n.entities.add({ position: r, point: { pixelSize: 10, color: s.color || i.Color.YELLOW, disableDepthTestDistance: Number.POSITIVE_INFINITY } });
|
|
6876
6945
|
const g = t.id + "_coord";
|
|
6877
6946
|
this.htmlLabelId = g;
|
|
6878
|
-
const
|
|
6879
|
-
this.htmlLabelPool.add({ text: `${
|
|
6880
|
-
${
|
|
6881
|
-
${
|
|
6947
|
+
const m = s.labelText || { lng: "经", lat: "纬", height: "高" };
|
|
6948
|
+
this.htmlLabelPool.add({ text: `${m.lng}:${l.toFixed(6)}
|
|
6949
|
+
${m.lat}:${d.toFixed(6)}
|
|
6950
|
+
${m.height}:${p.toFixed(2)} m` }, { id: g, lon: l, lat: d, height: p, theme: "measure-coordinate", show: !0 });
|
|
6882
6951
|
}
|
|
6883
6952
|
}
|
|
6884
6953
|
class bt {
|
|
@@ -6941,20 +7010,20 @@ class bt {
|
|
|
6941
7010
|
return;
|
|
6942
7011
|
}
|
|
6943
7012
|
this.stop();
|
|
6944
|
-
const { corners: a, center: l, width: d, height:
|
|
7013
|
+
const { corners: a, center: l, width: d, height: p, area: g } = r;
|
|
6945
7014
|
this.previewEntity && (i.entities.remove(this.previewEntity), this.previewEntity = null), this.primitive && (i.scene.primitives.remove(this.primitive), this.primitive = null), this.entity && (i.entities.remove(this.entity), this.entity = null);
|
|
6946
|
-
const
|
|
6947
|
-
this.htmlLabelId =
|
|
6948
|
-
const
|
|
7015
|
+
const m = this.htmlLabelId || `measure_rectangle_${Date.now()}`;
|
|
7016
|
+
this.htmlLabelId = m;
|
|
7017
|
+
const u = e.Cartographic.fromCartesian(l), f = t.labelText || { width: "宽", heightLabel: "高", area: "面积", side: "边长" };
|
|
6949
7018
|
this.previewLabelId && this.htmlLabelPool && (this.htmlLabelPool.removeByIds([this.previewLabelId]), this.previewLabelId = null), this.htmlLabelPool.add(
|
|
6950
7019
|
{ text: `${f.width}:${d.toFixed(2)} m
|
|
6951
|
-
${f.heightLabel}:${
|
|
7020
|
+
${f.heightLabel}:${p.toFixed(2)} m
|
|
6952
7021
|
${f.area}:${g.toFixed(2)} m²` },
|
|
6953
7022
|
{
|
|
6954
|
-
id:
|
|
6955
|
-
lon: e.Math.toDegrees(
|
|
6956
|
-
lat: e.Math.toDegrees(
|
|
6957
|
-
height:
|
|
7023
|
+
id: m,
|
|
7024
|
+
lon: e.Math.toDegrees(u.longitude),
|
|
7025
|
+
lat: e.Math.toDegrees(u.latitude),
|
|
7026
|
+
height: u.height || 0,
|
|
6958
7027
|
theme: "measure-rectangle",
|
|
6959
7028
|
show: !0
|
|
6960
7029
|
}
|
|
@@ -6966,7 +7035,7 @@ ${f.area}:${g.toFixed(2)} m²` },
|
|
|
6966
7035
|
[a[3], a[0]]
|
|
6967
7036
|
];
|
|
6968
7037
|
for (let A = 0; A < y.length; A++) {
|
|
6969
|
-
const [R,
|
|
7038
|
+
const [R, $] = y[A], B = A === 0 || A === 2 ? d : p, Y = new e.Cartesian3((R.x + $.x) / 2, (R.y + $.y) / 2, (R.z + $.z) / 2), N = e.Cartographic.fromCartesian(Y), z = `measure_rectangle_seg_${Date.now()}_${A}`;
|
|
6970
7039
|
this.segmentLabelIds.push(z), this.htmlLabelPool.add(
|
|
6971
7040
|
{ text: `${f.side}:${Number(B).toFixed(2)} m` },
|
|
6972
7041
|
{
|
|
@@ -7030,7 +7099,7 @@ ${f.area}:${g.toFixed(2)} m²` },
|
|
|
7030
7099
|
label: this.labelEntity,
|
|
7031
7100
|
positions: [this.startPoint, this.secondPoint, o],
|
|
7032
7101
|
width: d,
|
|
7033
|
-
height:
|
|
7102
|
+
height: p,
|
|
7034
7103
|
area: g,
|
|
7035
7104
|
clear: () => this.clear()
|
|
7036
7105
|
};
|
|
@@ -7078,20 +7147,20 @@ ${f.area}:${g.toFixed(2)} m²` },
|
|
|
7078
7147
|
if (!this.startPoint || !this.secondPoint) return;
|
|
7079
7148
|
const o = this.computeRectangle(this.startPoint, this.secondPoint, s);
|
|
7080
7149
|
if (!o) return;
|
|
7081
|
-
const { corners: r, center: a, width: l, height: d, area:
|
|
7150
|
+
const { corners: r, center: a, width: l, height: d, area: p } = o, g = this.buildSurfaceRectanglePositions(r);
|
|
7082
7151
|
this.currentCorners = g;
|
|
7083
|
-
const
|
|
7084
|
-
this.previewLabelId =
|
|
7152
|
+
const m = e.Cartographic.fromCartesian(a), u = this.previewLabelId || "measure_rectangle_preview";
|
|
7153
|
+
this.previewLabelId = u;
|
|
7085
7154
|
const f = t.labelText || { width: "宽", heightLabel: "高", area: "面积" };
|
|
7086
7155
|
if (this.htmlLabelPool.add(
|
|
7087
7156
|
{ text: `${f.width}:${l.toFixed(2)} m
|
|
7088
7157
|
${f.heightLabel}:${d.toFixed(2)} m
|
|
7089
|
-
${f.area}:${
|
|
7158
|
+
${f.area}:${p.toFixed(2)} m²` },
|
|
7090
7159
|
{
|
|
7091
|
-
id:
|
|
7092
|
-
lon: e.Math.toDegrees(
|
|
7093
|
-
lat: e.Math.toDegrees(
|
|
7094
|
-
height:
|
|
7160
|
+
id: u,
|
|
7161
|
+
lon: e.Math.toDegrees(m.longitude),
|
|
7162
|
+
lat: e.Math.toDegrees(m.latitude),
|
|
7163
|
+
height: m.height || 0,
|
|
7095
7164
|
theme: "measure-rectangle",
|
|
7096
7165
|
show: !0
|
|
7097
7166
|
}
|
|
@@ -7165,10 +7234,10 @@ ${f.area}:${u.toFixed(2)} m²` },
|
|
|
7165
7234
|
}
|
|
7166
7235
|
const r = this.computeRectangle(o[0], o[1], o[2]);
|
|
7167
7236
|
if (!r) return;
|
|
7168
|
-
const a = r.corners, l = r.center, d = r.width,
|
|
7169
|
-
this.htmlLabelId =
|
|
7170
|
-
${f.heightLabel}:${
|
|
7171
|
-
${f.area}:${g.toFixed(2)} m²` }, { id:
|
|
7237
|
+
const a = r.corners, l = r.center, d = r.width, p = r.height, g = r.area, m = i.Cartographic.fromCartesian(l), u = t.id + "_rectangle", f = s.labelText || { width: "宽", heightLabel: "高", area: "面积", side: "边长" };
|
|
7238
|
+
this.htmlLabelId = u, this.htmlLabelPool.add({ text: `${f.width}:${d.toFixed(2)} m
|
|
7239
|
+
${f.heightLabel}:${p.toFixed(2)} m
|
|
7240
|
+
${f.area}:${g.toFixed(2)} m²` }, { id: u, lon: i.Math.toDegrees(m.longitude), lat: i.Math.toDegrees(m.latitude), height: m.height || 0, theme: "measure-rectangle", show: !0 });
|
|
7172
7241
|
const y = [
|
|
7173
7242
|
[a[0], a[1]],
|
|
7174
7243
|
[a[1], a[2]],
|
|
@@ -7176,7 +7245,7 @@ ${f.area}:${g.toFixed(2)} m²` }, { id: m, lon: i.Math.toDegrees(p.longitude), l
|
|
|
7176
7245
|
[a[3], a[0]]
|
|
7177
7246
|
];
|
|
7178
7247
|
for (let D = 0; D < y.length; D++) {
|
|
7179
|
-
const [T, S] = y[D], _ = D === 0 || D === 2 ? d :
|
|
7248
|
+
const [T, S] = y[D], _ = D === 0 || D === 2 ? d : p, k = new i.Cartesian3((T.x + S.x) / 2, (T.y + S.y) / 2, (T.z + S.z) / 2), A = i.Cartographic.fromCartesian(k), R = t.id + `_rectangle_seg_${D}`;
|
|
7180
7249
|
this.segmentLabelIds.push(R), this.htmlLabelPool.add({ text: `${f.side}:${Number(_).toFixed(2)} m` }, { id: R, lon: i.Math.toDegrees(A.longitude), lat: i.Math.toDegrees(A.latitude), height: A.height || 0, theme: "measure-rectangle-seg", show: !0 });
|
|
7181
7250
|
}
|
|
7182
7251
|
const w = new i.PolygonHierarchy(a), v = new i.PolygonGeometry({
|
|
@@ -7216,9 +7285,9 @@ ${f.area}:${g.toFixed(2)} m²` }, { id: m, lon: i.Math.toDegrees(p.longitude), l
|
|
|
7216
7285
|
computeRectangle(t, e, i) {
|
|
7217
7286
|
const n = this.Cesium, s = new n.EllipsoidTangentPlane(t, n.Ellipsoid.WGS84), o = s.projectPointsOntoPlane([t, e, i]);
|
|
7218
7287
|
if (!o || o.length < 3) return null;
|
|
7219
|
-
const r = o[0], a = o[1], l = o[2], d = a.x - r.x,
|
|
7288
|
+
const r = o[0], a = o[1], l = o[2], d = a.x - r.x, p = a.y - r.y, g = Math.sqrt(d * d + p * p);
|
|
7220
7289
|
if (!g) return null;
|
|
7221
|
-
const
|
|
7290
|
+
const m = d / g, f = -(p / g), y = m, w = l.x - a.x, v = l.y - a.y, P = w * f + v * y;
|
|
7222
7291
|
if (!P) return null;
|
|
7223
7292
|
const b = new n.Cartesian2(a.x + f * P, a.y + y * P), C = new n.Cartesian2(r.x + f * P, r.y + y * P), L = s.projectPointsOntoEllipsoid([r, a, b, C]);
|
|
7224
7293
|
if (!L || L.length < 4) return null;
|
|
@@ -7229,8 +7298,8 @@ ${f.area}:${g.toFixed(2)} m²` }, { id: m, lon: i.Math.toDegrees(p.longitude), l
|
|
|
7229
7298
|
), _ = new n.EllipsoidTangentPlane(T, n.Ellipsoid.WGS84).projectPointsOntoPlane(E);
|
|
7230
7299
|
let k = 0;
|
|
7231
7300
|
for (let R = 0; R < _.length; R++) {
|
|
7232
|
-
const
|
|
7233
|
-
k += _[R].x * _[
|
|
7301
|
+
const $ = (R + 1) % _.length;
|
|
7302
|
+
k += _[R].x * _[$].y - _[$].x * _[R].y;
|
|
7234
7303
|
}
|
|
7235
7304
|
const A = Math.abs(k) / 2;
|
|
7236
7305
|
return { corners: E, center: T, width: I, height: D, area: A };
|
|
@@ -7281,10 +7350,10 @@ class Pt {
|
|
|
7281
7350
|
const o = i.scene.pickPosition(s.position);
|
|
7282
7351
|
if (o && (this.positions.push(o), this.positions.length === 2)) {
|
|
7283
7352
|
this.stop();
|
|
7284
|
-
const d = this.positions[0],
|
|
7353
|
+
const d = this.positions[0], p = this.positions[1], g = e.Cartesian3.distance(d, p), m = this.buildRegularPolygonPoints(d, g, n);
|
|
7285
7354
|
this.previewEntity && (i.entities.remove(this.previewEntity), this.previewEntity = null), this.primitive && (i.scene.primitives.remove(this.primitive), this.primitive = null);
|
|
7286
|
-
const
|
|
7287
|
-
polygonHierarchy:
|
|
7355
|
+
const u = new e.PolygonHierarchy(m), f = new e.PolygonGeometry({
|
|
7356
|
+
polygonHierarchy: u,
|
|
7288
7357
|
vertexFormat: e.MaterialAppearance.VERTEX_FORMAT,
|
|
7289
7358
|
perPositionHeight: !0,
|
|
7290
7359
|
arcType: e.ArcType.NONE
|
|
@@ -7302,7 +7371,7 @@ class Pt {
|
|
|
7302
7371
|
closed: !0
|
|
7303
7372
|
})
|
|
7304
7373
|
}), i.scene.primitives.add(this.primitive);
|
|
7305
|
-
const P = t.lineColor || w, b = ((a = (r = t.dashLineColor || t.lineColor || t.color || e.Color.RED).withAlpha) == null ? void 0 : a.call(r, 0.9)) || e.Color.RED, C =
|
|
7374
|
+
const P = t.lineColor || w, b = ((a = (r = t.dashLineColor || t.lineColor || t.color || e.Color.RED).withAlpha) == null ? void 0 : a.call(r, 0.9)) || e.Color.RED, C = m.slice(), L = i.entities.add({
|
|
7306
7375
|
polyline: {
|
|
7307
7376
|
positions: C,
|
|
7308
7377
|
width: t.width || 2,
|
|
@@ -7317,7 +7386,7 @@ class Pt {
|
|
|
7317
7386
|
}
|
|
7318
7387
|
});
|
|
7319
7388
|
this.edgeEntities.push(L);
|
|
7320
|
-
const E = t.pointColor || w, M =
|
|
7389
|
+
const E = t.pointColor || w, M = m.slice(0, m.length - 1);
|
|
7321
7390
|
for (const k of M) {
|
|
7322
7391
|
const A = i.entities.add({
|
|
7323
7392
|
position: k,
|
|
@@ -7329,13 +7398,13 @@ class Pt {
|
|
|
7329
7398
|
});
|
|
7330
7399
|
this.pointEntities.push(A);
|
|
7331
7400
|
}
|
|
7332
|
-
const x = this.computeAreaByPlane(
|
|
7401
|
+
const x = this.computeAreaByPlane(m), I = e.Cartographic.fromCartesian(d), D = this.htmlLabelId || `measure_regular_${Date.now()}`;
|
|
7333
7402
|
this.htmlLabelId = D;
|
|
7334
7403
|
const T = t.labelText || { sides: "边数", radius: "半径", circumference: "周长", area: "面积", side: "边长" };
|
|
7335
7404
|
this.previewLabelId && this.htmlLabelPool && (this.htmlLabelPool.removeByIds([this.previewLabelId]), this.previewLabelId = null);
|
|
7336
7405
|
let S = 0;
|
|
7337
|
-
for (let k = 1; k <
|
|
7338
|
-
const A =
|
|
7406
|
+
for (let k = 1; k < m.length; k++) {
|
|
7407
|
+
const A = m[k - 1], R = m[k], $ = e.Cartographic.fromCartesian(A), B = e.Cartographic.fromCartesian(R), N = new e.EllipsoidGeodesic($, B).surfaceDistance;
|
|
7339
7408
|
S += N;
|
|
7340
7409
|
const z = new e.Cartesian3((A.x + R.x) / 2, (A.y + R.y) / 2, (A.z + R.z) / 2), V = e.Cartographic.fromCartesian(z), se = `measure_regular_seg_${Date.now()}_${k - 1}`;
|
|
7341
7410
|
this.segmentLabelIds.push(se), this.htmlLabelPool.add(
|
|
@@ -7367,7 +7436,7 @@ ${T.area}:${x.toFixed(2)} m²` },
|
|
|
7367
7436
|
const _ = {
|
|
7368
7437
|
entity: this.primitive,
|
|
7369
7438
|
label: this.labelEntity,
|
|
7370
|
-
positions:
|
|
7439
|
+
positions: m,
|
|
7371
7440
|
radius: g,
|
|
7372
7441
|
sides: n,
|
|
7373
7442
|
perimeter: S,
|
|
@@ -7432,16 +7501,16 @@ ${T.area}:${x.toFixed(2)} m²` },
|
|
|
7432
7501
|
const v = this.currentPoints[w - 1], P = this.currentPoints[w], b = e.Cartographic.fromCartesian(v), C = e.Cartographic.fromCartesian(P), L = new e.EllipsoidGeodesic(b, C);
|
|
7433
7502
|
d += L.surfaceDistance;
|
|
7434
7503
|
}
|
|
7435
|
-
const
|
|
7436
|
-
this.previewLabelId =
|
|
7437
|
-
const
|
|
7504
|
+
const p = this.computeAreaByPlane(this.currentPoints), g = e.Cartographic.fromCartesian(o), m = this.previewLabelId || "measure_regular_preview";
|
|
7505
|
+
this.previewLabelId = m;
|
|
7506
|
+
const u = t.labelText || { sides: "边数", radius: "半径", circumference: "周长", area: "面积" };
|
|
7438
7507
|
this.htmlLabelPool.add(
|
|
7439
|
-
{ text: `${
|
|
7440
|
-
${
|
|
7441
|
-
${
|
|
7442
|
-
${
|
|
7508
|
+
{ text: `${u.sides}:${n}
|
|
7509
|
+
${u.radius}:${l.toFixed(2)} m
|
|
7510
|
+
${u.circumference}:${d.toFixed(2)} m
|
|
7511
|
+
${u.area}:${p.toFixed(2)} m²` },
|
|
7443
7512
|
{
|
|
7444
|
-
id:
|
|
7513
|
+
id: m,
|
|
7445
7514
|
lon: e.Math.toDegrees(g.longitude),
|
|
7446
7515
|
lat: e.Math.toDegrees(g.latitude),
|
|
7447
7516
|
height: g.height || 0,
|
|
@@ -7514,7 +7583,7 @@ ${m.area}:${u.toFixed(2)} m²` },
|
|
|
7514
7583
|
const E = r[1];
|
|
7515
7584
|
d = i.Cartesian3.distance(l, E), a = this.buildRegularPolygonPoints(l, d, Math.max(o, 3));
|
|
7516
7585
|
}
|
|
7517
|
-
const
|
|
7586
|
+
const p = new i.PolygonHierarchy(a), g = new i.PolygonGeometry({ polygonHierarchy: p, vertexFormat: i.MaterialAppearance.VERTEX_FORMAT, perPositionHeight: !0 }), m = new i.GeometryInstance({ geometry: g }), u = 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), y = new i.Primitive({ geometryInstances: m, appearance: new i.MaterialAppearance({ material: i.Material.fromType("Color", { color: u }), translucent: !0, closed: !0 }), depthFailAppearance: new i.MaterialAppearance({ material: i.Material.fromType("Color", { color: f }), translucent: !0, closed: !0 }) });
|
|
7518
7587
|
n.scene.primitives.add(y), this.primitive = y;
|
|
7519
7588
|
const w = this.computeAreaByPlane(a), v = i.Cartographic.fromCartesian(l), P = t.id + "_regular";
|
|
7520
7589
|
this.htmlLabelId = P;
|
|
@@ -7534,8 +7603,8 @@ ${b.area}:${w.toFixed(2)} m²` }, { id: P, lon: i.Math.toDegrees(v.longitude), l
|
|
|
7534
7603
|
buildRegularPolygonPoints(t, e, i) {
|
|
7535
7604
|
const n = this.Cesium, s = new n.EllipsoidTangentPlane(t, n.Ellipsoid.WGS84), o = 2 * Math.PI / i, r = [];
|
|
7536
7605
|
for (let d = 0; d < i; d++) {
|
|
7537
|
-
const
|
|
7538
|
-
r.push(new n.Cartesian2(g,
|
|
7606
|
+
const p = d * o, g = e * Math.cos(p), m = e * Math.sin(p);
|
|
7607
|
+
r.push(new n.Cartesian2(g, m));
|
|
7539
7608
|
}
|
|
7540
7609
|
const l = s.projectPointsOntoEllipsoid(r).slice();
|
|
7541
7610
|
return l.push(l[0]), l;
|
|
@@ -7630,8 +7699,8 @@ class No {
|
|
|
7630
7699
|
case "coordinate": {
|
|
7631
7700
|
const d = o == null ? void 0 : o.lnglat;
|
|
7632
7701
|
if (d && typeof d.lng == "number" && typeof d.lat == "number") {
|
|
7633
|
-
const
|
|
7634
|
-
return [[
|
|
7702
|
+
const p = this.Cesium.Cartesian3.fromDegrees(d.lng, d.lat, d.height || 0);
|
|
7703
|
+
return [[p.x, p.y, p.z]];
|
|
7635
7704
|
}
|
|
7636
7705
|
return;
|
|
7637
7706
|
}
|
|
@@ -7939,25 +8008,25 @@ class zo {
|
|
|
7939
8008
|
}
|
|
7940
8009
|
_setupEntities(t) {
|
|
7941
8010
|
const e = t.waypoints || [], i = new this.Cesium.SampledPositionProperty(), n = new this.Cesium.SampledProperty(this.Cesium.Quaternion), s = [];
|
|
7942
|
-
for (const
|
|
8011
|
+
for (const p of e) {
|
|
7943
8012
|
let g;
|
|
7944
|
-
|
|
7945
|
-
let
|
|
7946
|
-
|
|
7947
|
-
const
|
|
7948
|
-
s.push({ position: g, orientation:
|
|
8013
|
+
p.destination ? p.destination.x !== void 0 ? g = new this.Cesium.Cartesian3(p.destination.x, p.destination.y, p.destination.z) : g = p.destination : p.lon !== void 0 && p.lat !== void 0 && (g = this.Cesium.Cartesian3.fromDegrees(p.lon, p.lat, p.height ?? 0));
|
|
8014
|
+
let m;
|
|
8015
|
+
p.orientation ? m = new this.Cesium.HeadingPitchRoll(p.orientation.heading, p.orientation.pitch, p.orientation.roll) : m = this.Cesium.HeadingPitchRoll.fromDegrees(p.heading ?? 0, p.pitch ?? -30, p.roll ?? 0);
|
|
8016
|
+
const u = this.Cesium.Transforms.headingPitchRollQuaternion(g, m);
|
|
8017
|
+
s.push({ position: g, orientation: u });
|
|
7949
8018
|
}
|
|
7950
8019
|
const o = this.Cesium.JulianDate.now(), r = t.speed || 100;
|
|
7951
8020
|
let a = 0;
|
|
7952
8021
|
const l = [];
|
|
7953
|
-
for (let
|
|
7954
|
-
if (
|
|
8022
|
+
for (let p = 0; p < s.length; p++) {
|
|
8023
|
+
if (p === 0)
|
|
7955
8024
|
l.push(o.clone());
|
|
7956
8025
|
else {
|
|
7957
|
-
const
|
|
7958
|
-
a +=
|
|
8026
|
+
const m = this.Cesium.Cartesian3.distance(s[p - 1].position, s[p].position) / Math.max(r, 0.1);
|
|
8027
|
+
a += m, l.push(this.Cesium.JulianDate.addSeconds(o, a, new this.Cesium.JulianDate()));
|
|
7959
8028
|
}
|
|
7960
|
-
i.addSample(l[
|
|
8029
|
+
i.addSample(l[p], s[p].position), n.addSample(l[p], s[p].orientation);
|
|
7961
8030
|
}
|
|
7962
8031
|
this.startTime = l[0], this.stopTime = l[l.length - 1];
|
|
7963
8032
|
const d = {
|
|
@@ -7974,15 +8043,15 @@ class zo {
|
|
|
7974
8043
|
runAnimations: t.modelAnimate ?? !0
|
|
7975
8044
|
} : d.point = { pixelSize: 1, color: this.Cesium.Color.TRANSPARENT }, t.showPath && this.viewEntities.push(this.viewer.entities.add({
|
|
7976
8045
|
polyline: {
|
|
7977
|
-
positions: s.map((
|
|
8046
|
+
positions: s.map((p) => p.position),
|
|
7978
8047
|
width: 3,
|
|
7979
8048
|
material: this.Cesium.Color.GREEN
|
|
7980
8049
|
// clampToGround: false
|
|
7981
8050
|
}
|
|
7982
|
-
})), this.entity = this.viewer.entities.add(d), t.showStops && s.forEach((
|
|
7983
|
-
const
|
|
8051
|
+
})), this.entity = this.viewer.entities.add(d), t.showStops && s.forEach((p, g) => {
|
|
8052
|
+
const m = this.Cesium.Cartographic.fromCartesian(p.position), u = this.Cesium.Cartesian3.fromRadians(m.longitude, m.latitude, 0);
|
|
7984
8053
|
this.viewEntities.push(this.viewer.entities.add({
|
|
7985
|
-
position:
|
|
8054
|
+
position: p.position,
|
|
7986
8055
|
point: {
|
|
7987
8056
|
pixelSize: 8,
|
|
7988
8057
|
color: this.Cesium.Color.YELLOW,
|
|
@@ -7999,7 +8068,7 @@ class zo {
|
|
|
7999
8068
|
style: this.Cesium.LabelStyle.FILL_AND_OUTLINE
|
|
8000
8069
|
},
|
|
8001
8070
|
polyline: {
|
|
8002
|
-
positions: [
|
|
8071
|
+
positions: [p.position, u],
|
|
8003
8072
|
width: 2,
|
|
8004
8073
|
material: new this.Cesium.PolylineDashMaterialProperty({
|
|
8005
8074
|
color: this.Cesium.Color.RED,
|
|
@@ -8079,10 +8148,10 @@ class Go {
|
|
|
8079
8148
|
const e = this.normalizePositions(t.positions || []);
|
|
8080
8149
|
if (!e.length) return;
|
|
8081
8150
|
const i = t.speed ?? 30, n = this.buildTimes(e, i), s = new this.Cesium.SampledPositionProperty();
|
|
8082
|
-
for (let
|
|
8083
|
-
s.addSample(n[
|
|
8151
|
+
for (let m = 0; m < e.length; m++)
|
|
8152
|
+
s.addSample(n[m], e[m]);
|
|
8084
8153
|
this.positionProperty = s;
|
|
8085
|
-
const o = new this.Cesium.VelocityOrientationProperty(s), r = t.showPath ?? !0, a = t.pathColor ?? this.Cesium.Color.YELLOW, l = t.pathWidth ?? 3, d = t.pointColor ?? this.Cesium.Color.RED,
|
|
8154
|
+
const o = new this.Cesium.VelocityOrientationProperty(s), r = t.showPath ?? !0, a = t.pathColor ?? this.Cesium.Color.YELLOW, l = t.pathWidth ?? 3, d = t.pointColor ?? this.Cesium.Color.RED, p = t.pointPixelSize ?? 8, g = {
|
|
8086
8155
|
availability: new this.Cesium.TimeIntervalCollection([
|
|
8087
8156
|
new this.Cesium.TimeInterval({ start: this.startTime, stop: this.stopTime })
|
|
8088
8157
|
]),
|
|
@@ -8095,7 +8164,7 @@ class Go {
|
|
|
8095
8164
|
scale: t.modelScale ?? 1,
|
|
8096
8165
|
minimumPixelSize: 64,
|
|
8097
8166
|
runAnimations: t.modelAnimate ?? !0
|
|
8098
|
-
} : g.point = { color: d, pixelSize:
|
|
8167
|
+
} : g.point = { color: d, pixelSize: p }, this.entity = this.viewer.entities.add(g), this.viewer.clock.startTime = this.startTime.clone(), this.viewer.clock.stopTime = this.stopTime.clone(), this.viewer.clock.currentTime = this.startTime.clone(), this.viewer.clock.clockRange = t.loop ? this.Cesium.ClockRange.LOOP_STOP : this.Cesium.ClockRange.CLAMPED, this.viewer.clock.multiplier = 1, this.viewer.clock.shouldAnimate = !0, t.initialView ? (this.viewer.camera.setView({
|
|
8099
8168
|
destination: t.initialView.destination,
|
|
8100
8169
|
orientation: t.initialView.orientation
|
|
8101
8170
|
}), this.cameraOffset = null) : t.followCamera ? this.viewer.trackedEntity = this.entity : t.lookAtOffset && this.viewer.camera.lookAt(this.entity.position, t.lookAtOffset), this.viewer.clock.onTick.addEventListener(this.onTick);
|
|
@@ -8141,14 +8210,14 @@ export {
|
|
|
8141
8210
|
Yt as DOM_EVENT_MAP,
|
|
8142
8211
|
Do as DrawTool,
|
|
8143
8212
|
Eo as EditMode,
|
|
8144
|
-
|
|
8213
|
+
$o as EntityLayerManager,
|
|
8145
8214
|
So as GLTFManage,
|
|
8146
8215
|
Mo as GLTFManageEventKey,
|
|
8147
8216
|
Se as HorizontalMeasure,
|
|
8148
8217
|
G as HtmlOverlayLabelPool,
|
|
8149
8218
|
Bt as MarkerEventBus,
|
|
8150
8219
|
te as MarkerEventKey,
|
|
8151
|
-
|
|
8220
|
+
Ho as MaterialManager,
|
|
8152
8221
|
No as MeasurementTool,
|
|
8153
8222
|
Go as PathRoamTool,
|
|
8154
8223
|
ke as PolylineDistanceMeasure,
|