@xingm/vmap-cesium-toolbar 0.0.2-alpha.11 → 0.0.2-alpha.13
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/dist/hooks/useDrawHelper.d.ts +5 -0
- package/dist/index.d.ts +31 -8
- package/dist/index.js +383 -221
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +6 -6
- package/dist/index.umd.js.map +1 -1
- package/dist/libs/CesiumMapDraw.d.ts +27 -0
- package/dist/libs/drawHelper/BaseDraw.d.ts +4 -0
- package/dist/package.json +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -91,14 +91,14 @@ class L {
|
|
|
91
91
|
* 应用/切换选中样式(统一逻辑,供调度器和子类共用)
|
|
92
92
|
*/
|
|
93
93
|
applySelectedStyleToEntity(e) {
|
|
94
|
-
|
|
94
|
+
I(e);
|
|
95
95
|
}
|
|
96
96
|
/**
|
|
97
97
|
* 恢复原始样式(兼容旧接口,内部仍走统一逻辑)
|
|
98
98
|
*/
|
|
99
99
|
restoreOriginalStyleForEntity(e) {
|
|
100
100
|
const t = e;
|
|
101
|
-
t._isSelected &&
|
|
101
|
+
t._isSelected && I(t);
|
|
102
102
|
}
|
|
103
103
|
constructor(e, t = {}) {
|
|
104
104
|
this.viewer = e, this.scene = e.scene, this.entities = e.entities, this.callbacks = t, this.updateOffsetHeight();
|
|
@@ -151,13 +151,29 @@ class L {
|
|
|
151
151
|
* 添加一个点到临时位置数组并创建点实体
|
|
152
152
|
*/
|
|
153
153
|
addPoint(e) {
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
154
|
+
if (!e || !Number.isFinite(e.x) || !Number.isFinite(e.y) || !Number.isFinite(e.z))
|
|
155
|
+
return;
|
|
156
|
+
let t;
|
|
157
|
+
try {
|
|
158
|
+
t = e.clone();
|
|
159
|
+
} catch {
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
let i;
|
|
163
|
+
try {
|
|
164
|
+
i = n.Cartographic.fromCartesian(t);
|
|
165
|
+
} catch {
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
if (!Number.isFinite(i.longitude) || !Number.isFinite(i.latitude))
|
|
169
|
+
return;
|
|
170
|
+
this.tempPositions.push(t);
|
|
171
|
+
const r = n.Cartesian3.fromRadians(
|
|
172
|
+
i.longitude,
|
|
173
|
+
i.latitude,
|
|
174
|
+
(i.height || 0) + this.offsetHeight
|
|
175
|
+
), o = this.entities.add({
|
|
176
|
+
position: r,
|
|
161
177
|
point: {
|
|
162
178
|
pixelSize: 8,
|
|
163
179
|
color: n.Color.RED,
|
|
@@ -168,7 +184,7 @@ class L {
|
|
|
168
184
|
disableDepthTestDistance: Number.POSITIVE_INFINITY
|
|
169
185
|
}
|
|
170
186
|
});
|
|
171
|
-
this.tempEntities.push(
|
|
187
|
+
this.tempEntities.push(o);
|
|
172
188
|
}
|
|
173
189
|
/**
|
|
174
190
|
* 创建总长/面积标签图片
|
|
@@ -199,7 +215,7 @@ class L {
|
|
|
199
215
|
}
|
|
200
216
|
// 其余公共方法(如有需要可在子类中覆盖)
|
|
201
217
|
}
|
|
202
|
-
function
|
|
218
|
+
function I(c) {
|
|
203
219
|
try {
|
|
204
220
|
const t = c._drawOptions?.selected;
|
|
205
221
|
if (!t) return;
|
|
@@ -253,16 +269,16 @@ function j(c) {
|
|
|
253
269
|
console.warn("toggleSelectedStyle failed", e);
|
|
254
270
|
}
|
|
255
271
|
}
|
|
256
|
-
function
|
|
272
|
+
function M(c) {
|
|
257
273
|
return !!c && Number.isFinite(c.x) && Number.isFinite(c.y) && Number.isFinite(c.z);
|
|
258
274
|
}
|
|
259
|
-
function
|
|
275
|
+
function j(c) {
|
|
260
276
|
return !isFinite(c) || isNaN(c) ? "0.00 m" : c >= 1e3 ? `${(c / 1e3).toFixed(2)} km` : `${c.toFixed(2)} m`;
|
|
261
277
|
}
|
|
262
|
-
function
|
|
278
|
+
function R(c) {
|
|
263
279
|
return !isFinite(c) || isNaN(c) ? "0.00 m²" : c >= 1 ? `${c.toFixed(2)} km²` : `${(c * 1e6).toFixed(2)} m²`;
|
|
264
280
|
}
|
|
265
|
-
function
|
|
281
|
+
function W(c, e) {
|
|
266
282
|
const t = n.Cartographic.fromCartesian(c), i = n.Cartographic.fromCartesian(e), r = Math.min(t.longitude, i.longitude), o = Math.max(t.longitude, i.longitude), s = Math.min(t.latitude, i.latitude), a = Math.max(t.latitude, i.latitude);
|
|
267
283
|
return new n.Rectangle(r, s, o, a);
|
|
268
284
|
}
|
|
@@ -276,14 +292,14 @@ function q(c) {
|
|
|
276
292
|
);
|
|
277
293
|
return o * s / 1e6;
|
|
278
294
|
}
|
|
279
|
-
function
|
|
280
|
-
const t = c.filter((o) =>
|
|
295
|
+
function H(c, e = n.Ellipsoid.WGS84) {
|
|
296
|
+
const t = c.filter((o) => M(o));
|
|
281
297
|
if (t.length < 3) return 0;
|
|
282
298
|
let i = 0;
|
|
283
299
|
const r = t.length;
|
|
284
300
|
for (let o = 0; o < r; o++) {
|
|
285
301
|
const s = t[o], a = t[(o + 1) % r];
|
|
286
|
-
if (!
|
|
302
|
+
if (!M(s) || !M(a))
|
|
287
303
|
return 0;
|
|
288
304
|
const l = e.cartesianToCartographic(s), h = e.cartesianToCartographic(a);
|
|
289
305
|
if (!l || !h || !Number.isFinite(l.longitude) || !Number.isFinite(l.latitude) || !Number.isFinite(h.longitude) || !Number.isFinite(h.latitude))
|
|
@@ -293,7 +309,7 @@ function R(c, e = n.Ellipsoid.WGS84) {
|
|
|
293
309
|
return i = Math.abs(i * 6378137 * 6378137 / 2), i / 1e6;
|
|
294
310
|
}
|
|
295
311
|
function J(c) {
|
|
296
|
-
const e = c.filter((o) =>
|
|
312
|
+
const e = c.filter((o) => M(o));
|
|
297
313
|
if (e.length === 0) return n.Cartesian3.ZERO;
|
|
298
314
|
let t = 0, i = 0, r = 0;
|
|
299
315
|
for (let o = 0; o < e.length; o++)
|
|
@@ -354,7 +370,7 @@ class V extends L {
|
|
|
354
370
|
finishDrawing() {
|
|
355
371
|
if (this.tempPositions.length < 2)
|
|
356
372
|
return this.restoreRequestRenderModeIfNeeded(), null;
|
|
357
|
-
const e = this.tempPositions.filter((l) =>
|
|
373
|
+
const e = this.tempPositions.filter((l) => M(l));
|
|
358
374
|
if (e.length < 2)
|
|
359
375
|
return this.restoreRequestRenderModeIfNeeded(), null;
|
|
360
376
|
const t = e.map((l) => {
|
|
@@ -474,15 +490,15 @@ class V extends L {
|
|
|
474
490
|
h.latitude,
|
|
475
491
|
(h.height || 0) + this.offsetHeight
|
|
476
492
|
));
|
|
477
|
-
const m = r % 2 === 0 ? -25 : 25,
|
|
493
|
+
const m = r % 2 === 0 ? -25 : 25, b = j(a);
|
|
478
494
|
if (r < this.currentSegmentLabels.length && this.currentSegmentLabels[r].billboard) {
|
|
479
495
|
const g = this.currentSegmentLabels[r];
|
|
480
|
-
if (g.position = new n.ConstantPositionProperty(u), g.billboard.pixelOffset = new n.ConstantProperty(new n.Cartesian2(0, m)), g._groundPosition = d, g._segmentText !==
|
|
481
|
-
const f = this.createSegmentLengthBillboardImage(
|
|
482
|
-
g.billboard.image = new n.ConstantProperty(f), g._segmentText =
|
|
496
|
+
if (g.position = new n.ConstantPositionProperty(u), g.billboard.pixelOffset = new n.ConstantProperty(new n.Cartesian2(0, m)), g._groundPosition = d, g._segmentText !== b) {
|
|
497
|
+
const f = this.createSegmentLengthBillboardImage(b);
|
|
498
|
+
g.billboard.image = new n.ConstantProperty(f), g._segmentText = b;
|
|
483
499
|
}
|
|
484
500
|
} else {
|
|
485
|
-
const g = this.createSegmentLengthBillboardImage(
|
|
501
|
+
const g = this.createSegmentLengthBillboardImage(b), w = this.entities.add({
|
|
486
502
|
position: u,
|
|
487
503
|
billboard: {
|
|
488
504
|
image: g,
|
|
@@ -496,7 +512,7 @@ class V extends L {
|
|
|
496
512
|
disableDepthTestDistance: new n.ConstantProperty(Number.POSITIVE_INFINITY)
|
|
497
513
|
}
|
|
498
514
|
});
|
|
499
|
-
|
|
515
|
+
w._segmentText = b, w._groundPosition = d, this.currentSegmentLabels.push(w), this.tempLabelEntities.push(w);
|
|
500
516
|
}
|
|
501
517
|
} else if (r < this.currentSegmentLabels.length) {
|
|
502
518
|
const l = this.currentSegmentLabels[r];
|
|
@@ -531,7 +547,7 @@ class V extends L {
|
|
|
531
547
|
i.latitude,
|
|
532
548
|
(i.height || 0) + this.offsetHeight
|
|
533
549
|
));
|
|
534
|
-
const a = `总长: ${
|
|
550
|
+
const a = `总长: ${j(e)}`, l = this.createTotalLengthBillboardImage(a);
|
|
535
551
|
if (this.currentTotalLabel && this.currentTotalLabel.billboard)
|
|
536
552
|
this.currentTotalLabel.position = new n.ConstantPositionProperty(o), this.currentTotalLabel.billboard.image = new n.ConstantProperty(l), this.currentTotalLabel._groundPosition = r;
|
|
537
553
|
else {
|
|
@@ -616,9 +632,15 @@ class K extends L {
|
|
|
616
632
|
updateDrawingEntity(e) {
|
|
617
633
|
if (this.scene.mode === n.SceneMode.SCENE3D && !this.scene.globe.tilesLoaded)
|
|
618
634
|
return;
|
|
619
|
-
const i = this.tempPositions.filter((o) =>
|
|
635
|
+
const i = this.tempPositions.filter((o) => M(o)), r = e && M(e) && i.length >= 2 ? [...i, e] : i;
|
|
620
636
|
if (r.length >= 3) {
|
|
621
|
-
const o = r.map((g) =>
|
|
637
|
+
const o = r.map((g) => {
|
|
638
|
+
try {
|
|
639
|
+
return n.Cartographic.fromCartesian(g);
|
|
640
|
+
} catch {
|
|
641
|
+
return null;
|
|
642
|
+
}
|
|
643
|
+
}).filter((g) => g && Number.isFinite(g.longitude) && Number.isFinite(g.latitude));
|
|
622
644
|
if (o.length < 3) {
|
|
623
645
|
if (this.currentPolygonEntity) {
|
|
624
646
|
this.entities.remove(this.currentPolygonEntity);
|
|
@@ -633,21 +655,21 @@ class K extends L {
|
|
|
633
655
|
return;
|
|
634
656
|
}
|
|
635
657
|
const s = o.map((g) => {
|
|
636
|
-
const
|
|
658
|
+
const w = g.height || 0, f = this.offsetHeight > 0 ? this.offsetHeight : 0.1;
|
|
637
659
|
return n.Cartesian3.fromRadians(
|
|
638
660
|
g.longitude,
|
|
639
661
|
g.latitude,
|
|
640
|
-
|
|
662
|
+
w + f
|
|
641
663
|
);
|
|
642
664
|
}), a = n.HeightReference.NONE, l = this.drawOptions?.fillColor ? this.resolveColor(this.drawOptions.fillColor) : n.Color.LIGHTGREEN.withAlpha(0.3), h = this.drawOptions?.strokeColor ? this.resolveColor(this.drawOptions.strokeColor) : this.drawOptions?.outlineColor ? this.resolveColor(this.drawOptions.outlineColor) : n.Color.LIGHTGREEN, d = this.drawOptions?.strokeWidth ?? this.drawOptions?.outlineWidth ?? 2, u = this.tempEntities.filter((g) => !!g?.polygon), m = this.tempEntities.filter((g) => {
|
|
643
|
-
const
|
|
644
|
-
return !!
|
|
665
|
+
const w = g;
|
|
666
|
+
return !!w?.polyline && !w?.point && !w?.polygon;
|
|
645
667
|
});
|
|
646
668
|
(u.length > 1 || m.length > 1) && ([...u, ...m].forEach((g) => {
|
|
647
669
|
this.entities.remove(g);
|
|
648
670
|
}), this.tempEntities = this.tempEntities.filter((g) => {
|
|
649
|
-
const
|
|
650
|
-
return
|
|
671
|
+
const w = g;
|
|
672
|
+
return w?.point ? !0 : !(w?.polygon || w?.polyline && !w?.polygon);
|
|
651
673
|
}), this.currentPolygonEntity = null, this.currentBorderEntity = null), this.currentPolygonEntity && this.tempEntities.indexOf(this.currentPolygonEntity) === -1 && (this.currentPolygonEntity = null), this.currentBorderEntity && this.tempEntities.indexOf(this.currentBorderEntity) === -1 && (this.currentBorderEntity = null), this.currentPolygonEntity ? (this.currentPolygonEntity.polygon.hierarchy = new n.ConstantProperty(
|
|
652
674
|
new n.PolygonHierarchy(s)
|
|
653
675
|
), this.currentPolygonEntity.polygon.heightReference = new n.ConstantProperty(a), this.currentPolygonEntity.polygon.material = new n.ColorMaterialProperty(l), this.currentPolygonEntity.polygon.outline = new n.ConstantProperty(!1)) : (this.currentPolygonEntity = this.entities.add({
|
|
@@ -658,10 +680,10 @@ class K extends L {
|
|
|
658
680
|
heightReference: a
|
|
659
681
|
}
|
|
660
682
|
}), this.tempEntities.push(this.currentPolygonEntity));
|
|
661
|
-
const
|
|
662
|
-
|
|
683
|
+
const b = s.slice();
|
|
684
|
+
b.length >= 2 && b.push(s[0]), this.currentBorderEntity && this.currentBorderEntity.polyline ? (this.currentBorderEntity.polyline.positions = new n.ConstantProperty(b), this.currentBorderEntity.polyline.width = new n.ConstantProperty(d), this.currentBorderEntity.polyline.material = new n.ColorMaterialProperty(h), this.currentBorderEntity.polyline.clampToGround = new n.ConstantProperty(!1)) : (this.currentBorderEntity = this.entities.add({
|
|
663
685
|
polyline: {
|
|
664
|
-
positions: new n.ConstantProperty(
|
|
686
|
+
positions: new n.ConstantProperty(b),
|
|
665
687
|
width: d,
|
|
666
688
|
material: new n.ColorMaterialProperty(h),
|
|
667
689
|
clampToGround: !1
|
|
@@ -684,10 +706,16 @@ class K extends L {
|
|
|
684
706
|
* 完成绘制
|
|
685
707
|
*/
|
|
686
708
|
finishDrawing() {
|
|
687
|
-
const e = this.tempPositions.filter((u) =>
|
|
709
|
+
const e = this.tempPositions.filter((u) => M(u));
|
|
688
710
|
if (e.length < 3)
|
|
689
711
|
return this.restoreRequestRenderModeIfNeeded(), null;
|
|
690
|
-
const t = e.map((u) =>
|
|
712
|
+
const t = e.map((u) => {
|
|
713
|
+
try {
|
|
714
|
+
return n.Cartographic.fromCartesian(u);
|
|
715
|
+
} catch {
|
|
716
|
+
return null;
|
|
717
|
+
}
|
|
718
|
+
}).filter((u) => u && Number.isFinite(u.longitude) && Number.isFinite(u.latitude));
|
|
691
719
|
if (t.length < 3)
|
|
692
720
|
return this.restoreRequestRenderModeIfNeeded(), null;
|
|
693
721
|
const i = t.map(
|
|
@@ -696,8 +724,8 @@ class K extends L {
|
|
|
696
724
|
let r = null, o = null;
|
|
697
725
|
const s = this.drawOptions?.fillColor ? this.resolveColor(this.drawOptions.fillColor) : n.Color.LIGHTGREEN.withAlpha(0.3), a = this.drawOptions?.strokeColor ? this.resolveColor(this.drawOptions.strokeColor) : this.drawOptions?.outlineColor ? this.resolveColor(this.drawOptions.outlineColor) : n.Color.LIGHTGREEN, l = this.drawOptions?.strokeWidth ?? this.drawOptions?.outlineWidth ?? 2;
|
|
698
726
|
if (this.offsetHeight > 0) {
|
|
699
|
-
const u = i.map((
|
|
700
|
-
const g = n.Cartographic.fromCartesian(
|
|
727
|
+
const u = i.map((b) => {
|
|
728
|
+
const g = n.Cartographic.fromCartesian(b);
|
|
701
729
|
return n.Cartesian3.fromRadians(
|
|
702
730
|
g.longitude,
|
|
703
731
|
g.latitude,
|
|
@@ -742,20 +770,20 @@ class K extends L {
|
|
|
742
770
|
}
|
|
743
771
|
}), r._groundPositions = i, r && (r._drawOptions = this.drawOptions, r._drawType = this.getDrawType(), this.drawOptions?.onClick && (r._onClick = this.drawOptions.onClick), o && (r._borderEntity = o));
|
|
744
772
|
}
|
|
745
|
-
const h =
|
|
746
|
-
if (h > 0) {
|
|
747
|
-
const u = J(i), m = n.Cartographic.fromCartesian(u),
|
|
773
|
+
const h = H(i, this.scene.globe.ellipsoid);
|
|
774
|
+
if (h > 0 && this.drawOptions?.showAreaLabel !== !1) {
|
|
775
|
+
const u = J(i), m = n.Cartographic.fromCartesian(u), b = n.Cartesian3.fromRadians(
|
|
748
776
|
m.longitude,
|
|
749
777
|
m.latitude,
|
|
750
778
|
m.height || 0
|
|
751
779
|
);
|
|
752
|
-
let g =
|
|
780
|
+
let g = b;
|
|
753
781
|
this.offsetHeight > 0 && (g = n.Cartesian3.fromRadians(
|
|
754
782
|
m.longitude,
|
|
755
783
|
m.latitude,
|
|
756
784
|
(m.height || 0) + this.offsetHeight
|
|
757
785
|
));
|
|
758
|
-
const
|
|
786
|
+
const w = `面积: ${R(h)}`, f = this.createTotalLengthBillboardImage(w), p = this.entities.add({
|
|
759
787
|
position: g,
|
|
760
788
|
billboard: {
|
|
761
789
|
image: f,
|
|
@@ -769,7 +797,9 @@ class K extends L {
|
|
|
769
797
|
disableDepthTestDistance: new n.ConstantProperty(Number.POSITIVE_INFINITY)
|
|
770
798
|
}
|
|
771
799
|
});
|
|
772
|
-
|
|
800
|
+
p._groundPosition = b, p._ownerEntityId = r.id;
|
|
801
|
+
const C = r;
|
|
802
|
+
C._labelEntities = [...C._labelEntities || [], p], this.tempLabelEntities.push(p);
|
|
773
803
|
}
|
|
774
804
|
this.tempEntities.forEach((u) => {
|
|
775
805
|
u && this.entities.remove(u);
|
|
@@ -778,7 +808,7 @@ class K extends L {
|
|
|
778
808
|
entity: r,
|
|
779
809
|
type: "polygon",
|
|
780
810
|
positions: i,
|
|
781
|
-
areaKm2:
|
|
811
|
+
areaKm2: H(i, this.scene.globe.ellipsoid)
|
|
782
812
|
};
|
|
783
813
|
return this.callbacks.onMeasureComplete && this.callbacks.onMeasureComplete(d), this.restoreRequestRenderModeIfNeeded(), this.callbacks.onDrawEnd && this.callbacks.onDrawEnd(r, d), d;
|
|
784
814
|
}
|
|
@@ -825,7 +855,7 @@ class _ extends L {
|
|
|
825
855
|
}
|
|
826
856
|
return;
|
|
827
857
|
}
|
|
828
|
-
const i =
|
|
858
|
+
const i = W(t[0], t[1]), r = n.HeightReference.NONE, o = this.drawOptions?.fillColor ? this.resolveColor(this.drawOptions.fillColor) : n.Color.GREEN, s = this.drawOptions?.strokeColor ? this.resolveColor(this.drawOptions.strokeColor) : this.drawOptions?.outlineColor ? this.resolveColor(this.drawOptions.outlineColor) : n.Color.DARKGREEN, a = this.drawOptions?.strokeWidth ?? this.drawOptions?.outlineWidth ?? 1;
|
|
829
859
|
this.currentRectangleEntity && !this.entities.contains(this.currentRectangleEntity) && (this.currentRectangleEntity = null), this.currentRectangleEntity ? (this.currentRectangleEntity.rectangle.coordinates = new n.ConstantProperty(i), this.currentRectangleEntity.rectangle.heightReference = new n.ConstantProperty(r), this.currentRectangleEntity.rectangle.extrudedHeight = this.offsetHeight > 0 ? new n.ConstantProperty(this.offsetHeight) : void 0, this.currentRectangleEntity.rectangle.material = new n.ColorMaterialProperty(o.withAlpha(0.5)), this.currentRectangleEntity.rectangle.outlineColor = new n.ConstantProperty(s), this.currentRectangleEntity.rectangle.outlineWidth = new n.ConstantProperty(a)) : (this.currentRectangleEntity = this.entities.add({
|
|
830
860
|
rectangle: {
|
|
831
861
|
coordinates: i,
|
|
@@ -844,17 +874,17 @@ class _ extends L {
|
|
|
844
874
|
finishDrawing() {
|
|
845
875
|
if (this.tempPositions.length < 2)
|
|
846
876
|
return this.restoreRequestRenderModeIfNeeded(), null;
|
|
847
|
-
const e = this.tempPositions.filter((m) =>
|
|
877
|
+
const e = this.tempPositions.filter((m) => M(m));
|
|
848
878
|
if (e.length < 2)
|
|
849
879
|
return this.restoreRequestRenderModeIfNeeded(), null;
|
|
850
880
|
const t = e.map((m) => {
|
|
851
|
-
const
|
|
881
|
+
const b = n.Cartographic.fromCartesian(m);
|
|
852
882
|
return n.Cartesian3.fromRadians(
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
883
|
+
b.longitude,
|
|
884
|
+
b.latitude,
|
|
885
|
+
b.height || 0
|
|
856
886
|
);
|
|
857
|
-
}), i =
|
|
887
|
+
}), i = W(t[0], t[1]);
|
|
858
888
|
let r = null;
|
|
859
889
|
const o = this.drawOptions?.fillColor ? this.resolveColor(this.drawOptions.fillColor) : n.Color.GREEN, s = this.drawOptions?.strokeColor ? this.resolveColor(this.drawOptions.strokeColor) : this.drawOptions?.outlineColor ? this.resolveColor(this.drawOptions.outlineColor) : n.Color.DARKGREEN, a = this.drawOptions?.strokeWidth ?? this.drawOptions?.outlineWidth ?? 1;
|
|
860
890
|
this.offsetHeight > 0 ? (r = this.entities.add({
|
|
@@ -880,19 +910,19 @@ class _ extends L {
|
|
|
880
910
|
}
|
|
881
911
|
}), r._groundRectangle = i), r && (r._drawOptions = this.drawOptions, r._drawType = this.getDrawType(), this.drawOptions?.onClick && (r._onClick = this.drawOptions.onClick));
|
|
882
912
|
const l = q(i);
|
|
883
|
-
if (l > 0) {
|
|
884
|
-
const m = n.Rectangle.center(i),
|
|
913
|
+
if (l > 0 && this.drawOptions?.showAreaLabel !== !1) {
|
|
914
|
+
const m = n.Rectangle.center(i), b = n.Cartesian3.fromRadians(
|
|
885
915
|
m.longitude,
|
|
886
916
|
m.latitude,
|
|
887
917
|
0
|
|
888
918
|
);
|
|
889
|
-
let g =
|
|
919
|
+
let g = b;
|
|
890
920
|
this.offsetHeight > 0 && (g = n.Cartesian3.fromRadians(
|
|
891
921
|
m.longitude,
|
|
892
922
|
m.latitude,
|
|
893
923
|
this.offsetHeight
|
|
894
924
|
));
|
|
895
|
-
const
|
|
925
|
+
const w = `面积: ${R(l)}`, f = this.createTotalLengthBillboardImage(w), p = this.entities.add({
|
|
896
926
|
position: g,
|
|
897
927
|
billboard: {
|
|
898
928
|
image: f,
|
|
@@ -906,15 +936,17 @@ class _ extends L {
|
|
|
906
936
|
disableDepthTestDistance: new n.ConstantProperty(Number.POSITIVE_INFINITY)
|
|
907
937
|
}
|
|
908
938
|
});
|
|
909
|
-
|
|
939
|
+
p._groundPosition = b, p._ownerEntityId = r.id;
|
|
940
|
+
const C = r;
|
|
941
|
+
C._labelEntities = [...C._labelEntities || [], p], this.tempLabelEntities.push(p);
|
|
910
942
|
}
|
|
911
943
|
this.tempEntities.forEach((m) => {
|
|
912
944
|
m && this.entities.remove(m);
|
|
913
945
|
}), this.tempEntities = [], this.tempPositions = [], this.currentRectangleEntity = null, this.originalDepthTestAgainstTerrain !== null && (this.scene.globe.depthTestAgainstTerrain = this.originalDepthTestAgainstTerrain, this.originalDepthTestAgainstTerrain = null);
|
|
914
946
|
const h = n.Rectangle.subsample(i, this.scene.globe.ellipsoid), d = (() => {
|
|
915
947
|
if (h.length > 1) {
|
|
916
|
-
const m = h[0],
|
|
917
|
-
if (n.Cartesian3.equalsEpsilon(m,
|
|
948
|
+
const m = h[0], b = h[h.length - 1];
|
|
949
|
+
if (n.Cartesian3.equalsEpsilon(m, b, n.Math.EPSILON9))
|
|
918
950
|
return h.slice(0, h.length - 1);
|
|
919
951
|
}
|
|
920
952
|
return h;
|
|
@@ -992,7 +1024,7 @@ class $ extends L {
|
|
|
992
1024
|
heightReference: n.HeightReference.NONE
|
|
993
1025
|
}
|
|
994
1026
|
}), this.tempEntities.push(this.currentCircleEntity)), d > 1) {
|
|
995
|
-
const u = n.Cartographic.fromCartesian(s), m = u.height || 0,
|
|
1027
|
+
const u = n.Cartographic.fromCartesian(s), m = u.height || 0, b = 0.1, g = i, w = this.generateCirclePositions(u, g, m + b), f = [...w, w[0]];
|
|
996
1028
|
this.currentBorderEntity && this.currentBorderEntity.polyline ? (this.currentBorderEntity.polyline.positions = new n.ConstantProperty(f), this.currentBorderEntity.polyline.material = new n.ColorMaterialProperty(h), this.currentBorderEntity.polyline.width = new n.ConstantProperty(d), this.currentBorderEntity.polyline.clampToGround = new n.ConstantProperty(!1)) : (this.currentBorderEntity = this.entities.add({
|
|
997
1029
|
polyline: {
|
|
998
1030
|
positions: f,
|
|
@@ -1025,8 +1057,8 @@ class $ extends L {
|
|
|
1025
1057
|
else if (this.currentCircleEntity) {
|
|
1026
1058
|
const f = this.currentCircleEntity.ellipse;
|
|
1027
1059
|
if (f) {
|
|
1028
|
-
const
|
|
1029
|
-
r = typeof
|
|
1060
|
+
const p = f.semiMajorAxis?.getValue(n.JulianDate.now());
|
|
1061
|
+
r = typeof p == "number" ? p : 0;
|
|
1030
1062
|
}
|
|
1031
1063
|
}
|
|
1032
1064
|
if (r < 1)
|
|
@@ -1050,7 +1082,7 @@ class $ extends L {
|
|
|
1050
1082
|
heightReference: n.HeightReference.NONE
|
|
1051
1083
|
}
|
|
1052
1084
|
});
|
|
1053
|
-
const f = n.Cartographic.fromCartesian(s),
|
|
1085
|
+
const f = n.Cartographic.fromCartesian(s), p = f.height || 0, C = 0.1, v = r, y = this.generateCirclePositions(f, v, p + C), x = [...y, y[0]], G = this.entities.add({
|
|
1054
1086
|
name: "绘制的圆-边框",
|
|
1055
1087
|
polyline: {
|
|
1056
1088
|
positions: x,
|
|
@@ -1076,11 +1108,11 @@ class $ extends L {
|
|
|
1076
1108
|
});
|
|
1077
1109
|
o._groundPosition = i, o._radius = r, o && (o._drawOptions = this.drawOptions, o._drawType = this.getDrawType(), this.drawOptions?.onClick && (o._onClick = this.drawOptions.onClick));
|
|
1078
1110
|
const d = Math.PI * r * r / 1e6;
|
|
1079
|
-
if (d > 0) {
|
|
1080
|
-
const f = `面积: ${
|
|
1111
|
+
if (d > 0 && this.drawOptions?.showAreaLabel !== !1) {
|
|
1112
|
+
const f = `面积: ${R(d)}`, p = this.createTotalLengthBillboardImage(f), C = this.entities.add({
|
|
1081
1113
|
position: s,
|
|
1082
1114
|
billboard: {
|
|
1083
|
-
image:
|
|
1115
|
+
image: p,
|
|
1084
1116
|
pixelOffset: new n.ConstantProperty(new n.Cartesian2(0, -25)),
|
|
1085
1117
|
heightReference: new n.ConstantProperty(
|
|
1086
1118
|
this.offsetHeight > 0 ? n.HeightReference.RELATIVE_TO_GROUND : n.HeightReference.NONE
|
|
@@ -1091,9 +1123,11 @@ class $ extends L {
|
|
|
1091
1123
|
disableDepthTestDistance: new n.ConstantProperty(Number.POSITIVE_INFINITY)
|
|
1092
1124
|
}
|
|
1093
1125
|
});
|
|
1094
|
-
C._groundPosition = i,
|
|
1126
|
+
C._groundPosition = i, C._ownerEntityId = o.id;
|
|
1127
|
+
const v = o;
|
|
1128
|
+
v._labelEntities = [...v._labelEntities || [], C], this.tempLabelEntities.push(C);
|
|
1095
1129
|
}
|
|
1096
|
-
this.tempEntities.forEach((f,
|
|
1130
|
+
this.tempEntities.forEach((f, p) => {
|
|
1097
1131
|
f && this.entities.remove(f);
|
|
1098
1132
|
}), this.tempEntities = [], this.tempPositions = [], this.currentCircleEntity = null, this.currentBorderEntity = null, this.centerPosition = null, this.originalDepthTestAgainstTerrain !== null && (this.scene.globe.depthTestAgainstTerrain = this.originalDepthTestAgainstTerrain, this.originalDepthTestAgainstTerrain = null);
|
|
1099
1133
|
const u = r / this.scene.globe.ellipsoid.maximumRadius, m = new n.Rectangle(
|
|
@@ -1101,20 +1135,20 @@ class $ extends L {
|
|
|
1101
1135
|
t.latitude - u,
|
|
1102
1136
|
t.longitude + u,
|
|
1103
1137
|
t.latitude + u
|
|
1104
|
-
),
|
|
1105
|
-
if (
|
|
1106
|
-
const f =
|
|
1107
|
-
if (n.Cartesian3.equalsEpsilon(f,
|
|
1108
|
-
return
|
|
1138
|
+
), b = n.Rectangle.subsample(m, this.scene.globe.ellipsoid), g = (() => {
|
|
1139
|
+
if (b.length > 1) {
|
|
1140
|
+
const f = b[0], p = b[b.length - 1];
|
|
1141
|
+
if (n.Cartesian3.equalsEpsilon(f, p, n.Math.EPSILON9))
|
|
1142
|
+
return b.slice(0, b.length - 1);
|
|
1109
1143
|
}
|
|
1110
|
-
return
|
|
1111
|
-
})(),
|
|
1144
|
+
return b;
|
|
1145
|
+
})(), w = {
|
|
1112
1146
|
entity: o,
|
|
1113
1147
|
type: "circle",
|
|
1114
1148
|
positions: g,
|
|
1115
1149
|
areaKm2: d
|
|
1116
1150
|
};
|
|
1117
|
-
return this.callbacks.onMeasureComplete && this.callbacks.onMeasureComplete(
|
|
1151
|
+
return this.callbacks.onMeasureComplete && this.callbacks.onMeasureComplete(w), this.restoreRequestRenderModeIfNeeded(), this.callbacks.onDrawEnd && this.callbacks.onDrawEnd(o, w), w;
|
|
1118
1152
|
}
|
|
1119
1153
|
/**
|
|
1120
1154
|
* 获取绘制类型
|
|
@@ -1128,7 +1162,7 @@ class $ extends L {
|
|
|
1128
1162
|
generateCirclePositions(e, t, i, r = 128) {
|
|
1129
1163
|
const s = e.latitude, a = e.longitude, l = t / 6378137, h = [];
|
|
1130
1164
|
for (let d = 0; d < r; d++) {
|
|
1131
|
-
const u = d / r * n.Math.TWO_PI, m = Math.sin(s),
|
|
1165
|
+
const u = d / r * n.Math.TWO_PI, m = Math.sin(s), b = Math.cos(s), g = Math.sin(l), w = Math.cos(l), f = Math.sin(u), p = Math.cos(u), C = Math.asin(m * w + b * g * p), v = a + Math.atan2(f * g * b, w - m * Math.sin(C));
|
|
1132
1166
|
h.push(n.Cartesian3.fromRadians(v, C, i));
|
|
1133
1167
|
}
|
|
1134
1168
|
return h;
|
|
@@ -1158,6 +1192,10 @@ class D {
|
|
|
1158
1192
|
// 双击判断
|
|
1159
1193
|
// 最近一次鼠标移动位置,用于在右键删点后立即重绘预览
|
|
1160
1194
|
lastPreviewPosition = null;
|
|
1195
|
+
// 绘制步骤提示(跟随鼠标的提示 Label)
|
|
1196
|
+
drawHintEntity = null;
|
|
1197
|
+
drawHintText = "";
|
|
1198
|
+
drawHintLastPosition = null;
|
|
1161
1199
|
// 静态:当前处于绘制状态的 DrawHelper,用于跨实例互斥
|
|
1162
1200
|
static activeDrawingHelper = null;
|
|
1163
1201
|
// 绘制类实例
|
|
@@ -1219,7 +1257,7 @@ class D {
|
|
|
1219
1257
|
} catch (d) {
|
|
1220
1258
|
console.warn("entity onClick handler error", d);
|
|
1221
1259
|
}
|
|
1222
|
-
s._drawOptions?.selected &&
|
|
1260
|
+
s._drawOptions?.selected && I(s);
|
|
1223
1261
|
}, n.ScreenSpaceEventType.LEFT_CLICK);
|
|
1224
1262
|
} catch (i) {
|
|
1225
1263
|
console.warn("entity click handler init failed", i);
|
|
@@ -1230,7 +1268,7 @@ class D {
|
|
|
1230
1268
|
*/
|
|
1231
1269
|
handleSceneModeChanged() {
|
|
1232
1270
|
const e = this.offsetHeight;
|
|
1233
|
-
this.updateOffsetHeight(), e !== this.offsetHeight && this.updateFinishedEntitiesForModeChange();
|
|
1271
|
+
this.updateOffsetHeight(), e !== this.offsetHeight && this.updateFinishedEntitiesForModeChange(), this.isDrawing && this.drawHintLastPosition && this.updateDrawHintPosition(this.drawHintLastPosition);
|
|
1234
1272
|
}
|
|
1235
1273
|
/**
|
|
1236
1274
|
* 根据场景模式更新偏移高度
|
|
@@ -1238,6 +1276,97 @@ class D {
|
|
|
1238
1276
|
updateOffsetHeight() {
|
|
1239
1277
|
this.scene.mode === n.SceneMode.SCENE3D ? this.offsetHeight = 1 : this.offsetHeight = 0;
|
|
1240
1278
|
}
|
|
1279
|
+
/**
|
|
1280
|
+
* 计算提示文本(随绘制模式 + 点数量变化)
|
|
1281
|
+
*/
|
|
1282
|
+
getDrawHintText() {
|
|
1283
|
+
if (!this.isDrawing || !this.drawMode)
|
|
1284
|
+
return "";
|
|
1285
|
+
const e = this.tempPositions.length;
|
|
1286
|
+
switch (this.drawMode) {
|
|
1287
|
+
case "circle":
|
|
1288
|
+
return e === 0 ? "单击确定圆心" : e === 1 ? "移动鼠标确定半径,单击确定半径点,双击完成,右键撤销" : "双击完成,右键撤销";
|
|
1289
|
+
case "rectangle":
|
|
1290
|
+
return e === 0 ? "单击确定起点" : e === 1 ? "移动鼠标确定终点,单击确定终点,双击完成,右键撤销" : "双击完成,右键撤销";
|
|
1291
|
+
case "polygon":
|
|
1292
|
+
return e === 0 ? "单击开始绘制" : "单击继续添加点,双击完成,右键删除最后一点";
|
|
1293
|
+
case "line":
|
|
1294
|
+
return e === 0 ? "单击开始绘制" : "单击继续添加点,双击完成,右键删除最后一点";
|
|
1295
|
+
default:
|
|
1296
|
+
return "";
|
|
1297
|
+
}
|
|
1298
|
+
}
|
|
1299
|
+
/**
|
|
1300
|
+
* 将提示位置转换为显示位置(按当前模式做轻微抬高,避免被地形遮挡)
|
|
1301
|
+
*/
|
|
1302
|
+
toHintDisplayPosition(e) {
|
|
1303
|
+
try {
|
|
1304
|
+
const t = n.Cartographic.fromCartesian(e), i = t.height || 0, r = this.offsetHeight > 0 ? this.offsetHeight : 0.1;
|
|
1305
|
+
return n.Cartesian3.fromRadians(
|
|
1306
|
+
t.longitude,
|
|
1307
|
+
t.latitude,
|
|
1308
|
+
i + r
|
|
1309
|
+
);
|
|
1310
|
+
} catch {
|
|
1311
|
+
return e;
|
|
1312
|
+
}
|
|
1313
|
+
}
|
|
1314
|
+
/**
|
|
1315
|
+
* 创建或更新提示实体的位置与文本
|
|
1316
|
+
*/
|
|
1317
|
+
updateDrawHintPosition(e) {
|
|
1318
|
+
if (!this.isDrawing) return;
|
|
1319
|
+
const t = this.getDrawHintText();
|
|
1320
|
+
if (!t) {
|
|
1321
|
+
this.clearDrawHint();
|
|
1322
|
+
return;
|
|
1323
|
+
}
|
|
1324
|
+
this.drawHintText = t, this.drawHintLastPosition = e.clone();
|
|
1325
|
+
const i = this.toHintDisplayPosition(e);
|
|
1326
|
+
this.drawHintEntity ? (this.drawHintEntity.position = new n.ConstantPositionProperty(i), this.drawHintEntity.label && (this.drawHintEntity.label.text = new n.ConstantProperty(this.drawHintText))) : this.drawHintEntity = this.entities.add({
|
|
1327
|
+
position: new n.ConstantPositionProperty(i),
|
|
1328
|
+
label: {
|
|
1329
|
+
text: this.drawHintText,
|
|
1330
|
+
font: "14px 'Microsoft YaHei', 'PingFang SC', sans-serif",
|
|
1331
|
+
showBackground: !0,
|
|
1332
|
+
backgroundColor: n.Color.BLACK.withAlpha(0.75),
|
|
1333
|
+
fillColor: n.Color.WHITE,
|
|
1334
|
+
outlineColor: n.Color.BLACK,
|
|
1335
|
+
outlineWidth: 2,
|
|
1336
|
+
style: n.LabelStyle.FILL_AND_OUTLINE,
|
|
1337
|
+
pixelOffset: new n.Cartesian2(12, -18),
|
|
1338
|
+
horizontalOrigin: n.HorizontalOrigin.LEFT,
|
|
1339
|
+
verticalOrigin: n.VerticalOrigin.TOP,
|
|
1340
|
+
disableDepthTestDistance: Number.POSITIVE_INFINITY,
|
|
1341
|
+
heightReference: n.HeightReference.NONE,
|
|
1342
|
+
scaleByDistance: new n.NearFarScalar(150, 1, 15e6, 0.6)
|
|
1343
|
+
}
|
|
1344
|
+
});
|
|
1345
|
+
}
|
|
1346
|
+
/**
|
|
1347
|
+
* 更新提示文本(不改变位置;通常在点数变化时调用)
|
|
1348
|
+
*/
|
|
1349
|
+
refreshDrawHintTextOnly() {
|
|
1350
|
+
const e = this.getDrawHintText();
|
|
1351
|
+
if (this.drawHintText = e, !e) {
|
|
1352
|
+
this.clearDrawHint();
|
|
1353
|
+
return;
|
|
1354
|
+
}
|
|
1355
|
+
this.drawHintEntity?.label && (this.drawHintEntity.label.text = new n.ConstantProperty(e));
|
|
1356
|
+
}
|
|
1357
|
+
/**
|
|
1358
|
+
* 清除绘制提示实体
|
|
1359
|
+
*/
|
|
1360
|
+
clearDrawHint() {
|
|
1361
|
+
if (this.drawHintEntity) {
|
|
1362
|
+
try {
|
|
1363
|
+
this.entities.remove(this.drawHintEntity);
|
|
1364
|
+
} catch {
|
|
1365
|
+
}
|
|
1366
|
+
this.drawHintEntity = null;
|
|
1367
|
+
}
|
|
1368
|
+
this.drawHintText = "", this.drawHintLastPosition = null;
|
|
1369
|
+
}
|
|
1241
1370
|
/**
|
|
1242
1371
|
* 开始绘制线条
|
|
1243
1372
|
*/
|
|
@@ -1268,7 +1397,7 @@ class D {
|
|
|
1268
1397
|
*/
|
|
1269
1398
|
startDrawing(e, t) {
|
|
1270
1399
|
const i = D.activeDrawingHelper;
|
|
1271
|
-
switch (i && i !== this && i.cancelDrawing(), this.endDrawingInternal(!1), this.drawMode = e, this.isDrawing = !0, this.lastPreviewPosition = null, D.activeDrawingHelper = this, this.tempPositions = [], this.tempEntities = [], this._doubleClickPending = !1, e) {
|
|
1400
|
+
switch (i && i !== this && i.cancelDrawing(), this.endDrawingInternal(!1), this.clearDrawHint(), this.drawMode = e, this.isDrawing = !0, this.lastPreviewPosition = null, D.activeDrawingHelper = this, this.tempPositions = [], this.tempEntities = [], this._doubleClickPending = !1, e) {
|
|
1272
1401
|
case "line":
|
|
1273
1402
|
this.currentDrawer = this.drawLine;
|
|
1274
1403
|
break;
|
|
@@ -1282,7 +1411,7 @@ class D {
|
|
|
1282
1411
|
this.currentDrawer = this.drawCircle;
|
|
1283
1412
|
break;
|
|
1284
1413
|
}
|
|
1285
|
-
this.currentDrawer && this.currentDrawer.startDrawing(t), this.activateDrawingHandlers();
|
|
1414
|
+
this.currentDrawer && this.currentDrawer.startDrawing(t), this.refreshDrawHintTextOnly(), this.activateDrawingHandlers();
|
|
1286
1415
|
}
|
|
1287
1416
|
/**
|
|
1288
1417
|
* 激活屏幕空间事件处理器
|
|
@@ -1298,16 +1427,16 @@ class D {
|
|
|
1298
1427
|
return;
|
|
1299
1428
|
}
|
|
1300
1429
|
const i = this.pickGlobePosition(t.position);
|
|
1301
|
-
i && this.addPoint(i);
|
|
1430
|
+
i && (this.updateDrawHintPosition(i), this.addPoint(i));
|
|
1302
1431
|
},
|
|
1303
1432
|
n.ScreenSpaceEventType.LEFT_CLICK
|
|
1304
1433
|
), this.screenSpaceEventHandler.setInputAction(() => {
|
|
1305
1434
|
!this.isDrawing || this.tempPositions.length === 0 || this.removeLastPoint();
|
|
1306
1435
|
}, n.ScreenSpaceEventType.RIGHT_CLICK), this.screenSpaceEventHandler.setInputAction(
|
|
1307
1436
|
(t) => {
|
|
1308
|
-
if (!this.isDrawing
|
|
1437
|
+
if (!this.isDrawing) return;
|
|
1309
1438
|
const i = this.pickGlobePosition(t.endPosition);
|
|
1310
|
-
i && this.updatePreview(i);
|
|
1439
|
+
i && (this.updateDrawHintPosition(i), this.tempPositions.length > 0 && this.updatePreview(i));
|
|
1311
1440
|
},
|
|
1312
1441
|
n.ScreenSpaceEventType.MOUSE_MOVE
|
|
1313
1442
|
);
|
|
@@ -1337,24 +1466,31 @@ class D {
|
|
|
1337
1466
|
* @returns 世界坐标 Cartesian3 或 null
|
|
1338
1467
|
*/
|
|
1339
1468
|
pickGlobePosition(e) {
|
|
1340
|
-
const t =
|
|
1341
|
-
if (t
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1469
|
+
const t = e;
|
|
1470
|
+
if (!t || !Number.isFinite(t.x) || !Number.isFinite(t.y))
|
|
1471
|
+
return null;
|
|
1472
|
+
try {
|
|
1473
|
+
const i = this.viewer.camera.getPickRay(e);
|
|
1474
|
+
if (i && this.scene.mode === n.SceneMode.SCENE3D && this.scene.globe.tilesLoaded) {
|
|
1475
|
+
const o = this.scene.globe.pick(i, this.scene);
|
|
1476
|
+
if (n.defined(o) && Number.isFinite(o.x) && Number.isFinite(o.y) && Number.isFinite(o.z))
|
|
1477
|
+
return o.clone();
|
|
1478
|
+
}
|
|
1479
|
+
const r = this.viewer.camera.pickEllipsoid(
|
|
1480
|
+
e,
|
|
1481
|
+
this.scene.globe.ellipsoid
|
|
1482
|
+
);
|
|
1483
|
+
return r && Number.isFinite(r.x) && Number.isFinite(r.y) && Number.isFinite(r.z) ? r.clone() : null;
|
|
1484
|
+
} catch {
|
|
1485
|
+
return null;
|
|
1345
1486
|
}
|
|
1346
|
-
const i = this.viewer.camera.pickEllipsoid(
|
|
1347
|
-
e,
|
|
1348
|
-
this.scene.globe.ellipsoid
|
|
1349
|
-
);
|
|
1350
|
-
return i && Number.isFinite(i.x) && Number.isFinite(i.y) && Number.isFinite(i.z) ? i : null;
|
|
1351
1487
|
}
|
|
1352
1488
|
/**
|
|
1353
1489
|
* 添加一个点到临时位置数组并创建点实体
|
|
1354
1490
|
* @param position 世界坐标
|
|
1355
1491
|
*/
|
|
1356
1492
|
addPoint(e) {
|
|
1357
|
-
this.drawMode === "polygon" && this.scene.mode === n.SceneMode.SCENE3D && !this.scene.globe.tilesLoaded || this.currentDrawer && (this.currentDrawer.addPointForHelper(e), this.tempPositions = this.currentDrawer.getTempPositions(), this.tempEntities = this.currentDrawer.getTempEntities(), this.updateDrawingEntity());
|
|
1493
|
+
this.drawMode === "polygon" && this.scene.mode === n.SceneMode.SCENE3D && !this.scene.globe.tilesLoaded || this.currentDrawer && (this.currentDrawer.addPointForHelper(e), this.tempPositions = this.currentDrawer.getTempPositions(), this.tempEntities = this.currentDrawer.getTempEntities(), this.updateDrawingEntity(), this.refreshDrawHintTextOnly());
|
|
1358
1494
|
}
|
|
1359
1495
|
/**
|
|
1360
1496
|
* 删除最后一个添加的点及其相关的临时实体
|
|
@@ -1363,7 +1499,7 @@ class D {
|
|
|
1363
1499
|
if (!this.currentDrawer)
|
|
1364
1500
|
return;
|
|
1365
1501
|
const e = this.currentDrawer.getTempPositions();
|
|
1366
|
-
!e || e.length === 0 || (this.currentDrawer.removeLastPointAndRedraw(), this.tempPositions = this.currentDrawer.getTempPositions(), this.tempEntities = this.currentDrawer.getTempEntities(), this.tempLabelEntities = this.currentDrawer.getTempLabelEntities(), this.lastPreviewPosition && this.isDrawing && this.updateDrawingEntity(this.lastPreviewPosition));
|
|
1502
|
+
!e || e.length === 0 || (this.currentDrawer.removeLastPointAndRedraw(), this.tempPositions = this.currentDrawer.getTempPositions(), this.tempEntities = this.currentDrawer.getTempEntities(), this.tempLabelEntities = this.currentDrawer.getTempLabelEntities(), this.lastPreviewPosition && this.isDrawing && this.updateDrawingEntity(this.lastPreviewPosition), this.refreshDrawHintTextOnly());
|
|
1367
1503
|
}
|
|
1368
1504
|
/**
|
|
1369
1505
|
* 更新预览线/面
|
|
@@ -1398,7 +1534,7 @@ class D {
|
|
|
1398
1534
|
}
|
|
1399
1535
|
e && e.entity && this.finishedEntities.push(e.entity), this.tempPositions = this.currentDrawer.getTempPositions(), this.tempEntities = this.currentDrawer.getTempEntities(), this.tempLabelEntities = this.currentDrawer.getTempLabelEntities(), this.finishedPointEntities = this.currentDrawer.getFinishedPointEntities(), this.tempLabelEntities.forEach((t) => {
|
|
1400
1536
|
this.finishedLabelEntities.push(t);
|
|
1401
|
-
}), this.tempLabelEntities = [], this.drawMode = null, this.isDrawing = !1, this.lastPreviewPosition = null, this.currentDrawer = null, this.deactivateDrawingHandlers(), D.activeDrawingHelper === this && (D.activeDrawingHelper = null);
|
|
1537
|
+
}), this.tempLabelEntities = [], this.drawMode = null, this.isDrawing = !1, this.lastPreviewPosition = null, this.currentDrawer = null, this.deactivateDrawingHandlers(), this.clearDrawHint(), D.activeDrawingHelper === this && (D.activeDrawingHelper = null);
|
|
1402
1538
|
}
|
|
1403
1539
|
/**
|
|
1404
1540
|
* 内部方法:重置绘图状态和清理临时数据
|
|
@@ -1406,7 +1542,7 @@ class D {
|
|
|
1406
1542
|
*/
|
|
1407
1543
|
endDrawingInternal(e) {
|
|
1408
1544
|
if (this.currentDrawer && (this.currentDrawer.clearTempEntitiesForHelper(), this.tempPositions = this.currentDrawer.getTempPositions(), this.tempEntities = this.currentDrawer.getTempEntities(), this.tempLabelEntities = this.currentDrawer.getTempLabelEntities()), this.tempEntities = [], this.tempLabelEntities = [], this.tempPositions = [], e) {
|
|
1409
|
-
this.drawMode = null, this.isDrawing = !1, this.lastPreviewPosition = null, this.currentDrawer = null, this.deactivateDrawingHandlers(), this.originalDepthTestAgainstTerrain !== null && (this.scene.globe.depthTestAgainstTerrain = this.originalDepthTestAgainstTerrain, this.originalDepthTestAgainstTerrain = null);
|
|
1545
|
+
this.drawMode = null, this.isDrawing = !1, this.lastPreviewPosition = null, this.currentDrawer = null, this.deactivateDrawingHandlers(), this.clearDrawHint(), this.originalDepthTestAgainstTerrain !== null && (this.scene.globe.depthTestAgainstTerrain = this.originalDepthTestAgainstTerrain, this.originalDepthTestAgainstTerrain = null);
|
|
1410
1546
|
try {
|
|
1411
1547
|
this.currentDrawer && this.currentDrawer.restoreRequestRenderModeIfNeeded && this.currentDrawer.restoreRequestRenderModeIfNeeded();
|
|
1412
1548
|
} catch {
|
|
@@ -1476,10 +1612,36 @@ class D {
|
|
|
1476
1612
|
removeEntity(e) {
|
|
1477
1613
|
const t = this.finishedEntities.indexOf(e);
|
|
1478
1614
|
if (t > -1) {
|
|
1479
|
-
const i = e.
|
|
1480
|
-
|
|
1615
|
+
const i = e, r = i._labelEntities;
|
|
1616
|
+
if (r && r.length > 0)
|
|
1617
|
+
r.forEach((s) => {
|
|
1618
|
+
try {
|
|
1619
|
+
s && this.entities.remove(s);
|
|
1620
|
+
} catch {
|
|
1621
|
+
}
|
|
1622
|
+
}), this.finishedLabelEntities = this.finishedLabelEntities.filter((s) => !r.includes(s)), i._labelEntities = [];
|
|
1623
|
+
else {
|
|
1624
|
+
const s = e.id;
|
|
1625
|
+
if (s) {
|
|
1626
|
+
const a = this.finishedLabelEntities.filter((l) => l?._ownerEntityId === s);
|
|
1627
|
+
a.forEach((l) => {
|
|
1628
|
+
try {
|
|
1629
|
+
this.entities.remove(l);
|
|
1630
|
+
} catch {
|
|
1631
|
+
}
|
|
1632
|
+
}), a.length > 0 && (this.finishedLabelEntities = this.finishedLabelEntities.filter((l) => l?._ownerEntityId !== s));
|
|
1633
|
+
}
|
|
1634
|
+
}
|
|
1635
|
+
const o = e._borderEntity;
|
|
1636
|
+
o && this.entities.remove(o), this.entities.remove(e), this.finishedEntities.splice(t, 1), this.onEntityRemovedCallback && this.onEntityRemovedCallback(e);
|
|
1481
1637
|
}
|
|
1482
1638
|
}
|
|
1639
|
+
/**
|
|
1640
|
+
* 获取某个绘制实体关联的标签实体(例如面积标签)
|
|
1641
|
+
*/
|
|
1642
|
+
getEntityLabelEntities(e) {
|
|
1643
|
+
return [...e?._labelEntities || []];
|
|
1644
|
+
}
|
|
1483
1645
|
/**
|
|
1484
1646
|
* 获取所有已完成的实体
|
|
1485
1647
|
* @returns 实体数组
|
|
@@ -1771,22 +1933,22 @@ class te {
|
|
|
1771
1933
|
const g = t.globe.pick(h, t);
|
|
1772
1934
|
n.defined(g) && (l = n.Cartographic.fromCartesian(g));
|
|
1773
1935
|
}
|
|
1774
|
-
const d = i.positionCartographic.height, u = i.heading, m = i.pitch,
|
|
1936
|
+
const d = i.positionCartographic.height, u = i.heading, m = i.pitch, b = i.roll;
|
|
1775
1937
|
if (t.mode = o, this.onSceneModeChanged && this.onSceneModeChanged(), l) {
|
|
1776
|
-
const g = l.longitude,
|
|
1938
|
+
const g = l.longitude, w = l.latitude;
|
|
1777
1939
|
o === n.SceneMode.SCENE2D ? i.setView({
|
|
1778
|
-
destination: n.Cartesian3.fromRadians(g,
|
|
1940
|
+
destination: n.Cartesian3.fromRadians(g, w, d),
|
|
1779
1941
|
orientation: {
|
|
1780
1942
|
heading: 0,
|
|
1781
1943
|
pitch: -Math.PI / 2,
|
|
1782
1944
|
roll: 0
|
|
1783
1945
|
}
|
|
1784
1946
|
}) : i.setView({
|
|
1785
|
-
destination: n.Cartesian3.fromRadians(g,
|
|
1947
|
+
destination: n.Cartesian3.fromRadians(g, w, d),
|
|
1786
1948
|
orientation: {
|
|
1787
1949
|
heading: u,
|
|
1788
1950
|
pitch: m,
|
|
1789
|
-
roll:
|
|
1951
|
+
roll: b
|
|
1790
1952
|
}
|
|
1791
1953
|
});
|
|
1792
1954
|
}
|
|
@@ -1943,13 +2105,13 @@ class ae {
|
|
|
1943
2105
|
`, r.appendChild(o), r.appendChild(s), this.toolbarElement.insertBefore(r, e), this.searchContainer = r;
|
|
1944
2106
|
const a = r.getBoundingClientRect(), l = window.innerHeight;
|
|
1945
2107
|
if (a.bottom > l) {
|
|
1946
|
-
const f = a.bottom - l,
|
|
2108
|
+
const f = a.bottom - l, p = parseFloat(r.style.top || "0"), C = Math.max(0, p - f);
|
|
1947
2109
|
r.style.top = `${C}px`;
|
|
1948
2110
|
}
|
|
1949
2111
|
const h = r.getBoundingClientRect();
|
|
1950
2112
|
if (h.top < 0) {
|
|
1951
|
-
const f = -h.top,
|
|
1952
|
-
r.style.top = `${
|
|
2113
|
+
const f = -h.top, p = parseFloat(r.style.top || "0");
|
|
2114
|
+
r.style.top = `${p + f}px`;
|
|
1953
2115
|
}
|
|
1954
2116
|
let d;
|
|
1955
2117
|
o.addEventListener("input", () => {
|
|
@@ -1966,42 +2128,42 @@ class ae {
|
|
|
1966
2128
|
d = setTimeout(async () => {
|
|
1967
2129
|
if (this.searchCallback?.onSearch)
|
|
1968
2130
|
try {
|
|
1969
|
-
const
|
|
1970
|
-
this.displaySearchResults(
|
|
1971
|
-
} catch (
|
|
1972
|
-
console.error("搜索失败:",
|
|
2131
|
+
const p = await this.searchCallback.onSearch(f);
|
|
2132
|
+
this.displaySearchResults(p, s);
|
|
2133
|
+
} catch (p) {
|
|
2134
|
+
console.error("搜索失败:", p), s.innerHTML = '<div style="padding: 8px; color: #666;">搜索失败</div>';
|
|
1973
2135
|
}
|
|
1974
2136
|
else
|
|
1975
2137
|
try {
|
|
1976
|
-
const
|
|
1977
|
-
this.displaySearchResults(
|
|
1978
|
-
} catch (
|
|
1979
|
-
console.error("默认搜索失败:",
|
|
2138
|
+
const p = await this.performDefaultSearch(f);
|
|
2139
|
+
this.displaySearchResults(p, s);
|
|
2140
|
+
} catch (p) {
|
|
2141
|
+
console.error("默认搜索失败:", p), s.innerHTML = '<div style="padding: 8px; color: #666;">搜索失败</div>';
|
|
1980
2142
|
}
|
|
1981
2143
|
}, 300);
|
|
1982
2144
|
});
|
|
1983
2145
|
let u;
|
|
1984
2146
|
const m = (f) => {
|
|
1985
|
-
const
|
|
1986
|
-
if (
|
|
1987
|
-
clearTimeout(u), this.closeSearchContainer(), r.removeEventListener("mouseleave", m), r.removeEventListener("mouseenter",
|
|
2147
|
+
const p = f.relatedTarget;
|
|
2148
|
+
if (p && (p.closest(".cesium-toolbar-button") !== null || p.closest(".cesium-map-toolbar") !== null)) {
|
|
2149
|
+
clearTimeout(u), this.closeSearchContainer(), r.removeEventListener("mouseleave", m), r.removeEventListener("mouseenter", b), o.removeEventListener("blur", g);
|
|
1988
2150
|
return;
|
|
1989
2151
|
}
|
|
1990
2152
|
u = setTimeout(() => {
|
|
1991
2153
|
const v = r.matches(":hover"), y = e.matches(":hover"), x = this.toolbarElement.matches(":hover"), G = document.activeElement === o;
|
|
1992
|
-
!v && !y && !x && !G && (this.closeSearchContainer(), r.removeEventListener("mouseleave", m), r.removeEventListener("mouseenter",
|
|
2154
|
+
!v && !y && !x && !G && (this.closeSearchContainer(), r.removeEventListener("mouseleave", m), r.removeEventListener("mouseenter", b), o.removeEventListener("blur", g));
|
|
1993
2155
|
}, 150);
|
|
1994
|
-
},
|
|
2156
|
+
}, b = () => {
|
|
1995
2157
|
clearTimeout(u);
|
|
1996
2158
|
}, g = () => {
|
|
1997
2159
|
setTimeout(() => {
|
|
1998
|
-
const f = r.matches(":hover"),
|
|
1999
|
-
document.activeElement !== o && !f && !
|
|
2160
|
+
const f = r.matches(":hover"), p = e.matches(":hover"), C = this.toolbarElement.matches(":hover");
|
|
2161
|
+
document.activeElement !== o && !f && !p && !C && (this.closeSearchContainer(), r.removeEventListener("mouseleave", m), r.removeEventListener("mouseenter", b), o.removeEventListener("blur", g));
|
|
2000
2162
|
}, 200);
|
|
2001
|
-
},
|
|
2002
|
-
f.key === "Escape" && (this.closeSearchContainer(), r.removeEventListener("mouseleave", m), r.removeEventListener("mouseenter",
|
|
2163
|
+
}, w = (f) => {
|
|
2164
|
+
f.key === "Escape" && (this.closeSearchContainer(), r.removeEventListener("mouseleave", m), r.removeEventListener("mouseenter", b), o.removeEventListener("blur", g), document.removeEventListener("keydown", w));
|
|
2003
2165
|
};
|
|
2004
|
-
r.addEventListener("mouseleave", m), r.addEventListener("mouseenter",
|
|
2166
|
+
r.addEventListener("mouseleave", m), r.addEventListener("mouseenter", b), o.addEventListener("blur", g), document.addEventListener("keydown", w), setTimeout(() => {
|
|
2005
2167
|
o.focus();
|
|
2006
2168
|
}, 100);
|
|
2007
2169
|
}
|
|
@@ -2366,12 +2528,12 @@ class le {
|
|
|
2366
2528
|
}
|
|
2367
2529
|
}
|
|
2368
2530
|
}
|
|
2369
|
-
const
|
|
2531
|
+
const z = {
|
|
2370
2532
|
basePath: "/geojson",
|
|
2371
2533
|
silent: !1
|
|
2372
2534
|
};
|
|
2373
2535
|
async function ce(c = {}) {
|
|
2374
|
-
const { basePath: e } = { ...
|
|
2536
|
+
const { basePath: e } = { ...z, ...c };
|
|
2375
2537
|
try {
|
|
2376
2538
|
const t = await fetch(`${e}/file-list.json`);
|
|
2377
2539
|
if (t.ok) {
|
|
@@ -2384,7 +2546,7 @@ async function ce(c = {}) {
|
|
|
2384
2546
|
return [];
|
|
2385
2547
|
}
|
|
2386
2548
|
async function he(c, e = {}) {
|
|
2387
|
-
const { basePath: t, silent: i } = { ...
|
|
2549
|
+
const { basePath: t, silent: i } = { ...z, ...e };
|
|
2388
2550
|
try {
|
|
2389
2551
|
const r = `${t}/${c}.geojson`, o = await fetch(r);
|
|
2390
2552
|
if (!o.ok)
|
|
@@ -2396,7 +2558,7 @@ async function he(c, e = {}) {
|
|
|
2396
2558
|
}
|
|
2397
2559
|
}
|
|
2398
2560
|
async function de(c, e = {}) {
|
|
2399
|
-
const { silent: t } = { ...
|
|
2561
|
+
const { silent: t } = { ...z, ...e };
|
|
2400
2562
|
let i = c;
|
|
2401
2563
|
if ((!i || i.length === 0) && (i = await ce(e)), !i || i.length === 0)
|
|
2402
2564
|
return t || (console.warn("未提供 GeoJSON 文件列表,无法加载数据"), console.warn("请使用 loadAllAirportNoFlyZones(fileList) 提供文件列表,"), console.warn("或在 public/geojson 目录下创建 file-list.json 文件")), [];
|
|
@@ -2455,13 +2617,13 @@ class ue {
|
|
|
2455
2617
|
try {
|
|
2456
2618
|
const a = this.viewer.scene.mode === n.SceneMode.SCENE3D, l = o.extrudedHeight, h = o.height, d = typeof l == "number" ? l : l?.getValue(n.JulianDate.now()), u = typeof h == "number" ? h : h?.getValue(n.JulianDate.now()), m = d ?? u ?? 0;
|
|
2457
2619
|
if (a && m > 0) {
|
|
2458
|
-
const
|
|
2459
|
-
const f = n.Cartographic.fromCartesian(
|
|
2620
|
+
const b = r.map((w) => {
|
|
2621
|
+
const f = n.Cartographic.fromCartesian(w);
|
|
2460
2622
|
return n.Cartesian3.fromRadians(f.longitude, f.latitude, m);
|
|
2461
2623
|
}), g = this.viewer.entities.add({
|
|
2462
2624
|
name: `${t.name}_top_outline`,
|
|
2463
2625
|
polyline: {
|
|
2464
|
-
positions:
|
|
2626
|
+
positions: b,
|
|
2465
2627
|
width: 2,
|
|
2466
2628
|
material: n.Color.RED,
|
|
2467
2629
|
clampToGround: !1
|
|
@@ -2977,14 +3139,14 @@ class be {
|
|
|
2977
3139
|
if (this.measurementCallback?.onDistanceComplete)
|
|
2978
3140
|
this.measurementCallback.onDistanceComplete(t, i);
|
|
2979
3141
|
else {
|
|
2980
|
-
const r =
|
|
3142
|
+
const r = j(i);
|
|
2981
3143
|
console.log(`测距完成,总距离: ${r}`);
|
|
2982
3144
|
}
|
|
2983
3145
|
}
|
|
2984
3146
|
} else if (e.polygon) {
|
|
2985
3147
|
const t = e.polygon.hierarchy?.getValue(n.JulianDate.now());
|
|
2986
3148
|
if (t && this.measurementCallback?.onAreaComplete) {
|
|
2987
|
-
const i =
|
|
3149
|
+
const i = H(t.positions, this.viewer.scene.globe.ellipsoid);
|
|
2988
3150
|
this.measurementCallback.onAreaComplete(t.positions, i);
|
|
2989
3151
|
}
|
|
2990
3152
|
}
|
|
@@ -3755,12 +3917,12 @@ class De {
|
|
|
3755
3917
|
return t ? (t._onClick = void 0, this.entities.remove(t)) : !1;
|
|
3756
3918
|
}
|
|
3757
3919
|
}
|
|
3758
|
-
const
|
|
3759
|
-
class
|
|
3920
|
+
const Pe = 1e3, T = "_infoWindowData";
|
|
3921
|
+
class Me {
|
|
3760
3922
|
viewer;
|
|
3761
3923
|
container;
|
|
3762
3924
|
entityMap = /* @__PURE__ */ new Map();
|
|
3763
|
-
currentTopZIndex =
|
|
3925
|
+
currentTopZIndex = Pe;
|
|
3764
3926
|
defaultUpdateInterval = 0;
|
|
3765
3927
|
// ms, 默认 0 = 每帧更新
|
|
3766
3928
|
isCameraMoving = !1;
|
|
@@ -3860,41 +4022,41 @@ class Pe {
|
|
|
3860
4022
|
if (typeof r.anchorPixel == "number" && y)
|
|
3861
4023
|
a = y.x, l = y.y - r.anchorPixel;
|
|
3862
4024
|
else {
|
|
3863
|
-
const x = n.Cartographic.fromCartesian(o), G = n.Math.toDegrees(x.longitude), A = n.Math.toDegrees(x.latitude), Y = n.Cartesian3.fromDegrees(G, A, x.height + h), E = this.getContainerPixelPosition(Y),
|
|
3864
|
-
E &&
|
|
4025
|
+
const x = n.Cartographic.fromCartesian(o), G = n.Math.toDegrees(x.longitude), A = n.Math.toDegrees(x.latitude), Y = n.Cartesian3.fromDegrees(G, A, x.height + h), E = this.getContainerPixelPosition(Y), P = this.getContainerPixelPosition(o);
|
|
4026
|
+
E && P ? (a = E.x, l = E.y) : P && (a = P.x, l = P.y);
|
|
3865
4027
|
}
|
|
3866
4028
|
} catch {
|
|
3867
4029
|
}
|
|
3868
4030
|
r.pixelOffset && (a += r.pixelOffset.x, l -= r.pixelOffset.y);
|
|
3869
|
-
const u = this.container.getBoundingClientRect(), m = u.width,
|
|
4031
|
+
const u = this.container.getBoundingClientRect(), m = u.width, b = u.height;
|
|
3870
4032
|
i.style.visibility = "hidden", i.style.display = "block";
|
|
3871
|
-
const g = i.getBoundingClientRect(),
|
|
4033
|
+
const g = i.getBoundingClientRect(), w = g.width, f = g.height;
|
|
3872
4034
|
i.style.visibility = "", i.style.display = "none";
|
|
3873
|
-
const
|
|
4035
|
+
const p = r.positionOffset ?? "top";
|
|
3874
4036
|
let C = "translate(-50%, -100%)";
|
|
3875
|
-
|
|
4037
|
+
p === "top" ? (l = l - d, C = "translate(-50%, -100%)") : p === "bottom" ? (l = s.y + d, a = s.x, C = "translate(-50%, 0%)") : p === "left" ? (a = s.x - d, l = s.y, C = "translate(-100%, -50%)") : p === "right" ? (a = s.x + d, l = s.y, C = "translate(0%, -50%)") : p === "top-left" ? (a = s.x - d, l = s.y - d, C = "translate(-100%, -100%)") : p === "top-right" ? (a = s.x + d, l = s.y - d, C = "translate(0%, -100%)") : p === "bottom-left" ? (a = s.x - d, l = s.y + d, C = "translate(-100%, 0%)") : p === "bottom-right" ? (a = s.x + d, l = s.y + d, C = "translate(0%, 0%)") : p === "left-top" ? (a = s.x - d, l = s.y - d, C = "translate(-100%, 0%)") : p === "left-bottom" ? (a = s.x - d, l = s.y + d, C = "translate(-100%, -100%)") : p === "right-top" ? (a = s.x + d, l = s.y - d, C = "translate(0%, 0%)") : p === "right-bottom" && (a = s.x + d, l = s.y + d, C = "translate(0%, -100%)");
|
|
3876
4038
|
const v = 10;
|
|
3877
4039
|
if (this.isCameraMoving || ((G) => {
|
|
3878
|
-
G.left < v && (a += v - G.left), G.right > m - v && (a -= G.right - (m - v)), G.top < v && (l += v - G.top), G.bottom >
|
|
4040
|
+
G.left < v && (a += v - G.left), G.right > m - v && (a -= G.right - (m - v)), G.top < v && (l += v - G.top), G.bottom > b - v && (l -= G.bottom - (b - v));
|
|
3879
4041
|
})((() => {
|
|
3880
|
-
switch (
|
|
4042
|
+
switch (p) {
|
|
3881
4043
|
case "top":
|
|
3882
4044
|
return {
|
|
3883
|
-
left: a -
|
|
3884
|
-
right: a +
|
|
4045
|
+
left: a - w / 2,
|
|
4046
|
+
right: a + w / 2,
|
|
3885
4047
|
top: l - f,
|
|
3886
4048
|
bottom: l
|
|
3887
4049
|
};
|
|
3888
4050
|
case "bottom":
|
|
3889
4051
|
return {
|
|
3890
|
-
left: a -
|
|
3891
|
-
right: a +
|
|
4052
|
+
left: a - w / 2,
|
|
4053
|
+
right: a + w / 2,
|
|
3892
4054
|
top: l,
|
|
3893
4055
|
bottom: l + f
|
|
3894
4056
|
};
|
|
3895
4057
|
case "left":
|
|
3896
4058
|
return {
|
|
3897
|
-
left: a -
|
|
4059
|
+
left: a - w,
|
|
3898
4060
|
right: a,
|
|
3899
4061
|
top: l - f / 2,
|
|
3900
4062
|
bottom: l + f / 2
|
|
@@ -3902,13 +4064,13 @@ class Pe {
|
|
|
3902
4064
|
case "right":
|
|
3903
4065
|
return {
|
|
3904
4066
|
left: a,
|
|
3905
|
-
right: a +
|
|
4067
|
+
right: a + w,
|
|
3906
4068
|
top: l - f / 2,
|
|
3907
4069
|
bottom: l + f / 2
|
|
3908
4070
|
};
|
|
3909
4071
|
case "top-left":
|
|
3910
4072
|
return {
|
|
3911
|
-
left: a -
|
|
4073
|
+
left: a - w,
|
|
3912
4074
|
right: a,
|
|
3913
4075
|
top: l - f,
|
|
3914
4076
|
bottom: l
|
|
@@ -3916,13 +4078,13 @@ class Pe {
|
|
|
3916
4078
|
case "top-right":
|
|
3917
4079
|
return {
|
|
3918
4080
|
left: a,
|
|
3919
|
-
right: a +
|
|
4081
|
+
right: a + w,
|
|
3920
4082
|
top: l - f,
|
|
3921
4083
|
bottom: l
|
|
3922
4084
|
};
|
|
3923
4085
|
case "bottom-left":
|
|
3924
4086
|
return {
|
|
3925
|
-
left: a -
|
|
4087
|
+
left: a - w,
|
|
3926
4088
|
right: a,
|
|
3927
4089
|
top: l,
|
|
3928
4090
|
bottom: l + f
|
|
@@ -3930,20 +4092,20 @@ class Pe {
|
|
|
3930
4092
|
case "bottom-right":
|
|
3931
4093
|
return {
|
|
3932
4094
|
left: a,
|
|
3933
|
-
right: a +
|
|
4095
|
+
right: a + w,
|
|
3934
4096
|
top: l,
|
|
3935
4097
|
bottom: l + f
|
|
3936
4098
|
};
|
|
3937
4099
|
case "left-top":
|
|
3938
4100
|
return {
|
|
3939
|
-
left: a -
|
|
4101
|
+
left: a - w,
|
|
3940
4102
|
right: a,
|
|
3941
4103
|
top: l,
|
|
3942
4104
|
bottom: l + f
|
|
3943
4105
|
};
|
|
3944
4106
|
case "left-bottom":
|
|
3945
4107
|
return {
|
|
3946
|
-
left: a -
|
|
4108
|
+
left: a - w,
|
|
3947
4109
|
right: a,
|
|
3948
4110
|
top: l - f,
|
|
3949
4111
|
bottom: l
|
|
@@ -3951,21 +4113,21 @@ class Pe {
|
|
|
3951
4113
|
case "right-top":
|
|
3952
4114
|
return {
|
|
3953
4115
|
left: a,
|
|
3954
|
-
right: a +
|
|
4116
|
+
right: a + w,
|
|
3955
4117
|
top: l,
|
|
3956
4118
|
bottom: l + f
|
|
3957
4119
|
};
|
|
3958
4120
|
case "right-bottom":
|
|
3959
4121
|
return {
|
|
3960
4122
|
left: a,
|
|
3961
|
-
right: a +
|
|
4123
|
+
right: a + w,
|
|
3962
4124
|
top: l - f,
|
|
3963
4125
|
bottom: l
|
|
3964
4126
|
};
|
|
3965
4127
|
default:
|
|
3966
4128
|
return {
|
|
3967
|
-
left: a -
|
|
3968
|
-
right: a +
|
|
4129
|
+
left: a - w / 2,
|
|
4130
|
+
right: a + w / 2,
|
|
3969
4131
|
top: l - f,
|
|
3970
4132
|
bottom: l
|
|
3971
4133
|
};
|
|
@@ -3973,8 +4135,8 @@ class Pe {
|
|
|
3973
4135
|
})()), i.style.left = `${a}px`, i.style.top = `${l}px`, i.style.transform = C, i.style.display = "block", t.arrowEl && r.showArrow) {
|
|
3974
4136
|
const y = t.arrowEl, x = (r.arrowSize ?? 8) + "px", G = i.style.background || r.backgroundColor || "#ffffff";
|
|
3975
4137
|
y.style.borderLeft = "0", y.style.borderRight = "0", y.style.borderTop = "0", y.style.borderBottom = "0", y.style.left = "", y.style.right = "", y.style.top = "", y.style.bottom = "", y.style.transform = "";
|
|
3976
|
-
const A = (O) => O.startsWith("top") ? "top" : O.startsWith("bottom") ? "bottom" : O.startsWith("left") ? "left" : O.startsWith("right") ? "right" : "top", Y = (O) => O.includes("left") ? 25 : O.includes("right") ? 75 : 50, E = A(
|
|
3977
|
-
E === "top" ? (y.style.left = `${
|
|
4138
|
+
const A = (O) => O.startsWith("top") ? "top" : O.startsWith("bottom") ? "bottom" : O.startsWith("left") ? "left" : O.startsWith("right") ? "right" : "top", Y = (O) => O.includes("left") ? 25 : O.includes("right") ? 75 : 50, E = A(p), P = Y(p);
|
|
4139
|
+
E === "top" ? (y.style.left = `${P}%`, y.style.bottom = `-${x}`, y.style.transform = "translateX(-50%)", y.style.borderLeft = `${x} solid transparent`, y.style.borderRight = `${x} solid transparent`, y.style.borderTop = `${x} solid ${G}`) : E === "bottom" ? (y.style.left = `${P}%`, y.style.top = `-${x}`, y.style.transform = "translateX(-50%)", y.style.borderLeft = `${x} solid transparent`, y.style.borderRight = `${x} solid transparent`, y.style.borderBottom = `${x} solid ${G}`) : E === "left" ? (y.style.right = `-${x}`, y.style.top = `${P}%`, y.style.transform = "translateY(-50%)", y.style.borderTop = `${x} solid transparent`, y.style.borderBottom = `${x} solid transparent`, y.style.borderLeft = `${x} solid ${G}`) : (y.style.left = `-${x}`, y.style.top = `${P}%`, y.style.transform = "translateY(-50%)", y.style.borderTop = `${x} solid transparent`, y.style.borderBottom = `${x} solid transparent`, y.style.borderRight = `${x} solid ${G}`);
|
|
3978
4140
|
}
|
|
3979
4141
|
}
|
|
3980
4142
|
/**
|
|
@@ -4239,8 +4401,8 @@ class Te {
|
|
|
4239
4401
|
if (i < 3) return e.slice();
|
|
4240
4402
|
const o = this.polygonArea2D(e) > 0, s = [];
|
|
4241
4403
|
for (let h = 0; h < i; h++) {
|
|
4242
|
-
const d = e[h], u = e[(h + 1) % i], m = u.x - d.x,
|
|
4243
|
-
s.push(new n.Cartesian2(-
|
|
4404
|
+
const d = e[h], u = e[(h + 1) % i], m = u.x - d.x, b = u.y - d.y, g = Math.hypot(m, b) || 1, w = m / g, f = b / g, p = o ? -f : f, C = o ? w : -w;
|
|
4405
|
+
s.push(new n.Cartesian2(-p, -C));
|
|
4244
4406
|
}
|
|
4245
4407
|
const a = [];
|
|
4246
4408
|
for (let h = 0; h < i; h++) {
|
|
@@ -4249,13 +4411,13 @@ class Te {
|
|
|
4249
4411
|
}
|
|
4250
4412
|
const l = [];
|
|
4251
4413
|
for (let h = 0; h < i; h++) {
|
|
4252
|
-
const d = (h - 1 + i) % i, u = s[d], m = a[d],
|
|
4253
|
-
if (Math.abs(
|
|
4414
|
+
const d = (h - 1 + i) % i, u = s[d], m = a[d], b = s[h], g = a[h], w = u.x * b.y - b.x * u.y;
|
|
4415
|
+
if (Math.abs(w) < 1e-8) {
|
|
4254
4416
|
const f = e[h];
|
|
4255
|
-
l.push(new n.Cartesian2(f.x +
|
|
4417
|
+
l.push(new n.Cartesian2(f.x + b.x * t, f.y + b.y * t));
|
|
4256
4418
|
} else {
|
|
4257
|
-
const f = (m *
|
|
4258
|
-
l.push(new n.Cartesian2(f,
|
|
4419
|
+
const f = (m * b.y - g * u.y) / w, p = (u.x * g - b.x * m) / w;
|
|
4420
|
+
l.push(new n.Cartesian2(f, p));
|
|
4259
4421
|
}
|
|
4260
4422
|
}
|
|
4261
4423
|
return l;
|
|
@@ -4425,11 +4587,11 @@ class Ee {
|
|
|
4425
4587
|
}
|
|
4426
4588
|
});
|
|
4427
4589
|
if (e.onClick) {
|
|
4428
|
-
const g = u,
|
|
4429
|
-
g._onClick = e.onClick,
|
|
4590
|
+
const g = u, w = m;
|
|
4591
|
+
g._onClick = e.onClick, w._onClick = e.onClick;
|
|
4430
4592
|
}
|
|
4431
|
-
const
|
|
4432
|
-
return
|
|
4593
|
+
const b = u;
|
|
4594
|
+
return b._innerEntity = m, b._isRing = !0, b._ringThickness = r, b._outerRectangle = e.coordinates, u;
|
|
4433
4595
|
}
|
|
4434
4596
|
const o = this.entities.add({
|
|
4435
4597
|
id: t,
|
|
@@ -4534,7 +4696,7 @@ class Oe {
|
|
|
4534
4696
|
add(e) {
|
|
4535
4697
|
const t = this.convertPosition(e.position), i = e.id || `circle_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`, r = this.resolveMaterial(e.material), o = e.outlineWidth && e.outlineWidth > 1 ? e.outlineWidth : 0;
|
|
4536
4698
|
if (o > 0) {
|
|
4537
|
-
const s = n.Cartographic.fromCartesian(t), a = s?.height ?? 0, l = 0.01, h = e.radius, d = Math.max(0, e.radius - o), u = this.generateCirclePositions(s, h, a + l), m = this.generateCirclePositions(s, d, a),
|
|
4699
|
+
const s = n.Cartographic.fromCartesian(t), a = s?.height ?? 0, l = 0.01, h = e.radius, d = Math.max(0, e.radius - o), u = this.generateCirclePositions(s, h, a + l), m = this.generateCirclePositions(s, d, a), b = this.entities.add({
|
|
4538
4700
|
// 使用带洞的多边形,只渲染环带区域,不填充中心
|
|
4539
4701
|
polygon: {
|
|
4540
4702
|
hierarchy: new n.PolygonHierarchy(u, [new n.PolygonHierarchy(m)]),
|
|
@@ -4555,11 +4717,11 @@ class Oe {
|
|
|
4555
4717
|
}
|
|
4556
4718
|
});
|
|
4557
4719
|
if (e.onClick) {
|
|
4558
|
-
const f =
|
|
4559
|
-
f._onClick = e.onClick,
|
|
4720
|
+
const f = b, p = g;
|
|
4721
|
+
f._onClick = e.onClick, p._onClick = e.onClick;
|
|
4560
4722
|
}
|
|
4561
|
-
const
|
|
4562
|
-
return
|
|
4723
|
+
const w = b;
|
|
4724
|
+
return w._innerEntity = g, w._isRing = !0, w._ringThickness = o, w._fillMaterial = r, w._ringHeightEpsilon = l, w._centerCartographic = s, w._outerRadius = h, w._innerRadius = d, b;
|
|
4563
4725
|
} else {
|
|
4564
4726
|
const s = this.entities.add({
|
|
4565
4727
|
id: i,
|
|
@@ -4589,7 +4751,7 @@ class Oe {
|
|
|
4589
4751
|
generateCirclePositions(e, t, i, r = 128) {
|
|
4590
4752
|
const s = e.latitude, a = e.longitude, l = t / 6378137, h = [];
|
|
4591
4753
|
for (let d = 0; d < r; d++) {
|
|
4592
|
-
const u = d / r * n.Math.TWO_PI, m = Math.sin(s),
|
|
4754
|
+
const u = d / r * n.Math.TWO_PI, m = Math.sin(s), b = Math.cos(s), g = Math.sin(l), w = Math.cos(l), f = Math.sin(u), p = Math.cos(u), C = Math.asin(m * w + b * g * p), v = a + Math.atan2(f * g * b, w - m * Math.sin(C));
|
|
4593
4755
|
h.push(n.Cartesian3.fromRadians(v, C, i));
|
|
4594
4756
|
}
|
|
4595
4757
|
return h;
|
|
@@ -4745,7 +4907,7 @@ class Le {
|
|
|
4745
4907
|
generateCirclePositions(e, t, i, r = 128) {
|
|
4746
4908
|
const s = e.latitude, a = e.longitude, l = t / 6378137, h = [];
|
|
4747
4909
|
for (let d = 0; d < r; d++) {
|
|
4748
|
-
const u = d / r * n.Math.TWO_PI, m = Math.sin(s),
|
|
4910
|
+
const u = d / r * n.Math.TWO_PI, m = Math.sin(s), b = Math.cos(s), g = Math.sin(l), w = Math.cos(l), f = Math.sin(u), p = Math.cos(u), C = Math.asin(m * w + b * g * p), v = a + Math.atan2(f * g * b, w - m * Math.sin(C));
|
|
4749
4911
|
h.push(n.Cartesian3.fromRadians(v, C, i));
|
|
4750
4912
|
}
|
|
4751
4913
|
return h.length > 0 && h.push(h[0]), h;
|
|
@@ -4762,7 +4924,7 @@ class Le {
|
|
|
4762
4924
|
dashLength: e.dashLength,
|
|
4763
4925
|
dashPattern: e.dashPattern,
|
|
4764
4926
|
gapColor: e.gapColor
|
|
4765
|
-
}),
|
|
4927
|
+
}), b = e.lineWidth ?? this.getInnerWidth(i), g = this.entities.add({
|
|
4766
4928
|
id: t,
|
|
4767
4929
|
polyline: {
|
|
4768
4930
|
positions: d,
|
|
@@ -4772,16 +4934,16 @@ class Le {
|
|
|
4772
4934
|
// clampToGround=true 时生效:保证外层在下
|
|
4773
4935
|
zIndex: 0
|
|
4774
4936
|
}
|
|
4775
|
-
}),
|
|
4937
|
+
}), w = s ? this.addInnerEntity({
|
|
4776
4938
|
outerId: t,
|
|
4777
4939
|
ringPositions: d,
|
|
4778
|
-
innerWidth:
|
|
4940
|
+
innerWidth: b,
|
|
4779
4941
|
lineMaterial: m,
|
|
4780
4942
|
clampToGround: o
|
|
4781
4943
|
}) : void 0, f = g;
|
|
4782
|
-
if (f._overlayType = "ring", f._centerCartographic = l, f._outerRadius = e.radius, f._ringSegments = r, f._ringGlowPower = n.Math.clamp(e.glowPower ?? 0.25, 0, 1), f._ringLineColor = e.lineColor ?? n.Color.WHITE, f._ringLineStyle = e.lineStyle ?? "solid", f._ringLineMaterialMode = e.lineMaterialMode ?? "stripe", f._ringStripeRepeat = e.stripeRepeat, f._ringDashLength = e.dashLength, f._ringDashPattern = e.dashPattern, f._ringGapColor = e.gapColor, f._ringShowInnerLine = s, f._innerEntity =
|
|
4783
|
-
const
|
|
4784
|
-
|
|
4944
|
+
if (f._overlayType = "ring", f._centerCartographic = l, f._outerRadius = e.radius, f._ringSegments = r, f._ringGlowPower = n.Math.clamp(e.glowPower ?? 0.25, 0, 1), f._ringLineColor = e.lineColor ?? n.Color.WHITE, f._ringLineStyle = e.lineStyle ?? "solid", f._ringLineMaterialMode = e.lineMaterialMode ?? "stripe", f._ringStripeRepeat = e.stripeRepeat, f._ringDashLength = e.dashLength, f._ringDashPattern = e.dashPattern, f._ringGapColor = e.gapColor, f._ringShowInnerLine = s, f._innerEntity = w, e.onClick && (f._onClick = e.onClick, w)) {
|
|
4945
|
+
const p = w;
|
|
4946
|
+
p._onClick = () => e.onClick?.(g);
|
|
4785
4947
|
}
|
|
4786
4948
|
return g;
|
|
4787
4949
|
}
|
|
@@ -4815,7 +4977,7 @@ class Le {
|
|
|
4815
4977
|
else if (!i._innerEntity) {
|
|
4816
4978
|
const u = this.rebuildRingPositions(e, i, { clampToGround: t.clampToGround, segments: t.segments });
|
|
4817
4979
|
if (u) {
|
|
4818
|
-
const m = t.clampToGround ?? e.polyline?.clampToGround?.getValue?.(n.JulianDate.now?.()) ?? e.polyline?.clampToGround,
|
|
4980
|
+
const m = t.clampToGround ?? e.polyline?.clampToGround?.getValue?.(n.JulianDate.now?.()) ?? e.polyline?.clampToGround, b = typeof m == "boolean" ? m : !0, g = e.polyline.width?.getValue?.(n.JulianDate.now?.()) ?? e.polyline.width ?? t.glowWidth ?? t.width ?? 8, w = typeof g == "number" ? g : t.glowWidth ?? t.width ?? 8, f = t.lineWidth ?? this.getInnerWidth(w), p = this.resolveLineMaterial({
|
|
4819
4981
|
lineColor: t.lineColor ?? i._ringLineColor,
|
|
4820
4982
|
lineStyle: t.lineStyle ?? i._ringLineStyle,
|
|
4821
4983
|
lineMaterialMode: t.lineMaterialMode ?? i._ringLineMaterialMode,
|
|
@@ -4827,8 +4989,8 @@ class Le {
|
|
|
4827
4989
|
outerId: String(e.id),
|
|
4828
4990
|
ringPositions: u,
|
|
4829
4991
|
innerWidth: f,
|
|
4830
|
-
lineMaterial:
|
|
4831
|
-
clampToGround:
|
|
4992
|
+
lineMaterial: p,
|
|
4993
|
+
clampToGround: b
|
|
4832
4994
|
});
|
|
4833
4995
|
if (i._innerEntity = C, i._onClick) {
|
|
4834
4996
|
const v = C;
|
|
@@ -4849,21 +5011,21 @@ class Le {
|
|
|
4849
5011
|
e.polyline.material = this.resolveGlowMaterial(t.color ?? n.Color.CYAN, u), i._ringGlowPower = n.Math.clamp(u, 0, 1);
|
|
4850
5012
|
}
|
|
4851
5013
|
if ((t.lineColor !== void 0 || t.lineStyle !== void 0 || t.lineMaterialMode !== void 0 || t.stripeRepeat !== void 0 || t.dashLength !== void 0 || t.dashPattern !== void 0 || t.gapColor !== void 0) && i._innerEntity?.polyline) {
|
|
4852
|
-
const u = t.lineColor ?? i._ringLineColor, m = t.lineStyle ?? i._ringLineStyle,
|
|
5014
|
+
const u = t.lineColor ?? i._ringLineColor, m = t.lineStyle ?? i._ringLineStyle, b = t.lineMaterialMode ?? i._ringLineMaterialMode, g = t.stripeRepeat ?? i._ringStripeRepeat, w = t.dashLength ?? i._ringDashLength, f = t.dashPattern ?? i._ringDashPattern, p = t.gapColor ?? i._ringGapColor;
|
|
4853
5015
|
i._innerEntity.polyline.material = this.resolveLineMaterial({
|
|
4854
5016
|
lineColor: u,
|
|
4855
5017
|
lineStyle: m,
|
|
4856
|
-
lineMaterialMode:
|
|
5018
|
+
lineMaterialMode: b,
|
|
4857
5019
|
stripeRepeat: g,
|
|
4858
|
-
dashLength:
|
|
5020
|
+
dashLength: w,
|
|
4859
5021
|
dashPattern: f,
|
|
4860
|
-
gapColor:
|
|
4861
|
-
}), i._ringLineColor = u, i._ringLineStyle = m, i._ringLineMaterialMode =
|
|
5022
|
+
gapColor: p
|
|
5023
|
+
}), i._ringLineColor = u, i._ringLineStyle = m, i._ringLineMaterialMode = b, i._ringStripeRepeat = g, i._ringDashLength = w, i._ringDashPattern = f, i._ringGapColor = p;
|
|
4862
5024
|
}
|
|
4863
5025
|
const s = i._centerCartographic, a = i._outerRadius, l = t.segments ?? i._ringSegments, h = t.segments !== void 0 && t.segments !== i._ringSegments, d = t.clampToGround !== void 0;
|
|
4864
5026
|
if (t.clampToGround !== void 0 && (e.polyline.clampToGround = new n.ConstantProperty(t.clampToGround), i._innerEntity?.polyline && (i._innerEntity.polyline.clampToGround = new n.ConstantProperty(t.clampToGround))), (h || d) && s && a !== void 0) {
|
|
4865
|
-
const m = t.clampToGround ?? !0 ? 0 : s.height ?? 0,
|
|
4866
|
-
e.polyline.positions = new n.ConstantProperty(
|
|
5027
|
+
const m = t.clampToGround ?? !0 ? 0 : s.height ?? 0, b = this.generateCirclePositions(s, a, m, l ?? 128);
|
|
5028
|
+
e.polyline.positions = new n.ConstantProperty(b), i._innerEntity?.polyline && (i._innerEntity.polyline.positions = new n.ConstantProperty(b)), i._ringSegments = l ?? 128;
|
|
4867
5029
|
}
|
|
4868
5030
|
}
|
|
4869
5031
|
/**
|
|
@@ -4906,7 +5068,7 @@ class Ae {
|
|
|
4906
5068
|
circle;
|
|
4907
5069
|
ring;
|
|
4908
5070
|
constructor(e) {
|
|
4909
|
-
this.viewer = e, this.entities = e.entities, this.initInfoWindowContainer(), this.setupEntityClickHandler(), this.marker = new xe(e), this.label = new ve(e), this.icon = new Ge(e), this.svg = new De(e), this.infoWindow = new
|
|
5071
|
+
this.viewer = e, this.entities = e.entities, this.initInfoWindowContainer(), this.setupEntityClickHandler(), this.marker = new xe(e), this.label = new ve(e), this.icon = new Ge(e), this.svg = new De(e), this.infoWindow = new Me(e, this.infoWindowContainer), this.polyline = new Ne(e), this.polygon = new Te(e), this.rectangle = new Ee(e), this.circle = new Oe(e), this.ring = new Le(e);
|
|
4910
5072
|
}
|
|
4911
5073
|
/**
|
|
4912
5074
|
* 初始化信息窗口容器
|
|
@@ -5071,7 +5233,7 @@ class Ae {
|
|
|
5071
5233
|
this.removeAllOverlays(), this.infoWindowContainer && this.infoWindowContainer.parentNode && this.infoWindowContainer.parentNode.removeChild(this.infoWindowContainer), this.overlayMap.clear();
|
|
5072
5234
|
}
|
|
5073
5235
|
}
|
|
5074
|
-
class
|
|
5236
|
+
class Ie {
|
|
5075
5237
|
viewer;
|
|
5076
5238
|
imageryLayer = null;
|
|
5077
5239
|
rectangle = null;
|
|
@@ -5388,27 +5550,27 @@ class je {
|
|
|
5388
5550
|
let h = this.options.minValue, d = this.options.maxValue;
|
|
5389
5551
|
if (!l) {
|
|
5390
5552
|
h = Number.POSITIVE_INFINITY, d = Number.NEGATIVE_INFINITY;
|
|
5391
|
-
for (const
|
|
5392
|
-
Number.isFinite(
|
|
5553
|
+
for (const p of e)
|
|
5554
|
+
Number.isFinite(p.value) && (p.value < h && (h = p.value), p.value > d && (d = p.value));
|
|
5393
5555
|
(!Number.isFinite(h) || !Number.isFinite(d) || h === d) && (h = 0, d = 1), i.persistMinMax && (this.options.minValue = h, this.options.maxValue = d);
|
|
5394
5556
|
}
|
|
5395
|
-
const u = n.Math.toDegrees(t.west), m = n.Math.toDegrees(t.east),
|
|
5396
|
-
for (const
|
|
5397
|
-
if (!Number.isFinite(
|
|
5398
|
-
const C = (
|
|
5557
|
+
const u = n.Math.toDegrees(t.west), m = n.Math.toDegrees(t.east), b = n.Math.toDegrees(t.south), g = n.Math.toDegrees(t.north);
|
|
5558
|
+
for (const p of e) {
|
|
5559
|
+
if (!Number.isFinite(p.lon) || !Number.isFinite(p.lat)) continue;
|
|
5560
|
+
const C = (p.value - h) / (d - h || 1);
|
|
5399
5561
|
if (C <= 0) continue;
|
|
5400
|
-
const v = (
|
|
5562
|
+
const v = (p.lon - u) / (m - u || 1) * r, y = (1 - (p.lat - b) / (g - b || 1)) * o, x = a.createRadialGradient(v, y, 0, v, y, s);
|
|
5401
5563
|
x.addColorStop(0, "rgba(0,0,0,1)"), x.addColorStop(1, "rgba(0,0,0,0)"), a.fillStyle = x, a.globalAlpha = C, a.beginPath(), a.arc(v, y, s, 0, Math.PI * 2), a.fill();
|
|
5402
5564
|
}
|
|
5403
5565
|
a.globalAlpha = 1;
|
|
5404
|
-
const
|
|
5405
|
-
for (let
|
|
5406
|
-
const C = f[
|
|
5566
|
+
const w = a.getImageData(0, 0, r, o), f = w.data;
|
|
5567
|
+
for (let p = 0; p < f.length; p += 4) {
|
|
5568
|
+
const C = f[p + 3];
|
|
5407
5569
|
if (C === 0) continue;
|
|
5408
5570
|
const y = Math.min(255, Math.max(0, C)) * 4;
|
|
5409
|
-
f[
|
|
5571
|
+
f[p] = this.gradientLUT[y], f[p + 1] = this.gradientLUT[y + 1], f[p + 2] = this.gradientLUT[y + 2], f[p + 3] = Math.round(C * this.options.opacity);
|
|
5410
5572
|
}
|
|
5411
|
-
a.putImageData(
|
|
5573
|
+
a.putImageData(w, 0, 0), this.updateImageryLayer(t);
|
|
5412
5574
|
}
|
|
5413
5575
|
/**
|
|
5414
5576
|
* 将当前 canvas 映射为 Cesium 影像图层
|
|
@@ -5431,7 +5593,7 @@ class je {
|
|
|
5431
5593
|
this.imageryLayer = this.viewer.imageryLayers.addImageryProvider(i), this.imageryLayer.alpha = this.options.opacity, this.imageryLayer.show = !0;
|
|
5432
5594
|
}
|
|
5433
5595
|
}
|
|
5434
|
-
const
|
|
5596
|
+
const je = {
|
|
5435
5597
|
CesiumMapToolbar: be,
|
|
5436
5598
|
DrawHelper: D,
|
|
5437
5599
|
CesiumOverlayService: Ae,
|
|
@@ -5448,10 +5610,10 @@ export {
|
|
|
5448
5610
|
V as DrawLine,
|
|
5449
5611
|
K as DrawPolygon,
|
|
5450
5612
|
_ as DrawRectangle,
|
|
5451
|
-
|
|
5613
|
+
Ie as HeatmapLayer,
|
|
5452
5614
|
Oe as MapCircle,
|
|
5453
5615
|
Ge as MapIcon,
|
|
5454
|
-
|
|
5616
|
+
Me as MapInfoWindow,
|
|
5455
5617
|
ve as MapLabel,
|
|
5456
5618
|
le as MapLayersService,
|
|
5457
5619
|
xe as MapMarker,
|
|
@@ -5462,10 +5624,10 @@ export {
|
|
|
5462
5624
|
De as MapSVG,
|
|
5463
5625
|
ue as NotFlyZonesService,
|
|
5464
5626
|
ae as SearchService,
|
|
5465
|
-
|
|
5627
|
+
je as default,
|
|
5466
5628
|
N as defaultButtonSorts,
|
|
5467
5629
|
we as defaultButtons,
|
|
5468
5630
|
S as initCesium,
|
|
5469
|
-
|
|
5631
|
+
I as toggleSelectedStyle
|
|
5470
5632
|
};
|
|
5471
5633
|
//# sourceMappingURL=index.es.js.map
|