leiting-bim 2.2.67 → 2.2.68
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
var
|
|
2
|
-
var Gt = (h, t, e) => t in h ?
|
|
1
|
+
var zt = Object.defineProperty;
|
|
2
|
+
var Gt = (h, t, e) => t in h ? zt(h, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : h[t] = e;
|
|
3
3
|
var c = (h, t, e) => Gt(h, typeof t != "symbol" ? t + "" : t, e);
|
|
4
4
|
class _o {
|
|
5
5
|
constructor(t, e, i) {
|
|
@@ -10,6 +10,7 @@ class _o {
|
|
|
10
10
|
c(this, "displayLimit");
|
|
11
11
|
c(this, "maxLevel");
|
|
12
12
|
c(this, "debugCurrentGrids");
|
|
13
|
+
c(this, "debugHeightBounds");
|
|
13
14
|
c(this, "levels");
|
|
14
15
|
c(this, "points", []);
|
|
15
16
|
c(this, "gridLayers", /* @__PURE__ */ new Map());
|
|
@@ -22,6 +23,13 @@ class _o {
|
|
|
22
23
|
c(this, "groupByTheme");
|
|
23
24
|
c(this, "tilingScheme");
|
|
24
25
|
c(this, "terrainLevelOffset");
|
|
26
|
+
c(this, "heightCandidateNeighborRing");
|
|
27
|
+
c(this, "heightBoxRetentionEnabled");
|
|
28
|
+
/**
|
|
29
|
+
* 地表瓦片已离开、但高度 OBB 曾进入视野的格网。每次刷新都会重新做 OBB
|
|
30
|
+
* 可见性判断,不能仅依赖“当前地表瓦片外围一圈”的首次发现。
|
|
31
|
+
*/
|
|
32
|
+
c(this, "heightRetainedCells", /* @__PURE__ */ new Map());
|
|
25
33
|
c(this, "debugTileCoordLayer", null);
|
|
26
34
|
c(this, "levelIndexByTileLevel", /* @__PURE__ */ new Map());
|
|
27
35
|
c(this, "_lastTileProvider", null);
|
|
@@ -37,13 +45,20 @@ class _o {
|
|
|
37
45
|
c(this, "defaultMaxLevel", 28);
|
|
38
46
|
// 单次从视图层级向下细分到聚合层级时,最多细分的层级数
|
|
39
47
|
c(this, "maxRefineLevels", 2);
|
|
40
|
-
this.Cesium = t, this.viewer = e, this.labelPool = i.labelPool, this.threshold = i.threshold ?? 10, this.displayLimit = i.displayLimit ?? 100, this.maxLevel = i.maxLevel ?? 5, this.
|
|
48
|
+
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
|
+
0,
|
|
50
|
+
Math.floor(i.heightCandidateNeighborRing ?? 1)
|
|
51
|
+
), this.heightBoxRetentionEnabled = i.heightBoxRetentionEnabled ?? !0;
|
|
41
52
|
const n = this.viewer.scene && this.viewer.scene.globe, s = n && n._surface, o = s && s._tileProvider, r = (o == null ? void 0 : o.tilingScheme) || new this.Cesium.GeographicTilingScheme();
|
|
42
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 = (a) => {
|
|
43
54
|
a === 0 && this._cameraDirty && (this._cameraDirty = !1, this._scheduleUpdate());
|
|
44
55
|
}, n.tileLoadProgressEvent.addEventListener(this._tileLoadListener)), this._cameraChangedHandler = () => {
|
|
45
56
|
this._update();
|
|
46
|
-
}, this.viewer.camera.changed.addEventListener(this._cameraChangedHandler);
|
|
57
|
+
}, this.viewer.camera.changed.addEventListener(this._cameraChangedHandler), this._exposeDebugInstance();
|
|
58
|
+
}
|
|
59
|
+
/** 临时调试入口:供浏览器控制台直接查看和操纵当前聚合器实例。 */
|
|
60
|
+
_exposeDebugInstance() {
|
|
61
|
+
typeof window > "u" || (window.__cesiumBufferedHierarchicalAggregator = this);
|
|
47
62
|
}
|
|
48
63
|
setGroupByTheme(t, e = !0, i = !0) {
|
|
49
64
|
if (this.groupByTheme === t) {
|
|
@@ -59,7 +74,21 @@ class _o {
|
|
|
59
74
|
this.threshold = t, e && this._update();
|
|
60
75
|
}
|
|
61
76
|
setDebugCurrentGrids(t, e = !0) {
|
|
62
|
-
this.debugCurrentGrids = t, t ? this._ensureDebugImageryLayer() : (this._clearDebugGrids(), this._removeDebugImageryLayer()), e && this._update();
|
|
77
|
+
this.debugCurrentGrids = t, t ? this._ensureDebugImageryLayer() : (this._clearDebugGrids(), this._removeDebugImageryLayer(), this.debugHeightBounds = !1), e && this._update();
|
|
78
|
+
}
|
|
79
|
+
/** 开关高度 OBB 调试绘制;开启时会自动保留二维格网作为参照。 */
|
|
80
|
+
setDebugHeightBounds(t, e = !0) {
|
|
81
|
+
this.debugHeightBounds = t, t && !this.debugCurrentGrids && (this.debugCurrentGrids = !0, this._ensureDebugImageryLayer()), e && this._update();
|
|
82
|
+
}
|
|
83
|
+
/** 调整高程包围盒的候选格网扩展圈数;0 表示只保留已渲染格网。 */
|
|
84
|
+
setHeightCandidateNeighborRing(t, e = !0) {
|
|
85
|
+
const i = Number.isFinite(t) ? Math.max(0, Math.floor(t)) : 0;
|
|
86
|
+
i !== this.heightCandidateNeighborRing && (this.heightCandidateNeighborRing = i, e && this._update());
|
|
87
|
+
}
|
|
88
|
+
/** 开关高程格网的三维可见性兜底,便于业务按需验证或降级。 */
|
|
89
|
+
setHeightBoxRetentionEnabled(t, e = !0) {
|
|
90
|
+
const i = !!t;
|
|
91
|
+
i !== this.heightBoxRetentionEnabled && (this.heightBoxRetentionEnabled = i, i || this.heightRetainedCells.clear(), e && this._update());
|
|
63
92
|
}
|
|
64
93
|
_syncTilingSchemeAndLevels() {
|
|
65
94
|
const t = this.viewer.scene && this.viewer.scene.globe, e = t && t._surface, i = e && e._tileProvider, n = (i == null ? void 0 : i.tilingScheme) || new this.Cesium.GeographicTilingScheme(), s = i !== this._lastTileProvider, o = this.tilingScheme !== n;
|
|
@@ -122,17 +151,18 @@ class _o {
|
|
|
122
151
|
if (!l) continue;
|
|
123
152
|
const d = `${l.x}_${l.y}`, u = r.get(d);
|
|
124
153
|
if (u) {
|
|
125
|
-
const g = u.allPoints.findIndex((
|
|
154
|
+
const g = u.allPoints.findIndex((p) => p.id === t.id);
|
|
126
155
|
if (g !== -1 && u.allPoints.splice(g, 1), this._shouldSkipAggregation(i.data)) {
|
|
127
|
-
const
|
|
128
|
-
|
|
156
|
+
const p = u.skipPoints.findIndex((m) => m.id === t.id);
|
|
157
|
+
p !== -1 && u.skipPoints.splice(p, 1);
|
|
129
158
|
} else {
|
|
130
|
-
const
|
|
131
|
-
if (
|
|
132
|
-
const f =
|
|
133
|
-
f !== -1 &&
|
|
159
|
+
const p = this.groupByTheme ? this._getBillboardTheme(i.data) : this.clusterTheme, m = u.groups.get(p);
|
|
160
|
+
if (m) {
|
|
161
|
+
const f = m.findIndex((y) => y.id === t.id);
|
|
162
|
+
f !== -1 && m.splice(f, 1), m.length === 0 && u.groups.delete(p);
|
|
134
163
|
}
|
|
135
164
|
}
|
|
165
|
+
u.heightRangeDirty = !0;
|
|
136
166
|
}
|
|
137
167
|
}
|
|
138
168
|
const n = { ...i, ...t };
|
|
@@ -150,7 +180,7 @@ class _o {
|
|
|
150
180
|
const l = a.filter((d) => !e.has(d.id));
|
|
151
181
|
l.length === 0 ? o.groups.delete(r) : o.groups.set(r, l);
|
|
152
182
|
}
|
|
153
|
-
o.allPoints.length === 0
|
|
183
|
+
o.allPoints.length === 0 ? n.delete(s) : o.heightRangeDirty = !0;
|
|
154
184
|
}
|
|
155
185
|
}
|
|
156
186
|
this._update();
|
|
@@ -177,8 +207,15 @@ class _o {
|
|
|
177
207
|
if (a || (a = {
|
|
178
208
|
allPoints: [],
|
|
179
209
|
groups: /* @__PURE__ */ new Map(),
|
|
180
|
-
skipPoints: []
|
|
181
|
-
|
|
210
|
+
skipPoints: [],
|
|
211
|
+
minHeight: 0,
|
|
212
|
+
maxHeight: 0,
|
|
213
|
+
heightRangeDirty: !1
|
|
214
|
+
}, n.set(r, a)), a.allPoints.push(t), !a.heightRangeDirty) {
|
|
215
|
+
const l = this._getPointHeight(t);
|
|
216
|
+
a.minHeight = Math.min(a.minHeight, l), a.maxHeight = Math.max(a.maxHeight, l);
|
|
217
|
+
}
|
|
218
|
+
if (this._shouldSkipAggregation(t.data))
|
|
182
219
|
a.skipPoints.push(t);
|
|
183
220
|
else {
|
|
184
221
|
const l = this.groupByTheme ? this._getBillboardTheme(t.data) : this.clusterTheme;
|
|
@@ -206,23 +243,28 @@ class _o {
|
|
|
206
243
|
this._syncTilingSchemeAndLevels(), this.labelPool.beginUpdate(), this.debugCurrentGrids && this._clearDebugGrids();
|
|
207
244
|
const t = this.points.length < this.minGlobalPointCount ? 1 / 0 : this.threshold;
|
|
208
245
|
let e = 0;
|
|
209
|
-
const i = (
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
r,
|
|
215
|
-
t,
|
|
216
|
-
e
|
|
217
|
-
);
|
|
246
|
+
const i = /* @__PURE__ */ new Map(), n = (s, o, r, a) => {
|
|
247
|
+
const l = this.levels[s];
|
|
248
|
+
if (!l) return;
|
|
249
|
+
const d = `${l.level}_${o}_${r}`;
|
|
250
|
+
i.has(d) || i.set(d, { levelIdx: s, lonIdx: o, latIdx: r, viewTileLevel: a });
|
|
218
251
|
};
|
|
219
252
|
try {
|
|
220
|
-
const
|
|
221
|
-
if (!
|
|
253
|
+
const s = this._getSurfaceTiles();
|
|
254
|
+
if (!s || s.length === 0) {
|
|
222
255
|
this._handleNoSurfaceTiles(e), this.labelPool.cleanup();
|
|
223
256
|
return;
|
|
224
257
|
}
|
|
225
|
-
this._tilesRetryCount = 0, this._processTiles(n, i);
|
|
258
|
+
this._tilesRetryCount = 0, this._processTiles(s, n), this._appendHeightVisibleCells(i);
|
|
259
|
+
for (const o of i.values())
|
|
260
|
+
if (e = this._processCell(
|
|
261
|
+
o.levelIdx,
|
|
262
|
+
o.lonIdx,
|
|
263
|
+
o.latIdx,
|
|
264
|
+
o.viewTileLevel,
|
|
265
|
+
t,
|
|
266
|
+
e
|
|
267
|
+
), e >= this.displayLimit) break;
|
|
226
268
|
} catch {
|
|
227
269
|
this.labelPool.cleanup();
|
|
228
270
|
return;
|
|
@@ -277,42 +319,194 @@ class _o {
|
|
|
277
319
|
}
|
|
278
320
|
return e;
|
|
279
321
|
}
|
|
322
|
+
_getPointHeight(t) {
|
|
323
|
+
const e = Number(t == null ? void 0 : t.height);
|
|
324
|
+
return Number.isFinite(e) ? e : 0;
|
|
325
|
+
}
|
|
326
|
+
_getCellHeightRange(t) {
|
|
327
|
+
if (!t.heightRangeDirty)
|
|
328
|
+
return { minHeight: t.minHeight, maxHeight: t.maxHeight };
|
|
329
|
+
let e = 0, i = 0;
|
|
330
|
+
for (const n of t.allPoints) {
|
|
331
|
+
const s = this._getPointHeight(n);
|
|
332
|
+
e = Math.min(e, s), i = Math.max(i, s);
|
|
333
|
+
}
|
|
334
|
+
return t.minHeight = e, t.maxHeight = i, t.heightRangeDirty = !1, { minHeight: e, maxHeight: i };
|
|
335
|
+
}
|
|
336
|
+
_createCameraCullingVolume() {
|
|
337
|
+
var t, e, i;
|
|
338
|
+
try {
|
|
339
|
+
const n = (t = this.viewer) == null ? void 0 : t.camera;
|
|
340
|
+
return (i = (e = n == null ? void 0 : n.frustum) == null ? void 0 : e.computeCullingVolume) == null ? void 0 : i.call(
|
|
341
|
+
e,
|
|
342
|
+
n.positionWC,
|
|
343
|
+
n.directionWC,
|
|
344
|
+
n.upWC
|
|
345
|
+
);
|
|
346
|
+
} catch {
|
|
347
|
+
return;
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
_createGlobeOccluder() {
|
|
351
|
+
var t, e, i, n, s, o;
|
|
352
|
+
try {
|
|
353
|
+
const r = (e = (t = this.viewer) == null ? void 0 : t.camera) == null ? void 0 : e.positionWC, a = ((s = (n = (i = this.viewer) == null ? void 0 : i.scene) == null ? void 0 : n.globe) == null ? void 0 : s.ellipsoid) || ((o = this.Cesium.Ellipsoid) == null ? void 0 : o.WGS84);
|
|
354
|
+
return !r || !a || !this.Cesium.EllipsoidalOccluder ? void 0 : new this.Cesium.EllipsoidalOccluder(a, r);
|
|
355
|
+
} catch {
|
|
356
|
+
return;
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
/**
|
|
360
|
+
* 地表瓦片离开渲染集合时,高空/地下点仍可能落在视锥内。使用格网 Rectangle 与
|
|
361
|
+
* [minHeight, maxHeight] 构造 OBB,再同时进行视锥和椭球遮挡判断。
|
|
362
|
+
*/
|
|
363
|
+
_isHeightBoxVisible(t, e, i, n, s) {
|
|
364
|
+
var d, u, g, p, m, f, y, w, v;
|
|
365
|
+
const o = this.levels[t], r = o && ((d = this.gridLayers.get(o.level)) == null ? void 0 : d.get(`${e}_${i}`));
|
|
366
|
+
if (!o || !r || r.allPoints.length === 0) return !1;
|
|
367
|
+
const { minHeight: a, maxHeight: l } = this._getCellHeightRange(r);
|
|
368
|
+
if (a === 0 && l === 0) return !1;
|
|
369
|
+
try {
|
|
370
|
+
const P = this.tilingScheme.tileXYToRectangle(e, i, o.level), b = (y = (u = this.Cesium.OrientedBoundingBox) == null ? void 0 : u.fromRectangle) == null ? void 0 : y.call(
|
|
371
|
+
u,
|
|
372
|
+
P,
|
|
373
|
+
a,
|
|
374
|
+
l,
|
|
375
|
+
((m = (p = (g = this.viewer) == null ? void 0 : g.scene) == null ? void 0 : p.globe) == null ? void 0 : m.ellipsoid) || ((f = this.Cesium.Ellipsoid) == null ? void 0 : f.WGS84)
|
|
376
|
+
);
|
|
377
|
+
if (!b) return !0;
|
|
378
|
+
const C = n || this._createCameraCullingVolume();
|
|
379
|
+
if (C && C.computeVisibility(b) === this.Cesium.Intersect.OUTSIDE)
|
|
380
|
+
return !1;
|
|
381
|
+
const L = s || this._createGlobeOccluder(), E = (v = (w = this.Cesium.BoundingSphere) == null ? void 0 : w.fromOrientedBoundingBox) == null ? void 0 : v.call(w, b);
|
|
382
|
+
return !(L && E && !L.isBoundingSphereVisible(E));
|
|
383
|
+
} catch {
|
|
384
|
+
return !0;
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
_doCellsOverlap(t, e) {
|
|
388
|
+
var r;
|
|
389
|
+
if (t.levelIdx === e.levelIdx)
|
|
390
|
+
return t.lonIdx === e.lonIdx && t.latIdx === e.latIdx;
|
|
391
|
+
const i = this.levels[t.levelIdx], n = this.levels[e.levelIdx];
|
|
392
|
+
if (!i || !n) return !1;
|
|
393
|
+
const s = this.tilingScheme.tileXYToRectangle(t.lonIdx, t.latIdx, i.level), o = this.tilingScheme.tileXYToRectangle(
|
|
394
|
+
e.lonIdx,
|
|
395
|
+
e.latIdx,
|
|
396
|
+
n.level
|
|
397
|
+
);
|
|
398
|
+
return !s || !o ? !1 : (r = this.Cesium.Rectangle) != null && r.intersection ? !!this.Cesium.Rectangle.intersection(s, o) : !(s.east <= o.west || s.west >= o.east || s.north <= o.south || s.south >= o.north);
|
|
399
|
+
}
|
|
400
|
+
/**
|
|
401
|
+
* 从当前地表可见格网的外围扩展少量候选格网。候选最终仍须通过 OBB 视锥测试,
|
|
402
|
+
* 因此不会因简单邻域扩展而显示真实离屏的点。
|
|
403
|
+
*/
|
|
404
|
+
_appendHeightVisibleCells(t) {
|
|
405
|
+
var l, d, u, g;
|
|
406
|
+
if (!this.heightBoxRetentionEnabled) {
|
|
407
|
+
this.heightRetainedCells.clear();
|
|
408
|
+
return;
|
|
409
|
+
}
|
|
410
|
+
const e = this._createCameraCullingVolume(), i = this._createGlobeOccluder(), n = [], s = /* @__PURE__ */ new Set(), o = Array.from(t.values());
|
|
411
|
+
for (const [p, m] of Array.from(this.heightRetainedCells.entries())) {
|
|
412
|
+
if (t.has(p)) {
|
|
413
|
+
this.heightRetainedCells.delete(p);
|
|
414
|
+
continue;
|
|
415
|
+
}
|
|
416
|
+
if (o.some(
|
|
417
|
+
(y) => y.levelIdx !== m.levelIdx && this._doCellsOverlap(m, y)
|
|
418
|
+
) || !this._isHeightBoxVisible(
|
|
419
|
+
m.levelIdx,
|
|
420
|
+
m.lonIdx,
|
|
421
|
+
m.latIdx,
|
|
422
|
+
e,
|
|
423
|
+
i
|
|
424
|
+
)) {
|
|
425
|
+
this.heightRetainedCells.delete(p);
|
|
426
|
+
continue;
|
|
427
|
+
}
|
|
428
|
+
t.set(p, m);
|
|
429
|
+
}
|
|
430
|
+
if (this.heightCandidateNeighborRing <= 0) return;
|
|
431
|
+
const r = /* @__PURE__ */ new Map();
|
|
432
|
+
for (const p of o) {
|
|
433
|
+
const m = r.get(p.levelIdx) || [];
|
|
434
|
+
m.push(p), r.set(p.levelIdx, m);
|
|
435
|
+
}
|
|
436
|
+
for (const [p, m] of r) {
|
|
437
|
+
const f = this.levels[p], 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 = (u = this.tilingScheme).getNumberOfYTilesAtLevel) == null ? void 0 : g.call(u, f.level));
|
|
438
|
+
if (!y || !Number.isFinite(w) || !Number.isFinite(v)) continue;
|
|
439
|
+
const P = new Set(m.map((C) => `${C.lonIdx}_${C.latIdx}`));
|
|
440
|
+
let b = m.map((C) => ({ ...C }));
|
|
441
|
+
for (let C = 1; C <= this.heightCandidateNeighborRing; C++) {
|
|
442
|
+
const L = /* @__PURE__ */ new Map();
|
|
443
|
+
for (const E of b)
|
|
444
|
+
for (let M = -1; M <= 1; M++)
|
|
445
|
+
for (let x = -1; x <= 1; x++) {
|
|
446
|
+
if (M === 0 && x === 0) continue;
|
|
447
|
+
const I = E.latIdx + x;
|
|
448
|
+
if (I < 0 || I >= v) continue;
|
|
449
|
+
const D = ((E.lonIdx + M) % w + w) % w, T = `${D}_${I}`;
|
|
450
|
+
if (P.has(T)) continue;
|
|
451
|
+
P.add(T);
|
|
452
|
+
const S = { ...E, lonIdx: D, latIdx: I };
|
|
453
|
+
L.set(T, S);
|
|
454
|
+
const _ = `${f.level}_${D}_${I}`;
|
|
455
|
+
t.has(_) || s.has(_) || y.get(T) && this._isHeightBoxVisible(p, D, I, e, i) && (n.push(S), s.add(_));
|
|
456
|
+
}
|
|
457
|
+
b = Array.from(L.values());
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
n.sort((p, m) => m.levelIdx - p.levelIdx);
|
|
461
|
+
const a = [];
|
|
462
|
+
for (const p of n) {
|
|
463
|
+
const m = Array.from(t.values()).some(
|
|
464
|
+
(v) => v.levelIdx !== p.levelIdx && this._doCellsOverlap(p, v)
|
|
465
|
+
), f = a.some(
|
|
466
|
+
(v) => v.levelIdx !== p.levelIdx && this._doCellsOverlap(p, v)
|
|
467
|
+
);
|
|
468
|
+
if (m || f) continue;
|
|
469
|
+
a.push(p);
|
|
470
|
+
const w = `${this.levels[p.levelIdx].level}_${p.lonIdx}_${p.latIdx}`;
|
|
471
|
+
t.set(w, p), this.heightRetainedCells.set(w, p);
|
|
472
|
+
}
|
|
473
|
+
}
|
|
280
474
|
_processTiles(t, e) {
|
|
281
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, u, g) => {
|
|
282
476
|
if (!n || !a) return !0;
|
|
283
|
-
const
|
|
284
|
-
return !(!
|
|
477
|
+
const p = this.tilingScheme.tileXYToRectangle(d, u, g);
|
|
478
|
+
return !(!p || p.east <= a.west || p.west >= a.east || p.north <= a.south || p.south >= a.north);
|
|
285
479
|
};
|
|
286
480
|
for (const d of t) {
|
|
287
481
|
const u = d.rectangle, g = d._level ?? d.level;
|
|
288
482
|
if (!u || typeof g != "number") continue;
|
|
289
|
-
const
|
|
290
|
-
if (
|
|
291
|
-
const f = this.levels[
|
|
292
|
-
if (typeof y == "number" && typeof
|
|
483
|
+
const p = this._getGridRefLevel(g), m = this._resolveLevelIndex(p);
|
|
484
|
+
if (m === void 0) continue;
|
|
485
|
+
const f = this.levels[m].level, y = d._x ?? d.x, w = d._y ?? d.y;
|
|
486
|
+
if (typeof y == "number" && typeof w == "number") {
|
|
293
487
|
const T = g - f;
|
|
294
488
|
if (T >= 0) {
|
|
295
|
-
const S = 1 << T, _ = Math.floor(y / S), k = Math.floor(
|
|
489
|
+
const S = 1 << T, _ = Math.floor(y / S), k = Math.floor(w / S), A = `${f}_${_}_${k}`;
|
|
296
490
|
if (i.has(A)) continue;
|
|
297
|
-
i.add(A), e(
|
|
491
|
+
i.add(A), e(m, _, k, g);
|
|
298
492
|
} else {
|
|
299
|
-
const _ = 1 << Math.min(-T, this.maxRefineLevels), k = y * _, A =
|
|
300
|
-
for (let
|
|
301
|
-
for (let
|
|
302
|
-
const
|
|
303
|
-
if (!l(
|
|
304
|
-
const N = `${f}_${
|
|
305
|
-
i.has(N) || (i.add(N), e(
|
|
493
|
+
const _ = 1 << Math.min(-T, this.maxRefineLevels), k = y * _, A = w * _;
|
|
494
|
+
for (let R = 0; R < _; R++)
|
|
495
|
+
for (let H = 0; H < _; H++) {
|
|
496
|
+
const B = k + R, Y = A + H;
|
|
497
|
+
if (!l(B, Y, f)) continue;
|
|
498
|
+
const N = `${f}_${B}_${Y}`;
|
|
499
|
+
i.has(N) || (i.add(N), e(m, B, Y, g));
|
|
306
500
|
}
|
|
307
501
|
}
|
|
308
502
|
continue;
|
|
309
503
|
}
|
|
310
|
-
const P = this.levels[
|
|
504
|
+
const P = this.levels[m].size, b = this.Cesium.Math.toDegrees(u.west), C = this.Cesium.Math.toDegrees(u.east), L = this.Cesium.Math.toDegrees(u.south), E = this.Cesium.Math.toDegrees(u.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);
|
|
311
505
|
for (let T = M; T <= x; T++)
|
|
312
506
|
for (let S = I; S <= D; S++) {
|
|
313
507
|
if (!l(T, S, f)) continue;
|
|
314
508
|
const _ = `${f}_${T}_${S}`;
|
|
315
|
-
i.has(_) || (i.add(_), e(
|
|
509
|
+
i.has(_) || (i.add(_), e(m, T, S, g));
|
|
316
510
|
}
|
|
317
511
|
}
|
|
318
512
|
}
|
|
@@ -327,7 +521,7 @@ class _o {
|
|
|
327
521
|
if (!r) return null;
|
|
328
522
|
const a = `${e}_${i}`, l = r.get(a);
|
|
329
523
|
if (!l) return null;
|
|
330
|
-
const d = this.tilingScheme.tileXYToRectangle(e, i, o), u = this.Cesium.Math.toDegrees(d.west), g = this.Cesium.Math.toDegrees(d.south),
|
|
524
|
+
const d = this.tilingScheme.tileXYToRectangle(e, i, o), u = this.Cesium.Math.toDegrees(d.west), g = this.Cesium.Math.toDegrees(d.south), p = this.Cesium.Math.toDegrees(d.east), m = this.Cesium.Math.toDegrees(d.north), f = (u + p) / 2, y = (g + m) / 2;
|
|
331
525
|
return {
|
|
332
526
|
levelIdx: t,
|
|
333
527
|
tileLevel: o,
|
|
@@ -338,8 +532,8 @@ class _o {
|
|
|
338
532
|
rect: d,
|
|
339
533
|
west: u,
|
|
340
534
|
south: g,
|
|
341
|
-
east:
|
|
342
|
-
north:
|
|
535
|
+
east: p,
|
|
536
|
+
north: m,
|
|
343
537
|
centerLon: f,
|
|
344
538
|
centerLat: y,
|
|
345
539
|
viewTileLevel: n
|
|
@@ -363,7 +557,7 @@ class _o {
|
|
|
363
557
|
return e;
|
|
364
558
|
}
|
|
365
559
|
_processCellGroups(t, e, i) {
|
|
366
|
-
var g,
|
|
560
|
+
var g, p, m, f, y, w, v;
|
|
367
561
|
const {
|
|
368
562
|
levelIdx: n,
|
|
369
563
|
lonIdx: s,
|
|
@@ -379,8 +573,8 @@ class _o {
|
|
|
379
573
|
return ((D = I.data) == null ? void 0 : D.show) !== !1;
|
|
380
574
|
});
|
|
381
575
|
if (C.length === 0) continue;
|
|
382
|
-
let
|
|
383
|
-
if (this.centralPointMode == "firstPoint" && (
|
|
576
|
+
let L = a, E = l, M = ((g = C[0]) == null ? void 0 : g.height) || 0;
|
|
577
|
+
if (this.centralPointMode == "firstPoint" && (L = ((p = C[0]) == null ? void 0 : p.lon) || 0, E = ((m = C[0]) == null ? void 0 : m.lat) || 0, M = ((f = C[0]) == null ? void 0 : f.height) || 0), n === this.levels.length - 1 || C.length < e)
|
|
384
578
|
for (const I of C) {
|
|
385
579
|
if (i >= this.displayLimit) break;
|
|
386
580
|
this._isVisibleAtLevel(I, u) && (this.labelPool.add(I.data, {
|
|
@@ -401,7 +595,7 @@ class _o {
|
|
|
401
595
|
this.labelPool.add(
|
|
402
596
|
{
|
|
403
597
|
id: S,
|
|
404
|
-
billboard: ((
|
|
598
|
+
billboard: ((v = (w = I[0]) == null ? void 0 : w.data) == null ? void 0 : v.billboard) || [],
|
|
405
599
|
count: I.length,
|
|
406
600
|
gridKey: `${s}_${o}`,
|
|
407
601
|
points: I,
|
|
@@ -409,8 +603,8 @@ class _o {
|
|
|
409
603
|
},
|
|
410
604
|
{
|
|
411
605
|
id: S,
|
|
412
|
-
lon:
|
|
413
|
-
lat:
|
|
606
|
+
lon: L,
|
|
607
|
+
lat: E,
|
|
414
608
|
height: M,
|
|
415
609
|
theme: T
|
|
416
610
|
}
|
|
@@ -421,20 +615,24 @@ class _o {
|
|
|
421
615
|
}
|
|
422
616
|
_debugDrawCell(t) {
|
|
423
617
|
if (!this.debugCurrentGrids) return;
|
|
424
|
-
const { levelIdx: e, west: i, south: n, east: s, north: o, lonIdx: r, latIdx: a } = t,
|
|
618
|
+
const { levelIdx: e, west: i, south: n, east: s, north: o, lonIdx: r, latIdx: a, cell: l } = t, d = this.levels[e].level, u = this.heightRetainedCells.has(
|
|
619
|
+
`${d}_${r}_${a}`
|
|
620
|
+
);
|
|
425
621
|
this._drawDebugGrid(
|
|
426
622
|
i,
|
|
427
623
|
n,
|
|
428
624
|
s,
|
|
429
625
|
o,
|
|
430
|
-
`L:${
|
|
626
|
+
`L:${d} X:${r} Y:${a}`,
|
|
627
|
+
l,
|
|
628
|
+
u
|
|
431
629
|
);
|
|
432
630
|
}
|
|
433
631
|
refresh() {
|
|
434
632
|
this._update();
|
|
435
633
|
}
|
|
436
|
-
_drawDebugGrid(t, e, i, n, s) {
|
|
437
|
-
const
|
|
634
|
+
_drawDebugGrid(t, e, i, n, s, o, r = !1) {
|
|
635
|
+
const a = this.Cesium.Rectangle.fromDegrees(t, e, i, n), l = this.Cesium.Cartesian3.fromDegreesArray([
|
|
438
636
|
t,
|
|
439
637
|
e,
|
|
440
638
|
i,
|
|
@@ -445,9 +643,9 @@ class _o {
|
|
|
445
643
|
n,
|
|
446
644
|
t,
|
|
447
645
|
e
|
|
448
|
-
]),
|
|
646
|
+
]), d = this.viewer.entities.add({
|
|
449
647
|
rectangle: {
|
|
450
|
-
coordinates:
|
|
648
|
+
coordinates: a,
|
|
451
649
|
material: this.Cesium.Color.YELLOW.withAlpha(0.2),
|
|
452
650
|
outline: !0,
|
|
453
651
|
outlineColor: this.Cesium.Color.RED,
|
|
@@ -457,7 +655,7 @@ class _o {
|
|
|
457
655
|
},
|
|
458
656
|
// 额外一圈贴地边框线,避免依赖 rectangle.outline
|
|
459
657
|
polyline: {
|
|
460
|
-
positions:
|
|
658
|
+
positions: l,
|
|
461
659
|
width: 2,
|
|
462
660
|
material: this.Cesium.Color.RED,
|
|
463
661
|
clampToGround: !0
|
|
@@ -473,7 +671,83 @@ class _o {
|
|
|
473
671
|
horizontalOrigin: this.Cesium.HorizontalOrigin.CENTER
|
|
474
672
|
}
|
|
475
673
|
});
|
|
476
|
-
this.debugGrids.push(
|
|
674
|
+
this.debugGrids.push(d), this.debugHeightBounds && o && this._drawDebugHeightBounds(t, e, i, n, s, o, r);
|
|
675
|
+
}
|
|
676
|
+
/**
|
|
677
|
+
* 用和可见性判断相同的 Rectangle + [minHeight, maxHeight] 绘制 OBB 线框,
|
|
678
|
+
* 便于确认“地表离屏但高程标记仍可见”的候选格网是否被正确选中。
|
|
679
|
+
*/
|
|
680
|
+
_drawDebugHeightBounds(t, e, i, n, s, o, r) {
|
|
681
|
+
var p, m, f, y, w, v;
|
|
682
|
+
const { minHeight: a, maxHeight: l } = this._getCellHeightRange(o), d = this.Cesium.Rectangle.fromDegrees(t, e, i, n), u = ((f = (m = (p = this.viewer) == null ? void 0 : p.scene) == null ? void 0 : m.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
|
+
w,
|
|
684
|
+
d,
|
|
685
|
+
a,
|
|
686
|
+
l,
|
|
687
|
+
u
|
|
688
|
+
);
|
|
689
|
+
if (g)
|
|
690
|
+
try {
|
|
691
|
+
const P = this.Cesium.Matrix3.getColumn(
|
|
692
|
+
g.halfAxes,
|
|
693
|
+
0,
|
|
694
|
+
new this.Cesium.Cartesian3()
|
|
695
|
+
), b = this.Cesium.Matrix3.getColumn(
|
|
696
|
+
g.halfAxes,
|
|
697
|
+
1,
|
|
698
|
+
new this.Cesium.Cartesian3()
|
|
699
|
+
), C = this.Cesium.Matrix3.getColumn(
|
|
700
|
+
g.halfAxes,
|
|
701
|
+
2,
|
|
702
|
+
new this.Cesium.Cartesian3()
|
|
703
|
+
), L = (B, Y, N) => {
|
|
704
|
+
const z = this.Cesium.Cartesian3.clone(g.center, new this.Cesium.Cartesian3()), V = new this.Cesium.Cartesian3();
|
|
705
|
+
return this.Cesium.Cartesian3.add(
|
|
706
|
+
z,
|
|
707
|
+
this.Cesium.Cartesian3.multiplyByScalar(P, B, V),
|
|
708
|
+
z
|
|
709
|
+
), this.Cesium.Cartesian3.add(
|
|
710
|
+
z,
|
|
711
|
+
this.Cesium.Cartesian3.multiplyByScalar(b, Y, V),
|
|
712
|
+
z
|
|
713
|
+
), this.Cesium.Cartesian3.add(
|
|
714
|
+
z,
|
|
715
|
+
this.Cesium.Cartesian3.multiplyByScalar(C, N, V),
|
|
716
|
+
z
|
|
717
|
+
), z;
|
|
718
|
+
}, E = L(-1, -1, -1), M = L(1, -1, -1), x = L(1, 1, -1), I = L(-1, 1, -1), D = L(-1, -1, 1), T = L(1, -1, 1), S = L(1, 1, 1), _ = L(-1, 1, 1), k = r ? this.Cesium.Color.ORANGE.withAlpha(1) : this.Cesium.Color.CYAN.withAlpha(0.9), A = this.viewer.entities.add({
|
|
719
|
+
polyline: {
|
|
720
|
+
// 连续路径覆盖 12 条盒子边;个别边重复仅用于将独立边串为一个 Polyline。
|
|
721
|
+
positions: [E, M, x, I, E, D, T, S, _, D, T, M, x, S, _, I],
|
|
722
|
+
width: 3,
|
|
723
|
+
material: k
|
|
724
|
+
}
|
|
725
|
+
});
|
|
726
|
+
this.debugGrids.push(A);
|
|
727
|
+
const R = this.Cesium.Cartesian3.add(
|
|
728
|
+
g.center,
|
|
729
|
+
C,
|
|
730
|
+
new this.Cesium.Cartesian3()
|
|
731
|
+
), H = this.viewer.entities.add({
|
|
732
|
+
position: R,
|
|
733
|
+
label: {
|
|
734
|
+
text: `${s}
|
|
735
|
+
${r ? "状态: 高度 Box 保留" : "状态: 地表格网可见"}
|
|
736
|
+
H: ${a.toFixed(1)} ~ ${l.toFixed(1)}m`,
|
|
737
|
+
font: "13px sans-serif",
|
|
738
|
+
fillColor: k,
|
|
739
|
+
outlineColor: this.Cesium.Color.BLACK,
|
|
740
|
+
outlineWidth: 2,
|
|
741
|
+
style: this.Cesium.LabelStyle.FILL_AND_OUTLINE,
|
|
742
|
+
verticalOrigin: this.Cesium.VerticalOrigin.BOTTOM,
|
|
743
|
+
horizontalOrigin: this.Cesium.HorizontalOrigin.CENTER,
|
|
744
|
+
pixelOffset: new this.Cesium.Cartesian2(0, -8),
|
|
745
|
+
disableDepthTestDistance: Number.POSITIVE_INFINITY
|
|
746
|
+
}
|
|
747
|
+
});
|
|
748
|
+
this.debugGrids.push(H);
|
|
749
|
+
} catch {
|
|
750
|
+
}
|
|
477
751
|
}
|
|
478
752
|
_clearDebugGrids() {
|
|
479
753
|
for (const t of this.debugGrids)
|
|
@@ -501,7 +775,7 @@ class _o {
|
|
|
501
775
|
destroy() {
|
|
502
776
|
this._cameraChangedHandler && (this.viewer.camera.changed.removeEventListener(this._cameraChangedHandler), this._cameraChangedHandler = null);
|
|
503
777
|
const t = this.viewer.scene, e = t && t.globe;
|
|
504
|
-
e && this._tileLoadListener && (e.tileLoadProgressEvent.removeEventListener(this._tileLoadListener), this._tileLoadListener = null), this._updateTimer !== null && (clearTimeout(this._updateTimer), this._updateTimer = null), this.labelPool.reset(), this._clearDebugGrids(), this._removeDebugImageryLayer();
|
|
778
|
+
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._clearDebugGrids(), this._removeDebugImageryLayer(), typeof window < "u" && window.__cesiumBufferedHierarchicalAggregator === this && delete window.__cesiumBufferedHierarchicalAggregator;
|
|
505
779
|
}
|
|
506
780
|
}
|
|
507
781
|
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 || {});
|
|
@@ -563,7 +837,7 @@ const Yt = {
|
|
|
563
837
|
[te.MouseDown]: "mousedown",
|
|
564
838
|
[te.MouseUp]: "mouseup"
|
|
565
839
|
};
|
|
566
|
-
function
|
|
840
|
+
function Vt() {
|
|
567
841
|
var h;
|
|
568
842
|
if (typeof window > "u") return !1;
|
|
569
843
|
try {
|
|
@@ -572,10 +846,10 @@ function jt() {
|
|
|
572
846
|
return !1;
|
|
573
847
|
}
|
|
574
848
|
}
|
|
575
|
-
function
|
|
576
|
-
|
|
849
|
+
function jt(h, t = {}) {
|
|
850
|
+
Vt() && console.log("[DeviceAlarm][OverlayPool]", h, t);
|
|
577
851
|
}
|
|
578
|
-
class
|
|
852
|
+
class G {
|
|
579
853
|
/**
|
|
580
854
|
* 构造函数
|
|
581
855
|
* @param Cesium Cesium 命名空间
|
|
@@ -663,53 +937,53 @@ class z {
|
|
|
663
937
|
console.warn(`Theme "${r}" not registered`);
|
|
664
938
|
return;
|
|
665
939
|
}
|
|
666
|
-
let
|
|
667
|
-
if (
|
|
668
|
-
const
|
|
669
|
-
if (
|
|
940
|
+
let p = this.labels.get(i);
|
|
941
|
+
if (p) {
|
|
942
|
+
const m = p.theme !== r || p.data !== t || p.notCreateElement !== l || !p.el.parentNode;
|
|
943
|
+
if (p.theme = r, p.data = t, p.notCreateElement = l, p.persistent = d, m)
|
|
670
944
|
try {
|
|
671
|
-
typeof
|
|
945
|
+
typeof p.unload == "function" && p.unload(), p.el.replaceChildren(), p.unload = g.createElement(p.el, { id: i, theme: r, data: t }, g) || {};
|
|
672
946
|
} catch (f) {
|
|
673
947
|
console.error(`Error updating label element for id "${i}":`, f);
|
|
674
948
|
}
|
|
675
|
-
(!l || a) &&
|
|
949
|
+
(!l || a) && p.el.parentNode !== this.container && this.container.appendChild(p.el);
|
|
676
950
|
} else {
|
|
677
|
-
const
|
|
678
|
-
Object.assign(
|
|
951
|
+
const m = document.createElement("div");
|
|
952
|
+
Object.assign(m.style, {
|
|
679
953
|
position: "absolute",
|
|
680
954
|
transform: "translate(0, 0)",
|
|
681
955
|
pointerEvents: "auto",
|
|
682
956
|
...e.style || {}
|
|
683
957
|
});
|
|
684
|
-
for (const [y,
|
|
685
|
-
|
|
958
|
+
for (const [y, w] of Object.entries(Yt)) {
|
|
959
|
+
m.addEventListener(w, (P) => {
|
|
686
960
|
P.stopPropagation();
|
|
687
961
|
const b = this.labels.get(i);
|
|
688
962
|
this.eventBus.runListener(y, b, P);
|
|
689
963
|
});
|
|
690
|
-
let
|
|
691
|
-
|
|
964
|
+
let v = 0;
|
|
965
|
+
m.addEventListener("wheel", (P) => {
|
|
692
966
|
if (!this.openWheel) return;
|
|
693
967
|
const b = P.currentTarget;
|
|
694
|
-
|
|
695
|
-
const C =
|
|
968
|
+
v = Date.now();
|
|
969
|
+
const C = v;
|
|
696
970
|
b.style.pointerEvents = "none", setTimeout(() => {
|
|
697
|
-
|
|
971
|
+
v === C && (b.style.pointerEvents = "auto");
|
|
698
972
|
}, 2e3);
|
|
699
973
|
});
|
|
700
974
|
}
|
|
701
975
|
let f = null;
|
|
702
976
|
if (!l || a) {
|
|
703
977
|
try {
|
|
704
|
-
f = g.createElement(
|
|
978
|
+
f = g.createElement(m, { id: i, theme: r, data: t }, g) || {};
|
|
705
979
|
} catch (y) {
|
|
706
980
|
console.error(`Error updating label element for id "${i}":`, y);
|
|
707
981
|
}
|
|
708
|
-
this.container.appendChild(
|
|
982
|
+
this.container.appendChild(m);
|
|
709
983
|
}
|
|
710
|
-
|
|
984
|
+
p = { id: i, el: m, theme: r, data: t, notCreateElement: l, persistent: d, unload: f }, this.labels.set(i, p);
|
|
711
985
|
}
|
|
712
|
-
|
|
986
|
+
p.el.dataset.lon = String(n), p.el.dataset.lat = String(s), p.el.dataset.height = String(o), p.offset = e.offset, p.anchor = e.anchor || "top-left", Object.assign(p.el.style, e.style || {}), p.el.style.zIndex = (u == null ? void 0 : u.zIndex) || "1", p.el.style.display = a ? "block" : "none", a && this.activeIds.add(i), a ? this._scheduleOcclusionCheck() : (this.activeIds.delete(i), this.occludedIds.delete(i));
|
|
713
987
|
}
|
|
714
988
|
/**
|
|
715
989
|
* 批量添加标签
|
|
@@ -844,7 +1118,7 @@ class z {
|
|
|
844
1118
|
for (const [t, e] of this.labels.entries())
|
|
845
1119
|
if (!this.activeIds.has(t)) {
|
|
846
1120
|
if (e.persistent) {
|
|
847
|
-
|
|
1121
|
+
jt("skip-persistent-cleanup", { id: t, display: e.el.style.display });
|
|
848
1122
|
continue;
|
|
849
1123
|
}
|
|
850
1124
|
e.el.style.display = "none", this.occludedIds.delete(t);
|
|
@@ -901,10 +1175,10 @@ class z {
|
|
|
901
1175
|
}
|
|
902
1176
|
const r = this.Cesium.Cartesian3.fromDegrees(n, s, o), a = this.toWindowCoordinates(r);
|
|
903
1177
|
if (this.Cesium.defined(a)) {
|
|
904
|
-
const l = this.themes[i.theme], d = i.offset || ((t = l.options) == null ? void 0 : t.offset) || {}, u = d.x || 0, g = d.y || 0,
|
|
1178
|
+
const l = this.themes[i.theme], d = i.offset || ((t = l.options) == null ? void 0 : t.offset) || {}, u = d.x || 0, g = d.y || 0, p = this.occludedIds.has(e);
|
|
905
1179
|
i.el.style.left = `${a.x}px`, i.el.style.top = `${a.y}px`;
|
|
906
|
-
const
|
|
907
|
-
i.el.style.transform = `${
|
|
1180
|
+
const m = this.getAnchorTransform(i.anchor);
|
|
1181
|
+
i.el.style.transform = `${m}${m ? " " : ""}translate(${u}px, ${g}px)`, i.el.style.display = p ? "none" : "block";
|
|
908
1182
|
} else
|
|
909
1183
|
i.el.style.display = "none";
|
|
910
1184
|
}
|
|
@@ -958,7 +1232,7 @@ class z {
|
|
|
958
1232
|
occluded: !0,
|
|
959
1233
|
reason: "pick-empty"
|
|
960
1234
|
}), !0;
|
|
961
|
-
const
|
|
1235
|
+
const p = Number(this.occlusionOptions.distanceEpsilon) || 0, m = l.Cartesian3.distance(a.positionWC, e), f = l.Cartesian3.distance(a.positionWC, g), y = f + p < m;
|
|
962
1236
|
return this._pushOcclusionLog({
|
|
963
1237
|
timestamp: Date.now(),
|
|
964
1238
|
id: t,
|
|
@@ -967,8 +1241,8 @@ class z {
|
|
|
967
1241
|
height: o,
|
|
968
1242
|
occluded: y,
|
|
969
1243
|
reason: "distance-compare",
|
|
970
|
-
epsilon:
|
|
971
|
-
labelDistance:
|
|
1244
|
+
epsilon: p,
|
|
1245
|
+
labelDistance: m,
|
|
972
1246
|
pickedDistance: f
|
|
973
1247
|
}), y;
|
|
974
1248
|
} catch {
|
|
@@ -1093,7 +1367,7 @@ class Wt {
|
|
|
1093
1367
|
startDrawing(t) {
|
|
1094
1368
|
const { Cesium: e, viewer: i } = this;
|
|
1095
1369
|
this.tooltip = new ce(), this.tooltip.show("左键添加点"), this.handler = new e.ScreenSpaceEventHandler(i.canvas), this.handler.setInputAction((n) => {
|
|
1096
|
-
var g,
|
|
1370
|
+
var g, p;
|
|
1097
1371
|
const s = i.scene.pickPosition(n.position);
|
|
1098
1372
|
if (!s) return;
|
|
1099
1373
|
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({
|
|
@@ -1113,7 +1387,7 @@ class Wt {
|
|
|
1113
1387
|
this.clear();
|
|
1114
1388
|
}
|
|
1115
1389
|
};
|
|
1116
|
-
(g = t.onComplete) == null || g.call(t, u), this.stopDrawing(), (
|
|
1390
|
+
(g = t.onComplete) == null || g.call(t, u), this.stopDrawing(), (p = this.tooltip) == null || p.hide(), this.tooltip = null;
|
|
1117
1391
|
}, e.ScreenSpaceEventType.LEFT_CLICK);
|
|
1118
1392
|
}
|
|
1119
1393
|
stopDrawing() {
|
|
@@ -1367,30 +1641,30 @@ class Xt {
|
|
|
1367
1641
|
height: s.height
|
|
1368
1642
|
}, r = (t == null ? void 0 : t.step) || 1, a = [], l = [];
|
|
1369
1643
|
for (let g = 0; g < 360; g += r) {
|
|
1370
|
-
const
|
|
1371
|
-
|
|
1644
|
+
const p = this.Cesium.Math.toRadians(g), m = new this.Cesium.EllipsoidGeodesic();
|
|
1645
|
+
m.setEndPoints(
|
|
1372
1646
|
s,
|
|
1373
1647
|
new this.Cesium.Cartographic(
|
|
1374
|
-
s.longitude + 1e-4 * Math.cos(
|
|
1375
|
-
s.latitude + 1e-4 * Math.sin(
|
|
1648
|
+
s.longitude + 1e-4 * Math.cos(p),
|
|
1649
|
+
s.latitude + 1e-4 * Math.sin(p)
|
|
1376
1650
|
)
|
|
1377
1651
|
);
|
|
1378
|
-
const f =
|
|
1652
|
+
const f = m.interpolateUsingSurfaceDistance(n), y = this.Cesium.Ellipsoid.WGS84.cartographicToCartesian(f);
|
|
1379
1653
|
a.push(y);
|
|
1380
|
-
const
|
|
1654
|
+
const w = this.Cesium.Cartographic.fromCartesian(y);
|
|
1381
1655
|
l.push({
|
|
1382
|
-
lng: this.Cesium.Math.toDegrees(
|
|
1383
|
-
lat: this.Cesium.Math.toDegrees(
|
|
1384
|
-
height:
|
|
1656
|
+
lng: this.Cesium.Math.toDegrees(w.longitude),
|
|
1657
|
+
lat: this.Cesium.Math.toDegrees(w.latitude),
|
|
1658
|
+
height: w.height
|
|
1385
1659
|
});
|
|
1386
1660
|
}
|
|
1387
1661
|
l.push(l[0]);
|
|
1388
1662
|
const d = this.positions.map((g) => {
|
|
1389
|
-
const
|
|
1663
|
+
const p = this.Cesium.Cartographic.fromCartesian(g);
|
|
1390
1664
|
return {
|
|
1391
|
-
lng: this.Cesium.Math.toDegrees(
|
|
1392
|
-
lat: this.Cesium.Math.toDegrees(
|
|
1393
|
-
height:
|
|
1665
|
+
lng: this.Cesium.Math.toDegrees(p.longitude),
|
|
1666
|
+
lat: this.Cesium.Math.toDegrees(p.latitude),
|
|
1667
|
+
height: p.height
|
|
1394
1668
|
};
|
|
1395
1669
|
});
|
|
1396
1670
|
(u = t.onComplete) == null || u.call(t, {
|
|
@@ -1603,19 +1877,19 @@ function Ie(h) {
|
|
|
1603
1877
|
return h != null && typeof h == "object";
|
|
1604
1878
|
}
|
|
1605
1879
|
var Le = Array.isArray;
|
|
1606
|
-
function
|
|
1880
|
+
function Oe(h) {
|
|
1607
1881
|
var t = typeof h;
|
|
1608
1882
|
return h != null && (t == "object" || t == "function");
|
|
1609
1883
|
}
|
|
1610
1884
|
var ri = "[object AsyncFunction]", ai = "[object Function]", li = "[object GeneratorFunction]", hi = "[object Proxy]";
|
|
1611
1885
|
function Mt(h) {
|
|
1612
|
-
if (!
|
|
1886
|
+
if (!Oe(h))
|
|
1613
1887
|
return !1;
|
|
1614
1888
|
var t = xe(h);
|
|
1615
1889
|
return t == ai || t == li || t == ri || t == hi;
|
|
1616
1890
|
}
|
|
1617
|
-
var
|
|
1618
|
-
var h = /[^.]+$/.exec(
|
|
1891
|
+
var ze = ie["__core-js_shared__"], Xe = (function() {
|
|
1892
|
+
var h = /[^.]+$/.exec(ze && ze.keys && ze.keys.IE_PROTO || "");
|
|
1619
1893
|
return h ? "Symbol(src)_1." + h : "";
|
|
1620
1894
|
})();
|
|
1621
1895
|
function ci(h) {
|
|
@@ -1639,7 +1913,7 @@ var pi = /[\\^$.*+?()[\]{}|]/g, mi = /^\[object .+?Constructor\]$/, gi = Functio
|
|
|
1639
1913
|
"^" + yi.call(wi).replace(pi, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
|
|
1640
1914
|
);
|
|
1641
1915
|
function Ci(h) {
|
|
1642
|
-
if (!
|
|
1916
|
+
if (!Oe(h) || ci(h))
|
|
1643
1917
|
return !1;
|
|
1644
1918
|
var t = Mt(h) ? vi : mi;
|
|
1645
1919
|
return t.test(de(h));
|
|
@@ -1655,7 +1929,7 @@ var Be = ue(ie, "WeakMap"), qe = Object.create, Pi = /* @__PURE__ */ (function()
|
|
|
1655
1929
|
function h() {
|
|
1656
1930
|
}
|
|
1657
1931
|
return function(t) {
|
|
1658
|
-
if (!
|
|
1932
|
+
if (!Oe(t))
|
|
1659
1933
|
return {};
|
|
1660
1934
|
if (qe)
|
|
1661
1935
|
return qe(t);
|
|
@@ -1708,26 +1982,26 @@ function Tt(h) {
|
|
|
1708
1982
|
var t = h && h.constructor, e = typeof t == "function" && t.prototype || ki;
|
|
1709
1983
|
return h === e;
|
|
1710
1984
|
}
|
|
1711
|
-
function
|
|
1985
|
+
function Ri(h, t) {
|
|
1712
1986
|
for (var e = -1, i = Array(h); ++e < h; )
|
|
1713
1987
|
i[e] = t(e);
|
|
1714
1988
|
return i;
|
|
1715
1989
|
}
|
|
1716
|
-
var
|
|
1990
|
+
var $i = "[object Arguments]";
|
|
1717
1991
|
function Je(h) {
|
|
1718
|
-
return Ie(h) && xe(h) ==
|
|
1992
|
+
return Ie(h) && xe(h) == $i;
|
|
1719
1993
|
}
|
|
1720
|
-
var _t = Object.prototype,
|
|
1994
|
+
var _t = Object.prototype, Hi = _t.hasOwnProperty, Oi = _t.propertyIsEnumerable, Fi = Je(/* @__PURE__ */ (function() {
|
|
1721
1995
|
return arguments;
|
|
1722
1996
|
})()) ? Je : function(h) {
|
|
1723
|
-
return Ie(h) &&
|
|
1997
|
+
return Ie(h) && Hi.call(h, "callee") && !Oi.call(h, "callee");
|
|
1724
1998
|
};
|
|
1725
|
-
function
|
|
1999
|
+
function Ni() {
|
|
1726
2000
|
return !1;
|
|
1727
2001
|
}
|
|
1728
|
-
var Dt = typeof exports == "object" && exports && !exports.nodeType && exports, Qe = Dt && typeof module == "object" && module && !module.nodeType && module,
|
|
2002
|
+
var Dt = typeof exports == "object" && exports && !exports.nodeType && exports, Qe = Dt && typeof module == "object" && module && !module.nodeType && module, zi = Qe && Qe.exports === Dt, et = zi ? ie.Buffer : void 0, Gi = et ? et.isBuffer : void 0, St = Gi || Ni, Bi = "[object Arguments]", Yi = "[object Array]", Vi = "[object Boolean]", ji = "[object Date]", Wi = "[object Error]", Ui = "[object Function]", Ki = "[object Map]", Xi = "[object Number]", qi = "[object Object]", Zi = "[object RegExp]", Ji = "[object Set]", Qi = "[object String]", es = "[object WeakMap]", ts = "[object ArrayBuffer]", is = "[object DataView]", ss = "[object Float32Array]", ns = "[object Float64Array]", os = "[object Int8Array]", rs = "[object Int16Array]", as = "[object Int32Array]", ls = "[object Uint8Array]", hs = "[object Uint8ClampedArray]", cs = "[object Uint16Array]", ds = "[object Uint32Array]", F = {};
|
|
1729
2003
|
F[ss] = F[ns] = F[os] = F[rs] = F[as] = F[ls] = F[hs] = F[cs] = F[ds] = !0;
|
|
1730
|
-
F[Bi] = F[Yi] = F[ts] = F[
|
|
2004
|
+
F[Bi] = F[Yi] = F[ts] = F[Vi] = F[is] = F[ji] = F[Wi] = F[Ui] = F[Ki] = F[Xi] = F[qi] = F[Zi] = F[Ji] = F[Qi] = F[es] = !1;
|
|
1731
2005
|
function us(h) {
|
|
1732
2006
|
return Ie(h) && It(h.length) && !!F[xe(h)];
|
|
1733
2007
|
}
|
|
@@ -1744,7 +2018,7 @@ var At = typeof exports == "object" && exports && !exports.nodeType && exports,
|
|
|
1744
2018
|
}
|
|
1745
2019
|
})(), tt = ye && ye.isTypedArray, ms = tt ? We(tt) : us, gs = Object.prototype, fs = gs.hasOwnProperty;
|
|
1746
2020
|
function ys(h, t) {
|
|
1747
|
-
var e = Le(h), i = !e && Fi(h), n = !e && !i && St(h), s = !e && !i && !n && ms(h), o = e || i || n || s, r = o ?
|
|
2021
|
+
var e = Le(h), i = !e && Fi(h), n = !e && !i && St(h), s = !e && !i && !n && ms(h), o = e || i || n || s, r = o ? Ri(h.length, String) : [], a = r.length;
|
|
1748
2022
|
for (var l in h)
|
|
1749
2023
|
fs.call(h, l) && !(o && // Safari 9 has enumerable `arguments.length` in strict mode.
|
|
1750
2024
|
(l == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
|
|
@@ -1809,7 +2083,7 @@ he.prototype.delete = Es;
|
|
|
1809
2083
|
he.prototype.get = Ts;
|
|
1810
2084
|
he.prototype.has = Ss;
|
|
1811
2085
|
he.prototype.set = ks;
|
|
1812
|
-
function
|
|
2086
|
+
function Rs() {
|
|
1813
2087
|
this.__data__ = [], this.size = 0;
|
|
1814
2088
|
}
|
|
1815
2089
|
function Fe(h, t) {
|
|
@@ -1818,22 +2092,22 @@ function Fe(h, t) {
|
|
|
1818
2092
|
return e;
|
|
1819
2093
|
return -1;
|
|
1820
2094
|
}
|
|
1821
|
-
var
|
|
1822
|
-
function
|
|
2095
|
+
var $s = Array.prototype, Hs = $s.splice;
|
|
2096
|
+
function Os(h) {
|
|
1823
2097
|
var t = this.__data__, e = Fe(t, h);
|
|
1824
2098
|
if (e < 0)
|
|
1825
2099
|
return !1;
|
|
1826
2100
|
var i = t.length - 1;
|
|
1827
|
-
return e == i ? t.pop() :
|
|
2101
|
+
return e == i ? t.pop() : Hs.call(t, e, 1), --this.size, !0;
|
|
1828
2102
|
}
|
|
1829
2103
|
function Fs(h) {
|
|
1830
2104
|
var t = this.__data__, e = Fe(t, h);
|
|
1831
2105
|
return e < 0 ? void 0 : t[e][1];
|
|
1832
2106
|
}
|
|
1833
|
-
function
|
|
2107
|
+
function Ns(h) {
|
|
1834
2108
|
return Fe(this.__data__, h) > -1;
|
|
1835
2109
|
}
|
|
1836
|
-
function
|
|
2110
|
+
function zs(h, t) {
|
|
1837
2111
|
var e = this.__data__, i = Fe(e, h);
|
|
1838
2112
|
return i < 0 ? (++this.size, e.push([h, t])) : e[i][1] = t, this;
|
|
1839
2113
|
}
|
|
@@ -1844,11 +2118,11 @@ function ae(h) {
|
|
|
1844
2118
|
this.set(i[0], i[1]);
|
|
1845
2119
|
}
|
|
1846
2120
|
}
|
|
1847
|
-
ae.prototype.clear =
|
|
1848
|
-
ae.prototype.delete =
|
|
2121
|
+
ae.prototype.clear = Rs;
|
|
2122
|
+
ae.prototype.delete = Os;
|
|
1849
2123
|
ae.prototype.get = Fs;
|
|
1850
|
-
ae.prototype.has =
|
|
1851
|
-
ae.prototype.set =
|
|
2124
|
+
ae.prototype.has = Ns;
|
|
2125
|
+
ae.prototype.set = zs;
|
|
1852
2126
|
var Me = ue(ie, "Map");
|
|
1853
2127
|
function Gs() {
|
|
1854
2128
|
this.size = 0, this.__data__ = {
|
|
@@ -1861,22 +2135,22 @@ function Bs(h) {
|
|
|
1861
2135
|
var t = typeof h;
|
|
1862
2136
|
return t == "string" || t == "number" || t == "symbol" || t == "boolean" ? h !== "__proto__" : h === null;
|
|
1863
2137
|
}
|
|
1864
|
-
function
|
|
2138
|
+
function Ne(h, t) {
|
|
1865
2139
|
var e = h.__data__;
|
|
1866
2140
|
return Bs(t) ? e[typeof t == "string" ? "string" : "hash"] : e.map;
|
|
1867
2141
|
}
|
|
1868
2142
|
function Ys(h) {
|
|
1869
|
-
var t =
|
|
2143
|
+
var t = Ne(this, h).delete(h);
|
|
1870
2144
|
return this.size -= t ? 1 : 0, t;
|
|
1871
2145
|
}
|
|
1872
|
-
function js(h) {
|
|
1873
|
-
return ze(this, h).get(h);
|
|
1874
|
-
}
|
|
1875
2146
|
function Vs(h) {
|
|
1876
|
-
return
|
|
2147
|
+
return Ne(this, h).get(h);
|
|
2148
|
+
}
|
|
2149
|
+
function js(h) {
|
|
2150
|
+
return Ne(this, h).has(h);
|
|
1877
2151
|
}
|
|
1878
2152
|
function Ws(h, t) {
|
|
1879
|
-
var e =
|
|
2153
|
+
var e = Ne(this, h), i = e.size;
|
|
1880
2154
|
return e.set(h, t), this.size += e.size == i ? 0 : 1, this;
|
|
1881
2155
|
}
|
|
1882
2156
|
function we(h) {
|
|
@@ -1888,8 +2162,8 @@ function we(h) {
|
|
|
1888
2162
|
}
|
|
1889
2163
|
we.prototype.clear = Gs;
|
|
1890
2164
|
we.prototype.delete = Ys;
|
|
1891
|
-
we.prototype.get =
|
|
1892
|
-
we.prototype.has =
|
|
2165
|
+
we.prototype.get = Vs;
|
|
2166
|
+
we.prototype.has = js;
|
|
1893
2167
|
we.prototype.set = Ws;
|
|
1894
2168
|
function Us(h, t) {
|
|
1895
2169
|
for (var e = -1, i = t.length, n = h.length; ++e < i; )
|
|
@@ -1930,7 +2204,7 @@ ve.prototype.delete = qs;
|
|
|
1930
2204
|
ve.prototype.get = Zs;
|
|
1931
2205
|
ve.prototype.has = Js;
|
|
1932
2206
|
ve.prototype.set = en;
|
|
1933
|
-
var
|
|
2207
|
+
var Rt = typeof exports == "object" && exports && !exports.nodeType && exports, it = Rt && typeof module == "object" && module && !module.nodeType && module, tn = it && it.exports === Rt, st = tn ? ie.Buffer : void 0;
|
|
1934
2208
|
st && st.allocUnsafe;
|
|
1935
2209
|
function sn(h, t) {
|
|
1936
2210
|
return h.slice();
|
|
@@ -1957,8 +2231,8 @@ function hn(h, t, e) {
|
|
|
1957
2231
|
function cn(h) {
|
|
1958
2232
|
return hn(h, Ps, ln);
|
|
1959
2233
|
}
|
|
1960
|
-
var Ye = ue(ie, "DataView"),
|
|
1961
|
-
(Ye && re(new Ye(new ArrayBuffer(1))) != ht || Me && re(new Me()) != ot ||
|
|
2234
|
+
var Ye = ue(ie, "DataView"), Ve = ue(ie, "Promise"), je = ue(ie, "Set"), ot = "[object Map]", dn = "[object Object]", rt = "[object Promise]", at = "[object Set]", lt = "[object WeakMap]", ht = "[object DataView]", un = de(Ye), pn = de(Me), mn = de(Ve), gn = de(je), fn = de(Be), re = xe;
|
|
2235
|
+
(Ye && re(new Ye(new ArrayBuffer(1))) != ht || Me && re(new Me()) != ot || Ve && re(Ve.resolve()) != rt || je && re(new je()) != at || Be && re(new Be()) != lt) && (re = function(h) {
|
|
1962
2236
|
var t = xe(h), e = t == dn ? h.constructor : void 0, i = e ? de(e) : "";
|
|
1963
2237
|
if (i)
|
|
1964
2238
|
switch (i) {
|
|
@@ -2002,8 +2276,8 @@ function En(h, t) {
|
|
|
2002
2276
|
var e = Ue(h.buffer);
|
|
2003
2277
|
return new h.constructor(e, h.byteOffset, h.length);
|
|
2004
2278
|
}
|
|
2005
|
-
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]",
|
|
2006
|
-
function
|
|
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]", $n = "[object Float32Array]", Hn = "[object Float64Array]", On = "[object Int8Array]", Fn = "[object Int16Array]", Nn = "[object Int32Array]", zn = "[object Uint8Array]", Gn = "[object Uint8ClampedArray]", Bn = "[object Uint16Array]", Yn = "[object Uint32Array]";
|
|
2280
|
+
function Vn(h, t, e) {
|
|
2007
2281
|
var i = h.constructor;
|
|
2008
2282
|
switch (t) {
|
|
2009
2283
|
case kn:
|
|
@@ -2011,14 +2285,14 @@ function jn(h, t, e) {
|
|
|
2011
2285
|
case Mn:
|
|
2012
2286
|
case xn:
|
|
2013
2287
|
return new i(+h);
|
|
2014
|
-
case $n:
|
|
2015
|
-
return Cn(h);
|
|
2016
2288
|
case Rn:
|
|
2017
|
-
|
|
2289
|
+
return Cn(h);
|
|
2290
|
+
case $n:
|
|
2018
2291
|
case Hn:
|
|
2292
|
+
case On:
|
|
2019
2293
|
case Fn:
|
|
2020
|
-
case zn:
|
|
2021
2294
|
case Nn:
|
|
2295
|
+
case zn:
|
|
2022
2296
|
case Gn:
|
|
2023
2297
|
case Bn:
|
|
2024
2298
|
case Yn:
|
|
@@ -2036,7 +2310,7 @@ function jn(h, t, e) {
|
|
|
2036
2310
|
return Ln(h);
|
|
2037
2311
|
}
|
|
2038
2312
|
}
|
|
2039
|
-
function
|
|
2313
|
+
function jn(h) {
|
|
2040
2314
|
return typeof h.constructor == "function" && !Tt(h) ? Pi(Ks(h)) : {};
|
|
2041
2315
|
}
|
|
2042
2316
|
var Wn = "[object Map]";
|
|
@@ -2047,42 +2321,42 @@ var pt = ye && ye.isMap, Kn = pt ? We(pt) : Un, Xn = "[object Set]";
|
|
|
2047
2321
|
function qn(h) {
|
|
2048
2322
|
return Ie(h) && re(h) == Xn;
|
|
2049
2323
|
}
|
|
2050
|
-
var mt = ye && ye.isSet, Zn = mt ? We(mt) : qn,
|
|
2051
|
-
|
|
2052
|
-
|
|
2324
|
+
var mt = ye && ye.isSet, Zn = mt ? We(mt) : qn, $t = "[object Arguments]", Jn = "[object Array]", Qn = "[object Boolean]", eo = "[object Date]", to = "[object Error]", Ht = "[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 = {};
|
|
2325
|
+
O[$t] = 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;
|
|
2326
|
+
O[to] = O[Ht] = O[ho] = !1;
|
|
2053
2327
|
function De(h, t, e, i, n, s) {
|
|
2054
2328
|
var o;
|
|
2055
2329
|
if (o !== void 0)
|
|
2056
2330
|
return o;
|
|
2057
|
-
if (!
|
|
2331
|
+
if (!Oe(h))
|
|
2058
2332
|
return h;
|
|
2059
2333
|
var r = Le(h);
|
|
2060
2334
|
if (r)
|
|
2061
2335
|
o = vn(h);
|
|
2062
2336
|
else {
|
|
2063
|
-
var a = re(h), l = a ==
|
|
2337
|
+
var a = re(h), l = a == Ht || a == io;
|
|
2064
2338
|
if (St(h))
|
|
2065
2339
|
return sn(h);
|
|
2066
|
-
if (a ==
|
|
2067
|
-
o = l ? {} :
|
|
2340
|
+
if (a == Ot || a == $t || l && !n)
|
|
2341
|
+
o = l ? {} : jn(h);
|
|
2068
2342
|
else {
|
|
2069
|
-
if (!
|
|
2343
|
+
if (!O[a])
|
|
2070
2344
|
return n ? h : {};
|
|
2071
|
-
o =
|
|
2345
|
+
o = Vn(h, a);
|
|
2072
2346
|
}
|
|
2073
2347
|
}
|
|
2074
2348
|
s || (s = new ve());
|
|
2075
2349
|
var d = s.get(h);
|
|
2076
2350
|
if (d)
|
|
2077
2351
|
return d;
|
|
2078
|
-
s.set(h, o), Zn(h) ? h.forEach(function(
|
|
2079
|
-
o.add(De(
|
|
2080
|
-
}) : Kn(h) && h.forEach(function(
|
|
2081
|
-
o.set(
|
|
2352
|
+
s.set(h, o), Zn(h) ? h.forEach(function(p) {
|
|
2353
|
+
o.add(De(p, t, e, p, h, s));
|
|
2354
|
+
}) : Kn(h) && h.forEach(function(p, m) {
|
|
2355
|
+
o.set(m, De(p, t, e, m, h, s));
|
|
2082
2356
|
});
|
|
2083
2357
|
var u = cn, g = r ? void 0 : u(h);
|
|
2084
|
-
return Li(g || h, function(
|
|
2085
|
-
g && (
|
|
2358
|
+
return Li(g || h, function(p, m) {
|
|
2359
|
+
g && (m = p, p = h[m]), Di(o, m, De(p, t, e, m, h, s));
|
|
2086
2360
|
}), o;
|
|
2087
2361
|
}
|
|
2088
2362
|
var Po = 1, Lo = 4;
|
|
@@ -2192,8 +2466,8 @@ class So {
|
|
|
2192
2466
|
* @return {*}
|
|
2193
2467
|
*/
|
|
2194
2468
|
async add(t, e = !0) {
|
|
2195
|
-
var
|
|
2196
|
-
const i = this.viewer, n = this.Cesium, s = n.Math.toRadians(((
|
|
2469
|
+
var p, m, f, y, w;
|
|
2470
|
+
const i = this.viewer, n = this.Cesium, s = n.Math.toRadians(((p = t.headingPitchRoll) == null ? void 0 : p.heading) || 0), o = n.Math.toRadians(((m = t.headingPitchRoll) == null ? void 0 : m.pitch) || 0), r = n.Math.toRadians(((f = t.headingPitchRoll) == null ? void 0 : f.roll) || 0), a = new n.HeadingPitchRoll(s, o, r);
|
|
2197
2471
|
let l = t.position;
|
|
2198
2472
|
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)
|
|
2199
2473
|
throw new Error("GLTFManage.add 缺少有效 position");
|
|
@@ -2205,9 +2479,9 @@ class So {
|
|
|
2205
2479
|
let g;
|
|
2206
2480
|
if (typeof ((y = n == null ? void 0 : n.Model) == null ? void 0 : y.fromGltf) == "function")
|
|
2207
2481
|
g = i.scene.primitives.add(n.Model.fromGltf(u));
|
|
2208
|
-
else if (typeof ((
|
|
2209
|
-
const
|
|
2210
|
-
g = i.scene.primitives.add(
|
|
2482
|
+
else if (typeof ((w = n == null ? void 0 : n.Model) == null ? void 0 : w.fromGltfAsync) == "function") {
|
|
2483
|
+
const v = await n.Model.fromGltfAsync(u);
|
|
2484
|
+
g = i.scene.primitives.add(v);
|
|
2211
2485
|
} else
|
|
2212
2486
|
throw new Error("Cesium.Model.fromGltf / fromGltfAsync 均不可用");
|
|
2213
2487
|
g.scale = 1, g.__sceneGadgetScale = this.getPrimitiveScale({ modelMatrix: d }), this.initializePrimitiveRuntimeState(g), this.primitives.set(t.id, g), g.show = e, this.runEventListener("add", { info: t, gltf: g });
|
|
@@ -2436,7 +2710,7 @@ class So {
|
|
|
2436
2710
|
n.Matrix4.fromScale(l),
|
|
2437
2711
|
new n.Matrix4()
|
|
2438
2712
|
);
|
|
2439
|
-
const u = this.getPrimitiveScale(t), g = this.getPrimitiveRuntimeRadius(t),
|
|
2713
|
+
const u = this.getPrimitiveScale(t), g = this.getPrimitiveRuntimeRadius(t), p = this.getPrimitiveEffectiveRadius(t);
|
|
2440
2714
|
return this.debugLog("applyScaleToPrimitive", {
|
|
2441
2715
|
id: t == null ? void 0 : t.id,
|
|
2442
2716
|
inputScale: e,
|
|
@@ -2446,7 +2720,7 @@ class So {
|
|
|
2446
2720
|
beforeRadius: o,
|
|
2447
2721
|
afterRadius: g,
|
|
2448
2722
|
beforeEffectiveRadius: r,
|
|
2449
|
-
afterEffectiveRadius:
|
|
2723
|
+
afterEffectiveRadius: p
|
|
2450
2724
|
}), t.modelMatrix;
|
|
2451
2725
|
}
|
|
2452
2726
|
getGizmoModelMatrix(t) {
|
|
@@ -2530,9 +2804,9 @@ class So {
|
|
|
2530
2804
|
*/
|
|
2531
2805
|
initEditBox(t) {
|
|
2532
2806
|
const e = this.Cesium, i = this.viewer, n = i.scene;
|
|
2533
|
-
let s = null, o = null, r = null, a = null, l = "", d = "", u = null, g = null,
|
|
2807
|
+
let s = null, o = null, r = null, a = null, l = "", d = "", u = null, g = null, p = null, m = null;
|
|
2534
2808
|
const f = () => {
|
|
2535
|
-
s = null, o = null, r = null, a = null, l = "", d = "", u = null, g = null,
|
|
2809
|
+
s = null, o = null, r = null, a = null, l = "", d = "", u = null, g = null, p = null, m = null, this.hideFeedback(), this.unlockCamera();
|
|
2536
2810
|
}, y = (P) => {
|
|
2537
2811
|
const b = (C) => (P.split(C)[1] || "").split("_");
|
|
2538
2812
|
if (P.includes("moveAxis_")) {
|
|
@@ -2560,47 +2834,47 @@ class So {
|
|
|
2560
2834
|
return { modelId: C[0], mode: "scale", axis: String(C[1] || "").toUpperCase() };
|
|
2561
2835
|
}
|
|
2562
2836
|
return P.includes("scaleCenter_") ? { modelId: b("scaleCenter_")[0], mode: "scale", axis: "CENTER" } : P.includes("scaleCenterHit_") ? { modelId: b("scaleCenterHit_")[0], mode: "scale", axis: "CENTER" } : null;
|
|
2563
|
-
},
|
|
2837
|
+
}, w = (P) => {
|
|
2564
2838
|
if (this.editMode !== "scale" || !this.activeModelId || !P || !(n != null && n.drillPick))
|
|
2565
2839
|
return !1;
|
|
2566
2840
|
try {
|
|
2567
2841
|
return (n.drillPick(P, 12) || []).some((C) => {
|
|
2568
|
-
const
|
|
2569
|
-
if (typeof
|
|
2570
|
-
const
|
|
2571
|
-
return (
|
|
2842
|
+
const L = this.getPickDebugId(C);
|
|
2843
|
+
if (typeof L != "string") return !1;
|
|
2844
|
+
const E = y(L);
|
|
2845
|
+
return (E == null ? void 0 : E.mode) === "scale" && (E == null ? void 0 : E.axis) === "CENTER" && (E == null ? void 0 : E.modelId) === this.activeModelId;
|
|
2572
2846
|
});
|
|
2573
2847
|
} catch {
|
|
2574
2848
|
return !1;
|
|
2575
2849
|
}
|
|
2576
|
-
},
|
|
2850
|
+
}, v = (P, b, C, L) => {
|
|
2577
2851
|
if (s = this.primitives.get(P), s) {
|
|
2578
|
-
l = C, d =
|
|
2579
|
-
const
|
|
2852
|
+
l = C, d = L, o = e.Matrix4.clone(s.modelMatrix), a = this.normalizeScaleVector(this.getPrimitiveScale(s));
|
|
2853
|
+
const E = e.Matrix4.getTranslation(
|
|
2580
2854
|
o,
|
|
2581
2855
|
new e.Cartesian3()
|
|
2582
2856
|
);
|
|
2583
|
-
|
|
2857
|
+
p = e.Cartesian3.clone(E), r = e.Cartesian2.clone(
|
|
2584
2858
|
b.position || b.endPosition,
|
|
2585
2859
|
new e.Cartesian2()
|
|
2586
2860
|
);
|
|
2587
|
-
const M = e.Transforms.eastNorthUpToFixedFrame(
|
|
2861
|
+
const M = e.Transforms.eastNorthUpToFixedFrame(p);
|
|
2588
2862
|
let x = new e.Cartesian3();
|
|
2589
|
-
C === "move" ?
|
|
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), u = e.Plane.fromPointNormal(p, x);
|
|
2590
2864
|
const I = i.camera.getPickRay(b.position || b.endPosition);
|
|
2591
|
-
g = I && u ? e.IntersectionTests.rayPlane(I, u) : null, g && (
|
|
2865
|
+
g = I && u ? e.IntersectionTests.rayPlane(I, u) : null, g && (m = e.Cartesian3.subtract(
|
|
2592
2866
|
g,
|
|
2593
|
-
|
|
2867
|
+
p,
|
|
2594
2868
|
new e.Cartesian3()
|
|
2595
|
-
), e.Cartesian3.magnitudeSquared(
|
|
2869
|
+
), e.Cartesian3.magnitudeSquared(m) > 0 && e.Cartesian3.normalize(m, m)), this.lockCamera();
|
|
2596
2870
|
}
|
|
2597
2871
|
};
|
|
2598
2872
|
this.handler.setInputAction((P) => {
|
|
2599
2873
|
var M, x;
|
|
2600
2874
|
if (!t()) return;
|
|
2601
2875
|
(this.editMode === "scale" || this.editMode === "move") && this.debugPickStack(P.position, this.editMode);
|
|
2602
|
-
const C = n.pick(P.position),
|
|
2603
|
-
if (typeof
|
|
2876
|
+
const C = n.pick(P.position), L = (C == null ? void 0 : C.id) || ((M = C == null ? void 0 : C.primitive) == null ? void 0 : M.id);
|
|
2877
|
+
if (typeof L != "string") {
|
|
2604
2878
|
this.editMode === "scale" && this.debugLog("scale:leftDown:miss", {
|
|
2605
2879
|
activeModelId: this.activeModelId,
|
|
2606
2880
|
pickedPrimitiveId: (x = C == null ? void 0 : C.primitive) == null ? void 0 : x.id,
|
|
@@ -2608,29 +2882,29 @@ class So {
|
|
|
2608
2882
|
});
|
|
2609
2883
|
return;
|
|
2610
2884
|
}
|
|
2611
|
-
let
|
|
2885
|
+
let E = y(L);
|
|
2612
2886
|
this.editMode === "scale" && this.debugLog("scale:leftDown:hit", {
|
|
2613
2887
|
activeModelId: this.activeModelId,
|
|
2614
|
-
hitId:
|
|
2615
|
-
hitInfo:
|
|
2616
|
-
}),
|
|
2617
|
-
modelId:
|
|
2888
|
+
hitId: L,
|
|
2889
|
+
hitInfo: E
|
|
2890
|
+
}), E != null && E.modelId && (this.setEditMode(E.mode), v(E.modelId, P, E.mode, E.axis), E.mode === "scale" && E.axis === "CENTER" && this.debugLog("scale:center:drag-start", {
|
|
2891
|
+
modelId: E.modelId,
|
|
2618
2892
|
startMousePosition: P.position
|
|
2619
2893
|
}));
|
|
2620
2894
|
}, e.ScreenSpaceEventType.LEFT_DOWN), this.handler.setInputAction((P) => {
|
|
2621
|
-
if (t() && (l === "" ?
|
|
2622
|
-
const C = i.camera.getPickRay(P.endPosition),
|
|
2623
|
-
if (!
|
|
2624
|
-
l === "rotate" ? this.rotateModel(s, o, d,
|
|
2895
|
+
if (t() && (l === "" ? w(P.endPosition) ? this.showHoverModeHint("向上拖放大,向下拖缩小") : this.scaleCenterHintVisible && this.hideModeHint() : this.scaleCenterHintVisible && this.hideModeHint(), l != "" && s && u && p && g)) {
|
|
2896
|
+
const C = i.camera.getPickRay(P.endPosition), L = C ? e.IntersectionTests.rayPlane(C, u) : null;
|
|
2897
|
+
if (!L) return;
|
|
2898
|
+
l === "rotate" ? this.rotateModel(s, o, d, p, m, L) : l === "move" ? this.moveModel(s, o, d, p, g, L) : l === "scale" && this.moveModelScale(
|
|
2625
2899
|
s,
|
|
2626
2900
|
o,
|
|
2627
2901
|
d,
|
|
2628
|
-
|
|
2902
|
+
p,
|
|
2629
2903
|
r,
|
|
2630
2904
|
g,
|
|
2631
2905
|
a,
|
|
2632
2906
|
P.endPosition,
|
|
2633
|
-
|
|
2907
|
+
L
|
|
2634
2908
|
);
|
|
2635
2909
|
}
|
|
2636
2910
|
}, e.ScreenSpaceEventType.MOUSE_MOVE), this.handler.setInputAction(() => {
|
|
@@ -2820,14 +3094,14 @@ class So {
|
|
|
2820
3094
|
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);
|
|
2821
3095
|
if (this.modeToolbarEl && this.modeToolbarEl.style.display !== "none") {
|
|
2822
3096
|
const d = Number(this.modeToolbarEl.offsetWidth || 58), u = Number(this.modeToolbarEl.offsetHeight || 176), g = 18;
|
|
2823
|
-
let
|
|
2824
|
-
|
|
2825
|
-
const
|
|
2826
|
-
|
|
3097
|
+
let p = s.maxX + g;
|
|
3098
|
+
p + d > a - 12 && (p = s.minX - d - g), p = n.Math.clamp(p, 12, Math.max(12, a - d - 12));
|
|
3099
|
+
const m = (s.minY + s.maxY) / 2, f = n.Math.clamp(
|
|
3100
|
+
m - u / 2,
|
|
2827
3101
|
12,
|
|
2828
3102
|
Math.max(12, l - u - 12)
|
|
2829
3103
|
);
|
|
2830
|
-
this.modeToolbarEl.style.left = `${
|
|
3104
|
+
this.modeToolbarEl.style.left = `${p}px`, this.modeToolbarEl.style.top = `${f + u / 2}px`;
|
|
2831
3105
|
}
|
|
2832
3106
|
if (this.feedbackLabelEl && this.feedbackLabelEl.style.display !== "none") {
|
|
2833
3107
|
const d = this.feedbackAnchor || o, u = this.toWindowCoordinates(d);
|
|
@@ -2876,7 +3150,7 @@ class So {
|
|
|
2876
3150
|
});
|
|
2877
3151
|
}
|
|
2878
3152
|
getGizmoMetrics(t) {
|
|
2879
|
-
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), u = Math.max(e * 1.02, 18), g = Math.max(e * 0.024, 1.15),
|
|
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), u = Math.max(e * 1.02, 18), g = Math.max(e * 0.024, 1.15), p = Math.max(e * 1.06, 18), m = Math.max(e * 0.075, 2.4);
|
|
2880
3154
|
return {
|
|
2881
3155
|
centerRadius: i,
|
|
2882
3156
|
axisLength: n,
|
|
@@ -2888,16 +3162,16 @@ class So {
|
|
|
2888
3162
|
planeThickness: d,
|
|
2889
3163
|
rotationRadius: u,
|
|
2890
3164
|
rotationThickness: g,
|
|
2891
|
-
scaleOffset:
|
|
2892
|
-
scaleHandleRadius:
|
|
3165
|
+
scaleOffset: p,
|
|
3166
|
+
scaleHandleRadius: m
|
|
2893
3167
|
};
|
|
2894
3168
|
}
|
|
2895
3169
|
createSegmentInstance(t, e, i, n, s) {
|
|
2896
3170
|
const o = this.Cesium, r = o.Cartesian3.subtract(i, e, new o.Cartesian3()), a = o.Cartesian3.magnitude(r);
|
|
2897
3171
|
if (!Number.isFinite(a) || a <= 0) return null;
|
|
2898
|
-
const l = o.Cartesian3.normalize(r, new o.Cartesian3()), d = o.Cartesian3.midpoint(e, i, new o.Cartesian3()), u = o.Cartesian3.UNIT_X, g = o.Cartesian3.cross(u, l, new o.Cartesian3()),
|
|
3172
|
+
const l = o.Cartesian3.normalize(r, new o.Cartesian3()), d = o.Cartesian3.midpoint(e, i, new o.Cartesian3()), u = o.Cartesian3.UNIT_X, g = o.Cartesian3.cross(u, l, new o.Cartesian3()), p = o.Cartesian3.magnitude(g), m = o.Math.clamp(o.Cartesian3.dot(u, l), -1, 1);
|
|
2899
3173
|
let f = o.Quaternion.clone(o.Quaternion.IDENTITY);
|
|
2900
|
-
return
|
|
3174
|
+
return p > 1e-6 ? (o.Cartesian3.normalize(g, g), f = o.Quaternion.fromAxisAngle(g, Math.acos(m))) : m < 0 && (f = o.Quaternion.fromAxisAngle(o.Cartesian3.UNIT_Z, Math.PI)), new o.GeometryInstance({
|
|
2901
3175
|
id: t,
|
|
2902
3176
|
geometry: this.createUnitBoxGeometry(),
|
|
2903
3177
|
modelMatrix: o.Matrix4.fromTranslationQuaternionRotationScale(
|
|
@@ -3104,28 +3378,28 @@ class So {
|
|
|
3104
3378
|
}
|
|
3105
3379
|
].flatMap((u) => {
|
|
3106
3380
|
const g = [];
|
|
3107
|
-
for (let
|
|
3108
|
-
const
|
|
3381
|
+
for (let p = 0; p < 90; p += s) {
|
|
3382
|
+
const m = e.Math.toRadians(p), f = e.Math.toRadians(p + s), y = this.getRotationPlanePoint(
|
|
3109
3383
|
u.plane,
|
|
3110
3384
|
n.rotationRadius,
|
|
3111
|
-
|
|
3112
|
-
),
|
|
3113
|
-
`rotationArc_${t.id}_${u.axis}_${
|
|
3385
|
+
m
|
|
3386
|
+
), w = this.getRotationPlanePoint(u.plane, n.rotationRadius, f), v = this.createSegmentInstance(
|
|
3387
|
+
`rotationArc_${t.id}_${u.axis}_${p}`,
|
|
3114
3388
|
y,
|
|
3115
|
-
|
|
3389
|
+
w,
|
|
3116
3390
|
n.rotationThickness,
|
|
3117
3391
|
u.color
|
|
3118
3392
|
);
|
|
3119
|
-
|
|
3393
|
+
v && g.push(v);
|
|
3120
3394
|
for (let P = 0; P < o; P += 1) {
|
|
3121
|
-
const b = r + l * (P + 0.5), C = this.getRotationPlanePoint(u.plane, b,
|
|
3122
|
-
`rotationSector_${t.id}_${u.axis}_${P}_${
|
|
3395
|
+
const b = r + l * (P + 0.5), C = this.getRotationPlanePoint(u.plane, b, m), L = this.getRotationPlanePoint(u.plane, b, f), E = this.createSegmentInstance(
|
|
3396
|
+
`rotationSector_${t.id}_${u.axis}_${P}_${p}`,
|
|
3123
3397
|
C,
|
|
3124
|
-
|
|
3398
|
+
L,
|
|
3125
3399
|
Math.max(l * 0.92, n.rotationThickness * 1.4),
|
|
3126
3400
|
u.color.withAlpha(0.04)
|
|
3127
3401
|
);
|
|
3128
|
-
|
|
3402
|
+
E && g.push(E);
|
|
3129
3403
|
}
|
|
3130
3404
|
}
|
|
3131
3405
|
return g;
|
|
@@ -3221,8 +3495,8 @@ class So {
|
|
|
3221
3495
|
bottomRadius: r
|
|
3222
3496
|
})
|
|
3223
3497
|
);
|
|
3224
|
-
let
|
|
3225
|
-
this.translate(u, [0, 0,
|
|
3498
|
+
let p = a + d, m = (a + d) / 2;
|
|
3499
|
+
this.translate(u, [0, 0, m]), this.translate(g, [0, 0, p]), this.heightArrow = new e.Primitive({
|
|
3226
3500
|
modelMatrix: t.modelMatrix,
|
|
3227
3501
|
geometryInstances: [
|
|
3228
3502
|
new e.GeometryInstance({
|
|
@@ -3370,8 +3644,8 @@ class So {
|
|
|
3370
3644
|
new r.Matrix4()
|
|
3371
3645
|
);
|
|
3372
3646
|
t.modelMatrix = u, this.updatedTool(u);
|
|
3373
|
-
const g = r.Matrix4.getTranslation(u, new r.Cartesian3()),
|
|
3374
|
-
this.showFeedback(`${
|
|
3647
|
+
const g = r.Matrix4.getTranslation(u, new r.Cartesian3()), p = r.Cartesian3.magnitude(d), m = ["XY", "YZ", "ZX"].includes(i) ? i : `${i}轴`;
|
|
3648
|
+
this.showFeedback(`${m} ${p.toFixed(2)} m`, g), this.writeDragEndPayload(t.id, "translation", {
|
|
3375
3649
|
id: t.id,
|
|
3376
3650
|
position: g
|
|
3377
3651
|
});
|
|
@@ -3394,19 +3668,19 @@ class So {
|
|
|
3394
3668
|
o.longitude,
|
|
3395
3669
|
o.latitude,
|
|
3396
3670
|
(l == null ? void 0 : l.height) || o.height || 0
|
|
3397
|
-
), u = r.Cartographic.toCartesian(d), g = r.Matrix4.getRotation(e, new r.Matrix3()),
|
|
3398
|
-
t.modelMatrix =
|
|
3671
|
+
), u = r.Cartographic.toCartesian(d), g = r.Matrix4.getRotation(e, new r.Matrix3()), p = r.Matrix4.fromRotationTranslation(g, u);
|
|
3672
|
+
t.modelMatrix = p, this.updatedTool(p), this.showFeedback(
|
|
3399
3673
|
`${(((l == null ? void 0 : l.height) || 0) - (o.height || 0)).toFixed(2)} m`,
|
|
3400
3674
|
u
|
|
3401
3675
|
);
|
|
3402
|
-
let
|
|
3403
|
-
|
|
3404
|
-
|
|
3405
|
-
|
|
3676
|
+
let m = new r.Cartesian3(
|
|
3677
|
+
p[12],
|
|
3678
|
+
p[13],
|
|
3679
|
+
p[14]
|
|
3406
3680
|
), f = this.dragEndCallbackMap.get(t.id);
|
|
3407
3681
|
f || (f = /* @__PURE__ */ new Map(), this.dragEndCallbackMap.set(t.id, f)), f.set("translation", {
|
|
3408
3682
|
id: t.id,
|
|
3409
|
-
position:
|
|
3683
|
+
position: m
|
|
3410
3684
|
});
|
|
3411
3685
|
}
|
|
3412
3686
|
}
|
|
@@ -3415,12 +3689,12 @@ class So {
|
|
|
3415
3689
|
if (!t || !e || !i) return null;
|
|
3416
3690
|
const o = s.camera.getPickRay(t);
|
|
3417
3691
|
if (!o) return null;
|
|
3418
|
-
const r = o.origin, a = n.Cartesian3.normalize(o.direction, new n.Cartesian3()), l = e, d = i, u = n.Cartesian3.subtract(r, l, new n.Cartesian3()), g = n.Cartesian3.dot(a, a),
|
|
3419
|
-
if (Math.abs(
|
|
3420
|
-
const
|
|
3692
|
+
const r = o.origin, a = n.Cartesian3.normalize(o.direction, new n.Cartesian3()), l = e, d = i, u = n.Cartesian3.subtract(r, l, new n.Cartesian3()), g = n.Cartesian3.dot(a, a), p = -n.Cartesian3.dot(a, d), m = n.Cartesian3.dot(d, d), f = -n.Cartesian3.dot(a, u), y = n.Cartesian3.dot(d, u), w = g * m - p * p;
|
|
3693
|
+
if (Math.abs(w) < 1e-6) return null;
|
|
3694
|
+
const v = (g * y - p * f) / w;
|
|
3421
3695
|
return n.Cartesian3.add(
|
|
3422
3696
|
l,
|
|
3423
|
-
n.Cartesian3.multiplyByScalar(d,
|
|
3697
|
+
n.Cartesian3.multiplyByScalar(d, v, new n.Cartesian3()),
|
|
3424
3698
|
new n.Cartesian3()
|
|
3425
3699
|
);
|
|
3426
3700
|
}
|
|
@@ -3443,22 +3717,22 @@ class So {
|
|
|
3443
3717
|
r.Cartesian3.normalize(a, a);
|
|
3444
3718
|
const l = r.Transforms.eastNorthUpToFixedFrame(n), d = this.getAxisVector(l, i), u = r.Math.clamp(r.Cartesian3.dot(s, a), -1, 1), g = Math.acos(u);
|
|
3445
3719
|
if (!Number.isFinite(g) || g <= 1e-6) return;
|
|
3446
|
-
const
|
|
3720
|
+
const p = r.Cartesian3.cross(
|
|
3447
3721
|
s,
|
|
3448
3722
|
a,
|
|
3449
3723
|
new r.Cartesian3()
|
|
3450
|
-
),
|
|
3724
|
+
), m = r.Cartesian3.dot(p, d) >= 0 ? 1 : -1, f = g * m, y = r.Quaternion.fromAxisAngle(d, f), w = r.Matrix4.fromRotationTranslation(
|
|
3451
3725
|
r.Matrix3.fromQuaternion(y)
|
|
3452
|
-
),
|
|
3726
|
+
), v = this.applyTransformAroundCenter(
|
|
3453
3727
|
e,
|
|
3454
3728
|
n,
|
|
3455
|
-
|
|
3729
|
+
w
|
|
3456
3730
|
);
|
|
3457
|
-
t.modelMatrix =
|
|
3458
|
-
const P = r.Matrix4.getTranslation(
|
|
3731
|
+
t.modelMatrix = v, this.updatedTool(v);
|
|
3732
|
+
const P = r.Matrix4.getTranslation(v, new r.Cartesian3());
|
|
3459
3733
|
this.showFeedback(`${i}轴 ${r.Math.toDegrees(f).toFixed(1)}°`, P);
|
|
3460
3734
|
const b = this.getModelHeadingPitchRoll(
|
|
3461
|
-
this.extractModelBaseMatrix(
|
|
3735
|
+
this.extractModelBaseMatrix(v)
|
|
3462
3736
|
);
|
|
3463
3737
|
this.writeDragEndPayload(t.id, "rotate", {
|
|
3464
3738
|
id: t.id,
|
|
@@ -3472,12 +3746,12 @@ class So {
|
|
|
3472
3746
|
moveModelScale(t, e, i, n, s, o, r, a, l) {
|
|
3473
3747
|
const d = this.Cesium;
|
|
3474
3748
|
if (!r) return;
|
|
3475
|
-
const u = this.getGizmoMetrics(t), g = d.Transforms.eastNorthUpToFixedFrame(n),
|
|
3476
|
-
let
|
|
3749
|
+
const u = this.getGizmoMetrics(t), g = d.Transforms.eastNorthUpToFixedFrame(n), p = Math.max(u.scaleOffset * 0.7, 8);
|
|
3750
|
+
let m = 0;
|
|
3477
3751
|
if (i === "CENTER") {
|
|
3478
3752
|
if (!s || !a) return;
|
|
3479
3753
|
const b = Number(s.y || 0) - Number(a.y || 0);
|
|
3480
|
-
|
|
3754
|
+
m = Math.pow(2, b / 180) - 1;
|
|
3481
3755
|
} else {
|
|
3482
3756
|
if (!o || !l) return;
|
|
3483
3757
|
const b = d.Cartesian3.subtract(
|
|
@@ -3485,9 +3759,9 @@ class So {
|
|
|
3485
3759
|
o,
|
|
3486
3760
|
new d.Cartesian3()
|
|
3487
3761
|
), C = this.getAxisVector(g, i);
|
|
3488
|
-
|
|
3762
|
+
m = d.Cartesian3.dot(b, C) / p;
|
|
3489
3763
|
}
|
|
3490
|
-
const f = Math.max(0.05, 1 +
|
|
3764
|
+
const f = Math.max(0.05, 1 + m), y = {
|
|
3491
3765
|
x: r.x,
|
|
3492
3766
|
y: r.y,
|
|
3493
3767
|
z: r.z
|
|
@@ -3501,9 +3775,9 @@ class So {
|
|
|
3501
3775
|
);
|
|
3502
3776
|
y[i.toLowerCase()] = b;
|
|
3503
3777
|
}
|
|
3504
|
-
const
|
|
3505
|
-
this.applyScaleToPrimitive(t, y,
|
|
3506
|
-
const
|
|
3778
|
+
const w = this.extractModelBaseMatrix(e);
|
|
3779
|
+
this.applyScaleToPrimitive(t, y, w), this.activeModelId === t.id ? this.refreshActiveToolGeometry() : this.updatedTool(t.modelMatrix);
|
|
3780
|
+
const v = d.Matrix4.getTranslation(t.modelMatrix, new d.Cartesian3()), P = i === "CENTER" ? `${Math.max(y.x, y.y, y.z).toFixed(2)}x` : `${i}轴 ${y[i.toLowerCase()].toFixed(2)}x`;
|
|
3507
3781
|
this.debugLog("moveModelScale", {
|
|
3508
3782
|
id: t == null ? void 0 : t.id,
|
|
3509
3783
|
axis: i,
|
|
@@ -3513,10 +3787,10 @@ class So {
|
|
|
3513
3787
|
z: Number((r == null ? void 0 : r.z) || 1)
|
|
3514
3788
|
},
|
|
3515
3789
|
nextScale: y,
|
|
3516
|
-
deltaFactor:
|
|
3790
|
+
deltaFactor: m,
|
|
3517
3791
|
factor: f,
|
|
3518
3792
|
runtimeRadius: this.getPrimitiveRuntimeRadius(t)
|
|
3519
|
-
}), this.showFeedback(P,
|
|
3793
|
+
}), this.showFeedback(P, v), this.writeDragEndPayload(t.id, "addScale", {
|
|
3520
3794
|
id: t.id,
|
|
3521
3795
|
scale: y
|
|
3522
3796
|
});
|
|
@@ -3652,7 +3926,7 @@ function ko(h, t) {
|
|
|
3652
3926
|
}
|
|
3653
3927
|
}), new i(t);
|
|
3654
3928
|
}
|
|
3655
|
-
function
|
|
3929
|
+
function Ro(h, t) {
|
|
3656
3930
|
const e = h.Color, i = Object.defineProperties, n = h.Event, s = h.createPropertyDescriptor, o = h.Property, r = (u, g) => u === void 0 ? g : u, a = {};
|
|
3657
3931
|
let l = t.materialType || "PolylineFlow" + Date.now() + Math.floor(Math.random() * 1e3);
|
|
3658
3932
|
function d(u) {
|
|
@@ -3715,7 +3989,7 @@ function $o(h, t) {
|
|
|
3715
3989
|
}
|
|
3716
3990
|
}), new d(t);
|
|
3717
3991
|
}
|
|
3718
|
-
class
|
|
3992
|
+
class $o {
|
|
3719
3993
|
constructor() {
|
|
3720
3994
|
c(this, "categoryMap", /* @__PURE__ */ new Map());
|
|
3721
3995
|
c(this, "CategoryGet", {});
|
|
@@ -3921,18 +4195,18 @@ class Io {
|
|
|
3921
4195
|
themeKey: t.theme,
|
|
3922
4196
|
category: "wall",
|
|
3923
4197
|
options: t
|
|
3924
|
-
}), n = (
|
|
3925
|
-
const b = Number(
|
|
4198
|
+
}), n = (v, P = 0) => {
|
|
4199
|
+
const b = Number(v);
|
|
3926
4200
|
return Number.isFinite(b) ? b : P;
|
|
3927
|
-
}, s = t.positions.map((
|
|
3928
|
-
(
|
|
4201
|
+
}, s = t.positions.map((v) => n(v == null ? void 0 : v[2], 0)), o = n(t.minHeight, 0), r = n(t.maxHeight, 0), a = (v) => Array.isArray(v) && v.length === t.positions.length && v.every((P) => Math.abs(n(P, 0)) < 1e-6), l = s.some((v) => Math.abs(v) > 1e-6), g = (Array.isArray(t.minimumHeights) && t.minimumHeights.length === t.positions.length && !(a(t.minimumHeights) && l) ? t.minimumHeights.map((v) => n(v, 0)) : s).map((v) => v - o), f = (Array.isArray(t.maximumHeights) && t.maximumHeights.length === t.positions.length && !(a(t.maximumHeights) && l) ? t.maximumHeights.map((v) => n(v, 0)) : s).map((v) => v + r), y = t.positions.map(
|
|
4202
|
+
(v) => this.Cesium.Cartesian3.fromDegrees(v[0], v[1], v[2] || 0)
|
|
3929
4203
|
);
|
|
3930
|
-
let
|
|
4204
|
+
let w = {
|
|
3931
4205
|
...t
|
|
3932
4206
|
};
|
|
3933
|
-
return i && (
|
|
4207
|
+
return i && (w.material = i), this.viewer.entities.add({
|
|
3934
4208
|
wall: {
|
|
3935
|
-
...
|
|
4209
|
+
...w,
|
|
3936
4210
|
positions: y,
|
|
3937
4211
|
minimumHeights: g,
|
|
3938
4212
|
maximumHeights: f
|
|
@@ -4071,7 +4345,7 @@ class Io {
|
|
|
4071
4345
|
this.groupMap.forEach((t) => t.removeAll(this.viewer)), this.groupMap.clear();
|
|
4072
4346
|
}
|
|
4073
4347
|
}
|
|
4074
|
-
class
|
|
4348
|
+
class Ho {
|
|
4075
4349
|
constructor(t, e, i, n, s) {
|
|
4076
4350
|
c(this, "Cesium");
|
|
4077
4351
|
c(this, "viewer");
|
|
@@ -4122,7 +4396,7 @@ class Oo {
|
|
|
4122
4396
|
(i = this.layerMap.get(t)) == null || i.removeGroups(e);
|
|
4123
4397
|
}
|
|
4124
4398
|
}
|
|
4125
|
-
function
|
|
4399
|
+
function Oo(h) {
|
|
4126
4400
|
const t = [];
|
|
4127
4401
|
return h.features.forEach((e, i) => {
|
|
4128
4402
|
if (e.geometry && e.properties) {
|
|
@@ -4235,16 +4509,16 @@ class Fo {
|
|
|
4235
4509
|
}
|
|
4236
4510
|
//注册主题
|
|
4237
4511
|
initTheme(t) {
|
|
4238
|
-
var n, s, o, r, a, l, d, u, g,
|
|
4512
|
+
var n, s, o, r, a, l, d, u, g, p, m, f;
|
|
4239
4513
|
let e = this.materialManager, i = this.Cesium;
|
|
4240
4514
|
if (t.category == "polyline") {
|
|
4241
4515
|
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);
|
|
4242
|
-
let
|
|
4516
|
+
let w = "";
|
|
4243
4517
|
if (y) {
|
|
4244
|
-
const
|
|
4245
|
-
let b = this.convertCadPatternToCesiumDash(
|
|
4246
|
-
|
|
4247
|
-
themeKey:
|
|
4518
|
+
const v = ((l = (a = t.properties) == null ? void 0 : a.lineType) == null ? void 0 : l.pattern) || [0.25, -0.125], P = ((u = (d = t.properties) == null ? void 0 : d.lineType) == null ? void 0 : u.patternLength) || 0.375;
|
|
4519
|
+
let b = this.convertCadPatternToCesiumDash(v, P);
|
|
4520
|
+
w = `DashedLineMaterial_pattern_${b.dashPattern}_dashLength_${b.dashLength}_color_${(g = t.properties) == null ? void 0 : g.color}`, e.has(w) || e.register({
|
|
4521
|
+
themeKey: w,
|
|
4248
4522
|
material: i.Material.fromType("PolylineDash", {
|
|
4249
4523
|
color: i.Color.fromCssColorString(t.properties.color || "#FFFFFF").withAlpha(
|
|
4250
4524
|
0.8
|
|
@@ -4256,8 +4530,8 @@ class Fo {
|
|
|
4256
4530
|
})
|
|
4257
4531
|
});
|
|
4258
4532
|
} else
|
|
4259
|
-
|
|
4260
|
-
themeKey:
|
|
4533
|
+
w = `LineMaterial_color_${(p = t.properties) == null ? void 0 : p.color}`, e.has(w) || e.register({
|
|
4534
|
+
themeKey: w,
|
|
4261
4535
|
material: i.Material.fromType("Color", {
|
|
4262
4536
|
color: i.Color.fromCssColorString(t.properties.color || "#FFFFFF").withAlpha(
|
|
4263
4537
|
0.8
|
|
@@ -4265,7 +4539,7 @@ class Fo {
|
|
|
4265
4539
|
})
|
|
4266
4540
|
});
|
|
4267
4541
|
} else if (t.category == "polygon") {
|
|
4268
|
-
let y = `polygonMaterial_color_${(
|
|
4542
|
+
let y = `polygonMaterial_color_${(m = t.properties) == null ? void 0 : m.color}`;
|
|
4269
4543
|
e.has(y) || e.register({
|
|
4270
4544
|
themeKey: y,
|
|
4271
4545
|
material: i.Material.fromType("Color", {
|
|
@@ -4521,15 +4795,15 @@ class Fo {
|
|
|
4521
4795
|
}
|
|
4522
4796
|
const r = o.geometry, a = r._positions || r._polygonHierarchy.positions;
|
|
4523
4797
|
if (a && a.length > 0) {
|
|
4524
|
-
let l = a[0].x, d = a[0].y, u = a[0].z, g = a[0].x,
|
|
4798
|
+
let l = a[0].x, d = a[0].y, u = a[0].z, g = a[0].x, p = a[0].y, m = a[0].z;
|
|
4525
4799
|
a.forEach((P) => {
|
|
4526
|
-
l = Math.min(l, P.x), d = Math.min(d, P.y), u = Math.min(u, P.z), g = Math.max(g, P.x),
|
|
4800
|
+
l = Math.min(l, P.x), d = Math.min(d, P.y), u = Math.min(u, P.z), g = Math.max(g, P.x), p = Math.max(p, P.y), m = Math.max(m, P.z);
|
|
4527
4801
|
});
|
|
4528
4802
|
const f = new this.Cesium.Cartesian3(
|
|
4529
4803
|
(l + g) / 2,
|
|
4530
|
-
(d +
|
|
4531
|
-
(u +
|
|
4532
|
-
),
|
|
4804
|
+
(d + p) / 2,
|
|
4805
|
+
(u + m) / 2
|
|
4806
|
+
), w = new this.Cesium.Cartesian3(g - l, p - d, m - u).z, v = Math.abs(w || 1) * 1.5;
|
|
4533
4807
|
this.viewer.camera.flyTo({
|
|
4534
4808
|
destination: f,
|
|
4535
4809
|
duration: 2,
|
|
@@ -4537,14 +4811,14 @@ class Fo {
|
|
|
4537
4811
|
complete: () => {
|
|
4538
4812
|
console.log(`已定位到图元 ${e}`);
|
|
4539
4813
|
},
|
|
4540
|
-
offset: new this.Cesium.Cartesian3(0, 0,
|
|
4814
|
+
offset: new this.Cesium.Cartesian3(0, 0, v)
|
|
4541
4815
|
// 使用动态计算的偏移高度
|
|
4542
4816
|
});
|
|
4543
4817
|
} else
|
|
4544
4818
|
console.warn(`无法获取图元 ${e} 的顶点信息`);
|
|
4545
4819
|
}
|
|
4546
4820
|
}
|
|
4547
|
-
const
|
|
4821
|
+
const Re = class Re {
|
|
4548
4822
|
constructor(t, e) {
|
|
4549
4823
|
c(this, "Cesium");
|
|
4550
4824
|
c(this, "viewer");
|
|
@@ -4577,7 +4851,7 @@ const $e = class $e {
|
|
|
4577
4851
|
const e = this.Cesium, i = this.viewer;
|
|
4578
4852
|
if (!this.htmlLabelPool) {
|
|
4579
4853
|
const n = t.overlayContainerId || "html-label-container";
|
|
4580
|
-
this.htmlLabelPool = new
|
|
4854
|
+
this.htmlLabelPool = new G(e, i, n), this.htmlLabelPool.registerTheme("measure-horizontal-total", {
|
|
4581
4855
|
createElement: (s, o) => {
|
|
4582
4856
|
var r;
|
|
4583
4857
|
s.innerHTML = String(((r = o == null ? void 0 : o.data) == null ? void 0 : r.text) || ""), s.style.background = "rgba(0,0,0,0.6)", s.style.color = "#fff", s.style.font = "14px sans-serif", s.style.padding = "4px 6px", s.style.borderRadius = "4px", s.style.whiteSpace = "pre";
|
|
@@ -4591,8 +4865,8 @@ const $e = class $e {
|
|
|
4591
4865
|
options: { offset: { x: 0, y: -10 } }
|
|
4592
4866
|
});
|
|
4593
4867
|
}
|
|
4594
|
-
this.tooltip = new ce(), this.tooltip.show(
|
|
4595
|
-
var
|
|
4868
|
+
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 m, f, y, w;
|
|
4596
4870
|
const s = i.scene.pickPosition(n.position);
|
|
4597
4871
|
if (!s) return;
|
|
4598
4872
|
const o = e.Cartographic.fromCartesian(s), r = e.Math.toDegrees(o.longitude), a = e.Math.toDegrees(o.latitude);
|
|
@@ -4608,7 +4882,7 @@ const $e = class $e {
|
|
|
4608
4882
|
}
|
|
4609
4883
|
});
|
|
4610
4884
|
this.tempPoints.push(d);
|
|
4611
|
-
const u = s, g = ((f = (
|
|
4885
|
+
const u = s, g = ((f = (m = t.dashLineColor || t.lineColor || t.color || e.Color.RED).withAlpha) == null ? void 0 : f.call(m, 0.9)) || e.Color.RED, p = i.entities.add({
|
|
4612
4886
|
polyline: {
|
|
4613
4887
|
positions: [u, l],
|
|
4614
4888
|
width: t.width || 3,
|
|
@@ -4619,24 +4893,24 @@ const $e = class $e {
|
|
|
4619
4893
|
})
|
|
4620
4894
|
}
|
|
4621
4895
|
});
|
|
4622
|
-
if (this.groundLineEntities.push(
|
|
4623
|
-
const
|
|
4896
|
+
if (this.groundLineEntities.push(p), this.positions.length >= 2) {
|
|
4897
|
+
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({
|
|
4624
4898
|
polyline: {
|
|
4625
|
-
positions: [
|
|
4899
|
+
positions: [v, P],
|
|
4626
4900
|
width: t.width || 3,
|
|
4627
4901
|
material: t.lineColor || t.color || e.Color.YELLOW,
|
|
4628
4902
|
depthFailMaterial: new e.PolylineDashMaterialProperty({
|
|
4629
|
-
color: ((
|
|
4903
|
+
color: ((w = (y = t.dashLineColor || t.lineColor || t.color || e.Color.RED).withAlpha) == null ? void 0 : w.call(y, 0.9)) || e.Color.RED,
|
|
4630
4904
|
dashLength: 12,
|
|
4631
4905
|
dashPattern: 255
|
|
4632
4906
|
})
|
|
4633
4907
|
}
|
|
4634
4908
|
});
|
|
4635
|
-
this.segmentEntities.push(
|
|
4909
|
+
this.segmentEntities.push(L);
|
|
4636
4910
|
const M = new e.EllipsoidGeodesic(b, C).surfaceDistance, x = new e.Cartesian3(
|
|
4637
|
-
(
|
|
4638
|
-
(
|
|
4639
|
-
(
|
|
4911
|
+
(v.x + P.x) / 2,
|
|
4912
|
+
(v.y + P.y) / 2,
|
|
4913
|
+
(v.z + P.z) / 2
|
|
4640
4914
|
), I = e.Cartographic.fromCartesian(x), D = `measure_horizontal_seg_${this.segmentLabelIds.length}_${Date.now()}`;
|
|
4641
4915
|
this.segmentLabelIds.push(D), this.htmlLabelPool.add(
|
|
4642
4916
|
{ text: `${M.toFixed(2)} m` },
|
|
@@ -4671,22 +4945,22 @@ const $e = class $e {
|
|
|
4671
4945
|
}, e.ScreenSpaceEventType.MOUSE_MOVE);
|
|
4672
4946
|
}
|
|
4673
4947
|
_handlePreviewMove(t, e, i, n) {
|
|
4674
|
-
var P, b, C,
|
|
4948
|
+
var P, b, C, L;
|
|
4675
4949
|
if (this.positions.length === 0) return;
|
|
4676
4950
|
const s = n.scene.pickPosition(t.endPosition);
|
|
4677
4951
|
if (!s) return;
|
|
4678
4952
|
this.hoverPos = s;
|
|
4679
4953
|
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);
|
|
4680
4954
|
this.previewPos = l, this.previewGroundPos = s;
|
|
4681
|
-
const d = this.positions[this.positions.length - 1], u = i.Cartographic.fromCartesian(d), g = i.Cartographic.fromCartesian(l),
|
|
4955
|
+
const d = this.positions[this.positions.length - 1], u = i.Cartographic.fromCartesian(d), g = i.Cartographic.fromCartesian(l), m = new i.EllipsoidGeodesic(u, g).surfaceDistance, f = new i.Cartesian3(
|
|
4682
4956
|
(d.x + l.x) / 2,
|
|
4683
4957
|
(d.y + l.y) / 2,
|
|
4684
4958
|
(d.z + l.z) / 2
|
|
4685
|
-
), y = i.Cartographic.fromCartesian(f),
|
|
4686
|
-
this.previewLabelId =
|
|
4687
|
-
{ text: `${
|
|
4959
|
+
), y = i.Cartographic.fromCartesian(f), w = this.previewLabelId || "measure_horizontal_preview";
|
|
4960
|
+
this.previewLabelId = w, this.htmlLabelPool.add(
|
|
4961
|
+
{ text: `${m.toFixed(2)} m` },
|
|
4688
4962
|
{
|
|
4689
|
-
id:
|
|
4963
|
+
id: w,
|
|
4690
4964
|
lon: i.Math.toDegrees(y.longitude),
|
|
4691
4965
|
lat: i.Math.toDegrees(y.latitude),
|
|
4692
4966
|
height: y.height || this.firstHeight || 0,
|
|
@@ -4694,13 +4968,13 @@ const $e = class $e {
|
|
|
4694
4968
|
show: !0
|
|
4695
4969
|
}
|
|
4696
4970
|
);
|
|
4697
|
-
const
|
|
4971
|
+
const v = ((b = (P = e.dashLineColor || e.lineColor || e.color || i.Color.RED).withAlpha) == null ? void 0 : b.call(P, 0.9)) || i.Color.RED;
|
|
4698
4972
|
this.previewGroundEntity || (this.previewGroundEntity = n.entities.add({
|
|
4699
4973
|
polyline: {
|
|
4700
4974
|
positions: new i.CallbackProperty(() => !this.previewPos || !this.previewGroundPos ? [] : [this.previewGroundPos, this.previewPos], !1),
|
|
4701
4975
|
width: e.width || 3,
|
|
4702
4976
|
material: new i.PolylineDashMaterialProperty({
|
|
4703
|
-
color:
|
|
4977
|
+
color: v,
|
|
4704
4978
|
dashLength: 12,
|
|
4705
4979
|
dashPattern: 255
|
|
4706
4980
|
})
|
|
@@ -4711,7 +4985,7 @@ const $e = class $e {
|
|
|
4711
4985
|
width: e.width || 3,
|
|
4712
4986
|
material: e.lineColor || e.color || i.Color.YELLOW,
|
|
4713
4987
|
depthFailMaterial: new i.PolylineDashMaterialProperty({
|
|
4714
|
-
color: ((
|
|
4988
|
+
color: ((L = (C = e.dashLineColor || e.lineColor || e.color || i.Color.RED).withAlpha) == null ? void 0 : L.call(C, 0.9)) || i.Color.RED,
|
|
4715
4989
|
dashLength: 12,
|
|
4716
4990
|
dashPattern: 255
|
|
4717
4991
|
})
|
|
@@ -4750,8 +5024,8 @@ const $e = class $e {
|
|
|
4750
5024
|
this.stop(), this._clearPreviewState();
|
|
4751
5025
|
let i = 0;
|
|
4752
5026
|
for (let l = 1; l < this.positions.length; l++) {
|
|
4753
|
-
const d = this.positions[l - 1], u = this.positions[l], g = e.Cartographic.fromCartesian(d),
|
|
4754
|
-
i +=
|
|
5027
|
+
const d = this.positions[l - 1], u = this.positions[l], g = e.Cartographic.fromCartesian(d), p = e.Cartographic.fromCartesian(u), m = new e.EllipsoidGeodesic(g, p);
|
|
5028
|
+
i += m.surfaceDistance;
|
|
4755
5029
|
}
|
|
4756
5030
|
const n = this.positions[this.positions.length - 1], s = e.Cartographic.fromCartesian(n), o = this.totalLabelId || `measure_horizontal_total_${Date.now()}`;
|
|
4757
5031
|
this.totalLabelId = o, this.htmlLabelPool.add(
|
|
@@ -4789,49 +5063,49 @@ const $e = class $e {
|
|
|
4789
5063
|
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;
|
|
4790
5064
|
}
|
|
4791
5065
|
rehydrate(t, e) {
|
|
4792
|
-
var
|
|
4793
|
-
const i = this.Cesium, n = this.viewer, s = t.options || {}, o = s.lineColor || s.color || i.Color.YELLOW, r = ((f = (
|
|
5066
|
+
var m, f;
|
|
5067
|
+
const i = this.Cesium, n = this.viewer, s = t.options || {}, o = s.lineColor || s.color || i.Color.YELLOW, r = ((f = (m = s.dashLineColor || s.lineColor || s.color || i.Color.RED).withAlpha) == null ? void 0 : f.call(m, 0.9)) || i.Color.RED, a = s.width || 3, l = (t.positions || []).map((y) => new i.Cartesian3(y[0], y[1], y[2]));
|
|
4794
5068
|
if (!l.length) return;
|
|
4795
5069
|
if (!this.htmlLabelPool) {
|
|
4796
5070
|
const y = s.overlayContainerId || "html-label-container";
|
|
4797
|
-
this.htmlLabelPool = e || new
|
|
4798
|
-
createElement: (
|
|
5071
|
+
this.htmlLabelPool = e || new G(i, n, y), this.htmlLabelPool.registerTheme("measure-horizontal-total", {
|
|
5072
|
+
createElement: (w, v) => {
|
|
4799
5073
|
var P;
|
|
4800
|
-
|
|
5074
|
+
w.innerHTML = String(((P = v == null ? void 0 : v.data) == null ? void 0 : P.text) || ""), w.style.background = "rgba(0,0,0,0.6)", w.style.color = "#fff", w.style.font = "14px sans-serif", w.style.padding = "4px 6px", w.style.borderRadius = "4px", w.style.whiteSpace = "pre";
|
|
4801
5075
|
},
|
|
4802
5076
|
options: { offset: { x: 0, y: -10 } }
|
|
4803
5077
|
}), this.htmlLabelPool.registerTheme("measure-horizontal-seg", {
|
|
4804
|
-
createElement: (
|
|
5078
|
+
createElement: (w, v) => {
|
|
4805
5079
|
var P;
|
|
4806
|
-
|
|
5080
|
+
w.innerHTML = String(((P = v == null ? void 0 : v.data) == null ? void 0 : P.text) || ""), w.style.background = "rgba(0,0,0,0.6)", w.style.color = "#fff", w.style.font = "14px sans-serif", w.style.padding = "4px 6px", w.style.borderRadius = "4px", w.style.whiteSpace = "pre";
|
|
4807
5081
|
},
|
|
4808
5082
|
options: { offset: { x: 0, y: -10 } }
|
|
4809
5083
|
});
|
|
4810
5084
|
}
|
|
4811
5085
|
for (const y of l) {
|
|
4812
|
-
const
|
|
4813
|
-
this.tempPoints.push(
|
|
4814
|
-
const
|
|
5086
|
+
const w = n.entities.add({ position: y, point: { pixelSize: 8, color: s.pointColor || s.color || i.Color.YELLOW, disableDepthTestDistance: Number.POSITIVE_INFINITY } });
|
|
5087
|
+
this.tempPoints.push(w);
|
|
5088
|
+
const v = i.Cartographic.fromCartesian(y), P = i.Math.toDegrees(v.longitude), b = i.Math.toDegrees(v.latitude), C = n.scene.globe.getHeight(new i.Cartographic(v.longitude, v.latitude, 0)) || 0, L = i.Cartesian3.fromDegrees(P, b, C), E = n.entities.add({
|
|
4815
5089
|
polyline: {
|
|
4816
|
-
positions: [
|
|
5090
|
+
positions: [L, y],
|
|
4817
5091
|
width: a,
|
|
4818
5092
|
material: new i.PolylineDashMaterialProperty({ color: r, dashLength: 12, dashPattern: 255 })
|
|
4819
5093
|
}
|
|
4820
5094
|
});
|
|
4821
|
-
this.groundLineEntities.push(
|
|
5095
|
+
this.groundLineEntities.push(E);
|
|
4822
5096
|
}
|
|
4823
5097
|
for (let y = 1; y < l.length; y++) {
|
|
4824
|
-
const
|
|
5098
|
+
const w = l[y - 1], v = l[y], P = n.entities.add({
|
|
4825
5099
|
polyline: {
|
|
4826
|
-
positions: [
|
|
5100
|
+
positions: [w, v],
|
|
4827
5101
|
width: a,
|
|
4828
5102
|
material: o,
|
|
4829
5103
|
depthFailMaterial: new i.PolylineDashMaterialProperty({ color: r, dashLength: 12, dashPattern: 255 })
|
|
4830
5104
|
}
|
|
4831
5105
|
});
|
|
4832
5106
|
this.segmentEntities.push(P);
|
|
4833
|
-
const b = i.Cartographic.fromCartesian(
|
|
4834
|
-
this.segmentLabelIds.push(I), this.htmlLabelPool.add({ text: `${
|
|
5107
|
+
const b = i.Cartographic.fromCartesian(w), C = i.Cartographic.fromCartesian(v), E = new i.EllipsoidGeodesic(b, C).surfaceDistance, M = new i.Cartesian3((w.x + v.x) / 2, (w.y + v.y) / 2, (w.z + v.z) / 2), x = i.Cartographic.fromCartesian(M), I = t.id + `_seg_${y - 1}`;
|
|
5108
|
+
this.segmentLabelIds.push(I), this.htmlLabelPool.add({ text: `${E.toFixed(2)} m` }, {
|
|
4835
5109
|
id: I,
|
|
4836
5110
|
lon: i.Math.toDegrees(x.longitude),
|
|
4837
5111
|
lat: i.Math.toDegrees(x.latitude),
|
|
@@ -4843,12 +5117,12 @@ const $e = class $e {
|
|
|
4843
5117
|
}
|
|
4844
5118
|
let d = 0;
|
|
4845
5119
|
for (let y = 1; y < l.length; y++) {
|
|
4846
|
-
const
|
|
5120
|
+
const w = i.Cartographic.fromCartesian(l[y - 1]), v = i.Cartographic.fromCartesian(l[y]), P = new i.EllipsoidGeodesic(w, v);
|
|
4847
5121
|
d += P.surfaceDistance;
|
|
4848
5122
|
}
|
|
4849
|
-
const u = l[l.length - 1], g = i.Cartographic.fromCartesian(u),
|
|
4850
|
-
this.totalLabelId =
|
|
4851
|
-
id:
|
|
5123
|
+
const u = l[l.length - 1], g = i.Cartographic.fromCartesian(u), p = t.id + "_total";
|
|
5124
|
+
this.totalLabelId = p, this.htmlLabelPool.add({ text: `${d.toFixed(2)} m` }, {
|
|
5125
|
+
id: p,
|
|
4852
5126
|
lon: i.Math.toDegrees(g.longitude),
|
|
4853
5127
|
lat: i.Math.toDegrees(g.latitude),
|
|
4854
5128
|
height: g.height || 0,
|
|
@@ -4858,8 +5132,8 @@ const $e = class $e {
|
|
|
4858
5132
|
});
|
|
4859
5133
|
}
|
|
4860
5134
|
};
|
|
4861
|
-
c(
|
|
4862
|
-
let Se =
|
|
5135
|
+
c(Re, "TIP_TEXT", "单击左键添加点,右键撤销,双击左键或Esc结束");
|
|
5136
|
+
let Se = Re;
|
|
4863
5137
|
class gt {
|
|
4864
5138
|
constructor(t, e) {
|
|
4865
5139
|
c(this, "Cesium");
|
|
@@ -4883,7 +5157,7 @@ class gt {
|
|
|
4883
5157
|
const e = this.Cesium, i = this.viewer;
|
|
4884
5158
|
if (!this.htmlLabelPool) {
|
|
4885
5159
|
const n = t.overlayContainerId || "html-label-container";
|
|
4886
|
-
this.htmlLabelPool = new
|
|
5160
|
+
this.htmlLabelPool = new G(e, i, n), this.htmlLabelPool.registerTheme("measure-vertical", {
|
|
4887
5161
|
createElement: (s, o) => {
|
|
4888
5162
|
var r;
|
|
4889
5163
|
s.innerHTML = String(((r = o == null ? void 0 : o.data) == null ? void 0 : r.text) || ""), s.style.background = "rgba(0,0,0,0.6)", s.style.color = "#fff", s.style.font = "14px sans-serif", s.style.padding = "4px 6px", s.style.borderRadius = "4px", s.style.whiteSpace = "pre";
|
|
@@ -4899,21 +5173,21 @@ class gt {
|
|
|
4899
5173
|
if (this.positions.length === 0) {
|
|
4900
5174
|
const g = e.Cartographic.fromCartesian(o);
|
|
4901
5175
|
this.baseCarto = new e.Cartographic(g.longitude, g.latitude, 0);
|
|
4902
|
-
const
|
|
4903
|
-
this.baseUp = e.Ellipsoid.WGS84.geodeticSurfaceNormalCartographic(this.baseCarto), this.positions.push(
|
|
4904
|
-
const
|
|
4905
|
-
position:
|
|
5176
|
+
const p = e.Ellipsoid.WGS84.cartographicToCartesian(this.baseCarto);
|
|
5177
|
+
this.baseUp = e.Ellipsoid.WGS84.geodeticSurfaceNormalCartographic(this.baseCarto), this.positions.push(p);
|
|
5178
|
+
const m = i.entities.add({
|
|
5179
|
+
position: p,
|
|
4906
5180
|
point: {
|
|
4907
5181
|
pixelSize: 8,
|
|
4908
5182
|
color: t.pointColor || t.color || e.Color.YELLOW,
|
|
4909
5183
|
disableDepthTestDistance: Number.POSITIVE_INFINITY
|
|
4910
5184
|
}
|
|
4911
5185
|
});
|
|
4912
|
-
this.tempPoints.push(
|
|
5186
|
+
this.tempPoints.push(m);
|
|
4913
5187
|
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;
|
|
4914
5188
|
this.previewEntity = i.entities.add({
|
|
4915
5189
|
polyline: {
|
|
4916
|
-
positions: [
|
|
5190
|
+
positions: [p, p],
|
|
4917
5191
|
width: t.width || 3,
|
|
4918
5192
|
material: f,
|
|
4919
5193
|
depthFailMaterial: new e.PolylineDashMaterialProperty({
|
|
@@ -4925,13 +5199,13 @@ class gt {
|
|
|
4925
5199
|
});
|
|
4926
5200
|
} else {
|
|
4927
5201
|
if (!this.baseCarto || !this.baseUp) return;
|
|
4928
|
-
const g = this.positions[0],
|
|
4929
|
-
if (!
|
|
4930
|
-
const
|
|
5202
|
+
const g = this.positions[0], p = i.camera.getPickRay(n.position);
|
|
5203
|
+
if (!p) return;
|
|
5204
|
+
const m = p.origin, f = e.Cartesian3.normalize(p.direction, new e.Cartesian3()), y = g, w = this.baseUp, v = e.Cartesian3.subtract(m, 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;
|
|
4931
5205
|
if (Math.abs(M) < 1e-6) return;
|
|
4932
|
-
const x = (P *
|
|
5206
|
+
const x = (P * E - b * L) / M, I = e.Cartesian3.add(
|
|
4933
5207
|
y,
|
|
4934
|
-
e.Cartesian3.multiplyByScalar(
|
|
5208
|
+
e.Cartesian3.multiplyByScalar(w, x, new e.Cartesian3()),
|
|
4935
5209
|
new e.Cartesian3()
|
|
4936
5210
|
);
|
|
4937
5211
|
this.positions[1] = I, this.stop(), this.previewEntity && (this.viewer.entities.remove(this.previewEntity), this.previewEntity = null), this.previewPointEntity && (this.viewer.entities.remove(this.previewPointEntity), this.previewPointEntity = null);
|
|
@@ -4957,33 +5231,33 @@ class gt {
|
|
|
4957
5231
|
}
|
|
4958
5232
|
});
|
|
4959
5233
|
this.tempPoints.push(S);
|
|
4960
|
-
const _ = this.baseCarto, k = e.Cartographic.fromCartesian(I), A = Math.abs((k.height || 0) - (_.height || 0)),
|
|
5234
|
+
const _ = this.baseCarto, k = e.Cartographic.fromCartesian(I), A = Math.abs((k.height || 0) - (_.height || 0)), R = new e.Cartesian3(
|
|
4961
5235
|
(this.positions[0].x + this.positions[1].x) / 2,
|
|
4962
5236
|
(this.positions[0].y + this.positions[1].y) / 2,
|
|
4963
5237
|
(this.positions[0].z + this.positions[1].z) / 2
|
|
4964
|
-
),
|
|
5238
|
+
), H = e.Cartographic.fromCartesian(R);
|
|
4965
5239
|
this.previewLabelId && this.htmlLabelPool && (this.htmlLabelPool.removeByIds([this.previewLabelId]), this.previewLabelId = null);
|
|
4966
|
-
const
|
|
4967
|
-
this.htmlLabelId =
|
|
5240
|
+
const B = this.htmlLabelId || `measure_vertical_${Date.now()}`;
|
|
5241
|
+
this.htmlLabelId = B, this.htmlLabelPool.add(
|
|
4968
5242
|
{ text: `${A.toFixed(2)} m` },
|
|
4969
5243
|
{
|
|
4970
|
-
id:
|
|
4971
|
-
lon: e.Math.toDegrees(
|
|
4972
|
-
lat: e.Math.toDegrees(
|
|
4973
|
-
height:
|
|
5244
|
+
id: B,
|
|
5245
|
+
lon: e.Math.toDegrees(H.longitude),
|
|
5246
|
+
lat: e.Math.toDegrees(H.latitude),
|
|
5247
|
+
height: H.height || 0,
|
|
4974
5248
|
theme: "measure-vertical",
|
|
4975
5249
|
show: !0,
|
|
4976
5250
|
style: { pointerEvents: "none", userSelect: "none", cursor: "default" }
|
|
4977
5251
|
}
|
|
4978
5252
|
);
|
|
4979
|
-
const
|
|
5253
|
+
const Y = {
|
|
4980
5254
|
entity: this.entity,
|
|
4981
5255
|
label: this.labelEntity,
|
|
4982
5256
|
positions: this.positions,
|
|
4983
5257
|
vertical: A,
|
|
4984
5258
|
clear: () => this.clear()
|
|
4985
5259
|
};
|
|
4986
|
-
(u = t.onComplete) == null || u.call(t,
|
|
5260
|
+
(u = t.onComplete) == null || u.call(t, Y);
|
|
4987
5261
|
}
|
|
4988
5262
|
}, e.ScreenSpaceEventType.LEFT_CLICK), this.handler.setInputAction((n) => {
|
|
4989
5263
|
var I, D;
|
|
@@ -4994,11 +5268,11 @@ class gt {
|
|
|
4994
5268
|
}
|
|
4995
5269
|
const s = this.positions[0], o = i.camera.getPickRay(n.endPosition);
|
|
4996
5270
|
if (!o) return;
|
|
4997
|
-
const r = o.origin, a = e.Cartesian3.normalize(o.direction, new e.Cartesian3()), l = s, d = this.baseUp, u = e.Cartesian3.subtract(r, l, new e.Cartesian3()), g = e.Cartesian3.dot(a, a),
|
|
4998
|
-
if (Math.abs(
|
|
4999
|
-
const
|
|
5271
|
+
const r = o.origin, a = e.Cartesian3.normalize(o.direction, new e.Cartesian3()), l = s, d = this.baseUp, u = e.Cartesian3.subtract(r, l, new e.Cartesian3()), g = e.Cartesian3.dot(a, a), p = -e.Cartesian3.dot(a, d), m = e.Cartesian3.dot(d, d), f = -e.Cartesian3.dot(a, u), y = e.Cartesian3.dot(d, u), w = g * m - p * p;
|
|
5272
|
+
if (Math.abs(w) < 1e-6) return;
|
|
5273
|
+
const v = (g * y - p * f) / w, P = e.Cartesian3.add(
|
|
5000
5274
|
l,
|
|
5001
|
-
e.Cartesian3.multiplyByScalar(d,
|
|
5275
|
+
e.Cartesian3.multiplyByScalar(d, v, new e.Cartesian3()),
|
|
5002
5276
|
new e.Cartesian3()
|
|
5003
5277
|
);
|
|
5004
5278
|
if (this.positions[1] = P, !this.previewEntity) {
|
|
@@ -5024,13 +5298,13 @@ class gt {
|
|
|
5024
5298
|
disableDepthTestDistance: Number.POSITIVE_INFINITY
|
|
5025
5299
|
}
|
|
5026
5300
|
});
|
|
5027
|
-
const b = this.baseCarto, C = e.Cartographic.fromCartesian(P),
|
|
5301
|
+
const b = this.baseCarto, C = e.Cartographic.fromCartesian(P), L = Math.abs((C.height || 0) - (b.height || 0)), E = new e.Cartesian3(
|
|
5028
5302
|
(this.positions[0].x + P.x) / 2,
|
|
5029
5303
|
(this.positions[0].y + P.y) / 2,
|
|
5030
5304
|
(this.positions[0].z + P.z) / 2
|
|
5031
|
-
), M = e.Cartographic.fromCartesian(
|
|
5305
|
+
), M = e.Cartographic.fromCartesian(E), x = this.previewLabelId || "measure_vertical_preview";
|
|
5032
5306
|
this.previewLabelId = x, this.htmlLabelPool.add(
|
|
5033
|
-
{ text: `${
|
|
5307
|
+
{ text: `${L.toFixed(2)} m` },
|
|
5034
5308
|
{
|
|
5035
5309
|
id: x,
|
|
5036
5310
|
lon: e.Math.toDegrees(M.longitude),
|
|
@@ -5051,26 +5325,26 @@ class gt {
|
|
|
5051
5325
|
}
|
|
5052
5326
|
rehydrate(t, e) {
|
|
5053
5327
|
var b, C;
|
|
5054
|
-
const i = this.Cesium, n = this.viewer, s = t.options || {}, o = s.lineColor || s.color || i.Color.CYAN, r = ((C = (b = s.dashLineColor || s.lineColor || s.color || i.Color.RED).withAlpha) == null ? void 0 : C.call(b, 0.9)) || i.Color.RED, a = s.width || 3, l = (t.positions || []).map((
|
|
5328
|
+
const i = this.Cesium, n = this.viewer, s = t.options || {}, o = s.lineColor || s.color || i.Color.CYAN, r = ((C = (b = s.dashLineColor || s.lineColor || s.color || i.Color.RED).withAlpha) == null ? void 0 : C.call(b, 0.9)) || i.Color.RED, a = s.width || 3, l = (t.positions || []).map((L) => new i.Cartesian3(L[0], L[1], L[2]));
|
|
5055
5329
|
if (l.length < 2) return;
|
|
5056
5330
|
if (!this.htmlLabelPool) {
|
|
5057
|
-
const
|
|
5058
|
-
this.htmlLabelPool = e || new
|
|
5059
|
-
createElement: (
|
|
5331
|
+
const L = s.overlayContainerId || "html-label-container";
|
|
5332
|
+
this.htmlLabelPool = e || new G(i, n, L), this.htmlLabelPool.registerTheme("measure-vertical", {
|
|
5333
|
+
createElement: (E, M) => {
|
|
5060
5334
|
var x;
|
|
5061
|
-
|
|
5335
|
+
E.innerHTML = String(((x = M == null ? void 0 : M.data) == null ? void 0 : x.text) || ""), E.style.background = "rgba(0,0,0,0.6)", E.style.color = "#fff", E.style.font = "14px sans-serif", E.style.padding = "4px 6px", E.style.borderRadius = "4px", E.style.whiteSpace = "pre";
|
|
5062
5336
|
},
|
|
5063
5337
|
options: { offset: { x: 0, y: -10 } }
|
|
5064
5338
|
});
|
|
5065
5339
|
}
|
|
5066
|
-
const d = l[0], u = l[1], g = n.entities.add({ position: d, point: { pixelSize: 8, color: s.pointColor || s.color || i.Color.YELLOW, disableDepthTestDistance: Number.POSITIVE_INFINITY } }),
|
|
5067
|
-
this.tempPoints.push(g), this.tempPoints.push(
|
|
5068
|
-
const
|
|
5340
|
+
const d = l[0], u = l[1], g = n.entities.add({ position: d, point: { pixelSize: 8, color: s.pointColor || s.color || i.Color.YELLOW, disableDepthTestDistance: Number.POSITIVE_INFINITY } }), p = n.entities.add({ position: u, point: { pixelSize: 8, color: s.pointColor || s.color || i.Color.YELLOW, disableDepthTestDistance: Number.POSITIVE_INFINITY } });
|
|
5341
|
+
this.tempPoints.push(g), this.tempPoints.push(p), this.entity = n.entities.add({ polyline: { positions: [d, u], width: a, material: o, depthFailMaterial: new i.PolylineDashMaterialProperty({ color: r, dashLength: 12, dashPattern: 255 }) } });
|
|
5342
|
+
const m = i.Cartographic.fromCartesian(d), f = i.Cartographic.fromCartesian(u), y = Math.abs((f.height || 0) - (m.height || 0)), w = new i.Cartesian3((d.x + u.x) / 2, (d.y + u.y) / 2, (d.z + u.z) / 2), v = i.Cartographic.fromCartesian(w), P = t.id + "_label";
|
|
5069
5343
|
this.htmlLabelId = P, this.htmlLabelPool.add({ text: `${y.toFixed(2)} m` }, {
|
|
5070
5344
|
id: P,
|
|
5071
|
-
lon: i.Math.toDegrees(
|
|
5072
|
-
lat: i.Math.toDegrees(
|
|
5073
|
-
height:
|
|
5345
|
+
lon: i.Math.toDegrees(v.longitude),
|
|
5346
|
+
lat: i.Math.toDegrees(v.latitude),
|
|
5347
|
+
height: v.height || 0,
|
|
5074
5348
|
theme: "measure-vertical",
|
|
5075
5349
|
show: !0,
|
|
5076
5350
|
style: { pointerEvents: "none", userSelect: "none", cursor: "default" }
|
|
@@ -5107,7 +5381,7 @@ class ft {
|
|
|
5107
5381
|
const e = this.Cesium, i = this.viewer;
|
|
5108
5382
|
if (!this.htmlLabelPool) {
|
|
5109
5383
|
const n = t.overlayContainerId || "html-label-container";
|
|
5110
|
-
this.htmlLabelPool = new
|
|
5384
|
+
this.htmlLabelPool = new G(e, i, n), this.htmlLabelPool.registerTheme("measure-triangle", {
|
|
5111
5385
|
createElement: (s, o) => {
|
|
5112
5386
|
var r;
|
|
5113
5387
|
s.innerHTML = String(((r = o == null ? void 0 : o.data) == null ? void 0 : r.text) || ""), s.style.background = "rgba(0,0,0,0.6)", s.style.color = "#fff", s.style.font = "14px sans-serif", s.style.padding = "4px 6px", s.style.borderRadius = "4px", s.style.whiteSpace = "pre";
|
|
@@ -5141,70 +5415,70 @@ class ft {
|
|
|
5141
5415
|
}
|
|
5142
5416
|
});
|
|
5143
5417
|
if (this.pointEntities.push(o), this.positions.length === 2) {
|
|
5144
|
-
this.stop(), this.previewSegmentEntities.forEach((
|
|
5145
|
-
const d = e.Cartographic.fromCartesian(this.positions[0]), u = e.Cartographic.fromCartesian(this.positions[1]), g = d.height || 0,
|
|
5418
|
+
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]), u = e.Cartographic.fromCartesian(this.positions[1]), g = d.height || 0, p = u.height || 0, m = g <= p ? this.positions[0] : this.positions[1], f = g > p ? this.positions[0] : this.positions[1], y = e.Cartographic.fromCartesian(m);
|
|
5146
5420
|
e.Cartographic.fromCartesian(f);
|
|
5147
|
-
const
|
|
5421
|
+
const w = Math.max(g, p), v = e.Cartesian3.fromDegrees(
|
|
5148
5422
|
e.Math.toDegrees(y.longitude),
|
|
5149
5423
|
e.Math.toDegrees(y.latitude),
|
|
5150
|
-
|
|
5424
|
+
w
|
|
5151
5425
|
), 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({
|
|
5152
5426
|
polyline: {
|
|
5153
|
-
positions: [
|
|
5427
|
+
positions: [m, v],
|
|
5154
5428
|
width: t.width || 3,
|
|
5155
5429
|
material: P,
|
|
5156
5430
|
depthFailMaterial: new e.PolylineDashMaterialProperty({ color: b, dashLength: 12, dashPattern: 255 })
|
|
5157
5431
|
}
|
|
5158
|
-
}),
|
|
5432
|
+
}), L = i.entities.add({
|
|
5159
5433
|
polyline: {
|
|
5160
|
-
positions: [
|
|
5434
|
+
positions: [v, f],
|
|
5161
5435
|
width: t.width || 3,
|
|
5162
5436
|
material: P,
|
|
5163
5437
|
depthFailMaterial: new e.PolylineDashMaterialProperty({ color: b, dashLength: 12, dashPattern: 255 })
|
|
5164
5438
|
}
|
|
5165
|
-
}),
|
|
5439
|
+
}), E = i.entities.add({
|
|
5166
5440
|
polyline: {
|
|
5167
|
-
positions: [
|
|
5441
|
+
positions: [m, f],
|
|
5168
5442
|
width: t.width || 3,
|
|
5169
5443
|
material: P,
|
|
5170
5444
|
depthFailMaterial: new e.PolylineDashMaterialProperty({ color: b, dashLength: 12, dashPattern: 255 })
|
|
5171
5445
|
}
|
|
5172
5446
|
});
|
|
5173
|
-
this.segmentEntities.push(C,
|
|
5174
|
-
const M = e.Cartesian3.distance(
|
|
5175
|
-
this.segmentLabelIds = [
|
|
5176
|
-
const
|
|
5177
|
-
this.angleLabelIds = [Z, ne], this.htmlLabelPool.add({ text: `${(
|
|
5178
|
-
const ge = Math.max(0.01, Math.min(0.5, t.angleMarkerRatio ?? 0.2)),
|
|
5447
|
+
this.segmentEntities.push(C, L, E);
|
|
5448
|
+
const M = e.Cartesian3.distance(m, v), x = e.Cartesian3.distance(v, f), I = e.Cartesian3.distance(m, f), D = new e.Cartesian3((m.x + v.x) / 2, (m.y + v.y) / 2, (m.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((m.x + f.x) / 2, (m.y + f.y) / 2, (m.z + f.z) / 2), _ = e.Cartographic.fromCartesian(D), k = e.Cartographic.fromCartesian(T), A = e.Cartographic.fromCartesian(S), R = "measure_triangle_seg_v", H = "measure_triangle_seg_h", B = "measure_triangle_seg_hyp";
|
|
5449
|
+
this.segmentLabelIds = [R, H, 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: H, lon: e.Math.toDegrees(k.longitude), lat: e.Math.toDegrees(k.latitude), height: k.height || 0, theme: "measure-triangle-seg", show: !0, style: { pointerEvents: "none", userSelect: "none", cursor: "default" } }), this.htmlLabelPool.add({ text: `${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" } });
|
|
5450
|
+
const Y = e.Cartesian3.subtract(f, m, new e.Cartesian3()), N = e.Cartesian3.subtract(v, m, new e.Cartesian3()), z = e.Cartesian3.subtract(v, f, new e.Cartesian3()), V = e.Cartesian3.subtract(m, 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(m), W = e.Cartographic.fromCartesian(f), Z = "measure_triangle_angle_a", ne = "measure_triangle_angle_b";
|
|
5451
|
+
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
|
+
const ge = Math.max(0.01, Math.min(0.5, t.angleMarkerRatio ?? 0.2)), U = Math.min(M, x) * ge;
|
|
5179
5453
|
if (M > 1e-3 && x > 1e-3) {
|
|
5180
|
-
const
|
|
5181
|
-
e.Cartesian3.subtract(
|
|
5454
|
+
const q = e.Cartesian3.normalize(
|
|
5455
|
+
e.Cartesian3.subtract(m, v, new e.Cartesian3()),
|
|
5182
5456
|
new e.Cartesian3()
|
|
5183
5457
|
), oe = e.Cartesian3.normalize(
|
|
5184
|
-
e.Cartesian3.subtract(f,
|
|
5458
|
+
e.Cartesian3.subtract(f, v, new e.Cartesian3()),
|
|
5185
5459
|
new e.Cartesian3()
|
|
5186
5460
|
), J = new e.Cartesian3(
|
|
5187
|
-
|
|
5188
|
-
|
|
5189
|
-
|
|
5190
|
-
),
|
|
5191
|
-
|
|
5192
|
-
|
|
5193
|
-
|
|
5194
|
-
),
|
|
5195
|
-
|
|
5196
|
-
|
|
5197
|
-
|
|
5461
|
+
v.x + q.x * U,
|
|
5462
|
+
v.y + q.y * U,
|
|
5463
|
+
v.z + q.z * U
|
|
5464
|
+
), $ = new e.Cartesian3(
|
|
5465
|
+
v.x + oe.x * U,
|
|
5466
|
+
v.y + oe.y * U,
|
|
5467
|
+
v.z + oe.z * U
|
|
5468
|
+
), X = new e.Cartesian3(
|
|
5469
|
+
v.x + q.x * U + oe.x * U,
|
|
5470
|
+
v.y + q.y * U + oe.y * U,
|
|
5471
|
+
v.z + q.z * U + oe.z * U
|
|
5198
5472
|
), Q = i.entities.add({
|
|
5199
5473
|
polyline: {
|
|
5200
|
-
positions: [J,
|
|
5474
|
+
positions: [J, X],
|
|
5201
5475
|
width: t.width || 3,
|
|
5202
5476
|
material: P,
|
|
5203
5477
|
depthFailMaterial: new e.PolylineDashMaterialProperty({ color: b, dashLength: 12, dashPattern: 255 })
|
|
5204
5478
|
}
|
|
5205
5479
|
}), Te = i.entities.add({
|
|
5206
5480
|
polyline: {
|
|
5207
|
-
positions: [
|
|
5481
|
+
positions: [$, X],
|
|
5208
5482
|
width: t.width || 3,
|
|
5209
5483
|
material: P,
|
|
5210
5484
|
depthFailMaterial: new e.PolylineDashMaterialProperty({ color: b, dashLength: 12, dashPattern: 255 })
|
|
@@ -5213,26 +5487,26 @@ class ft {
|
|
|
5213
5487
|
this.angleMarkerEntities.push(Q, Te);
|
|
5214
5488
|
}
|
|
5215
5489
|
this.previewLabelId && this.htmlLabelPool && (this.htmlLabelPool.removeByIds([this.previewLabelId]), this.previewLabelId = null);
|
|
5216
|
-
const
|
|
5490
|
+
const K = {
|
|
5217
5491
|
entity: this.segmentEntities,
|
|
5218
|
-
positions: [
|
|
5492
|
+
positions: [m, f, v],
|
|
5219
5493
|
lengths: { vertical: M, horizontal: x, hypotenuse: I },
|
|
5220
|
-
angles: { acuteA:
|
|
5494
|
+
angles: { acuteA: j, acuteB: le },
|
|
5221
5495
|
clear: () => this.clear()
|
|
5222
5496
|
};
|
|
5223
|
-
(l = t.onComplete) == null || l.call(t,
|
|
5497
|
+
(l = t.onComplete) == null || l.call(t, K);
|
|
5224
5498
|
}
|
|
5225
5499
|
}, e.ScreenSpaceEventType.LEFT_CLICK), this.handler.setInputAction((n) => {
|
|
5226
5500
|
var le, ee;
|
|
5227
5501
|
if (this.positions.length !== 1) return;
|
|
5228
5502
|
const s = i.scene.pickPosition(n.endPosition);
|
|
5229
5503
|
if (!s) return;
|
|
5230
|
-
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, u = a > l ? this.positions[0] : s, g = e.Cartographic.fromCartesian(d),
|
|
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, u = a > l ? this.positions[0] : s, g = e.Cartographic.fromCartesian(d), p = Math.max(a, l), m = e.Cartesian3.fromDegrees(
|
|
5231
5505
|
this.Cesium.Math.toDegrees(g.longitude),
|
|
5232
5506
|
this.Cesium.Math.toDegrees(g.latitude),
|
|
5233
|
-
|
|
5507
|
+
p
|
|
5234
5508
|
);
|
|
5235
|
-
this.previewLow = d, this.previewHigh = u, this.previewThird =
|
|
5509
|
+
this.previewLow = d, this.previewHigh = u, this.previewThird = m;
|
|
5236
5510
|
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;
|
|
5237
5511
|
if (this.previewPointEntity ? this.previewPointEntity.position = s : this.previewPointEntity = i.entities.add({
|
|
5238
5512
|
position: s,
|
|
@@ -5242,7 +5516,7 @@ class ft {
|
|
|
5242
5516
|
disableDepthTestDistance: Number.POSITIVE_INFINITY
|
|
5243
5517
|
}
|
|
5244
5518
|
}), !this.previewSegmentEntities.length) {
|
|
5245
|
-
const
|
|
5519
|
+
const W = i.entities.add({
|
|
5246
5520
|
polyline: {
|
|
5247
5521
|
positions: new e.CallbackProperty(() => !this.previewLow || !this.previewThird ? [] : [this.previewLow, this.previewThird], !1),
|
|
5248
5522
|
width: t.width || 3,
|
|
@@ -5264,40 +5538,40 @@ class ft {
|
|
|
5264
5538
|
depthFailMaterial: new e.PolylineDashMaterialProperty({ color: y, dashLength: 12, dashPattern: 255 })
|
|
5265
5539
|
}
|
|
5266
5540
|
});
|
|
5267
|
-
this.previewSegmentEntities.push(
|
|
5541
|
+
this.previewSegmentEntities.push(W, Z, ne);
|
|
5268
5542
|
}
|
|
5269
|
-
const
|
|
5270
|
-
this.segmentLabelIds.length === 0 && (this.segmentLabelIds = [
|
|
5271
|
-
const Ce = Math.max(0.01, Math.min(0.5, t.angleMarkerRatio ?? 0.2)),
|
|
5272
|
-
if (
|
|
5273
|
-
const
|
|
5274
|
-
e.Cartesian3.subtract(d,
|
|
5543
|
+
const w = e.Cartesian3.distance(d, m), v = e.Cartesian3.distance(m, u), P = e.Cartesian3.distance(d, u), b = e.Cartesian3.subtract(u, d, new e.Cartesian3()), C = e.Cartesian3.subtract(m, d, new e.Cartesian3()), L = e.Cartesian3.subtract(m, u, new e.Cartesian3()), E = e.Cartesian3.subtract(d, u, 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 + m.x) / 2, (d.y + m.y) / 2, (d.z + m.z) / 2), k = new e.Cartesian3((m.x + u.x) / 2, (m.y + u.y) / 2, (m.z + u.z) / 2), A = new e.Cartesian3((d.x + u.x) / 2, (d.y + u.y) / 2, (d.z + u.z) / 2), R = e.Cartographic.fromCartesian(_), H = e.Cartographic.fromCartesian(k), B = e.Cartographic.fromCartesian(A), Y = e.Cartographic.fromCartesian(d), N = e.Cartographic.fromCartesian(u), 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";
|
|
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(H.longitude), lat: e.Math.toDegrees(H.latitude), height: H.height || 0, theme: "measure-triangle-seg", show: !0, style: { pointerEvents: "none", userSelect: "none", cursor: "default" } }), this.htmlLabelPool.add({ text: `${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
|
+
const Ce = Math.max(0.01, Math.min(0.5, t.angleMarkerRatio ?? 0.2)), j = Math.min(w, v) * Ce;
|
|
5546
|
+
if (w > 1e-3 && v > 1e-3) {
|
|
5547
|
+
const W = e.Cartesian3.normalize(
|
|
5548
|
+
e.Cartesian3.subtract(d, m, new e.Cartesian3()),
|
|
5275
5549
|
new e.Cartesian3()
|
|
5276
5550
|
), Z = e.Cartesian3.normalize(
|
|
5277
|
-
e.Cartesian3.subtract(u,
|
|
5551
|
+
e.Cartesian3.subtract(u, m, new e.Cartesian3()),
|
|
5278
5552
|
new e.Cartesian3()
|
|
5279
5553
|
), ne = new e.Cartesian3(
|
|
5280
|
-
|
|
5281
|
-
|
|
5282
|
-
|
|
5554
|
+
m.x + W.x * j,
|
|
5555
|
+
m.y + W.y * j,
|
|
5556
|
+
m.z + W.z * j
|
|
5283
5557
|
), ge = new e.Cartesian3(
|
|
5284
|
-
|
|
5285
|
-
|
|
5286
|
-
|
|
5287
|
-
),
|
|
5288
|
-
|
|
5289
|
-
|
|
5290
|
-
|
|
5558
|
+
m.x + Z.x * j,
|
|
5559
|
+
m.y + Z.y * j,
|
|
5560
|
+
m.z + Z.z * j
|
|
5561
|
+
), U = new e.Cartesian3(
|
|
5562
|
+
m.x + W.x * j + Z.x * j,
|
|
5563
|
+
m.y + W.y * j + Z.y * j,
|
|
5564
|
+
m.z + W.z * j + Z.z * j
|
|
5291
5565
|
);
|
|
5292
|
-
if (this.previewMarkerP1 = ne, this.previewMarkerP2 = ge, this.previewMarkerCorner =
|
|
5293
|
-
const
|
|
5566
|
+
if (this.previewMarkerP1 = ne, this.previewMarkerP2 = ge, this.previewMarkerCorner = U, !this.previewAngleMarkerEntities.length) {
|
|
5567
|
+
const K = i.entities.add({
|
|
5294
5568
|
polyline: {
|
|
5295
5569
|
positions: new e.CallbackProperty(() => !this.previewMarkerP1 || !this.previewMarkerCorner ? [] : [this.previewMarkerP1, this.previewMarkerCorner], !1),
|
|
5296
5570
|
width: t.width || 3,
|
|
5297
5571
|
material: f,
|
|
5298
5572
|
depthFailMaterial: new e.PolylineDashMaterialProperty({ color: y, dashLength: 12, dashPattern: 255 })
|
|
5299
5573
|
}
|
|
5300
|
-
}),
|
|
5574
|
+
}), q = i.entities.add({
|
|
5301
5575
|
polyline: {
|
|
5302
5576
|
positions: new e.CallbackProperty(() => !this.previewMarkerP2 || !this.previewMarkerCorner ? [] : [this.previewMarkerP2, this.previewMarkerCorner], !1),
|
|
5303
5577
|
width: t.width || 3,
|
|
@@ -5305,7 +5579,7 @@ class ft {
|
|
|
5305
5579
|
depthFailMaterial: new e.PolylineDashMaterialProperty({ color: y, dashLength: 12, dashPattern: 255 })
|
|
5306
5580
|
}
|
|
5307
5581
|
});
|
|
5308
|
-
this.previewAngleMarkerEntities.push(
|
|
5582
|
+
this.previewAngleMarkerEntities.push(K, q);
|
|
5309
5583
|
}
|
|
5310
5584
|
}
|
|
5311
5585
|
}, e.ScreenSpaceEventType.MOUSE_MOVE);
|
|
@@ -5317,53 +5591,53 @@ class ft {
|
|
|
5317
5591
|
this.stop(), this.segmentEntities.forEach((t) => this.viewer.entities.remove(t)), this.segmentEntities = [], this.angleMarkerEntities.forEach((t) => this.viewer.entities.remove(t)), this.angleMarkerEntities = [], this.pointEntities.forEach((t) => this.viewer.entities.remove(t)), this.pointEntities = [], this.previewSegmentEntities.forEach((t) => this.viewer.entities.remove(t)), this.previewSegmentEntities = [], this.previewAngleMarkerEntities.forEach((t) => this.viewer.entities.remove(t)), this.previewAngleMarkerEntities = [], this.previewPointEntity && (this.viewer.entities.remove(this.previewPointEntity), this.previewPointEntity = null), this.htmlLabelPool && this.htmlLabelId && (this.htmlLabelPool.removeByIds([this.htmlLabelId]), this.htmlLabelId = null), this.previewLabelId && this.htmlLabelPool && (this.htmlLabelPool.removeByIds([this.previewLabelId]), this.previewLabelId = null), this.segmentLabelIds.length && this.htmlLabelPool && this.htmlLabelPool.removeByIds(this.segmentLabelIds.slice()), this.angleLabelIds.length && this.htmlLabelPool && this.htmlLabelPool.removeByIds(this.angleLabelIds.slice()), this.segmentLabelIds = [], this.angleLabelIds = [], this.positions = [];
|
|
5318
5592
|
}
|
|
5319
5593
|
rehydrate(t, e) {
|
|
5320
|
-
var
|
|
5321
|
-
const i = this.Cesium, n = this.viewer, s = t.options || {}, o = s.lineColor || s.color || i.Color.YELLOW, r = ((oe = (
|
|
5594
|
+
var q, oe;
|
|
5595
|
+
const i = this.Cesium, n = this.viewer, s = t.options || {}, o = s.lineColor || s.color || i.Color.YELLOW, r = ((oe = (q = s.dashLineColor || s.lineColor || s.color || i.Color.RED).withAlpha) == null ? void 0 : oe.call(q, 0.9)) || i.Color.RED, a = s.width || 3, l = (t.positions || []).map((J) => new i.Cartesian3(J[0], J[1], J[2]));
|
|
5322
5596
|
if (l.length < 2) return;
|
|
5323
5597
|
if (!this.htmlLabelPool) {
|
|
5324
5598
|
const J = s.overlayContainerId || "html-label-container";
|
|
5325
|
-
this.htmlLabelPool = e || new
|
|
5326
|
-
createElement: (
|
|
5599
|
+
this.htmlLabelPool = e || new G(i, n, J), this.htmlLabelPool.registerTheme("measure-triangle", {
|
|
5600
|
+
createElement: ($, X) => {
|
|
5327
5601
|
var Q;
|
|
5328
|
-
|
|
5602
|
+
$.innerHTML = String(((Q = X == null ? void 0 : X.data) == null ? void 0 : Q.text) || ""), $.style.background = "rgba(0,0,0,0.6)", $.style.color = "#fff", $.style.font = "14px sans-serif", $.style.padding = "4px 6px", $.style.borderRadius = "4px", $.style.whiteSpace = "pre";
|
|
5329
5603
|
},
|
|
5330
5604
|
options: { offset: { x: 0, y: -10 } }
|
|
5331
5605
|
}), this.htmlLabelPool.registerTheme("measure-triangle-seg", {
|
|
5332
|
-
createElement: (
|
|
5606
|
+
createElement: ($, X) => {
|
|
5333
5607
|
var Q;
|
|
5334
|
-
|
|
5608
|
+
$.innerHTML = String(((Q = X == null ? void 0 : X.data) == null ? void 0 : Q.text) || ""), $.style.background = "rgba(0,0,0,0.6)", $.style.color = "#fff", $.style.font = "14px sans-serif", $.style.padding = "4px 6px", $.style.borderRadius = "4px", $.style.whiteSpace = "pre";
|
|
5335
5609
|
},
|
|
5336
5610
|
options: { offset: { x: 0, y: -10 } }
|
|
5337
5611
|
}), this.htmlLabelPool.registerTheme("measure-triangle-angle", {
|
|
5338
|
-
createElement: (
|
|
5612
|
+
createElement: ($, X) => {
|
|
5339
5613
|
var Q;
|
|
5340
|
-
|
|
5614
|
+
$.innerHTML = String(((Q = X == null ? void 0 : X.data) == null ? void 0 : Q.text) || ""), $.style.background = "rgba(0,0,0,0.6)", $.style.color = "#fff", $.style.font = "14px sans-serif", $.style.padding = "4px 6px", $.style.borderRadius = "4px", $.style.whiteSpace = "pre";
|
|
5341
5615
|
},
|
|
5342
5616
|
options: { offset: { x: 0, y: -10 } }
|
|
5343
5617
|
});
|
|
5344
5618
|
}
|
|
5345
|
-
const d = i.Cartographic.fromCartesian(l[0]), u = i.Cartographic.fromCartesian(l[1]), g = d.height || 0,
|
|
5346
|
-
this.pointEntities.push(y,
|
|
5347
|
-
const
|
|
5348
|
-
i.Math.toDegrees(
|
|
5349
|
-
i.Math.toDegrees(
|
|
5619
|
+
const d = i.Cartographic.fromCartesian(l[0]), u = i.Cartographic.fromCartesian(l[1]), g = d.height || 0, p = u.height || 0, m = g <= p ? l[0] : l[1], f = g > p ? l[0] : l[1], y = n.entities.add({ position: m, 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
|
+
this.pointEntities.push(y, w);
|
|
5621
|
+
const v = i.Cartographic.fromCartesian(m), P = Math.max(g, p), b = i.Cartesian3.fromDegrees(
|
|
5622
|
+
i.Math.toDegrees(v.longitude),
|
|
5623
|
+
i.Math.toDegrees(v.latitude),
|
|
5350
5624
|
P
|
|
5351
5625
|
), C = n.entities.add({
|
|
5352
|
-
polyline: { positions: [
|
|
5353
|
-
}), E = n.entities.add({
|
|
5354
|
-
polyline: { positions: [b, f], width: a, material: o, depthFailMaterial: new i.PolylineDashMaterialProperty({ color: r, dashLength: 12, dashPattern: 255 }) }
|
|
5626
|
+
polyline: { positions: [m, b], width: a, material: o, depthFailMaterial: new i.PolylineDashMaterialProperty({ color: r, dashLength: 12, dashPattern: 255 }) }
|
|
5355
5627
|
}), L = n.entities.add({
|
|
5356
|
-
polyline: { positions: [
|
|
5628
|
+
polyline: { positions: [b, f], width: a, material: o, depthFailMaterial: new i.PolylineDashMaterialProperty({ color: r, dashLength: 12, dashPattern: 255 }) }
|
|
5629
|
+
}), E = n.entities.add({
|
|
5630
|
+
polyline: { positions: [m, f], width: a, material: o, depthFailMaterial: new i.PolylineDashMaterialProperty({ color: r, dashLength: 12, dashPattern: 255 }) }
|
|
5357
5631
|
});
|
|
5358
|
-
this.segmentEntities.push(C,
|
|
5359
|
-
const M = i.Cartesian3.distance(
|
|
5360
|
-
this.segmentLabelIds = [
|
|
5361
|
-
const
|
|
5362
|
-
this.angleLabelIds = [ne, ge], this.htmlLabelPool.add({ text: `${Z.angle}:${(
|
|
5363
|
-
const
|
|
5632
|
+
this.segmentEntities.push(C, L, E);
|
|
5633
|
+
const M = i.Cartesian3.distance(m, b), x = i.Cartesian3.distance(b, f), I = i.Cartesian3.distance(m, f), D = new i.Cartesian3((m.x + b.x) / 2, (m.y + b.y) / 2, (m.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((m.x + f.x) / 2, (m.y + f.y) / 2, (m.z + f.z) / 2), _ = i.Cartographic.fromCartesian(D), k = i.Cartographic.fromCartesian(T), A = i.Cartographic.fromCartesian(S), R = t.id + "_tri_v", H = t.id + "_tri_h", B = t.id + "_tri_hyp";
|
|
5634
|
+
this.segmentLabelIds = [R, H, 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: H, lon: i.Math.toDegrees(k.longitude), lat: i.Math.toDegrees(k.latitude), height: k.height || 0, theme: "measure-triangle-seg", show: !0, style: { pointerEvents: "none", userSelect: "none", cursor: "default" } }), this.htmlLabelPool.add({ text: `${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" } });
|
|
5635
|
+
const Y = i.Cartesian3.subtract(f, m, new i.Cartesian3()), N = i.Cartesian3.subtract(b, m, new i.Cartesian3()), z = i.Cartesian3.subtract(b, f, new i.Cartesian3()), V = i.Cartesian3.subtract(m, 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(m), W = i.Cartographic.fromCartesian(f), Z = s.labelText || { angle: "角度" }, ne = t.id + "_tri_angA", ge = t.id + "_tri_angB";
|
|
5636
|
+
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
|
+
const U = Math.max(0.01, Math.min(0.5, s.angleMarkerRatio ?? 0.2)), K = Math.min(M, x) * U;
|
|
5364
5638
|
if (M > 1e-3 && x > 1e-3) {
|
|
5365
|
-
const J = i.Cartesian3.normalize(i.Cartesian3.subtract(
|
|
5366
|
-
this.angleMarkerEntities.push(Ft,
|
|
5639
|
+
const J = i.Cartesian3.normalize(i.Cartesian3.subtract(m, b, new i.Cartesian3()), new i.Cartesian3()), $ = 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 + $.x * K, b.y + $.y * K, b.z + $.z * K), Te = new i.Cartesian3(b.x + J.x * K + $.x * K, b.y + J.y * K + $.y * K, b.z + J.z * K + $.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
|
+
this.angleMarkerEntities.push(Ft, Nt);
|
|
5367
5641
|
}
|
|
5368
5642
|
}
|
|
5369
5643
|
}
|
|
@@ -5388,7 +5662,7 @@ class yt {
|
|
|
5388
5662
|
const e = this.Cesium, i = this.viewer;
|
|
5389
5663
|
if (!this.htmlLabelPool) {
|
|
5390
5664
|
const n = t.overlayContainerId || "html-label-container";
|
|
5391
|
-
this.htmlLabelPool = new
|
|
5665
|
+
this.htmlLabelPool = new G(e, i, n), this.htmlLabelPool.registerTheme("measure-space", {
|
|
5392
5666
|
createElement: (s, o) => {
|
|
5393
5667
|
var r;
|
|
5394
5668
|
s.innerHTML = String(((r = o == null ? void 0 : o.data) == null ? void 0 : r.text) || ""), s.style.background = "rgba(0,0,0,0.6)", s.style.color = "#fff", s.style.font = "14px sans-serif", s.style.padding = "4px 6px", s.style.borderRadius = "4px", s.style.whiteSpace = "pre";
|
|
@@ -5411,24 +5685,24 @@ class yt {
|
|
|
5411
5685
|
});
|
|
5412
5686
|
if (this.tempPoints.push(o), this.positions.length === 2) {
|
|
5413
5687
|
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);
|
|
5414
|
-
const d = this.positions[0], u = this.positions[1], g = t.lineColor || t.color || e.Color.YELLOW,
|
|
5688
|
+
const d = this.positions[0], u = this.positions[1], g = t.lineColor || t.color || e.Color.YELLOW, p = ((a = (r = t.dashLineColor || t.lineColor || t.color || e.Color.RED).withAlpha) == null ? void 0 : a.call(r, 0.9)) || e.Color.RED;
|
|
5415
5689
|
this.entity = i.entities.add({
|
|
5416
5690
|
polyline: {
|
|
5417
5691
|
positions: [d, u],
|
|
5418
5692
|
width: t.width || 3,
|
|
5419
5693
|
material: g,
|
|
5420
5694
|
depthFailMaterial: new e.PolylineDashMaterialProperty({
|
|
5421
|
-
color:
|
|
5695
|
+
color: p,
|
|
5422
5696
|
dashLength: 12,
|
|
5423
5697
|
dashPattern: 255
|
|
5424
5698
|
})
|
|
5425
5699
|
}
|
|
5426
5700
|
});
|
|
5427
|
-
const
|
|
5428
|
-
this.htmlLabelId =
|
|
5429
|
-
{ text: `${
|
|
5701
|
+
const m = e.Cartesian3.distance(d, u), f = u, y = e.Cartographic.fromCartesian(f), w = this.htmlLabelId || `measure_space_${Date.now()}`;
|
|
5702
|
+
this.htmlLabelId = w, this.htmlLabelPool.add(
|
|
5703
|
+
{ text: `${m.toFixed(2)} m` },
|
|
5430
5704
|
{
|
|
5431
|
-
id:
|
|
5705
|
+
id: w,
|
|
5432
5706
|
lon: e.Math.toDegrees(y.longitude),
|
|
5433
5707
|
lat: e.Math.toDegrees(y.latitude),
|
|
5434
5708
|
height: y.height || 0,
|
|
@@ -5437,17 +5711,17 @@ class yt {
|
|
|
5437
5711
|
style: { pointerEvents: "none", userSelect: "none", cursor: "default" }
|
|
5438
5712
|
}
|
|
5439
5713
|
);
|
|
5440
|
-
const
|
|
5714
|
+
const v = {
|
|
5441
5715
|
entity: this.entity,
|
|
5442
5716
|
label: this.labelEntity,
|
|
5443
5717
|
positions: this.positions,
|
|
5444
|
-
distance:
|
|
5718
|
+
distance: m,
|
|
5445
5719
|
clear: () => this.clear()
|
|
5446
5720
|
};
|
|
5447
|
-
(l = t.onComplete) == null || l.call(t,
|
|
5721
|
+
(l = t.onComplete) == null || l.call(t, v);
|
|
5448
5722
|
}
|
|
5449
5723
|
}, e.ScreenSpaceEventType.LEFT_CLICK), this.handler.setInputAction((n) => {
|
|
5450
|
-
var
|
|
5724
|
+
var p, m;
|
|
5451
5725
|
if (this.positions.length !== 1) return;
|
|
5452
5726
|
const s = i.scene.pickPosition(n.endPosition);
|
|
5453
5727
|
if (!s) return;
|
|
@@ -5469,7 +5743,7 @@ class yt {
|
|
|
5469
5743
|
style: { pointerEvents: "none", userSelect: "none", cursor: "default" }
|
|
5470
5744
|
}
|
|
5471
5745
|
);
|
|
5472
|
-
const u = t.lineColor || t.color || e.Color.YELLOW, g = ((
|
|
5746
|
+
const u = t.lineColor || t.color || e.Color.YELLOW, g = ((m = (p = t.dashLineColor || t.lineColor || t.color || e.Color.RED).withAlpha) == null ? void 0 : m.call(p, 0.9)) || e.Color.RED;
|
|
5473
5747
|
this.previewEntity || (this.previewEntity = i.entities.add({
|
|
5474
5748
|
polyline: {
|
|
5475
5749
|
positions: new e.CallbackProperty(() => !this.previewPos || !this.positions.length ? [] : [this.positions[0], this.previewPos], !1),
|
|
@@ -5496,10 +5770,10 @@ class yt {
|
|
|
5496
5770
|
if (l.length) {
|
|
5497
5771
|
if (!this.htmlLabelPool) {
|
|
5498
5772
|
const g = s.overlayContainerId || "html-label-container";
|
|
5499
|
-
this.htmlLabelPool = e || new
|
|
5500
|
-
createElement: (
|
|
5773
|
+
this.htmlLabelPool = e || new G(i, n, g), this.htmlLabelPool.registerTheme("measure-space", {
|
|
5774
|
+
createElement: (p, m) => {
|
|
5501
5775
|
var f;
|
|
5502
|
-
|
|
5776
|
+
p.innerHTML = String(((f = m == null ? void 0 : m.data) == null ? void 0 : f.text) || ""), p.style.background = "rgba(0,0,0,0.6)", p.style.color = "#fff", p.style.font = "14px sans-serif", p.style.padding = "4px 6px", p.style.borderRadius = "4px", p.style.whiteSpace = "pre";
|
|
5503
5777
|
},
|
|
5504
5778
|
options: { offset: { x: 0, y: -10 } }
|
|
5505
5779
|
});
|
|
@@ -5518,12 +5792,12 @@ class yt {
|
|
|
5518
5792
|
depthFailMaterial: new i.PolylineDashMaterialProperty({ color: r, dashLength: 12, dashPattern: 255 })
|
|
5519
5793
|
}
|
|
5520
5794
|
});
|
|
5521
|
-
const
|
|
5522
|
-
this.htmlLabelId = f, this.htmlLabelPool.add({ text: `${
|
|
5795
|
+
const p = i.Cartesian3.distance(l[0], l[1]), m = i.Cartographic.fromCartesian(l[1]), f = t.id + "_label";
|
|
5796
|
+
this.htmlLabelId = f, this.htmlLabelPool.add({ text: `${p.toFixed(2)} m` }, {
|
|
5523
5797
|
id: f,
|
|
5524
|
-
lon: i.Math.toDegrees(
|
|
5525
|
-
lat: i.Math.toDegrees(
|
|
5526
|
-
height:
|
|
5798
|
+
lon: i.Math.toDegrees(m.longitude),
|
|
5799
|
+
lat: i.Math.toDegrees(m.latitude),
|
|
5800
|
+
height: m.height || 0,
|
|
5527
5801
|
theme: "measure-space",
|
|
5528
5802
|
show: !0,
|
|
5529
5803
|
style: { pointerEvents: "none", userSelect: "none", cursor: "default" }
|
|
@@ -5532,7 +5806,7 @@ class yt {
|
|
|
5532
5806
|
}
|
|
5533
5807
|
}
|
|
5534
5808
|
}
|
|
5535
|
-
const
|
|
5809
|
+
const $e = class $e {
|
|
5536
5810
|
constructor(t, e) {
|
|
5537
5811
|
c(this, "Cesium");
|
|
5538
5812
|
c(this, "viewer");
|
|
@@ -5563,7 +5837,7 @@ const Re = class Re {
|
|
|
5563
5837
|
const e = this.Cesium, i = this.viewer;
|
|
5564
5838
|
if (!this.htmlLabelPool) {
|
|
5565
5839
|
const n = t.overlayContainerId || "html-label-container";
|
|
5566
|
-
this.htmlLabelPool = new
|
|
5840
|
+
this.htmlLabelPool = new G(e, i, n), this.htmlLabelPool.registerTheme("measure-area", {
|
|
5567
5841
|
createElement: (s, o) => {
|
|
5568
5842
|
var r;
|
|
5569
5843
|
s.innerHTML = String(((r = o == null ? void 0 : o.data) == null ? void 0 : r.text) || ""), s.style.background = "rgba(0,0,0,0.6)", s.style.color = "#fff", s.style.font = "14px sans-serif", s.style.padding = "4px 6px", s.style.borderRadius = "4px", s.style.whiteSpace = "pre";
|
|
@@ -5583,8 +5857,8 @@ const Re = class Re {
|
|
|
5583
5857
|
options: { offset: { x: 0, y: -10 } }
|
|
5584
5858
|
});
|
|
5585
5859
|
}
|
|
5586
|
-
this.tooltip = new ce(), this.tooltip.show(
|
|
5587
|
-
var g,
|
|
5860
|
+
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) => {
|
|
5861
|
+
var g, p;
|
|
5588
5862
|
const s = i.scene.pickPosition(n.position);
|
|
5589
5863
|
if (!s) return;
|
|
5590
5864
|
this.positions.push(s);
|
|
@@ -5617,18 +5891,18 @@ const Re = class Re {
|
|
|
5617
5891
|
})
|
|
5618
5892
|
}), i.scene.primitives.add(this.primitive), this.positions.length >= 2) {
|
|
5619
5893
|
if (this.edgeEntities.length) {
|
|
5620
|
-
for (const
|
|
5894
|
+
for (const v of this.edgeEntities)
|
|
5621
5895
|
try {
|
|
5622
|
-
i.entities.remove(
|
|
5896
|
+
i.entities.remove(v);
|
|
5623
5897
|
} catch {
|
|
5624
5898
|
}
|
|
5625
5899
|
this.edgeEntities = [];
|
|
5626
5900
|
}
|
|
5627
|
-
const
|
|
5901
|
+
const m = t.lineColor || t.color || e.Color.YELLOW, f = ((p = (g = t.dashLineColor || t.lineColor || t.color || e.Color.RED).withAlpha) == null ? void 0 : p.call(g, 0.9)) || e.Color.RED, y = this.positions.concat([this.positions[0]]), w = i.entities.add({
|
|
5628
5902
|
polyline: {
|
|
5629
5903
|
positions: y,
|
|
5630
5904
|
width: t.width || 2,
|
|
5631
|
-
material:
|
|
5905
|
+
material: m,
|
|
5632
5906
|
clampToGround: !1,
|
|
5633
5907
|
arcType: e.ArcType.NONE,
|
|
5634
5908
|
depthFailMaterial: new e.PolylineDashMaterialProperty({
|
|
@@ -5638,30 +5912,30 @@ const Re = class Re {
|
|
|
5638
5912
|
})
|
|
5639
5913
|
}
|
|
5640
5914
|
});
|
|
5641
|
-
this.edgeEntities.push(
|
|
5915
|
+
this.edgeEntities.push(w);
|
|
5642
5916
|
}
|
|
5643
5917
|
}, e.ScreenSpaceEventType.LEFT_CLICK), this.handler.setInputAction((n) => {
|
|
5644
|
-
var
|
|
5918
|
+
var m, f;
|
|
5645
5919
|
if (this.positions.length === 0) return;
|
|
5646
5920
|
const s = i.scene.pickPosition(n.endPosition);
|
|
5647
5921
|
if (!s) return;
|
|
5648
5922
|
this.previewPos = s;
|
|
5649
5923
|
const o = this.positions.concat([s]), r = new e.Cartesian3(
|
|
5650
|
-
o.reduce((y,
|
|
5651
|
-
o.reduce((y,
|
|
5652
|
-
o.reduce((y,
|
|
5924
|
+
o.reduce((y, w) => y + w.x, 0) / o.length,
|
|
5925
|
+
o.reduce((y, w) => y + w.y, 0) / o.length,
|
|
5926
|
+
o.reduce((y, w) => y + w.z, 0) / o.length
|
|
5653
5927
|
), l = new e.EllipsoidTangentPlane(r, e.Ellipsoid.WGS84).projectPointsOntoPlane(o);
|
|
5654
5928
|
let d = 0;
|
|
5655
5929
|
for (let y = 0; y < l.length; y++) {
|
|
5656
|
-
const
|
|
5657
|
-
d += l[y].x * l[
|
|
5930
|
+
const w = (y + 1) % l.length;
|
|
5931
|
+
d += l[y].x * l[w].y - l[w].x * l[y].y;
|
|
5658
5932
|
}
|
|
5659
5933
|
d = Math.abs(d) / 2;
|
|
5660
5934
|
const u = e.Cartographic.fromCartesian(r), g = this.previewLabelId || "measure_area_preview";
|
|
5661
5935
|
this.previewLabelId = g;
|
|
5662
|
-
const
|
|
5936
|
+
const p = t.labelText || { area: "面积" };
|
|
5663
5937
|
if (this.htmlLabelPool.add(
|
|
5664
|
-
{ text: `${
|
|
5938
|
+
{ text: `${p.area}:${d.toFixed(2)} m²` },
|
|
5665
5939
|
{
|
|
5666
5940
|
id: g,
|
|
5667
5941
|
lon: e.Math.toDegrees(u.longitude),
|
|
@@ -5684,16 +5958,16 @@ const Re = class Re {
|
|
|
5684
5958
|
arcType: e.ArcType.NONE
|
|
5685
5959
|
}
|
|
5686
5960
|
});
|
|
5687
|
-
const
|
|
5961
|
+
const w = t.lineColor || t.color || e.Color.YELLOW, v = ((f = (m = t.dashLineColor || t.lineColor || t.color || e.Color.RED).withAlpha) == null ? void 0 : f.call(m, 0.9)) || e.Color.RED;
|
|
5688
5962
|
this.previewEdgeEntity = i.entities.add({
|
|
5689
5963
|
polyline: {
|
|
5690
5964
|
positions: new e.CallbackProperty(() => !this.previewPos || !this.positions.length ? [] : this.positions.concat([this.previewPos, this.positions[0]]), !1),
|
|
5691
5965
|
width: t.width || 2,
|
|
5692
|
-
material:
|
|
5966
|
+
material: w,
|
|
5693
5967
|
clampToGround: !1,
|
|
5694
5968
|
arcType: e.ArcType.NONE,
|
|
5695
5969
|
depthFailMaterial: new e.PolylineDashMaterialProperty({
|
|
5696
|
-
color:
|
|
5970
|
+
color: v,
|
|
5697
5971
|
dashLength: 12,
|
|
5698
5972
|
dashPattern: 255
|
|
5699
5973
|
})
|
|
@@ -5786,9 +6060,9 @@ const Re = class Re {
|
|
|
5786
6060
|
closed: !0
|
|
5787
6061
|
})
|
|
5788
6062
|
}), i.scene.primitives.add(this.primitive), this.positions.length >= 2) {
|
|
5789
|
-
const u = 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,
|
|
6063
|
+
const u = 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, p = this.positions.concat([this.positions[0]]), m = i.entities.add({
|
|
5790
6064
|
polyline: {
|
|
5791
|
-
positions:
|
|
6065
|
+
positions: p,
|
|
5792
6066
|
width: t.width || 2,
|
|
5793
6067
|
material: u,
|
|
5794
6068
|
clampToGround: !1,
|
|
@@ -5800,7 +6074,7 @@ const Re = class Re {
|
|
|
5800
6074
|
})
|
|
5801
6075
|
}
|
|
5802
6076
|
});
|
|
5803
|
-
this.edgeEntities.push(
|
|
6077
|
+
this.edgeEntities.push(m);
|
|
5804
6078
|
}
|
|
5805
6079
|
}
|
|
5806
6080
|
_undoLastPoint(t, e, i) {
|
|
@@ -5810,11 +6084,11 @@ const Re = class Re {
|
|
|
5810
6084
|
n && i.entities.remove(n), this._clearPreviewState(), this._rebuildShape(t, e, i);
|
|
5811
6085
|
}
|
|
5812
6086
|
_finishMeasurement(t, e, i) {
|
|
5813
|
-
var
|
|
6087
|
+
var p;
|
|
5814
6088
|
if (i && this.positions.length >= 3) {
|
|
5815
6089
|
this.positions.pop();
|
|
5816
|
-
const
|
|
5817
|
-
|
|
6090
|
+
const m = this.tempPoints.pop();
|
|
6091
|
+
m && this.viewer.entities.remove(m);
|
|
5818
6092
|
}
|
|
5819
6093
|
if (this.positions.length < 3) {
|
|
5820
6094
|
this.clear();
|
|
@@ -5822,14 +6096,14 @@ const Re = class Re {
|
|
|
5822
6096
|
}
|
|
5823
6097
|
this._clearPreviewState(), this.stop();
|
|
5824
6098
|
const n = new e.Cartesian3(
|
|
5825
|
-
this.positions.reduce((
|
|
5826
|
-
this.positions.reduce((
|
|
5827
|
-
this.positions.reduce((
|
|
6099
|
+
this.positions.reduce((m, f) => m + f.x, 0) / this.positions.length,
|
|
6100
|
+
this.positions.reduce((m, f) => m + f.y, 0) / this.positions.length,
|
|
6101
|
+
this.positions.reduce((m, f) => m + f.z, 0) / this.positions.length
|
|
5828
6102
|
), o = new e.EllipsoidTangentPlane(n, e.Ellipsoid.WGS84).projectPointsOntoPlane(this.positions);
|
|
5829
6103
|
let r = 0;
|
|
5830
|
-
for (let
|
|
5831
|
-
const f = (
|
|
5832
|
-
r += o[
|
|
6104
|
+
for (let m = 0; m < o.length; m++) {
|
|
6105
|
+
const f = (m + 1) % o.length;
|
|
6106
|
+
r += o[m].x * o[f].y - o[f].x * o[m].y;
|
|
5833
6107
|
}
|
|
5834
6108
|
r = Math.abs(r) / 2;
|
|
5835
6109
|
const a = e.Cartographic.fromCartesian(n), l = this.htmlLabelId || `measure_area_${Date.now()}`;
|
|
@@ -5846,25 +6120,25 @@ const Re = class Re {
|
|
|
5846
6120
|
show: !0
|
|
5847
6121
|
}
|
|
5848
6122
|
), this.labelEntity = this.htmlLabelId;
|
|
5849
|
-
for (let
|
|
5850
|
-
const f = (
|
|
6123
|
+
for (let m = 0; m < this.positions.length; m++) {
|
|
6124
|
+
const f = (m + 1) % this.positions.length, y = this.positions[m], 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()}_${m}`;
|
|
5851
6125
|
this.segmentLabelIds.push(M), this.htmlLabelPool.add(
|
|
5852
6126
|
{ text: `${d.side}:${C.toFixed(2)} m` },
|
|
5853
6127
|
{
|
|
5854
6128
|
id: M,
|
|
5855
|
-
lon: e.Math.toDegrees(
|
|
5856
|
-
lat: e.Math.toDegrees(
|
|
5857
|
-
height:
|
|
6129
|
+
lon: e.Math.toDegrees(E.longitude),
|
|
6130
|
+
lat: e.Math.toDegrees(E.latitude),
|
|
6131
|
+
height: E.height || 0,
|
|
5858
6132
|
theme: "measure-area-seg",
|
|
5859
6133
|
show: !0
|
|
5860
6134
|
}
|
|
5861
6135
|
);
|
|
5862
6136
|
}
|
|
5863
6137
|
const u = o;
|
|
5864
|
-
for (let
|
|
5865
|
-
const f = u[(
|
|
5866
|
-
if (!
|
|
5867
|
-
const M =
|
|
6138
|
+
for (let m = 0; m < u.length; m++) {
|
|
6139
|
+
const f = u[(m - 1 + u.length) % u.length], y = u[m], w = u[(m + 1) % u.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
|
+
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[m]), D = `measure_area_angle_${Date.now()}_${m}`;
|
|
5868
6142
|
this.angleLabelIds.push(D), this.htmlLabelPool.add(
|
|
5869
6143
|
{ text: `${d.angle}:${x.toFixed(2)} °` },
|
|
5870
6144
|
{
|
|
@@ -5884,7 +6158,7 @@ const Re = class Re {
|
|
|
5884
6158
|
area: r,
|
|
5885
6159
|
clear: () => this.clear()
|
|
5886
6160
|
};
|
|
5887
|
-
(
|
|
6161
|
+
(p = t.onComplete) == null || p.call(t, g);
|
|
5888
6162
|
}
|
|
5889
6163
|
_bindGlobalEvents(t, e, i) {
|
|
5890
6164
|
this.keydownHandler = (n) => {
|
|
@@ -5898,45 +6172,45 @@ const Re = class Re {
|
|
|
5898
6172
|
if (o.length < 3) return;
|
|
5899
6173
|
if (!this.htmlLabelPool) {
|
|
5900
6174
|
const C = s.overlayContainerId || "html-label-container";
|
|
5901
|
-
this.htmlLabelPool = e || new
|
|
5902
|
-
createElement: (
|
|
6175
|
+
this.htmlLabelPool = e || new G(i, n, C), this.htmlLabelPool.registerTheme("measure-area", {
|
|
6176
|
+
createElement: (L, E) => {
|
|
5903
6177
|
var M;
|
|
5904
|
-
|
|
6178
|
+
L.innerHTML = String(((M = E == null ? void 0 : E.data) == null ? void 0 : M.text) || ""), L.style.background = "rgba(0,0,0,0.6)", L.style.color = "#fff", L.style.font = "14px sans-serif", L.style.padding = "4px 6px", L.style.borderRadius = "4px", L.style.whiteSpace = "pre";
|
|
5905
6179
|
},
|
|
5906
6180
|
options: { offset: { x: 0, y: -10 } }
|
|
5907
6181
|
}), this.htmlLabelPool.registerTheme("measure-area-seg", {
|
|
5908
|
-
createElement: (
|
|
6182
|
+
createElement: (L, E) => {
|
|
5909
6183
|
var M;
|
|
5910
|
-
|
|
6184
|
+
L.innerHTML = String(((M = E == null ? void 0 : E.data) == null ? void 0 : M.text) || ""), L.style.background = "rgba(0,0,0,0.6)", L.style.color = "#fff", L.style.font = "14px sans-serif", L.style.padding = "4px 6px", L.style.borderRadius = "4px", L.style.whiteSpace = "pre";
|
|
5911
6185
|
},
|
|
5912
6186
|
options: { offset: { x: 0, y: -10 } }
|
|
5913
6187
|
}), this.htmlLabelPool.registerTheme("measure-area-angle", {
|
|
5914
|
-
createElement: (
|
|
6188
|
+
createElement: (L, E) => {
|
|
5915
6189
|
var M;
|
|
5916
|
-
|
|
6190
|
+
L.innerHTML = String(((M = E == null ? void 0 : E.data) == null ? void 0 : M.text) || ""), L.style.background = "rgba(0,0,0,0.6)", L.style.color = "#fff", L.style.font = "14px sans-serif", L.style.padding = "4px 6px", L.style.borderRadius = "4px", L.style.whiteSpace = "pre";
|
|
5917
6191
|
},
|
|
5918
6192
|
options: { offset: { x: 0, y: -10 } }
|
|
5919
6193
|
});
|
|
5920
6194
|
}
|
|
5921
6195
|
for (const C of o) {
|
|
5922
|
-
const
|
|
5923
|
-
this.tempPoints.push(
|
|
6196
|
+
const L = n.entities.add({ position: C, point: { pixelSize: 8, color: s.color || i.Color.YELLOW, disableDepthTestDistance: Number.POSITIVE_INFINITY } });
|
|
6197
|
+
this.tempPoints.push(L);
|
|
5924
6198
|
}
|
|
5925
6199
|
const r = new i.Cartesian3(
|
|
5926
|
-
o.reduce((C,
|
|
5927
|
-
o.reduce((C,
|
|
5928
|
-
o.reduce((C,
|
|
6200
|
+
o.reduce((C, L) => C + L.x, 0) / o.length,
|
|
6201
|
+
o.reduce((C, L) => C + L.y, 0) / o.length,
|
|
6202
|
+
o.reduce((C, L) => C + L.z, 0) / o.length
|
|
5929
6203
|
), l = new i.EllipsoidTangentPlane(r, i.Ellipsoid.WGS84).projectPointsOntoPlane(o);
|
|
5930
6204
|
let d = 0;
|
|
5931
6205
|
for (let C = 0; C < l.length; C++) {
|
|
5932
|
-
const
|
|
5933
|
-
d += l[C].x * l[
|
|
6206
|
+
const L = (C + 1) % l.length;
|
|
6207
|
+
d += l[C].x * l[L].y - l[L].x * l[C].y;
|
|
5934
6208
|
}
|
|
5935
6209
|
d = Math.abs(d) / 2;
|
|
5936
6210
|
const u = i.Cartographic.fromCartesian(r), g = t.id + "_area";
|
|
5937
6211
|
this.htmlLabelId = g;
|
|
5938
|
-
const
|
|
5939
|
-
this.htmlLabelPool.add({ text: `${
|
|
6212
|
+
const p = s.labelText || { area: "面积", side: "边长", angle: "角度" };
|
|
6213
|
+
this.htmlLabelPool.add({ text: `${p.area}:${d.toFixed(2)} m²` }, {
|
|
5940
6214
|
id: g,
|
|
5941
6215
|
lon: i.Math.toDegrees(u.longitude),
|
|
5942
6216
|
lat: i.Math.toDegrees(u.latitude),
|
|
@@ -5944,27 +6218,27 @@ const Re = class Re {
|
|
|
5944
6218
|
theme: "measure-area",
|
|
5945
6219
|
show: !0
|
|
5946
6220
|
});
|
|
5947
|
-
const
|
|
6221
|
+
const m = new i.PolygonHierarchy(o), f = new i.PolygonGeometry({ polygonHierarchy: m, 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({
|
|
5948
6222
|
geometryInstances: y,
|
|
5949
|
-
appearance: new i.MaterialAppearance({ material: i.Material.fromType("Color", { color:
|
|
5950
|
-
depthFailAppearance: new i.MaterialAppearance({ material: i.Material.fromType("Color", { color:
|
|
6223
|
+
appearance: new i.MaterialAppearance({ material: i.Material.fromType("Color", { color: w }), translucent: !0, closed: !0 }),
|
|
6224
|
+
depthFailAppearance: new i.MaterialAppearance({ material: i.Material.fromType("Color", { color: v }), translucent: !0, closed: !0 })
|
|
5951
6225
|
});
|
|
5952
6226
|
n.scene.primitives.add(P), this.primitive = P;
|
|
5953
6227
|
for (let C = 0; C < o.length; C++) {
|
|
5954
|
-
const
|
|
5955
|
-
this.segmentLabelIds.push(k), this.htmlLabelPool.add({ text: `${
|
|
6228
|
+
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: `${p.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 });
|
|
5956
6230
|
}
|
|
5957
6231
|
const b = l;
|
|
5958
6232
|
for (let C = 0; C < b.length; C++) {
|
|
5959
|
-
const
|
|
6233
|
+
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);
|
|
5960
6234
|
if (!S || !_) continue;
|
|
5961
|
-
const k = x / S * (D / _) + I / S * (T / _), A = Math.acos(Math.min(1, Math.max(-1, k))) * (180 / Math.PI),
|
|
5962
|
-
this.angleLabelIds.push(
|
|
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]), H = t.id + `_area_angle_${C}`;
|
|
6236
|
+
this.angleLabelIds.push(H), this.htmlLabelPool.add({ text: `${p.angle}:${A.toFixed(2)} °` }, { id: H, lon: i.Math.toDegrees(R.longitude), lat: i.Math.toDegrees(R.latitude), height: R.height || 0, theme: "measure-area-angle", show: !0 });
|
|
5963
6237
|
}
|
|
5964
6238
|
}
|
|
5965
6239
|
};
|
|
5966
|
-
c(
|
|
5967
|
-
let Ae =
|
|
6240
|
+
c($e, "TIP_TEXT", "单击左键添加点,右键撤销,双击左键或Esc结束");
|
|
6241
|
+
let Ae = $e;
|
|
5968
6242
|
class wt {
|
|
5969
6243
|
constructor(t, e) {
|
|
5970
6244
|
c(this, "Cesium");
|
|
@@ -5987,7 +6261,7 @@ class wt {
|
|
|
5987
6261
|
const e = this.Cesium, i = this.viewer;
|
|
5988
6262
|
if (!this.htmlLabelPool) {
|
|
5989
6263
|
const n = t.overlayContainerId || "html-label-container";
|
|
5990
|
-
this.htmlLabelPool = new
|
|
6264
|
+
this.htmlLabelPool = new G(e, i, n), this.htmlLabelPool.registerTheme("measure-circle", {
|
|
5991
6265
|
createElement: (s, o) => {
|
|
5992
6266
|
var a;
|
|
5993
6267
|
const r = ((a = o == null ? void 0 : o.data) == null ? void 0 : a.text) || "";
|
|
@@ -6001,11 +6275,11 @@ class wt {
|
|
|
6001
6275
|
const s = i.scene.pickPosition(n.position);
|
|
6002
6276
|
if (s && (this.positions.push(s), this.positions.length === 2)) {
|
|
6003
6277
|
this.stop();
|
|
6004
|
-
const r = this.positions[0], a = this.positions[1], l = e.Cartesian3.distance(r, a), d = Math.PI * l * l, u = 2 * Math.PI * l, g = t.labelText || { radius: "半径", area: "面积", circumference: "周长" },
|
|
6005
|
-
this.labelEntity ? (this.labelEntity.position =
|
|
6278
|
+
const r = this.positions[0], a = this.positions[1], l = e.Cartesian3.distance(r, a), d = Math.PI * l * l, u = 2 * Math.PI * l, g = t.labelText || { radius: "半径", area: "面积", circumference: "周长" }, p = r;
|
|
6279
|
+
this.labelEntity ? (this.labelEntity.position = p, this.labelEntity.label.text = `${g.radius}:${l.toFixed(2)} m
|
|
6006
6280
|
${g.area}:${d.toFixed(2)} m²
|
|
6007
6281
|
${g.circumference}:${u.toFixed(2)} m`) : this.labelEntity = i.entities.add({
|
|
6008
|
-
position:
|
|
6282
|
+
position: p,
|
|
6009
6283
|
label: {
|
|
6010
6284
|
text: `${g.radius}:${l.toFixed(2)} m
|
|
6011
6285
|
${g.area}:${d.toFixed(2)} m²
|
|
@@ -6024,32 +6298,32 @@ ${g.circumference}:${u.toFixed(2)} m`,
|
|
|
6024
6298
|
show: !1
|
|
6025
6299
|
}
|
|
6026
6300
|
}), this.previewEntity && (i.entities.remove(this.previewEntity), this.previewEntity = null);
|
|
6027
|
-
const
|
|
6301
|
+
const m = e.Cartographic.fromCartesian(r), f = new e.EllipseGeometry({
|
|
6028
6302
|
center: r,
|
|
6029
6303
|
semiMajorAxis: l,
|
|
6030
6304
|
semiMinorAxis: l,
|
|
6031
|
-
height:
|
|
6305
|
+
height: m.height || 0,
|
|
6032
6306
|
vertexFormat: e.MaterialAppearance.VERTEX_FORMAT
|
|
6033
|
-
}), y = new e.GeometryInstance({ geometry: f }),
|
|
6307
|
+
}), 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);
|
|
6034
6308
|
this.ellipsePrimitive && (i.scene.primitives.remove(this.ellipsePrimitive), this.ellipsePrimitive = null), this.ellipsePrimitive = new e.Primitive({
|
|
6035
6309
|
geometryInstances: y,
|
|
6036
6310
|
appearance: new e.MaterialAppearance({
|
|
6037
|
-
material: e.Material.fromType("Color", { color:
|
|
6311
|
+
material: e.Material.fromType("Color", { color: w }),
|
|
6038
6312
|
translucent: !0,
|
|
6039
6313
|
closed: !0
|
|
6040
6314
|
}),
|
|
6041
6315
|
depthFailAppearance: new e.MaterialAppearance({
|
|
6042
|
-
material: e.Material.fromType("Color", { color:
|
|
6316
|
+
material: e.Material.fromType("Color", { color: v }),
|
|
6043
6317
|
translucent: !0,
|
|
6044
6318
|
closed: !0
|
|
6045
6319
|
})
|
|
6046
6320
|
}), i.scene.primitives.add(this.ellipsePrimitive), this.entity = this.ellipsePrimitive, this.isPrimitive = !0;
|
|
6047
|
-
const P = e.Cartographic.fromCartesian(r), b = e.Math.toDegrees(P.longitude), C = e.Math.toDegrees(P.latitude),
|
|
6048
|
-
this.htmlLabelId =
|
|
6321
|
+
const P = e.Cartographic.fromCartesian(r), b = e.Math.toDegrees(P.longitude), C = e.Math.toDegrees(P.latitude), L = P.height || 0, E = this.htmlLabelId || `measure_circle_${Date.now()}`;
|
|
6322
|
+
this.htmlLabelId = E;
|
|
6049
6323
|
const M = `${g.radius}:${l.toFixed(2)} m
|
|
6050
6324
|
${g.area}:${d.toFixed(2)} m²
|
|
6051
6325
|
${g.circumference}:${u.toFixed(2)} m`;
|
|
6052
|
-
this.htmlLabelPool.add({ text: M }, { id:
|
|
6326
|
+
this.htmlLabelPool.add({ text: M }, { id: E, lon: b, lat: C, height: L, theme: "measure-circle", show: !0 });
|
|
6053
6327
|
const x = {
|
|
6054
6328
|
entity: this.entity,
|
|
6055
6329
|
label: this.labelEntity,
|
|
@@ -6067,11 +6341,11 @@ ${g.circumference}:${u.toFixed(2)} m`;
|
|
|
6067
6341
|
if (!r) return;
|
|
6068
6342
|
const a = e.Cartesian3.distance(s, r);
|
|
6069
6343
|
this.currentRadius = a;
|
|
6070
|
-
const l = e.Cartographic.fromCartesian(s), d = Math.PI * a * a, u = 2 * Math.PI * a, g = t.labelText || { radius: "半径", area: "面积", circumference: "周长" },
|
|
6071
|
-
this.labelEntity ? (this.labelEntity.position =
|
|
6344
|
+
const l = e.Cartographic.fromCartesian(s), d = Math.PI * a * a, u = 2 * Math.PI * a, g = t.labelText || { radius: "半径", area: "面积", circumference: "周长" }, p = s;
|
|
6345
|
+
this.labelEntity ? (this.labelEntity.position = p, this.labelEntity.label.text = `${g.radius}:${a.toFixed(2)} m
|
|
6072
6346
|
${g.area}:${d.toFixed(2)} m²
|
|
6073
6347
|
${g.circumference}:${u.toFixed(2)} m`) : this.labelEntity = i.entities.add({
|
|
6074
|
-
position:
|
|
6348
|
+
position: p,
|
|
6075
6349
|
label: {
|
|
6076
6350
|
text: `${g.radius}:${a.toFixed(2)} m
|
|
6077
6351
|
${g.area}:${d.toFixed(2)} m²
|
|
@@ -6090,12 +6364,12 @@ ${g.circumference}:${u.toFixed(2)} m`,
|
|
|
6090
6364
|
show: !1
|
|
6091
6365
|
}
|
|
6092
6366
|
});
|
|
6093
|
-
const
|
|
6094
|
-
this.htmlLabelId =
|
|
6367
|
+
const m = e.Cartographic.fromCartesian(s), f = e.Math.toDegrees(m.longitude), y = e.Math.toDegrees(m.latitude), w = m.height || 0, v = this.htmlLabelId || `measure_circle_${Date.now()}`;
|
|
6368
|
+
this.htmlLabelId = v;
|
|
6095
6369
|
const P = `${g.radius}:${a.toFixed(2)} m
|
|
6096
6370
|
${g.area}:${d.toFixed(2)} m²
|
|
6097
6371
|
${g.circumference}:${u.toFixed(2)} m`;
|
|
6098
|
-
if (this.htmlLabelPool.add({ text: P }, { id:
|
|
6372
|
+
if (this.htmlLabelPool.add({ text: P }, { id: v, lon: f, lat: y, height: w, theme: "measure-circle", show: !0 }), !this.previewEntity) {
|
|
6099
6373
|
const b = t.color || e.Color.YELLOW.withAlpha(0.5);
|
|
6100
6374
|
this.previewEntity = i.entities.add({
|
|
6101
6375
|
position: s,
|
|
@@ -6116,34 +6390,34 @@ ${g.circumference}:${u.toFixed(2)} m`;
|
|
|
6116
6390
|
this.stop(), this.entity && (this.isPrimitive ? this.viewer.scene.primitives.remove(this.entity) : this.viewer.entities.remove(this.entity), this.entity = null, this.isPrimitive = !1), this.previewEntity && (this.viewer.entities.remove(this.previewEntity), this.previewEntity = null), this.labelEntity && (this.viewer.entities.remove(this.labelEntity), this.labelEntity = null), this.previewLabel && (this.viewer.entities.remove(this.previewLabel), this.previewLabel = null), this.ellipsePrimitive && (this.viewer.scene.primitives.remove(this.ellipsePrimitive), this.ellipsePrimitive = null), this.htmlLabelPool && this.htmlLabelId && (this.htmlLabelPool.removeByIds([this.htmlLabelId]), this.htmlLabelId = null), this.positions = [], this.currentRadius = 0;
|
|
6117
6391
|
}
|
|
6118
6392
|
rehydrate(t, e) {
|
|
6119
|
-
const i = this.Cesium, n = this.viewer, s = t.options || {}, o = (t.positions || []).map((
|
|
6393
|
+
const i = this.Cesium, n = this.viewer, s = t.options || {}, o = (t.positions || []).map((L) => new i.Cartesian3(L[0], L[1], L[2]));
|
|
6120
6394
|
if (o.length < 2) return;
|
|
6121
6395
|
if (!this.htmlLabelPool) {
|
|
6122
|
-
const
|
|
6123
|
-
this.htmlLabelPool = e || new
|
|
6124
|
-
createElement: (
|
|
6396
|
+
const L = s.overlayContainerId || "html-label-container";
|
|
6397
|
+
this.htmlLabelPool = e || new G(i, n, L), this.htmlLabelPool.registerTheme("measure-circle", {
|
|
6398
|
+
createElement: (E, M) => {
|
|
6125
6399
|
var I;
|
|
6126
6400
|
const x = ((I = M == null ? void 0 : M.data) == null ? void 0 : I.text) || "";
|
|
6127
|
-
|
|
6401
|
+
E.innerHTML = String(x), E.style.background = "rgba(0,0,0,0.6)", E.style.color = "#fff", E.style.font = "14px sans-serif", E.style.padding = "4px 6px", E.style.borderRadius = "4px", E.style.whiteSpace = "pre";
|
|
6128
6402
|
},
|
|
6129
6403
|
options: { offset: { x: 0, y: -10 } }
|
|
6130
6404
|
});
|
|
6131
6405
|
}
|
|
6132
|
-
const r = o[0], a = o[1], l = i.Cartesian3.distance(r, a), d = Math.PI * l * l, u = 2 * Math.PI * l, g = i.Cartographic.fromCartesian(r),
|
|
6133
|
-
geometryInstances:
|
|
6406
|
+
const r = o[0], a = o[1], l = i.Cartesian3.distance(r, a), d = Math.PI * l * l, u = 2 * Math.PI * l, g = i.Cartographic.fromCartesian(r), p = new i.EllipseGeometry({ center: r, semiMajorAxis: l, semiMinorAxis: l, height: g.height || 0, vertexFormat: i.MaterialAppearance.VERTEX_FORMAT }), m = new i.GeometryInstance({ geometry: p }), 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({
|
|
6407
|
+
geometryInstances: m,
|
|
6134
6408
|
appearance: new i.MaterialAppearance({ material: i.Material.fromType("Color", { color: f }), translucent: !0, closed: !0 }),
|
|
6135
6409
|
depthFailAppearance: new i.MaterialAppearance({ material: i.Material.fromType("Color", { color: y }), translucent: !0, closed: !0 })
|
|
6136
6410
|
});
|
|
6137
|
-
n.scene.primitives.add(
|
|
6138
|
-
const
|
|
6411
|
+
n.scene.primitives.add(w), this.ellipsePrimitive = w, this.entity = w, this.isPrimitive = !0;
|
|
6412
|
+
const v = i.Cartographic.fromCartesian(r), P = t.id + "_circle";
|
|
6139
6413
|
this.htmlLabelId = P;
|
|
6140
6414
|
const b = s.labelText || { radius: "半径", area: "面积", circumference: "周长" }, C = `${b.radius}:${l.toFixed(2)} m
|
|
6141
6415
|
${b.area}:${d.toFixed(2)} m²
|
|
6142
6416
|
${b.circumference}:${u.toFixed(2)} m`;
|
|
6143
|
-
this.htmlLabelPool.add({ text: C }, { id: P, lon: i.Math.toDegrees(
|
|
6417
|
+
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 });
|
|
6144
6418
|
}
|
|
6145
6419
|
}
|
|
6146
|
-
const
|
|
6420
|
+
const He = class He {
|
|
6147
6421
|
constructor(t, e) {
|
|
6148
6422
|
c(this, "Cesium");
|
|
6149
6423
|
c(this, "viewer");
|
|
@@ -6171,7 +6445,7 @@ const Oe = class Oe {
|
|
|
6171
6445
|
const e = this.Cesium, i = this.viewer;
|
|
6172
6446
|
if (!this.htmlLabelPool) {
|
|
6173
6447
|
const n = t.overlayContainerId || "html-label-container";
|
|
6174
|
-
this.htmlLabelPool = new
|
|
6448
|
+
this.htmlLabelPool = new G(e, i, n), this.htmlLabelPool.registerTheme("measure-polyline-total", {
|
|
6175
6449
|
createElement: (s, o) => {
|
|
6176
6450
|
var r;
|
|
6177
6451
|
s.innerHTML = String(((r = o == null ? void 0 : o.data) == null ? void 0 : r.text) || ""), s.style.background = "rgba(0,0,0,0.6)", s.style.color = "#fff", s.style.font = "14px sans-serif", s.style.padding = "4px 6px", s.style.borderRadius = "4px", s.style.whiteSpace = "pre";
|
|
@@ -6185,7 +6459,7 @@ const Oe = class Oe {
|
|
|
6185
6459
|
options: { offset: { x: 0, y: -10 } }
|
|
6186
6460
|
});
|
|
6187
6461
|
}
|
|
6188
|
-
this.tooltip = new ce(), this.tooltip.show(
|
|
6462
|
+
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) => {
|
|
6189
6463
|
var r, a;
|
|
6190
6464
|
const s = i.scene.pickPosition(n.position);
|
|
6191
6465
|
if (!s) return;
|
|
@@ -6210,15 +6484,15 @@ const Oe = class Oe {
|
|
|
6210
6484
|
})
|
|
6211
6485
|
}
|
|
6212
6486
|
}), this.positions.length >= 2) {
|
|
6213
|
-
const l = this.positions[this.positions.length - 2], d = this.positions[this.positions.length - 1], u = e.Cartographic.fromCartesian(l), g = e.Cartographic.fromCartesian(d),
|
|
6487
|
+
const l = this.positions[this.positions.length - 2], d = this.positions[this.positions.length - 1], u = e.Cartographic.fromCartesian(l), g = e.Cartographic.fromCartesian(d), m = new e.EllipsoidGeodesic(u, g).surfaceDistance, f = new e.Cartesian3(
|
|
6214
6488
|
(l.x + d.x) / 2,
|
|
6215
6489
|
(l.y + d.y) / 2,
|
|
6216
6490
|
(l.z + d.z) / 2
|
|
6217
|
-
), y = e.Cartographic.fromCartesian(f),
|
|
6218
|
-
this.segmentLabelIds.push(
|
|
6219
|
-
{ text: `${
|
|
6491
|
+
), y = e.Cartographic.fromCartesian(f), w = `measure_polyline_seg_${this.segmentLabelIds.length}_${Date.now()}`;
|
|
6492
|
+
this.segmentLabelIds.push(w), this.htmlLabelPool.add(
|
|
6493
|
+
{ text: `${m.toFixed(2)} m` },
|
|
6220
6494
|
{
|
|
6221
|
-
id:
|
|
6495
|
+
id: w,
|
|
6222
6496
|
lon: e.Math.toDegrees(y.longitude),
|
|
6223
6497
|
lat: e.Math.toDegrees(y.latitude),
|
|
6224
6498
|
height: y.height || 0,
|
|
@@ -6232,7 +6506,7 @@ const Oe = class Oe {
|
|
|
6232
6506
|
}, e.ScreenSpaceEventType.LEFT_DOUBLE_CLICK), this.handler.setInputAction(() => {
|
|
6233
6507
|
this._undoLastPoint();
|
|
6234
6508
|
}, e.ScreenSpaceEventType.RIGHT_CLICK), this.handler.setInputAction((n) => {
|
|
6235
|
-
var
|
|
6509
|
+
var m, f;
|
|
6236
6510
|
if (this.positions.length === 0) return;
|
|
6237
6511
|
const s = i.scene.pickPosition(n.endPosition);
|
|
6238
6512
|
if (!s) return;
|
|
@@ -6241,11 +6515,11 @@ const Oe = class Oe {
|
|
|
6241
6515
|
(o.x + s.x) / 2,
|
|
6242
6516
|
(o.y + s.y) / 2,
|
|
6243
6517
|
(o.z + s.z) / 2
|
|
6244
|
-
), g = e.Cartographic.fromCartesian(u),
|
|
6245
|
-
this.previewLabelId =
|
|
6518
|
+
), g = e.Cartographic.fromCartesian(u), p = this.previewLabelId || "measure_polyline_preview";
|
|
6519
|
+
this.previewLabelId = p, this.htmlLabelPool.add(
|
|
6246
6520
|
{ text: `${d.toFixed(2)} m` },
|
|
6247
6521
|
{
|
|
6248
|
-
id:
|
|
6522
|
+
id: p,
|
|
6249
6523
|
lon: e.Math.toDegrees(g.longitude),
|
|
6250
6524
|
lat: e.Math.toDegrees(g.latitude),
|
|
6251
6525
|
height: g.height || 0,
|
|
@@ -6258,7 +6532,7 @@ const Oe = class Oe {
|
|
|
6258
6532
|
width: t.width || 3,
|
|
6259
6533
|
material: t.lineColor || t.color || e.Color.YELLOW,
|
|
6260
6534
|
depthFailMaterial: new e.PolylineDashMaterialProperty({
|
|
6261
|
-
color: ((f = (
|
|
6535
|
+
color: ((f = (m = t.dashLineColor || t.lineColor || t.color || e.Color.RED).withAlpha) == null ? void 0 : f.call(m, 0.9)) || e.Color.RED,
|
|
6262
6536
|
dashLength: 12,
|
|
6263
6537
|
dashPattern: 255
|
|
6264
6538
|
})
|
|
@@ -6306,7 +6580,7 @@ const Oe = class Oe {
|
|
|
6306
6580
|
this.stop(), this._clearPreviewState();
|
|
6307
6581
|
let n = 0;
|
|
6308
6582
|
for (let d = 1; d < this.positions.length; d++) {
|
|
6309
|
-
const u = this.positions[d - 1], g = this.positions[d],
|
|
6583
|
+
const u = this.positions[d - 1], g = this.positions[d], p = e.Cartographic.fromCartesian(u), m = e.Cartographic.fromCartesian(g), f = new e.EllipsoidGeodesic(p, m);
|
|
6310
6584
|
n += f.surfaceDistance;
|
|
6311
6585
|
}
|
|
6312
6586
|
const s = this.positions[this.positions.length - 1];
|
|
@@ -6341,48 +6615,48 @@ const Oe = class Oe {
|
|
|
6341
6615
|
}, i.canvas.addEventListener("contextmenu", this.contextMenuHandler);
|
|
6342
6616
|
}
|
|
6343
6617
|
rehydrate(t, e) {
|
|
6344
|
-
var
|
|
6345
|
-
const i = this.Cesium, n = this.viewer, s = t.options || {}, o = s.lineColor || s.color || i.Color.YELLOW, r = ((f = (
|
|
6618
|
+
var m, f;
|
|
6619
|
+
const i = this.Cesium, n = this.viewer, s = t.options || {}, o = s.lineColor || s.color || i.Color.YELLOW, r = ((f = (m = s.dashLineColor || s.lineColor || s.color || i.Color.RED).withAlpha) == null ? void 0 : f.call(m, 0.9)) || i.Color.RED, a = s.width || 3, l = (t.positions || []).map((y) => new i.Cartesian3(y[0], y[1], y[2]));
|
|
6346
6620
|
if (l.length < 2) return;
|
|
6347
6621
|
if (!this.htmlLabelPool) {
|
|
6348
6622
|
const y = s.overlayContainerId || "html-label-container";
|
|
6349
|
-
this.htmlLabelPool = e || new
|
|
6350
|
-
createElement: (
|
|
6623
|
+
this.htmlLabelPool = e || new G(i, n, y), this.htmlLabelPool.registerTheme("measure-polyline-total", {
|
|
6624
|
+
createElement: (w, v) => {
|
|
6351
6625
|
var P;
|
|
6352
|
-
|
|
6626
|
+
w.innerHTML = String(((P = v == null ? void 0 : v.data) == null ? void 0 : P.text) || ""), w.style.background = "rgba(0,0,0,0.6)", w.style.color = "#fff", w.style.font = "14px sans-serif", w.style.padding = "4px 6px", w.style.borderRadius = "4px", w.style.whiteSpace = "pre";
|
|
6353
6627
|
},
|
|
6354
6628
|
options: { offset: { x: 0, y: -10 } }
|
|
6355
6629
|
}), this.htmlLabelPool.registerTheme("measure-polyline-seg", {
|
|
6356
|
-
createElement: (
|
|
6630
|
+
createElement: (w, v) => {
|
|
6357
6631
|
var P;
|
|
6358
|
-
|
|
6632
|
+
w.innerHTML = String(((P = v == null ? void 0 : v.data) == null ? void 0 : P.text) || ""), w.style.background = "rgba(0,0,0,0.6)", w.style.color = "#fff", w.style.font = "14px sans-serif", w.style.padding = "4px 6px", w.style.borderRadius = "4px", w.style.whiteSpace = "pre";
|
|
6359
6633
|
},
|
|
6360
6634
|
options: { offset: { x: 0, y: -10 } }
|
|
6361
6635
|
});
|
|
6362
6636
|
}
|
|
6363
6637
|
for (const y of l) {
|
|
6364
|
-
const
|
|
6365
|
-
this.tempPoints.push(
|
|
6638
|
+
const w = n.entities.add({ position: y, point: { pixelSize: 8, color: s.pointColor || s.color || i.Color.YELLOW, disableDepthTestDistance: Number.POSITIVE_INFINITY } });
|
|
6639
|
+
this.tempPoints.push(w);
|
|
6366
6640
|
}
|
|
6367
6641
|
this.entity = n.entities.add({ polyline: { positions: l, width: a, material: o, depthFailMaterial: new i.PolylineDashMaterialProperty({ color: r, dashLength: 12, dashPattern: 255 }) } });
|
|
6368
6642
|
let d = 0;
|
|
6369
6643
|
for (let y = 1; y < l.length; y++) {
|
|
6370
|
-
const
|
|
6644
|
+
const w = i.Cartographic.fromCartesian(l[y - 1]), v = i.Cartographic.fromCartesian(l[y]), P = new i.EllipsoidGeodesic(w, v);
|
|
6371
6645
|
d += P.surfaceDistance;
|
|
6372
|
-
const b = l[y - 1], C = l[y],
|
|
6646
|
+
const b = l[y - 1], C = l[y], L = new i.Cartesian3((b.x + C.x) / 2, (b.y + C.y) / 2, (b.z + C.z) / 2), E = i.Cartographic.fromCartesian(L), M = t.id + `_seg_${y - 1}`;
|
|
6373
6647
|
this.segmentLabelIds.push(M), this.htmlLabelPool.add({ text: `${P.surfaceDistance.toFixed(2)} m` }, {
|
|
6374
6648
|
id: M,
|
|
6375
|
-
lon: i.Math.toDegrees(
|
|
6376
|
-
lat: i.Math.toDegrees(
|
|
6377
|
-
height:
|
|
6649
|
+
lon: i.Math.toDegrees(E.longitude),
|
|
6650
|
+
lat: i.Math.toDegrees(E.latitude),
|
|
6651
|
+
height: E.height || 0,
|
|
6378
6652
|
theme: "measure-polyline-seg",
|
|
6379
6653
|
show: !0,
|
|
6380
6654
|
style: { pointerEvents: "none", userSelect: "none", cursor: "default" }
|
|
6381
6655
|
});
|
|
6382
6656
|
}
|
|
6383
|
-
const u = l[l.length - 1], g = i.Cartographic.fromCartesian(u),
|
|
6384
|
-
this.totalLabelId =
|
|
6385
|
-
id:
|
|
6657
|
+
const u = l[l.length - 1], g = i.Cartographic.fromCartesian(u), p = t.id + "_total";
|
|
6658
|
+
this.totalLabelId = p, this.htmlLabelPool.add({ text: `${d.toFixed(2)} m` }, {
|
|
6659
|
+
id: p,
|
|
6386
6660
|
lon: i.Math.toDegrees(g.longitude),
|
|
6387
6661
|
lat: i.Math.toDegrees(g.latitude),
|
|
6388
6662
|
height: g.height || 0,
|
|
@@ -6392,8 +6666,8 @@ const Oe = class Oe {
|
|
|
6392
6666
|
});
|
|
6393
6667
|
}
|
|
6394
6668
|
};
|
|
6395
|
-
c(
|
|
6396
|
-
let ke =
|
|
6669
|
+
c(He, "TIP_TEXT", "单击左键添加点,右键撤销,双击左键或Esc结束");
|
|
6670
|
+
let ke = He;
|
|
6397
6671
|
class vt {
|
|
6398
6672
|
constructor(t, e) {
|
|
6399
6673
|
c(this, "Cesium");
|
|
@@ -6412,7 +6686,7 @@ class vt {
|
|
|
6412
6686
|
const e = this.Cesium, i = this.viewer;
|
|
6413
6687
|
if (!this.htmlLabelPool) {
|
|
6414
6688
|
const n = t.overlayContainerId || "html-label-container";
|
|
6415
|
-
this.htmlLabelPool = new
|
|
6689
|
+
this.htmlLabelPool = new G(e, i, n), this.htmlLabelPool.registerTheme("measure-terrainHeight", {
|
|
6416
6690
|
createElement: (s, o) => {
|
|
6417
6691
|
var r;
|
|
6418
6692
|
s.innerHTML = String(((r = o == null ? void 0 : o.data) == null ? void 0 : r.text) || ""), s.style.background = "rgba(0,0,0,0.6)", s.style.color = "#fff", s.style.font = "14px sans-serif", s.style.padding = "4px 6px", s.style.borderRadius = "4px", s.style.whiteSpace = "pre";
|
|
@@ -6453,11 +6727,11 @@ class vt {
|
|
|
6453
6727
|
})
|
|
6454
6728
|
}
|
|
6455
6729
|
});
|
|
6456
|
-
const u = t.labelText || { height: "高程" }, g = (o.height || 0) - r,
|
|
6457
|
-
this.htmlLabelId =
|
|
6458
|
-
{ text:
|
|
6730
|
+
const u = t.labelText || { height: "高程" }, g = (o.height || 0) - r, p = `${u.height}:${r.toFixed(2)} m`, m = this.htmlLabelId || `measure_terrain_${Date.now()}`;
|
|
6731
|
+
this.htmlLabelId = m, this.htmlLabelPool.add(
|
|
6732
|
+
{ text: p },
|
|
6459
6733
|
{
|
|
6460
|
-
id:
|
|
6734
|
+
id: m,
|
|
6461
6735
|
lon: a,
|
|
6462
6736
|
lat: l,
|
|
6463
6737
|
height: o.height || 0,
|
|
@@ -6492,20 +6766,20 @@ class vt {
|
|
|
6492
6766
|
if (o.length < 1) return;
|
|
6493
6767
|
if (!this.htmlLabelPool) {
|
|
6494
6768
|
const f = s.overlayContainerId || "html-label-container";
|
|
6495
|
-
this.htmlLabelPool = e || new
|
|
6496
|
-
createElement: (y,
|
|
6497
|
-
var
|
|
6498
|
-
y.innerHTML = String(((
|
|
6769
|
+
this.htmlLabelPool = e || new G(i, n, f), this.htmlLabelPool.registerTheme("measure-terrainHeight", {
|
|
6770
|
+
createElement: (y, w) => {
|
|
6771
|
+
var v;
|
|
6772
|
+
y.innerHTML = String(((v = w == null ? void 0 : w.data) == null ? void 0 : v.text) || ""), y.style.background = "rgba(0,0,0,0.6)", y.style.color = "#fff", y.style.font = "14px sans-serif", y.style.padding = "4px 6px", y.style.borderRadius = "4px", y.style.whiteSpace = "pre";
|
|
6499
6773
|
},
|
|
6500
6774
|
options: { offset: { x: 0, y: -10 } }
|
|
6501
6775
|
});
|
|
6502
6776
|
}
|
|
6503
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), u = i.Math.toDegrees(a.latitude), g = i.Cartesian3.fromDegrees(d, u, l);
|
|
6504
6778
|
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 }) } });
|
|
6505
|
-
const
|
|
6779
|
+
const p = s.labelText || { height: "高程" };
|
|
6506
6780
|
(a.height || 0) - l;
|
|
6507
|
-
const
|
|
6508
|
-
this.htmlLabelId =
|
|
6781
|
+
const m = t.id + "_terrain";
|
|
6782
|
+
this.htmlLabelId = m, this.htmlLabelPool.add({ text: `${p.height}:${l.toFixed(2)} m` }, { id: m, lon: d, lat: u, height: a.height || 0, theme: "measure-terrainHeight", show: !0 });
|
|
6509
6783
|
}
|
|
6510
6784
|
}
|
|
6511
6785
|
class Ct {
|
|
@@ -6524,7 +6798,7 @@ class Ct {
|
|
|
6524
6798
|
const e = this.Cesium, i = this.viewer;
|
|
6525
6799
|
if (!this.htmlLabelPool) {
|
|
6526
6800
|
const n = t.overlayContainerId || "html-label-container";
|
|
6527
|
-
this.htmlLabelPool = new
|
|
6801
|
+
this.htmlLabelPool = new G(e, i, n), this.htmlLabelPool.registerTheme("measure-coordinate", {
|
|
6528
6802
|
createElement: (s, o) => {
|
|
6529
6803
|
var r;
|
|
6530
6804
|
s.innerHTML = String(((r = o == null ? void 0 : o.data) == null ? void 0 : r.text) || ""), s.style.background = "rgba(0,0,0,0.6)", s.style.color = "#fff", s.style.font = "14px sans-serif", s.style.padding = "4px 6px", s.style.borderRadius = "4px", s.style.whiteSpace = "pre";
|
|
@@ -6533,7 +6807,7 @@ class Ct {
|
|
|
6533
6807
|
});
|
|
6534
6808
|
}
|
|
6535
6809
|
this.handler = new e.ScreenSpaceEventHandler(i.canvas), this.handler.setInputAction((n) => {
|
|
6536
|
-
var
|
|
6810
|
+
var p;
|
|
6537
6811
|
const s = i.scene.pickPosition(n.position);
|
|
6538
6812
|
if (!s) return;
|
|
6539
6813
|
const o = e.Cartographic.fromCartesian(s), r = e.Math.toDegrees(o.longitude), a = e.Math.toDegrees(o.latitude), l = o.height || 0;
|
|
@@ -6567,7 +6841,7 @@ ${u.height}:${l.toFixed(2)} m` },
|
|
|
6567
6841
|
lnglat: { lng: r, lat: a, height: l },
|
|
6568
6842
|
clear: () => this.clear()
|
|
6569
6843
|
};
|
|
6570
|
-
(
|
|
6844
|
+
(p = t.onComplete) == null || p.call(t, g), this.stop();
|
|
6571
6845
|
}, e.ScreenSpaceEventType.LEFT_CLICK);
|
|
6572
6846
|
}
|
|
6573
6847
|
stop() {
|
|
@@ -6577,10 +6851,10 @@ ${u.height}:${l.toFixed(2)} m` },
|
|
|
6577
6851
|
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);
|
|
6578
6852
|
}
|
|
6579
6853
|
rehydrate(t, e) {
|
|
6580
|
-
var
|
|
6854
|
+
var m;
|
|
6581
6855
|
const i = this.Cesium, n = this.viewer, s = t.options || {}, o = (t.positions || []).map((f) => new i.Cartesian3(f[0], f[1], f[2]));
|
|
6582
6856
|
if (!o.length) {
|
|
6583
|
-
const f = (
|
|
6857
|
+
const f = (m = t.data) == null ? void 0 : m.lnglat;
|
|
6584
6858
|
if (f && typeof f.lng == "number" && typeof f.lat == "number") {
|
|
6585
6859
|
const y = i.Cartesian3.fromDegrees(f.lng, f.lat, f.height || 0);
|
|
6586
6860
|
o.push(y);
|
|
@@ -6589,10 +6863,10 @@ ${u.height}:${l.toFixed(2)} m` },
|
|
|
6589
6863
|
if (!o.length) return;
|
|
6590
6864
|
if (!this.htmlLabelPool) {
|
|
6591
6865
|
const f = s.overlayContainerId || "html-label-container";
|
|
6592
|
-
this.htmlLabelPool = e || new
|
|
6593
|
-
createElement: (y,
|
|
6594
|
-
var
|
|
6595
|
-
y.innerHTML = String(((
|
|
6866
|
+
this.htmlLabelPool = e || new G(i, n, f), this.htmlLabelPool.registerTheme("measure-coordinate", {
|
|
6867
|
+
createElement: (y, w) => {
|
|
6868
|
+
var v;
|
|
6869
|
+
y.innerHTML = String(((v = w == null ? void 0 : w.data) == null ? void 0 : v.text) || ""), y.style.background = "rgba(0,0,0,0.6)", y.style.color = "#fff", y.style.font = "14px sans-serif", y.style.padding = "4px 6px", y.style.borderRadius = "4px", y.style.whiteSpace = "pre";
|
|
6596
6870
|
},
|
|
6597
6871
|
options: { offset: { x: 0, y: -10 } }
|
|
6598
6872
|
});
|
|
@@ -6601,10 +6875,10 @@ ${u.height}:${l.toFixed(2)} m` },
|
|
|
6601
6875
|
this.entity = n.entities.add({ position: r, point: { pixelSize: 10, color: s.color || i.Color.YELLOW, disableDepthTestDistance: Number.POSITIVE_INFINITY } });
|
|
6602
6876
|
const g = t.id + "_coord";
|
|
6603
6877
|
this.htmlLabelId = g;
|
|
6604
|
-
const
|
|
6605
|
-
this.htmlLabelPool.add({ text: `${
|
|
6606
|
-
${
|
|
6607
|
-
${
|
|
6878
|
+
const p = s.labelText || { lng: "经", lat: "纬", height: "高" };
|
|
6879
|
+
this.htmlLabelPool.add({ text: `${p.lng}:${l.toFixed(6)}
|
|
6880
|
+
${p.lat}:${d.toFixed(6)}
|
|
6881
|
+
${p.height}:${u.toFixed(2)} m` }, { id: g, lon: l, lat: d, height: u, theme: "measure-coordinate", show: !0 });
|
|
6608
6882
|
}
|
|
6609
6883
|
}
|
|
6610
6884
|
class bt {
|
|
@@ -6635,7 +6909,7 @@ class bt {
|
|
|
6635
6909
|
const e = this.Cesium, i = this.viewer;
|
|
6636
6910
|
if (!this.htmlLabelPool) {
|
|
6637
6911
|
const n = t.overlayContainerId || "html-label-container";
|
|
6638
|
-
this.htmlLabelPool = new
|
|
6912
|
+
this.htmlLabelPool = new G(e, i, n), this.htmlLabelPool.registerTheme("measure-rectangle", {
|
|
6639
6913
|
createElement: (s, o) => {
|
|
6640
6914
|
var r;
|
|
6641
6915
|
s.innerHTML = String(((r = o == null ? void 0 : o.data) == null ? void 0 : r.text) || ""), s.style.background = "rgba(0,0,0,0.6)", s.style.color = "#fff", s.style.font = "14px sans-serif", s.style.padding = "4px 6px", s.style.borderRadius = "4px", s.style.whiteSpace = "pre";
|
|
@@ -6669,18 +6943,18 @@ class bt {
|
|
|
6669
6943
|
this.stop();
|
|
6670
6944
|
const { corners: a, center: l, width: d, height: u, area: g } = r;
|
|
6671
6945
|
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);
|
|
6672
|
-
const
|
|
6673
|
-
this.htmlLabelId =
|
|
6674
|
-
const
|
|
6946
|
+
const p = this.htmlLabelId || `measure_rectangle_${Date.now()}`;
|
|
6947
|
+
this.htmlLabelId = p;
|
|
6948
|
+
const m = e.Cartographic.fromCartesian(l), f = t.labelText || { width: "宽", heightLabel: "高", area: "面积", side: "边长" };
|
|
6675
6949
|
this.previewLabelId && this.htmlLabelPool && (this.htmlLabelPool.removeByIds([this.previewLabelId]), this.previewLabelId = null), this.htmlLabelPool.add(
|
|
6676
6950
|
{ text: `${f.width}:${d.toFixed(2)} m
|
|
6677
6951
|
${f.heightLabel}:${u.toFixed(2)} m
|
|
6678
6952
|
${f.area}:${g.toFixed(2)} m²` },
|
|
6679
6953
|
{
|
|
6680
|
-
id:
|
|
6681
|
-
lon: e.Math.toDegrees(
|
|
6682
|
-
lat: e.Math.toDegrees(
|
|
6683
|
-
height:
|
|
6954
|
+
id: p,
|
|
6955
|
+
lon: e.Math.toDegrees(m.longitude),
|
|
6956
|
+
lat: e.Math.toDegrees(m.latitude),
|
|
6957
|
+
height: m.height || 0,
|
|
6684
6958
|
theme: "measure-rectangle",
|
|
6685
6959
|
show: !0
|
|
6686
6960
|
}
|
|
@@ -6692,11 +6966,11 @@ ${f.area}:${g.toFixed(2)} m²` },
|
|
|
6692
6966
|
[a[3], a[0]]
|
|
6693
6967
|
];
|
|
6694
6968
|
for (let A = 0; A < y.length; A++) {
|
|
6695
|
-
const [
|
|
6696
|
-
this.segmentLabelIds.push(
|
|
6697
|
-
{ text: `${f.side}:${Number(
|
|
6969
|
+
const [R, H] = y[A], B = A === 0 || A === 2 ? d : u, Y = new e.Cartesian3((R.x + H.x) / 2, (R.y + H.y) / 2, (R.z + H.z) / 2), N = e.Cartographic.fromCartesian(Y), z = `measure_rectangle_seg_${Date.now()}_${A}`;
|
|
6970
|
+
this.segmentLabelIds.push(z), this.htmlLabelPool.add(
|
|
6971
|
+
{ text: `${f.side}:${Number(B).toFixed(2)} m` },
|
|
6698
6972
|
{
|
|
6699
|
-
id:
|
|
6973
|
+
id: z,
|
|
6700
6974
|
lon: e.Math.toDegrees(N.longitude),
|
|
6701
6975
|
lat: e.Math.toDegrees(N.latitude),
|
|
6702
6976
|
height: N.height || 0,
|
|
@@ -6705,12 +6979,12 @@ ${f.area}:${g.toFixed(2)} m²` },
|
|
|
6705
6979
|
}
|
|
6706
6980
|
);
|
|
6707
6981
|
}
|
|
6708
|
-
const
|
|
6709
|
-
polygonHierarchy:
|
|
6982
|
+
const w = this.buildSurfaceRectanglePositions(a), v = new e.PolygonHierarchy(w), P = new e.PolygonGeometry({
|
|
6983
|
+
polygonHierarchy: v,
|
|
6710
6984
|
vertexFormat: e.MaterialAppearance.VERTEX_FORMAT,
|
|
6711
6985
|
perPositionHeight: !0,
|
|
6712
6986
|
arcType: e.ArcType.NONE
|
|
6713
|
-
}), b = new e.GeometryInstance({ geometry: P }), C = t.color || e.Color.YELLOW.withAlpha(0.4),
|
|
6987
|
+
}), b = new e.GeometryInstance({ geometry: P }), C = t.color || e.Color.YELLOW.withAlpha(0.4), L = t.color && t.color.withAlpha ? t.color.withAlpha(0.25) : e.Color.RED.withAlpha(0.4);
|
|
6714
6988
|
this.primitive = new e.Primitive({
|
|
6715
6989
|
geometryInstances: b,
|
|
6716
6990
|
appearance: new e.MaterialAppearance({
|
|
@@ -6719,16 +6993,16 @@ ${f.area}:${g.toFixed(2)} m²` },
|
|
|
6719
6993
|
closed: !0
|
|
6720
6994
|
}),
|
|
6721
6995
|
depthFailAppearance: new e.MaterialAppearance({
|
|
6722
|
-
material: e.Material.fromType("Color", { color:
|
|
6996
|
+
material: e.Material.fromType("Color", { color: L }),
|
|
6723
6997
|
translucent: !0,
|
|
6724
6998
|
closed: !0
|
|
6725
6999
|
})
|
|
6726
7000
|
}), i.scene.primitives.add(this.primitive);
|
|
6727
|
-
const
|
|
7001
|
+
const E = t.lineColor || t.color || e.Color.YELLOW, M = ((_ = (S = t.dashLineColor || t.lineColor || t.color || e.Color.RED).withAlpha) == null ? void 0 : _.call(S, 0.9)) || e.Color.RED, x = [...w, w[0]], I = i.entities.add({
|
|
6728
7002
|
polyline: {
|
|
6729
7003
|
positions: x,
|
|
6730
7004
|
width: t.width || 2,
|
|
6731
|
-
material:
|
|
7005
|
+
material: E,
|
|
6732
7006
|
clampToGround: !1,
|
|
6733
7007
|
arcType: e.ArcType.NONE,
|
|
6734
7008
|
depthFailMaterial: new e.PolylineDashMaterialProperty({
|
|
@@ -6741,7 +7015,7 @@ ${f.area}:${g.toFixed(2)} m²` },
|
|
|
6741
7015
|
this.edgeEntities.push(I);
|
|
6742
7016
|
const D = t.pointColor || t.color || e.Color.YELLOW;
|
|
6743
7017
|
for (const A of a) {
|
|
6744
|
-
const
|
|
7018
|
+
const R = i.entities.add({
|
|
6745
7019
|
position: A,
|
|
6746
7020
|
point: {
|
|
6747
7021
|
pixelSize: 8,
|
|
@@ -6749,7 +7023,7 @@ ${f.area}:${g.toFixed(2)} m²` },
|
|
|
6749
7023
|
disableDepthTestDistance: Number.POSITIVE_INFINITY
|
|
6750
7024
|
}
|
|
6751
7025
|
});
|
|
6752
|
-
this.pointEntities.push(
|
|
7026
|
+
this.pointEntities.push(R);
|
|
6753
7027
|
}
|
|
6754
7028
|
const T = {
|
|
6755
7029
|
entity: this.primitive,
|
|
@@ -6762,17 +7036,17 @@ ${f.area}:${g.toFixed(2)} m²` },
|
|
|
6762
7036
|
};
|
|
6763
7037
|
(k = t.onComplete) == null || k.call(t, T);
|
|
6764
7038
|
}, e.ScreenSpaceEventType.LEFT_CLICK), this.handler.setInputAction((n) => {
|
|
6765
|
-
var y,
|
|
7039
|
+
var y, w;
|
|
6766
7040
|
const s = i.scene.pickPosition(n.endPosition);
|
|
6767
7041
|
if (!s) return;
|
|
6768
7042
|
if (this.startPoint && !this.secondPoint) {
|
|
6769
7043
|
if (this.endPoint = s, !this.previewEdgeEntity) {
|
|
6770
|
-
const
|
|
7044
|
+
const v = t.lineColor || t.color || e.Color.YELLOW, P = ((w = (y = t.dashLineColor || t.lineColor || t.color || e.Color.RED).withAlpha) == null ? void 0 : w.call(y, 0.9)) || e.Color.RED;
|
|
6771
7045
|
this.previewEdgeEntity = i.entities.add({
|
|
6772
7046
|
polyline: {
|
|
6773
7047
|
positions: new e.CallbackProperty(() => !this.startPoint || !this.endPoint ? [] : [this.startPoint, this.endPoint], !1),
|
|
6774
7048
|
width: t.width || 2,
|
|
6775
|
-
material:
|
|
7049
|
+
material: v,
|
|
6776
7050
|
clampToGround: !1,
|
|
6777
7051
|
arcType: e.ArcType.NONE,
|
|
6778
7052
|
depthFailMaterial: new e.PolylineDashMaterialProperty({
|
|
@@ -6789,7 +7063,7 @@ ${f.area}:${g.toFixed(2)} m²` },
|
|
|
6789
7063
|
color: b,
|
|
6790
7064
|
disableDepthTestDistance: Number.POSITIVE_INFINITY
|
|
6791
7065
|
}
|
|
6792
|
-
}),
|
|
7066
|
+
}), L = i.entities.add({
|
|
6793
7067
|
position: new e.CallbackProperty(() => this.endPoint || this.startPoint, !1),
|
|
6794
7068
|
point: {
|
|
6795
7069
|
pixelSize: 8,
|
|
@@ -6797,7 +7071,7 @@ ${f.area}:${g.toFixed(2)} m²` },
|
|
|
6797
7071
|
disableDepthTestDistance: Number.POSITIVE_INFINITY
|
|
6798
7072
|
}
|
|
6799
7073
|
});
|
|
6800
|
-
this.previewPointEntities.push(C,
|
|
7074
|
+
this.previewPointEntities.push(C, L);
|
|
6801
7075
|
}
|
|
6802
7076
|
return;
|
|
6803
7077
|
}
|
|
@@ -6806,30 +7080,30 @@ ${f.area}:${g.toFixed(2)} m²` },
|
|
|
6806
7080
|
if (!o) return;
|
|
6807
7081
|
const { corners: r, center: a, width: l, height: d, area: u } = o, g = this.buildSurfaceRectanglePositions(r);
|
|
6808
7082
|
this.currentCorners = g;
|
|
6809
|
-
const
|
|
6810
|
-
this.previewLabelId =
|
|
7083
|
+
const p = e.Cartographic.fromCartesian(a), m = this.previewLabelId || "measure_rectangle_preview";
|
|
7084
|
+
this.previewLabelId = m;
|
|
6811
7085
|
const f = t.labelText || { width: "宽", heightLabel: "高", area: "面积" };
|
|
6812
7086
|
if (this.htmlLabelPool.add(
|
|
6813
7087
|
{ text: `${f.width}:${l.toFixed(2)} m
|
|
6814
7088
|
${f.heightLabel}:${d.toFixed(2)} m
|
|
6815
7089
|
${f.area}:${u.toFixed(2)} m²` },
|
|
6816
7090
|
{
|
|
6817
|
-
id:
|
|
6818
|
-
lon: e.Math.toDegrees(
|
|
6819
|
-
lat: e.Math.toDegrees(
|
|
6820
|
-
height:
|
|
7091
|
+
id: m,
|
|
7092
|
+
lon: e.Math.toDegrees(p.longitude),
|
|
7093
|
+
lat: e.Math.toDegrees(p.latitude),
|
|
7094
|
+
height: p.height || 0,
|
|
6821
7095
|
theme: "measure-rectangle",
|
|
6822
7096
|
show: !0
|
|
6823
7097
|
}
|
|
6824
7098
|
), !this.previewEntity) {
|
|
6825
|
-
const
|
|
7099
|
+
const v = t.color || e.Color.YELLOW.withAlpha(0.4);
|
|
6826
7100
|
this.previewEntity = i.entities.add({
|
|
6827
7101
|
polygon: {
|
|
6828
7102
|
hierarchy: new e.CallbackProperty(() => {
|
|
6829
7103
|
if (!(!this.startPoint || !this.secondPoint || !this.currentCorners.length))
|
|
6830
7104
|
return new e.PolygonHierarchy(this.currentCorners);
|
|
6831
7105
|
}, !1),
|
|
6832
|
-
material:
|
|
7106
|
+
material: v,
|
|
6833
7107
|
perPositionHeight: !0,
|
|
6834
7108
|
arcType: e.ArcType.NONE
|
|
6835
7109
|
}
|
|
@@ -6875,7 +7149,7 @@ ${f.area}:${u.toFixed(2)} m²` },
|
|
|
6875
7149
|
if (o.length < 3) return;
|
|
6876
7150
|
if (!this.htmlLabelPool) {
|
|
6877
7151
|
const D = s.overlayContainerId || "html-label-container";
|
|
6878
|
-
this.htmlLabelPool = e || new
|
|
7152
|
+
this.htmlLabelPool = e || new G(i, n, D), this.htmlLabelPool.registerTheme("measure-rectangle", {
|
|
6879
7153
|
createElement: (T, S) => {
|
|
6880
7154
|
var _;
|
|
6881
7155
|
T.innerHTML = String(((_ = S == null ? void 0 : S.data) == null ? void 0 : _.text) || ""), T.style.background = "rgba(0,0,0,0.6)", T.style.color = "#fff", T.style.font = "14px sans-serif", T.style.padding = "4px 6px", T.style.borderRadius = "4px", T.style.whiteSpace = "pre";
|
|
@@ -6891,10 +7165,10 @@ ${f.area}:${u.toFixed(2)} m²` },
|
|
|
6891
7165
|
}
|
|
6892
7166
|
const r = this.computeRectangle(o[0], o[1], o[2]);
|
|
6893
7167
|
if (!r) return;
|
|
6894
|
-
const a = r.corners, l = r.center, d = r.width, u = r.height, g = r.area,
|
|
6895
|
-
this.htmlLabelId =
|
|
7168
|
+
const a = r.corners, l = r.center, d = r.width, u = r.height, g = r.area, p = i.Cartographic.fromCartesian(l), m = t.id + "_rectangle", f = s.labelText || { width: "宽", heightLabel: "高", area: "面积", side: "边长" };
|
|
7169
|
+
this.htmlLabelId = m, this.htmlLabelPool.add({ text: `${f.width}:${d.toFixed(2)} m
|
|
6896
7170
|
${f.heightLabel}:${u.toFixed(2)} m
|
|
6897
|
-
${f.area}:${g.toFixed(2)} m²` }, { id:
|
|
7171
|
+
${f.area}:${g.toFixed(2)} m²` }, { id: m, lon: i.Math.toDegrees(p.longitude), lat: i.Math.toDegrees(p.latitude), height: p.height || 0, theme: "measure-rectangle", show: !0 });
|
|
6898
7172
|
const y = [
|
|
6899
7173
|
[a[0], a[1]],
|
|
6900
7174
|
[a[1], a[2]],
|
|
@@ -6902,25 +7176,25 @@ ${f.area}:${g.toFixed(2)} m²` }, { id: p, lon: i.Math.toDegrees(m.longitude), l
|
|
|
6902
7176
|
[a[3], a[0]]
|
|
6903
7177
|
];
|
|
6904
7178
|
for (let D = 0; D < y.length; D++) {
|
|
6905
|
-
const [T, S] = y[D], _ = D === 0 || D === 2 ? d : u, k = new i.Cartesian3((T.x + S.x) / 2, (T.y + S.y) / 2, (T.z + S.z) / 2), A = i.Cartographic.fromCartesian(k),
|
|
6906
|
-
this.segmentLabelIds.push(
|
|
7179
|
+
const [T, S] = y[D], _ = D === 0 || D === 2 ? d : u, 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
|
+
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 });
|
|
6907
7181
|
}
|
|
6908
|
-
const
|
|
6909
|
-
polygonHierarchy:
|
|
7182
|
+
const w = new i.PolygonHierarchy(a), v = new i.PolygonGeometry({
|
|
7183
|
+
polygonHierarchy: w,
|
|
6910
7184
|
vertexFormat: i.MaterialAppearance.VERTEX_FORMAT,
|
|
6911
7185
|
perPositionHeight: !0,
|
|
6912
7186
|
arcType: i.ArcType.NONE
|
|
6913
|
-
}), P = new i.GeometryInstance({ geometry:
|
|
7187
|
+
}), P = new i.GeometryInstance({ geometry: v }), b = s.color || i.Color.YELLOW.withAlpha(0.4), C = s.color && s.color.withAlpha ? s.color.withAlpha(0.25) : i.Color.RED.withAlpha(0.4), L = new i.Primitive({
|
|
6914
7188
|
geometryInstances: P,
|
|
6915
7189
|
appearance: new i.MaterialAppearance({ material: i.Material.fromType("Color", { color: b }), translucent: !0, closed: !0 }),
|
|
6916
7190
|
depthFailAppearance: new i.MaterialAppearance({ material: i.Material.fromType("Color", { color: C }), translucent: !0, closed: !0 })
|
|
6917
7191
|
});
|
|
6918
|
-
this.primitive =
|
|
6919
|
-
const
|
|
7192
|
+
this.primitive = L, n.scene.primitives.add(this.primitive);
|
|
7193
|
+
const E = s.lineColor || b, M = [...a, a[0]], x = n.entities.add({
|
|
6920
7194
|
polyline: {
|
|
6921
7195
|
positions: M,
|
|
6922
7196
|
width: s.width || 2,
|
|
6923
|
-
material:
|
|
7197
|
+
material: E,
|
|
6924
7198
|
clampToGround: !1,
|
|
6925
7199
|
arcType: i.ArcType.NONE
|
|
6926
7200
|
}
|
|
@@ -6944,22 +7218,22 @@ ${f.area}:${g.toFixed(2)} m²` }, { id: p, lon: i.Math.toDegrees(m.longitude), l
|
|
|
6944
7218
|
if (!o || o.length < 3) return null;
|
|
6945
7219
|
const r = o[0], a = o[1], l = o[2], d = a.x - r.x, u = a.y - r.y, g = Math.sqrt(d * d + u * u);
|
|
6946
7220
|
if (!g) return null;
|
|
6947
|
-
const
|
|
7221
|
+
const p = d / g, f = -(u / g), y = p, w = l.x - a.x, v = l.y - a.y, P = w * f + v * y;
|
|
6948
7222
|
if (!P) return null;
|
|
6949
|
-
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),
|
|
6950
|
-
if (!
|
|
6951
|
-
const
|
|
7223
|
+
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
|
+
if (!L || L.length < 4) return null;
|
|
7225
|
+
const E = L, M = E[0], x = E[2], I = Math.abs(g), D = Math.abs(P), T = new n.Cartesian3(
|
|
6952
7226
|
(M.x + x.x) / 2,
|
|
6953
7227
|
(M.y + x.y) / 2,
|
|
6954
7228
|
(M.z + x.z) / 2
|
|
6955
|
-
), _ = new n.EllipsoidTangentPlane(T, n.Ellipsoid.WGS84).projectPointsOntoPlane(
|
|
7229
|
+
), _ = new n.EllipsoidTangentPlane(T, n.Ellipsoid.WGS84).projectPointsOntoPlane(E);
|
|
6956
7230
|
let k = 0;
|
|
6957
|
-
for (let
|
|
6958
|
-
const
|
|
6959
|
-
k += _[
|
|
7231
|
+
for (let R = 0; R < _.length; R++) {
|
|
7232
|
+
const H = (R + 1) % _.length;
|
|
7233
|
+
k += _[R].x * _[H].y - _[H].x * _[R].y;
|
|
6960
7234
|
}
|
|
6961
7235
|
const A = Math.abs(k) / 2;
|
|
6962
|
-
return { corners:
|
|
7236
|
+
return { corners: E, center: T, width: I, height: D, area: A };
|
|
6963
7237
|
}
|
|
6964
7238
|
}
|
|
6965
7239
|
class Pt {
|
|
@@ -6988,7 +7262,7 @@ class Pt {
|
|
|
6988
7262
|
const e = this.Cesium, i = this.viewer, n = Math.max(t.sides || 6, 6);
|
|
6989
7263
|
if (!this.htmlLabelPool) {
|
|
6990
7264
|
const s = t.overlayContainerId || "html-label-container";
|
|
6991
|
-
this.htmlLabelPool = new
|
|
7265
|
+
this.htmlLabelPool = new G(e, i, s), this.htmlLabelPool.registerTheme("measure-regular", {
|
|
6992
7266
|
createElement: (o, r) => {
|
|
6993
7267
|
var a;
|
|
6994
7268
|
o.innerHTML = String(((a = r == null ? void 0 : r.data) == null ? void 0 : a.text) || ""), o.style.background = "rgba(0,0,0,0.6)", o.style.color = "#fff", o.style.font = "14px sans-serif", o.style.padding = "4px 6px", o.style.borderRadius = "4px", o.style.whiteSpace = "pre";
|
|
@@ -7007,28 +7281,28 @@ class Pt {
|
|
|
7007
7281
|
const o = i.scene.pickPosition(s.position);
|
|
7008
7282
|
if (o && (this.positions.push(o), this.positions.length === 2)) {
|
|
7009
7283
|
this.stop();
|
|
7010
|
-
const d = this.positions[0], u = this.positions[1], g = e.Cartesian3.distance(d, u),
|
|
7284
|
+
const d = this.positions[0], u = this.positions[1], g = e.Cartesian3.distance(d, u), p = this.buildRegularPolygonPoints(d, g, n);
|
|
7011
7285
|
this.previewEntity && (i.entities.remove(this.previewEntity), this.previewEntity = null), this.primitive && (i.scene.primitives.remove(this.primitive), this.primitive = null);
|
|
7012
|
-
const
|
|
7013
|
-
polygonHierarchy:
|
|
7286
|
+
const m = new e.PolygonHierarchy(p), f = new e.PolygonGeometry({
|
|
7287
|
+
polygonHierarchy: m,
|
|
7014
7288
|
vertexFormat: e.MaterialAppearance.VERTEX_FORMAT,
|
|
7015
7289
|
perPositionHeight: !0,
|
|
7016
7290
|
arcType: e.ArcType.NONE
|
|
7017
|
-
}), y = new e.GeometryInstance({ geometry: f }),
|
|
7291
|
+
}), y = new e.GeometryInstance({ geometry: f }), w = t.color || e.Color.YELLOW.withAlpha(0.4), v = t.color && t.color.withAlpha ? t.color.withAlpha(0.25) : e.Color.RED.withAlpha(0.4);
|
|
7018
7292
|
this.primitive = new e.Primitive({
|
|
7019
7293
|
geometryInstances: y,
|
|
7020
7294
|
appearance: new e.MaterialAppearance({
|
|
7021
|
-
material: e.Material.fromType("Color", { color:
|
|
7295
|
+
material: e.Material.fromType("Color", { color: w }),
|
|
7022
7296
|
translucent: !0,
|
|
7023
7297
|
closed: !0
|
|
7024
7298
|
}),
|
|
7025
7299
|
depthFailAppearance: new e.MaterialAppearance({
|
|
7026
|
-
material: e.Material.fromType("Color", { color:
|
|
7300
|
+
material: e.Material.fromType("Color", { color: v }),
|
|
7027
7301
|
translucent: !0,
|
|
7028
7302
|
closed: !0
|
|
7029
7303
|
})
|
|
7030
7304
|
}), i.scene.primitives.add(this.primitive);
|
|
7031
|
-
const P = t.lineColor ||
|
|
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 = p.slice(), L = i.entities.add({
|
|
7032
7306
|
polyline: {
|
|
7033
7307
|
positions: C,
|
|
7034
7308
|
width: t.width || 2,
|
|
@@ -7042,35 +7316,35 @@ class Pt {
|
|
|
7042
7316
|
})
|
|
7043
7317
|
}
|
|
7044
7318
|
});
|
|
7045
|
-
this.edgeEntities.push(
|
|
7046
|
-
const
|
|
7319
|
+
this.edgeEntities.push(L);
|
|
7320
|
+
const E = t.pointColor || w, M = p.slice(0, p.length - 1);
|
|
7047
7321
|
for (const k of M) {
|
|
7048
7322
|
const A = i.entities.add({
|
|
7049
7323
|
position: k,
|
|
7050
7324
|
point: {
|
|
7051
7325
|
pixelSize: 8,
|
|
7052
|
-
color:
|
|
7326
|
+
color: E,
|
|
7053
7327
|
disableDepthTestDistance: Number.POSITIVE_INFINITY
|
|
7054
7328
|
}
|
|
7055
7329
|
});
|
|
7056
7330
|
this.pointEntities.push(A);
|
|
7057
7331
|
}
|
|
7058
|
-
const x = this.computeAreaByPlane(
|
|
7332
|
+
const x = this.computeAreaByPlane(p), I = e.Cartographic.fromCartesian(d), D = this.htmlLabelId || `measure_regular_${Date.now()}`;
|
|
7059
7333
|
this.htmlLabelId = D;
|
|
7060
7334
|
const T = t.labelText || { sides: "边数", radius: "半径", circumference: "周长", area: "面积", side: "边长" };
|
|
7061
7335
|
this.previewLabelId && this.htmlLabelPool && (this.htmlLabelPool.removeByIds([this.previewLabelId]), this.previewLabelId = null);
|
|
7062
7336
|
let S = 0;
|
|
7063
|
-
for (let k = 1; k <
|
|
7064
|
-
const A =
|
|
7337
|
+
for (let k = 1; k < p.length; k++) {
|
|
7338
|
+
const A = p[k - 1], R = p[k], H = e.Cartographic.fromCartesian(A), B = e.Cartographic.fromCartesian(R), N = new e.EllipsoidGeodesic(H, B).surfaceDistance;
|
|
7065
7339
|
S += N;
|
|
7066
|
-
const
|
|
7340
|
+
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}`;
|
|
7067
7341
|
this.segmentLabelIds.push(se), this.htmlLabelPool.add(
|
|
7068
7342
|
{ text: `${T.side}:${N.toFixed(2)} m` },
|
|
7069
7343
|
{
|
|
7070
7344
|
id: se,
|
|
7071
|
-
lon: e.Math.toDegrees(
|
|
7072
|
-
lat: e.Math.toDegrees(
|
|
7073
|
-
height:
|
|
7345
|
+
lon: e.Math.toDegrees(V.longitude),
|
|
7346
|
+
lat: e.Math.toDegrees(V.latitude),
|
|
7347
|
+
height: V.height || 0,
|
|
7074
7348
|
theme: "measure-regular-seg",
|
|
7075
7349
|
show: !0
|
|
7076
7350
|
}
|
|
@@ -7093,7 +7367,7 @@ ${T.area}:${x.toFixed(2)} m²` },
|
|
|
7093
7367
|
const _ = {
|
|
7094
7368
|
entity: this.primitive,
|
|
7095
7369
|
label: this.labelEntity,
|
|
7096
|
-
positions:
|
|
7370
|
+
positions: p,
|
|
7097
7371
|
radius: g,
|
|
7098
7372
|
sides: n,
|
|
7099
7373
|
perimeter: S,
|
|
@@ -7109,24 +7383,24 @@ ${T.area}:${x.toFixed(2)} m²` },
|
|
|
7109
7383
|
if (!a) return;
|
|
7110
7384
|
const l = e.Cartesian3.distance(o, a);
|
|
7111
7385
|
if (this.currentPoints = this.buildRegularPolygonPoints(o, l, n), !this.previewEntity) {
|
|
7112
|
-
const
|
|
7386
|
+
const w = t.color || e.Color.YELLOW.withAlpha(0.4);
|
|
7113
7387
|
this.previewEntity = i.entities.add({
|
|
7114
7388
|
polygon: {
|
|
7115
7389
|
hierarchy: new e.CallbackProperty(() => {
|
|
7116
7390
|
if (!(!this.currentPoints || this.currentPoints.length === 0))
|
|
7117
7391
|
return new e.PolygonHierarchy(this.currentPoints);
|
|
7118
7392
|
}, !1),
|
|
7119
|
-
material:
|
|
7393
|
+
material: w,
|
|
7120
7394
|
perPositionHeight: !0,
|
|
7121
7395
|
arcType: e.ArcType.NONE
|
|
7122
7396
|
}
|
|
7123
7397
|
});
|
|
7124
|
-
const
|
|
7398
|
+
const v = t.lineColor || t.color || e.Color.YELLOW, P = ((y = (f = t.dashLineColor || t.lineColor || t.color || e.Color.RED).withAlpha) == null ? void 0 : y.call(f, 0.9)) || e.Color.RED;
|
|
7125
7399
|
this.previewEdgeEntity = i.entities.add({
|
|
7126
7400
|
polyline: {
|
|
7127
7401
|
positions: new e.CallbackProperty(() => !this.currentPoints || this.currentPoints.length === 0 ? [] : this.currentPoints.slice(), !1),
|
|
7128
7402
|
width: t.width || 2,
|
|
7129
|
-
material:
|
|
7403
|
+
material: v,
|
|
7130
7404
|
clampToGround: !1,
|
|
7131
7405
|
arcType: e.ArcType.NONE,
|
|
7132
7406
|
depthFailMaterial: new e.PolylineDashMaterialProperty({
|
|
@@ -7143,7 +7417,7 @@ ${T.area}:${x.toFixed(2)} m²` },
|
|
|
7143
7417
|
color: b,
|
|
7144
7418
|
disableDepthTestDistance: Number.POSITIVE_INFINITY
|
|
7145
7419
|
}
|
|
7146
|
-
}),
|
|
7420
|
+
}), L = i.entities.add({
|
|
7147
7421
|
position: new e.CallbackProperty(() => a || o, !1),
|
|
7148
7422
|
point: {
|
|
7149
7423
|
pixelSize: 8,
|
|
@@ -7151,23 +7425,23 @@ ${T.area}:${x.toFixed(2)} m²` },
|
|
|
7151
7425
|
disableDepthTestDistance: Number.POSITIVE_INFINITY
|
|
7152
7426
|
}
|
|
7153
7427
|
});
|
|
7154
|
-
this.previewPointEntities.push(C,
|
|
7428
|
+
this.previewPointEntities.push(C, L);
|
|
7155
7429
|
}
|
|
7156
7430
|
let d = 0;
|
|
7157
|
-
for (let
|
|
7158
|
-
const
|
|
7159
|
-
d +=
|
|
7431
|
+
for (let w = 1; w < this.currentPoints.length; w++) {
|
|
7432
|
+
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
|
+
d += L.surfaceDistance;
|
|
7160
7434
|
}
|
|
7161
|
-
const u = this.computeAreaByPlane(this.currentPoints), g = e.Cartographic.fromCartesian(o),
|
|
7162
|
-
this.previewLabelId =
|
|
7163
|
-
const
|
|
7435
|
+
const u = this.computeAreaByPlane(this.currentPoints), g = e.Cartographic.fromCartesian(o), p = this.previewLabelId || "measure_regular_preview";
|
|
7436
|
+
this.previewLabelId = p;
|
|
7437
|
+
const m = t.labelText || { sides: "边数", radius: "半径", circumference: "周长", area: "面积" };
|
|
7164
7438
|
this.htmlLabelPool.add(
|
|
7165
|
-
{ text: `${
|
|
7166
|
-
${
|
|
7167
|
-
${
|
|
7168
|
-
${
|
|
7439
|
+
{ text: `${m.sides}:${n}
|
|
7440
|
+
${m.radius}:${l.toFixed(2)} m
|
|
7441
|
+
${m.circumference}:${d.toFixed(2)} m
|
|
7442
|
+
${m.area}:${u.toFixed(2)} m²` },
|
|
7169
7443
|
{
|
|
7170
|
-
id:
|
|
7444
|
+
id: p,
|
|
7171
7445
|
lon: e.Math.toDegrees(g.longitude),
|
|
7172
7446
|
lat: e.Math.toDegrees(g.latitude),
|
|
7173
7447
|
height: g.height || 0,
|
|
@@ -7208,12 +7482,12 @@ ${p.area}:${u.toFixed(2)} m²` },
|
|
|
7208
7482
|
this.labelEntity && (this.viewer.entities.remove(this.labelEntity), this.labelEntity = null), this.htmlLabelPool && this.htmlLabelId && (this.htmlLabelPool.removeByIds([this.htmlLabelId]), this.htmlLabelId = null), this.previewLabelId && this.htmlLabelPool && (this.htmlLabelPool.removeByIds([this.previewLabelId]), this.previewLabelId = null), this.segmentLabelIds.length && this.htmlLabelPool && this.htmlLabelPool.removeByIds(this.segmentLabelIds.slice()), this.segmentLabelIds = [], this.positions = [], this.currentPoints = [];
|
|
7209
7483
|
}
|
|
7210
7484
|
rehydrate(t, e) {
|
|
7211
|
-
var
|
|
7212
|
-
const i = this.Cesium, n = this.viewer, s = t.options || {}, o = ((
|
|
7485
|
+
var L;
|
|
7486
|
+
const i = this.Cesium, n = this.viewer, s = t.options || {}, o = ((L = t.data) == null ? void 0 : L.sides) || s.sides || 3, r = (t.positions || []).map((E) => new i.Cartesian3(E[0], E[1], E[2]));
|
|
7213
7487
|
if (r.length < 2) return;
|
|
7214
7488
|
if (!this.htmlLabelPool) {
|
|
7215
|
-
const
|
|
7216
|
-
this.htmlLabelPool = e || new
|
|
7489
|
+
const E = s.overlayContainerId || "html-label-container";
|
|
7490
|
+
this.htmlLabelPool = e || new G(i, n, E), this.htmlLabelPool.registerTheme("measure-regular", {
|
|
7217
7491
|
createElement: (M, x) => {
|
|
7218
7492
|
var I;
|
|
7219
7493
|
M.innerHTML = String(((I = x == null ? void 0 : x.data) == null ? void 0 : I.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";
|
|
@@ -7234,34 +7508,34 @@ ${p.area}:${u.toFixed(2)} m²` },
|
|
|
7234
7508
|
a.reduce((M, x) => M + x.y, 0) / a.length,
|
|
7235
7509
|
a.reduce((M, x) => M + x.z, 0) / a.length
|
|
7236
7510
|
);
|
|
7237
|
-
const
|
|
7238
|
-
a[Math.floor(a.length / 2)] || a[1], d = i.Cartesian3.distance(l,
|
|
7511
|
+
const E = a[0];
|
|
7512
|
+
a[Math.floor(a.length / 2)] || a[1], d = i.Cartesian3.distance(l, E);
|
|
7239
7513
|
} else {
|
|
7240
|
-
const
|
|
7241
|
-
d = i.Cartesian3.distance(l,
|
|
7514
|
+
const E = r[1];
|
|
7515
|
+
d = i.Cartesian3.distance(l, E), a = this.buildRegularPolygonPoints(l, d, Math.max(o, 3));
|
|
7242
7516
|
}
|
|
7243
|
-
const u = new i.PolygonHierarchy(a), g = new i.PolygonGeometry({ polygonHierarchy: u, vertexFormat: i.MaterialAppearance.VERTEX_FORMAT, perPositionHeight: !0 }),
|
|
7517
|
+
const u = new i.PolygonHierarchy(a), g = new i.PolygonGeometry({ polygonHierarchy: u, vertexFormat: i.MaterialAppearance.VERTEX_FORMAT, perPositionHeight: !0 }), p = new i.GeometryInstance({ geometry: g }), m = 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: p, appearance: new i.MaterialAppearance({ material: i.Material.fromType("Color", { color: m }), translucent: !0, closed: !0 }), depthFailAppearance: new i.MaterialAppearance({ material: i.Material.fromType("Color", { color: f }), translucent: !0, closed: !0 }) });
|
|
7244
7518
|
n.scene.primitives.add(y), this.primitive = y;
|
|
7245
|
-
const
|
|
7519
|
+
const w = this.computeAreaByPlane(a), v = i.Cartographic.fromCartesian(l), P = t.id + "_regular";
|
|
7246
7520
|
this.htmlLabelId = P;
|
|
7247
7521
|
const b = s.labelText || { sides: "边数", radius: "半径", circumference: "周长", area: "面积", side: "边长" };
|
|
7248
7522
|
let C = 0;
|
|
7249
|
-
for (let
|
|
7250
|
-
const M = a[
|
|
7523
|
+
for (let E = 1; E < a.length; E++) {
|
|
7524
|
+
const M = a[E - 1], x = a[E], I = i.Cartographic.fromCartesian(M), D = i.Cartographic.fromCartesian(x), S = new i.EllipsoidGeodesic(I, D).surfaceDistance;
|
|
7251
7525
|
C += S;
|
|
7252
|
-
const _ = new i.Cartesian3((M.x + x.x) / 2, (M.y + x.y) / 2, (M.z + x.z) / 2), k = i.Cartographic.fromCartesian(_), A = t.id + `_regular_seg_${
|
|
7526
|
+
const _ = new i.Cartesian3((M.x + x.x) / 2, (M.y + x.y) / 2, (M.z + x.z) / 2), k = i.Cartographic.fromCartesian(_), A = t.id + `_regular_seg_${E - 1}`;
|
|
7253
7527
|
this.segmentLabelIds.push(A), this.htmlLabelPool.add({ text: `${b.side}:${S.toFixed(2)} m` }, { id: A, lon: i.Math.toDegrees(k.longitude), lat: i.Math.toDegrees(k.latitude), height: k.height || 0, theme: "measure-regular-seg", show: !0 });
|
|
7254
7528
|
}
|
|
7255
7529
|
this.htmlLabelPool.add({ text: `${b.sides}:${Math.max(o, 3)}
|
|
7256
7530
|
${b.radius}:${d.toFixed(2)} m
|
|
7257
7531
|
${b.circumference}:${C.toFixed(2)} m
|
|
7258
|
-
${b.area}:${
|
|
7532
|
+
${b.area}:${w.toFixed(2)} m²` }, { id: P, lon: i.Math.toDegrees(v.longitude), lat: i.Math.toDegrees(v.latitude), height: v.height || 0, theme: "measure-regular", show: !0 });
|
|
7259
7533
|
}
|
|
7260
7534
|
buildRegularPolygonPoints(t, e, i) {
|
|
7261
7535
|
const n = this.Cesium, s = new n.EllipsoidTangentPlane(t, n.Ellipsoid.WGS84), o = 2 * Math.PI / i, r = [];
|
|
7262
7536
|
for (let d = 0; d < i; d++) {
|
|
7263
|
-
const u = d * o, g = e * Math.cos(u),
|
|
7264
|
-
r.push(new n.Cartesian2(g,
|
|
7537
|
+
const u = d * o, g = e * Math.cos(u), p = e * Math.sin(u);
|
|
7538
|
+
r.push(new n.Cartesian2(g, p));
|
|
7265
7539
|
}
|
|
7266
7540
|
const l = s.projectPointsOntoEllipsoid(r).slice();
|
|
7267
7541
|
return l.push(l[0]), l;
|
|
@@ -7280,7 +7554,7 @@ ${b.area}:${v.toFixed(2)} m²` }, { id: P, lon: i.Math.toDegrees(w.longitude), l
|
|
|
7280
7554
|
return Math.abs(o) / 2;
|
|
7281
7555
|
}
|
|
7282
7556
|
}
|
|
7283
|
-
class
|
|
7557
|
+
class No {
|
|
7284
7558
|
constructor({ Cesium: t, viewer: e }) {
|
|
7285
7559
|
c(this, "Cesium");
|
|
7286
7560
|
c(this, "viewer");
|
|
@@ -7527,7 +7801,7 @@ class zo {
|
|
|
7527
7801
|
else {
|
|
7528
7802
|
if (this.specifiedClear = !0, !this.deleteLabelPool) {
|
|
7529
7803
|
const e = t || "html-label-container";
|
|
7530
|
-
this.deleteLabelPool = new
|
|
7804
|
+
this.deleteLabelPool = new G(this.Cesium, this.viewer, e), this.deleteLabelPool.registerTheme("measure-delete-label", {
|
|
7531
7805
|
createElement: (i, n) => {
|
|
7532
7806
|
i.innerHTML = "删除", i.style.background = "rgba(255,0,0,0.7)", i.style.color = "#fff", i.style.font = "12px sans-serif", i.style.padding = "2px 6px", i.style.borderRadius = "4px", i.style.whiteSpace = "nowrap";
|
|
7533
7807
|
},
|
|
@@ -7608,7 +7882,7 @@ class zo {
|
|
|
7608
7882
|
return null;
|
|
7609
7883
|
}
|
|
7610
7884
|
}
|
|
7611
|
-
class
|
|
7885
|
+
class zo {
|
|
7612
7886
|
constructor({ Cesium: t, viewer: e }) {
|
|
7613
7887
|
c(this, "Cesium");
|
|
7614
7888
|
c(this, "viewer");
|
|
@@ -7668,10 +7942,10 @@ class No {
|
|
|
7668
7942
|
for (const u of e) {
|
|
7669
7943
|
let g;
|
|
7670
7944
|
u.destination ? u.destination.x !== void 0 ? g = new this.Cesium.Cartesian3(u.destination.x, u.destination.y, u.destination.z) : g = u.destination : u.lon !== void 0 && u.lat !== void 0 && (g = this.Cesium.Cartesian3.fromDegrees(u.lon, u.lat, u.height ?? 0));
|
|
7671
|
-
let
|
|
7672
|
-
u.orientation ?
|
|
7673
|
-
const
|
|
7674
|
-
s.push({ position: g, orientation:
|
|
7945
|
+
let p;
|
|
7946
|
+
u.orientation ? p = new this.Cesium.HeadingPitchRoll(u.orientation.heading, u.orientation.pitch, u.orientation.roll) : p = this.Cesium.HeadingPitchRoll.fromDegrees(u.heading ?? 0, u.pitch ?? -30, u.roll ?? 0);
|
|
7947
|
+
const m = this.Cesium.Transforms.headingPitchRollQuaternion(g, p);
|
|
7948
|
+
s.push({ position: g, orientation: m });
|
|
7675
7949
|
}
|
|
7676
7950
|
const o = this.Cesium.JulianDate.now(), r = t.speed || 100;
|
|
7677
7951
|
let a = 0;
|
|
@@ -7680,8 +7954,8 @@ class No {
|
|
|
7680
7954
|
if (u === 0)
|
|
7681
7955
|
l.push(o.clone());
|
|
7682
7956
|
else {
|
|
7683
|
-
const
|
|
7684
|
-
a +=
|
|
7957
|
+
const p = this.Cesium.Cartesian3.distance(s[u - 1].position, s[u].position) / Math.max(r, 0.1);
|
|
7958
|
+
a += p, l.push(this.Cesium.JulianDate.addSeconds(o, a, new this.Cesium.JulianDate()));
|
|
7685
7959
|
}
|
|
7686
7960
|
i.addSample(l[u], s[u].position), n.addSample(l[u], s[u].orientation);
|
|
7687
7961
|
}
|
|
@@ -7706,7 +7980,7 @@ class No {
|
|
|
7706
7980
|
// clampToGround: false
|
|
7707
7981
|
}
|
|
7708
7982
|
})), this.entity = this.viewer.entities.add(d), t.showStops && s.forEach((u, g) => {
|
|
7709
|
-
const
|
|
7983
|
+
const p = this.Cesium.Cartographic.fromCartesian(u.position), m = this.Cesium.Cartesian3.fromRadians(p.longitude, p.latitude, 0);
|
|
7710
7984
|
this.viewEntities.push(this.viewer.entities.add({
|
|
7711
7985
|
position: u.position,
|
|
7712
7986
|
point: {
|
|
@@ -7725,7 +7999,7 @@ class No {
|
|
|
7725
7999
|
style: this.Cesium.LabelStyle.FILL_AND_OUTLINE
|
|
7726
8000
|
},
|
|
7727
8001
|
polyline: {
|
|
7728
|
-
positions: [u.position,
|
|
8002
|
+
positions: [u.position, m],
|
|
7729
8003
|
width: 2,
|
|
7730
8004
|
material: new this.Cesium.PolylineDashMaterialProperty({
|
|
7731
8005
|
color: this.Cesium.Color.RED,
|
|
@@ -7805,8 +8079,8 @@ class Go {
|
|
|
7805
8079
|
const e = this.normalizePositions(t.positions || []);
|
|
7806
8080
|
if (!e.length) return;
|
|
7807
8081
|
const i = t.speed ?? 30, n = this.buildTimes(e, i), s = new this.Cesium.SampledPositionProperty();
|
|
7808
|
-
for (let
|
|
7809
|
-
s.addSample(n[
|
|
8082
|
+
for (let p = 0; p < e.length; p++)
|
|
8083
|
+
s.addSample(n[p], e[p]);
|
|
7810
8084
|
this.positionProperty = s;
|
|
7811
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, u = t.pointPixelSize ?? 8, g = {
|
|
7812
8086
|
availability: new this.Cesium.TimeIntervalCollection([
|
|
@@ -7861,21 +8135,21 @@ class Go {
|
|
|
7861
8135
|
export {
|
|
7862
8136
|
Ae as AreaMeasure,
|
|
7863
8137
|
_o as BufferedHierarchicalAggregator,
|
|
7864
|
-
|
|
8138
|
+
zo as CameraRoamTool,
|
|
7865
8139
|
wt as CircleMeasure,
|
|
7866
8140
|
Ct as CoordinateMeasure,
|
|
7867
8141
|
Yt as DOM_EVENT_MAP,
|
|
7868
8142
|
Do as DrawTool,
|
|
7869
8143
|
Eo as EditMode,
|
|
7870
|
-
|
|
8144
|
+
Ho as EntityLayerManager,
|
|
7871
8145
|
So as GLTFManage,
|
|
7872
8146
|
Mo as GLTFManageEventKey,
|
|
7873
8147
|
Se as HorizontalMeasure,
|
|
7874
|
-
|
|
8148
|
+
G as HtmlOverlayLabelPool,
|
|
7875
8149
|
Bt as MarkerEventBus,
|
|
7876
8150
|
te as MarkerEventKey,
|
|
7877
|
-
|
|
7878
|
-
|
|
8151
|
+
$o as MaterialManager,
|
|
8152
|
+
No as MeasurementTool,
|
|
7879
8153
|
Go as PathRoamTool,
|
|
7880
8154
|
ke as PolylineDistanceMeasure,
|
|
7881
8155
|
Fo as PrimitiveManager,
|
|
@@ -7886,8 +8160,8 @@ export {
|
|
|
7886
8160
|
ce as TooltipManager,
|
|
7887
8161
|
ft as TriangleMeasure,
|
|
7888
8162
|
gt as VerticalMeasure,
|
|
7889
|
-
|
|
8163
|
+
Oo as convertGeoJsonToEntityData,
|
|
7890
8164
|
Ao as getDynamicImgMaterial,
|
|
7891
|
-
|
|
8165
|
+
Ro as getPolylineFlowMaterialProperty,
|
|
7892
8166
|
ko as getWallMaterial
|
|
7893
8167
|
};
|