leiting-bim 2.1.160 → 2.1.161
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/leiting-bim.es.js +1 -1
- package/leiting-bim.umd.js +5 -5
- package/leitingbim.css +1 -1
- package/package.json +1 -1
- package/plugins/cesium-core/dist/cesium-core.mjs +1424 -1261
- package/plugins/cesium-core/dist/cesium-core.mjs.map +1 -1
- package/plugins/cesium-core/dist/cesium-core.umd.js +22 -22
- package/plugins/cesium-core/dist/cesium-core.umd.js.map +1 -1
- package/plugins/cesium-core/dist/components/measurement/handlers/AreaMeasure.d.ts +9 -0
- package/plugins/cesium-core/dist/components/measurement/handlers/HorizontalMeasure.d.ts +12 -0
- package/plugins/cesium-core/dist/components/measurement/handlers/PolylineDistanceMeasure.d.ts +8 -0
- package/plugins/cesium-vue/dist/components/measurement.js +900 -722
- package/plugins/cesium-vue/dist/components/measurement.js.map +1 -1
|
@@ -1,46 +1,46 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
class
|
|
1
|
+
var Nt = Object.defineProperty;
|
|
2
|
+
var Gt = (a, t, e) => t in a ? Nt(a, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : a[t] = e;
|
|
3
|
+
var l = (a, t, e) => Gt(a, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
+
class To {
|
|
5
5
|
constructor(t, e, i) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
6
|
+
l(this, "Cesium");
|
|
7
|
+
l(this, "viewer");
|
|
8
|
+
l(this, "labelPool");
|
|
9
|
+
l(this, "threshold");
|
|
10
|
+
l(this, "displayLimit");
|
|
11
|
+
l(this, "maxLevel");
|
|
12
|
+
l(this, "debugCurrentGrids");
|
|
13
|
+
l(this, "levels");
|
|
14
|
+
l(this, "points", []);
|
|
15
|
+
l(this, "gridLayers", /* @__PURE__ */ new Map());
|
|
16
|
+
l(this, "debugGrids", []);
|
|
17
|
+
l(this, "_updateFn");
|
|
18
|
+
l(this, "clusterTheme");
|
|
19
|
+
l(this, "pointTheme");
|
|
20
|
+
l(this, "centralPointMode");
|
|
21
|
+
l(this, "minGlobalPointCount");
|
|
22
|
+
l(this, "groupByTheme");
|
|
23
|
+
l(this, "tilingScheme");
|
|
24
|
+
l(this, "terrainLevelOffset");
|
|
25
|
+
l(this, "debugTileCoordLayer", null);
|
|
26
|
+
l(this, "levelIndexByTileLevel", /* @__PURE__ */ new Map());
|
|
27
|
+
l(this, "_lastTileProvider", null);
|
|
28
|
+
l(this, "_updateTimer", null);
|
|
29
|
+
l(this, "_updateDelay", 100);
|
|
30
|
+
l(this, "_tilesRetryCount", 0);
|
|
31
|
+
l(this, "_tilesRetryMax", 100);
|
|
32
|
+
l(this, "_cameraDirty", !1);
|
|
33
|
+
l(this, "_tileLoadListener", null);
|
|
34
|
+
l(this, "_cameraChangedHandler", null);
|
|
35
35
|
// 默认显示的地图层级区间(兼容旧数据)
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
l(this, "defaultMinLevel", 0);
|
|
37
|
+
l(this, "defaultMaxLevel", 28);
|
|
38
38
|
// 单次从视图层级向下细分到聚合层级时,最多细分的层级数
|
|
39
|
-
|
|
39
|
+
l(this, "maxRefineLevels", 2);
|
|
40
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.debugCurrentGrids = i.debugCurrentGrids ?? !1, this.clusterTheme = i.clusterTheme ?? "cluster-label", this.pointTheme = i.pointTheme ?? "point-label", this.centralPointMode = i.centralPointMode ?? "central", this.minGlobalPointCount = i.minGlobalPointCount ?? 0, this.groupByTheme = i.groupByTheme ?? !1, this.terrainLevelOffset = i.terrainLevelOffset ?? 2;
|
|
41
41
|
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
|
-
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 = (
|
|
43
|
-
|
|
42
|
+
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 = (h) => {
|
|
43
|
+
h === 0 && this._cameraDirty && (this._cameraDirty = !1, this._scheduleUpdate());
|
|
44
44
|
}, n.tileLoadProgressEvent.addEventListener(this._tileLoadListener)), this._cameraChangedHandler = () => {
|
|
45
45
|
this._update();
|
|
46
46
|
}, this.viewer.camera.changed.addEventListener(this._cameraChangedHandler);
|
|
@@ -96,7 +96,7 @@ class En {
|
|
|
96
96
|
}, this._updateDelay);
|
|
97
97
|
}
|
|
98
98
|
updatePoint(t) {
|
|
99
|
-
var s, o, r,
|
|
99
|
+
var s, o, r, h;
|
|
100
100
|
const e = this.points.findIndex((c) => c.id === t.id);
|
|
101
101
|
if (e === -1) return;
|
|
102
102
|
const i = this.points[e];
|
|
@@ -116,7 +116,7 @@ class En {
|
|
|
116
116
|
const y = f.skipPoints.findIndex((v) => v.id === t.id);
|
|
117
117
|
y !== -1 && f.skipPoints.splice(y, 1);
|
|
118
118
|
} else {
|
|
119
|
-
const y = this.groupByTheme ? (
|
|
119
|
+
const y = this.groupByTheme ? (h = i.data) == null ? void 0 : h.theme : this.clusterTheme, v = f.groups.get(y);
|
|
120
120
|
if (v) {
|
|
121
121
|
const C = v.findIndex((b) => b.id === t.id);
|
|
122
122
|
C !== -1 && v.splice(C, 1), v.length === 0 && f.groups.delete(y);
|
|
@@ -135,8 +135,8 @@ class En {
|
|
|
135
135
|
if (n)
|
|
136
136
|
for (const [s, o] of n.entries()) {
|
|
137
137
|
o.allPoints = o.allPoints.filter((r) => !e.has(r.id)), o.skipPoints = o.skipPoints.filter((r) => !e.has(r.id));
|
|
138
|
-
for (const [r,
|
|
139
|
-
const c =
|
|
138
|
+
for (const [r, h] of o.groups.entries()) {
|
|
139
|
+
const c = h.filter((d) => !e.has(d.id));
|
|
140
140
|
c.length === 0 ? o.groups.delete(r) : o.groups.set(r, c);
|
|
141
141
|
}
|
|
142
142
|
o.allPoints.length === 0 && n.delete(s);
|
|
@@ -153,8 +153,8 @@ class En {
|
|
|
153
153
|
}
|
|
154
154
|
_addPointToGrid(t) {
|
|
155
155
|
var e, i, n, s, o, r;
|
|
156
|
-
for (const
|
|
157
|
-
const c =
|
|
156
|
+
for (const h of this.levels) {
|
|
157
|
+
const c = h.level, d = this.gridLayers.get(c);
|
|
158
158
|
if (!d) continue;
|
|
159
159
|
const u = this.Cesium.Cartographic.fromDegrees(t.lon, t.lat), m = this.tilingScheme.positionToTileXY(
|
|
160
160
|
u,
|
|
@@ -250,8 +250,8 @@ class En {
|
|
|
250
250
|
return 0;
|
|
251
251
|
let s = 0, o = 1 / 0;
|
|
252
252
|
for (let r = 0; r < this.levels.length; r++) {
|
|
253
|
-
const
|
|
254
|
-
|
|
253
|
+
const h = Math.abs(this.levels[r].level - t);
|
|
254
|
+
h < o && (o = h, s = r);
|
|
255
255
|
}
|
|
256
256
|
return s;
|
|
257
257
|
}
|
|
@@ -268,10 +268,10 @@ class En {
|
|
|
268
268
|
return e;
|
|
269
269
|
}
|
|
270
270
|
_processTiles(t, e) {
|
|
271
|
-
const i = /* @__PURE__ */ new Set(), n = !this._isTerrainEnabled(), s = this.viewer.scene, o = s && s.globe, r = o && o.ellipsoid,
|
|
272
|
-
if (!n || !
|
|
271
|
+
const i = /* @__PURE__ */ new Set(), n = !this._isTerrainEnabled(), s = this.viewer.scene, o = s && s.globe, r = o && o.ellipsoid, h = r && s.camera.computeViewRectangle(r), c = (d, u, m) => {
|
|
272
|
+
if (!n || !h) return !0;
|
|
273
273
|
const g = this.tilingScheme.tileXYToRectangle(d, u, m);
|
|
274
|
-
return !(!g || g.east <=
|
|
274
|
+
return !(!g || g.east <= h.west || g.west >= h.east || g.north <= h.south || g.south >= h.north);
|
|
275
275
|
};
|
|
276
276
|
for (const d of t) {
|
|
277
277
|
const u = d.rectangle, m = d._level ?? d.level;
|
|
@@ -282,14 +282,14 @@ class En {
|
|
|
282
282
|
if (typeof w == "number" && typeof y == "number") {
|
|
283
283
|
const T = m - f;
|
|
284
284
|
if (T >= 0) {
|
|
285
|
-
const A = 1 << T,
|
|
285
|
+
const A = 1 << T, S = Math.floor(w / A), k = Math.floor(y / A), x = `${f}_${S}_${k}`;
|
|
286
286
|
if (i.has(x)) continue;
|
|
287
|
-
i.add(x), e(p,
|
|
287
|
+
i.add(x), e(p, S, k, m);
|
|
288
288
|
} else {
|
|
289
|
-
const
|
|
290
|
-
for (let $ = 0; $ <
|
|
291
|
-
for (let
|
|
292
|
-
const z =
|
|
289
|
+
const S = 1 << Math.min(-T, this.maxRefineLevels), k = w * S, x = y * S;
|
|
290
|
+
for (let $ = 0; $ < S; $++)
|
|
291
|
+
for (let H = 0; H < S; H++) {
|
|
292
|
+
const z = k + $, G = x + H;
|
|
293
293
|
if (!c(z, G, f)) continue;
|
|
294
294
|
const B = `${f}_${z}_${G}`;
|
|
295
295
|
i.has(B) || (i.add(B), e(p, z, G, m));
|
|
@@ -297,12 +297,12 @@ class En {
|
|
|
297
297
|
}
|
|
298
298
|
continue;
|
|
299
299
|
}
|
|
300
|
-
const C = this.levels[p].size, b = this.Cesium.Math.toDegrees(u.west), M = this.Cesium.Math.toDegrees(u.east), P = this.Cesium.Math.toDegrees(u.south), L = this.Cesium.Math.toDegrees(u.north), E = Math.floor((b - -180) / C), I = Math.floor((M - -180) / C),
|
|
300
|
+
const C = this.levels[p].size, b = this.Cesium.Math.toDegrees(u.west), M = this.Cesium.Math.toDegrees(u.east), P = this.Cesium.Math.toDegrees(u.south), L = this.Cesium.Math.toDegrees(u.north), E = Math.floor((b - -180) / C), I = Math.floor((M - -180) / C), D = Math.floor((P - -90) / C), _ = Math.floor((L - -90) / C);
|
|
301
301
|
for (let T = E; T <= I; T++)
|
|
302
|
-
for (let A =
|
|
302
|
+
for (let A = D; A <= _; A++) {
|
|
303
303
|
if (!c(T, A, f)) continue;
|
|
304
|
-
const
|
|
305
|
-
i.has(
|
|
304
|
+
const S = `${f}_${T}_${A}`;
|
|
305
|
+
i.has(S) || (i.add(S), e(p, T, A, m));
|
|
306
306
|
}
|
|
307
307
|
}
|
|
308
308
|
}
|
|
@@ -315,7 +315,7 @@ class En {
|
|
|
315
315
|
_getCellContext(t, e, i, n) {
|
|
316
316
|
const o = this.levels[t].level, r = this.gridLayers.get(o);
|
|
317
317
|
if (!r) return null;
|
|
318
|
-
const
|
|
318
|
+
const h = `${e}_${i}`, c = r.get(h);
|
|
319
319
|
if (!c) return null;
|
|
320
320
|
const d = this.tilingScheme.tileXYToRectangle(e, i, o), u = this.Cesium.Math.toDegrees(d.west), m = this.Cesium.Math.toDegrees(d.south), g = this.Cesium.Math.toDegrees(d.east), p = this.Cesium.Math.toDegrees(d.north), f = (u + g) / 2, w = (m + p) / 2;
|
|
321
321
|
return {
|
|
@@ -323,7 +323,7 @@ class En {
|
|
|
323
323
|
tileLevel: o,
|
|
324
324
|
lonIdx: e,
|
|
325
325
|
latIdx: i,
|
|
326
|
-
key:
|
|
326
|
+
key: h,
|
|
327
327
|
cell: c,
|
|
328
328
|
rect: d,
|
|
329
329
|
west: u,
|
|
@@ -336,7 +336,7 @@ class En {
|
|
|
336
336
|
};
|
|
337
337
|
}
|
|
338
338
|
_processCellSkipPoints(t, e) {
|
|
339
|
-
var o, r,
|
|
339
|
+
var o, r, h, c;
|
|
340
340
|
const { cell: i, viewTileLevel: n } = t, s = n;
|
|
341
341
|
for (const d of i.skipPoints)
|
|
342
342
|
if (((o = d.data) == null ? void 0 : o.show) !== !1) {
|
|
@@ -346,7 +346,7 @@ class En {
|
|
|
346
346
|
lon: d.lon,
|
|
347
347
|
lat: d.lat,
|
|
348
348
|
height: d.height,
|
|
349
|
-
theme: ((c = (
|
|
349
|
+
theme: ((c = (h = (r = d.data) == null ? void 0 : r.billboard) == null ? void 0 : h[0]) == null ? void 0 : c.theme) || this.pointTheme,
|
|
350
350
|
style: d.style
|
|
351
351
|
}), e++);
|
|
352
352
|
}
|
|
@@ -359,18 +359,18 @@ class En {
|
|
|
359
359
|
lonIdx: s,
|
|
360
360
|
latIdx: o,
|
|
361
361
|
cell: r,
|
|
362
|
-
centerLon:
|
|
362
|
+
centerLon: h,
|
|
363
363
|
centerLat: c,
|
|
364
364
|
viewTileLevel: d
|
|
365
365
|
} = t, u = d;
|
|
366
|
-
for (const [I,
|
|
367
|
-
const _ =
|
|
366
|
+
for (const [I, D] of r.groups) {
|
|
367
|
+
const _ = D.filter((x) => {
|
|
368
368
|
var $;
|
|
369
369
|
return (($ = x.data) == null ? void 0 : $.show) !== !1;
|
|
370
370
|
});
|
|
371
371
|
if (_.length === 0) continue;
|
|
372
|
-
let T =
|
|
373
|
-
if (this.centralPointMode == "firstPoint" && (T = ((g = _[0]) == null ? void 0 : g.lon) || 0, A = ((p = _[0]) == null ? void 0 : p.lat) || 0,
|
|
372
|
+
let T = h, A = c, S = ((m = _[0]) == null ? void 0 : m.height) || 0;
|
|
373
|
+
if (this.centralPointMode == "firstPoint" && (T = ((g = _[0]) == null ? void 0 : g.lon) || 0, A = ((p = _[0]) == null ? void 0 : p.lat) || 0, S = ((f = _[0]) == null ? void 0 : f.height) || 0), n === this.levels.length - 1 || _.length < e)
|
|
374
374
|
for (const x of _) {
|
|
375
375
|
if (i >= this.displayLimit) break;
|
|
376
376
|
this._isVisibleAtLevel(x, u) && (this.labelPool.add(x.data, {
|
|
@@ -387,7 +387,7 @@ class En {
|
|
|
387
387
|
return i;
|
|
388
388
|
const x = u == null ? _ : _.filter((G) => this._isVisibleAtLevel(G, u));
|
|
389
389
|
if (!x.length) return i;
|
|
390
|
-
const
|
|
390
|
+
const H = ((P = (M = (b = (C = x[0]) == null ? void 0 : C.data) == null ? void 0 : b.billboard) == null ? void 0 : M[0]) == null ? void 0 : P.theme) || this.clusterTheme, z = this.groupByTheme ? `cluster-${n}-${s}-${o}-${I}` : `cluster-${n}-${s}-${o}`;
|
|
391
391
|
this.labelPool.add(
|
|
392
392
|
{
|
|
393
393
|
id: z,
|
|
@@ -401,8 +401,8 @@ class En {
|
|
|
401
401
|
id: z,
|
|
402
402
|
lon: T,
|
|
403
403
|
lat: A,
|
|
404
|
-
height:
|
|
405
|
-
theme:
|
|
404
|
+
height: S,
|
|
405
|
+
theme: H
|
|
406
406
|
}
|
|
407
407
|
), i++;
|
|
408
408
|
}
|
|
@@ -411,13 +411,13 @@ class En {
|
|
|
411
411
|
}
|
|
412
412
|
_debugDrawCell(t) {
|
|
413
413
|
if (!this.debugCurrentGrids) return;
|
|
414
|
-
const { levelIdx: e, west: i, south: n, east: s, north: o, lonIdx: r, latIdx:
|
|
414
|
+
const { levelIdx: e, west: i, south: n, east: s, north: o, lonIdx: r, latIdx: h } = t, c = this.levels[e].level;
|
|
415
415
|
this._drawDebugGrid(
|
|
416
416
|
i,
|
|
417
417
|
n,
|
|
418
418
|
s,
|
|
419
419
|
o,
|
|
420
|
-
`L:${c} X:${r} Y:${
|
|
420
|
+
`L:${c} X:${r} Y:${h}`
|
|
421
421
|
);
|
|
422
422
|
}
|
|
423
423
|
refresh() {
|
|
@@ -435,7 +435,7 @@ class En {
|
|
|
435
435
|
n,
|
|
436
436
|
t,
|
|
437
437
|
e
|
|
438
|
-
]),
|
|
438
|
+
]), h = this.viewer.entities.add({
|
|
439
439
|
rectangle: {
|
|
440
440
|
coordinates: o,
|
|
441
441
|
material: this.Cesium.Color.YELLOW.withAlpha(0.2),
|
|
@@ -463,7 +463,7 @@ class En {
|
|
|
463
463
|
horizontalOrigin: this.Cesium.HorizontalOrigin.CENTER
|
|
464
464
|
}
|
|
465
465
|
});
|
|
466
|
-
this.debugGrids.push(
|
|
466
|
+
this.debugGrids.push(h);
|
|
467
467
|
}
|
|
468
468
|
_clearDebugGrids() {
|
|
469
469
|
for (const t of this.debugGrids)
|
|
@@ -495,9 +495,9 @@ class En {
|
|
|
495
495
|
}
|
|
496
496
|
}
|
|
497
497
|
var te = /* @__PURE__ */ ((a) => (a.Click = "marker:click", a.DoubleClick = "marker:dblclick", a.RightClick = "marker:rightclick", a.MouseEnter = "marker:mouseenter", a.MouseLeave = "marker:mouseleave", a.MouseDown = "marker:mousedown", a.MouseUp = "marker:mouseup", a))(te || {});
|
|
498
|
-
class
|
|
498
|
+
class Bt {
|
|
499
499
|
constructor() {
|
|
500
|
-
|
|
500
|
+
l(this, "listenerMap", /* @__PURE__ */ new Map());
|
|
501
501
|
}
|
|
502
502
|
/**
|
|
503
503
|
* 添加监听器
|
|
@@ -544,7 +544,7 @@ class zt {
|
|
|
544
544
|
}
|
|
545
545
|
}
|
|
546
546
|
}
|
|
547
|
-
const
|
|
547
|
+
const jt = {
|
|
548
548
|
[te.Click]: "click",
|
|
549
549
|
[te.DoubleClick]: "dblclick",
|
|
550
550
|
[te.RightClick]: "contextmenu",
|
|
@@ -562,30 +562,30 @@ class N {
|
|
|
562
562
|
* @param eventBus 可选:自定义事件总线
|
|
563
563
|
*/
|
|
564
564
|
constructor(t, e, i = "html-label-container", n, s = !0) {
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
565
|
+
l(this, "viewer");
|
|
566
|
+
l(this, "Cesium");
|
|
567
|
+
l(this, "container");
|
|
568
|
+
l(this, "labels", /* @__PURE__ */ new Map());
|
|
569
|
+
l(this, "activeIds", /* @__PURE__ */ new Set());
|
|
570
|
+
l(this, "occludedIds", /* @__PURE__ */ new Set());
|
|
571
|
+
l(this, "_updateFn");
|
|
572
|
+
l(this, "_cameraChangedFn");
|
|
573
|
+
l(this, "themes", {});
|
|
574
|
+
l(this, "occlusionCheckLogs", []);
|
|
575
|
+
l(this, "occlusionLogEnabled", !1);
|
|
576
|
+
l(this, "occlusionLogMax", 1e4);
|
|
577
|
+
l(this, "occlusionOptions", {
|
|
578
578
|
enabled: !1,
|
|
579
579
|
throttleMs: 120,
|
|
580
580
|
distanceEpsilon: 1
|
|
581
581
|
});
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
this.Cesium = t, this.viewer = e, this.container = this._createContainer(i), this._updateFn = this._update.bind(this), this.viewer.scene.postRender.addEventListener(this._updateFn), this._cameraChangedFn = this._scheduleOcclusionCheck.bind(this), this.viewer.camera.changed.addEventListener(this._cameraChangedFn), this.eventBus = n || new
|
|
582
|
+
l(this, "_occlusionTimer", null);
|
|
583
|
+
l(this, "_lastOcclusionAt", 0);
|
|
584
|
+
l(this, "_occlusionChecking", !1);
|
|
585
|
+
l(this, "_occlusionPending", !1);
|
|
586
|
+
l(this, "eventBus");
|
|
587
|
+
l(this, "openWheel", !0);
|
|
588
|
+
this.Cesium = t, this.viewer = e, this.container = this._createContainer(i), this._updateFn = this._update.bind(this), this.viewer.scene.postRender.addEventListener(this._updateFn), this._cameraChangedFn = this._scheduleOcclusionCheck.bind(this), this.viewer.camera.changed.addEventListener(this._cameraChangedFn), this.eventBus = n || new Bt(), this.openWheel = s, this.runOcclusionCheckNow();
|
|
589
589
|
}
|
|
590
590
|
/**
|
|
591
591
|
* 创建标签容器
|
|
@@ -619,7 +619,7 @@ class N {
|
|
|
619
619
|
lat: s,
|
|
620
620
|
height: o = 0,
|
|
621
621
|
theme: r,
|
|
622
|
-
show:
|
|
622
|
+
show: h = !0,
|
|
623
623
|
notCreateElement: c = !1,
|
|
624
624
|
style: d
|
|
625
625
|
} = e, u = this.themes[r];
|
|
@@ -631,7 +631,7 @@ class N {
|
|
|
631
631
|
if (m) {
|
|
632
632
|
m.theme = r, m.data = t, m.notCreateElement = c;
|
|
633
633
|
try {
|
|
634
|
-
m.unload = u.createElement(m.el, { id: i, theme: r, data: t }, u), (!c ||
|
|
634
|
+
m.unload = u.createElement(m.el, { id: i, theme: r, data: t }, u), (!c || h) && this.container.appendChild(m.el);
|
|
635
635
|
} catch (g) {
|
|
636
636
|
console.error(`Error updating label element for id "${i}":`, g);
|
|
637
637
|
}
|
|
@@ -643,7 +643,7 @@ class N {
|
|
|
643
643
|
pointerEvents: "auto",
|
|
644
644
|
...e.style || {}
|
|
645
645
|
});
|
|
646
|
-
for (const [f, w] of Object.entries(
|
|
646
|
+
for (const [f, w] of Object.entries(jt)) {
|
|
647
647
|
g.addEventListener(w, (v) => {
|
|
648
648
|
v.stopPropagation();
|
|
649
649
|
const C = this.labels.get(i);
|
|
@@ -661,7 +661,7 @@ class N {
|
|
|
661
661
|
});
|
|
662
662
|
}
|
|
663
663
|
let p = null;
|
|
664
|
-
if (!c ||
|
|
664
|
+
if (!c || h) {
|
|
665
665
|
try {
|
|
666
666
|
p = u.createElement(g, { id: i, theme: r, data: t }, u) || {};
|
|
667
667
|
} catch (f) {
|
|
@@ -671,7 +671,7 @@ class N {
|
|
|
671
671
|
}
|
|
672
672
|
m = { id: i, el: g, theme: r, data: t, notCreateElement: c, unload: p }, this.labels.set(i, m);
|
|
673
673
|
}
|
|
674
|
-
m.el.dataset.lon = String(n), m.el.dataset.lat = String(s), m.el.dataset.height = String(o), m.el.style.zIndex = (d == null ? void 0 : d.zIndex) || "1", m.el.style.display =
|
|
674
|
+
m.el.dataset.lon = String(n), m.el.dataset.lat = String(s), m.el.dataset.height = String(o), m.el.style.zIndex = (d == null ? void 0 : d.zIndex) || "1", m.el.style.display = h ? "block" : "none", h && this.activeIds.add(i), h ? this._scheduleOcclusionCheck() : this.occludedIds.delete(i);
|
|
675
675
|
}
|
|
676
676
|
/**
|
|
677
677
|
* 批量添加标签
|
|
@@ -807,8 +807,8 @@ class N {
|
|
|
807
807
|
}
|
|
808
808
|
let r = 0;
|
|
809
809
|
o && o[0] && o[0].height != null ? r = o[0].height : r = 0;
|
|
810
|
-
const
|
|
811
|
-
return this.toWindowCoordinates(
|
|
810
|
+
const h = i.Cartesian3.fromDegrees(t, e, r);
|
|
811
|
+
return this.toWindowCoordinates(h);
|
|
812
812
|
}
|
|
813
813
|
/**
|
|
814
814
|
* 坐标转换:经纬度 -> 屏幕像素坐标
|
|
@@ -843,10 +843,10 @@ class N {
|
|
|
843
843
|
i.el.style.display = "none";
|
|
844
844
|
continue;
|
|
845
845
|
}
|
|
846
|
-
const r = this.Cesium.Cartesian3.fromDegrees(n, s, o),
|
|
847
|
-
if (this.Cesium.defined(
|
|
846
|
+
const r = this.Cesium.Cartesian3.fromDegrees(n, s, o), h = this.toWindowCoordinates(r);
|
|
847
|
+
if (this.Cesium.defined(h)) {
|
|
848
848
|
const d = ((t = this.themes[i.theme].options) == null ? void 0 : t.offset) || {}, u = d.x || 0, m = d.y || 0, g = this.occludedIds.has(e);
|
|
849
|
-
i.el.style.left = `${
|
|
849
|
+
i.el.style.left = `${h.x}px`, i.el.style.top = `${h.y}px`, i.el.style.transform = `translate(${u}px, ${m}px)`, i.el.style.display = g ? "none" : "block";
|
|
850
850
|
} else
|
|
851
851
|
i.el.style.display = "none";
|
|
852
852
|
}
|
|
@@ -867,8 +867,8 @@ class N {
|
|
|
867
867
|
}
|
|
868
868
|
_computeLabelOccluded(t, e, i, n, s, o) {
|
|
869
869
|
var d, u;
|
|
870
|
-
const r = (d = this.viewer) == null ? void 0 : d.scene,
|
|
871
|
-
if (!r || !
|
|
870
|
+
const r = (d = this.viewer) == null ? void 0 : d.scene, h = (u = this.viewer) == null ? void 0 : u.camera, c = this.Cesium;
|
|
871
|
+
if (!r || !h || !c)
|
|
872
872
|
return this._pushOcclusionLog({
|
|
873
873
|
timestamp: Date.now(),
|
|
874
874
|
id: t,
|
|
@@ -890,7 +890,7 @@ class N {
|
|
|
890
890
|
}), !0;
|
|
891
891
|
try {
|
|
892
892
|
const m = r.pickPosition(i);
|
|
893
|
-
if (!m || !
|
|
893
|
+
if (!m || !h.positionWC)
|
|
894
894
|
return this._pushOcclusionLog({
|
|
895
895
|
timestamp: Date.now(),
|
|
896
896
|
id: t,
|
|
@@ -900,7 +900,7 @@ class N {
|
|
|
900
900
|
occluded: !0,
|
|
901
901
|
reason: "pick-empty"
|
|
902
902
|
}), !0;
|
|
903
|
-
const g = Number(this.occlusionOptions.distanceEpsilon) || 0, p = c.Cartesian3.distance(
|
|
903
|
+
const g = Number(this.occlusionOptions.distanceEpsilon) || 0, p = c.Cartesian3.distance(h.positionWC, e), f = c.Cartesian3.distance(h.positionWC, m), w = f + g < p;
|
|
904
904
|
return this._pushOcclusionLog({
|
|
905
905
|
timestamp: Date.now(),
|
|
906
906
|
id: t,
|
|
@@ -1002,13 +1002,13 @@ class N {
|
|
|
1002
1002
|
this.viewer.scene.postRender.removeEventListener(this._updateFn), this.viewer.camera.changed.removeEventListener(this._cameraChangedFn), this._occlusionTimer !== null && (clearTimeout(this._occlusionTimer), this._occlusionTimer = null), this.labels.clear(), this.activeIds.clear(), this.occludedIds.clear();
|
|
1003
1003
|
}
|
|
1004
1004
|
}
|
|
1005
|
-
class
|
|
1005
|
+
class ye {
|
|
1006
1006
|
constructor() {
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1007
|
+
l(this, "tooltipEl");
|
|
1008
|
+
l(this, "visible", !1);
|
|
1009
|
+
l(this, "offsetX", 10);
|
|
1010
|
+
l(this, "offsetY", -20);
|
|
1011
|
+
l(this, "onMouseMove", null);
|
|
1012
1012
|
this.tooltipEl = document.createElement("div"), this.tooltipEl.style.position = "fixed", this.tooltipEl.style.pointerEvents = "none", this.tooltipEl.style.zIndex = "10000", this.tooltipEl.style.padding = "4px 8px", this.tooltipEl.style.borderRadius = "4px", this.tooltipEl.style.background = "rgba(0, 0, 0, 0.7)", this.tooltipEl.style.color = "#fff", this.tooltipEl.style.fontSize = "13px", this.tooltipEl.style.transition = "opacity 0.1s ease", this.tooltipEl.style.opacity = "0", document.body.appendChild(this.tooltipEl), this.onMouseMove = (t) => {
|
|
1013
1013
|
this.visible && (this.tooltipEl.style.left = `${t.clientX + this.offsetX}px`, this.tooltipEl.style.top = `${t.clientY + this.offsetY}px`);
|
|
1014
1014
|
}, window.addEventListener("mousemove", this.onMouseMove);
|
|
@@ -1023,22 +1023,22 @@ class ze {
|
|
|
1023
1023
|
this.onMouseMove && (window.removeEventListener("mousemove", this.onMouseMove), this.onMouseMove = null), this.tooltipEl.parentElement && this.tooltipEl.parentElement.removeChild(this.tooltipEl);
|
|
1024
1024
|
}
|
|
1025
1025
|
}
|
|
1026
|
-
class
|
|
1026
|
+
class Yt {
|
|
1027
1027
|
constructor(t, e) {
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1028
|
+
l(this, "Cesium");
|
|
1029
|
+
l(this, "viewer");
|
|
1030
|
+
l(this, "handler", null);
|
|
1031
|
+
l(this, "entity", null);
|
|
1032
|
+
l(this, "tooltip", null);
|
|
1033
1033
|
this.Cesium = t, this.viewer = e;
|
|
1034
1034
|
}
|
|
1035
1035
|
startDrawing(t) {
|
|
1036
1036
|
const { Cesium: e, viewer: i } = this;
|
|
1037
|
-
this.tooltip = new
|
|
1037
|
+
this.tooltip = new ye(), this.tooltip.show("左键添加点"), this.handler = new e.ScreenSpaceEventHandler(i.canvas), this.handler.setInputAction((n) => {
|
|
1038
1038
|
var m, g;
|
|
1039
1039
|
const s = i.scene.pickPosition(n.position);
|
|
1040
1040
|
if (!s) return;
|
|
1041
|
-
const o = e.Cartographic.fromCartesian(s), r = e.Math.toDegrees(o.longitude),
|
|
1041
|
+
const o = e.Cartographic.fromCartesian(s), r = e.Math.toDegrees(o.longitude), h = e.Math.toDegrees(o.latitude), c = o.height, d = i.entities.add({
|
|
1042
1042
|
position: s,
|
|
1043
1043
|
point: {
|
|
1044
1044
|
pixelSize: 10,
|
|
@@ -1050,7 +1050,7 @@ class Gt {
|
|
|
1050
1050
|
const u = {
|
|
1051
1051
|
entity: d,
|
|
1052
1052
|
position: s,
|
|
1053
|
-
lnglat: { lng: r, lat:
|
|
1053
|
+
lnglat: { lng: r, lat: h, height: c },
|
|
1054
1054
|
clear: () => {
|
|
1055
1055
|
this.clear();
|
|
1056
1056
|
}
|
|
@@ -1066,21 +1066,21 @@ class Gt {
|
|
|
1066
1066
|
this.entity && (this.viewer.entities.remove(this.entity), this.entity = null), this.stopDrawing();
|
|
1067
1067
|
}
|
|
1068
1068
|
}
|
|
1069
|
-
class
|
|
1069
|
+
class Vt {
|
|
1070
1070
|
constructor(t, e) {
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1071
|
+
l(this, "Cesium");
|
|
1072
|
+
l(this, "viewer");
|
|
1073
|
+
l(this, "handler", null);
|
|
1074
|
+
l(this, "positions", []);
|
|
1075
|
+
l(this, "entity", null);
|
|
1076
|
+
l(this, "tooltip", null);
|
|
1077
|
+
l(this, "tempPoints", []);
|
|
1078
|
+
l(this, "options", null);
|
|
1079
|
+
l(this, "keydownHandler", null);
|
|
1080
1080
|
this.Cesium = t, this.viewer = e;
|
|
1081
1081
|
}
|
|
1082
1082
|
getPickPosition(t) {
|
|
1083
|
-
var s, o, r,
|
|
1083
|
+
var s, o, r, h;
|
|
1084
1084
|
const { viewer: e } = this, i = e == null ? void 0 : e.scene;
|
|
1085
1085
|
if (!i || !t) return null;
|
|
1086
1086
|
let n = null;
|
|
@@ -1091,7 +1091,7 @@ class Bt {
|
|
|
1091
1091
|
}
|
|
1092
1092
|
if (!n) {
|
|
1093
1093
|
const c = (o = (s = e.camera) == null ? void 0 : s.getPickRay) == null ? void 0 : o.call(s, t);
|
|
1094
|
-
c && (n = ((
|
|
1094
|
+
c && (n = ((h = (r = i.globe) == null ? void 0 : r.pick) == null ? void 0 : h.call(r, c, i)) || null);
|
|
1095
1095
|
}
|
|
1096
1096
|
return n;
|
|
1097
1097
|
}
|
|
@@ -1115,12 +1115,12 @@ class Bt {
|
|
|
1115
1115
|
const { Cesium: e } = this;
|
|
1116
1116
|
if (t && this.positions.length > 0) {
|
|
1117
1117
|
this.positions.length = this.positions.length - 1;
|
|
1118
|
-
const
|
|
1119
|
-
|
|
1118
|
+
const h = this.tempPoints.pop();
|
|
1119
|
+
h && this.viewer.entities.remove(h);
|
|
1120
1120
|
}
|
|
1121
1121
|
if (this.syncEntity(), this.stopDrawing(), (s = this.tooltip) == null || s.hide(), this.tooltip = null, this.positions.length < 2) return;
|
|
1122
|
-
const i = this.positions.map((
|
|
1123
|
-
const c = e.Cartographic.fromCartesian(
|
|
1122
|
+
const i = this.positions.map((h) => {
|
|
1123
|
+
const c = e.Cartographic.fromCartesian(h);
|
|
1124
1124
|
return {
|
|
1125
1125
|
lng: e.Math.toDegrees(c.longitude),
|
|
1126
1126
|
lat: e.Math.toDegrees(c.latitude),
|
|
@@ -1146,8 +1146,8 @@ class Bt {
|
|
|
1146
1146
|
}
|
|
1147
1147
|
startDrawing(t) {
|
|
1148
1148
|
const { Cesium: e, viewer: i } = this;
|
|
1149
|
-
this.options = t, this.positions = [], this.tempPoints = [], this.entity = null, this.tooltip = new
|
|
1150
|
-
var r,
|
|
1149
|
+
this.options = t, this.positions = [], this.tempPoints = [], this.entity = null, this.tooltip = new ye(), this.tooltip.show("单击左键添加点,右键撤销,双击左键或 Esc 结束"), this.handler = new e.ScreenSpaceEventHandler(i.canvas), this.bindKeyboardEvents(), this.handler.setInputAction((n) => {
|
|
1150
|
+
var r, h;
|
|
1151
1151
|
const s = this.getPickPosition(n.position);
|
|
1152
1152
|
if (!s) return;
|
|
1153
1153
|
this.positions.push(s);
|
|
@@ -1164,7 +1164,7 @@ class Bt {
|
|
|
1164
1164
|
positions: this.positions.slice(),
|
|
1165
1165
|
width: 3,
|
|
1166
1166
|
material: t.color || e.Color.YELLOW,
|
|
1167
|
-
depthFailMaterial: ((
|
|
1167
|
+
depthFailMaterial: ((h = (r = t.color) == null ? void 0 : r.withAlpha) == null ? void 0 : h.call(r, 0.5)) || e.Color.YELLOW.withAlpha(0.5)
|
|
1168
1168
|
}
|
|
1169
1169
|
});
|
|
1170
1170
|
}, e.ScreenSpaceEventType.LEFT_CLICK), this.handler.setInputAction(() => {
|
|
@@ -1183,14 +1183,14 @@ class Bt {
|
|
|
1183
1183
|
this.entity && (t.entities.remove(this.entity), this.entity = null), this.tempPoints.forEach((i) => t.entities.remove(i)), this.tempPoints = [], (e = this.tooltip) == null || e.hide(), this.tooltip = null, this.positions = [], this.options = null, this.stopDrawing();
|
|
1184
1184
|
}
|
|
1185
1185
|
}
|
|
1186
|
-
class
|
|
1186
|
+
class Wt {
|
|
1187
1187
|
constructor(t, e) {
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1188
|
+
l(this, "Cesium");
|
|
1189
|
+
l(this, "viewer");
|
|
1190
|
+
l(this, "handler", null);
|
|
1191
|
+
l(this, "startPoint", null);
|
|
1192
|
+
l(this, "endPoint", null);
|
|
1193
|
+
l(this, "entity", null);
|
|
1194
1194
|
this.Cesium = t, this.viewer = e;
|
|
1195
1195
|
}
|
|
1196
1196
|
startDrawing(t) {
|
|
@@ -1205,7 +1205,7 @@ class jt {
|
|
|
1205
1205
|
coordinates: new e.CallbackProperty(() => {
|
|
1206
1206
|
if (!(!this.startPoint || !this.endPoint))
|
|
1207
1207
|
try {
|
|
1208
|
-
const r = e.Cartographic.fromCartesian(this.startPoint),
|
|
1208
|
+
const r = e.Cartographic.fromCartesian(this.startPoint), h = e.Cartographic.fromCartesian(this.endPoint), c = Math.min(r.longitude, h.longitude), d = Math.max(r.longitude, h.longitude), u = Math.min(r.latitude, h.latitude), m = Math.max(r.latitude, h.latitude);
|
|
1209
1209
|
return new e.Rectangle(c, u, d, m);
|
|
1210
1210
|
} catch (r) {
|
|
1211
1211
|
console.warn("Rectangle calculation error:", r);
|
|
@@ -1220,13 +1220,13 @@ class jt {
|
|
|
1220
1220
|
});
|
|
1221
1221
|
else {
|
|
1222
1222
|
this.stopDrawing();
|
|
1223
|
-
const r = e.Cartographic.fromCartesian(this.startPoint),
|
|
1224
|
-
lng: e.Math.toDegrees(Math.min(r.longitude,
|
|
1225
|
-
lat: e.Math.toDegrees(Math.min(r.latitude,
|
|
1223
|
+
const r = e.Cartographic.fromCartesian(this.startPoint), h = e.Cartographic.fromCartesian(this.endPoint), c = {
|
|
1224
|
+
lng: e.Math.toDegrees(Math.min(r.longitude, h.longitude)),
|
|
1225
|
+
lat: e.Math.toDegrees(Math.min(r.latitude, h.latitude)),
|
|
1226
1226
|
height: 0
|
|
1227
1227
|
}, d = {
|
|
1228
|
-
lng: e.Math.toDegrees(Math.max(r.longitude,
|
|
1229
|
-
lat: e.Math.toDegrees(Math.max(r.latitude,
|
|
1228
|
+
lng: e.Math.toDegrees(Math.max(r.longitude, h.longitude)),
|
|
1229
|
+
lat: e.Math.toDegrees(Math.max(r.latitude, h.latitude)),
|
|
1230
1230
|
height: 0
|
|
1231
1231
|
}, u = {
|
|
1232
1232
|
entity: this.entity,
|
|
@@ -1258,15 +1258,15 @@ class jt {
|
|
|
1258
1258
|
this.entity && (this.viewer.entities.remove(this.entity), this.entity = null), this.startPoint = null, this.endPoint = null, this.stopDrawing();
|
|
1259
1259
|
}
|
|
1260
1260
|
}
|
|
1261
|
-
class
|
|
1261
|
+
class Ut {
|
|
1262
1262
|
constructor(t, e) {
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1263
|
+
l(this, "viewer");
|
|
1264
|
+
l(this, "Cesium");
|
|
1265
|
+
l(this, "handler", null);
|
|
1266
|
+
l(this, "entity", null);
|
|
1267
|
+
l(this, "positions", []);
|
|
1268
|
+
l(this, "_isDrawing", !1);
|
|
1269
|
+
l(this, "currentRadius", 0);
|
|
1270
1270
|
this.Cesium = t, this.viewer = e;
|
|
1271
1271
|
}
|
|
1272
1272
|
startDrawing(t) {
|
|
@@ -1306,7 +1306,7 @@ class Yt {
|
|
|
1306
1306
|
lng: this.Cesium.Math.toDegrees(s.longitude),
|
|
1307
1307
|
lat: this.Cesium.Math.toDegrees(s.latitude),
|
|
1308
1308
|
height: s.height
|
|
1309
|
-
}, r = (t == null ? void 0 : t.step) || 1,
|
|
1309
|
+
}, r = (t == null ? void 0 : t.step) || 1, h = [], c = [];
|
|
1310
1310
|
for (let m = 0; m < 360; m += r) {
|
|
1311
1311
|
const g = this.Cesium.Math.toRadians(m), p = new this.Cesium.EllipsoidGeodesic();
|
|
1312
1312
|
p.setEndPoints(
|
|
@@ -1317,7 +1317,7 @@ class Yt {
|
|
|
1317
1317
|
)
|
|
1318
1318
|
);
|
|
1319
1319
|
const f = p.interpolateUsingSurfaceDistance(n), w = this.Cesium.Ellipsoid.WGS84.cartographicToCartesian(f);
|
|
1320
|
-
|
|
1320
|
+
h.push(w);
|
|
1321
1321
|
const y = this.Cesium.Cartographic.fromCartesian(w);
|
|
1322
1322
|
c.push({
|
|
1323
1323
|
lng: this.Cesium.Math.toDegrees(y.longitude),
|
|
@@ -1338,7 +1338,7 @@ class Yt {
|
|
|
1338
1338
|
entity: this.entity,
|
|
1339
1339
|
positions: this.positions,
|
|
1340
1340
|
lnglats: d,
|
|
1341
|
-
circlePoints:
|
|
1341
|
+
circlePoints: h,
|
|
1342
1342
|
circleLnglats: c,
|
|
1343
1343
|
center: o,
|
|
1344
1344
|
radius: n,
|
|
@@ -1354,18 +1354,18 @@ class Yt {
|
|
|
1354
1354
|
this.stopDrawing(), this.entity && (this.viewer.entities.remove(this.entity), this.entity = null), this.positions = [], this.currentRadius = 0;
|
|
1355
1355
|
}
|
|
1356
1356
|
}
|
|
1357
|
-
class
|
|
1357
|
+
class Kt {
|
|
1358
1358
|
constructor(t, e) {
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1359
|
+
l(this, "Cesium");
|
|
1360
|
+
l(this, "viewer");
|
|
1361
|
+
l(this, "handler", null);
|
|
1362
|
+
l(this, "positions", []);
|
|
1363
|
+
l(this, "lnglats", []);
|
|
1364
|
+
l(this, "entity", null);
|
|
1365
|
+
l(this, "tooltip", null);
|
|
1366
|
+
l(this, "tempPoints", []);
|
|
1367
|
+
l(this, "options", null);
|
|
1368
|
+
l(this, "keydownHandler", null);
|
|
1369
1369
|
this.Cesium = t, this.viewer = e;
|
|
1370
1370
|
}
|
|
1371
1371
|
isHelperPick(t) {
|
|
@@ -1386,7 +1386,7 @@ class Vt {
|
|
|
1386
1386
|
}
|
|
1387
1387
|
}
|
|
1388
1388
|
getPickPosition(t) {
|
|
1389
|
-
var r,
|
|
1389
|
+
var r, h, c, d;
|
|
1390
1390
|
const { viewer: e } = this, i = e == null ? void 0 : e.scene;
|
|
1391
1391
|
if (!i || !t) return null;
|
|
1392
1392
|
let n = null;
|
|
@@ -1397,7 +1397,7 @@ class Vt {
|
|
|
1397
1397
|
console.warn("[PolygonDrawer] pickPosition failed:", u);
|
|
1398
1398
|
}
|
|
1399
1399
|
if (!n) {
|
|
1400
|
-
const u = (
|
|
1400
|
+
const u = (h = (r = e.camera) == null ? void 0 : r.getPickRay) == null ? void 0 : h.call(r, t);
|
|
1401
1401
|
u && (n = ((d = (c = i.globe) == null ? void 0 : c.pick) == null ? void 0 : d.call(c, u, i)) || null);
|
|
1402
1402
|
}
|
|
1403
1403
|
return n;
|
|
@@ -1439,7 +1439,7 @@ class Vt {
|
|
|
1439
1439
|
}
|
|
1440
1440
|
startDrawing(t) {
|
|
1441
1441
|
const { Cesium: e, viewer: i } = this;
|
|
1442
|
-
this.options = t, this.positions = [], this.lnglats = [], this.tempPoints = [], this.entity = null, this.tooltip = new
|
|
1442
|
+
this.options = t, this.positions = [], this.lnglats = [], this.tempPoints = [], this.entity = null, this.tooltip = new ye(), this.tooltip.show("单击左键添加点,右键撤销,双击左键或 Esc 结束"), this.handler = new e.ScreenSpaceEventHandler(i.canvas), this.bindKeyboardEvents(), this.handler.setInputAction((n) => {
|
|
1443
1443
|
const s = this.getPickPosition(n.position);
|
|
1444
1444
|
if (!s) return;
|
|
1445
1445
|
this.positions.push(s);
|
|
@@ -1484,30 +1484,30 @@ class Vt {
|
|
|
1484
1484
|
this.entity && (t.entities.remove(this.entity), this.entity = null), this.tempPoints.forEach((i) => t.entities.remove(i)), this.tempPoints = [], (e = this.tooltip) == null || e.hide(), this.tooltip = null, this.positions = [], this.lnglats = [], this.options = null, this.stopDrawing();
|
|
1485
1485
|
}
|
|
1486
1486
|
}
|
|
1487
|
-
class
|
|
1487
|
+
class xo {
|
|
1488
1488
|
constructor(t, e) {
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1489
|
+
l(this, "viewer");
|
|
1490
|
+
l(this, "Cesium");
|
|
1491
|
+
l(this, "activeDrawer", null);
|
|
1492
1492
|
this.viewer = e, this.Cesium = t;
|
|
1493
1493
|
}
|
|
1494
1494
|
draw(t, e) {
|
|
1495
1495
|
var i;
|
|
1496
1496
|
switch (this.clear(), t) {
|
|
1497
1497
|
case "point":
|
|
1498
|
-
this.activeDrawer = new
|
|
1498
|
+
this.activeDrawer = new Yt(this.Cesium, this.viewer);
|
|
1499
1499
|
break;
|
|
1500
1500
|
case "line":
|
|
1501
|
-
this.activeDrawer = new
|
|
1501
|
+
this.activeDrawer = new Vt(this.Cesium, this.viewer);
|
|
1502
1502
|
break;
|
|
1503
1503
|
case "rectangle":
|
|
1504
|
-
this.activeDrawer = new
|
|
1504
|
+
this.activeDrawer = new Wt(this.Cesium, this.viewer);
|
|
1505
1505
|
break;
|
|
1506
1506
|
case "circle":
|
|
1507
|
-
this.activeDrawer = new
|
|
1507
|
+
this.activeDrawer = new Ut(this.Cesium, this.viewer);
|
|
1508
1508
|
break;
|
|
1509
1509
|
case "polygon":
|
|
1510
|
-
this.activeDrawer = new
|
|
1510
|
+
this.activeDrawer = new Kt(this.Cesium, this.viewer);
|
|
1511
1511
|
break;
|
|
1512
1512
|
default:
|
|
1513
1513
|
throw new Error(`Unsupported draw type: ${t}`);
|
|
@@ -1521,52 +1521,52 @@ class Mn {
|
|
|
1521
1521
|
this.clear();
|
|
1522
1522
|
}
|
|
1523
1523
|
}
|
|
1524
|
-
var
|
|
1525
|
-
function
|
|
1526
|
-
var t =
|
|
1524
|
+
var Lt = typeof global == "object" && global && global.Object === Object && global, qt = typeof self == "object" && self && self.Object === Object && self, ie = Lt || qt || Function("return this")(), ge = ie.Symbol, Et = Object.prototype, Xt = Et.hasOwnProperty, Jt = Et.toString, be = ge ? ge.toStringTag : void 0;
|
|
1525
|
+
function Zt(a) {
|
|
1526
|
+
var t = Xt.call(a, be), e = a[be];
|
|
1527
1527
|
try {
|
|
1528
|
-
a[
|
|
1528
|
+
a[be] = void 0;
|
|
1529
1529
|
var i = !0;
|
|
1530
1530
|
} catch {
|
|
1531
1531
|
}
|
|
1532
|
-
var n =
|
|
1533
|
-
return i && (t ? a[
|
|
1532
|
+
var n = Jt.call(a);
|
|
1533
|
+
return i && (t ? a[be] = e : delete a[be]), n;
|
|
1534
1534
|
}
|
|
1535
|
-
var
|
|
1536
|
-
function
|
|
1537
|
-
return
|
|
1538
|
-
}
|
|
1539
|
-
var Qt = "[object Null]", ei = "[object Undefined]", Be = ge ? ge.toStringTag : void 0;
|
|
1540
|
-
function Ee(a) {
|
|
1541
|
-
return a == null ? a === void 0 ? ei : Qt : Be && Be in Object(a) ? qt(a) : Zt(a);
|
|
1535
|
+
var Qt = Object.prototype, ei = Qt.toString;
|
|
1536
|
+
function ti(a) {
|
|
1537
|
+
return ei.call(a);
|
|
1542
1538
|
}
|
|
1539
|
+
var ii = "[object Null]", si = "[object Undefined]", Ke = ge ? ge.toStringTag : void 0;
|
|
1543
1540
|
function Me(a) {
|
|
1541
|
+
return a == null ? a === void 0 ? si : ii : Ke && Ke in Object(a) ? Zt(a) : ti(a);
|
|
1542
|
+
}
|
|
1543
|
+
function Ie(a) {
|
|
1544
1544
|
return a != null && typeof a == "object";
|
|
1545
1545
|
}
|
|
1546
|
-
var
|
|
1547
|
-
function
|
|
1546
|
+
var He = Array.isArray;
|
|
1547
|
+
function Fe(a) {
|
|
1548
1548
|
var t = typeof a;
|
|
1549
1549
|
return a != null && (t == "object" || t == "function");
|
|
1550
1550
|
}
|
|
1551
|
-
var
|
|
1552
|
-
function
|
|
1553
|
-
if (!
|
|
1551
|
+
var ni = "[object AsyncFunction]", oi = "[object Function]", ri = "[object GeneratorFunction]", ai = "[object Proxy]";
|
|
1552
|
+
function Mt(a) {
|
|
1553
|
+
if (!Fe(a))
|
|
1554
1554
|
return !1;
|
|
1555
|
-
var t =
|
|
1556
|
-
return t ==
|
|
1555
|
+
var t = Me(a);
|
|
1556
|
+
return t == oi || t == ri || t == ni || t == ai;
|
|
1557
1557
|
}
|
|
1558
|
-
var
|
|
1559
|
-
var a = /[^.]+$/.exec(
|
|
1558
|
+
var Ne = ie["__core-js_shared__"], qe = (function() {
|
|
1559
|
+
var a = /[^.]+$/.exec(Ne && Ne.keys && Ne.keys.IE_PROTO || "");
|
|
1560
1560
|
return a ? "Symbol(src)_1." + a : "";
|
|
1561
1561
|
})();
|
|
1562
|
-
function
|
|
1563
|
-
return !!
|
|
1562
|
+
function li(a) {
|
|
1563
|
+
return !!qe && qe in a;
|
|
1564
1564
|
}
|
|
1565
|
-
var
|
|
1565
|
+
var hi = Function.prototype, ci = hi.toString;
|
|
1566
1566
|
function ce(a) {
|
|
1567
1567
|
if (a != null) {
|
|
1568
1568
|
try {
|
|
1569
|
-
return
|
|
1569
|
+
return ci.call(a);
|
|
1570
1570
|
} catch {
|
|
1571
1571
|
}
|
|
1572
1572
|
try {
|
|
@@ -1576,167 +1576,167 @@ function ce(a) {
|
|
|
1576
1576
|
}
|
|
1577
1577
|
return "";
|
|
1578
1578
|
}
|
|
1579
|
-
var
|
|
1580
|
-
"^" +
|
|
1579
|
+
var di = /[\\^$.*+?()[\]{}|]/g, pi = /^\[object .+?Constructor\]$/, ui = Function.prototype, mi = Object.prototype, gi = ui.toString, fi = mi.hasOwnProperty, yi = RegExp(
|
|
1580
|
+
"^" + gi.call(fi).replace(di, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
|
|
1581
1581
|
);
|
|
1582
|
-
function
|
|
1583
|
-
if (!
|
|
1582
|
+
function wi(a) {
|
|
1583
|
+
if (!Fe(a) || li(a))
|
|
1584
1584
|
return !1;
|
|
1585
|
-
var t =
|
|
1585
|
+
var t = Mt(a) ? yi : pi;
|
|
1586
1586
|
return t.test(ce(a));
|
|
1587
1587
|
}
|
|
1588
|
-
function
|
|
1588
|
+
function vi(a, t) {
|
|
1589
1589
|
return a == null ? void 0 : a[t];
|
|
1590
1590
|
}
|
|
1591
1591
|
function de(a, t) {
|
|
1592
|
-
var e =
|
|
1593
|
-
return
|
|
1592
|
+
var e = vi(a, t);
|
|
1593
|
+
return wi(e) ? e : void 0;
|
|
1594
1594
|
}
|
|
1595
|
-
var
|
|
1595
|
+
var Be = de(ie, "WeakMap"), Xe = Object.create, Ci = /* @__PURE__ */ (function() {
|
|
1596
1596
|
function a() {
|
|
1597
1597
|
}
|
|
1598
1598
|
return function(t) {
|
|
1599
|
-
if (!
|
|
1599
|
+
if (!Fe(t))
|
|
1600
1600
|
return {};
|
|
1601
|
-
if (
|
|
1602
|
-
return
|
|
1601
|
+
if (Xe)
|
|
1602
|
+
return Xe(t);
|
|
1603
1603
|
a.prototype = t;
|
|
1604
1604
|
var e = new a();
|
|
1605
1605
|
return a.prototype = void 0, e;
|
|
1606
1606
|
};
|
|
1607
|
-
})(),
|
|
1607
|
+
})(), Je = (function() {
|
|
1608
1608
|
try {
|
|
1609
1609
|
var a = de(Object, "defineProperty");
|
|
1610
1610
|
return a({}, "", {}), a;
|
|
1611
1611
|
} catch {
|
|
1612
1612
|
}
|
|
1613
1613
|
})();
|
|
1614
|
-
function
|
|
1614
|
+
function bi(a, t) {
|
|
1615
1615
|
for (var e = -1, i = a == null ? 0 : a.length; ++e < i && t(a[e], e, a) !== !1; )
|
|
1616
1616
|
;
|
|
1617
1617
|
return a;
|
|
1618
1618
|
}
|
|
1619
|
-
var
|
|
1620
|
-
function
|
|
1619
|
+
var Pi = 9007199254740991, Li = /^(?:0|[1-9]\d*)$/;
|
|
1620
|
+
function Ei(a, t) {
|
|
1621
1621
|
var e = typeof a;
|
|
1622
|
-
return t = t ??
|
|
1622
|
+
return t = t ?? Pi, !!t && (e == "number" || e != "symbol" && Li.test(a)) && a > -1 && a % 1 == 0 && a < t;
|
|
1623
1623
|
}
|
|
1624
|
-
function
|
|
1625
|
-
t == "__proto__" &&
|
|
1624
|
+
function Mi(a, t, e) {
|
|
1625
|
+
t == "__proto__" && Je ? Je(a, t, {
|
|
1626
1626
|
configurable: !0,
|
|
1627
1627
|
enumerable: !0,
|
|
1628
1628
|
value: e,
|
|
1629
1629
|
writable: !0
|
|
1630
1630
|
}) : a[t] = e;
|
|
1631
1631
|
}
|
|
1632
|
-
function
|
|
1632
|
+
function It(a, t) {
|
|
1633
1633
|
return a === t || a !== a && t !== t;
|
|
1634
1634
|
}
|
|
1635
|
-
var
|
|
1636
|
-
function
|
|
1635
|
+
var Ii = Object.prototype, Ti = Ii.hasOwnProperty;
|
|
1636
|
+
function xi(a, t, e) {
|
|
1637
1637
|
var i = a[t];
|
|
1638
|
-
(!(
|
|
1638
|
+
(!(Ti.call(a, t) && It(i, e)) || e === void 0 && !(t in a)) && Mi(a, t, e);
|
|
1639
1639
|
}
|
|
1640
|
-
var
|
|
1641
|
-
function
|
|
1642
|
-
return typeof a == "number" && a > -1 && a % 1 == 0 && a <=
|
|
1640
|
+
var _i = 9007199254740991;
|
|
1641
|
+
function Tt(a) {
|
|
1642
|
+
return typeof a == "number" && a > -1 && a % 1 == 0 && a <= _i;
|
|
1643
1643
|
}
|
|
1644
|
-
function
|
|
1645
|
-
return a != null &&
|
|
1644
|
+
function Di(a) {
|
|
1645
|
+
return a != null && Tt(a.length) && !Mt(a);
|
|
1646
1646
|
}
|
|
1647
|
-
var
|
|
1648
|
-
function
|
|
1649
|
-
var t = a && a.constructor, e = typeof t == "function" && t.prototype ||
|
|
1647
|
+
var Si = Object.prototype;
|
|
1648
|
+
function xt(a) {
|
|
1649
|
+
var t = a && a.constructor, e = typeof t == "function" && t.prototype || Si;
|
|
1650
1650
|
return a === e;
|
|
1651
1651
|
}
|
|
1652
|
-
function
|
|
1652
|
+
function Ai(a, t) {
|
|
1653
1653
|
for (var e = -1, i = Array(a); ++e < a; )
|
|
1654
1654
|
i[e] = t(e);
|
|
1655
1655
|
return i;
|
|
1656
1656
|
}
|
|
1657
|
-
var
|
|
1658
|
-
function
|
|
1659
|
-
return
|
|
1657
|
+
var $i = "[object Arguments]";
|
|
1658
|
+
function Ze(a) {
|
|
1659
|
+
return Ie(a) && Me(a) == $i;
|
|
1660
1660
|
}
|
|
1661
|
-
var
|
|
1661
|
+
var _t = Object.prototype, ki = _t.hasOwnProperty, Oi = _t.propertyIsEnumerable, Hi = Ze(/* @__PURE__ */ (function() {
|
|
1662
1662
|
return arguments;
|
|
1663
|
-
})()) ?
|
|
1664
|
-
return
|
|
1663
|
+
})()) ? Ze : function(a) {
|
|
1664
|
+
return Ie(a) && ki.call(a, "callee") && !Oi.call(a, "callee");
|
|
1665
1665
|
};
|
|
1666
|
-
function
|
|
1666
|
+
function Fi() {
|
|
1667
1667
|
return !1;
|
|
1668
1668
|
}
|
|
1669
|
-
var
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
function
|
|
1673
|
-
return
|
|
1669
|
+
var Dt = typeof exports == "object" && exports && !exports.nodeType && exports, Qe = Dt && typeof module == "object" && module && !module.nodeType && module, Ri = Qe && Qe.exports === Dt, et = Ri ? ie.Buffer : void 0, zi = et ? et.isBuffer : void 0, St = zi || Fi, Ni = "[object Arguments]", Gi = "[object Array]", Bi = "[object Boolean]", ji = "[object Date]", Yi = "[object Error]", Vi = "[object Function]", Wi = "[object Map]", Ui = "[object Number]", Ki = "[object Object]", qi = "[object RegExp]", Xi = "[object Set]", Ji = "[object String]", Zi = "[object WeakMap]", Qi = "[object ArrayBuffer]", es = "[object DataView]", ts = "[object Float32Array]", is = "[object Float64Array]", ss = "[object Int8Array]", ns = "[object Int16Array]", os = "[object Int32Array]", rs = "[object Uint8Array]", as = "[object Uint8ClampedArray]", ls = "[object Uint16Array]", hs = "[object Uint32Array]", R = {};
|
|
1670
|
+
R[ts] = R[is] = R[ss] = R[ns] = R[os] = R[rs] = R[as] = R[ls] = R[hs] = !0;
|
|
1671
|
+
R[Ni] = R[Gi] = R[Qi] = R[Bi] = R[es] = R[ji] = R[Yi] = R[Vi] = R[Wi] = R[Ui] = R[Ki] = R[qi] = R[Xi] = R[Ji] = R[Zi] = !1;
|
|
1672
|
+
function cs(a) {
|
|
1673
|
+
return Ie(a) && Tt(a.length) && !!R[Me(a)];
|
|
1674
1674
|
}
|
|
1675
|
-
function
|
|
1675
|
+
function We(a) {
|
|
1676
1676
|
return function(t) {
|
|
1677
1677
|
return a(t);
|
|
1678
1678
|
};
|
|
1679
1679
|
}
|
|
1680
|
-
var
|
|
1680
|
+
var At = typeof exports == "object" && exports && !exports.nodeType && exports, Pe = At && typeof module == "object" && module && !module.nodeType && module, ds = Pe && Pe.exports === At, Ge = ds && Lt.process, fe = (function() {
|
|
1681
1681
|
try {
|
|
1682
|
-
var a =
|
|
1683
|
-
return a ||
|
|
1682
|
+
var a = Pe && Pe.require && Pe.require("util").types;
|
|
1683
|
+
return a || Ge && Ge.binding && Ge.binding("util");
|
|
1684
1684
|
} catch {
|
|
1685
1685
|
}
|
|
1686
|
-
})(),
|
|
1687
|
-
function
|
|
1688
|
-
var e =
|
|
1686
|
+
})(), tt = fe && fe.isTypedArray, ps = tt ? We(tt) : cs, us = Object.prototype, ms = us.hasOwnProperty;
|
|
1687
|
+
function gs(a, t) {
|
|
1688
|
+
var e = He(a), i = !e && Hi(a), n = !e && !i && St(a), s = !e && !i && !n && ps(a), o = e || i || n || s, r = o ? Ai(a.length, String) : [], h = r.length;
|
|
1689
1689
|
for (var c in a)
|
|
1690
|
-
|
|
1690
|
+
ms.call(a, c) && !(o && // Safari 9 has enumerable `arguments.length` in strict mode.
|
|
1691
1691
|
(c == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
|
|
1692
1692
|
n && (c == "offset" || c == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
|
|
1693
1693
|
s && (c == "buffer" || c == "byteLength" || c == "byteOffset") || // Skip index properties.
|
|
1694
|
-
|
|
1694
|
+
Ei(c, h))) && r.push(c);
|
|
1695
1695
|
return r;
|
|
1696
1696
|
}
|
|
1697
|
-
function
|
|
1697
|
+
function $t(a, t) {
|
|
1698
1698
|
return function(e) {
|
|
1699
1699
|
return a(t(e));
|
|
1700
1700
|
};
|
|
1701
1701
|
}
|
|
1702
|
-
var
|
|
1703
|
-
function
|
|
1704
|
-
if (!
|
|
1705
|
-
return
|
|
1702
|
+
var fs = $t(Object.keys, Object), ys = Object.prototype, ws = ys.hasOwnProperty;
|
|
1703
|
+
function vs(a) {
|
|
1704
|
+
if (!xt(a))
|
|
1705
|
+
return fs(a);
|
|
1706
1706
|
var t = [];
|
|
1707
1707
|
for (var e in Object(a))
|
|
1708
|
-
|
|
1708
|
+
ws.call(a, e) && e != "constructor" && t.push(e);
|
|
1709
1709
|
return t;
|
|
1710
1710
|
}
|
|
1711
|
-
function
|
|
1712
|
-
return
|
|
1711
|
+
function Cs(a) {
|
|
1712
|
+
return Di(a) ? gs(a) : vs(a);
|
|
1713
1713
|
}
|
|
1714
|
-
var
|
|
1715
|
-
function
|
|
1716
|
-
this.__data__ =
|
|
1714
|
+
var Le = de(Object, "create");
|
|
1715
|
+
function bs() {
|
|
1716
|
+
this.__data__ = Le ? Le(null) : {}, this.size = 0;
|
|
1717
1717
|
}
|
|
1718
|
-
function
|
|
1718
|
+
function Ps(a) {
|
|
1719
1719
|
var t = this.has(a) && delete this.__data__[a];
|
|
1720
1720
|
return this.size -= t ? 1 : 0, t;
|
|
1721
1721
|
}
|
|
1722
|
-
var
|
|
1723
|
-
function
|
|
1722
|
+
var Ls = "__lodash_hash_undefined__", Es = Object.prototype, Ms = Es.hasOwnProperty;
|
|
1723
|
+
function Is(a) {
|
|
1724
1724
|
var t = this.__data__;
|
|
1725
|
-
if (
|
|
1725
|
+
if (Le) {
|
|
1726
1726
|
var e = t[a];
|
|
1727
|
-
return e ===
|
|
1727
|
+
return e === Ls ? void 0 : e;
|
|
1728
1728
|
}
|
|
1729
|
-
return
|
|
1729
|
+
return Ms.call(t, a) ? t[a] : void 0;
|
|
1730
1730
|
}
|
|
1731
|
-
var
|
|
1732
|
-
function
|
|
1731
|
+
var Ts = Object.prototype, xs = Ts.hasOwnProperty;
|
|
1732
|
+
function _s(a) {
|
|
1733
1733
|
var t = this.__data__;
|
|
1734
|
-
return
|
|
1734
|
+
return Le ? t[a] !== void 0 : xs.call(t, a);
|
|
1735
1735
|
}
|
|
1736
|
-
var
|
|
1737
|
-
function
|
|
1736
|
+
var Ds = "__lodash_hash_undefined__";
|
|
1737
|
+
function Ss(a, t) {
|
|
1738
1738
|
var e = this.__data__;
|
|
1739
|
-
return this.size += this.has(a) ? 0 : 1, e[a] =
|
|
1739
|
+
return this.size += this.has(a) ? 0 : 1, e[a] = Le && t === void 0 ? Ds : t, this;
|
|
1740
1740
|
}
|
|
1741
1741
|
function he(a) {
|
|
1742
1742
|
var t = -1, e = a == null ? 0 : a.length;
|
|
@@ -1745,37 +1745,37 @@ function he(a) {
|
|
|
1745
1745
|
this.set(i[0], i[1]);
|
|
1746
1746
|
}
|
|
1747
1747
|
}
|
|
1748
|
-
he.prototype.clear =
|
|
1749
|
-
he.prototype.delete =
|
|
1750
|
-
he.prototype.get =
|
|
1751
|
-
he.prototype.has =
|
|
1752
|
-
he.prototype.set =
|
|
1753
|
-
function
|
|
1748
|
+
he.prototype.clear = bs;
|
|
1749
|
+
he.prototype.delete = Ps;
|
|
1750
|
+
he.prototype.get = Is;
|
|
1751
|
+
he.prototype.has = _s;
|
|
1752
|
+
he.prototype.set = Ss;
|
|
1753
|
+
function As() {
|
|
1754
1754
|
this.__data__ = [], this.size = 0;
|
|
1755
1755
|
}
|
|
1756
|
-
function
|
|
1756
|
+
function Re(a, t) {
|
|
1757
1757
|
for (var e = a.length; e--; )
|
|
1758
|
-
if (
|
|
1758
|
+
if (It(a[e][0], t))
|
|
1759
1759
|
return e;
|
|
1760
1760
|
return -1;
|
|
1761
1761
|
}
|
|
1762
|
-
var
|
|
1763
|
-
function
|
|
1764
|
-
var t = this.__data__, e =
|
|
1762
|
+
var $s = Array.prototype, ks = $s.splice;
|
|
1763
|
+
function Os(a) {
|
|
1764
|
+
var t = this.__data__, e = Re(t, a);
|
|
1765
1765
|
if (e < 0)
|
|
1766
1766
|
return !1;
|
|
1767
1767
|
var i = t.length - 1;
|
|
1768
|
-
return e == i ? t.pop() :
|
|
1768
|
+
return e == i ? t.pop() : ks.call(t, e, 1), --this.size, !0;
|
|
1769
1769
|
}
|
|
1770
|
-
function
|
|
1771
|
-
var t = this.__data__, e =
|
|
1770
|
+
function Hs(a) {
|
|
1771
|
+
var t = this.__data__, e = Re(t, a);
|
|
1772
1772
|
return e < 0 ? void 0 : t[e][1];
|
|
1773
1773
|
}
|
|
1774
|
-
function
|
|
1775
|
-
return
|
|
1774
|
+
function Fs(a) {
|
|
1775
|
+
return Re(this.__data__, a) > -1;
|
|
1776
1776
|
}
|
|
1777
|
-
function
|
|
1778
|
-
var e = this.__data__, i =
|
|
1777
|
+
function Rs(a, t) {
|
|
1778
|
+
var e = this.__data__, i = Re(e, a);
|
|
1779
1779
|
return i < 0 ? (++this.size, e.push([a, t])) : e[i][1] = t, this;
|
|
1780
1780
|
}
|
|
1781
1781
|
function ae(a) {
|
|
@@ -1785,265 +1785,265 @@ function ae(a) {
|
|
|
1785
1785
|
this.set(i[0], i[1]);
|
|
1786
1786
|
}
|
|
1787
1787
|
}
|
|
1788
|
-
ae.prototype.clear =
|
|
1789
|
-
ae.prototype.delete =
|
|
1790
|
-
ae.prototype.get =
|
|
1791
|
-
ae.prototype.has =
|
|
1792
|
-
ae.prototype.set =
|
|
1793
|
-
var
|
|
1794
|
-
function
|
|
1788
|
+
ae.prototype.clear = As;
|
|
1789
|
+
ae.prototype.delete = Os;
|
|
1790
|
+
ae.prototype.get = Hs;
|
|
1791
|
+
ae.prototype.has = Fs;
|
|
1792
|
+
ae.prototype.set = Rs;
|
|
1793
|
+
var Ee = de(ie, "Map");
|
|
1794
|
+
function zs() {
|
|
1795
1795
|
this.size = 0, this.__data__ = {
|
|
1796
1796
|
hash: new he(),
|
|
1797
|
-
map: new (
|
|
1797
|
+
map: new (Ee || ae)(),
|
|
1798
1798
|
string: new he()
|
|
1799
1799
|
};
|
|
1800
1800
|
}
|
|
1801
|
-
function
|
|
1801
|
+
function Ns(a) {
|
|
1802
1802
|
var t = typeof a;
|
|
1803
1803
|
return t == "string" || t == "number" || t == "symbol" || t == "boolean" ? a !== "__proto__" : a === null;
|
|
1804
1804
|
}
|
|
1805
|
-
function
|
|
1805
|
+
function ze(a, t) {
|
|
1806
1806
|
var e = a.__data__;
|
|
1807
|
-
return
|
|
1807
|
+
return Ns(t) ? e[typeof t == "string" ? "string" : "hash"] : e.map;
|
|
1808
1808
|
}
|
|
1809
|
-
function
|
|
1810
|
-
var t =
|
|
1809
|
+
function Gs(a) {
|
|
1810
|
+
var t = ze(this, a).delete(a);
|
|
1811
1811
|
return this.size -= t ? 1 : 0, t;
|
|
1812
1812
|
}
|
|
1813
|
-
function
|
|
1814
|
-
return
|
|
1813
|
+
function Bs(a) {
|
|
1814
|
+
return ze(this, a).get(a);
|
|
1815
1815
|
}
|
|
1816
|
-
function
|
|
1817
|
-
return
|
|
1816
|
+
function js(a) {
|
|
1817
|
+
return ze(this, a).has(a);
|
|
1818
1818
|
}
|
|
1819
|
-
function
|
|
1820
|
-
var e =
|
|
1819
|
+
function Ys(a, t) {
|
|
1820
|
+
var e = ze(this, a), i = e.size;
|
|
1821
1821
|
return e.set(a, t), this.size += e.size == i ? 0 : 1, this;
|
|
1822
1822
|
}
|
|
1823
|
-
function
|
|
1823
|
+
function we(a) {
|
|
1824
1824
|
var t = -1, e = a == null ? 0 : a.length;
|
|
1825
1825
|
for (this.clear(); ++t < e; ) {
|
|
1826
1826
|
var i = a[t];
|
|
1827
1827
|
this.set(i[0], i[1]);
|
|
1828
1828
|
}
|
|
1829
1829
|
}
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
function
|
|
1830
|
+
we.prototype.clear = zs;
|
|
1831
|
+
we.prototype.delete = Gs;
|
|
1832
|
+
we.prototype.get = Bs;
|
|
1833
|
+
we.prototype.has = js;
|
|
1834
|
+
we.prototype.set = Ys;
|
|
1835
|
+
function Vs(a, t) {
|
|
1836
1836
|
for (var e = -1, i = t.length, n = a.length; ++e < i; )
|
|
1837
1837
|
a[n + e] = t[e];
|
|
1838
1838
|
return a;
|
|
1839
1839
|
}
|
|
1840
|
-
var
|
|
1841
|
-
function
|
|
1840
|
+
var Ws = $t(Object.getPrototypeOf, Object);
|
|
1841
|
+
function Us() {
|
|
1842
1842
|
this.__data__ = new ae(), this.size = 0;
|
|
1843
1843
|
}
|
|
1844
|
-
function
|
|
1844
|
+
function Ks(a) {
|
|
1845
1845
|
var t = this.__data__, e = t.delete(a);
|
|
1846
1846
|
return this.size = t.size, e;
|
|
1847
1847
|
}
|
|
1848
|
-
function
|
|
1848
|
+
function qs(a) {
|
|
1849
1849
|
return this.__data__.get(a);
|
|
1850
1850
|
}
|
|
1851
|
-
function
|
|
1851
|
+
function Xs(a) {
|
|
1852
1852
|
return this.__data__.has(a);
|
|
1853
1853
|
}
|
|
1854
|
-
var
|
|
1855
|
-
function
|
|
1854
|
+
var Js = 200;
|
|
1855
|
+
function Zs(a, t) {
|
|
1856
1856
|
var e = this.__data__;
|
|
1857
1857
|
if (e instanceof ae) {
|
|
1858
1858
|
var i = e.__data__;
|
|
1859
|
-
if (!
|
|
1859
|
+
if (!Ee || i.length < Js - 1)
|
|
1860
1860
|
return i.push([a, t]), this.size = ++e.size, this;
|
|
1861
|
-
e = this.__data__ = new
|
|
1861
|
+
e = this.__data__ = new we(i);
|
|
1862
1862
|
}
|
|
1863
1863
|
return e.set(a, t), this.size = e.size, this;
|
|
1864
1864
|
}
|
|
1865
|
-
function
|
|
1865
|
+
function ve(a) {
|
|
1866
1866
|
var t = this.__data__ = new ae(a);
|
|
1867
1867
|
this.size = t.size;
|
|
1868
1868
|
}
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
var
|
|
1875
|
-
|
|
1876
|
-
function
|
|
1869
|
+
ve.prototype.clear = Us;
|
|
1870
|
+
ve.prototype.delete = Ks;
|
|
1871
|
+
ve.prototype.get = qs;
|
|
1872
|
+
ve.prototype.has = Xs;
|
|
1873
|
+
ve.prototype.set = Zs;
|
|
1874
|
+
var kt = typeof exports == "object" && exports && !exports.nodeType && exports, it = kt && typeof module == "object" && module && !module.nodeType && module, Qs = it && it.exports === kt, st = Qs ? ie.Buffer : void 0;
|
|
1875
|
+
st && st.allocUnsafe;
|
|
1876
|
+
function en(a, t) {
|
|
1877
1877
|
return a.slice();
|
|
1878
1878
|
}
|
|
1879
|
-
function
|
|
1879
|
+
function tn(a, t) {
|
|
1880
1880
|
for (var e = -1, i = a == null ? 0 : a.length, n = 0, s = []; ++e < i; ) {
|
|
1881
1881
|
var o = a[e];
|
|
1882
1882
|
t(o, e, a) && (s[n++] = o);
|
|
1883
1883
|
}
|
|
1884
1884
|
return s;
|
|
1885
1885
|
}
|
|
1886
|
-
function
|
|
1886
|
+
function sn() {
|
|
1887
1887
|
return [];
|
|
1888
1888
|
}
|
|
1889
|
-
var
|
|
1890
|
-
return a == null ? [] : (a = Object(a),
|
|
1891
|
-
return
|
|
1889
|
+
var nn = Object.prototype, on = nn.propertyIsEnumerable, nt = Object.getOwnPropertySymbols, rn = nt ? function(a) {
|
|
1890
|
+
return a == null ? [] : (a = Object(a), tn(nt(a), function(t) {
|
|
1891
|
+
return on.call(a, t);
|
|
1892
1892
|
}));
|
|
1893
|
-
} :
|
|
1894
|
-
function
|
|
1893
|
+
} : sn;
|
|
1894
|
+
function an(a, t, e) {
|
|
1895
1895
|
var i = t(a);
|
|
1896
|
-
return
|
|
1896
|
+
return He(a) ? i : Vs(i, e(a));
|
|
1897
1897
|
}
|
|
1898
|
-
function
|
|
1899
|
-
return
|
|
1898
|
+
function ln(a) {
|
|
1899
|
+
return an(a, Cs, rn);
|
|
1900
1900
|
}
|
|
1901
|
-
var
|
|
1902
|
-
(
|
|
1903
|
-
var t =
|
|
1901
|
+
var je = de(ie, "DataView"), Ye = de(ie, "Promise"), Ve = de(ie, "Set"), ot = "[object Map]", hn = "[object Object]", rt = "[object Promise]", at = "[object Set]", lt = "[object WeakMap]", ht = "[object DataView]", cn = ce(je), dn = ce(Ee), pn = ce(Ye), un = ce(Ve), mn = ce(Be), re = Me;
|
|
1902
|
+
(je && re(new je(new ArrayBuffer(1))) != ht || Ee && re(new Ee()) != ot || Ye && re(Ye.resolve()) != rt || Ve && re(new Ve()) != at || Be && re(new Be()) != lt) && (re = function(a) {
|
|
1903
|
+
var t = Me(a), e = t == hn ? a.constructor : void 0, i = e ? ce(e) : "";
|
|
1904
1904
|
if (i)
|
|
1905
1905
|
switch (i) {
|
|
1906
|
-
case
|
|
1907
|
-
return
|
|
1908
|
-
case
|
|
1909
|
-
return
|
|
1910
|
-
case
|
|
1911
|
-
return
|
|
1912
|
-
case
|
|
1913
|
-
return
|
|
1914
|
-
case
|
|
1915
|
-
return
|
|
1906
|
+
case cn:
|
|
1907
|
+
return ht;
|
|
1908
|
+
case dn:
|
|
1909
|
+
return ot;
|
|
1910
|
+
case pn:
|
|
1911
|
+
return rt;
|
|
1912
|
+
case un:
|
|
1913
|
+
return at;
|
|
1914
|
+
case mn:
|
|
1915
|
+
return lt;
|
|
1916
1916
|
}
|
|
1917
1917
|
return t;
|
|
1918
1918
|
});
|
|
1919
|
-
var
|
|
1920
|
-
function
|
|
1919
|
+
var gn = Object.prototype, fn = gn.hasOwnProperty;
|
|
1920
|
+
function yn(a) {
|
|
1921
1921
|
var t = a.length, e = new a.constructor(t);
|
|
1922
|
-
return t && typeof a[0] == "string" &&
|
|
1922
|
+
return t && typeof a[0] == "string" && fn.call(a, "index") && (e.index = a.index, e.input = a.input), e;
|
|
1923
1923
|
}
|
|
1924
|
-
var
|
|
1925
|
-
function
|
|
1924
|
+
var ct = ie.Uint8Array;
|
|
1925
|
+
function Ue(a) {
|
|
1926
1926
|
var t = new a.constructor(a.byteLength);
|
|
1927
|
-
return new
|
|
1927
|
+
return new ct(t).set(new ct(a)), t;
|
|
1928
1928
|
}
|
|
1929
|
-
function
|
|
1930
|
-
var e =
|
|
1929
|
+
function wn(a, t) {
|
|
1930
|
+
var e = Ue(a.buffer);
|
|
1931
1931
|
return new a.constructor(e, a.byteOffset, a.byteLength);
|
|
1932
1932
|
}
|
|
1933
|
-
var
|
|
1934
|
-
function
|
|
1935
|
-
var t = new a.constructor(a.source,
|
|
1933
|
+
var vn = /\w*$/;
|
|
1934
|
+
function Cn(a) {
|
|
1935
|
+
var t = new a.constructor(a.source, vn.exec(a));
|
|
1936
1936
|
return t.lastIndex = a.lastIndex, t;
|
|
1937
1937
|
}
|
|
1938
|
-
var
|
|
1939
|
-
function
|
|
1940
|
-
return
|
|
1938
|
+
var dt = ge ? ge.prototype : void 0, pt = dt ? dt.valueOf : void 0;
|
|
1939
|
+
function bn(a) {
|
|
1940
|
+
return pt ? Object(pt.call(a)) : {};
|
|
1941
1941
|
}
|
|
1942
|
-
function
|
|
1943
|
-
var e =
|
|
1942
|
+
function Pn(a, t) {
|
|
1943
|
+
var e = Ue(a.buffer);
|
|
1944
1944
|
return new a.constructor(e, a.byteOffset, a.length);
|
|
1945
1945
|
}
|
|
1946
|
-
var
|
|
1947
|
-
function
|
|
1946
|
+
var Ln = "[object Boolean]", En = "[object Date]", Mn = "[object Map]", In = "[object Number]", Tn = "[object RegExp]", xn = "[object Set]", _n = "[object String]", Dn = "[object Symbol]", Sn = "[object ArrayBuffer]", An = "[object DataView]", $n = "[object Float32Array]", kn = "[object Float64Array]", On = "[object Int8Array]", Hn = "[object Int16Array]", Fn = "[object Int32Array]", Rn = "[object Uint8Array]", zn = "[object Uint8ClampedArray]", Nn = "[object Uint16Array]", Gn = "[object Uint32Array]";
|
|
1947
|
+
function Bn(a, t, e) {
|
|
1948
1948
|
var i = a.constructor;
|
|
1949
1949
|
switch (t) {
|
|
1950
|
-
case
|
|
1951
|
-
return
|
|
1952
|
-
case
|
|
1953
|
-
case
|
|
1950
|
+
case Sn:
|
|
1951
|
+
return Ue(a);
|
|
1952
|
+
case Ln:
|
|
1953
|
+
case En:
|
|
1954
1954
|
return new i(+a);
|
|
1955
|
-
case
|
|
1956
|
-
return
|
|
1957
|
-
case
|
|
1958
|
-
case
|
|
1959
|
-
case
|
|
1960
|
-
case
|
|
1961
|
-
case
|
|
1962
|
-
case
|
|
1963
|
-
case
|
|
1964
|
-
case
|
|
1965
|
-
case
|
|
1966
|
-
return
|
|
1967
|
-
case
|
|
1955
|
+
case An:
|
|
1956
|
+
return wn(a);
|
|
1957
|
+
case $n:
|
|
1958
|
+
case kn:
|
|
1959
|
+
case On:
|
|
1960
|
+
case Hn:
|
|
1961
|
+
case Fn:
|
|
1962
|
+
case Rn:
|
|
1963
|
+
case zn:
|
|
1964
|
+
case Nn:
|
|
1965
|
+
case Gn:
|
|
1966
|
+
return Pn(a);
|
|
1967
|
+
case Mn:
|
|
1968
1968
|
return new i();
|
|
1969
|
-
case
|
|
1970
|
-
case
|
|
1969
|
+
case In:
|
|
1970
|
+
case _n:
|
|
1971
1971
|
return new i(a);
|
|
1972
|
-
case
|
|
1973
|
-
return
|
|
1974
|
-
case
|
|
1972
|
+
case Tn:
|
|
1973
|
+
return Cn(a);
|
|
1974
|
+
case xn:
|
|
1975
1975
|
return new i();
|
|
1976
|
-
case
|
|
1977
|
-
return
|
|
1976
|
+
case Dn:
|
|
1977
|
+
return bn(a);
|
|
1978
1978
|
}
|
|
1979
1979
|
}
|
|
1980
|
-
function
|
|
1981
|
-
return typeof a.constructor == "function" && !
|
|
1980
|
+
function jn(a) {
|
|
1981
|
+
return typeof a.constructor == "function" && !xt(a) ? Ci(Ws(a)) : {};
|
|
1982
1982
|
}
|
|
1983
|
-
var
|
|
1984
|
-
function
|
|
1985
|
-
return
|
|
1983
|
+
var Yn = "[object Map]";
|
|
1984
|
+
function Vn(a) {
|
|
1985
|
+
return Ie(a) && re(a) == Yn;
|
|
1986
1986
|
}
|
|
1987
|
-
var
|
|
1988
|
-
function
|
|
1989
|
-
return
|
|
1987
|
+
var ut = fe && fe.isMap, Wn = ut ? We(ut) : Vn, Un = "[object Set]";
|
|
1988
|
+
function Kn(a) {
|
|
1989
|
+
return Ie(a) && re(a) == Un;
|
|
1990
1990
|
}
|
|
1991
|
-
var
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
function
|
|
1991
|
+
var mt = fe && fe.isSet, qn = mt ? We(mt) : Kn, Ot = "[object Arguments]", Xn = "[object Array]", Jn = "[object Boolean]", Zn = "[object Date]", Qn = "[object Error]", Ht = "[object Function]", eo = "[object GeneratorFunction]", to = "[object Map]", io = "[object Number]", Ft = "[object Object]", so = "[object RegExp]", no = "[object Set]", oo = "[object String]", ro = "[object Symbol]", ao = "[object WeakMap]", lo = "[object ArrayBuffer]", ho = "[object DataView]", co = "[object Float32Array]", po = "[object Float64Array]", uo = "[object Int8Array]", mo = "[object Int16Array]", go = "[object Int32Array]", fo = "[object Uint8Array]", yo = "[object Uint8ClampedArray]", wo = "[object Uint16Array]", vo = "[object Uint32Array]", F = {};
|
|
1992
|
+
F[Ot] = F[Xn] = F[lo] = F[ho] = F[Jn] = F[Zn] = F[co] = F[po] = F[uo] = F[mo] = F[go] = F[to] = F[io] = F[Ft] = F[so] = F[no] = F[oo] = F[ro] = F[fo] = F[yo] = F[wo] = F[vo] = !0;
|
|
1993
|
+
F[Qn] = F[Ht] = F[ao] = !1;
|
|
1994
|
+
function _e(a, t, e, i, n, s) {
|
|
1995
1995
|
var o;
|
|
1996
1996
|
if (o !== void 0)
|
|
1997
1997
|
return o;
|
|
1998
|
-
if (!
|
|
1998
|
+
if (!Fe(a))
|
|
1999
1999
|
return a;
|
|
2000
|
-
var r =
|
|
2000
|
+
var r = He(a);
|
|
2001
2001
|
if (r)
|
|
2002
|
-
o =
|
|
2002
|
+
o = yn(a);
|
|
2003
2003
|
else {
|
|
2004
|
-
var
|
|
2005
|
-
if (
|
|
2006
|
-
return
|
|
2007
|
-
if (
|
|
2008
|
-
o = c ? {} :
|
|
2004
|
+
var h = re(a), c = h == Ht || h == eo;
|
|
2005
|
+
if (St(a))
|
|
2006
|
+
return en(a);
|
|
2007
|
+
if (h == Ft || h == Ot || c && !n)
|
|
2008
|
+
o = c ? {} : jn(a);
|
|
2009
2009
|
else {
|
|
2010
|
-
if (!
|
|
2010
|
+
if (!F[h])
|
|
2011
2011
|
return n ? a : {};
|
|
2012
|
-
o =
|
|
2012
|
+
o = Bn(a, h);
|
|
2013
2013
|
}
|
|
2014
2014
|
}
|
|
2015
|
-
s || (s = new
|
|
2015
|
+
s || (s = new ve());
|
|
2016
2016
|
var d = s.get(a);
|
|
2017
2017
|
if (d)
|
|
2018
2018
|
return d;
|
|
2019
|
-
s.set(a, o),
|
|
2020
|
-
o.add(
|
|
2021
|
-
}) :
|
|
2022
|
-
o.set(p,
|
|
2019
|
+
s.set(a, o), qn(a) ? a.forEach(function(g) {
|
|
2020
|
+
o.add(_e(g, t, e, g, a, s));
|
|
2021
|
+
}) : Wn(a) && a.forEach(function(g, p) {
|
|
2022
|
+
o.set(p, _e(g, t, e, p, a, s));
|
|
2023
2023
|
});
|
|
2024
|
-
var u =
|
|
2025
|
-
return
|
|
2026
|
-
m && (p = g, g = a[p]),
|
|
2024
|
+
var u = ln, m = r ? void 0 : u(a);
|
|
2025
|
+
return bi(m || a, function(g, p) {
|
|
2026
|
+
m && (p = g, g = a[p]), xi(o, p, _e(g, t, e, p, a, s));
|
|
2027
2027
|
}), o;
|
|
2028
2028
|
}
|
|
2029
|
-
var
|
|
2030
|
-
function
|
|
2031
|
-
return
|
|
2029
|
+
var Co = 1, bo = 4;
|
|
2030
|
+
function xe(a) {
|
|
2031
|
+
return _e(a, Co | bo);
|
|
2032
2032
|
}
|
|
2033
|
-
var
|
|
2034
|
-
class
|
|
2033
|
+
var Po = /* @__PURE__ */ ((a) => (a.Rotate = "rotate", a.Move = "move", a.Scale = "scale", a.MoveHeight = "moveHeight", a.Empty = "", a))(Po || {}), Lo = /* @__PURE__ */ ((a) => (a.Scale = "addScale", a.Rotate = "rotate", a.Translation = "translation", a.Remove = "removeById", a.Add = "add", a))(Lo || {});
|
|
2034
|
+
class _o {
|
|
2035
2035
|
constructor(t) {
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2036
|
+
l(this, "primitives", /* @__PURE__ */ new Map());
|
|
2037
|
+
l(this, "eventListener", /* @__PURE__ */ new Map());
|
|
2038
|
+
l(this, "Cesium");
|
|
2039
|
+
l(this, "viewer");
|
|
2040
|
+
l(this, "handler");
|
|
2041
|
+
l(this, "rotationRing");
|
|
2042
|
+
l(this, "translationSquare");
|
|
2043
|
+
l(this, "heightArrow");
|
|
2044
|
+
l(this, "editMode", "");
|
|
2045
2045
|
// 默认是移动模式
|
|
2046
|
-
|
|
2046
|
+
l(this, "dragEndCallbackMap", /* @__PURE__ */ new Map());
|
|
2047
2047
|
this.Cesium = t.Cesium, this.viewer = t.viewer, this.handler = new this.Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas);
|
|
2048
2048
|
}
|
|
2049
2049
|
/**
|
|
@@ -2069,9 +2069,9 @@ class In {
|
|
|
2069
2069
|
*/
|
|
2070
2070
|
add(t, e = !0) {
|
|
2071
2071
|
var u, m, g;
|
|
2072
|
-
const i = this.viewer, n = this.Cesium, s = n.Math.toRadians(((u = t.headingPitchRoll) == null ? void 0 : u.heading) || 0), o = n.Math.toRadians(((m = t.headingPitchRoll) == null ? void 0 : m.pitch) || 0), r = n.Math.toRadians(((g = t.headingPitchRoll) == null ? void 0 : g.roll) || 0),
|
|
2072
|
+
const i = this.viewer, n = this.Cesium, s = n.Math.toRadians(((u = t.headingPitchRoll) == null ? void 0 : u.heading) || 0), o = n.Math.toRadians(((m = t.headingPitchRoll) == null ? void 0 : m.pitch) || 0), r = n.Math.toRadians(((g = t.headingPitchRoll) == null ? void 0 : g.roll) || 0), h = new n.HeadingPitchRoll(s, o, r), c = n.Transforms.headingPitchRollToFixedFrame(
|
|
2073
2073
|
t.position,
|
|
2074
|
-
|
|
2074
|
+
h,
|
|
2075
2075
|
i.scene.globe.ellipsoid,
|
|
2076
2076
|
n.Transforms.eastNorthUpToFixedFrame,
|
|
2077
2077
|
new n.Matrix4()
|
|
@@ -2227,9 +2227,9 @@ class In {
|
|
|
2227
2227
|
*/
|
|
2228
2228
|
initEditBox(t) {
|
|
2229
2229
|
const e = this.Cesium, i = this.viewer, n = i.scene;
|
|
2230
|
-
let s = null, o = null, r = null,
|
|
2230
|
+
let s = null, o = null, r = null, h = null, c = null;
|
|
2231
2231
|
const d = () => {
|
|
2232
|
-
s = null, o = null, r = null, c = null,
|
|
2232
|
+
s = null, o = null, r = null, c = null, h = null, this.setEditMode(
|
|
2233
2233
|
""
|
|
2234
2234
|
/* Empty */
|
|
2235
2235
|
), this.unlockCamera();
|
|
@@ -2242,7 +2242,7 @@ class In {
|
|
|
2242
2242
|
);
|
|
2243
2243
|
r = this.toCartographic(p), c = g.position;
|
|
2244
2244
|
const f = n.globe.pick(i.camera.getPickRay(g.position), n);
|
|
2245
|
-
|
|
2245
|
+
h = this.toCartographic(f), this.lockCamera();
|
|
2246
2246
|
}
|
|
2247
2247
|
};
|
|
2248
2248
|
this.handler.setInputAction((m) => {
|
|
@@ -2284,7 +2284,7 @@ class In {
|
|
|
2284
2284
|
let w = 0;
|
|
2285
2285
|
if (this.editMode === "rotate") {
|
|
2286
2286
|
let y = this.calculateHeading(r, f);
|
|
2287
|
-
w = this.calculateHeading(r,
|
|
2287
|
+
w = this.calculateHeading(r, h) - y, this.rotateModel(s, o, w);
|
|
2288
2288
|
} else this.editMode === "move" ? this.moveModel(s, o, m) : this.editMode === "moveHeight" && this.moveModelHeight(s, o, m, c);
|
|
2289
2289
|
}
|
|
2290
2290
|
}, e.ScreenSpaceEventType.MOUSE_MOVE), this.handler.setInputAction(() => {
|
|
@@ -2320,7 +2320,7 @@ class In {
|
|
|
2320
2320
|
this.rotationRing && i.scene.primitives.remove(this.rotationRing);
|
|
2321
2321
|
const n = [];
|
|
2322
2322
|
for (let r = 0; r <= 360; r += 3) {
|
|
2323
|
-
const
|
|
2323
|
+
const h = Math.sin(e.Math.toRadians(r)), c = Math.cos(e.Math.toRadians(r)), d = t.boundingSphere.radius * c, u = t.boundingSphere.radius * h;
|
|
2324
2324
|
n.push(new e.Cartesian3(d, u, 0));
|
|
2325
2325
|
}
|
|
2326
2326
|
const s = new e.PolylineGeometry({
|
|
@@ -2381,7 +2381,7 @@ class In {
|
|
|
2381
2381
|
createHeightArrow(t) {
|
|
2382
2382
|
const e = this.Cesium, i = this.viewer;
|
|
2383
2383
|
this.heightArrow && i.scene.primitives.remove(this.heightArrow);
|
|
2384
|
-
let n = e.Color.GREEN, s = Math.max(t.boundingSphere.radius * 0.025, 1), o = 2 * s, r = t.boundingSphere.radius + 50,
|
|
2384
|
+
let n = e.Color.GREEN, s = Math.max(t.boundingSphere.radius * 0.025, 1), o = 2 * s, r = t.boundingSphere.radius + 50, h = r * 0.1;
|
|
2385
2385
|
const c = Math.max(t.boundingSphere.radius * 0.2, 1), d = e.CylinderGeometry.createGeometry(
|
|
2386
2386
|
new e.CylinderGeometry({
|
|
2387
2387
|
length: r,
|
|
@@ -2390,7 +2390,7 @@ class In {
|
|
|
2390
2390
|
})
|
|
2391
2391
|
), u = e.CylinderGeometry.createGeometry(
|
|
2392
2392
|
new e.CylinderGeometry({
|
|
2393
|
-
length:
|
|
2393
|
+
length: h,
|
|
2394
2394
|
topRadius: 0,
|
|
2395
2395
|
bottomRadius: o
|
|
2396
2396
|
})
|
|
@@ -2424,7 +2424,7 @@ class In {
|
|
|
2424
2424
|
translate(t, e) {
|
|
2425
2425
|
let i = this.Cesium;
|
|
2426
2426
|
const n = new i.Cartesian3();
|
|
2427
|
-
|
|
2427
|
+
He(e) ? (n.x = e[0], n.y = e[1], n.z = e[2]) : i.Cartesian3.clone(e, n);
|
|
2428
2428
|
for (let s = 0; s < t.attributes.position.values.length; s += 3)
|
|
2429
2429
|
t.attributes.position.values[s] += n.x, t.attributes.position.values[s + 1] += n.y, t.attributes.position.values[s + 2] += n.z;
|
|
2430
2430
|
}
|
|
@@ -2446,10 +2446,10 @@ class In {
|
|
|
2446
2446
|
moveModel(t, e, i) {
|
|
2447
2447
|
const n = this.Cesium, s = this.viewer, o = s.scene, r = o.globe.pick(s.camera.getPickRay(i.endPosition), o);
|
|
2448
2448
|
if (r) {
|
|
2449
|
-
const
|
|
2449
|
+
const h = n.Matrix4.getTranslation(
|
|
2450
2450
|
e,
|
|
2451
2451
|
new n.Cartesian3()
|
|
2452
|
-
), c = n.Cartographic.fromCartesian(
|
|
2452
|
+
), c = n.Cartographic.fromCartesian(h), d = n.Cartographic.fromCartesian(r), u = new n.Cartographic(
|
|
2453
2453
|
d.longitude,
|
|
2454
2454
|
d.latitude,
|
|
2455
2455
|
c.height
|
|
@@ -2474,7 +2474,7 @@ class In {
|
|
|
2474
2474
|
* @return {*}
|
|
2475
2475
|
*/
|
|
2476
2476
|
moveModelHeight(t, e, i, n) {
|
|
2477
|
-
const s = this.Cesium, o = this.viewer, r = o.scene,
|
|
2477
|
+
const s = this.Cesium, o = this.viewer, r = o.scene, h = n.y - i.endPosition.y;
|
|
2478
2478
|
if (r.globe.pick(o.camera.getPickRay(i.endPosition), r)) {
|
|
2479
2479
|
const d = s.Matrix4.getTranslation(
|
|
2480
2480
|
e,
|
|
@@ -2482,7 +2482,7 @@ class In {
|
|
|
2482
2482
|
), u = s.Cartographic.fromCartesian(d), m = new s.Cartographic(
|
|
2483
2483
|
u.longitude,
|
|
2484
2484
|
u.latitude,
|
|
2485
|
-
u.height +
|
|
2485
|
+
u.height + h * 1e-3 * Math.max(o.camera.positionCartographic.height, 1)
|
|
2486
2486
|
), g = s.Cartographic.toCartesian(m), p = s.Matrix4.getRotation(e, new s.Matrix3()), f = s.Matrix4.fromRotationTranslation(p, g);
|
|
2487
2487
|
t.modelMatrix = f, this.updatedTool(f);
|
|
2488
2488
|
let w = new s.Cartesian3(
|
|
@@ -2504,13 +2504,13 @@ class In {
|
|
|
2504
2504
|
* @return {*}
|
|
2505
2505
|
*/
|
|
2506
2506
|
rotateModel(t, e, i) {
|
|
2507
|
-
const n = this.Cesium, s = this.viewer, o = this.getModelHeadingPitchRoll(e), r = o.heading + i,
|
|
2507
|
+
const n = this.Cesium, s = this.viewer, o = this.getModelHeadingPitchRoll(e), r = o.heading + i, h = new n.HeadingPitchRoll(
|
|
2508
2508
|
r,
|
|
2509
2509
|
o.pitch,
|
|
2510
2510
|
o.roll
|
|
2511
2511
|
), c = n.Transforms.headingPitchRollToFixedFrame(
|
|
2512
2512
|
n.Matrix4.getTranslation(t.modelMatrix, new n.Cartesian3()),
|
|
2513
|
-
|
|
2513
|
+
h,
|
|
2514
2514
|
s.scene.globe.ellipsoid,
|
|
2515
2515
|
n.Transforms.eastNorthUpToFixedFrame,
|
|
2516
2516
|
new n.Matrix4()
|
|
@@ -2530,7 +2530,7 @@ class In {
|
|
|
2530
2530
|
this.handler && (this.handler.destroy(), this.handler = null);
|
|
2531
2531
|
}
|
|
2532
2532
|
}
|
|
2533
|
-
function
|
|
2533
|
+
function Do(a, t) {
|
|
2534
2534
|
const e = t.materialType || "DynamicImgMaterial" + Date.now() + Math.floor(Math.random() * 1e3);
|
|
2535
2535
|
function i(s) {
|
|
2536
2536
|
this._definitionChanged = new a.Event(), this._color = s.color, this._colorSubscription = void 0, this.color = s.color, this.duration = s.duration, this._time = Date.now();
|
|
@@ -2593,7 +2593,7 @@ function Tn(a, t) {
|
|
|
2593
2593
|
}
|
|
2594
2594
|
}), new i(t);
|
|
2595
2595
|
}
|
|
2596
|
-
function
|
|
2596
|
+
function So(a, t) {
|
|
2597
2597
|
const e = t.MaterialType || "wallType" + (/* @__PURE__ */ new Date()).getTime() + parseInt(Math.random() * 1e3 + "");
|
|
2598
2598
|
function i(s) {
|
|
2599
2599
|
this._definitionChanged = new a.Event(), this._color = void 0, this._colorSubscription = void 0, this.color = s.color, this.duration = s.duration, this._time = (/* @__PURE__ */ new Date()).getTime();
|
|
@@ -2656,11 +2656,11 @@ function xn(a, t) {
|
|
|
2656
2656
|
}
|
|
2657
2657
|
}), new i(t);
|
|
2658
2658
|
}
|
|
2659
|
-
function
|
|
2660
|
-
const e = a.Color, i = Object.defineProperties, n = a.Event, s = a.createPropertyDescriptor, o = a.Property, r = (u, m) => u === void 0 ? m : u,
|
|
2659
|
+
function Ao(a, t) {
|
|
2660
|
+
const e = a.Color, i = Object.defineProperties, n = a.Event, s = a.createPropertyDescriptor, o = a.Property, r = (u, m) => u === void 0 ? m : u, h = {};
|
|
2661
2661
|
let c = t.materialType || "PolylineFlow" + Date.now() + Math.floor(Math.random() * 1e3);
|
|
2662
2662
|
function d(u) {
|
|
2663
|
-
u = r(u,
|
|
2663
|
+
u = r(u, h), this._definitionChanged = new n(), this._color = void 0, this._colorSubscription = void 0, this.color = u.color || e.fromBytes(0, 255, 255, 255), this._duration = void 0, this._durationSubscription = void 0, this.duration = r(u.duration, 45);
|
|
2664
2664
|
}
|
|
2665
2665
|
return i(d.prototype, {
|
|
2666
2666
|
isConstant: {
|
|
@@ -2719,10 +2719,10 @@ function _n(a, t) {
|
|
|
2719
2719
|
}
|
|
2720
2720
|
}), new d(t);
|
|
2721
2721
|
}
|
|
2722
|
-
class
|
|
2722
|
+
class $o {
|
|
2723
2723
|
constructor() {
|
|
2724
|
-
|
|
2725
|
-
|
|
2724
|
+
l(this, "categoryMap", /* @__PURE__ */ new Map());
|
|
2725
|
+
l(this, "CategoryGet", {});
|
|
2726
2726
|
}
|
|
2727
2727
|
registerCategoryGet(t, e) {
|
|
2728
2728
|
if (!t) return console.warn("分类不能为空");
|
|
@@ -2816,14 +2816,14 @@ class Dn {
|
|
|
2816
2816
|
return [...this.categoryMap.keys()];
|
|
2817
2817
|
}
|
|
2818
2818
|
}
|
|
2819
|
-
class
|
|
2819
|
+
class Eo {
|
|
2820
2820
|
constructor(t) {
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
|
|
2821
|
+
l(this, "id");
|
|
2822
|
+
l(this, "entities", []);
|
|
2823
|
+
l(this, "primitives", []);
|
|
2824
|
+
l(this, "dataItem", {});
|
|
2825
|
+
l(this, "aggregator");
|
|
2826
|
+
l(this, "cardPool");
|
|
2827
2827
|
const { id: e, entities: i = [], primitives: n = [], dataItem: s = {}, aggregator: o, cardPool: r } = t;
|
|
2828
2828
|
this.id = e, this.entities = i, this.primitives = n, this.dataItem = s, this.aggregator = o, this.cardPool = r;
|
|
2829
2829
|
}
|
|
@@ -2856,22 +2856,22 @@ class bn {
|
|
|
2856
2856
|
}), this.primitives = [], e && this.aggregator && Array.isArray(this.dataItem.billboard) && this.aggregator.removePointsById([this.dataItem.id]), e && this.cardPool && this.dataItem.card && this.cardPool.removeByIds([this.dataItem.id]), this.dataItem.id;
|
|
2857
2857
|
}
|
|
2858
2858
|
}
|
|
2859
|
-
class
|
|
2859
|
+
class Mo {
|
|
2860
2860
|
constructor(t, e, i, n, s, o) {
|
|
2861
|
-
|
|
2862
|
-
|
|
2863
|
-
|
|
2864
|
-
|
|
2865
|
-
|
|
2866
|
-
|
|
2867
|
-
|
|
2861
|
+
l(this, "id");
|
|
2862
|
+
l(this, "groupMap", /* @__PURE__ */ new Map());
|
|
2863
|
+
l(this, "Cesium");
|
|
2864
|
+
l(this, "viewer");
|
|
2865
|
+
l(this, "materialManager");
|
|
2866
|
+
l(this, "aggregator");
|
|
2867
|
+
l(this, "cardPool");
|
|
2868
2868
|
this.id = t, this.Cesium = e, this.viewer = i, this.materialManager = n, this.aggregator = s, this.cardPool = o, this.aggregator.labelPool.eventBus.addListener(te.Click, {
|
|
2869
2869
|
name: "BufferedHierarchicalAggregator_maker_click",
|
|
2870
|
-
fn: (
|
|
2871
|
-
this.cardPool.showByIds([
|
|
2870
|
+
fn: (h, c) => {
|
|
2871
|
+
this.cardPool.showByIds([h.data.id]);
|
|
2872
2872
|
}
|
|
2873
2873
|
}), new e.ScreenSpaceEventHandler(i.scene.canvas).setInputAction(() => {
|
|
2874
|
-
this.cardPool.hideFilter((
|
|
2874
|
+
this.cardPool.hideFilter((h) => !h.initShow);
|
|
2875
2875
|
}, e.ScreenSpaceEventType.LEFT_CLICK);
|
|
2876
2876
|
}
|
|
2877
2877
|
/** ====== 下面是抽出的创建函数 ====== */
|
|
@@ -2902,7 +2902,7 @@ class Pn {
|
|
|
2902
2902
|
}), n = (v, C = 0) => {
|
|
2903
2903
|
const b = Number(v);
|
|
2904
2904
|
return Number.isFinite(b) ? b : C;
|
|
2905
|
-
}, s = t.positions.map((v) => n(v == null ? void 0 : v[2], 0)), o = n(t.minHeight, 0), r = n(t.maxHeight, 0),
|
|
2905
|
+
}, s = t.positions.map((v) => n(v == null ? void 0 : v[2], 0)), o = n(t.minHeight, 0), r = n(t.maxHeight, 0), h = (v) => Array.isArray(v) && v.length === t.positions.length && v.every((C) => Math.abs(n(C, 0)) < 1e-6), c = s.some((v) => Math.abs(v) > 1e-6), m = (Array.isArray(t.minimumHeights) && t.minimumHeights.length === t.positions.length && !(h(t.minimumHeights) && c) ? t.minimumHeights.map((v) => n(v, 0)) : s).map((v) => v - o), f = (Array.isArray(t.maximumHeights) && t.maximumHeights.length === t.positions.length && !(h(t.maximumHeights) && c) ? t.maximumHeights.map((v) => n(v, 0)) : s).map((v) => v + r), w = t.positions.map(
|
|
2906
2906
|
(v) => this.Cesium.Cartesian3.fromDegrees(v[0], v[1], v[2] || 0)
|
|
2907
2907
|
);
|
|
2908
2908
|
let y = {
|
|
@@ -2929,12 +2929,12 @@ class Pn {
|
|
|
2929
2929
|
let u = Array.isArray(d[0]) ? t.hierarchy.flat() : t.hole;
|
|
2930
2930
|
return this.Cesium.Cartesian3.fromDegreesArrayHeights(u.flat());
|
|
2931
2931
|
})) || [], r = new this.Cesium.PolygonHierarchy(s, o);
|
|
2932
|
-
let
|
|
2932
|
+
let h = {
|
|
2933
2933
|
...t
|
|
2934
2934
|
};
|
|
2935
|
-
return i && (
|
|
2935
|
+
return i && (h.material = i), this.viewer.entities.add({
|
|
2936
2936
|
polygon: {
|
|
2937
|
-
...
|
|
2937
|
+
...h,
|
|
2938
2938
|
hierarchy: r
|
|
2939
2939
|
// 使用构建好的 PolygonHierarchy
|
|
2940
2940
|
},
|
|
@@ -2975,19 +2975,19 @@ class Pn {
|
|
|
2975
2975
|
const i = t.id || `${Date.now()}`;
|
|
2976
2976
|
this.removeGroup(i);
|
|
2977
2977
|
const n = [], s = t.show !== !1;
|
|
2978
|
-
(t.polyline || []).forEach((
|
|
2979
|
-
const c = this.createPolyline(
|
|
2978
|
+
(t.polyline || []).forEach((h) => {
|
|
2979
|
+
const c = this.createPolyline(h, s);
|
|
2980
2980
|
c && n.push(c);
|
|
2981
|
-
}), (t.wall || []).forEach((
|
|
2982
|
-
const c = this.createWall(
|
|
2981
|
+
}), (t.wall || []).forEach((h) => {
|
|
2982
|
+
const c = this.createWall(h, s);
|
|
2983
2983
|
c && n.push(c);
|
|
2984
|
-
}), (t.polygon || []).forEach((
|
|
2985
|
-
const c = this.createPolygon(
|
|
2984
|
+
}), (t.polygon || []).forEach((h) => {
|
|
2985
|
+
const c = this.createPolygon(h, s);
|
|
2986
2986
|
c && n.push(c);
|
|
2987
2987
|
});
|
|
2988
2988
|
const o = this.createBillboardPoints(t);
|
|
2989
2989
|
o.length && e && this.aggregator.appendPoints(o, !1), this.createCard(t);
|
|
2990
|
-
const r = new
|
|
2990
|
+
const r = new Eo({
|
|
2991
2991
|
id: i,
|
|
2992
2992
|
entities: n,
|
|
2993
2993
|
primitives: [],
|
|
@@ -3036,20 +3036,20 @@ class Pn {
|
|
|
3036
3036
|
this.groupMap.forEach((t) => t.removeAll(this.viewer)), this.groupMap.clear();
|
|
3037
3037
|
}
|
|
3038
3038
|
}
|
|
3039
|
-
class
|
|
3039
|
+
class ko {
|
|
3040
3040
|
constructor(t, e, i, n, s) {
|
|
3041
|
-
|
|
3042
|
-
|
|
3043
|
-
|
|
3044
|
-
|
|
3045
|
-
|
|
3046
|
-
|
|
3041
|
+
l(this, "Cesium");
|
|
3042
|
+
l(this, "viewer");
|
|
3043
|
+
l(this, "layerMap", /* @__PURE__ */ new Map());
|
|
3044
|
+
l(this, "materialManager");
|
|
3045
|
+
l(this, "aggregator");
|
|
3046
|
+
l(this, "cardPool");
|
|
3047
3047
|
this.Cesium = t, this.viewer = e, this.materialManager = i, this.aggregator = n, this.cardPool = s;
|
|
3048
3048
|
}
|
|
3049
3049
|
addLayer(t) {
|
|
3050
3050
|
this.layerMap.has(t) || this.layerMap.set(
|
|
3051
3051
|
t,
|
|
3052
|
-
new
|
|
3052
|
+
new Mo(
|
|
3053
3053
|
t,
|
|
3054
3054
|
this.Cesium,
|
|
3055
3055
|
this.viewer,
|
|
@@ -3087,7 +3087,7 @@ class Sn {
|
|
|
3087
3087
|
(i = this.layerMap.get(t)) == null || i.removeGroups(e);
|
|
3088
3088
|
}
|
|
3089
3089
|
}
|
|
3090
|
-
function
|
|
3090
|
+
function Oo(a) {
|
|
3091
3091
|
const t = [];
|
|
3092
3092
|
return a.features.forEach((e, i) => {
|
|
3093
3093
|
if (e.geometry && e.properties) {
|
|
@@ -3164,17 +3164,17 @@ function An(a) {
|
|
|
3164
3164
|
}
|
|
3165
3165
|
}), t;
|
|
3166
3166
|
}
|
|
3167
|
-
class
|
|
3167
|
+
class Ho {
|
|
3168
3168
|
constructor(t) {
|
|
3169
|
-
|
|
3170
|
-
|
|
3169
|
+
l(this, "Cesium");
|
|
3170
|
+
l(this, "viewer");
|
|
3171
3171
|
// Cesium.Viewer
|
|
3172
|
-
|
|
3173
|
-
|
|
3174
|
-
|
|
3175
|
-
|
|
3172
|
+
l(this, "layerMap");
|
|
3173
|
+
l(this, "hideLayerMap");
|
|
3174
|
+
l(this, "entityLayerManager");
|
|
3175
|
+
l(this, "PrimitiveThemeMap");
|
|
3176
3176
|
// theme -> 合并后的 Primitive 和图元 ID 的映射
|
|
3177
|
-
|
|
3177
|
+
l(this, "materialManager");
|
|
3178
3178
|
let { Cesium: e, viewer: i, materialManager: n, entityLayerManager: s } = t;
|
|
3179
3179
|
this.Cesium = e, this.viewer = i, this.layerMap = /* @__PURE__ */ new Map(), this.PrimitiveThemeMap = /* @__PURE__ */ new Map(), this.hideLayerMap = /* @__PURE__ */ new Map(), this.materialManager = n, this.entityLayerManager = s;
|
|
3180
3180
|
}
|
|
@@ -3185,7 +3185,7 @@ class $n {
|
|
|
3185
3185
|
}
|
|
3186
3186
|
// 创建或获取 材质图元组
|
|
3187
3187
|
carateThemePrimitive(t) {
|
|
3188
|
-
let e =
|
|
3188
|
+
let e = xe(t), i = this.PrimitiveThemeMap.get(e.theme);
|
|
3189
3189
|
if (!i) {
|
|
3190
3190
|
this.initTheme(e);
|
|
3191
3191
|
let n = this.createAppearance(e);
|
|
@@ -3200,13 +3200,13 @@ class $n {
|
|
|
3200
3200
|
}
|
|
3201
3201
|
//注册主题
|
|
3202
3202
|
initTheme(t) {
|
|
3203
|
-
var n, s, o, r,
|
|
3203
|
+
var n, s, o, r, h, c, d, u, m, g, p, f;
|
|
3204
3204
|
let e = this.materialManager, i = this.Cesium;
|
|
3205
3205
|
if (t.category == "polyline") {
|
|
3206
3206
|
const w = ((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);
|
|
3207
3207
|
let y = "";
|
|
3208
3208
|
if (w) {
|
|
3209
|
-
const v = ((c = (
|
|
3209
|
+
const v = ((c = (h = t.properties) == null ? void 0 : h.lineType) == null ? void 0 : c.pattern) || [0.25, -0.125], C = ((u = (d = t.properties) == null ? void 0 : d.lineType) == null ? void 0 : u.patternLength) || 0.375;
|
|
3210
3210
|
let b = this.convertCadPatternToCesiumDash(v, C);
|
|
3211
3211
|
y = `DashedLineMaterial_pattern_${b.dashPattern}_dashLength_${b.dashLength}_color_${(m = t.properties) == null ? void 0 : m.color}`, e.has(y) || e.register({
|
|
3212
3212
|
themeKey: y,
|
|
@@ -3244,8 +3244,8 @@ class $n {
|
|
|
3244
3244
|
convertCadPatternToCesiumDash(t, e) {
|
|
3245
3245
|
const n = e / 16;
|
|
3246
3246
|
let s = [], o = 0;
|
|
3247
|
-
for (let
|
|
3248
|
-
const c = Math.floor(Math.abs(
|
|
3247
|
+
for (let h of t) {
|
|
3248
|
+
const c = Math.floor(Math.abs(h) / n), d = h >= 0 ? 1 : 0;
|
|
3249
3249
|
for (let u = 0; u < c && (s.push(d), o++, !(o >= 16)); u++)
|
|
3250
3250
|
;
|
|
3251
3251
|
if (o >= 16) break;
|
|
@@ -3254,8 +3254,8 @@ class $n {
|
|
|
3254
3254
|
s.push(0);
|
|
3255
3255
|
s.length > 16 && (s.length = 16);
|
|
3256
3256
|
let r = 0;
|
|
3257
|
-
for (let
|
|
3258
|
-
r = r << 1 | s[
|
|
3257
|
+
for (let h = 0; h < 16; h++)
|
|
3258
|
+
r = r << 1 | s[h];
|
|
3259
3259
|
return {
|
|
3260
3260
|
dashPattern: r,
|
|
3261
3261
|
dashLength: e
|
|
@@ -3266,11 +3266,11 @@ class $n {
|
|
|
3266
3266
|
const e = /* @__PURE__ */ new Map();
|
|
3267
3267
|
t.forEach((i) => {
|
|
3268
3268
|
let { layerId: n, dataList: s } = i;
|
|
3269
|
-
|
|
3270
|
-
let
|
|
3271
|
-
if (
|
|
3269
|
+
xe(s).forEach((r) => {
|
|
3270
|
+
let h = this.createGeometryInstance(r);
|
|
3271
|
+
if (h) {
|
|
3272
3272
|
let c = this.carateThemePrimitive(r);
|
|
3273
|
-
c.ids.set(r.id, r), c.geometryInstances.set(r.id,
|
|
3273
|
+
c.ids.set(r.id, r), c.geometryInstances.set(r.id, h);
|
|
3274
3274
|
const d = this.layerMap.get(n);
|
|
3275
3275
|
if (d)
|
|
3276
3276
|
d.set(r.id, r);
|
|
@@ -3301,7 +3301,7 @@ class $n {
|
|
|
3301
3301
|
createPolygon(t) {
|
|
3302
3302
|
var o;
|
|
3303
3303
|
const e = Array.isArray(t.hierarchy[0]) ? t.hierarchy.flat() : t.hierarchy, i = this.Cesium.Cartesian3.fromDegreesArrayHeights(e), n = ((o = t.holes) == null ? void 0 : o.map((r) => {
|
|
3304
|
-
let
|
|
3304
|
+
let h = Array.isArray(r[0]) ? r.flat() : r, c = this.Cesium.Cartesian3.fromDegreesArrayHeights(h.flat());
|
|
3305
3305
|
return new this.Cesium.PolygonHierarchy(c);
|
|
3306
3306
|
})) || [], s = new this.Cesium.PolygonHierarchy(i, n);
|
|
3307
3307
|
return new this.Cesium.GeometryInstance({
|
|
@@ -3324,7 +3324,7 @@ class $n {
|
|
|
3324
3324
|
}
|
|
3325
3325
|
// 更新图元
|
|
3326
3326
|
updateGeometryInstance(t) {
|
|
3327
|
-
let e =
|
|
3327
|
+
let e = xe(t);
|
|
3328
3328
|
const i = this.layerMap.get(e.layerId);
|
|
3329
3329
|
if (!i) {
|
|
3330
3330
|
console.warn(`没有找到图层 ${e.layerId}`);
|
|
@@ -3356,13 +3356,13 @@ class $n {
|
|
|
3356
3356
|
return;
|
|
3357
3357
|
}
|
|
3358
3358
|
s.forEach((r) => {
|
|
3359
|
-
let
|
|
3360
|
-
if (!
|
|
3359
|
+
let h = o.get(r);
|
|
3360
|
+
if (!h) {
|
|
3361
3361
|
console.warn(`没有找到图元 ${r} 在图层 ${n} 中`);
|
|
3362
3362
|
return;
|
|
3363
3363
|
}
|
|
3364
|
-
let c = this.PrimitiveThemeMap.get(
|
|
3365
|
-
c && (c.geometryInstances.delete(
|
|
3364
|
+
let c = this.PrimitiveThemeMap.get(h.theme);
|
|
3365
|
+
c && (c.geometryInstances.delete(h.id), c.ids.delete(h.id), e.add(h));
|
|
3366
3366
|
});
|
|
3367
3367
|
}), Array.from(e.values()).forEach((i) => {
|
|
3368
3368
|
this.updatePrimitive(i);
|
|
@@ -3370,7 +3370,7 @@ class $n {
|
|
|
3370
3370
|
}
|
|
3371
3371
|
// 添加图元
|
|
3372
3372
|
addGeometryInstance(t) {
|
|
3373
|
-
let e =
|
|
3373
|
+
let e = xe(t);
|
|
3374
3374
|
const i = this.layerMap.get(e.layerId);
|
|
3375
3375
|
if (!i) {
|
|
3376
3376
|
console.warn(`没有找到图层 ${e.layerId}`);
|
|
@@ -3426,8 +3426,8 @@ class $n {
|
|
|
3426
3426
|
let { layerId: n, ids: s } = i, o = this.hideLayerMap.get(n);
|
|
3427
3427
|
o || (o = /* @__PURE__ */ new Set(), this.hideLayerMap.set(n, o)), s.forEach((r) => {
|
|
3428
3428
|
o.add(r);
|
|
3429
|
-
let
|
|
3430
|
-
|
|
3429
|
+
let h = this.getGeometryInstanceInfo(n, r);
|
|
3430
|
+
h && e.set(h.theme, h);
|
|
3431
3431
|
});
|
|
3432
3432
|
}), Array.from(e.values()).forEach((i) => {
|
|
3433
3433
|
this.updatePrimitive(i);
|
|
@@ -3440,8 +3440,8 @@ class $n {
|
|
|
3440
3440
|
let { layerId: n, ids: s } = i, o = this.hideLayerMap.get(n);
|
|
3441
3441
|
o || (o = /* @__PURE__ */ new Set(), this.hideLayerMap.set(n, o)), s.forEach((r) => {
|
|
3442
3442
|
o.delete(r);
|
|
3443
|
-
let
|
|
3444
|
-
|
|
3443
|
+
let h = this.getGeometryInstanceInfo(n, r);
|
|
3444
|
+
h && e.set(h.theme, h);
|
|
3445
3445
|
});
|
|
3446
3446
|
}), Array.from(e.values()).forEach((i) => {
|
|
3447
3447
|
this.updatePrimitive(i);
|
|
@@ -3484,10 +3484,10 @@ class $n {
|
|
|
3484
3484
|
console.warn(`没有找到图元的几何体 ${e}`);
|
|
3485
3485
|
return;
|
|
3486
3486
|
}
|
|
3487
|
-
const r = o.geometry,
|
|
3488
|
-
if (
|
|
3489
|
-
let c =
|
|
3490
|
-
|
|
3487
|
+
const r = o.geometry, h = r._positions || r._polygonHierarchy.positions;
|
|
3488
|
+
if (h && h.length > 0) {
|
|
3489
|
+
let c = h[0].x, d = h[0].y, u = h[0].z, m = h[0].x, g = h[0].y, p = h[0].z;
|
|
3490
|
+
h.forEach((C) => {
|
|
3491
3491
|
c = Math.min(c, C.x), d = Math.min(d, C.y), u = Math.min(u, C.z), m = Math.max(m, C.x), g = Math.max(g, C.y), p = Math.max(p, C.z);
|
|
3492
3492
|
});
|
|
3493
3493
|
const f = new this.Cesium.Cartesian3(
|
|
@@ -3509,26 +3509,32 @@ class $n {
|
|
|
3509
3509
|
console.warn(`无法获取图元 ${e} 的顶点信息`);
|
|
3510
3510
|
}
|
|
3511
3511
|
}
|
|
3512
|
-
class
|
|
3512
|
+
const $e = class $e {
|
|
3513
3513
|
constructor(t, e) {
|
|
3514
|
-
|
|
3515
|
-
|
|
3516
|
-
|
|
3517
|
-
|
|
3518
|
-
|
|
3519
|
-
|
|
3520
|
-
|
|
3521
|
-
|
|
3522
|
-
|
|
3523
|
-
|
|
3524
|
-
|
|
3525
|
-
|
|
3526
|
-
|
|
3527
|
-
|
|
3528
|
-
|
|
3529
|
-
|
|
3530
|
-
|
|
3531
|
-
|
|
3514
|
+
l(this, "Cesium");
|
|
3515
|
+
l(this, "viewer");
|
|
3516
|
+
l(this, "handler", null);
|
|
3517
|
+
l(this, "positions", []);
|
|
3518
|
+
l(this, "tempPoints", []);
|
|
3519
|
+
l(this, "segmentEntities", []);
|
|
3520
|
+
l(this, "segmentLabelIds", []);
|
|
3521
|
+
l(this, "previewEntity", null);
|
|
3522
|
+
l(this, "previewGroundEntity", null);
|
|
3523
|
+
l(this, "hoverPos", null);
|
|
3524
|
+
l(this, "htmlLabelPool", null);
|
|
3525
|
+
l(this, "totalLabelId", null);
|
|
3526
|
+
l(this, "previewLabelId", null);
|
|
3527
|
+
l(this, "labelEntity", null);
|
|
3528
|
+
l(this, "firstHeight", null);
|
|
3529
|
+
l(this, "groundLineEntities", []);
|
|
3530
|
+
l(this, "previewPos", null);
|
|
3531
|
+
l(this, "previewGroundPos", null);
|
|
3532
|
+
l(this, "tooltip", null);
|
|
3533
|
+
l(this, "moveFrameId", null);
|
|
3534
|
+
l(this, "pendingMove", null);
|
|
3535
|
+
l(this, "lastMoveKey", null);
|
|
3536
|
+
l(this, "keydownHandler", null);
|
|
3537
|
+
l(this, "contextMenuHandler", null);
|
|
3532
3538
|
this.Cesium = t, this.viewer = e;
|
|
3533
3539
|
}
|
|
3534
3540
|
start(t) {
|
|
@@ -3550,13 +3556,13 @@ class ht {
|
|
|
3550
3556
|
options: { offset: { x: 0, y: -10 } }
|
|
3551
3557
|
});
|
|
3552
3558
|
}
|
|
3553
|
-
this.handler = new e.ScreenSpaceEventHandler(i.canvas), this.handler.setInputAction((n) => {
|
|
3554
|
-
var f, w, y
|
|
3559
|
+
this.tooltip = new ye(), this.tooltip.show($e.TIP_TEXT), this._bindGlobalEvents(t, e, i), this.handler = new e.ScreenSpaceEventHandler(i.canvas), this.handler.setInputAction((n) => {
|
|
3560
|
+
var p, f, w, y;
|
|
3555
3561
|
const s = i.scene.pickPosition(n.position);
|
|
3556
3562
|
if (!s) return;
|
|
3557
|
-
const o = e.Cartographic.fromCartesian(s), r = e.Math.toDegrees(o.longitude),
|
|
3563
|
+
const o = e.Cartographic.fromCartesian(s), r = e.Math.toDegrees(o.longitude), h = e.Math.toDegrees(o.latitude);
|
|
3558
3564
|
this.positions.length === 0 && (this.firstHeight = o.height || 0);
|
|
3559
|
-
const c = e.Cartesian3.fromDegrees(r,
|
|
3565
|
+
const c = e.Cartesian3.fromDegrees(r, h, this.firstHeight || 0);
|
|
3560
3566
|
this.positions.push(c);
|
|
3561
3567
|
const d = i.entities.add({
|
|
3562
3568
|
position: c,
|
|
@@ -3567,141 +3573,189 @@ class ht {
|
|
|
3567
3573
|
}
|
|
3568
3574
|
});
|
|
3569
3575
|
this.tempPoints.push(d);
|
|
3570
|
-
const u =
|
|
3576
|
+
const u = s, m = ((f = (p = t.dashLineColor || t.lineColor || t.color || e.Color.RED).withAlpha) == null ? void 0 : f.call(p, 0.9)) || e.Color.RED, g = i.entities.add({
|
|
3571
3577
|
polyline: {
|
|
3572
|
-
positions: [
|
|
3578
|
+
positions: [u, c],
|
|
3573
3579
|
width: t.width || 3,
|
|
3574
3580
|
material: new e.PolylineDashMaterialProperty({
|
|
3575
|
-
color:
|
|
3581
|
+
color: m,
|
|
3576
3582
|
dashLength: 12,
|
|
3577
3583
|
dashPattern: 255
|
|
3578
3584
|
})
|
|
3579
3585
|
}
|
|
3580
3586
|
});
|
|
3581
|
-
if (this.groundLineEntities.push(
|
|
3582
|
-
const
|
|
3587
|
+
if (this.groundLineEntities.push(g), this.positions.length >= 2) {
|
|
3588
|
+
const v = this.positions[this.positions.length - 2], C = this.positions[this.positions.length - 1], b = e.Cartographic.fromCartesian(v), M = e.Cartographic.fromCartesian(C), P = i.entities.add({
|
|
3583
3589
|
polyline: {
|
|
3584
|
-
positions: [
|
|
3590
|
+
positions: [v, C],
|
|
3585
3591
|
width: t.width || 3,
|
|
3586
3592
|
material: t.lineColor || t.color || e.Color.YELLOW,
|
|
3587
3593
|
depthFailMaterial: new e.PolylineDashMaterialProperty({
|
|
3588
|
-
color: ((
|
|
3594
|
+
color: ((y = (w = t.dashLineColor || t.lineColor || t.color || e.Color.RED).withAlpha) == null ? void 0 : y.call(w, 0.9)) || e.Color.RED,
|
|
3589
3595
|
dashLength: 12,
|
|
3590
3596
|
dashPattern: 255
|
|
3591
3597
|
})
|
|
3592
3598
|
}
|
|
3593
3599
|
});
|
|
3594
|
-
this.segmentEntities.push(
|
|
3595
|
-
const
|
|
3596
|
-
(
|
|
3597
|
-
(
|
|
3598
|
-
(
|
|
3599
|
-
),
|
|
3600
|
-
this.segmentLabelIds.push(
|
|
3601
|
-
{ text: `${
|
|
3600
|
+
this.segmentEntities.push(P);
|
|
3601
|
+
const E = new e.EllipsoidGeodesic(b, M).surfaceDistance, I = new e.Cartesian3(
|
|
3602
|
+
(v.x + C.x) / 2,
|
|
3603
|
+
(v.y + C.y) / 2,
|
|
3604
|
+
(v.z + C.z) / 2
|
|
3605
|
+
), D = e.Cartographic.fromCartesian(I), _ = `measure_horizontal_seg_${this.segmentLabelIds.length}_${Date.now()}`;
|
|
3606
|
+
this.segmentLabelIds.push(_), this.htmlLabelPool.add(
|
|
3607
|
+
{ text: `${E.toFixed(2)} m` },
|
|
3602
3608
|
{
|
|
3603
|
-
id:
|
|
3604
|
-
lon: e.Math.toDegrees(
|
|
3605
|
-
lat: e.Math.toDegrees(
|
|
3606
|
-
height:
|
|
3609
|
+
id: _,
|
|
3610
|
+
lon: e.Math.toDegrees(D.longitude),
|
|
3611
|
+
lat: e.Math.toDegrees(D.latitude),
|
|
3612
|
+
height: D.height || this.firstHeight || 0,
|
|
3607
3613
|
theme: "measure-horizontal-seg",
|
|
3608
3614
|
show: !0
|
|
3609
3615
|
}
|
|
3610
3616
|
);
|
|
3611
3617
|
}
|
|
3612
3618
|
}, e.ScreenSpaceEventType.LEFT_CLICK), this.handler.setInputAction(() => {
|
|
3613
|
-
|
|
3614
|
-
|
|
3615
|
-
|
|
3616
|
-
|
|
3617
|
-
|
|
3618
|
-
this.
|
|
3619
|
-
|
|
3620
|
-
|
|
3621
|
-
|
|
3622
|
-
n += f.surfaceDistance;
|
|
3623
|
-
}
|
|
3624
|
-
const s = this.positions[this.positions.length - 1], o = e.Cartographic.fromCartesian(s), r = this.totalLabelId || `measure_horizontal_total_${Date.now()}`;
|
|
3625
|
-
this.totalLabelId = r, this.htmlLabelPool.add(
|
|
3626
|
-
{ text: `${n.toFixed(2)} m` },
|
|
3627
|
-
{
|
|
3628
|
-
id: r,
|
|
3629
|
-
lon: e.Math.toDegrees(o.longitude),
|
|
3630
|
-
lat: e.Math.toDegrees(o.latitude),
|
|
3631
|
-
height: o.height || this.firstHeight || 0,
|
|
3632
|
-
theme: "measure-horizontal-total",
|
|
3633
|
-
show: !0
|
|
3634
|
-
}
|
|
3635
|
-
), this.labelEntity = this.totalLabelId;
|
|
3636
|
-
const l = {
|
|
3637
|
-
entity: this.segmentEntities,
|
|
3638
|
-
label: this.labelEntity,
|
|
3639
|
-
segmentLabels: this.segmentLabelIds,
|
|
3640
|
-
positions: this.positions,
|
|
3641
|
-
distance: n,
|
|
3642
|
-
clear: () => this.clear()
|
|
3643
|
-
};
|
|
3644
|
-
(c = t.onComplete) == null || c.call(t, l);
|
|
3645
|
-
}, e.ScreenSpaceEventType.LEFT_DOUBLE_CLICK), this.handler.setInputAction((n) => {
|
|
3646
|
-
var M, P, L, E;
|
|
3647
|
-
if (this.positions.length === 0) return;
|
|
3648
|
-
const s = i.scene.pickPosition(n.endPosition);
|
|
3649
|
-
if (!s) return;
|
|
3650
|
-
this.hoverPos = s;
|
|
3651
|
-
const o = e.Cartographic.fromCartesian(s), r = e.Math.toDegrees(o.longitude), l = e.Math.toDegrees(o.latitude), c = e.Cartesian3.fromDegrees(r, l, this.firstHeight || 0);
|
|
3652
|
-
this.previewPos = c;
|
|
3653
|
-
const d = i.scene.globe.getHeight(new e.Cartographic(o.longitude, o.latitude, 0)) || 0, u = e.Cartesian3.fromDegrees(r, l, d);
|
|
3654
|
-
this.previewGroundPos = u;
|
|
3655
|
-
const m = this.positions[this.positions.length - 1], g = e.Cartographic.fromCartesian(m), p = e.Cartographic.fromCartesian(c), w = new e.EllipsoidGeodesic(g, p).surfaceDistance, y = new e.Cartesian3(
|
|
3656
|
-
(m.x + c.x) / 2,
|
|
3657
|
-
(m.y + c.y) / 2,
|
|
3658
|
-
(m.z + c.z) / 2
|
|
3659
|
-
), v = e.Cartographic.fromCartesian(y), C = this.previewLabelId || "measure_horizontal_preview";
|
|
3660
|
-
this.previewLabelId = C, this.htmlLabelPool.add(
|
|
3661
|
-
{ text: `${w.toFixed(2)} m` },
|
|
3662
|
-
{
|
|
3663
|
-
id: C,
|
|
3664
|
-
lon: e.Math.toDegrees(v.longitude),
|
|
3665
|
-
lat: e.Math.toDegrees(v.latitude),
|
|
3666
|
-
height: v.height || this.firstHeight || 0,
|
|
3667
|
-
theme: "measure-horizontal-seg",
|
|
3668
|
-
show: !0
|
|
3669
|
-
}
|
|
3670
|
-
);
|
|
3671
|
-
const b = ((P = (M = t.dashLineColor || t.lineColor || t.color || e.Color.RED).withAlpha) == null ? void 0 : P.call(M, 0.9)) || e.Color.RED;
|
|
3672
|
-
this.previewGroundEntity || (this.previewGroundEntity = i.entities.add({
|
|
3673
|
-
polyline: {
|
|
3674
|
-
positions: new e.CallbackProperty(() => !this.previewPos || !this.previewGroundPos ? [] : [this.previewGroundPos, this.previewPos], !1),
|
|
3675
|
-
width: t.width || 3,
|
|
3676
|
-
material: new e.PolylineDashMaterialProperty({
|
|
3677
|
-
color: b,
|
|
3678
|
-
dashLength: 12,
|
|
3679
|
-
dashPattern: 255
|
|
3680
|
-
})
|
|
3681
|
-
}
|
|
3682
|
-
})), this.previewEntity || (this.previewEntity = i.entities.add({
|
|
3683
|
-
polyline: {
|
|
3684
|
-
positions: new e.CallbackProperty(() => !this.previewPos || !this.positions.length ? [] : [this.positions[this.positions.length - 1], this.previewPos], !1),
|
|
3685
|
-
width: t.width || 3,
|
|
3686
|
-
material: t.lineColor || t.color || e.Color.YELLOW,
|
|
3687
|
-
depthFailMaterial: new e.PolylineDashMaterialProperty({
|
|
3688
|
-
color: ((E = (L = t.dashLineColor || t.lineColor || t.color || e.Color.RED).withAlpha) == null ? void 0 : E.call(L, 0.9)) || e.Color.RED,
|
|
3689
|
-
dashLength: 12,
|
|
3690
|
-
dashPattern: 255
|
|
3691
|
-
})
|
|
3619
|
+
this._finishMeasurement(t, e);
|
|
3620
|
+
}, e.ScreenSpaceEventType.LEFT_DOUBLE_CLICK), this.handler.setInputAction(() => {
|
|
3621
|
+
this._undoLastPoint();
|
|
3622
|
+
}, e.ScreenSpaceEventType.RIGHT_CLICK), this.handler.setInputAction((n) => {
|
|
3623
|
+
var s, o;
|
|
3624
|
+
this.pendingMove = {
|
|
3625
|
+
endPosition: {
|
|
3626
|
+
x: (s = n.endPosition) == null ? void 0 : s.x,
|
|
3627
|
+
y: (o = n.endPosition) == null ? void 0 : o.y
|
|
3692
3628
|
}
|
|
3629
|
+
}, this.moveFrameId == null && (this.moveFrameId = window.requestAnimationFrame(() => {
|
|
3630
|
+
this.moveFrameId = null;
|
|
3631
|
+
const r = this.pendingMove;
|
|
3632
|
+
if (this.pendingMove = null, !(r != null && r.endPosition)) return;
|
|
3633
|
+
const h = `${r.endPosition.x}_${r.endPosition.y}`;
|
|
3634
|
+
h !== this.lastMoveKey && (this.lastMoveKey = h, this._handlePreviewMove(r, t, e, i));
|
|
3693
3635
|
}));
|
|
3694
3636
|
}, e.ScreenSpaceEventType.MOUSE_MOVE);
|
|
3695
3637
|
}
|
|
3638
|
+
_handlePreviewMove(t, e, i, n) {
|
|
3639
|
+
var C, b, M, P;
|
|
3640
|
+
if (this.positions.length === 0) return;
|
|
3641
|
+
const s = n.scene.pickPosition(t.endPosition);
|
|
3642
|
+
if (!s) return;
|
|
3643
|
+
this.hoverPos = s;
|
|
3644
|
+
const o = i.Cartographic.fromCartesian(s), r = i.Math.toDegrees(o.longitude), h = i.Math.toDegrees(o.latitude), c = i.Cartesian3.fromDegrees(r, h, this.firstHeight || 0);
|
|
3645
|
+
this.previewPos = c, this.previewGroundPos = s;
|
|
3646
|
+
const d = this.positions[this.positions.length - 1], u = i.Cartographic.fromCartesian(d), m = i.Cartographic.fromCartesian(c), p = new i.EllipsoidGeodesic(u, m).surfaceDistance, f = new i.Cartesian3(
|
|
3647
|
+
(d.x + c.x) / 2,
|
|
3648
|
+
(d.y + c.y) / 2,
|
|
3649
|
+
(d.z + c.z) / 2
|
|
3650
|
+
), w = i.Cartographic.fromCartesian(f), y = this.previewLabelId || "measure_horizontal_preview";
|
|
3651
|
+
this.previewLabelId = y, this.htmlLabelPool.add(
|
|
3652
|
+
{ text: `${p.toFixed(2)} m` },
|
|
3653
|
+
{
|
|
3654
|
+
id: y,
|
|
3655
|
+
lon: i.Math.toDegrees(w.longitude),
|
|
3656
|
+
lat: i.Math.toDegrees(w.latitude),
|
|
3657
|
+
height: w.height || this.firstHeight || 0,
|
|
3658
|
+
theme: "measure-horizontal-seg",
|
|
3659
|
+
show: !0
|
|
3660
|
+
}
|
|
3661
|
+
);
|
|
3662
|
+
const v = ((b = (C = e.dashLineColor || e.lineColor || e.color || i.Color.RED).withAlpha) == null ? void 0 : b.call(C, 0.9)) || i.Color.RED;
|
|
3663
|
+
this.previewGroundEntity || (this.previewGroundEntity = n.entities.add({
|
|
3664
|
+
polyline: {
|
|
3665
|
+
positions: new i.CallbackProperty(() => !this.previewPos || !this.previewGroundPos ? [] : [this.previewGroundPos, this.previewPos], !1),
|
|
3666
|
+
width: e.width || 3,
|
|
3667
|
+
material: new i.PolylineDashMaterialProperty({
|
|
3668
|
+
color: v,
|
|
3669
|
+
dashLength: 12,
|
|
3670
|
+
dashPattern: 255
|
|
3671
|
+
})
|
|
3672
|
+
}
|
|
3673
|
+
})), this.previewEntity || (this.previewEntity = n.entities.add({
|
|
3674
|
+
polyline: {
|
|
3675
|
+
positions: new i.CallbackProperty(() => !this.previewPos || !this.positions.length ? [] : [this.positions[this.positions.length - 1], this.previewPos], !1),
|
|
3676
|
+
width: e.width || 3,
|
|
3677
|
+
material: e.lineColor || e.color || i.Color.YELLOW,
|
|
3678
|
+
depthFailMaterial: new i.PolylineDashMaterialProperty({
|
|
3679
|
+
color: ((P = (M = e.dashLineColor || e.lineColor || e.color || i.Color.RED).withAlpha) == null ? void 0 : P.call(M, 0.9)) || i.Color.RED,
|
|
3680
|
+
dashLength: 12,
|
|
3681
|
+
dashPattern: 255
|
|
3682
|
+
})
|
|
3683
|
+
}
|
|
3684
|
+
}));
|
|
3685
|
+
}
|
|
3686
|
+
_clearPreviewState() {
|
|
3687
|
+
this.previewLabelId && this.htmlLabelPool && (this.htmlLabelPool.removeByIds([this.previewLabelId]), this.previewLabelId = null), this.previewEntity && (this.viewer.entities.remove(this.previewEntity), this.previewEntity = null), this.previewGroundEntity && (this.viewer.entities.remove(this.previewGroundEntity), this.previewGroundEntity = null), this.previewPos = null, this.previewGroundPos = null, this.hoverPos = null;
|
|
3688
|
+
}
|
|
3689
|
+
_undoLastPoint() {
|
|
3690
|
+
if (!this.positions.length) return;
|
|
3691
|
+
this.positions.pop();
|
|
3692
|
+
const t = this.tempPoints.pop();
|
|
3693
|
+
t && this.viewer.entities.remove(t);
|
|
3694
|
+
const e = this.groundLineEntities.pop();
|
|
3695
|
+
if (e && this.viewer.entities.remove(e), this.segmentEntities.length > this.positions.length - 1) {
|
|
3696
|
+
const i = this.segmentEntities.pop();
|
|
3697
|
+
i && this.viewer.entities.remove(i);
|
|
3698
|
+
}
|
|
3699
|
+
if (this.segmentLabelIds.length > this.positions.length - 1 && this.htmlLabelPool) {
|
|
3700
|
+
const i = this.segmentLabelIds.pop();
|
|
3701
|
+
i && this.htmlLabelPool.removeByIds([i]);
|
|
3702
|
+
}
|
|
3703
|
+
if (!this.positions.length) {
|
|
3704
|
+
this.firstHeight = null, this._clearPreviewState();
|
|
3705
|
+
return;
|
|
3706
|
+
}
|
|
3707
|
+
this.totalLabelId && this.htmlLabelPool && (this.htmlLabelPool.removeByIds([this.totalLabelId]), this.totalLabelId = null), this.previewLabelId && this.htmlLabelPool && (this.htmlLabelPool.removeByIds([this.previewLabelId]), this.previewLabelId = null);
|
|
3708
|
+
}
|
|
3709
|
+
_finishMeasurement(t, e) {
|
|
3710
|
+
var h;
|
|
3711
|
+
if (this.positions.length < 2) {
|
|
3712
|
+
this.clear();
|
|
3713
|
+
return;
|
|
3714
|
+
}
|
|
3715
|
+
this.stop(), this._clearPreviewState();
|
|
3716
|
+
let i = 0;
|
|
3717
|
+
for (let c = 1; c < this.positions.length; c++) {
|
|
3718
|
+
const d = this.positions[c - 1], u = this.positions[c], m = e.Cartographic.fromCartesian(d), g = e.Cartographic.fromCartesian(u), p = new e.EllipsoidGeodesic(m, g);
|
|
3719
|
+
i += p.surfaceDistance;
|
|
3720
|
+
}
|
|
3721
|
+
const n = this.positions[this.positions.length - 1], s = e.Cartographic.fromCartesian(n), o = this.totalLabelId || `measure_horizontal_total_${Date.now()}`;
|
|
3722
|
+
this.totalLabelId = o, this.htmlLabelPool.add(
|
|
3723
|
+
{ text: `${i.toFixed(2)} m` },
|
|
3724
|
+
{
|
|
3725
|
+
id: o,
|
|
3726
|
+
lon: e.Math.toDegrees(s.longitude),
|
|
3727
|
+
lat: e.Math.toDegrees(s.latitude),
|
|
3728
|
+
height: s.height || this.firstHeight || 0,
|
|
3729
|
+
theme: "measure-horizontal-total",
|
|
3730
|
+
show: !0
|
|
3731
|
+
}
|
|
3732
|
+
), this.labelEntity = this.totalLabelId;
|
|
3733
|
+
const r = {
|
|
3734
|
+
entity: this.segmentEntities,
|
|
3735
|
+
label: this.labelEntity,
|
|
3736
|
+
segmentLabels: this.segmentLabelIds,
|
|
3737
|
+
positions: this.positions,
|
|
3738
|
+
distance: i,
|
|
3739
|
+
clear: () => this.clear()
|
|
3740
|
+
};
|
|
3741
|
+
(h = t.onComplete) == null || h.call(t, r);
|
|
3742
|
+
}
|
|
3743
|
+
_bindGlobalEvents(t, e, i) {
|
|
3744
|
+
this.keydownHandler = (n) => {
|
|
3745
|
+
n.key === "Escape" && (n.preventDefault(), this._finishMeasurement(t, e));
|
|
3746
|
+
}, window.addEventListener("keydown", this.keydownHandler), this.contextMenuHandler = (n) => {
|
|
3747
|
+
n.preventDefault();
|
|
3748
|
+
}, i.canvas.addEventListener("contextmenu", this.contextMenuHandler);
|
|
3749
|
+
}
|
|
3696
3750
|
stop() {
|
|
3697
|
-
this.handler && (this.handler.destroy(), this.handler = null);
|
|
3751
|
+
this.moveFrameId != null && (cancelAnimationFrame(this.moveFrameId), this.moveFrameId = null), this.pendingMove = null, this.lastMoveKey = null, this.keydownHandler && (window.removeEventListener("keydown", this.keydownHandler), this.keydownHandler = null), this.contextMenuHandler && (this.viewer.canvas.removeEventListener("contextmenu", this.contextMenuHandler), this.contextMenuHandler = null), this.handler && (this.handler.destroy(), this.handler = null), this.tooltip && (this.tooltip.destroy(), this.tooltip = null);
|
|
3698
3752
|
}
|
|
3699
3753
|
clear() {
|
|
3700
3754
|
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;
|
|
3701
3755
|
}
|
|
3702
3756
|
rehydrate(t, e) {
|
|
3703
3757
|
var p, f;
|
|
3704
|
-
const i = this.Cesium, n = this.viewer, s = t.options || {}, o = s.lineColor || s.color || i.Color.YELLOW, r = ((f = (p = s.dashLineColor || s.lineColor || s.color || i.Color.RED).withAlpha) == null ? void 0 : f.call(p, 0.9)) || i.Color.RED,
|
|
3758
|
+
const i = this.Cesium, n = this.viewer, s = t.options || {}, o = s.lineColor || s.color || i.Color.YELLOW, r = ((f = (p = s.dashLineColor || s.lineColor || s.color || i.Color.RED).withAlpha) == null ? void 0 : f.call(p, 0.9)) || i.Color.RED, h = s.width || 3, c = (t.positions || []).map((w) => new i.Cartesian3(w[0], w[1], w[2]));
|
|
3705
3759
|
if (!c.length) return;
|
|
3706
3760
|
if (!this.htmlLabelPool) {
|
|
3707
3761
|
const w = s.overlayContainerId || "html-label-container";
|
|
@@ -3725,7 +3779,7 @@ class ht {
|
|
|
3725
3779
|
const v = i.Cartographic.fromCartesian(w), C = i.Math.toDegrees(v.longitude), b = i.Math.toDegrees(v.latitude), M = n.scene.globe.getHeight(new i.Cartographic(v.longitude, v.latitude, 0)) || 0, P = i.Cartesian3.fromDegrees(C, b, M), L = n.entities.add({
|
|
3726
3780
|
polyline: {
|
|
3727
3781
|
positions: [P, w],
|
|
3728
|
-
width:
|
|
3782
|
+
width: h,
|
|
3729
3783
|
material: new i.PolylineDashMaterialProperty({ color: r, dashLength: 12, dashPattern: 255 })
|
|
3730
3784
|
}
|
|
3731
3785
|
});
|
|
@@ -3735,15 +3789,15 @@ class ht {
|
|
|
3735
3789
|
const y = c[w - 1], v = c[w], C = n.entities.add({
|
|
3736
3790
|
polyline: {
|
|
3737
3791
|
positions: [y, v],
|
|
3738
|
-
width:
|
|
3792
|
+
width: h,
|
|
3739
3793
|
material: o,
|
|
3740
3794
|
depthFailMaterial: new i.PolylineDashMaterialProperty({ color: r, dashLength: 12, dashPattern: 255 })
|
|
3741
3795
|
}
|
|
3742
3796
|
});
|
|
3743
3797
|
this.segmentEntities.push(C);
|
|
3744
|
-
const b = i.Cartographic.fromCartesian(y), M = i.Cartographic.fromCartesian(v), L = new i.EllipsoidGeodesic(b, M).surfaceDistance, E = new i.Cartesian3((y.x + v.x) / 2, (y.y + v.y) / 2, (y.z + v.z) / 2), I = i.Cartographic.fromCartesian(E),
|
|
3745
|
-
this.segmentLabelIds.push(
|
|
3746
|
-
id:
|
|
3798
|
+
const b = i.Cartographic.fromCartesian(y), M = i.Cartographic.fromCartesian(v), L = new i.EllipsoidGeodesic(b, M).surfaceDistance, E = new i.Cartesian3((y.x + v.x) / 2, (y.y + v.y) / 2, (y.z + v.z) / 2), I = i.Cartographic.fromCartesian(E), D = t.id + `_seg_${w - 1}`;
|
|
3799
|
+
this.segmentLabelIds.push(D), this.htmlLabelPool.add({ text: `${L.toFixed(2)} m` }, {
|
|
3800
|
+
id: D,
|
|
3747
3801
|
lon: i.Math.toDegrees(I.longitude),
|
|
3748
3802
|
lat: i.Math.toDegrees(I.latitude),
|
|
3749
3803
|
height: I.height || 0,
|
|
@@ -3768,23 +3822,25 @@ class ht {
|
|
|
3768
3822
|
style: { pointerEvents: "none", userSelect: "none", cursor: "default" }
|
|
3769
3823
|
});
|
|
3770
3824
|
}
|
|
3771
|
-
}
|
|
3772
|
-
|
|
3825
|
+
};
|
|
3826
|
+
l($e, "TIP_TEXT", "单击左键添加点,右键撤销,双击左键或Esc结束");
|
|
3827
|
+
let De = $e;
|
|
3828
|
+
class gt {
|
|
3773
3829
|
constructor(t, e) {
|
|
3774
|
-
|
|
3775
|
-
|
|
3776
|
-
|
|
3777
|
-
|
|
3778
|
-
|
|
3779
|
-
|
|
3780
|
-
|
|
3781
|
-
|
|
3782
|
-
|
|
3783
|
-
|
|
3784
|
-
|
|
3785
|
-
|
|
3786
|
-
|
|
3787
|
-
|
|
3830
|
+
l(this, "Cesium");
|
|
3831
|
+
l(this, "viewer");
|
|
3832
|
+
l(this, "handler", null);
|
|
3833
|
+
l(this, "entity", null);
|
|
3834
|
+
l(this, "labelEntity", null);
|
|
3835
|
+
l(this, "positions", []);
|
|
3836
|
+
l(this, "htmlLabelPool", null);
|
|
3837
|
+
l(this, "htmlLabelId", null);
|
|
3838
|
+
l(this, "previewLabelId", null);
|
|
3839
|
+
l(this, "baseCarto", null);
|
|
3840
|
+
l(this, "baseUp", null);
|
|
3841
|
+
l(this, "tempPoints", []);
|
|
3842
|
+
l(this, "previewPointEntity", null);
|
|
3843
|
+
l(this, "previewEntity", null);
|
|
3788
3844
|
this.Cesium = t, this.viewer = e;
|
|
3789
3845
|
}
|
|
3790
3846
|
start(t) {
|
|
@@ -3801,7 +3857,7 @@ class ct {
|
|
|
3801
3857
|
});
|
|
3802
3858
|
}
|
|
3803
3859
|
this.handler = new e.ScreenSpaceEventHandler(i.canvas), this.handler.setInputAction((n) => {
|
|
3804
|
-
var r,
|
|
3860
|
+
var r, h, c, d, u;
|
|
3805
3861
|
const s = i.camera.getPickRay(n.position);
|
|
3806
3862
|
let o = s ? i.scene.globe.pick(s, i.scene) : null;
|
|
3807
3863
|
if (o || (o = i.camera.pickEllipsoid(n.position, e.Ellipsoid.WGS84)), o || (o = i.scene.pickPosition(n.position)), !!o)
|
|
@@ -3819,7 +3875,7 @@ class ct {
|
|
|
3819
3875
|
}
|
|
3820
3876
|
});
|
|
3821
3877
|
this.tempPoints.push(p);
|
|
3822
|
-
const f = t.lineColor || t.color || e.Color.CYAN, w = ((
|
|
3878
|
+
const f = t.lineColor || t.color || e.Color.CYAN, w = ((h = (r = t.dashLineColor || t.lineColor || t.color || e.Color.RED).withAlpha) == null ? void 0 : h.call(r, 0.9)) || e.Color.RED;
|
|
3823
3879
|
this.previewEntity = i.entities.add({
|
|
3824
3880
|
polyline: {
|
|
3825
3881
|
positions: [g, g],
|
|
@@ -3838,16 +3894,16 @@ class ct {
|
|
|
3838
3894
|
if (!g) return;
|
|
3839
3895
|
const p = g.origin, f = e.Cartesian3.normalize(g.direction, new e.Cartesian3()), w = m, y = this.baseUp, v = e.Cartesian3.subtract(p, w, new e.Cartesian3()), C = e.Cartesian3.dot(f, f), b = -e.Cartesian3.dot(f, y), M = e.Cartesian3.dot(y, y), P = -e.Cartesian3.dot(f, v), L = e.Cartesian3.dot(y, v), E = C * M - b * b;
|
|
3840
3896
|
if (Math.abs(E) < 1e-6) return;
|
|
3841
|
-
const I = (C * L - b * P) / E,
|
|
3897
|
+
const I = (C * L - b * P) / E, D = e.Cartesian3.add(
|
|
3842
3898
|
w,
|
|
3843
3899
|
e.Cartesian3.multiplyByScalar(y, I, new e.Cartesian3()),
|
|
3844
3900
|
new e.Cartesian3()
|
|
3845
3901
|
);
|
|
3846
|
-
this.positions[1] =
|
|
3902
|
+
this.positions[1] = D, this.stop(), this.previewEntity && (this.viewer.entities.remove(this.previewEntity), this.previewEntity = null), this.previewPointEntity && (this.viewer.entities.remove(this.previewPointEntity), this.previewPointEntity = null);
|
|
3847
3903
|
const _ = t.lineColor || t.color || e.Color.CYAN, T = ((d = (c = t.dashLineColor || t.lineColor || t.color || e.Color.RED).withAlpha) == null ? void 0 : d.call(c, 0.9)) || e.Color.RED;
|
|
3848
3904
|
this.entity = i.entities.add({
|
|
3849
3905
|
polyline: {
|
|
3850
|
-
positions: [m,
|
|
3906
|
+
positions: [m, D],
|
|
3851
3907
|
width: t.width || 3,
|
|
3852
3908
|
material: _,
|
|
3853
3909
|
depthFailMaterial: new e.PolylineDashMaterialProperty({
|
|
@@ -3858,7 +3914,7 @@ class ct {
|
|
|
3858
3914
|
}
|
|
3859
3915
|
});
|
|
3860
3916
|
const A = i.entities.add({
|
|
3861
|
-
position:
|
|
3917
|
+
position: D,
|
|
3862
3918
|
point: {
|
|
3863
3919
|
pixelSize: 8,
|
|
3864
3920
|
color: t.pointColor || t.color || e.Color.YELLOW,
|
|
@@ -3866,20 +3922,20 @@ class ct {
|
|
|
3866
3922
|
}
|
|
3867
3923
|
});
|
|
3868
3924
|
this.tempPoints.push(A);
|
|
3869
|
-
const
|
|
3925
|
+
const S = this.baseCarto, k = e.Cartographic.fromCartesian(D), x = Math.abs((k.height || 0) - (S.height || 0)), $ = new e.Cartesian3(
|
|
3870
3926
|
(this.positions[0].x + this.positions[1].x) / 2,
|
|
3871
3927
|
(this.positions[0].y + this.positions[1].y) / 2,
|
|
3872
3928
|
(this.positions[0].z + this.positions[1].z) / 2
|
|
3873
|
-
),
|
|
3929
|
+
), H = e.Cartographic.fromCartesian($);
|
|
3874
3930
|
this.previewLabelId && this.htmlLabelPool && (this.htmlLabelPool.removeByIds([this.previewLabelId]), this.previewLabelId = null);
|
|
3875
3931
|
const z = this.htmlLabelId || `measure_vertical_${Date.now()}`;
|
|
3876
3932
|
this.htmlLabelId = z, this.htmlLabelPool.add(
|
|
3877
3933
|
{ text: `${x.toFixed(2)} m` },
|
|
3878
3934
|
{
|
|
3879
3935
|
id: z,
|
|
3880
|
-
lon: e.Math.toDegrees(
|
|
3881
|
-
lat: e.Math.toDegrees(
|
|
3882
|
-
height:
|
|
3936
|
+
lon: e.Math.toDegrees(H.longitude),
|
|
3937
|
+
lat: e.Math.toDegrees(H.latitude),
|
|
3938
|
+
height: H.height || 0,
|
|
3883
3939
|
theme: "measure-vertical",
|
|
3884
3940
|
show: !0,
|
|
3885
3941
|
style: { pointerEvents: "none", userSelect: "none", cursor: "default" }
|
|
@@ -3895,7 +3951,7 @@ class ct {
|
|
|
3895
3951
|
(u = t.onComplete) == null || u.call(t, G);
|
|
3896
3952
|
}
|
|
3897
3953
|
}, e.ScreenSpaceEventType.LEFT_CLICK), this.handler.setInputAction((n) => {
|
|
3898
|
-
var
|
|
3954
|
+
var D, _;
|
|
3899
3955
|
if (this.positions.length < 1) return;
|
|
3900
3956
|
if (!this.baseCarto || !this.baseUp) {
|
|
3901
3957
|
const T = e.Cartographic.fromCartesian(this.positions[0]);
|
|
@@ -3903,7 +3959,7 @@ class ct {
|
|
|
3903
3959
|
}
|
|
3904
3960
|
const s = this.positions[0], o = i.camera.getPickRay(n.endPosition);
|
|
3905
3961
|
if (!o) return;
|
|
3906
|
-
const r = o.origin,
|
|
3962
|
+
const r = o.origin, h = e.Cartesian3.normalize(o.direction, new e.Cartesian3()), c = s, d = this.baseUp, u = e.Cartesian3.subtract(r, c, new e.Cartesian3()), m = e.Cartesian3.dot(h, h), g = -e.Cartesian3.dot(h, d), p = e.Cartesian3.dot(d, d), f = -e.Cartesian3.dot(h, u), w = e.Cartesian3.dot(d, u), y = m * p - g * g;
|
|
3907
3963
|
if (Math.abs(y) < 1e-6) return;
|
|
3908
3964
|
const v = (m * w - g * f) / y, C = e.Cartesian3.add(
|
|
3909
3965
|
c,
|
|
@@ -3911,7 +3967,7 @@ class ct {
|
|
|
3911
3967
|
new e.Cartesian3()
|
|
3912
3968
|
);
|
|
3913
3969
|
if (this.positions[1] = C, !this.previewEntity) {
|
|
3914
|
-
const T = t.lineColor || t.color || e.Color.CYAN, A = ((_ = (
|
|
3970
|
+
const T = t.lineColor || t.color || e.Color.CYAN, A = ((_ = (D = t.dashLineColor || t.lineColor || t.color || e.Color.RED).withAlpha) == null ? void 0 : _.call(D, 0.9)) || e.Color.RED;
|
|
3915
3971
|
this.previewEntity = i.entities.add({
|
|
3916
3972
|
polyline: {
|
|
3917
3973
|
positions: new e.CallbackProperty(() => this.positions.length < 2 ? [] : [this.positions[0], this.positions[1]], !1),
|
|
@@ -3960,7 +4016,7 @@ class ct {
|
|
|
3960
4016
|
}
|
|
3961
4017
|
rehydrate(t, e) {
|
|
3962
4018
|
var b, M;
|
|
3963
|
-
const i = this.Cesium, n = this.viewer, s = t.options || {}, o = s.lineColor || s.color || i.Color.CYAN, r = ((M = (b = s.dashLineColor || s.lineColor || s.color || i.Color.RED).withAlpha) == null ? void 0 : M.call(b, 0.9)) || i.Color.RED,
|
|
4019
|
+
const i = this.Cesium, n = this.viewer, s = t.options || {}, o = s.lineColor || s.color || i.Color.CYAN, r = ((M = (b = s.dashLineColor || s.lineColor || s.color || i.Color.RED).withAlpha) == null ? void 0 : M.call(b, 0.9)) || i.Color.RED, h = s.width || 3, c = (t.positions || []).map((P) => new i.Cartesian3(P[0], P[1], P[2]));
|
|
3964
4020
|
if (c.length < 2) return;
|
|
3965
4021
|
if (!this.htmlLabelPool) {
|
|
3966
4022
|
const P = s.overlayContainerId || "html-label-container";
|
|
@@ -3973,7 +4029,7 @@ class ct {
|
|
|
3973
4029
|
});
|
|
3974
4030
|
}
|
|
3975
4031
|
const d = c[0], u = c[1], m = n.entities.add({ position: d, point: { pixelSize: 8, color: s.pointColor || s.color || i.Color.YELLOW, disableDepthTestDistance: Number.POSITIVE_INFINITY } }), g = n.entities.add({ position: u, point: { pixelSize: 8, color: s.pointColor || s.color || i.Color.YELLOW, disableDepthTestDistance: Number.POSITIVE_INFINITY } });
|
|
3976
|
-
this.tempPoints.push(m), this.tempPoints.push(g), this.entity = n.entities.add({ polyline: { positions: [d, u], width:
|
|
4032
|
+
this.tempPoints.push(m), this.tempPoints.push(g), this.entity = n.entities.add({ polyline: { positions: [d, u], width: h, material: o, depthFailMaterial: new i.PolylineDashMaterialProperty({ color: r, dashLength: 12, dashPattern: 255 }) } });
|
|
3977
4033
|
const p = i.Cartographic.fromCartesian(d), f = i.Cartographic.fromCartesian(u), w = Math.abs((f.height || 0) - (p.height || 0)), y = new i.Cartesian3((d.x + u.x) / 2, (d.y + u.y) / 2, (d.z + u.z) / 2), v = i.Cartographic.fromCartesian(y), C = t.id + "_label";
|
|
3978
4034
|
this.htmlLabelId = C, this.htmlLabelPool.add({ text: `${w.toFixed(2)} m` }, {
|
|
3979
4035
|
id: C,
|
|
@@ -3986,29 +4042,29 @@ class ct {
|
|
|
3986
4042
|
});
|
|
3987
4043
|
}
|
|
3988
4044
|
}
|
|
3989
|
-
class
|
|
4045
|
+
class ft {
|
|
3990
4046
|
constructor(t, e) {
|
|
3991
|
-
|
|
3992
|
-
|
|
3993
|
-
|
|
3994
|
-
|
|
3995
|
-
|
|
3996
|
-
|
|
3997
|
-
|
|
3998
|
-
|
|
3999
|
-
|
|
4000
|
-
|
|
4001
|
-
|
|
4002
|
-
|
|
4003
|
-
|
|
4004
|
-
|
|
4005
|
-
|
|
4006
|
-
|
|
4007
|
-
|
|
4008
|
-
|
|
4009
|
-
|
|
4010
|
-
|
|
4011
|
-
|
|
4047
|
+
l(this, "Cesium");
|
|
4048
|
+
l(this, "viewer");
|
|
4049
|
+
l(this, "handler", null);
|
|
4050
|
+
l(this, "positions", []);
|
|
4051
|
+
l(this, "htmlLabelPool", null);
|
|
4052
|
+
l(this, "htmlLabelId", null);
|
|
4053
|
+
l(this, "segmentEntities", []);
|
|
4054
|
+
l(this, "angleMarkerEntities", []);
|
|
4055
|
+
l(this, "pointEntities", []);
|
|
4056
|
+
l(this, "segmentLabelIds", []);
|
|
4057
|
+
l(this, "angleLabelIds", []);
|
|
4058
|
+
l(this, "previewLabelId", null);
|
|
4059
|
+
l(this, "previewSegmentEntities", []);
|
|
4060
|
+
l(this, "previewAngleMarkerEntities", []);
|
|
4061
|
+
l(this, "previewPointEntity", null);
|
|
4062
|
+
l(this, "previewLow", null);
|
|
4063
|
+
l(this, "previewHigh", null);
|
|
4064
|
+
l(this, "previewThird", null);
|
|
4065
|
+
l(this, "previewMarkerP1", null);
|
|
4066
|
+
l(this, "previewMarkerP2", null);
|
|
4067
|
+
l(this, "previewMarkerCorner", null);
|
|
4012
4068
|
this.Cesium = t, this.viewer = e;
|
|
4013
4069
|
}
|
|
4014
4070
|
start(t) {
|
|
@@ -4037,7 +4093,7 @@ class dt {
|
|
|
4037
4093
|
});
|
|
4038
4094
|
}
|
|
4039
4095
|
this.handler = new e.ScreenSpaceEventHandler(i.canvas), this.handler.setInputAction((n) => {
|
|
4040
|
-
var r,
|
|
4096
|
+
var r, h, c;
|
|
4041
4097
|
const s = i.scene.pickPosition(n.position);
|
|
4042
4098
|
if (!s) return;
|
|
4043
4099
|
this.positions.push(s);
|
|
@@ -4057,7 +4113,7 @@ class dt {
|
|
|
4057
4113
|
e.Math.toDegrees(w.longitude),
|
|
4058
4114
|
e.Math.toDegrees(w.latitude),
|
|
4059
4115
|
y
|
|
4060
|
-
), C = t.lineColor || t.color || e.Color.YELLOW, b = ((
|
|
4116
|
+
), C = t.lineColor || t.color || e.Color.YELLOW, b = ((h = (r = t.dashLineColor || t.lineColor || t.color || e.Color.RED).withAlpha) == null ? void 0 : h.call(r, 0.9)) || e.Color.RED, M = i.entities.add({
|
|
4061
4117
|
polyline: {
|
|
4062
4118
|
positions: [p, v],
|
|
4063
4119
|
width: t.width || 3,
|
|
@@ -4080,30 +4136,30 @@ class dt {
|
|
|
4080
4136
|
}
|
|
4081
4137
|
});
|
|
4082
4138
|
this.segmentEntities.push(M, P, L);
|
|
4083
|
-
const E = e.Cartesian3.distance(p, v), I = e.Cartesian3.distance(v, f),
|
|
4084
|
-
this.segmentLabelIds = [$,
|
|
4085
|
-
const G = e.Cartesian3.subtract(f, p, new e.Cartesian3()), B = e.Cartesian3.subtract(v, p, new e.Cartesian3()), K = e.Cartesian3.subtract(v, f, new e.Cartesian3()), X = e.Cartesian3.subtract(p, f, new e.Cartesian3()), se = e.Cartesian3.dot(G, B), pe = Math.sqrt(e.Cartesian3.dot(G, G)) * Math.sqrt(e.Cartesian3.dot(B, B)), ue = e.Cartesian3.dot(K, X),
|
|
4086
|
-
this.angleLabelIds = [J,
|
|
4139
|
+
const E = e.Cartesian3.distance(p, v), I = e.Cartesian3.distance(v, f), D = e.Cartesian3.distance(p, f), _ = new e.Cartesian3((p.x + v.x) / 2, (p.y + v.y) / 2, (p.z + v.z) / 2), T = new e.Cartesian3((v.x + f.x) / 2, (v.y + f.y) / 2, (v.z + f.z) / 2), A = new e.Cartesian3((p.x + f.x) / 2, (p.y + f.y) / 2, (p.z + f.z) / 2), S = e.Cartographic.fromCartesian(_), k = e.Cartographic.fromCartesian(T), x = e.Cartographic.fromCartesian(A), $ = "measure_triangle_seg_v", H = "measure_triangle_seg_h", z = "measure_triangle_seg_hyp";
|
|
4140
|
+
this.segmentLabelIds = [$, H, z], this.htmlLabelPool.add({ text: `${E.toFixed(2)} m` }, { id: $, lon: e.Math.toDegrees(S.longitude), lat: e.Math.toDegrees(S.latitude), height: S.height || 0, theme: "measure-triangle-seg", show: !0, style: { pointerEvents: "none", userSelect: "none", cursor: "default" } }), this.htmlLabelPool.add({ text: `${I.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: `${D.toFixed(2)} m` }, { id: z, lon: e.Math.toDegrees(x.longitude), lat: e.Math.toDegrees(x.latitude), height: x.height || 0, theme: "measure-triangle-seg", show: !0, style: { pointerEvents: "none", userSelect: "none", cursor: "default" } });
|
|
4141
|
+
const G = e.Cartesian3.subtract(f, p, new e.Cartesian3()), B = e.Cartesian3.subtract(v, p, new e.Cartesian3()), K = e.Cartesian3.subtract(v, f, new e.Cartesian3()), X = e.Cartesian3.subtract(p, f, new e.Cartesian3()), se = e.Cartesian3.dot(G, B), pe = Math.sqrt(e.Cartesian3.dot(G, G)) * Math.sqrt(e.Cartesian3.dot(B, B)), ue = e.Cartesian3.dot(K, X), Ce = Math.sqrt(e.Cartesian3.dot(K, K)) * Math.sqrt(e.Cartesian3.dot(X, X)), j = Math.acos(Math.min(Math.max(se / (pe || 1), -1), 1)), le = Math.acos(Math.min(Math.max(ue / (Ce || 1), -1), 1)), ee = e.Cartographic.fromCartesian(p), Y = e.Cartographic.fromCartesian(f), J = "measure_triangle_angle_a", ne = "measure_triangle_angle_b";
|
|
4142
|
+
this.angleLabelIds = [J, ne], this.htmlLabelPool.add({ text: `${(j * 180 / Math.PI).toFixed(2)}°` }, { id: J, lon: e.Math.toDegrees(ee.longitude), lat: e.Math.toDegrees(ee.latitude), height: ee.height || 0, theme: "measure-triangle-angle", show: !0, style: { pointerEvents: "none", userSelect: "none", cursor: "default" } }), this.htmlLabelPool.add({ text: `${(le * 180 / Math.PI).toFixed(2)}°` }, { id: ne, 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" } });
|
|
4087
4143
|
const me = Math.max(0.01, Math.min(0.5, t.angleMarkerRatio ?? 0.2)), V = Math.min(E, I) * me;
|
|
4088
4144
|
if (E > 1e-3 && I > 1e-3) {
|
|
4089
4145
|
const q = e.Cartesian3.normalize(
|
|
4090
4146
|
e.Cartesian3.subtract(p, v, new e.Cartesian3()),
|
|
4091
4147
|
new e.Cartesian3()
|
|
4092
|
-
),
|
|
4148
|
+
), oe = e.Cartesian3.normalize(
|
|
4093
4149
|
e.Cartesian3.subtract(f, v, new e.Cartesian3()),
|
|
4094
4150
|
new e.Cartesian3()
|
|
4095
4151
|
), Z = new e.Cartesian3(
|
|
4096
4152
|
v.x + q.x * V,
|
|
4097
4153
|
v.y + q.y * V,
|
|
4098
4154
|
v.z + q.z * V
|
|
4099
|
-
),
|
|
4100
|
-
v.x +
|
|
4101
|
-
v.y +
|
|
4102
|
-
v.z +
|
|
4155
|
+
), O = new e.Cartesian3(
|
|
4156
|
+
v.x + oe.x * V,
|
|
4157
|
+
v.y + oe.y * V,
|
|
4158
|
+
v.z + oe.z * V
|
|
4103
4159
|
), U = new e.Cartesian3(
|
|
4104
|
-
v.x + q.x * V +
|
|
4105
|
-
v.y + q.y * V +
|
|
4106
|
-
v.z + q.z * V +
|
|
4160
|
+
v.x + q.x * V + oe.x * V,
|
|
4161
|
+
v.y + q.y * V + oe.y * V,
|
|
4162
|
+
v.z + q.z * V + oe.z * V
|
|
4107
4163
|
), Q = i.entities.add({
|
|
4108
4164
|
polyline: {
|
|
4109
4165
|
positions: [Z, U],
|
|
@@ -4111,21 +4167,21 @@ class dt {
|
|
|
4111
4167
|
material: C,
|
|
4112
4168
|
depthFailMaterial: new e.PolylineDashMaterialProperty({ color: b, dashLength: 12, dashPattern: 255 })
|
|
4113
4169
|
}
|
|
4114
|
-
}),
|
|
4170
|
+
}), Te = i.entities.add({
|
|
4115
4171
|
polyline: {
|
|
4116
|
-
positions: [
|
|
4172
|
+
positions: [O, U],
|
|
4117
4173
|
width: t.width || 3,
|
|
4118
4174
|
material: C,
|
|
4119
4175
|
depthFailMaterial: new e.PolylineDashMaterialProperty({ color: b, dashLength: 12, dashPattern: 255 })
|
|
4120
4176
|
}
|
|
4121
4177
|
});
|
|
4122
|
-
this.angleMarkerEntities.push(Q,
|
|
4178
|
+
this.angleMarkerEntities.push(Q, Te);
|
|
4123
4179
|
}
|
|
4124
4180
|
this.previewLabelId && this.htmlLabelPool && (this.htmlLabelPool.removeByIds([this.previewLabelId]), this.previewLabelId = null);
|
|
4125
4181
|
const W = {
|
|
4126
4182
|
entity: this.segmentEntities,
|
|
4127
4183
|
positions: [p, f, v],
|
|
4128
|
-
lengths: { vertical: E, horizontal: I, hypotenuse:
|
|
4184
|
+
lengths: { vertical: E, horizontal: I, hypotenuse: D },
|
|
4129
4185
|
angles: { acuteA: j, acuteB: le },
|
|
4130
4186
|
clear: () => this.clear()
|
|
4131
4187
|
};
|
|
@@ -4136,7 +4192,7 @@ class dt {
|
|
|
4136
4192
|
if (this.positions.length !== 1) return;
|
|
4137
4193
|
const s = i.scene.pickPosition(n.endPosition);
|
|
4138
4194
|
if (!s) return;
|
|
4139
|
-
const o = e.Cartographic.fromCartesian(this.positions[0]), r = e.Cartographic.fromCartesian(s),
|
|
4195
|
+
const o = e.Cartographic.fromCartesian(this.positions[0]), r = e.Cartographic.fromCartesian(s), h = o.height || 0, c = r.height || 0, d = h <= c ? this.positions[0] : s, u = h > c ? this.positions[0] : s, m = e.Cartographic.fromCartesian(d), g = Math.max(h, c), p = e.Cartesian3.fromDegrees(
|
|
4140
4196
|
this.Cesium.Math.toDegrees(m.longitude),
|
|
4141
4197
|
this.Cesium.Math.toDegrees(m.latitude),
|
|
4142
4198
|
g
|
|
@@ -4165,7 +4221,7 @@ class dt {
|
|
|
4165
4221
|
material: f,
|
|
4166
4222
|
depthFailMaterial: new e.PolylineDashMaterialProperty({ color: w, dashLength: 12, dashPattern: 255 })
|
|
4167
4223
|
}
|
|
4168
|
-
}),
|
|
4224
|
+
}), ne = i.entities.add({
|
|
4169
4225
|
polyline: {
|
|
4170
4226
|
positions: new e.CallbackProperty(() => !this.previewLow || !this.previewHigh ? [] : [this.previewLow, this.previewHigh], !1),
|
|
4171
4227
|
width: t.width || 3,
|
|
@@ -4173,11 +4229,11 @@ class dt {
|
|
|
4173
4229
|
depthFailMaterial: new e.PolylineDashMaterialProperty({ color: w, dashLength: 12, dashPattern: 255 })
|
|
4174
4230
|
}
|
|
4175
4231
|
});
|
|
4176
|
-
this.previewSegmentEntities.push(Y, J,
|
|
4232
|
+
this.previewSegmentEntities.push(Y, J, ne);
|
|
4177
4233
|
}
|
|
4178
|
-
const y = e.Cartesian3.distance(d, p), v = e.Cartesian3.distance(p, u), C = e.Cartesian3.distance(d, u), b = e.Cartesian3.subtract(u, d, new e.Cartesian3()), M = e.Cartesian3.subtract(p, d, new e.Cartesian3()), P = e.Cartesian3.subtract(p, u, new e.Cartesian3()), L = e.Cartesian3.subtract(d, u, new e.Cartesian3()), E = e.Cartesian3.dot(b, M), I = Math.sqrt(e.Cartesian3.dot(b, b)) * Math.sqrt(e.Cartesian3.dot(M, M)),
|
|
4179
|
-
this.segmentLabelIds.length === 0 && (this.segmentLabelIds = [K, X, se]), this.angleLabelIds.length === 0 && (this.angleLabelIds = [pe, ue]), this.htmlLabelPool.add({ text: `${y.toFixed(2)} m` }, { id: K, lon: e.Math.toDegrees($.longitude), lat: e.Math.toDegrees($.latitude), height: $.height || 0, theme: "measure-triangle-seg", show: !0, style: { pointerEvents: "none", userSelect: "none", cursor: "default" } }), this.htmlLabelPool.add({ text: `${v.toFixed(2)} m` }, { id: X, lon: e.Math.toDegrees(
|
|
4180
|
-
const
|
|
4234
|
+
const y = e.Cartesian3.distance(d, p), v = e.Cartesian3.distance(p, u), C = e.Cartesian3.distance(d, u), b = e.Cartesian3.subtract(u, d, new e.Cartesian3()), M = e.Cartesian3.subtract(p, d, new e.Cartesian3()), P = e.Cartesian3.subtract(p, u, new e.Cartesian3()), L = e.Cartesian3.subtract(d, u, new e.Cartesian3()), E = e.Cartesian3.dot(b, M), I = Math.sqrt(e.Cartesian3.dot(b, b)) * Math.sqrt(e.Cartesian3.dot(M, M)), D = e.Cartesian3.dot(P, L), _ = Math.sqrt(e.Cartesian3.dot(P, P)) * Math.sqrt(e.Cartesian3.dot(L, L)), T = Math.acos(Math.min(Math.max(E / (I || 1), -1), 1)), A = Math.acos(Math.min(Math.max(D / (_ || 1), -1), 1)), S = new e.Cartesian3((d.x + p.x) / 2, (d.y + p.y) / 2, (d.z + p.z) / 2), k = new e.Cartesian3((p.x + u.x) / 2, (p.y + u.y) / 2, (p.z + u.z) / 2), x = new e.Cartesian3((d.x + u.x) / 2, (d.y + u.y) / 2, (d.z + u.z) / 2), $ = e.Cartographic.fromCartesian(S), H = e.Cartographic.fromCartesian(k), z = e.Cartographic.fromCartesian(x), G = e.Cartographic.fromCartesian(d), B = e.Cartographic.fromCartesian(u), K = "measure_triangle_seg_v", X = "measure_triangle_seg_h", se = "measure_triangle_seg_hyp", pe = "measure_triangle_angle_a", ue = "measure_triangle_angle_b";
|
|
4235
|
+
this.segmentLabelIds.length === 0 && (this.segmentLabelIds = [K, X, se]), this.angleLabelIds.length === 0 && (this.angleLabelIds = [pe, ue]), this.htmlLabelPool.add({ text: `${y.toFixed(2)} m` }, { id: K, lon: e.Math.toDegrees($.longitude), lat: e.Math.toDegrees($.latitude), height: $.height || 0, theme: "measure-triangle-seg", show: !0, style: { pointerEvents: "none", userSelect: "none", cursor: "default" } }), this.htmlLabelPool.add({ text: `${v.toFixed(2)} m` }, { id: X, lon: e.Math.toDegrees(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: `${C.toFixed(2)} m` }, { id: se, lon: e.Math.toDegrees(z.longitude), lat: e.Math.toDegrees(z.latitude), height: z.height || 0, theme: "measure-triangle-seg", show: !0, style: { pointerEvents: "none", userSelect: "none", cursor: "default" } }), this.htmlLabelPool.add({ text: `${(T * 180 / Math.PI).toFixed(2)}°` }, { id: pe, lon: e.Math.toDegrees(G.longitude), lat: e.Math.toDegrees(G.latitude), height: G.height || 0, theme: "measure-triangle-angle", show: !0, style: { pointerEvents: "none", userSelect: "none", cursor: "default" } }), this.htmlLabelPool.add({ text: `${(A * 180 / Math.PI).toFixed(2)}°` }, { id: ue, lon: e.Math.toDegrees(B.longitude), lat: e.Math.toDegrees(B.latitude), height: B.height || 0, theme: "measure-triangle-angle", show: !0, style: { pointerEvents: "none", userSelect: "none", cursor: "default" } });
|
|
4236
|
+
const Ce = Math.max(0.01, Math.min(0.5, t.angleMarkerRatio ?? 0.2)), j = Math.min(y, v) * Ce;
|
|
4181
4237
|
if (y > 1e-3 && v > 1e-3) {
|
|
4182
4238
|
const Y = e.Cartesian3.normalize(
|
|
4183
4239
|
e.Cartesian3.subtract(d, p, new e.Cartesian3()),
|
|
@@ -4185,7 +4241,7 @@ class dt {
|
|
|
4185
4241
|
), J = e.Cartesian3.normalize(
|
|
4186
4242
|
e.Cartesian3.subtract(u, p, new e.Cartesian3()),
|
|
4187
4243
|
new e.Cartesian3()
|
|
4188
|
-
),
|
|
4244
|
+
), ne = new e.Cartesian3(
|
|
4189
4245
|
p.x + Y.x * j,
|
|
4190
4246
|
p.y + Y.y * j,
|
|
4191
4247
|
p.z + Y.z * j
|
|
@@ -4198,7 +4254,7 @@ class dt {
|
|
|
4198
4254
|
p.y + Y.y * j + J.y * j,
|
|
4199
4255
|
p.z + Y.z * j + J.z * j
|
|
4200
4256
|
);
|
|
4201
|
-
if (this.previewMarkerP1 =
|
|
4257
|
+
if (this.previewMarkerP1 = ne, this.previewMarkerP2 = me, this.previewMarkerCorner = V, !this.previewAngleMarkerEntities.length) {
|
|
4202
4258
|
const W = i.entities.add({
|
|
4203
4259
|
polyline: {
|
|
4204
4260
|
positions: new e.CallbackProperty(() => !this.previewMarkerP1 || !this.previewMarkerCorner ? [] : [this.previewMarkerP1, this.previewMarkerCorner], !1),
|
|
@@ -4226,27 +4282,27 @@ class dt {
|
|
|
4226
4282
|
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 = [];
|
|
4227
4283
|
}
|
|
4228
4284
|
rehydrate(t, e) {
|
|
4229
|
-
var q,
|
|
4230
|
-
const i = this.Cesium, n = this.viewer, s = t.options || {}, o = s.lineColor || s.color || i.Color.YELLOW, r = ((
|
|
4285
|
+
var q, oe;
|
|
4286
|
+
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, h = s.width || 3, c = (t.positions || []).map((Z) => new i.Cartesian3(Z[0], Z[1], Z[2]));
|
|
4231
4287
|
if (c.length < 2) return;
|
|
4232
4288
|
if (!this.htmlLabelPool) {
|
|
4233
4289
|
const Z = s.overlayContainerId || "html-label-container";
|
|
4234
4290
|
this.htmlLabelPool = e || new N(i, n, Z), this.htmlLabelPool.registerTheme("measure-triangle", {
|
|
4235
|
-
createElement: (
|
|
4291
|
+
createElement: (O, U) => {
|
|
4236
4292
|
var Q;
|
|
4237
|
-
|
|
4293
|
+
O.innerHTML = String(((Q = U == null ? void 0 : U.data) == null ? void 0 : Q.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";
|
|
4238
4294
|
},
|
|
4239
4295
|
options: { offset: { x: 0, y: -10 } }
|
|
4240
4296
|
}), this.htmlLabelPool.registerTheme("measure-triangle-seg", {
|
|
4241
|
-
createElement: (
|
|
4297
|
+
createElement: (O, U) => {
|
|
4242
4298
|
var Q;
|
|
4243
|
-
|
|
4299
|
+
O.innerHTML = String(((Q = U == null ? void 0 : U.data) == null ? void 0 : Q.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";
|
|
4244
4300
|
},
|
|
4245
4301
|
options: { offset: { x: 0, y: -10 } }
|
|
4246
4302
|
}), this.htmlLabelPool.registerTheme("measure-triangle-angle", {
|
|
4247
|
-
createElement: (
|
|
4303
|
+
createElement: (O, U) => {
|
|
4248
4304
|
var Q;
|
|
4249
|
-
|
|
4305
|
+
O.innerHTML = String(((Q = U == null ? void 0 : U.data) == null ? void 0 : Q.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";
|
|
4250
4306
|
},
|
|
4251
4307
|
options: { offset: { x: 0, y: -10 } }
|
|
4252
4308
|
});
|
|
@@ -4258,38 +4314,38 @@ class dt {
|
|
|
4258
4314
|
i.Math.toDegrees(v.latitude),
|
|
4259
4315
|
C
|
|
4260
4316
|
), M = n.entities.add({
|
|
4261
|
-
polyline: { positions: [p, b], width:
|
|
4317
|
+
polyline: { positions: [p, b], width: h, material: o, depthFailMaterial: new i.PolylineDashMaterialProperty({ color: r, dashLength: 12, dashPattern: 255 }) }
|
|
4262
4318
|
}), P = n.entities.add({
|
|
4263
|
-
polyline: { positions: [b, f], width:
|
|
4319
|
+
polyline: { positions: [b, f], width: h, material: o, depthFailMaterial: new i.PolylineDashMaterialProperty({ color: r, dashLength: 12, dashPattern: 255 }) }
|
|
4264
4320
|
}), L = n.entities.add({
|
|
4265
|
-
polyline: { positions: [p, f], width:
|
|
4321
|
+
polyline: { positions: [p, f], width: h, material: o, depthFailMaterial: new i.PolylineDashMaterialProperty({ color: r, dashLength: 12, dashPattern: 255 }) }
|
|
4266
4322
|
});
|
|
4267
4323
|
this.segmentEntities.push(M, P, L);
|
|
4268
|
-
const E = i.Cartesian3.distance(p, b), I = i.Cartesian3.distance(b, f),
|
|
4269
|
-
this.segmentLabelIds = [$,
|
|
4270
|
-
const G = i.Cartesian3.subtract(f, p, new i.Cartesian3()), B = i.Cartesian3.subtract(b, p, new i.Cartesian3()), K = i.Cartesian3.subtract(b, f, new i.Cartesian3()), X = i.Cartesian3.subtract(p, f, new i.Cartesian3()), se = i.Cartesian3.dot(G, B), pe = Math.sqrt(i.Cartesian3.dot(G, G)) * Math.sqrt(i.Cartesian3.dot(B, B)), ue = i.Cartesian3.dot(K, X),
|
|
4271
|
-
this.angleLabelIds = [
|
|
4324
|
+
const E = i.Cartesian3.distance(p, b), I = i.Cartesian3.distance(b, f), D = i.Cartesian3.distance(p, f), _ = new i.Cartesian3((p.x + b.x) / 2, (p.y + b.y) / 2, (p.z + b.z) / 2), T = new i.Cartesian3((b.x + f.x) / 2, (b.y + f.y) / 2, (b.z + f.z) / 2), A = new i.Cartesian3((p.x + f.x) / 2, (p.y + f.y) / 2, (p.z + f.z) / 2), S = i.Cartographic.fromCartesian(_), k = i.Cartographic.fromCartesian(T), x = i.Cartographic.fromCartesian(A), $ = t.id + "_tri_v", H = t.id + "_tri_h", z = t.id + "_tri_hyp";
|
|
4325
|
+
this.segmentLabelIds = [$, H, z], this.htmlLabelPool.add({ text: `${E.toFixed(2)} m` }, { id: $, lon: i.Math.toDegrees(S.longitude), lat: i.Math.toDegrees(S.latitude), height: S.height || 0, theme: "measure-triangle-seg", show: !0, style: { pointerEvents: "none", userSelect: "none", cursor: "default" } }), this.htmlLabelPool.add({ text: `${I.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: `${D.toFixed(2)} m` }, { id: z, lon: i.Math.toDegrees(x.longitude), lat: i.Math.toDegrees(x.latitude), height: x.height || 0, theme: "measure-triangle-seg", show: !0, style: { pointerEvents: "none", userSelect: "none", cursor: "default" } });
|
|
4326
|
+
const G = i.Cartesian3.subtract(f, p, new i.Cartesian3()), B = i.Cartesian3.subtract(b, p, new i.Cartesian3()), K = i.Cartesian3.subtract(b, f, new i.Cartesian3()), X = i.Cartesian3.subtract(p, f, new i.Cartesian3()), se = i.Cartesian3.dot(G, B), pe = Math.sqrt(i.Cartesian3.dot(G, G)) * Math.sqrt(i.Cartesian3.dot(B, B)), ue = i.Cartesian3.dot(K, X), Ce = Math.sqrt(i.Cartesian3.dot(K, K)) * Math.sqrt(i.Cartesian3.dot(X, X)), j = Math.acos(Math.min(Math.max(se / (pe || 1), -1), 1)), le = Math.acos(Math.min(Math.max(ue / (Ce || 1), -1), 1)), ee = i.Cartographic.fromCartesian(p), Y = i.Cartographic.fromCartesian(f), J = s.labelText || { angle: "角度" }, ne = t.id + "_tri_angA", me = t.id + "_tri_angB";
|
|
4327
|
+
this.angleLabelIds = [ne, me], this.htmlLabelPool.add({ text: `${J.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: `${J.angle}:${(le * 180 / Math.PI).toFixed(2)}°` }, { id: me, lon: i.Math.toDegrees(Y.longitude), lat: i.Math.toDegrees(Y.latitude), height: Y.height || 0, theme: "measure-triangle-angle", show: !0, style: { pointerEvents: "none", userSelect: "none", cursor: "default" } });
|
|
4272
4328
|
const V = Math.max(0.01, Math.min(0.5, s.angleMarkerRatio ?? 0.2)), W = Math.min(E, I) * V;
|
|
4273
4329
|
if (E > 1e-3 && I > 1e-3) {
|
|
4274
|
-
const Z = i.Cartesian3.normalize(i.Cartesian3.subtract(p, b, new i.Cartesian3()), new i.Cartesian3()),
|
|
4275
|
-
this.angleMarkerEntities.push(
|
|
4330
|
+
const Z = i.Cartesian3.normalize(i.Cartesian3.subtract(p, b, new i.Cartesian3()), new i.Cartesian3()), O = i.Cartesian3.normalize(i.Cartesian3.subtract(f, b, new i.Cartesian3()), new i.Cartesian3()), U = new i.Cartesian3(b.x + Z.x * W, b.y + Z.y * W, b.z + Z.z * W), Q = new i.Cartesian3(b.x + O.x * W, b.y + O.y * W, b.z + O.z * W), Te = new i.Cartesian3(b.x + Z.x * W + O.x * W, b.y + Z.y * W + O.y * W, b.z + Z.z * W + O.z * W), Rt = n.entities.add({ polyline: { positions: [U, Te], width: h, material: o, depthFailMaterial: new i.PolylineDashMaterialProperty({ color: r, dashLength: 12, dashPattern: 255 }) } }), zt = n.entities.add({ polyline: { positions: [Q, Te], width: h, material: o, depthFailMaterial: new i.PolylineDashMaterialProperty({ color: r, dashLength: 12, dashPattern: 255 }) } });
|
|
4331
|
+
this.angleMarkerEntities.push(Rt, zt);
|
|
4276
4332
|
}
|
|
4277
4333
|
}
|
|
4278
4334
|
}
|
|
4279
|
-
class
|
|
4335
|
+
class yt {
|
|
4280
4336
|
constructor(t, e) {
|
|
4281
|
-
|
|
4282
|
-
|
|
4283
|
-
|
|
4284
|
-
|
|
4285
|
-
|
|
4286
|
-
|
|
4287
|
-
|
|
4288
|
-
|
|
4289
|
-
|
|
4290
|
-
|
|
4291
|
-
|
|
4292
|
-
|
|
4337
|
+
l(this, "Cesium");
|
|
4338
|
+
l(this, "viewer");
|
|
4339
|
+
l(this, "handler", null);
|
|
4340
|
+
l(this, "entity", null);
|
|
4341
|
+
l(this, "labelEntity", null);
|
|
4342
|
+
l(this, "positions", []);
|
|
4343
|
+
l(this, "tempPoints", []);
|
|
4344
|
+
l(this, "htmlLabelPool", null);
|
|
4345
|
+
l(this, "htmlLabelId", null);
|
|
4346
|
+
l(this, "previewEntity", null);
|
|
4347
|
+
l(this, "previewPos", null);
|
|
4348
|
+
l(this, "previewLabelId", null);
|
|
4293
4349
|
this.Cesium = t, this.viewer = e;
|
|
4294
4350
|
}
|
|
4295
4351
|
start(t) {
|
|
@@ -4306,7 +4362,7 @@ class pt {
|
|
|
4306
4362
|
});
|
|
4307
4363
|
}
|
|
4308
4364
|
this.handler = new e.ScreenSpaceEventHandler(i.canvas), this.handler.setInputAction((n) => {
|
|
4309
|
-
var r,
|
|
4365
|
+
var r, h, c;
|
|
4310
4366
|
const s = i.scene.pickPosition(n.position);
|
|
4311
4367
|
if (!s) return;
|
|
4312
4368
|
this.positions.push(s);
|
|
@@ -4320,7 +4376,7 @@ class pt {
|
|
|
4320
4376
|
});
|
|
4321
4377
|
if (this.tempPoints.push(o), this.positions.length === 2) {
|
|
4322
4378
|
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);
|
|
4323
|
-
const d = this.positions[0], u = this.positions[1], m = t.lineColor || t.color || e.Color.YELLOW, g = ((
|
|
4379
|
+
const d = this.positions[0], u = this.positions[1], m = t.lineColor || t.color || e.Color.YELLOW, g = ((h = (r = t.dashLineColor || t.lineColor || t.color || e.Color.RED).withAlpha) == null ? void 0 : h.call(r, 0.9)) || e.Color.RED;
|
|
4324
4380
|
this.entity = i.entities.add({
|
|
4325
4381
|
polyline: {
|
|
4326
4382
|
positions: [d, u],
|
|
@@ -4361,11 +4417,11 @@ class pt {
|
|
|
4361
4417
|
const s = i.scene.pickPosition(n.endPosition);
|
|
4362
4418
|
if (!s) return;
|
|
4363
4419
|
this.previewPos = s;
|
|
4364
|
-
const o = this.positions[0], r = e.Cartesian3.distance(o, s),
|
|
4420
|
+
const o = this.positions[0], r = e.Cartesian3.distance(o, s), h = new e.Cartesian3(
|
|
4365
4421
|
(o.x + s.x) / 2,
|
|
4366
4422
|
(o.y + s.y) / 2,
|
|
4367
4423
|
(o.z + s.z) / 2
|
|
4368
|
-
), c = e.Cartographic.fromCartesian(
|
|
4424
|
+
), c = e.Cartographic.fromCartesian(h), d = this.previewLabelId || "measure_space_preview";
|
|
4369
4425
|
this.previewLabelId = d, this.htmlLabelPool.add(
|
|
4370
4426
|
{ text: `${r.toFixed(2)} m` },
|
|
4371
4427
|
{
|
|
@@ -4401,7 +4457,7 @@ class pt {
|
|
|
4401
4457
|
}
|
|
4402
4458
|
rehydrate(t, e) {
|
|
4403
4459
|
var d, u;
|
|
4404
|
-
const i = this.Cesium, n = this.viewer, s = t.options || {}, o = s.lineColor || s.color || i.Color.YELLOW, r = ((u = (d = s.dashLineColor || s.lineColor || s.color || i.Color.RED).withAlpha) == null ? void 0 : u.call(d, 0.9)) || i.Color.RED,
|
|
4460
|
+
const i = this.Cesium, n = this.viewer, s = t.options || {}, o = s.lineColor || s.color || i.Color.YELLOW, r = ((u = (d = s.dashLineColor || s.lineColor || s.color || i.Color.RED).withAlpha) == null ? void 0 : u.call(d, 0.9)) || i.Color.RED, h = s.width || 3, c = (t.positions || []).map((m) => new i.Cartesian3(m[0], m[1], m[2]));
|
|
4405
4461
|
if (c.length) {
|
|
4406
4462
|
if (!this.htmlLabelPool) {
|
|
4407
4463
|
const m = s.overlayContainerId || "html-label-container";
|
|
@@ -4422,7 +4478,7 @@ class pt {
|
|
|
4422
4478
|
this.tempPoints.push(m), this.entity = n.entities.add({
|
|
4423
4479
|
polyline: {
|
|
4424
4480
|
positions: [c[0], c[1]],
|
|
4425
|
-
width:
|
|
4481
|
+
width: h,
|
|
4426
4482
|
material: o,
|
|
4427
4483
|
depthFailMaterial: new i.PolylineDashMaterialProperty({ color: r, dashLength: 12, dashPattern: 255 })
|
|
4428
4484
|
}
|
|
@@ -4441,27 +4497,30 @@ class pt {
|
|
|
4441
4497
|
}
|
|
4442
4498
|
}
|
|
4443
4499
|
}
|
|
4444
|
-
class
|
|
4500
|
+
const ke = class ke {
|
|
4445
4501
|
constructor(t, e) {
|
|
4446
|
-
|
|
4447
|
-
|
|
4448
|
-
|
|
4449
|
-
|
|
4450
|
-
|
|
4451
|
-
|
|
4452
|
-
|
|
4453
|
-
|
|
4454
|
-
|
|
4455
|
-
|
|
4456
|
-
|
|
4457
|
-
|
|
4458
|
-
|
|
4459
|
-
|
|
4460
|
-
|
|
4461
|
-
|
|
4462
|
-
|
|
4463
|
-
|
|
4464
|
-
|
|
4502
|
+
l(this, "Cesium");
|
|
4503
|
+
l(this, "viewer");
|
|
4504
|
+
l(this, "handler", null);
|
|
4505
|
+
l(this, "entity", null);
|
|
4506
|
+
l(this, "labelEntity", null);
|
|
4507
|
+
l(this, "positions", []);
|
|
4508
|
+
l(this, "tempPoints", []);
|
|
4509
|
+
l(this, "primitive", null);
|
|
4510
|
+
l(this, "previewEntity", null);
|
|
4511
|
+
l(this, "previewPos", null);
|
|
4512
|
+
l(this, "edgeEntities", []);
|
|
4513
|
+
l(this, "pointEntities", []);
|
|
4514
|
+
l(this, "previewEdgeEntity", null);
|
|
4515
|
+
l(this, "previewPointEntities", []);
|
|
4516
|
+
l(this, "htmlLabelPool", null);
|
|
4517
|
+
l(this, "htmlLabelId", null);
|
|
4518
|
+
l(this, "previewLabelId", null);
|
|
4519
|
+
l(this, "segmentLabelIds", []);
|
|
4520
|
+
l(this, "angleLabelIds", []);
|
|
4521
|
+
l(this, "tooltip", null);
|
|
4522
|
+
l(this, "keydownHandler", null);
|
|
4523
|
+
l(this, "contextMenuHandler", null);
|
|
4465
4524
|
this.Cesium = t, this.viewer = e;
|
|
4466
4525
|
}
|
|
4467
4526
|
start(t) {
|
|
@@ -4489,7 +4548,7 @@ class ut {
|
|
|
4489
4548
|
options: { offset: { x: 0, y: -10 } }
|
|
4490
4549
|
});
|
|
4491
4550
|
}
|
|
4492
|
-
this.handler = new e.ScreenSpaceEventHandler(i.canvas), this.handler.setInputAction((n) => {
|
|
4551
|
+
this.tooltip = new ye(), this.tooltip.show(ke.TIP_TEXT), this._bindGlobalEvents(t, e, i), this.handler = new e.ScreenSpaceEventHandler(i.canvas), this.handler.setInputAction((n) => {
|
|
4493
4552
|
var m, g;
|
|
4494
4553
|
const s = i.scene.pickPosition(n.position);
|
|
4495
4554
|
if (!s) return;
|
|
@@ -4503,12 +4562,12 @@ class ut {
|
|
|
4503
4562
|
}
|
|
4504
4563
|
});
|
|
4505
4564
|
this.tempPoints.push(o), this.primitive && (i.scene.primitives.remove(this.primitive), this.primitive = null);
|
|
4506
|
-
const r = new e.PolygonHierarchy(this.positions.slice()),
|
|
4565
|
+
const r = new e.PolygonHierarchy(this.positions.slice()), h = new e.PolygonGeometry({
|
|
4507
4566
|
polygonHierarchy: r,
|
|
4508
4567
|
vertexFormat: e.MaterialAppearance.VERTEX_FORMAT,
|
|
4509
4568
|
perPositionHeight: !0,
|
|
4510
4569
|
arcType: e.ArcType.NONE
|
|
4511
|
-
}), c = new e.GeometryInstance({ geometry:
|
|
4570
|
+
}), c = new e.GeometryInstance({ geometry: h }), d = t.color || e.Color.YELLOW.withAlpha(0.4), u = t.color && t.color.withAlpha ? t.color.withAlpha(0.25) : e.Color.RED.withAlpha(0.4);
|
|
4512
4571
|
if (this.primitive = new e.Primitive({
|
|
4513
4572
|
geometryInstances: c,
|
|
4514
4573
|
appearance: new e.MaterialAppearance({
|
|
@@ -4616,93 +4675,13 @@ class ut {
|
|
|
4616
4675
|
this.previewPointEntities.push(b);
|
|
4617
4676
|
}
|
|
4618
4677
|
}, e.ScreenSpaceEventType.MOUSE_MOVE), this.handler.setInputAction(() => {
|
|
4619
|
-
|
|
4620
|
-
|
|
4621
|
-
|
|
4622
|
-
|
|
4623
|
-
}
|
|
4624
|
-
if (this.positions.length >= 3) {
|
|
4625
|
-
this.positions.pop();
|
|
4626
|
-
const p = this.tempPoints.pop();
|
|
4627
|
-
p && this.viewer.entities.remove(p);
|
|
4628
|
-
}
|
|
4629
|
-
if (this.previewEntity && (this.viewer.entities.remove(this.previewEntity), this.previewEntity = null), this.previewEdgeEntity && (this.viewer.entities.remove(this.previewEdgeEntity), this.previewEdgeEntity = null), this.previewPointEntities.length) {
|
|
4630
|
-
for (const p of this.previewPointEntities)
|
|
4631
|
-
try {
|
|
4632
|
-
this.viewer.entities.remove(p);
|
|
4633
|
-
} catch {
|
|
4634
|
-
}
|
|
4635
|
-
this.previewPointEntities = [];
|
|
4636
|
-
}
|
|
4637
|
-
this.previewPos = null, this.stop();
|
|
4638
|
-
const n = new e.Cartesian3(
|
|
4639
|
-
this.positions.reduce((p, f) => p + f.x, 0) / this.positions.length,
|
|
4640
|
-
this.positions.reduce((p, f) => p + f.y, 0) / this.positions.length,
|
|
4641
|
-
this.positions.reduce((p, f) => p + f.z, 0) / this.positions.length
|
|
4642
|
-
), o = new e.EllipsoidTangentPlane(n, e.Ellipsoid.WGS84).projectPointsOntoPlane(this.positions);
|
|
4643
|
-
let r = 0;
|
|
4644
|
-
for (let p = 0; p < o.length; p++) {
|
|
4645
|
-
const f = (p + 1) % o.length;
|
|
4646
|
-
r += o[p].x * o[f].y - o[f].x * o[p].y;
|
|
4647
|
-
}
|
|
4648
|
-
r = Math.abs(r) / 2;
|
|
4649
|
-
const l = e.Cartographic.fromCartesian(n), c = this.htmlLabelId || `measure_area_${Date.now()}`;
|
|
4650
|
-
this.htmlLabelId = c;
|
|
4651
|
-
const d = t.labelText || { area: "面积", side: "边长", angle: "角度" };
|
|
4652
|
-
this.previewLabelId && this.htmlLabelPool && (this.htmlLabelPool.removeByIds([this.previewLabelId]), this.previewLabelId = null), this.htmlLabelPool.add(
|
|
4653
|
-
{ text: `${d.area}:${r.toFixed(2)} m²` },
|
|
4654
|
-
{
|
|
4655
|
-
id: c,
|
|
4656
|
-
lon: e.Math.toDegrees(l.longitude),
|
|
4657
|
-
lat: e.Math.toDegrees(l.latitude),
|
|
4658
|
-
height: l.height || 0,
|
|
4659
|
-
theme: "measure-area",
|
|
4660
|
-
show: !0
|
|
4661
|
-
}
|
|
4662
|
-
), this.labelEntity = this.htmlLabelId;
|
|
4663
|
-
for (let p = 0; p < this.positions.length; p++) {
|
|
4664
|
-
const f = (p + 1) % this.positions.length, w = this.positions[p], y = this.positions[f], v = e.Cartographic.fromCartesian(w), C = e.Cartographic.fromCartesian(y), M = new e.EllipsoidGeodesic(v, C).surfaceDistance, P = new e.Cartesian3((w.x + y.x) / 2, (w.y + y.y) / 2, (w.z + y.z) / 2), L = e.Cartographic.fromCartesian(P), E = `measure_area_seg_${Date.now()}_${p}`;
|
|
4665
|
-
this.segmentLabelIds.push(E), this.htmlLabelPool.add(
|
|
4666
|
-
{ text: `${d.side}:${M.toFixed(2)} m` },
|
|
4667
|
-
{
|
|
4668
|
-
id: E,
|
|
4669
|
-
lon: e.Math.toDegrees(L.longitude),
|
|
4670
|
-
lat: e.Math.toDegrees(L.latitude),
|
|
4671
|
-
height: L.height || 0,
|
|
4672
|
-
theme: "measure-area-seg",
|
|
4673
|
-
show: !0
|
|
4674
|
-
}
|
|
4675
|
-
);
|
|
4676
|
-
}
|
|
4677
|
-
const u = o;
|
|
4678
|
-
for (let p = 0; p < u.length; p++) {
|
|
4679
|
-
const f = u[(p - 1 + u.length) % u.length], w = u[p], y = u[(p + 1) % u.length], v = f.x - w.x, C = f.y - w.y, b = y.x - w.x, M = y.y - w.y, P = Math.sqrt(v * v + C * C), L = Math.sqrt(b * b + M * M);
|
|
4680
|
-
if (!P || !L) continue;
|
|
4681
|
-
const E = v / P * (b / L) + C / P * (M / L), I = Math.acos(Math.min(1, Math.max(-1, E))) * (180 / Math.PI), S = e.Cartographic.fromCartesian(this.positions[p]), _ = `measure_area_angle_${Date.now()}_${p}`;
|
|
4682
|
-
this.angleLabelIds.push(_), this.htmlLabelPool.add(
|
|
4683
|
-
{ text: `${d.angle}:${I.toFixed(2)} °` },
|
|
4684
|
-
{
|
|
4685
|
-
id: _,
|
|
4686
|
-
lon: e.Math.toDegrees(S.longitude),
|
|
4687
|
-
lat: e.Math.toDegrees(S.latitude),
|
|
4688
|
-
height: S.height || 0,
|
|
4689
|
-
theme: "measure-area-angle",
|
|
4690
|
-
show: !0
|
|
4691
|
-
}
|
|
4692
|
-
);
|
|
4693
|
-
}
|
|
4694
|
-
const m = {
|
|
4695
|
-
entity: this.primitive,
|
|
4696
|
-
label: this.labelEntity,
|
|
4697
|
-
positions: this.positions,
|
|
4698
|
-
area: r,
|
|
4699
|
-
clear: () => this.clear()
|
|
4700
|
-
};
|
|
4701
|
-
(g = t.onComplete) == null || g.call(t, m);
|
|
4702
|
-
}, e.ScreenSpaceEventType.LEFT_DOUBLE_CLICK);
|
|
4678
|
+
this._finishMeasurement(t, e, !0);
|
|
4679
|
+
}, e.ScreenSpaceEventType.LEFT_DOUBLE_CLICK), this.handler.setInputAction(() => {
|
|
4680
|
+
this._undoLastPoint(t, e, i);
|
|
4681
|
+
}, e.ScreenSpaceEventType.RIGHT_CLICK);
|
|
4703
4682
|
}
|
|
4704
4683
|
stop() {
|
|
4705
|
-
this.handler && (this.handler.destroy(), this.handler = null);
|
|
4684
|
+
this.keydownHandler && (window.removeEventListener("keydown", this.keydownHandler), this.keydownHandler = null), this.contextMenuHandler && (this.viewer.canvas.removeEventListener("contextmenu", this.contextMenuHandler), this.contextMenuHandler = null), this.handler && (this.handler.destroy(), this.handler = null), this.tooltip && (this.tooltip.destroy(), this.tooltip = null);
|
|
4706
4685
|
}
|
|
4707
4686
|
clear() {
|
|
4708
4687
|
if (this.stop(), this.entity && (this.viewer.entities.remove(this.entity), this.entity = null), this.primitive && (this.viewer.scene.primitives.remove(this.primitive), this.primitive = null), this.edgeEntities.length) {
|
|
@@ -4731,6 +4710,154 @@ class ut {
|
|
|
4731
4710
|
}
|
|
4732
4711
|
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.angleLabelIds.length && this.htmlLabelPool && this.htmlLabelPool.removeByIds(this.angleLabelIds.slice()), this.segmentLabelIds = [], this.angleLabelIds = [], this.tempPoints.forEach((t) => this.viewer.entities.remove(t)), this.tempPoints = [], this.positions = [];
|
|
4733
4712
|
}
|
|
4713
|
+
_clearPreviewState() {
|
|
4714
|
+
if (this.previewEntity && (this.viewer.entities.remove(this.previewEntity), this.previewEntity = null), this.previewEdgeEntity && (this.viewer.entities.remove(this.previewEdgeEntity), this.previewEdgeEntity = null), this.previewPointEntities.length) {
|
|
4715
|
+
for (const t of this.previewPointEntities)
|
|
4716
|
+
try {
|
|
4717
|
+
this.viewer.entities.remove(t);
|
|
4718
|
+
} catch {
|
|
4719
|
+
}
|
|
4720
|
+
this.previewPointEntities = [];
|
|
4721
|
+
}
|
|
4722
|
+
this.previewLabelId && this.htmlLabelPool && (this.htmlLabelPool.removeByIds([this.previewLabelId]), this.previewLabelId = null), this.previewPos = null;
|
|
4723
|
+
}
|
|
4724
|
+
_rebuildShape(t, e, i) {
|
|
4725
|
+
var c, d;
|
|
4726
|
+
if (this.primitive && (i.scene.primitives.remove(this.primitive), this.primitive = null), this.edgeEntities.length) {
|
|
4727
|
+
for (const u of this.edgeEntities)
|
|
4728
|
+
try {
|
|
4729
|
+
i.entities.remove(u);
|
|
4730
|
+
} catch {
|
|
4731
|
+
}
|
|
4732
|
+
this.edgeEntities = [];
|
|
4733
|
+
}
|
|
4734
|
+
if (!this.positions.length) return;
|
|
4735
|
+
const n = new e.PolygonHierarchy(this.positions.slice()), s = new e.PolygonGeometry({
|
|
4736
|
+
polygonHierarchy: n,
|
|
4737
|
+
vertexFormat: e.MaterialAppearance.VERTEX_FORMAT,
|
|
4738
|
+
perPositionHeight: !0,
|
|
4739
|
+
arcType: e.ArcType.NONE
|
|
4740
|
+
}), o = new e.GeometryInstance({ geometry: s }), r = t.color || e.Color.YELLOW.withAlpha(0.4), h = t.color && t.color.withAlpha ? t.color.withAlpha(0.25) : e.Color.RED.withAlpha(0.4);
|
|
4741
|
+
if (this.primitive = new e.Primitive({
|
|
4742
|
+
geometryInstances: o,
|
|
4743
|
+
appearance: new e.MaterialAppearance({
|
|
4744
|
+
material: e.Material.fromType("Color", { color: r }),
|
|
4745
|
+
translucent: !0,
|
|
4746
|
+
closed: !0
|
|
4747
|
+
}),
|
|
4748
|
+
depthFailAppearance: new e.MaterialAppearance({
|
|
4749
|
+
material: e.Material.fromType("Color", { color: h }),
|
|
4750
|
+
translucent: !0,
|
|
4751
|
+
closed: !0
|
|
4752
|
+
})
|
|
4753
|
+
}), i.scene.primitives.add(this.primitive), this.positions.length >= 2) {
|
|
4754
|
+
const u = t.lineColor || t.color || e.Color.YELLOW, m = ((d = (c = t.dashLineColor || t.lineColor || t.color || e.Color.RED).withAlpha) == null ? void 0 : d.call(c, 0.9)) || e.Color.RED, g = this.positions.concat([this.positions[0]]), p = i.entities.add({
|
|
4755
|
+
polyline: {
|
|
4756
|
+
positions: g,
|
|
4757
|
+
width: t.width || 2,
|
|
4758
|
+
material: u,
|
|
4759
|
+
clampToGround: !1,
|
|
4760
|
+
arcType: e.ArcType.NONE,
|
|
4761
|
+
depthFailMaterial: new e.PolylineDashMaterialProperty({
|
|
4762
|
+
color: m,
|
|
4763
|
+
dashLength: 12,
|
|
4764
|
+
dashPattern: 255
|
|
4765
|
+
})
|
|
4766
|
+
}
|
|
4767
|
+
});
|
|
4768
|
+
this.edgeEntities.push(p);
|
|
4769
|
+
}
|
|
4770
|
+
}
|
|
4771
|
+
_undoLastPoint(t, e, i) {
|
|
4772
|
+
if (!this.positions.length) return;
|
|
4773
|
+
this.positions.pop();
|
|
4774
|
+
const n = this.tempPoints.pop();
|
|
4775
|
+
n && i.entities.remove(n), this._clearPreviewState(), this._rebuildShape(t, e, i);
|
|
4776
|
+
}
|
|
4777
|
+
_finishMeasurement(t, e, i) {
|
|
4778
|
+
var g;
|
|
4779
|
+
if (i && this.positions.length >= 3) {
|
|
4780
|
+
this.positions.pop();
|
|
4781
|
+
const p = this.tempPoints.pop();
|
|
4782
|
+
p && this.viewer.entities.remove(p);
|
|
4783
|
+
}
|
|
4784
|
+
if (this.positions.length < 3) {
|
|
4785
|
+
this.clear();
|
|
4786
|
+
return;
|
|
4787
|
+
}
|
|
4788
|
+
this._clearPreviewState(), this.stop();
|
|
4789
|
+
const n = new e.Cartesian3(
|
|
4790
|
+
this.positions.reduce((p, f) => p + f.x, 0) / this.positions.length,
|
|
4791
|
+
this.positions.reduce((p, f) => p + f.y, 0) / this.positions.length,
|
|
4792
|
+
this.positions.reduce((p, f) => p + f.z, 0) / this.positions.length
|
|
4793
|
+
), o = new e.EllipsoidTangentPlane(n, e.Ellipsoid.WGS84).projectPointsOntoPlane(this.positions);
|
|
4794
|
+
let r = 0;
|
|
4795
|
+
for (let p = 0; p < o.length; p++) {
|
|
4796
|
+
const f = (p + 1) % o.length;
|
|
4797
|
+
r += o[p].x * o[f].y - o[f].x * o[p].y;
|
|
4798
|
+
}
|
|
4799
|
+
r = Math.abs(r) / 2;
|
|
4800
|
+
const h = e.Cartographic.fromCartesian(n), c = this.htmlLabelId || `measure_area_${Date.now()}`;
|
|
4801
|
+
this.htmlLabelId = c;
|
|
4802
|
+
const d = t.labelText || { area: "面积", side: "边长", angle: "角度" };
|
|
4803
|
+
this.htmlLabelPool.add(
|
|
4804
|
+
{ text: `${d.area}:${r.toFixed(2)} m²` },
|
|
4805
|
+
{
|
|
4806
|
+
id: c,
|
|
4807
|
+
lon: e.Math.toDegrees(h.longitude),
|
|
4808
|
+
lat: e.Math.toDegrees(h.latitude),
|
|
4809
|
+
height: h.height || 0,
|
|
4810
|
+
theme: "measure-area",
|
|
4811
|
+
show: !0
|
|
4812
|
+
}
|
|
4813
|
+
), this.labelEntity = this.htmlLabelId;
|
|
4814
|
+
for (let p = 0; p < this.positions.length; p++) {
|
|
4815
|
+
const f = (p + 1) % this.positions.length, w = this.positions[p], y = this.positions[f], v = e.Cartographic.fromCartesian(w), C = e.Cartographic.fromCartesian(y), M = new e.EllipsoidGeodesic(v, C).surfaceDistance, P = new e.Cartesian3((w.x + y.x) / 2, (w.y + y.y) / 2, (w.z + y.z) / 2), L = e.Cartographic.fromCartesian(P), E = `measure_area_seg_${Date.now()}_${p}`;
|
|
4816
|
+
this.segmentLabelIds.push(E), this.htmlLabelPool.add(
|
|
4817
|
+
{ text: `${d.side}:${M.toFixed(2)} m` },
|
|
4818
|
+
{
|
|
4819
|
+
id: E,
|
|
4820
|
+
lon: e.Math.toDegrees(L.longitude),
|
|
4821
|
+
lat: e.Math.toDegrees(L.latitude),
|
|
4822
|
+
height: L.height || 0,
|
|
4823
|
+
theme: "measure-area-seg",
|
|
4824
|
+
show: !0
|
|
4825
|
+
}
|
|
4826
|
+
);
|
|
4827
|
+
}
|
|
4828
|
+
const u = o;
|
|
4829
|
+
for (let p = 0; p < u.length; p++) {
|
|
4830
|
+
const f = u[(p - 1 + u.length) % u.length], w = u[p], y = u[(p + 1) % u.length], v = f.x - w.x, C = f.y - w.y, b = y.x - w.x, M = y.y - w.y, P = Math.sqrt(v * v + C * C), L = Math.sqrt(b * b + M * M);
|
|
4831
|
+
if (!P || !L) continue;
|
|
4832
|
+
const E = v / P * (b / L) + C / P * (M / L), I = Math.acos(Math.min(1, Math.max(-1, E))) * (180 / Math.PI), D = e.Cartographic.fromCartesian(this.positions[p]), _ = `measure_area_angle_${Date.now()}_${p}`;
|
|
4833
|
+
this.angleLabelIds.push(_), this.htmlLabelPool.add(
|
|
4834
|
+
{ text: `${d.angle}:${I.toFixed(2)} °` },
|
|
4835
|
+
{
|
|
4836
|
+
id: _,
|
|
4837
|
+
lon: e.Math.toDegrees(D.longitude),
|
|
4838
|
+
lat: e.Math.toDegrees(D.latitude),
|
|
4839
|
+
height: D.height || 0,
|
|
4840
|
+
theme: "measure-area-angle",
|
|
4841
|
+
show: !0
|
|
4842
|
+
}
|
|
4843
|
+
);
|
|
4844
|
+
}
|
|
4845
|
+
const m = {
|
|
4846
|
+
entity: this.primitive,
|
|
4847
|
+
label: this.labelEntity,
|
|
4848
|
+
positions: this.positions,
|
|
4849
|
+
area: r,
|
|
4850
|
+
clear: () => this.clear()
|
|
4851
|
+
};
|
|
4852
|
+
(g = t.onComplete) == null || g.call(t, m);
|
|
4853
|
+
}
|
|
4854
|
+
_bindGlobalEvents(t, e, i) {
|
|
4855
|
+
this.keydownHandler = (n) => {
|
|
4856
|
+
n.key === "Escape" && (n.preventDefault(), this._finishMeasurement(t, e, !1));
|
|
4857
|
+
}, window.addEventListener("keydown", this.keydownHandler), this.contextMenuHandler = (n) => {
|
|
4858
|
+
n.preventDefault();
|
|
4859
|
+
}, i.canvas.addEventListener("contextmenu", this.contextMenuHandler);
|
|
4860
|
+
}
|
|
4734
4861
|
rehydrate(t, e) {
|
|
4735
4862
|
const i = this.Cesium, n = this.viewer, s = t.options || {}, o = (t.positions || []).map((M) => new i.Cartesian3(M[0], M[1], M[2]));
|
|
4736
4863
|
if (o.length < 3) return;
|
|
@@ -4789,33 +4916,35 @@ class ut {
|
|
|
4789
4916
|
});
|
|
4790
4917
|
n.scene.primitives.add(C), this.primitive = C;
|
|
4791
4918
|
for (let M = 0; M < o.length; M++) {
|
|
4792
|
-
const P = (M + 1) % o.length, L = o[M], E = o[P], I = i.Cartographic.fromCartesian(L),
|
|
4793
|
-
this.segmentLabelIds.push(
|
|
4919
|
+
const P = (M + 1) % o.length, L = o[M], E = o[P], I = i.Cartographic.fromCartesian(L), D = i.Cartographic.fromCartesian(E), T = new i.EllipsoidGeodesic(I, D).surfaceDistance, A = new i.Cartesian3((L.x + E.x) / 2, (L.y + E.y) / 2, (L.z + E.z) / 2), S = i.Cartographic.fromCartesian(A), k = t.id + `_area_seg_${M}`;
|
|
4920
|
+
this.segmentLabelIds.push(k), this.htmlLabelPool.add({ text: `${g.side}:${T.toFixed(2)} m` }, { id: k, lon: i.Math.toDegrees(S.longitude), lat: i.Math.toDegrees(S.latitude), height: S.height || 0, theme: "measure-area-seg", show: !0 });
|
|
4794
4921
|
}
|
|
4795
4922
|
const b = c;
|
|
4796
4923
|
for (let M = 0; M < b.length; M++) {
|
|
4797
|
-
const P = b[(M - 1 + b.length) % b.length], L = b[M], E = b[(M + 1) % b.length], I = P.x - L.x,
|
|
4798
|
-
if (!A || !
|
|
4799
|
-
const
|
|
4800
|
-
this.angleLabelIds.push(
|
|
4924
|
+
const P = b[(M - 1 + b.length) % b.length], L = b[M], E = b[(M + 1) % b.length], I = P.x - L.x, D = P.y - L.y, _ = E.x - L.x, T = E.y - L.y, A = Math.sqrt(I * I + D * D), S = Math.sqrt(_ * _ + T * T);
|
|
4925
|
+
if (!A || !S) continue;
|
|
4926
|
+
const k = I / A * (_ / S) + D / A * (T / S), x = Math.acos(Math.min(1, Math.max(-1, k))) * (180 / Math.PI), $ = i.Cartographic.fromCartesian(o[M]), H = t.id + `_area_angle_${M}`;
|
|
4927
|
+
this.angleLabelIds.push(H), this.htmlLabelPool.add({ text: `${g.angle}:${x.toFixed(2)} °` }, { id: H, lon: i.Math.toDegrees($.longitude), lat: i.Math.toDegrees($.latitude), height: $.height || 0, theme: "measure-area-angle", show: !0 });
|
|
4801
4928
|
}
|
|
4802
4929
|
}
|
|
4803
|
-
}
|
|
4804
|
-
|
|
4930
|
+
};
|
|
4931
|
+
l(ke, "TIP_TEXT", "单击左键添加点,右键撤销,双击左键或Esc结束");
|
|
4932
|
+
let Se = ke;
|
|
4933
|
+
class wt {
|
|
4805
4934
|
constructor(t, e) {
|
|
4806
|
-
|
|
4807
|
-
|
|
4808
|
-
|
|
4809
|
-
|
|
4810
|
-
|
|
4811
|
-
|
|
4812
|
-
|
|
4813
|
-
|
|
4814
|
-
|
|
4815
|
-
|
|
4816
|
-
|
|
4817
|
-
|
|
4818
|
-
|
|
4935
|
+
l(this, "Cesium");
|
|
4936
|
+
l(this, "viewer");
|
|
4937
|
+
l(this, "handler", null);
|
|
4938
|
+
l(this, "entity", null);
|
|
4939
|
+
l(this, "positions", []);
|
|
4940
|
+
l(this, "currentRadius", 0);
|
|
4941
|
+
l(this, "labelEntity", null);
|
|
4942
|
+
l(this, "previewLabel", null);
|
|
4943
|
+
l(this, "ellipsePrimitive", null);
|
|
4944
|
+
l(this, "previewEntity", null);
|
|
4945
|
+
l(this, "isPrimitive", !1);
|
|
4946
|
+
l(this, "htmlLabelPool", null);
|
|
4947
|
+
l(this, "htmlLabelId", null);
|
|
4819
4948
|
this.Cesium = t, this.viewer = e;
|
|
4820
4949
|
}
|
|
4821
4950
|
start(t) {
|
|
@@ -4825,8 +4954,8 @@ class mt {
|
|
|
4825
4954
|
const n = t.overlayContainerId || "html-label-container";
|
|
4826
4955
|
this.htmlLabelPool = new N(e, i, n), this.htmlLabelPool.registerTheme("measure-circle", {
|
|
4827
4956
|
createElement: (s, o) => {
|
|
4828
|
-
var
|
|
4829
|
-
const r = ((
|
|
4957
|
+
var h;
|
|
4958
|
+
const r = ((h = o == null ? void 0 : o.data) == null ? void 0 : h.text) || "";
|
|
4830
4959
|
s.innerHTML = String(r), 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";
|
|
4831
4960
|
},
|
|
4832
4961
|
options: { offset: { x: 0, y: -10 } }
|
|
@@ -4837,7 +4966,7 @@ class mt {
|
|
|
4837
4966
|
const s = i.scene.pickPosition(n.position);
|
|
4838
4967
|
if (s && (this.positions.push(s), this.positions.length === 2)) {
|
|
4839
4968
|
this.stop();
|
|
4840
|
-
const r = this.positions[0],
|
|
4969
|
+
const r = this.positions[0], h = this.positions[1], c = e.Cartesian3.distance(r, h), d = Math.PI * c * c, u = 2 * Math.PI * c, m = t.labelText || { radius: "半径", area: "面积", circumference: "周长" }, g = r;
|
|
4841
4970
|
this.labelEntity ? (this.labelEntity.position = g, this.labelEntity.label.text = `${m.radius}:${c.toFixed(2)} m
|
|
4842
4971
|
${m.area}:${d.toFixed(2)} m²
|
|
4843
4972
|
${m.circumference}:${u.toFixed(2)} m`) : this.labelEntity = i.entities.add({
|
|
@@ -4901,15 +5030,15 @@ ${m.circumference}:${u.toFixed(2)} m`;
|
|
|
4901
5030
|
if (this.positions.length !== 1) return;
|
|
4902
5031
|
const s = this.positions[0], o = i.camera.getPickRay(n.endPosition), r = i.scene.globe.pick(o, i.scene);
|
|
4903
5032
|
if (!r) return;
|
|
4904
|
-
const
|
|
4905
|
-
this.currentRadius =
|
|
4906
|
-
const c = e.Cartographic.fromCartesian(s), d = Math.PI *
|
|
4907
|
-
this.labelEntity ? (this.labelEntity.position = g, this.labelEntity.label.text = `${m.radius}:${
|
|
5033
|
+
const h = e.Cartesian3.distance(s, r);
|
|
5034
|
+
this.currentRadius = h;
|
|
5035
|
+
const c = e.Cartographic.fromCartesian(s), d = Math.PI * h * h, u = 2 * Math.PI * h, m = t.labelText || { radius: "半径", area: "面积", circumference: "周长" }, g = s;
|
|
5036
|
+
this.labelEntity ? (this.labelEntity.position = g, this.labelEntity.label.text = `${m.radius}:${h.toFixed(2)} m
|
|
4908
5037
|
${m.area}:${d.toFixed(2)} m²
|
|
4909
5038
|
${m.circumference}:${u.toFixed(2)} m`) : this.labelEntity = i.entities.add({
|
|
4910
5039
|
position: g,
|
|
4911
5040
|
label: {
|
|
4912
|
-
text: `${m.radius}:${
|
|
5041
|
+
text: `${m.radius}:${h.toFixed(2)} m
|
|
4913
5042
|
${m.area}:${d.toFixed(2)} m²
|
|
4914
5043
|
${m.circumference}:${u.toFixed(2)} m`,
|
|
4915
5044
|
font: "14px sans-serif",
|
|
@@ -4928,7 +5057,7 @@ ${m.circumference}:${u.toFixed(2)} m`,
|
|
|
4928
5057
|
});
|
|
4929
5058
|
const p = e.Cartographic.fromCartesian(s), f = e.Math.toDegrees(p.longitude), w = e.Math.toDegrees(p.latitude), y = p.height || 0, v = this.htmlLabelId || `measure_circle_${Date.now()}`;
|
|
4930
5059
|
this.htmlLabelId = v;
|
|
4931
|
-
const C = `${m.radius}:${
|
|
5060
|
+
const C = `${m.radius}:${h.toFixed(2)} m
|
|
4932
5061
|
${m.area}:${d.toFixed(2)} m²
|
|
4933
5062
|
${m.circumference}:${u.toFixed(2)} m`;
|
|
4934
5063
|
if (this.htmlLabelPool.add({ text: C }, { id: v, lon: f, lat: w, height: y, theme: "measure-circle", show: !0 }), !this.previewEntity) {
|
|
@@ -4958,14 +5087,14 @@ ${m.circumference}:${u.toFixed(2)} m`;
|
|
|
4958
5087
|
const P = s.overlayContainerId || "html-label-container";
|
|
4959
5088
|
this.htmlLabelPool = e || new N(i, n, P), this.htmlLabelPool.registerTheme("measure-circle", {
|
|
4960
5089
|
createElement: (L, E) => {
|
|
4961
|
-
var
|
|
4962
|
-
const I = ((
|
|
5090
|
+
var D;
|
|
5091
|
+
const I = ((D = E == null ? void 0 : E.data) == null ? void 0 : D.text) || "";
|
|
4963
5092
|
L.innerHTML = String(I), 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";
|
|
4964
5093
|
},
|
|
4965
5094
|
options: { offset: { x: 0, y: -10 } }
|
|
4966
5095
|
});
|
|
4967
5096
|
}
|
|
4968
|
-
const r = o[0],
|
|
5097
|
+
const r = o[0], h = o[1], c = i.Cartesian3.distance(r, h), d = Math.PI * c * c, u = 2 * Math.PI * c, m = i.Cartographic.fromCartesian(r), g = new i.EllipseGeometry({ center: r, semiMajorAxis: c, semiMinorAxis: c, height: m.height || 0, vertexFormat: i.MaterialAppearance.VERTEX_FORMAT }), p = new i.GeometryInstance({ geometry: g }), f = s.color || i.Color.YELLOW.withAlpha(0.5), w = s.color && s.color.withAlpha ? s.color.withAlpha(0.25) : i.Color.RED.withAlpha(0.4), y = new i.Primitive({
|
|
4969
5098
|
geometryInstances: p,
|
|
4970
5099
|
appearance: new i.MaterialAppearance({ material: i.Material.fromType("Color", { color: f }), translucent: !0, closed: !0 }),
|
|
4971
5100
|
depthFailAppearance: new i.MaterialAppearance({ material: i.Material.fromType("Color", { color: w }), translucent: !0, closed: !0 })
|
|
@@ -4979,24 +5108,27 @@ ${b.circumference}:${u.toFixed(2)} m`;
|
|
|
4979
5108
|
this.htmlLabelPool.add({ text: M }, { id: C, lon: i.Math.toDegrees(v.longitude), lat: i.Math.toDegrees(v.latitude), height: v.height || 0, theme: "measure-circle", show: !0 });
|
|
4980
5109
|
}
|
|
4981
5110
|
}
|
|
4982
|
-
class
|
|
5111
|
+
const Oe = class Oe {
|
|
4983
5112
|
constructor(t, e) {
|
|
4984
|
-
|
|
4985
|
-
|
|
4986
|
-
|
|
4987
|
-
|
|
4988
|
-
|
|
4989
|
-
|
|
4990
|
-
|
|
4991
|
-
|
|
4992
|
-
|
|
4993
|
-
|
|
4994
|
-
|
|
4995
|
-
|
|
4996
|
-
|
|
4997
|
-
|
|
4998
|
-
|
|
4999
|
-
|
|
5113
|
+
l(this, "Cesium");
|
|
5114
|
+
l(this, "viewer");
|
|
5115
|
+
l(this, "handler", null);
|
|
5116
|
+
l(this, "entity", null);
|
|
5117
|
+
l(this, "labelEntity", null);
|
|
5118
|
+
l(this, "positions", []);
|
|
5119
|
+
l(this, "tempPoints", []);
|
|
5120
|
+
l(this, "segmentLabels", []);
|
|
5121
|
+
l(this, "hoverPos", null);
|
|
5122
|
+
l(this, "previewPos", null);
|
|
5123
|
+
l(this, "previewLabel", null);
|
|
5124
|
+
l(this, "previewEntity", null);
|
|
5125
|
+
l(this, "htmlLabelPool", null);
|
|
5126
|
+
l(this, "totalLabelId", null);
|
|
5127
|
+
l(this, "segmentLabelIds", []);
|
|
5128
|
+
l(this, "previewLabelId", null);
|
|
5129
|
+
l(this, "tooltip", null);
|
|
5130
|
+
l(this, "keydownHandler", null);
|
|
5131
|
+
l(this, "contextMenuHandler", null);
|
|
5000
5132
|
this.Cesium = t, this.viewer = e;
|
|
5001
5133
|
}
|
|
5002
5134
|
start(t) {
|
|
@@ -5018,8 +5150,8 @@ class gt {
|
|
|
5018
5150
|
options: { offset: { x: 0, y: -10 } }
|
|
5019
5151
|
});
|
|
5020
5152
|
}
|
|
5021
|
-
this.handler = new e.ScreenSpaceEventHandler(i.canvas), this.handler.setInputAction((n) => {
|
|
5022
|
-
var r,
|
|
5153
|
+
this.tooltip = new ye(), this.tooltip.show(Oe.TIP_TEXT), this._bindGlobalEvents(t, e, i), this.handler = new e.ScreenSpaceEventHandler(i.canvas), this.handler.setInputAction((n) => {
|
|
5154
|
+
var r, h;
|
|
5023
5155
|
const s = i.scene.pickPosition(n.position);
|
|
5024
5156
|
if (!s) return;
|
|
5025
5157
|
this.positions.push(s);
|
|
@@ -5037,7 +5169,7 @@ class gt {
|
|
|
5037
5169
|
width: t.width || 3,
|
|
5038
5170
|
material: t.lineColor || t.color || e.Color.YELLOW,
|
|
5039
5171
|
depthFailMaterial: new e.PolylineDashMaterialProperty({
|
|
5040
|
-
color: ((
|
|
5172
|
+
color: ((h = (r = t.dashLineColor || t.lineColor || t.color || e.Color.RED).withAlpha) == null ? void 0 : h.call(r, 0.9)) || e.Color.RED,
|
|
5041
5173
|
dashLength: 12,
|
|
5042
5174
|
dashPattern: 255
|
|
5043
5175
|
})
|
|
@@ -5061,55 +5193,16 @@ class gt {
|
|
|
5061
5193
|
);
|
|
5062
5194
|
}
|
|
5063
5195
|
}, e.ScreenSpaceEventType.LEFT_CLICK), this.handler.setInputAction(() => {
|
|
5064
|
-
|
|
5065
|
-
|
|
5066
|
-
|
|
5067
|
-
|
|
5068
|
-
}
|
|
5069
|
-
if (this.stop(), this.previewLabelId && (this.htmlLabelPool.removeByIds([this.previewLabelId]), this.previewLabelId = null), this.hoverPos && (this.hoverPos = null), this.previewEntity && (this.viewer.entities.remove(this.previewEntity), this.previewEntity = null), this.positions.length >= 2 && this.tempPoints.length >= 2) {
|
|
5070
|
-
const d = this.tempPoints[this.tempPoints.length - 1];
|
|
5071
|
-
this.viewer.entities.remove(d), this.tempPoints.pop();
|
|
5072
|
-
}
|
|
5073
|
-
if (this.segmentLabelIds.length >= 1) {
|
|
5074
|
-
const d = this.segmentLabelIds[this.segmentLabelIds.length - 1];
|
|
5075
|
-
d && (this.htmlLabelPool.removeByIds([d]), this.segmentLabelIds.pop());
|
|
5076
|
-
}
|
|
5077
|
-
this.positions.length >= 2 && this.positions.pop();
|
|
5078
|
-
let n = 0;
|
|
5079
|
-
for (let d = 1; d < this.positions.length; d++) {
|
|
5080
|
-
const u = this.positions[d - 1], m = this.positions[d], g = e.Cartographic.fromCartesian(u), p = e.Cartographic.fromCartesian(m), w = new e.EllipsoidGeodesic(g, p).surfaceDistance;
|
|
5081
|
-
n += w;
|
|
5082
|
-
}
|
|
5083
|
-
const s = this.positions[this.positions.length - 1];
|
|
5084
|
-
this.entity && this.entity.polyline && (this.entity.polyline.positions = this.positions);
|
|
5085
|
-
const o = e.Cartographic.fromCartesian(s), r = this.totalLabelId || `measure_polyline_total_${Date.now()}`;
|
|
5086
|
-
this.totalLabelId = r, this.htmlLabelPool.add(
|
|
5087
|
-
{ text: `${n.toFixed(2)} m` },
|
|
5088
|
-
{
|
|
5089
|
-
id: r,
|
|
5090
|
-
lon: e.Math.toDegrees(o.longitude),
|
|
5091
|
-
lat: e.Math.toDegrees(o.latitude),
|
|
5092
|
-
height: o.height || 0,
|
|
5093
|
-
theme: "measure-polyline-total",
|
|
5094
|
-
show: !0
|
|
5095
|
-
}
|
|
5096
|
-
), this.labelEntity = this.totalLabelId;
|
|
5097
|
-
const l = {
|
|
5098
|
-
entity: this.entity,
|
|
5099
|
-
label: this.labelEntity,
|
|
5100
|
-
segmentLabels: this.segmentLabelIds,
|
|
5101
|
-
positions: this.positions,
|
|
5102
|
-
distance: n,
|
|
5103
|
-
clear: () => this.clear()
|
|
5104
|
-
};
|
|
5105
|
-
(c = t.onComplete) == null || c.call(t, l);
|
|
5106
|
-
}, e.ScreenSpaceEventType.LEFT_DOUBLE_CLICK), this.handler.setInputAction((n) => {
|
|
5196
|
+
this._finishMeasurement(t, e, !0);
|
|
5197
|
+
}, e.ScreenSpaceEventType.LEFT_DOUBLE_CLICK), this.handler.setInputAction(() => {
|
|
5198
|
+
this._undoLastPoint();
|
|
5199
|
+
}, e.ScreenSpaceEventType.RIGHT_CLICK), this.handler.setInputAction((n) => {
|
|
5107
5200
|
var p, f;
|
|
5108
5201
|
if (this.positions.length === 0) return;
|
|
5109
5202
|
const s = i.scene.pickPosition(n.endPosition);
|
|
5110
5203
|
if (!s) return;
|
|
5111
5204
|
this.hoverPos = s, this.previewPos = s;
|
|
5112
|
-
const o = this.positions[this.positions.length - 1], r = e.Cartographic.fromCartesian(o),
|
|
5205
|
+
const o = this.positions[this.positions.length - 1], r = e.Cartographic.fromCartesian(o), h = e.Cartographic.fromCartesian(s), d = new e.EllipsoidGeodesic(r, h).surfaceDistance, u = new e.Cartesian3(
|
|
5113
5206
|
(o.x + s.x) / 2,
|
|
5114
5207
|
(o.y + s.y) / 2,
|
|
5115
5208
|
(o.z + s.z) / 2
|
|
@@ -5139,14 +5232,82 @@ class gt {
|
|
|
5139
5232
|
}, e.ScreenSpaceEventType.MOUSE_MOVE);
|
|
5140
5233
|
}
|
|
5141
5234
|
stop() {
|
|
5142
|
-
this.handler && (this.handler.destroy(), this.handler = null);
|
|
5235
|
+
this.keydownHandler && (window.removeEventListener("keydown", this.keydownHandler), this.keydownHandler = null), this.contextMenuHandler && (this.viewer.canvas.removeEventListener("contextmenu", this.contextMenuHandler), this.contextMenuHandler = null), this.handler && (this.handler.destroy(), this.handler = null), this.tooltip && (this.tooltip.destroy(), this.tooltip = null);
|
|
5143
5236
|
}
|
|
5144
5237
|
clear() {
|
|
5145
5238
|
this.stop(), this.entity && (this.viewer.entities.remove(this.entity), this.entity = null), this.totalLabelId && this.htmlLabelPool && (this.htmlLabelPool.removeByIds([this.totalLabelId]), this.totalLabelId = null), this.previewEntity && (this.viewer.entities.remove(this.previewEntity), this.previewEntity = null), this.previewLabelId && this.htmlLabelPool && (this.htmlLabelPool.removeByIds([this.previewLabelId]), this.previewLabelId = null), this.hoverPos = null, this.segmentLabelIds.length && this.htmlLabelPool && this.htmlLabelPool.removeByIds(this.segmentLabelIds.slice()), this.segmentLabelIds = [], this.tempPoints.forEach((t) => this.viewer.entities.remove(t)), this.tempPoints = [], this.positions = [];
|
|
5146
5239
|
}
|
|
5240
|
+
_clearPreviewState() {
|
|
5241
|
+
this.previewEntity && (this.viewer.entities.remove(this.previewEntity), this.previewEntity = null), this.previewLabelId && this.htmlLabelPool && (this.htmlLabelPool.removeByIds([this.previewLabelId]), this.previewLabelId = null), this.previewPos = null, this.hoverPos = null;
|
|
5242
|
+
}
|
|
5243
|
+
_undoLastPoint() {
|
|
5244
|
+
var e;
|
|
5245
|
+
if (!this.positions.length) return;
|
|
5246
|
+
this.positions.pop();
|
|
5247
|
+
const t = this.tempPoints.pop();
|
|
5248
|
+
if (t && this.viewer.entities.remove(t), this.segmentLabelIds.length > this.positions.length - 1 && this.htmlLabelPool) {
|
|
5249
|
+
const i = this.segmentLabelIds.pop();
|
|
5250
|
+
i && this.htmlLabelPool.removeByIds([i]);
|
|
5251
|
+
}
|
|
5252
|
+
(e = this.entity) != null && e.polyline && (this.entity.polyline.positions = this.positions.slice()), this.positions.length ? this.previewLabelId && this.htmlLabelPool && (this.htmlLabelPool.removeByIds([this.previewLabelId]), this.previewLabelId = null) : (this.entity && (this.viewer.entities.remove(this.entity), this.entity = null), this._clearPreviewState());
|
|
5253
|
+
}
|
|
5254
|
+
_finishMeasurement(t, e, i) {
|
|
5255
|
+
var c;
|
|
5256
|
+
if (i) {
|
|
5257
|
+
if (this.positions.length >= 2 && this.tempPoints.length >= 2) {
|
|
5258
|
+
const d = this.tempPoints[this.tempPoints.length - 1];
|
|
5259
|
+
this.viewer.entities.remove(d), this.tempPoints.pop();
|
|
5260
|
+
}
|
|
5261
|
+
if (this.segmentLabelIds.length >= 1) {
|
|
5262
|
+
const d = this.segmentLabelIds[this.segmentLabelIds.length - 1];
|
|
5263
|
+
d && (this.htmlLabelPool.removeByIds([d]), this.segmentLabelIds.pop());
|
|
5264
|
+
}
|
|
5265
|
+
this.positions.length >= 2 && this.positions.pop();
|
|
5266
|
+
}
|
|
5267
|
+
if (this.positions.length < 2) {
|
|
5268
|
+
this.clear();
|
|
5269
|
+
return;
|
|
5270
|
+
}
|
|
5271
|
+
this.stop(), this._clearPreviewState();
|
|
5272
|
+
let n = 0;
|
|
5273
|
+
for (let d = 1; d < this.positions.length; d++) {
|
|
5274
|
+
const u = this.positions[d - 1], m = this.positions[d], g = e.Cartographic.fromCartesian(u), p = e.Cartographic.fromCartesian(m), f = new e.EllipsoidGeodesic(g, p);
|
|
5275
|
+
n += f.surfaceDistance;
|
|
5276
|
+
}
|
|
5277
|
+
const s = this.positions[this.positions.length - 1];
|
|
5278
|
+
this.entity && this.entity.polyline && (this.entity.polyline.positions = this.positions);
|
|
5279
|
+
const o = e.Cartographic.fromCartesian(s), r = this.totalLabelId || `measure_polyline_total_${Date.now()}`;
|
|
5280
|
+
this.totalLabelId = r, this.htmlLabelPool.add(
|
|
5281
|
+
{ text: `${n.toFixed(2)} m` },
|
|
5282
|
+
{
|
|
5283
|
+
id: r,
|
|
5284
|
+
lon: e.Math.toDegrees(o.longitude),
|
|
5285
|
+
lat: e.Math.toDegrees(o.latitude),
|
|
5286
|
+
height: o.height || 0,
|
|
5287
|
+
theme: "measure-polyline-total",
|
|
5288
|
+
show: !0
|
|
5289
|
+
}
|
|
5290
|
+
), this.labelEntity = this.totalLabelId;
|
|
5291
|
+
const h = {
|
|
5292
|
+
entity: this.entity,
|
|
5293
|
+
label: this.labelEntity,
|
|
5294
|
+
segmentLabels: this.segmentLabelIds,
|
|
5295
|
+
positions: this.positions,
|
|
5296
|
+
distance: n,
|
|
5297
|
+
clear: () => this.clear()
|
|
5298
|
+
};
|
|
5299
|
+
(c = t.onComplete) == null || c.call(t, h);
|
|
5300
|
+
}
|
|
5301
|
+
_bindGlobalEvents(t, e, i) {
|
|
5302
|
+
this.keydownHandler = (n) => {
|
|
5303
|
+
n.key === "Escape" && (n.preventDefault(), this._finishMeasurement(t, e, !1));
|
|
5304
|
+
}, window.addEventListener("keydown", this.keydownHandler), this.contextMenuHandler = (n) => {
|
|
5305
|
+
n.preventDefault();
|
|
5306
|
+
}, i.canvas.addEventListener("contextmenu", this.contextMenuHandler);
|
|
5307
|
+
}
|
|
5147
5308
|
rehydrate(t, e) {
|
|
5148
5309
|
var p, f;
|
|
5149
|
-
const i = this.Cesium, n = this.viewer, s = t.options || {}, o = s.lineColor || s.color || i.Color.YELLOW, r = ((f = (p = s.dashLineColor || s.lineColor || s.color || i.Color.RED).withAlpha) == null ? void 0 : f.call(p, 0.9)) || i.Color.RED,
|
|
5310
|
+
const i = this.Cesium, n = this.viewer, s = t.options || {}, o = s.lineColor || s.color || i.Color.YELLOW, r = ((f = (p = s.dashLineColor || s.lineColor || s.color || i.Color.RED).withAlpha) == null ? void 0 : f.call(p, 0.9)) || i.Color.RED, h = s.width || 3, c = (t.positions || []).map((w) => new i.Cartesian3(w[0], w[1], w[2]));
|
|
5150
5311
|
if (c.length < 2) return;
|
|
5151
5312
|
if (!this.htmlLabelPool) {
|
|
5152
5313
|
const w = s.overlayContainerId || "html-label-container";
|
|
@@ -5168,7 +5329,7 @@ class gt {
|
|
|
5168
5329
|
const y = n.entities.add({ position: w, point: { pixelSize: 8, color: s.pointColor || s.color || i.Color.YELLOW, disableDepthTestDistance: Number.POSITIVE_INFINITY } });
|
|
5169
5330
|
this.tempPoints.push(y);
|
|
5170
5331
|
}
|
|
5171
|
-
this.entity = n.entities.add({ polyline: { positions: c, width:
|
|
5332
|
+
this.entity = n.entities.add({ polyline: { positions: c, width: h, material: o, depthFailMaterial: new i.PolylineDashMaterialProperty({ color: r, dashLength: 12, dashPattern: 255 }) } });
|
|
5172
5333
|
let d = 0;
|
|
5173
5334
|
for (let w = 1; w < c.length; w++) {
|
|
5174
5335
|
const y = i.Cartographic.fromCartesian(c[w - 1]), v = i.Cartographic.fromCartesian(c[w]), C = new i.EllipsoidGeodesic(y, v);
|
|
@@ -5195,18 +5356,20 @@ class gt {
|
|
|
5195
5356
|
style: { pointerEvents: "none", userSelect: "none", cursor: "default" }
|
|
5196
5357
|
});
|
|
5197
5358
|
}
|
|
5198
|
-
}
|
|
5199
|
-
|
|
5359
|
+
};
|
|
5360
|
+
l(Oe, "TIP_TEXT", "单击左键添加点,右键撤销,双击左键或Esc结束");
|
|
5361
|
+
let Ae = Oe;
|
|
5362
|
+
class vt {
|
|
5200
5363
|
constructor(t, e) {
|
|
5201
|
-
|
|
5202
|
-
|
|
5203
|
-
|
|
5204
|
-
|
|
5205
|
-
|
|
5206
|
-
|
|
5207
|
-
|
|
5208
|
-
|
|
5209
|
-
|
|
5364
|
+
l(this, "Cesium");
|
|
5365
|
+
l(this, "viewer");
|
|
5366
|
+
l(this, "handler", null);
|
|
5367
|
+
l(this, "labelEntity", null);
|
|
5368
|
+
l(this, "htmlLabelPool", null);
|
|
5369
|
+
l(this, "htmlLabelId", null);
|
|
5370
|
+
l(this, "topPoint", null);
|
|
5371
|
+
l(this, "zeroPoint", null);
|
|
5372
|
+
l(this, "lineEntity", null);
|
|
5210
5373
|
this.Cesium = t, this.viewer = e;
|
|
5211
5374
|
}
|
|
5212
5375
|
start(t) {
|
|
@@ -5228,7 +5391,7 @@ class ft {
|
|
|
5228
5391
|
if (!s) return;
|
|
5229
5392
|
const o = e.Cartographic.fromCartesian(s), r = i.scene.globe.getHeight(
|
|
5230
5393
|
new e.Cartographic(o.longitude, o.latitude, 0)
|
|
5231
|
-
) || 0,
|
|
5394
|
+
) || 0, h = e.Math.toDegrees(o.longitude), c = e.Math.toDegrees(o.latitude), d = e.Cartesian3.fromDegrees(h, c, r);
|
|
5232
5395
|
this.topPoint = i.entities.add({
|
|
5233
5396
|
position: s,
|
|
5234
5397
|
point: {
|
|
@@ -5260,7 +5423,7 @@ class ft {
|
|
|
5260
5423
|
{ text: g },
|
|
5261
5424
|
{
|
|
5262
5425
|
id: p,
|
|
5263
|
-
lon:
|
|
5426
|
+
lon: h,
|
|
5264
5427
|
lat: c,
|
|
5265
5428
|
height: o.height || 0,
|
|
5266
5429
|
theme: "measure-terrainHeight",
|
|
@@ -5302,21 +5465,21 @@ class ft {
|
|
|
5302
5465
|
options: { offset: { x: 0, y: -10 } }
|
|
5303
5466
|
});
|
|
5304
5467
|
}
|
|
5305
|
-
const r = o[0],
|
|
5468
|
+
const r = o[0], h = i.Cartographic.fromCartesian(r), c = n.scene.globe.getHeight(new i.Cartographic(h.longitude, h.latitude, 0)) || 0, d = i.Math.toDegrees(h.longitude), u = i.Math.toDegrees(h.latitude), m = i.Cartesian3.fromDegrees(d, u, c);
|
|
5306
5469
|
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: m, point: { pixelSize: 8, color: i.Color.YELLOW, disableDepthTestDistance: Number.POSITIVE_INFINITY } }), this.lineEntity = n.entities.add({ polyline: { positions: [m, r], width: s.width || 3, material: s.color || i.Color.YELLOW, depthFailMaterial: new i.PolylineDashMaterialProperty({ color: i.Color.RED, dashLength: 12, dashPattern: 255 }) } });
|
|
5307
|
-
const g = s.labelText || { height: "高差" }, p = (
|
|
5308
|
-
this.htmlLabelId = f, this.htmlLabelPool.add({ text: `${g.height}:${p.toFixed(2)} m` }, { id: f, lon: d, lat: u, height:
|
|
5470
|
+
const g = s.labelText || { height: "高差" }, p = (h.height || 0) - c, f = t.id + "_terrain";
|
|
5471
|
+
this.htmlLabelId = f, this.htmlLabelPool.add({ text: `${g.height}:${p.toFixed(2)} m` }, { id: f, lon: d, lat: u, height: h.height || 0, theme: "measure-terrainHeight", show: !0 });
|
|
5309
5472
|
}
|
|
5310
5473
|
}
|
|
5311
|
-
class
|
|
5474
|
+
class Ct {
|
|
5312
5475
|
constructor(t, e) {
|
|
5313
|
-
|
|
5314
|
-
|
|
5315
|
-
|
|
5316
|
-
|
|
5317
|
-
|
|
5318
|
-
|
|
5319
|
-
|
|
5476
|
+
l(this, "Cesium");
|
|
5477
|
+
l(this, "viewer");
|
|
5478
|
+
l(this, "handler", null);
|
|
5479
|
+
l(this, "entity", null);
|
|
5480
|
+
l(this, "labelEntity", null);
|
|
5481
|
+
l(this, "htmlLabelPool", null);
|
|
5482
|
+
l(this, "htmlLabelId", null);
|
|
5320
5483
|
this.Cesium = t, this.viewer = e;
|
|
5321
5484
|
}
|
|
5322
5485
|
start(t) {
|
|
@@ -5336,7 +5499,7 @@ class yt {
|
|
|
5336
5499
|
var g;
|
|
5337
5500
|
const s = i.scene.pickPosition(n.position);
|
|
5338
5501
|
if (!s) return;
|
|
5339
|
-
const o = e.Cartographic.fromCartesian(s), r = e.Math.toDegrees(o.longitude),
|
|
5502
|
+
const o = e.Cartographic.fromCartesian(s), r = e.Math.toDegrees(o.longitude), h = e.Math.toDegrees(o.latitude), c = o.height || 0;
|
|
5340
5503
|
this.entity = i.entities.add({
|
|
5341
5504
|
position: s,
|
|
5342
5505
|
point: {
|
|
@@ -5350,12 +5513,12 @@ class yt {
|
|
|
5350
5513
|
const u = t.labelText || { lng: "经", lat: "纬", height: "高" };
|
|
5351
5514
|
this.htmlLabelPool.add(
|
|
5352
5515
|
{ text: `${u.lng}:${r.toFixed(6)}
|
|
5353
|
-
${u.lat}:${
|
|
5516
|
+
${u.lat}:${h.toFixed(6)}
|
|
5354
5517
|
${u.height}:${c.toFixed(2)} m` },
|
|
5355
5518
|
{
|
|
5356
5519
|
id: d,
|
|
5357
5520
|
lon: r,
|
|
5358
|
-
lat:
|
|
5521
|
+
lat: h,
|
|
5359
5522
|
height: c,
|
|
5360
5523
|
theme: "measure-coordinate",
|
|
5361
5524
|
show: !0
|
|
@@ -5364,7 +5527,7 @@ ${u.height}:${c.toFixed(2)} m` },
|
|
|
5364
5527
|
const m = {
|
|
5365
5528
|
entity: this.entity,
|
|
5366
5529
|
label: this.labelEntity,
|
|
5367
|
-
lnglat: { lng: r, lat:
|
|
5530
|
+
lnglat: { lng: r, lat: h, height: c },
|
|
5368
5531
|
clear: () => this.clear()
|
|
5369
5532
|
};
|
|
5370
5533
|
(g = t.onComplete) == null || g.call(t, m), this.stop();
|
|
@@ -5397,7 +5560,7 @@ ${u.height}:${c.toFixed(2)} m` },
|
|
|
5397
5560
|
options: { offset: { x: 0, y: -10 } }
|
|
5398
5561
|
});
|
|
5399
5562
|
}
|
|
5400
|
-
const r = o[0],
|
|
5563
|
+
const r = o[0], h = i.Cartographic.fromCartesian(r), c = i.Math.toDegrees(h.longitude), d = i.Math.toDegrees(h.latitude), u = h.height || 0;
|
|
5401
5564
|
this.entity = n.entities.add({ position: r, point: { pixelSize: 10, color: s.color || i.Color.YELLOW, disableDepthTestDistance: Number.POSITIVE_INFINITY } });
|
|
5402
5565
|
const m = t.id + "_coord";
|
|
5403
5566
|
this.htmlLabelId = m;
|
|
@@ -5407,27 +5570,27 @@ ${g.lat}:${d.toFixed(6)}
|
|
|
5407
5570
|
${g.height}:${u.toFixed(2)} m` }, { id: m, lon: c, lat: d, height: u, theme: "measure-coordinate", show: !0 });
|
|
5408
5571
|
}
|
|
5409
5572
|
}
|
|
5410
|
-
class
|
|
5573
|
+
class bt {
|
|
5411
5574
|
constructor(t, e) {
|
|
5412
|
-
|
|
5413
|
-
|
|
5414
|
-
|
|
5415
|
-
|
|
5416
|
-
|
|
5417
|
-
|
|
5418
|
-
|
|
5419
|
-
|
|
5420
|
-
|
|
5421
|
-
|
|
5422
|
-
|
|
5423
|
-
|
|
5424
|
-
|
|
5425
|
-
|
|
5426
|
-
|
|
5427
|
-
|
|
5428
|
-
|
|
5429
|
-
|
|
5430
|
-
|
|
5575
|
+
l(this, "Cesium");
|
|
5576
|
+
l(this, "viewer");
|
|
5577
|
+
l(this, "handler", null);
|
|
5578
|
+
l(this, "startPoint", null);
|
|
5579
|
+
l(this, "endPoint", null);
|
|
5580
|
+
l(this, "secondPoint", null);
|
|
5581
|
+
l(this, "currentCorners", []);
|
|
5582
|
+
l(this, "edgeEntities", []);
|
|
5583
|
+
l(this, "pointEntities", []);
|
|
5584
|
+
l(this, "previewEdgeEntity", null);
|
|
5585
|
+
l(this, "previewPointEntities", []);
|
|
5586
|
+
l(this, "entity", null);
|
|
5587
|
+
l(this, "labelEntity", null);
|
|
5588
|
+
l(this, "primitive", null);
|
|
5589
|
+
l(this, "previewEntity", null);
|
|
5590
|
+
l(this, "htmlLabelPool", null);
|
|
5591
|
+
l(this, "htmlLabelId", null);
|
|
5592
|
+
l(this, "segmentLabelIds", []);
|
|
5593
|
+
l(this, "previewLabelId", null);
|
|
5431
5594
|
this.Cesium = t, this.viewer = e;
|
|
5432
5595
|
}
|
|
5433
5596
|
start(t) {
|
|
@@ -5450,7 +5613,7 @@ class wt {
|
|
|
5450
5613
|
});
|
|
5451
5614
|
}
|
|
5452
5615
|
this.handler = new e.ScreenSpaceEventHandler(i.canvas), this.handler.setInputAction((n) => {
|
|
5453
|
-
var A,
|
|
5616
|
+
var A, S, k;
|
|
5454
5617
|
const s = i.scene.pickPosition(n.position);
|
|
5455
5618
|
if (!s) return;
|
|
5456
5619
|
if (!this.startPoint) {
|
|
@@ -5467,7 +5630,7 @@ class wt {
|
|
|
5467
5630
|
return;
|
|
5468
5631
|
}
|
|
5469
5632
|
this.stop();
|
|
5470
|
-
const { corners:
|
|
5633
|
+
const { corners: h, center: c, width: d, height: u, area: m } = r;
|
|
5471
5634
|
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);
|
|
5472
5635
|
const g = this.htmlLabelId || `measure_rectangle_${Date.now()}`;
|
|
5473
5636
|
this.htmlLabelId = g;
|
|
@@ -5486,13 +5649,13 @@ ${f.area}:${m.toFixed(2)} m²` },
|
|
|
5486
5649
|
}
|
|
5487
5650
|
);
|
|
5488
5651
|
const w = [
|
|
5489
|
-
[
|
|
5490
|
-
[
|
|
5491
|
-
[
|
|
5492
|
-
[
|
|
5652
|
+
[h[0], h[1]],
|
|
5653
|
+
[h[1], h[2]],
|
|
5654
|
+
[h[2], h[3]],
|
|
5655
|
+
[h[3], h[0]]
|
|
5493
5656
|
];
|
|
5494
5657
|
for (let x = 0; x < w.length; x++) {
|
|
5495
|
-
const [$,
|
|
5658
|
+
const [$, H] = w[x], z = x === 0 || x === 2 ? d : u, G = new e.Cartesian3(($.x + H.x) / 2, ($.y + H.y) / 2, ($.z + H.z) / 2), B = e.Cartographic.fromCartesian(G), K = `measure_rectangle_seg_${Date.now()}_${x}`;
|
|
5496
5659
|
this.segmentLabelIds.push(K), this.htmlLabelPool.add(
|
|
5497
5660
|
{ text: `${f.side}:${Number(z).toFixed(2)} m` },
|
|
5498
5661
|
{
|
|
@@ -5505,7 +5668,7 @@ ${f.area}:${m.toFixed(2)} m²` },
|
|
|
5505
5668
|
}
|
|
5506
5669
|
);
|
|
5507
5670
|
}
|
|
5508
|
-
const y = this.buildSurfaceRectanglePositions(
|
|
5671
|
+
const y = this.buildSurfaceRectanglePositions(h), v = new e.PolygonHierarchy(y), C = new e.PolygonGeometry({
|
|
5509
5672
|
polygonHierarchy: v,
|
|
5510
5673
|
vertexFormat: e.MaterialAppearance.VERTEX_FORMAT,
|
|
5511
5674
|
perPositionHeight: !0,
|
|
@@ -5524,7 +5687,7 @@ ${f.area}:${m.toFixed(2)} m²` },
|
|
|
5524
5687
|
closed: !0
|
|
5525
5688
|
})
|
|
5526
5689
|
}), i.scene.primitives.add(this.primitive);
|
|
5527
|
-
const L = t.lineColor || t.color || e.Color.YELLOW, E = ((
|
|
5690
|
+
const L = t.lineColor || t.color || e.Color.YELLOW, E = ((S = (A = t.dashLineColor || t.lineColor || t.color || e.Color.RED).withAlpha) == null ? void 0 : S.call(A, 0.9)) || e.Color.RED, I = [...y, y[0]], D = i.entities.add({
|
|
5528
5691
|
polyline: {
|
|
5529
5692
|
positions: I,
|
|
5530
5693
|
width: t.width || 2,
|
|
@@ -5538,9 +5701,9 @@ ${f.area}:${m.toFixed(2)} m²` },
|
|
|
5538
5701
|
})
|
|
5539
5702
|
}
|
|
5540
5703
|
});
|
|
5541
|
-
this.edgeEntities.push(
|
|
5704
|
+
this.edgeEntities.push(D);
|
|
5542
5705
|
const _ = t.pointColor || t.color || e.Color.YELLOW;
|
|
5543
|
-
for (const x of
|
|
5706
|
+
for (const x of h) {
|
|
5544
5707
|
const $ = i.entities.add({
|
|
5545
5708
|
position: x,
|
|
5546
5709
|
point: {
|
|
@@ -5560,7 +5723,7 @@ ${f.area}:${m.toFixed(2)} m²` },
|
|
|
5560
5723
|
area: m,
|
|
5561
5724
|
clear: () => this.clear()
|
|
5562
5725
|
};
|
|
5563
|
-
(
|
|
5726
|
+
(k = t.onComplete) == null || k.call(t, T);
|
|
5564
5727
|
}, e.ScreenSpaceEventType.LEFT_CLICK), this.handler.setInputAction((n) => {
|
|
5565
5728
|
var w, y;
|
|
5566
5729
|
const s = i.scene.pickPosition(n.endPosition);
|
|
@@ -5604,9 +5767,9 @@ ${f.area}:${m.toFixed(2)} m²` },
|
|
|
5604
5767
|
if (!this.startPoint || !this.secondPoint) return;
|
|
5605
5768
|
const o = this.computeRectangle(this.startPoint, this.secondPoint, s);
|
|
5606
5769
|
if (!o) return;
|
|
5607
|
-
const { corners: r, center:
|
|
5770
|
+
const { corners: r, center: h, width: c, height: d, area: u } = o, m = this.buildSurfaceRectanglePositions(r);
|
|
5608
5771
|
this.currentCorners = m;
|
|
5609
|
-
const g = e.Cartographic.fromCartesian(
|
|
5772
|
+
const g = e.Cartographic.fromCartesian(h), p = this.previewLabelId || "measure_rectangle_preview";
|
|
5610
5773
|
this.previewLabelId = p;
|
|
5611
5774
|
const f = t.labelText || { width: "宽", heightLabel: "高", area: "面积" };
|
|
5612
5775
|
if (this.htmlLabelPool.add(
|
|
@@ -5677,35 +5840,35 @@ ${f.area}:${u.toFixed(2)} m²` },
|
|
|
5677
5840
|
const _ = s.overlayContainerId || "html-label-container";
|
|
5678
5841
|
this.htmlLabelPool = e || new N(i, n, _), this.htmlLabelPool.registerTheme("measure-rectangle", {
|
|
5679
5842
|
createElement: (T, A) => {
|
|
5680
|
-
var
|
|
5681
|
-
T.innerHTML = String(((
|
|
5843
|
+
var S;
|
|
5844
|
+
T.innerHTML = String(((S = A == null ? void 0 : A.data) == null ? void 0 : S.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";
|
|
5682
5845
|
},
|
|
5683
5846
|
options: { offset: { x: 0, y: -10 } }
|
|
5684
5847
|
}), this.htmlLabelPool.registerTheme("measure-rectangle-seg", {
|
|
5685
5848
|
createElement: (T, A) => {
|
|
5686
|
-
var
|
|
5687
|
-
T.innerHTML = String(((
|
|
5849
|
+
var S;
|
|
5850
|
+
T.innerHTML = String(((S = A == null ? void 0 : A.data) == null ? void 0 : S.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";
|
|
5688
5851
|
},
|
|
5689
5852
|
options: { offset: { x: 0, y: -10 } }
|
|
5690
5853
|
});
|
|
5691
5854
|
}
|
|
5692
5855
|
const r = this.computeRectangle(o[0], o[1], o[2]);
|
|
5693
5856
|
if (!r) return;
|
|
5694
|
-
const
|
|
5857
|
+
const h = r.corners, c = r.center, d = r.width, u = r.height, m = r.area, g = i.Cartographic.fromCartesian(c), p = t.id + "_rectangle", f = s.labelText || { width: "宽", heightLabel: "高", area: "面积", side: "边长" };
|
|
5695
5858
|
this.htmlLabelId = p, this.htmlLabelPool.add({ text: `${f.width}:${d.toFixed(2)} m
|
|
5696
5859
|
${f.heightLabel}:${u.toFixed(2)} m
|
|
5697
5860
|
${f.area}:${m.toFixed(2)} m²` }, { id: p, lon: i.Math.toDegrees(g.longitude), lat: i.Math.toDegrees(g.latitude), height: g.height || 0, theme: "measure-rectangle", show: !0 });
|
|
5698
5861
|
const w = [
|
|
5699
|
-
[
|
|
5700
|
-
[
|
|
5701
|
-
[
|
|
5702
|
-
[
|
|
5862
|
+
[h[0], h[1]],
|
|
5863
|
+
[h[1], h[2]],
|
|
5864
|
+
[h[2], h[3]],
|
|
5865
|
+
[h[3], h[0]]
|
|
5703
5866
|
];
|
|
5704
5867
|
for (let _ = 0; _ < w.length; _++) {
|
|
5705
|
-
const [T, A] = w[_],
|
|
5706
|
-
this.segmentLabelIds.push($), this.htmlLabelPool.add({ text: `${f.side}:${Number(
|
|
5868
|
+
const [T, A] = w[_], S = _ === 0 || _ === 2 ? d : u, k = new i.Cartesian3((T.x + A.x) / 2, (T.y + A.y) / 2, (T.z + A.z) / 2), x = i.Cartographic.fromCartesian(k), $ = t.id + `_rectangle_seg_${_}`;
|
|
5869
|
+
this.segmentLabelIds.push($), this.htmlLabelPool.add({ text: `${f.side}:${Number(S).toFixed(2)} m` }, { id: $, lon: i.Math.toDegrees(x.longitude), lat: i.Math.toDegrees(x.latitude), height: x.height || 0, theme: "measure-rectangle-seg", show: !0 });
|
|
5707
5870
|
}
|
|
5708
|
-
const y = new i.PolygonHierarchy(
|
|
5871
|
+
const y = new i.PolygonHierarchy(h), v = new i.PolygonGeometry({
|
|
5709
5872
|
polygonHierarchy: y,
|
|
5710
5873
|
vertexFormat: i.MaterialAppearance.VERTEX_FORMAT,
|
|
5711
5874
|
perPositionHeight: !0,
|
|
@@ -5716,7 +5879,7 @@ ${f.area}:${m.toFixed(2)} m²` }, { id: p, lon: i.Math.toDegrees(g.longitude), l
|
|
|
5716
5879
|
depthFailAppearance: new i.MaterialAppearance({ material: i.Material.fromType("Color", { color: M }), translucent: !0, closed: !0 })
|
|
5717
5880
|
});
|
|
5718
5881
|
this.primitive = P, n.scene.primitives.add(this.primitive);
|
|
5719
|
-
const L = s.lineColor || b, E = [...
|
|
5882
|
+
const L = s.lineColor || b, E = [...h, h[0]], I = n.entities.add({
|
|
5720
5883
|
polyline: {
|
|
5721
5884
|
positions: E,
|
|
5722
5885
|
width: s.width || 2,
|
|
@@ -5726,13 +5889,13 @@ ${f.area}:${m.toFixed(2)} m²` }, { id: p, lon: i.Math.toDegrees(g.longitude), l
|
|
|
5726
5889
|
}
|
|
5727
5890
|
});
|
|
5728
5891
|
this.edgeEntities.push(I);
|
|
5729
|
-
const
|
|
5730
|
-
for (const _ of
|
|
5892
|
+
const D = s.pointColor || b;
|
|
5893
|
+
for (const _ of h) {
|
|
5731
5894
|
const T = n.entities.add({
|
|
5732
5895
|
position: _,
|
|
5733
5896
|
point: {
|
|
5734
5897
|
pixelSize: 8,
|
|
5735
|
-
color:
|
|
5898
|
+
color: D,
|
|
5736
5899
|
disableDepthTestDistance: Number.POSITIVE_INFINITY
|
|
5737
5900
|
}
|
|
5738
5901
|
});
|
|
@@ -5742,45 +5905,45 @@ ${f.area}:${m.toFixed(2)} m²` }, { id: p, lon: i.Math.toDegrees(g.longitude), l
|
|
|
5742
5905
|
computeRectangle(t, e, i) {
|
|
5743
5906
|
const n = this.Cesium, s = new n.EllipsoidTangentPlane(t, n.Ellipsoid.WGS84), o = s.projectPointsOntoPlane([t, e, i]);
|
|
5744
5907
|
if (!o || o.length < 3) return null;
|
|
5745
|
-
const r = o[0],
|
|
5908
|
+
const r = o[0], h = o[1], c = o[2], d = h.x - r.x, u = h.y - r.y, m = Math.sqrt(d * d + u * u);
|
|
5746
5909
|
if (!m) return null;
|
|
5747
|
-
const g = d / m, f = -(u / m), w = g, y = c.x -
|
|
5910
|
+
const g = d / m, f = -(u / m), w = g, y = c.x - h.x, v = c.y - h.y, C = y * f + v * w;
|
|
5748
5911
|
if (!C) return null;
|
|
5749
|
-
const b = new n.Cartesian2(
|
|
5912
|
+
const b = new n.Cartesian2(h.x + f * C, h.y + w * C), M = new n.Cartesian2(r.x + f * C, r.y + w * C), P = s.projectPointsOntoEllipsoid([r, h, b, M]);
|
|
5750
5913
|
if (!P || P.length < 4) return null;
|
|
5751
|
-
const L = P, E = L[0], I = L[2],
|
|
5914
|
+
const L = P, E = L[0], I = L[2], D = Math.abs(m), _ = Math.abs(C), T = new n.Cartesian3(
|
|
5752
5915
|
(E.x + I.x) / 2,
|
|
5753
5916
|
(E.y + I.y) / 2,
|
|
5754
5917
|
(E.z + I.z) / 2
|
|
5755
|
-
),
|
|
5756
|
-
let
|
|
5757
|
-
for (let $ = 0; $ <
|
|
5758
|
-
const
|
|
5759
|
-
|
|
5918
|
+
), S = new n.EllipsoidTangentPlane(T, n.Ellipsoid.WGS84).projectPointsOntoPlane(L);
|
|
5919
|
+
let k = 0;
|
|
5920
|
+
for (let $ = 0; $ < S.length; $++) {
|
|
5921
|
+
const H = ($ + 1) % S.length;
|
|
5922
|
+
k += S[$].x * S[H].y - S[H].x * S[$].y;
|
|
5760
5923
|
}
|
|
5761
|
-
const x = Math.abs(
|
|
5762
|
-
return { corners: L, center: T, width:
|
|
5924
|
+
const x = Math.abs(k) / 2;
|
|
5925
|
+
return { corners: L, center: T, width: D, height: _, area: x };
|
|
5763
5926
|
}
|
|
5764
5927
|
}
|
|
5765
|
-
class
|
|
5928
|
+
class Pt {
|
|
5766
5929
|
constructor(t, e) {
|
|
5767
|
-
|
|
5768
|
-
|
|
5769
|
-
|
|
5770
|
-
|
|
5771
|
-
|
|
5772
|
-
|
|
5773
|
-
|
|
5774
|
-
|
|
5775
|
-
|
|
5776
|
-
|
|
5777
|
-
|
|
5778
|
-
|
|
5779
|
-
|
|
5780
|
-
|
|
5781
|
-
|
|
5782
|
-
|
|
5783
|
-
|
|
5930
|
+
l(this, "Cesium");
|
|
5931
|
+
l(this, "viewer");
|
|
5932
|
+
l(this, "handler", null);
|
|
5933
|
+
l(this, "entity", null);
|
|
5934
|
+
l(this, "positions", []);
|
|
5935
|
+
l(this, "labelEntity", null);
|
|
5936
|
+
l(this, "currentPoints", []);
|
|
5937
|
+
l(this, "primitive", null);
|
|
5938
|
+
l(this, "previewEntity", null);
|
|
5939
|
+
l(this, "edgeEntities", []);
|
|
5940
|
+
l(this, "pointEntities", []);
|
|
5941
|
+
l(this, "previewEdgeEntity", null);
|
|
5942
|
+
l(this, "previewPointEntities", []);
|
|
5943
|
+
l(this, "htmlLabelPool", null);
|
|
5944
|
+
l(this, "htmlLabelId", null);
|
|
5945
|
+
l(this, "segmentLabelIds", []);
|
|
5946
|
+
l(this, "previewLabelId", null);
|
|
5784
5947
|
this.Cesium = t, this.viewer = e;
|
|
5785
5948
|
}
|
|
5786
5949
|
start(t) {
|
|
@@ -5790,20 +5953,20 @@ class vt {
|
|
|
5790
5953
|
const s = t.overlayContainerId || "html-label-container";
|
|
5791
5954
|
this.htmlLabelPool = new N(e, i, s), this.htmlLabelPool.registerTheme("measure-regular", {
|
|
5792
5955
|
createElement: (o, r) => {
|
|
5793
|
-
var
|
|
5794
|
-
o.innerHTML = String(((
|
|
5956
|
+
var h;
|
|
5957
|
+
o.innerHTML = String(((h = r == null ? void 0 : r.data) == null ? void 0 : h.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";
|
|
5795
5958
|
},
|
|
5796
5959
|
options: { offset: { x: 0, y: -10 } }
|
|
5797
5960
|
}), this.htmlLabelPool.registerTheme("measure-regular-seg", {
|
|
5798
5961
|
createElement: (o, r) => {
|
|
5799
|
-
var
|
|
5800
|
-
o.innerHTML = String(((
|
|
5962
|
+
var h;
|
|
5963
|
+
o.innerHTML = String(((h = r == null ? void 0 : r.data) == null ? void 0 : h.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";
|
|
5801
5964
|
},
|
|
5802
5965
|
options: { offset: { x: 0, y: -10 } }
|
|
5803
5966
|
});
|
|
5804
5967
|
}
|
|
5805
5968
|
this.handler = new e.ScreenSpaceEventHandler(i.canvas), this.handler.setInputAction((s) => {
|
|
5806
|
-
var r,
|
|
5969
|
+
var r, h, c;
|
|
5807
5970
|
const o = i.scene.pickPosition(s.position);
|
|
5808
5971
|
if (o && (this.positions.push(o), this.positions.length === 2)) {
|
|
5809
5972
|
this.stop();
|
|
@@ -5828,7 +5991,7 @@ class vt {
|
|
|
5828
5991
|
closed: !0
|
|
5829
5992
|
})
|
|
5830
5993
|
}), i.scene.primitives.add(this.primitive);
|
|
5831
|
-
const C = t.lineColor || y, b = ((
|
|
5994
|
+
const C = t.lineColor || y, b = ((h = (r = t.dashLineColor || t.lineColor || t.color || e.Color.RED).withAlpha) == null ? void 0 : h.call(r, 0.9)) || e.Color.RED, M = g.slice(), P = i.entities.add({
|
|
5832
5995
|
polyline: {
|
|
5833
5996
|
positions: M,
|
|
5834
5997
|
width: t.width || 2,
|
|
@@ -5844,9 +6007,9 @@ class vt {
|
|
|
5844
6007
|
});
|
|
5845
6008
|
this.edgeEntities.push(P);
|
|
5846
6009
|
const L = t.pointColor || y, E = g.slice(0, g.length - 1);
|
|
5847
|
-
for (const
|
|
6010
|
+
for (const k of E) {
|
|
5848
6011
|
const x = i.entities.add({
|
|
5849
|
-
position:
|
|
6012
|
+
position: k,
|
|
5850
6013
|
point: {
|
|
5851
6014
|
pixelSize: 8,
|
|
5852
6015
|
color: L,
|
|
@@ -5855,15 +6018,15 @@ class vt {
|
|
|
5855
6018
|
});
|
|
5856
6019
|
this.pointEntities.push(x);
|
|
5857
6020
|
}
|
|
5858
|
-
const I = this.computeAreaByPlane(g),
|
|
6021
|
+
const I = this.computeAreaByPlane(g), D = e.Cartographic.fromCartesian(d), _ = this.htmlLabelId || `measure_regular_${Date.now()}`;
|
|
5859
6022
|
this.htmlLabelId = _;
|
|
5860
6023
|
const T = t.labelText || { sides: "边数", radius: "半径", circumference: "周长", area: "面积", side: "边长" };
|
|
5861
6024
|
this.previewLabelId && this.htmlLabelPool && (this.htmlLabelPool.removeByIds([this.previewLabelId]), this.previewLabelId = null);
|
|
5862
6025
|
let A = 0;
|
|
5863
|
-
for (let
|
|
5864
|
-
const x = g[
|
|
6026
|
+
for (let k = 1; k < g.length; k++) {
|
|
6027
|
+
const x = g[k - 1], $ = g[k], H = e.Cartographic.fromCartesian(x), z = e.Cartographic.fromCartesian($), B = new e.EllipsoidGeodesic(H, z).surfaceDistance;
|
|
5865
6028
|
A += B;
|
|
5866
|
-
const K = new e.Cartesian3((x.x + $.x) / 2, (x.y + $.y) / 2, (x.z + $.z) / 2), X = e.Cartographic.fromCartesian(K), se = `measure_regular_seg_${Date.now()}_${
|
|
6029
|
+
const K = new e.Cartesian3((x.x + $.x) / 2, (x.y + $.y) / 2, (x.z + $.z) / 2), X = e.Cartographic.fromCartesian(K), se = `measure_regular_seg_${Date.now()}_${k - 1}`;
|
|
5867
6030
|
this.segmentLabelIds.push(se), this.htmlLabelPool.add(
|
|
5868
6031
|
{ text: `${T.side}:${B.toFixed(2)} m` },
|
|
5869
6032
|
{
|
|
@@ -5883,14 +6046,14 @@ ${T.circumference}:${A.toFixed(2)} m
|
|
|
5883
6046
|
${T.area}:${I.toFixed(2)} m²` },
|
|
5884
6047
|
{
|
|
5885
6048
|
id: _,
|
|
5886
|
-
lon: e.Math.toDegrees(
|
|
5887
|
-
lat: e.Math.toDegrees(
|
|
5888
|
-
height:
|
|
6049
|
+
lon: e.Math.toDegrees(D.longitude),
|
|
6050
|
+
lat: e.Math.toDegrees(D.latitude),
|
|
6051
|
+
height: D.height || 0,
|
|
5889
6052
|
theme: "measure-regular",
|
|
5890
6053
|
show: !0
|
|
5891
6054
|
}
|
|
5892
6055
|
);
|
|
5893
|
-
const
|
|
6056
|
+
const S = {
|
|
5894
6057
|
entity: this.primitive,
|
|
5895
6058
|
label: this.labelEntity,
|
|
5896
6059
|
positions: g,
|
|
@@ -5900,14 +6063,14 @@ ${T.area}:${I.toFixed(2)} m²` },
|
|
|
5900
6063
|
area: I,
|
|
5901
6064
|
clear: () => this.clear()
|
|
5902
6065
|
};
|
|
5903
|
-
(c = t.onComplete) == null || c.call(t,
|
|
6066
|
+
(c = t.onComplete) == null || c.call(t, S);
|
|
5904
6067
|
}
|
|
5905
6068
|
}, e.ScreenSpaceEventType.LEFT_CLICK), this.handler.setInputAction((s) => {
|
|
5906
6069
|
var f, w;
|
|
5907
6070
|
if (this.positions.length !== 1) return;
|
|
5908
|
-
const o = this.positions[0], r = i.camera.getPickRay(s.endPosition),
|
|
5909
|
-
if (!
|
|
5910
|
-
const c = e.Cartesian3.distance(o,
|
|
6071
|
+
const o = this.positions[0], r = i.camera.getPickRay(s.endPosition), h = i.scene.globe.pick(r, i.scene);
|
|
6072
|
+
if (!h) return;
|
|
6073
|
+
const c = e.Cartesian3.distance(o, h);
|
|
5911
6074
|
if (this.currentPoints = this.buildRegularPolygonPoints(o, c, n), !this.previewEntity) {
|
|
5912
6075
|
const y = t.color || e.Color.YELLOW.withAlpha(0.4);
|
|
5913
6076
|
this.previewEntity = i.entities.add({
|
|
@@ -5944,7 +6107,7 @@ ${T.area}:${I.toFixed(2)} m²` },
|
|
|
5944
6107
|
disableDepthTestDistance: Number.POSITIVE_INFINITY
|
|
5945
6108
|
}
|
|
5946
6109
|
}), P = i.entities.add({
|
|
5947
|
-
position: new e.CallbackProperty(() =>
|
|
6110
|
+
position: new e.CallbackProperty(() => h || o, !1),
|
|
5948
6111
|
point: {
|
|
5949
6112
|
pixelSize: 8,
|
|
5950
6113
|
color: b,
|
|
@@ -6015,42 +6178,42 @@ ${p.area}:${u.toFixed(2)} m²` },
|
|
|
6015
6178
|
const L = s.overlayContainerId || "html-label-container";
|
|
6016
6179
|
this.htmlLabelPool = e || new N(i, n, L), this.htmlLabelPool.registerTheme("measure-regular", {
|
|
6017
6180
|
createElement: (E, I) => {
|
|
6018
|
-
var
|
|
6019
|
-
E.innerHTML = String(((
|
|
6181
|
+
var D;
|
|
6182
|
+
E.innerHTML = String(((D = I == null ? void 0 : I.data) == null ? void 0 : D.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";
|
|
6020
6183
|
},
|
|
6021
6184
|
options: { offset: { x: 0, y: -10 } }
|
|
6022
6185
|
}), this.htmlLabelPool.registerTheme("measure-regular-seg", {
|
|
6023
6186
|
createElement: (E, I) => {
|
|
6024
|
-
var
|
|
6025
|
-
E.innerHTML = String(((
|
|
6187
|
+
var D;
|
|
6188
|
+
E.innerHTML = String(((D = I == null ? void 0 : I.data) == null ? void 0 : D.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";
|
|
6026
6189
|
},
|
|
6027
6190
|
options: { offset: { x: 0, y: -10 } }
|
|
6028
6191
|
});
|
|
6029
6192
|
}
|
|
6030
|
-
let
|
|
6193
|
+
let h = [], c = r[0], d = 0;
|
|
6031
6194
|
if (r.length >= 3) {
|
|
6032
|
-
|
|
6033
|
-
|
|
6034
|
-
|
|
6035
|
-
|
|
6195
|
+
h = r.slice(), c = new i.Cartesian3(
|
|
6196
|
+
h.reduce((E, I) => E + I.x, 0) / h.length,
|
|
6197
|
+
h.reduce((E, I) => E + I.y, 0) / h.length,
|
|
6198
|
+
h.reduce((E, I) => E + I.z, 0) / h.length
|
|
6036
6199
|
);
|
|
6037
|
-
const L =
|
|
6038
|
-
|
|
6200
|
+
const L = h[0];
|
|
6201
|
+
h[Math.floor(h.length / 2)] || h[1], d = i.Cartesian3.distance(c, L);
|
|
6039
6202
|
} else {
|
|
6040
6203
|
const L = r[1];
|
|
6041
|
-
d = i.Cartesian3.distance(c, L),
|
|
6204
|
+
d = i.Cartesian3.distance(c, L), h = this.buildRegularPolygonPoints(c, d, Math.max(o, 3));
|
|
6042
6205
|
}
|
|
6043
|
-
const u = new i.PolygonHierarchy(
|
|
6206
|
+
const u = new i.PolygonHierarchy(h), m = new i.PolygonGeometry({ polygonHierarchy: u, vertexFormat: i.MaterialAppearance.VERTEX_FORMAT, perPositionHeight: !0 }), g = new i.GeometryInstance({ geometry: m }), p = s.color || i.Color.YELLOW.withAlpha(0.4), f = s.color && s.color.withAlpha ? s.color.withAlpha(0.25) : i.Color.RED.withAlpha(0.4), w = new i.Primitive({ geometryInstances: g, appearance: new i.MaterialAppearance({ material: i.Material.fromType("Color", { color: p }), translucent: !0, closed: !0 }), depthFailAppearance: new i.MaterialAppearance({ material: i.Material.fromType("Color", { color: f }), translucent: !0, closed: !0 }) });
|
|
6044
6207
|
n.scene.primitives.add(w), this.primitive = w;
|
|
6045
|
-
const y = this.computeAreaByPlane(
|
|
6208
|
+
const y = this.computeAreaByPlane(h), v = i.Cartographic.fromCartesian(c), C = t.id + "_regular";
|
|
6046
6209
|
this.htmlLabelId = C;
|
|
6047
6210
|
const b = s.labelText || { sides: "边数", radius: "半径", circumference: "周长", area: "面积", side: "边长" };
|
|
6048
6211
|
let M = 0;
|
|
6049
|
-
for (let L = 1; L <
|
|
6050
|
-
const E =
|
|
6212
|
+
for (let L = 1; L < h.length; L++) {
|
|
6213
|
+
const E = h[L - 1], I = h[L], D = i.Cartographic.fromCartesian(E), _ = i.Cartographic.fromCartesian(I), A = new i.EllipsoidGeodesic(D, _).surfaceDistance;
|
|
6051
6214
|
M += A;
|
|
6052
|
-
const
|
|
6053
|
-
this.segmentLabelIds.push(x), this.htmlLabelPool.add({ text: `${b.side}:${A.toFixed(2)} m` }, { id: x, lon: i.Math.toDegrees(
|
|
6215
|
+
const S = new i.Cartesian3((E.x + I.x) / 2, (E.y + I.y) / 2, (E.z + I.z) / 2), k = i.Cartographic.fromCartesian(S), x = t.id + `_regular_seg_${L - 1}`;
|
|
6216
|
+
this.segmentLabelIds.push(x), this.htmlLabelPool.add({ text: `${b.side}:${A.toFixed(2)} m` }, { id: x, lon: i.Math.toDegrees(k.longitude), lat: i.Math.toDegrees(k.latitude), height: k.height || 0, theme: "measure-regular-seg", show: !0 });
|
|
6054
6217
|
}
|
|
6055
6218
|
this.htmlLabelPool.add({ text: `${b.sides}:${Math.max(o, 3)}
|
|
6056
6219
|
${b.radius}:${d.toFixed(2)} m
|
|
@@ -6068,66 +6231,66 @@ ${b.area}:${y.toFixed(2)} m²` }, { id: C, lon: i.Math.toDegrees(v.longitude), l
|
|
|
6068
6231
|
}
|
|
6069
6232
|
computeAreaByPlane(t) {
|
|
6070
6233
|
const e = this.Cesium, i = new e.Cartesian3(
|
|
6071
|
-
t.reduce((r,
|
|
6072
|
-
t.reduce((r,
|
|
6073
|
-
t.reduce((r,
|
|
6234
|
+
t.reduce((r, h) => r + h.x, 0) / t.length,
|
|
6235
|
+
t.reduce((r, h) => r + h.y, 0) / t.length,
|
|
6236
|
+
t.reduce((r, h) => r + h.z, 0) / t.length
|
|
6074
6237
|
), s = new e.EllipsoidTangentPlane(i, e.Ellipsoid.WGS84).projectPointsOntoPlane(t);
|
|
6075
6238
|
let o = 0;
|
|
6076
6239
|
for (let r = 0; r < s.length; r++) {
|
|
6077
|
-
const
|
|
6078
|
-
o += s[r].x * s[
|
|
6240
|
+
const h = (r + 1) % s.length;
|
|
6241
|
+
o += s[r].x * s[h].y - s[h].x * s[r].y;
|
|
6079
6242
|
}
|
|
6080
6243
|
return Math.abs(o) / 2;
|
|
6081
6244
|
}
|
|
6082
6245
|
}
|
|
6083
|
-
class
|
|
6246
|
+
class Fo {
|
|
6084
6247
|
constructor({ Cesium: t, viewer: e }) {
|
|
6085
|
-
|
|
6086
|
-
|
|
6087
|
-
|
|
6088
|
-
|
|
6089
|
-
|
|
6090
|
-
|
|
6091
|
-
|
|
6092
|
-
|
|
6093
|
-
|
|
6248
|
+
l(this, "Cesium");
|
|
6249
|
+
l(this, "viewer");
|
|
6250
|
+
l(this, "actives", []);
|
|
6251
|
+
l(this, "measurements", []);
|
|
6252
|
+
l(this, "htmlLabelPool", null);
|
|
6253
|
+
l(this, "recordHandlers", /* @__PURE__ */ new Map());
|
|
6254
|
+
l(this, "specifiedClear", !1);
|
|
6255
|
+
l(this, "deleteLabelPool", null);
|
|
6256
|
+
l(this, "deleteLabelIds", /* @__PURE__ */ new Map());
|
|
6094
6257
|
this.Cesium = t, this.viewer = e, e.screenSpaceEventHandler.removeInputAction(t.ScreenSpaceEventType.LEFT_DOUBLE_CLICK);
|
|
6095
6258
|
}
|
|
6096
6259
|
measure(t, e) {
|
|
6097
6260
|
let i = null;
|
|
6098
6261
|
switch (t) {
|
|
6099
6262
|
case "horizontal":
|
|
6100
|
-
i = new
|
|
6263
|
+
i = new De(this.Cesium, this.viewer);
|
|
6101
6264
|
break;
|
|
6102
6265
|
case "vertical":
|
|
6103
|
-
i = new
|
|
6266
|
+
i = new gt(this.Cesium, this.viewer);
|
|
6104
6267
|
break;
|
|
6105
6268
|
case "triangle":
|
|
6106
|
-
i = new
|
|
6269
|
+
i = new ft(this.Cesium, this.viewer);
|
|
6107
6270
|
break;
|
|
6108
6271
|
case "space":
|
|
6109
|
-
i = new
|
|
6272
|
+
i = new yt(this.Cesium, this.viewer);
|
|
6110
6273
|
break;
|
|
6111
6274
|
case "area":
|
|
6112
|
-
i = new
|
|
6275
|
+
i = new Se(this.Cesium, this.viewer);
|
|
6113
6276
|
break;
|
|
6114
6277
|
case "circle":
|
|
6115
|
-
i = new
|
|
6278
|
+
i = new wt(this.Cesium, this.viewer);
|
|
6116
6279
|
break;
|
|
6117
6280
|
case "polyline":
|
|
6118
|
-
i = new
|
|
6281
|
+
i = new Ae(this.Cesium, this.viewer);
|
|
6119
6282
|
break;
|
|
6120
6283
|
case "terrainHeight":
|
|
6121
|
-
i = new
|
|
6284
|
+
i = new vt(this.Cesium, this.viewer);
|
|
6122
6285
|
break;
|
|
6123
6286
|
case "coordinate":
|
|
6124
|
-
i = new
|
|
6287
|
+
i = new Ct(this.Cesium, this.viewer);
|
|
6125
6288
|
break;
|
|
6126
6289
|
case "rectangle":
|
|
6127
|
-
i = new
|
|
6290
|
+
i = new bt(this.Cesium, this.viewer);
|
|
6128
6291
|
break;
|
|
6129
6292
|
case "regularPolygon":
|
|
6130
|
-
i = new
|
|
6293
|
+
i = new Pt(this.Cesium, this.viewer);
|
|
6131
6294
|
break;
|
|
6132
6295
|
default:
|
|
6133
6296
|
throw new Error(`Unsupported measurement type: ${t}`);
|
|
@@ -6168,8 +6331,8 @@ class On {
|
|
|
6168
6331
|
data: this._serializeMetrics(t, o)
|
|
6169
6332
|
};
|
|
6170
6333
|
this.measurements.push(r), n && this.recordHandlers.set(r.id, n), this.specifiedClear && this._showDeleteLabels("html-label-container"), (c = e.onComplete) == null || c.call(e, o);
|
|
6171
|
-
const
|
|
6172
|
-
|
|
6334
|
+
const h = this.actives.indexOf(n);
|
|
6335
|
+
h >= 0 && this.actives.splice(h, 1);
|
|
6173
6336
|
}
|
|
6174
6337
|
};
|
|
6175
6338
|
i.start(s);
|
|
@@ -6219,37 +6382,37 @@ class On {
|
|
|
6219
6382
|
let s = null;
|
|
6220
6383
|
switch (n.type) {
|
|
6221
6384
|
case "horizontal":
|
|
6222
|
-
s = new
|
|
6385
|
+
s = new De(this.Cesium, this.viewer);
|
|
6223
6386
|
break;
|
|
6224
6387
|
case "vertical":
|
|
6225
|
-
s = new
|
|
6388
|
+
s = new gt(this.Cesium, this.viewer);
|
|
6226
6389
|
break;
|
|
6227
6390
|
case "triangle":
|
|
6228
|
-
s = new
|
|
6391
|
+
s = new ft(this.Cesium, this.viewer);
|
|
6229
6392
|
break;
|
|
6230
6393
|
case "space":
|
|
6231
|
-
s = new
|
|
6394
|
+
s = new yt(this.Cesium, this.viewer);
|
|
6232
6395
|
break;
|
|
6233
6396
|
case "area":
|
|
6234
|
-
s = new
|
|
6397
|
+
s = new Se(this.Cesium, this.viewer);
|
|
6235
6398
|
break;
|
|
6236
6399
|
case "circle":
|
|
6237
|
-
s = new
|
|
6400
|
+
s = new wt(this.Cesium, this.viewer);
|
|
6238
6401
|
break;
|
|
6239
6402
|
case "polyline":
|
|
6240
|
-
s = new
|
|
6403
|
+
s = new Ae(this.Cesium, this.viewer);
|
|
6241
6404
|
break;
|
|
6242
6405
|
case "terrainHeight":
|
|
6243
|
-
s = new
|
|
6406
|
+
s = new vt(this.Cesium, this.viewer);
|
|
6244
6407
|
break;
|
|
6245
6408
|
case "coordinate":
|
|
6246
|
-
s = new
|
|
6409
|
+
s = new Ct(this.Cesium, this.viewer);
|
|
6247
6410
|
break;
|
|
6248
6411
|
case "rectangle":
|
|
6249
|
-
s = new
|
|
6412
|
+
s = new bt(this.Cesium, this.viewer);
|
|
6250
6413
|
break;
|
|
6251
6414
|
case "regularPolygon":
|
|
6252
|
-
s = new
|
|
6415
|
+
s = new Pt(this.Cesium, this.viewer);
|
|
6253
6416
|
break;
|
|
6254
6417
|
default:
|
|
6255
6418
|
s = null;
|
|
@@ -6368,13 +6531,13 @@ class On {
|
|
|
6368
6531
|
if (this.deleteLabelIds.has(i.id)) continue;
|
|
6369
6532
|
const s = this._computeRecordCenter(i);
|
|
6370
6533
|
if (!s) continue;
|
|
6371
|
-
const o = e.Cartographic.fromCartesian(s), r = e.Math.toDegrees(o.longitude),
|
|
6534
|
+
const o = e.Cartographic.fromCartesian(s), r = e.Math.toDegrees(o.longitude), h = e.Math.toDegrees(o.latitude), c = o.height || 0;
|
|
6372
6535
|
this.deleteLabelPool.add(
|
|
6373
6536
|
{ recordId: i.id },
|
|
6374
6537
|
{
|
|
6375
6538
|
id: n,
|
|
6376
6539
|
lon: r,
|
|
6377
|
-
lat:
|
|
6540
|
+
lat: h,
|
|
6378
6541
|
height: c,
|
|
6379
6542
|
theme: "measure-delete-label",
|
|
6380
6543
|
show: !0,
|
|
@@ -6394,12 +6557,12 @@ class On {
|
|
|
6394
6557
|
var n, s;
|
|
6395
6558
|
const e = this.Cesium, i = (t.positions || []).map((o) => this._toCartesian(o));
|
|
6396
6559
|
if (i.length > 0) {
|
|
6397
|
-
const o = i.reduce((c, d) => c + d.x, 0) / i.length, r = i.reduce((c, d) => c + d.y, 0) / i.length,
|
|
6398
|
-
return new e.Cartesian3(o, r,
|
|
6560
|
+
const o = i.reduce((c, d) => c + d.x, 0) / i.length, r = i.reduce((c, d) => c + d.y, 0) / i.length, h = i.reduce((c, d) => c + d.z, 0) / i.length;
|
|
6561
|
+
return new e.Cartesian3(o, r, h);
|
|
6399
6562
|
}
|
|
6400
6563
|
if (t.type === "coordinate" && ((n = t.data) != null && n.lnglat)) {
|
|
6401
|
-
const o = t.data.lnglat.lng, r = t.data.lnglat.lat,
|
|
6402
|
-
return e.Cartesian3.fromDegrees(o, r,
|
|
6564
|
+
const o = t.data.lnglat.lng, r = t.data.lnglat.lat, h = t.data.lnglat.height || 0;
|
|
6565
|
+
return e.Cartesian3.fromDegrees(o, r, h);
|
|
6403
6566
|
}
|
|
6404
6567
|
if (t.type === "terrainHeight" && ((s = t.data) != null && s.position)) {
|
|
6405
6568
|
const o = t.data.position;
|
|
@@ -6408,18 +6571,18 @@ class On {
|
|
|
6408
6571
|
return null;
|
|
6409
6572
|
}
|
|
6410
6573
|
}
|
|
6411
|
-
class
|
|
6574
|
+
class Ro {
|
|
6412
6575
|
constructor({ Cesium: t, viewer: e }) {
|
|
6413
|
-
|
|
6414
|
-
|
|
6415
|
-
|
|
6416
|
-
|
|
6417
|
-
|
|
6418
|
-
|
|
6419
|
-
|
|
6420
|
-
|
|
6421
|
-
|
|
6422
|
-
|
|
6576
|
+
l(this, "Cesium");
|
|
6577
|
+
l(this, "viewer");
|
|
6578
|
+
l(this, "options", null);
|
|
6579
|
+
l(this, "entity", null);
|
|
6580
|
+
l(this, "viewEntities", []);
|
|
6581
|
+
l(this, "startTime", null);
|
|
6582
|
+
l(this, "stopTime", null);
|
|
6583
|
+
l(this, "isPaused", !1);
|
|
6584
|
+
l(this, "lastTime", null);
|
|
6585
|
+
l(this, "onTick", (t) => {
|
|
6423
6586
|
if (!this.options || !this.entity) return;
|
|
6424
6587
|
const e = t.currentTime;
|
|
6425
6588
|
if (this.Cesium.JulianDate.lessThan(e, this.startTime) || this.Cesium.JulianDate.greaterThan(e, this.stopTime)) {
|
|
@@ -6474,14 +6637,14 @@ class kn {
|
|
|
6474
6637
|
s.push({ position: m, orientation: p });
|
|
6475
6638
|
}
|
|
6476
6639
|
const o = this.Cesium.JulianDate.now(), r = t.speed || 100;
|
|
6477
|
-
let
|
|
6640
|
+
let h = 0;
|
|
6478
6641
|
const c = [];
|
|
6479
6642
|
for (let u = 0; u < s.length; u++) {
|
|
6480
6643
|
if (u === 0)
|
|
6481
6644
|
c.push(o.clone());
|
|
6482
6645
|
else {
|
|
6483
6646
|
const g = this.Cesium.Cartesian3.distance(s[u - 1].position, s[u].position) / Math.max(r, 0.1);
|
|
6484
|
-
|
|
6647
|
+
h += g, c.push(this.Cesium.JulianDate.addSeconds(o, h, new this.Cesium.JulianDate()));
|
|
6485
6648
|
}
|
|
6486
6649
|
i.addSample(c[u], s[u].position), n.addSample(c[u], s[u].orientation);
|
|
6487
6650
|
}
|
|
@@ -6561,17 +6724,17 @@ class kn {
|
|
|
6561
6724
|
// Legacy/Helper methods compatibility if needed, but we are refactoring.
|
|
6562
6725
|
// We'll keep minimal interface compliance.
|
|
6563
6726
|
}
|
|
6564
|
-
class
|
|
6727
|
+
class zo {
|
|
6565
6728
|
constructor({ Cesium: t, viewer: e }) {
|
|
6566
|
-
|
|
6567
|
-
|
|
6568
|
-
|
|
6569
|
-
|
|
6570
|
-
|
|
6571
|
-
|
|
6572
|
-
|
|
6573
|
-
|
|
6574
|
-
|
|
6729
|
+
l(this, "Cesium");
|
|
6730
|
+
l(this, "viewer");
|
|
6731
|
+
l(this, "entity", null);
|
|
6732
|
+
l(this, "positionProperty", null);
|
|
6733
|
+
l(this, "startTime", null);
|
|
6734
|
+
l(this, "stopTime", null);
|
|
6735
|
+
l(this, "options", null);
|
|
6736
|
+
l(this, "cameraOffset", null);
|
|
6737
|
+
l(this, "onTick", (t) => {
|
|
6575
6738
|
if (!this.options || !this.positionProperty) return;
|
|
6576
6739
|
const e = t.currentTime, i = this.positionProperty.getValue(e);
|
|
6577
6740
|
if (this.options.followCamera && this.options.initialView && i) {
|
|
@@ -6608,13 +6771,13 @@ class Fn {
|
|
|
6608
6771
|
for (let g = 0; g < e.length; g++)
|
|
6609
6772
|
s.addSample(n[g], e[g]);
|
|
6610
6773
|
this.positionProperty = s;
|
|
6611
|
-
const o = new this.Cesium.VelocityOrientationProperty(s), r = t.showPath ?? !0,
|
|
6774
|
+
const o = new this.Cesium.VelocityOrientationProperty(s), r = t.showPath ?? !0, h = t.pathColor ?? this.Cesium.Color.YELLOW, c = t.pathWidth ?? 3, d = t.pointColor ?? this.Cesium.Color.RED, u = t.pointPixelSize ?? 8, m = {
|
|
6612
6775
|
availability: new this.Cesium.TimeIntervalCollection([
|
|
6613
6776
|
new this.Cesium.TimeInterval({ start: this.startTime, stop: this.stopTime })
|
|
6614
6777
|
]),
|
|
6615
6778
|
position: s,
|
|
6616
6779
|
orientation: o,
|
|
6617
|
-
path: r ? { material:
|
|
6780
|
+
path: r ? { material: h, width: c, leadTime: 0 } : void 0
|
|
6618
6781
|
};
|
|
6619
6782
|
t.modelUrl ? m.model = {
|
|
6620
6783
|
uri: t.modelUrl,
|
|
@@ -6659,36 +6822,36 @@ class Fn {
|
|
|
6659
6822
|
}
|
|
6660
6823
|
}
|
|
6661
6824
|
export {
|
|
6662
|
-
|
|
6663
|
-
|
|
6664
|
-
|
|
6665
|
-
|
|
6666
|
-
|
|
6667
|
-
|
|
6668
|
-
|
|
6669
|
-
|
|
6670
|
-
|
|
6671
|
-
|
|
6672
|
-
|
|
6673
|
-
|
|
6825
|
+
Se as AreaMeasure,
|
|
6826
|
+
To as BufferedHierarchicalAggregator,
|
|
6827
|
+
Ro as CameraRoamTool,
|
|
6828
|
+
wt as CircleMeasure,
|
|
6829
|
+
Ct as CoordinateMeasure,
|
|
6830
|
+
jt as DOM_EVENT_MAP,
|
|
6831
|
+
xo as DrawTool,
|
|
6832
|
+
Po as EditMode,
|
|
6833
|
+
ko as EntityLayerManager,
|
|
6834
|
+
_o as GLTFManage,
|
|
6835
|
+
Lo as GLTFManageEventKey,
|
|
6836
|
+
De as HorizontalMeasure,
|
|
6674
6837
|
N as HtmlOverlayLabelPool,
|
|
6675
|
-
|
|
6838
|
+
Bt as MarkerEventBus,
|
|
6676
6839
|
te as MarkerEventKey,
|
|
6677
|
-
|
|
6678
|
-
|
|
6679
|
-
|
|
6680
|
-
|
|
6681
|
-
|
|
6682
|
-
|
|
6683
|
-
|
|
6684
|
-
|
|
6685
|
-
|
|
6686
|
-
|
|
6687
|
-
|
|
6688
|
-
|
|
6689
|
-
|
|
6690
|
-
|
|
6691
|
-
|
|
6692
|
-
|
|
6840
|
+
$o as MaterialManager,
|
|
6841
|
+
Fo as MeasurementTool,
|
|
6842
|
+
zo as PathRoamTool,
|
|
6843
|
+
Ae as PolylineDistanceMeasure,
|
|
6844
|
+
Ho as PrimitiveManager,
|
|
6845
|
+
bt as RectangleMeasure,
|
|
6846
|
+
Pt as RegularPolygonMeasure,
|
|
6847
|
+
yt as SpaceMeasure,
|
|
6848
|
+
vt as TerrainHeightMeasure,
|
|
6849
|
+
ye as TooltipManager,
|
|
6850
|
+
ft as TriangleMeasure,
|
|
6851
|
+
gt as VerticalMeasure,
|
|
6852
|
+
Oo as convertGeoJsonToEntityData,
|
|
6853
|
+
Do as getDynamicImgMaterial,
|
|
6854
|
+
Ao as getPolylineFlowMaterialProperty,
|
|
6855
|
+
So as getWallMaterial
|
|
6693
6856
|
};
|
|
6694
6857
|
//# sourceMappingURL=cesium-core.mjs.map
|