cesium-xs-sdk 1.0.8 → 1.0.10
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/cesium-xs-sdk.cjs.js +1731 -1081
- package/dist/cesium-xs-sdk.cjs.js.map +1 -1
- package/dist/cesium-xs-sdk.esm.js +1731 -1081
- package/dist/cesium-xs-sdk.esm.js.map +1 -1
- package/dist/cesium-xs-sdk.umd.js +1 -1
- package/dist/cesium-xs-sdk.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/controls/Zoom.js +135 -135
- package/src/core/ModuleManager.js +16 -0
- package/src/index.d.ts +54 -10
- package/src/index.js +2 -0
- package/src/modules/GraphicModule.js +157 -0
- package/src/modules/MilitarySymbolModule.js +469 -0
- package/src/modules/militarySymbolAssets.js +10 -0
- package/src/modules/tools/MeasureTool.js +514 -514
- package/src/vue.d.ts +19 -18
- package/src/vue.js +73 -70
|
@@ -242,7 +242,7 @@ class Config {
|
|
|
242
242
|
}
|
|
243
243
|
}
|
|
244
244
|
|
|
245
|
-
const Cesium$
|
|
245
|
+
const Cesium$h = getCesium();
|
|
246
246
|
|
|
247
247
|
/**
|
|
248
248
|
* 图层类型枚举
|
|
@@ -328,10 +328,10 @@ function createProviderByType(type, url, opts) {
|
|
|
328
328
|
case LayerType.XYZ:
|
|
329
329
|
case LayerType.TMS:
|
|
330
330
|
// XYZ / TMS 均使用 UrlTemplateImageryProvider
|
|
331
|
-
return new Cesium$
|
|
331
|
+
return new Cesium$h.UrlTemplateImageryProvider({ url, ...opts });
|
|
332
332
|
|
|
333
333
|
case LayerType.WMTS:
|
|
334
|
-
return new Cesium$
|
|
334
|
+
return new Cesium$h.WebMapTileServiceImageryProvider({
|
|
335
335
|
url,
|
|
336
336
|
layer: opts.layer,
|
|
337
337
|
style: opts.style || 'default',
|
|
@@ -341,7 +341,7 @@ function createProviderByType(type, url, opts) {
|
|
|
341
341
|
});
|
|
342
342
|
|
|
343
343
|
case LayerType.WMS:
|
|
344
|
-
return new Cesium$
|
|
344
|
+
return new Cesium$h.WebMapServiceImageryProvider({
|
|
345
345
|
url,
|
|
346
346
|
layers: opts.layers || '',
|
|
347
347
|
parameters: { transparent: true, format: 'image/png', ...opts.parameters },
|
|
@@ -349,23 +349,23 @@ function createProviderByType(type, url, opts) {
|
|
|
349
349
|
});
|
|
350
350
|
|
|
351
351
|
case LayerType.SINGLE_IMAGE:
|
|
352
|
-
return new Cesium$
|
|
352
|
+
return new Cesium$h.SingleTileImageryProvider({
|
|
353
353
|
url,
|
|
354
|
-
rectangle: opts.extent ? Cesium$
|
|
354
|
+
rectangle: opts.extent ? Cesium$h.Rectangle.fromDegrees(...opts.extent) : undefined,
|
|
355
355
|
credit: opts.credit || '',
|
|
356
356
|
...opts
|
|
357
357
|
});
|
|
358
358
|
|
|
359
359
|
case LayerType.TERRAIN:
|
|
360
360
|
// fromUrl 返回 Promise,由 addProviderToViewer 统一 await
|
|
361
|
-
return Cesium$
|
|
361
|
+
return Cesium$h.CesiumTerrainProvider.fromUrl(url, {
|
|
362
362
|
requestWaterMask: opts.requestWaterMask ?? false,
|
|
363
363
|
requestVertexNormals: opts.requestVertexNormals ?? false,
|
|
364
364
|
...opts
|
|
365
365
|
});
|
|
366
366
|
|
|
367
367
|
case LayerType['3DTILES']:
|
|
368
|
-
return new Cesium$
|
|
368
|
+
return new Cesium$h.Cesium3DTileset({
|
|
369
369
|
url,
|
|
370
370
|
maximumScreenSpaceError: opts.maximumScreenSpaceError ?? 16,
|
|
371
371
|
maximumMemoryUsage: opts.maximumMemoryUsage ?? 512,
|
|
@@ -472,10 +472,10 @@ class ImageryLayerWrapper {
|
|
|
472
472
|
if (provider && provider.rectangle) {
|
|
473
473
|
const rect = provider.rectangle;
|
|
474
474
|
return {
|
|
475
|
-
west: Cesium$
|
|
476
|
-
south: Cesium$
|
|
477
|
-
east: Cesium$
|
|
478
|
-
north: Cesium$
|
|
475
|
+
west: Cesium$h.Math.toDegrees(rect.west),
|
|
476
|
+
south: Cesium$h.Math.toDegrees(rect.south),
|
|
477
|
+
east: Cesium$h.Math.toDegrees(rect.east),
|
|
478
|
+
north: Cesium$h.Math.toDegrees(rect.north)
|
|
479
479
|
};
|
|
480
480
|
}
|
|
481
481
|
return null;
|
|
@@ -519,10 +519,10 @@ class TerrainLayerWrapper {
|
|
|
519
519
|
if (this._provider.rectangle) {
|
|
520
520
|
const rect = this._provider.rectangle;
|
|
521
521
|
return {
|
|
522
|
-
west: Cesium$
|
|
523
|
-
south: Cesium$
|
|
524
|
-
east: Cesium$
|
|
525
|
-
north: Cesium$
|
|
522
|
+
west: Cesium$h.Math.toDegrees(rect.west),
|
|
523
|
+
south: Cesium$h.Math.toDegrees(rect.south),
|
|
524
|
+
east: Cesium$h.Math.toDegrees(rect.east),
|
|
525
|
+
north: Cesium$h.Math.toDegrees(rect.north)
|
|
526
526
|
};
|
|
527
527
|
}
|
|
528
528
|
return { west: -180, south: -85, east: 180, north: 85 };
|
|
@@ -561,17 +561,17 @@ class TilesetLayerWrapper {
|
|
|
561
561
|
getExtent() {
|
|
562
562
|
if (this._tileset.boundingSphere) {
|
|
563
563
|
const bs = this._tileset.boundingSphere;
|
|
564
|
-
const cartographic = Cesium$
|
|
564
|
+
const cartographic = Cesium$h.Cartographic.fromCartesian(bs.center);
|
|
565
565
|
const rect = this._tileset.rectangle;
|
|
566
566
|
if (rect) {
|
|
567
567
|
return {
|
|
568
|
-
west: Cesium$
|
|
569
|
-
south: Cesium$
|
|
570
|
-
east: Cesium$
|
|
571
|
-
north: Cesium$
|
|
568
|
+
west: Cesium$h.Math.toDegrees(rect.west),
|
|
569
|
+
south: Cesium$h.Math.toDegrees(rect.south),
|
|
570
|
+
east: Cesium$h.Math.toDegrees(rect.east),
|
|
571
|
+
north: Cesium$h.Math.toDegrees(rect.north),
|
|
572
572
|
center: [
|
|
573
|
-
Cesium$
|
|
574
|
-
Cesium$
|
|
573
|
+
Cesium$h.Math.toDegrees(cartographic.longitude),
|
|
574
|
+
Cesium$h.Math.toDegrees(cartographic.latitude)
|
|
575
575
|
]
|
|
576
576
|
};
|
|
577
577
|
}
|
|
@@ -609,20 +609,20 @@ class SceneModule {
|
|
|
609
609
|
// ========== 坐标转换 ==========
|
|
610
610
|
|
|
611
611
|
lonLatToWorld(lon, lat, height = 0) {
|
|
612
|
-
return Cesium$
|
|
612
|
+
return Cesium$h.Cartesian3.fromDegrees(lon, lat, height);
|
|
613
613
|
}
|
|
614
614
|
|
|
615
615
|
worldToLonLat(cartesian) {
|
|
616
|
-
const cartographic = Cesium$
|
|
616
|
+
const cartographic = Cesium$h.Cartographic.fromCartesian(cartesian);
|
|
617
617
|
return [
|
|
618
|
-
Cesium$
|
|
619
|
-
Cesium$
|
|
618
|
+
Cesium$h.Math.toDegrees(cartographic.longitude),
|
|
619
|
+
Cesium$h.Math.toDegrees(cartographic.latitude),
|
|
620
620
|
cartographic.height
|
|
621
621
|
];
|
|
622
622
|
}
|
|
623
623
|
|
|
624
624
|
screenToWorld(x, y) {
|
|
625
|
-
const screenPosition = new Cesium$
|
|
625
|
+
const screenPosition = new Cesium$h.Cartesian2(x, y);
|
|
626
626
|
if (this.viewer.scene.pickPositionSupported) {
|
|
627
627
|
const precisePosition = this.viewer.scene.pickPosition(screenPosition);
|
|
628
628
|
if (precisePosition) return precisePosition;
|
|
@@ -630,7 +630,7 @@ class SceneModule {
|
|
|
630
630
|
const ray = this.viewer.camera.getPickRay(screenPosition);
|
|
631
631
|
const globePosition = this.viewer.scene.globe.pick(ray, this.viewer.scene);
|
|
632
632
|
if (globePosition) return globePosition;
|
|
633
|
-
return this.viewer.camera.pickEllipsoid(screenPosition, Cesium$
|
|
633
|
+
return this.viewer.camera.pickEllipsoid(screenPosition, Cesium$h.Ellipsoid.WGS84);
|
|
634
634
|
}
|
|
635
635
|
|
|
636
636
|
worldToScreen(cartesian) {
|
|
@@ -648,13 +648,13 @@ class SceneModule {
|
|
|
648
648
|
}
|
|
649
649
|
|
|
650
650
|
lonLatToCartographic(lon, lat, height = 0) {
|
|
651
|
-
return new Cesium$
|
|
651
|
+
return new Cesium$h.Cartographic(Cesium$h.Math.toRadians(lon), Cesium$h.Math.toRadians(lat), height);
|
|
652
652
|
}
|
|
653
653
|
|
|
654
654
|
cartographicToLonLat(cartographic) {
|
|
655
655
|
return [
|
|
656
|
-
Cesium$
|
|
657
|
-
Cesium$
|
|
656
|
+
Cesium$h.Math.toDegrees(cartographic.longitude),
|
|
657
|
+
Cesium$h.Math.toDegrees(cartographic.latitude),
|
|
658
658
|
cartographic.height
|
|
659
659
|
];
|
|
660
660
|
}
|
|
@@ -750,7 +750,7 @@ class SceneModule {
|
|
|
750
750
|
this.viewer.imageryLayers.remove(layer.getLayer());
|
|
751
751
|
} else if (layer instanceof TerrainLayerWrapper) {
|
|
752
752
|
// 地形无法直接删除,重置为默认椭球地形
|
|
753
|
-
this.viewer.terrainProvider = new Cesium$
|
|
753
|
+
this.viewer.terrainProvider = new Cesium$h.EllipsoidTerrainProvider();
|
|
754
754
|
} else if (layer instanceof TilesetLayerWrapper) {
|
|
755
755
|
this.viewer.scene.primitives.remove(layer.getTileset());
|
|
756
756
|
}
|
|
@@ -792,17 +792,17 @@ class SceneModule {
|
|
|
792
792
|
duration = 3.0
|
|
793
793
|
} = params;
|
|
794
794
|
|
|
795
|
-
if (!Cesium$
|
|
795
|
+
if (!Cesium$h.defined(lon) || !Cesium$h.defined(lat)) {
|
|
796
796
|
console.warn('flyToLonLat: 必须提供 lon、lat');
|
|
797
797
|
return Promise.resolve(false);
|
|
798
798
|
}
|
|
799
799
|
|
|
800
800
|
return this.viewer.camera.flyTo({
|
|
801
|
-
destination: Cesium$
|
|
801
|
+
destination: Cesium$h.Cartesian3.fromDegrees(lon, lat, height),
|
|
802
802
|
orientation: {
|
|
803
|
-
heading: Cesium$
|
|
804
|
-
pitch: Cesium$
|
|
805
|
-
roll: Cesium$
|
|
803
|
+
heading: Cesium$h.Math.toRadians(heading),
|
|
804
|
+
pitch: Cesium$h.Math.toRadians(pitch),
|
|
805
|
+
roll: Cesium$h.Math.toRadians(roll)
|
|
806
806
|
},
|
|
807
807
|
duration
|
|
808
808
|
});
|
|
@@ -827,23 +827,23 @@ class SceneModule {
|
|
|
827
827
|
roll = 0
|
|
828
828
|
} = params;
|
|
829
829
|
|
|
830
|
-
if (!Cesium$
|
|
830
|
+
if (!Cesium$h.defined(lon) || !Cesium$h.defined(lat)) {
|
|
831
831
|
console.warn('setView: 必须提供 lon、lat');
|
|
832
832
|
return;
|
|
833
833
|
}
|
|
834
834
|
|
|
835
835
|
this.viewer.camera.setView({
|
|
836
|
-
destination: Cesium$
|
|
836
|
+
destination: Cesium$h.Cartesian3.fromDegrees(lon, lat, height),
|
|
837
837
|
orientation: {
|
|
838
|
-
heading: Cesium$
|
|
839
|
-
pitch: Cesium$
|
|
840
|
-
roll: Cesium$
|
|
838
|
+
heading: Cesium$h.Math.toRadians(heading),
|
|
839
|
+
pitch: Cesium$h.Math.toRadians(pitch),
|
|
840
|
+
roll: Cesium$h.Math.toRadians(roll)
|
|
841
841
|
}
|
|
842
842
|
});
|
|
843
843
|
}
|
|
844
844
|
}
|
|
845
845
|
|
|
846
|
-
const Cesium$
|
|
846
|
+
const Cesium$g = getCesium();
|
|
847
847
|
|
|
848
848
|
/**
|
|
849
849
|
* 标绘几何算法工具
|
|
@@ -1132,7 +1132,7 @@ class PlotGeometryUtil {
|
|
|
1132
1132
|
for (const p of points) {
|
|
1133
1133
|
flat.push(p[0], p[1], p[2] || 0);
|
|
1134
1134
|
}
|
|
1135
|
-
return Cesium$
|
|
1135
|
+
return Cesium$g.Cartesian3.fromDegreesArrayHeights(flat);
|
|
1136
1136
|
}
|
|
1137
1137
|
|
|
1138
1138
|
// ==================== 曲线/插值工具(复合箭头、曲线标绘需要)====================
|
|
@@ -2028,7 +2028,7 @@ function isLinePlotType(plotType) {
|
|
|
2028
2028
|
].includes(plotType);
|
|
2029
2029
|
}
|
|
2030
2030
|
|
|
2031
|
-
const Cesium$
|
|
2031
|
+
const Cesium$f = getCesium();
|
|
2032
2032
|
|
|
2033
2033
|
/**
|
|
2034
2034
|
* 点图元包装器
|
|
@@ -2040,7 +2040,7 @@ class PointWrapper {
|
|
|
2040
2040
|
}
|
|
2041
2041
|
|
|
2042
2042
|
setPosition(coords) {
|
|
2043
|
-
this._entity.position = Cesium$
|
|
2043
|
+
this._entity.position = Cesium$f.Cartesian3.fromDegrees(...coords);
|
|
2044
2044
|
return this;
|
|
2045
2045
|
}
|
|
2046
2046
|
|
|
@@ -2088,7 +2088,7 @@ class PointWrapper {
|
|
|
2088
2088
|
// 名称标签相关
|
|
2089
2089
|
setNameVisible(visible) {
|
|
2090
2090
|
if (!this._entity.label) {
|
|
2091
|
-
this._entity.label = new Cesium$
|
|
2091
|
+
this._entity.label = new Cesium$f.LabelGraphics();
|
|
2092
2092
|
}
|
|
2093
2093
|
this._entity.label.show = visible;
|
|
2094
2094
|
return this;
|
|
@@ -2096,22 +2096,22 @@ class PointWrapper {
|
|
|
2096
2096
|
|
|
2097
2097
|
setText(text, options = {}) {
|
|
2098
2098
|
if (!this._entity.label) {
|
|
2099
|
-
this._entity.label = new Cesium$
|
|
2099
|
+
this._entity.label = new Cesium$f.LabelGraphics();
|
|
2100
2100
|
}
|
|
2101
2101
|
this._entity.label.text = text;
|
|
2102
2102
|
|
|
2103
2103
|
// 应用配置选项
|
|
2104
2104
|
this._entity.label.disableDepthTestDistance = options.disableDepthTestDistance ?? Number.POSITIVE_INFINITY;
|
|
2105
|
-
this._entity.label.verticalOrigin = options.verticalOrigin ?? Cesium$
|
|
2106
|
-
this._entity.label.eyeOffset = options.eyeOffset ?? new Cesium$
|
|
2107
|
-
this._entity.label.heightReference = options.heightReference ?? Cesium$
|
|
2105
|
+
this._entity.label.verticalOrigin = options.verticalOrigin ?? Cesium$f.VerticalOrigin.BOTTOM;
|
|
2106
|
+
this._entity.label.eyeOffset = options.eyeOffset ?? new Cesium$f.Cartesian3(0, 0, -10);
|
|
2107
|
+
this._entity.label.heightReference = options.heightReference ?? Cesium$f.HeightReference.RELATIVE_TO_GROUND;
|
|
2108
2108
|
|
|
2109
2109
|
return this;
|
|
2110
2110
|
}
|
|
2111
2111
|
|
|
2112
2112
|
setFont(font) {
|
|
2113
2113
|
if (!this._entity.label) {
|
|
2114
|
-
this._entity.label = new Cesium$
|
|
2114
|
+
this._entity.label = new Cesium$f.LabelGraphics();
|
|
2115
2115
|
}
|
|
2116
2116
|
this._entity.label.font = font;
|
|
2117
2117
|
return this;
|
|
@@ -2119,7 +2119,7 @@ class PointWrapper {
|
|
|
2119
2119
|
|
|
2120
2120
|
setTextColor(color) {
|
|
2121
2121
|
if (!this._entity.label) {
|
|
2122
|
-
this._entity.label = new Cesium$
|
|
2122
|
+
this._entity.label = new Cesium$f.LabelGraphics();
|
|
2123
2123
|
}
|
|
2124
2124
|
this._entity.label.fillColor = color;
|
|
2125
2125
|
return this;
|
|
@@ -2127,7 +2127,7 @@ class PointWrapper {
|
|
|
2127
2127
|
|
|
2128
2128
|
setTextOutlineColor(color) {
|
|
2129
2129
|
if (!this._entity.label) {
|
|
2130
|
-
this._entity.label = new Cesium$
|
|
2130
|
+
this._entity.label = new Cesium$f.LabelGraphics();
|
|
2131
2131
|
}
|
|
2132
2132
|
this._entity.label.outlineColor = color;
|
|
2133
2133
|
return this;
|
|
@@ -2135,7 +2135,7 @@ class PointWrapper {
|
|
|
2135
2135
|
|
|
2136
2136
|
setTextOutlineWidth(width) {
|
|
2137
2137
|
if (!this._entity.label) {
|
|
2138
|
-
this._entity.label = new Cesium$
|
|
2138
|
+
this._entity.label = new Cesium$f.LabelGraphics();
|
|
2139
2139
|
}
|
|
2140
2140
|
this._entity.label.outlineWidth = width;
|
|
2141
2141
|
return this;
|
|
@@ -2143,19 +2143,19 @@ class PointWrapper {
|
|
|
2143
2143
|
|
|
2144
2144
|
setAlignType(alignType) {
|
|
2145
2145
|
if (!this._entity.label) {
|
|
2146
|
-
this._entity.label = new Cesium$
|
|
2146
|
+
this._entity.label = new Cesium$f.LabelGraphics();
|
|
2147
2147
|
}
|
|
2148
2148
|
// alignType: 0=CENTER, 1=LEFT, 2=RIGHT, 3=TOP, 4=BOTTOM
|
|
2149
|
-
const horizontalOrigins = [Cesium$
|
|
2150
|
-
const verticalOrigins = [Cesium$
|
|
2151
|
-
this._entity.label.horizontalOrigin = horizontalOrigins[alignType] || Cesium$
|
|
2152
|
-
this._entity.label.verticalOrigin = verticalOrigins[alignType] || Cesium$
|
|
2149
|
+
const horizontalOrigins = [Cesium$f.HorizontalOrigin.CENTER, Cesium$f.HorizontalOrigin.LEFT, Cesium$f.HorizontalOrigin.RIGHT];
|
|
2150
|
+
const verticalOrigins = [Cesium$f.VerticalOrigin.CENTER, Cesium$f.VerticalOrigin.CENTER, Cesium$f.VerticalOrigin.CENTER, Cesium$f.VerticalOrigin.TOP, Cesium$f.VerticalOrigin.BOTTOM];
|
|
2151
|
+
this._entity.label.horizontalOrigin = horizontalOrigins[alignType] || Cesium$f.HorizontalOrigin.CENTER;
|
|
2152
|
+
this._entity.label.verticalOrigin = verticalOrigins[alignType] || Cesium$f.VerticalOrigin.CENTER;
|
|
2153
2153
|
return this;
|
|
2154
2154
|
}
|
|
2155
2155
|
|
|
2156
2156
|
setTextPixelOffset(offset) {
|
|
2157
2157
|
if (!this._entity.label) {
|
|
2158
|
-
this._entity.label = new Cesium$
|
|
2158
|
+
this._entity.label = new Cesium$f.LabelGraphics();
|
|
2159
2159
|
}
|
|
2160
2160
|
this._entity.label.pixelOffset = offset;
|
|
2161
2161
|
return this;
|
|
@@ -2163,7 +2163,7 @@ class PointWrapper {
|
|
|
2163
2163
|
|
|
2164
2164
|
setTextScale(scale) {
|
|
2165
2165
|
if (!this._entity.label) {
|
|
2166
|
-
this._entity.label = new Cesium$
|
|
2166
|
+
this._entity.label = new Cesium$f.LabelGraphics();
|
|
2167
2167
|
}
|
|
2168
2168
|
this._entity.label.scale = scale;
|
|
2169
2169
|
return this;
|
|
@@ -2185,7 +2185,7 @@ class LineWrapper {
|
|
|
2185
2185
|
}
|
|
2186
2186
|
|
|
2187
2187
|
setPositions(coords) {
|
|
2188
|
-
this._entity.polyline.positions = Cesium$
|
|
2188
|
+
this._entity.polyline.positions = Cesium$f.Cartesian3.fromDegreesArrayHeights(
|
|
2189
2189
|
coords.flatMap(coord => [coord[0], coord[1], coord[2] || 0])
|
|
2190
2190
|
);
|
|
2191
2191
|
return this;
|
|
@@ -2229,23 +2229,23 @@ class LineWrapper {
|
|
|
2229
2229
|
*/
|
|
2230
2230
|
setLabel(text, options = {}) {
|
|
2231
2231
|
if (!this._entity.label) {
|
|
2232
|
-
this._entity.label = new Cesium$
|
|
2232
|
+
this._entity.label = new Cesium$f.LabelGraphics();
|
|
2233
2233
|
}
|
|
2234
2234
|
this._entity.label.text = text;
|
|
2235
2235
|
this._entity.label.font = options.font || '14px Microsoft YaHei';
|
|
2236
|
-
this._entity.label.fillColor = options.color || Cesium$
|
|
2237
|
-
this._entity.label.outlineColor = options.outlineColor || Cesium$
|
|
2236
|
+
this._entity.label.fillColor = options.color || Cesium$f.Color.WHITE;
|
|
2237
|
+
this._entity.label.outlineColor = options.outlineColor || Cesium$f.Color.BLACK;
|
|
2238
2238
|
this._entity.label.outlineWidth = options.outlineWidth ?? 1;
|
|
2239
2239
|
this._entity.label.show = true;
|
|
2240
|
-
this._entity.label.pixelOffset = options.pixelOffset || new Cesium$
|
|
2241
|
-
this._entity.label.horizontalOrigin = options.horizontalOrigin ?? Cesium$
|
|
2242
|
-
this._entity.label.verticalOrigin = options.verticalOrigin ?? Cesium$
|
|
2240
|
+
this._entity.label.pixelOffset = options.pixelOffset || new Cesium$f.Cartesian2(0, -10);
|
|
2241
|
+
this._entity.label.horizontalOrigin = options.horizontalOrigin ?? Cesium$f.HorizontalOrigin.CENTER;
|
|
2242
|
+
this._entity.label.verticalOrigin = options.verticalOrigin ?? Cesium$f.VerticalOrigin.BOTTOM;
|
|
2243
2243
|
|
|
2244
2244
|
// 使用 CallbackProperty 动态计算标签锚点,随编辑/平移自动更新
|
|
2245
2245
|
const self = this;
|
|
2246
|
-
this._entity.position = new Cesium$
|
|
2246
|
+
this._entity.position = new Cesium$f.CallbackProperty(function () {
|
|
2247
2247
|
const anchor = self._computeLabelAnchor();
|
|
2248
|
-
return Cesium$
|
|
2248
|
+
return Cesium$f.Cartesian3.fromDegrees(anchor[0], anchor[1], anchor[2] || 0);
|
|
2249
2249
|
}, false);
|
|
2250
2250
|
|
|
2251
2251
|
return this;
|
|
@@ -2268,13 +2268,13 @@ class LineWrapper {
|
|
|
2268
2268
|
return [x / cps.length, y / cps.length, z / cps.length];
|
|
2269
2269
|
}
|
|
2270
2270
|
|
|
2271
|
-
const positions = this._entity.polyline?.positions?.getValue(Cesium$
|
|
2271
|
+
const positions = this._entity.polyline?.positions?.getValue(Cesium$f.JulianDate.now());
|
|
2272
2272
|
if (positions && positions.length > 0) {
|
|
2273
2273
|
let lon = 0, lat = 0, height = 0;
|
|
2274
2274
|
positions.forEach(p => {
|
|
2275
|
-
const c = Cesium$
|
|
2276
|
-
lon += Cesium$
|
|
2277
|
-
lat += Cesium$
|
|
2275
|
+
const c = Cesium$f.Cartographic.fromCartesian(p);
|
|
2276
|
+
lon += Cesium$f.Math.toDegrees(c.longitude);
|
|
2277
|
+
lat += Cesium$f.Math.toDegrees(c.latitude);
|
|
2278
2278
|
height += c.height || 0;
|
|
2279
2279
|
});
|
|
2280
2280
|
const count = positions.length;
|
|
@@ -2347,8 +2347,8 @@ class PolygonWrapper {
|
|
|
2347
2347
|
}
|
|
2348
2348
|
|
|
2349
2349
|
setPositions(coords) {
|
|
2350
|
-
this._entity.polygon.hierarchy = new Cesium$
|
|
2351
|
-
Cesium$
|
|
2350
|
+
this._entity.polygon.hierarchy = new Cesium$f.PolygonHierarchy(
|
|
2351
|
+
Cesium$f.Cartesian3.fromDegreesArrayHeights(
|
|
2352
2352
|
coords.flatMap(coord => [coord[0], coord[1], coord[2] || 0])
|
|
2353
2353
|
)
|
|
2354
2354
|
);
|
|
@@ -2398,23 +2398,23 @@ class PolygonWrapper {
|
|
|
2398
2398
|
*/
|
|
2399
2399
|
setLabel(text, options = {}) {
|
|
2400
2400
|
if (!this._entity.label) {
|
|
2401
|
-
this._entity.label = new Cesium$
|
|
2401
|
+
this._entity.label = new Cesium$f.LabelGraphics();
|
|
2402
2402
|
}
|
|
2403
2403
|
this._entity.label.text = text;
|
|
2404
2404
|
this._entity.label.font = options.font || '14px Microsoft YaHei';
|
|
2405
|
-
this._entity.label.fillColor = options.color || Cesium$
|
|
2406
|
-
this._entity.label.outlineColor = options.outlineColor || Cesium$
|
|
2405
|
+
this._entity.label.fillColor = options.color || Cesium$f.Color.WHITE;
|
|
2406
|
+
this._entity.label.outlineColor = options.outlineColor || Cesium$f.Color.BLACK;
|
|
2407
2407
|
this._entity.label.outlineWidth = options.outlineWidth ?? 1;
|
|
2408
2408
|
this._entity.label.show = true;
|
|
2409
|
-
this._entity.label.pixelOffset = options.pixelOffset || new Cesium$
|
|
2410
|
-
this._entity.label.horizontalOrigin = options.horizontalOrigin ?? Cesium$
|
|
2411
|
-
this._entity.label.verticalOrigin = options.verticalOrigin ?? Cesium$
|
|
2409
|
+
this._entity.label.pixelOffset = options.pixelOffset || new Cesium$f.Cartesian2(0, -10);
|
|
2410
|
+
this._entity.label.horizontalOrigin = options.horizontalOrigin ?? Cesium$f.HorizontalOrigin.CENTER;
|
|
2411
|
+
this._entity.label.verticalOrigin = options.verticalOrigin ?? Cesium$f.VerticalOrigin.BOTTOM;
|
|
2412
2412
|
|
|
2413
2413
|
// 使用 CallbackProperty 动态计算标签锚点,随编辑/平移自动更新
|
|
2414
2414
|
const self = this;
|
|
2415
|
-
this._entity.position = new Cesium$
|
|
2415
|
+
this._entity.position = new Cesium$f.CallbackProperty(function () {
|
|
2416
2416
|
const anchor = self._computeLabelAnchor();
|
|
2417
|
-
return Cesium$
|
|
2417
|
+
return Cesium$f.Cartesian3.fromDegrees(anchor[0], anchor[1], anchor[2] || 0);
|
|
2418
2418
|
}, false);
|
|
2419
2419
|
|
|
2420
2420
|
return this;
|
|
@@ -2441,13 +2441,13 @@ class PolygonWrapper {
|
|
|
2441
2441
|
return [x / cps.length, y / cps.length, z / cps.length];
|
|
2442
2442
|
}
|
|
2443
2443
|
|
|
2444
|
-
const hierarchy = this._entity.polygon?.hierarchy?.getValue(Cesium$
|
|
2444
|
+
const hierarchy = this._entity.polygon?.hierarchy?.getValue(Cesium$f.JulianDate.now());
|
|
2445
2445
|
if (hierarchy && hierarchy.positions && hierarchy.positions.length > 0) {
|
|
2446
2446
|
let lon = 0, lat = 0, height = 0;
|
|
2447
2447
|
hierarchy.positions.forEach(p => {
|
|
2448
|
-
const c = Cesium$
|
|
2449
|
-
lon += Cesium$
|
|
2450
|
-
lat += Cesium$
|
|
2448
|
+
const c = Cesium$f.Cartographic.fromCartesian(p);
|
|
2449
|
+
lon += Cesium$f.Math.toDegrees(c.longitude);
|
|
2450
|
+
lat += Cesium$f.Math.toDegrees(c.latitude);
|
|
2451
2451
|
height += c.height || 0;
|
|
2452
2452
|
});
|
|
2453
2453
|
const count = hierarchy.positions.length;
|
|
@@ -2520,7 +2520,7 @@ class ModelWrapper {
|
|
|
2520
2520
|
}
|
|
2521
2521
|
|
|
2522
2522
|
setPosition(coords) {
|
|
2523
|
-
this._entity.position = Cesium$
|
|
2523
|
+
this._entity.position = Cesium$f.Cartesian3.fromDegrees(...coords);
|
|
2524
2524
|
return this;
|
|
2525
2525
|
}
|
|
2526
2526
|
|
|
@@ -2570,7 +2570,7 @@ class TextWrapper {
|
|
|
2570
2570
|
}
|
|
2571
2571
|
|
|
2572
2572
|
setPosition(coords) {
|
|
2573
|
-
this._entity.position = Cesium$
|
|
2573
|
+
this._entity.position = Cesium$f.Cartesian3.fromDegrees(...coords);
|
|
2574
2574
|
return this;
|
|
2575
2575
|
}
|
|
2576
2576
|
|
|
@@ -2616,10 +2616,10 @@ class TextWrapper {
|
|
|
2616
2616
|
}
|
|
2617
2617
|
|
|
2618
2618
|
setAlignType(alignType) {
|
|
2619
|
-
const horizontalOrigins = [Cesium$
|
|
2620
|
-
const verticalOrigins = [Cesium$
|
|
2621
|
-
this._entity.label.horizontalOrigin = horizontalOrigins[alignType] || Cesium$
|
|
2622
|
-
this._entity.label.verticalOrigin = verticalOrigins[alignType] || Cesium$
|
|
2619
|
+
const horizontalOrigins = [Cesium$f.HorizontalOrigin.CENTER, Cesium$f.HorizontalOrigin.LEFT, Cesium$f.HorizontalOrigin.RIGHT];
|
|
2620
|
+
const verticalOrigins = [Cesium$f.VerticalOrigin.CENTER, Cesium$f.VerticalOrigin.CENTER, Cesium$f.VerticalOrigin.CENTER, Cesium$f.VerticalOrigin.TOP, Cesium$f.VerticalOrigin.BOTTOM];
|
|
2621
|
+
this._entity.label.horizontalOrigin = horizontalOrigins[alignType] || Cesium$f.HorizontalOrigin.CENTER;
|
|
2622
|
+
this._entity.label.verticalOrigin = verticalOrigins[alignType] || Cesium$f.VerticalOrigin.CENTER;
|
|
2623
2623
|
return this;
|
|
2624
2624
|
}
|
|
2625
2625
|
|
|
@@ -2657,14 +2657,14 @@ class GraphicModule {
|
|
|
2657
2657
|
return this.wrapperMap.get(graphicId);
|
|
2658
2658
|
}
|
|
2659
2659
|
|
|
2660
|
-
const defaultStyle = this.config.graphic?.point || { pixelSize: 8, color: Cesium$
|
|
2660
|
+
const defaultStyle = this.config.graphic?.point || { pixelSize: 8, color: Cesium$f.Color.RED };
|
|
2661
2661
|
|
|
2662
2662
|
const entityOptions = {
|
|
2663
2663
|
id: graphicId,
|
|
2664
|
-
position: Cesium$
|
|
2664
|
+
position: Cesium$f.Cartesian3.fromDegrees(0, 0, 0),
|
|
2665
2665
|
point: {
|
|
2666
2666
|
...defaultStyle,
|
|
2667
|
-
outlineColor: Cesium$
|
|
2667
|
+
outlineColor: Cesium$f.Color.WHITE,
|
|
2668
2668
|
outlineWidth: 1
|
|
2669
2669
|
}
|
|
2670
2670
|
};
|
|
@@ -2698,12 +2698,12 @@ class GraphicModule {
|
|
|
2698
2698
|
return this.wrapperMap.get(graphicId);
|
|
2699
2699
|
}
|
|
2700
2700
|
|
|
2701
|
-
const defaultStyle = this.config.graphic?.line || { width: 2, material: Cesium$
|
|
2701
|
+
const defaultStyle = this.config.graphic?.line || { width: 2, material: Cesium$f.Color.BLUE };
|
|
2702
2702
|
|
|
2703
2703
|
const entityOptions = {
|
|
2704
2704
|
id: graphicId,
|
|
2705
2705
|
polyline: {
|
|
2706
|
-
positions: Cesium$
|
|
2706
|
+
positions: Cesium$f.Cartesian3.fromDegreesArrayHeights([0, 0, 0, 0, 0, 0]),
|
|
2707
2707
|
clampToGround: true,
|
|
2708
2708
|
...defaultStyle
|
|
2709
2709
|
}
|
|
@@ -2738,14 +2738,14 @@ class GraphicModule {
|
|
|
2738
2738
|
return this.wrapperMap.get(graphicId);
|
|
2739
2739
|
}
|
|
2740
2740
|
|
|
2741
|
-
const defaultStyle = this.config.graphic?.polygon || { color: Cesium$
|
|
2741
|
+
const defaultStyle = this.config.graphic?.polygon || { color: Cesium$f.Color.GREEN.withAlpha(0.5) };
|
|
2742
2742
|
|
|
2743
2743
|
const entityOptions = {
|
|
2744
2744
|
id: graphicId,
|
|
2745
2745
|
polygon: {
|
|
2746
|
-
hierarchy: new Cesium$
|
|
2746
|
+
hierarchy: new Cesium$f.PolygonHierarchy([]),
|
|
2747
2747
|
clampToGround: true,
|
|
2748
|
-
outlineColor: Cesium$
|
|
2748
|
+
outlineColor: Cesium$f.Color.WHITE,
|
|
2749
2749
|
outlineWidth: 1,
|
|
2750
2750
|
...defaultStyle
|
|
2751
2751
|
}
|
|
@@ -2782,7 +2782,7 @@ class GraphicModule {
|
|
|
2782
2782
|
|
|
2783
2783
|
const entityOptions = {
|
|
2784
2784
|
id: graphicId,
|
|
2785
|
-
position: Cesium$
|
|
2785
|
+
position: Cesium$f.Cartesian3.fromDegrees(0, 0, 0),
|
|
2786
2786
|
model: {
|
|
2787
2787
|
uri: "",
|
|
2788
2788
|
scale: 1.0,
|
|
@@ -2821,16 +2821,16 @@ class GraphicModule {
|
|
|
2821
2821
|
|
|
2822
2822
|
const entityOptions = {
|
|
2823
2823
|
id: graphicId,
|
|
2824
|
-
position: Cesium$
|
|
2824
|
+
position: Cesium$f.Cartesian3.fromDegrees(0, 0, 0),
|
|
2825
2825
|
label: {
|
|
2826
2826
|
text: "",
|
|
2827
2827
|
font: "16px Microsoft YaHei",
|
|
2828
|
-
fillColor: Cesium$
|
|
2829
|
-
outlineColor: Cesium$
|
|
2828
|
+
fillColor: Cesium$f.Color.WHITE,
|
|
2829
|
+
outlineColor: Cesium$f.Color.BLACK,
|
|
2830
2830
|
outlineWidth: 2,
|
|
2831
|
-
style: Cesium$
|
|
2832
|
-
verticalOrigin: Cesium$
|
|
2833
|
-
horizontalOrigin: Cesium$
|
|
2831
|
+
style: Cesium$f.LabelStyle.FILL_AND_OUTLINE,
|
|
2832
|
+
verticalOrigin: Cesium$f.VerticalOrigin.BOTTOM,
|
|
2833
|
+
horizontalOrigin: Cesium$f.HorizontalOrigin.CENTER
|
|
2834
2834
|
}
|
|
2835
2835
|
};
|
|
2836
2836
|
|
|
@@ -3047,6 +3047,9 @@ class GraphicModule {
|
|
|
3047
3047
|
return false;
|
|
3048
3048
|
}
|
|
3049
3049
|
|
|
3050
|
+
// 清理可能存在的 outline 等关联 entity
|
|
3051
|
+
this.removeOutline(graphicId);
|
|
3052
|
+
|
|
3050
3053
|
const entity = this.graphicMap.get(graphicId);
|
|
3051
3054
|
this.viewer.entities.remove(entity);
|
|
3052
3055
|
this.graphicMap.delete(graphicId);
|
|
@@ -3062,9 +3065,163 @@ class GraphicModule {
|
|
|
3062
3065
|
getGraphic(graphicId) {
|
|
3063
3066
|
return this.graphicMap.get(graphicId);
|
|
3064
3067
|
}
|
|
3068
|
+
|
|
3069
|
+
/**
|
|
3070
|
+
* 从 entity 中提取顶点坐标
|
|
3071
|
+
* 支持 point / polyline / polygon
|
|
3072
|
+
* @private
|
|
3073
|
+
* @param {Cesium.Entity} entity 图元实体
|
|
3074
|
+
* @returns {Cesium.Cartesian3[]} 顶点坐标数组
|
|
3075
|
+
*/
|
|
3076
|
+
_getEntityPositions(entity) {
|
|
3077
|
+
const getValue = (prop) => {
|
|
3078
|
+
if (prop == null) return undefined;
|
|
3079
|
+
return typeof prop.getValue === 'function' ? prop.getValue(Cesium$f.JulianDate.now()) : prop;
|
|
3080
|
+
};
|
|
3081
|
+
|
|
3082
|
+
// 优先按 geometry 类型取顶点,避免 polygon/polyline 也带 position 时只拿到中心点
|
|
3083
|
+
if (entity.polygon?.hierarchy) {
|
|
3084
|
+
const hierarchy = getValue(entity.polygon.hierarchy);
|
|
3085
|
+
if (Array.isArray(hierarchy)) return hierarchy;
|
|
3086
|
+
if (Array.isArray(hierarchy?.positions)) return hierarchy.positions;
|
|
3087
|
+
return [];
|
|
3088
|
+
}
|
|
3089
|
+
if (entity.polyline?.positions) {
|
|
3090
|
+
return getValue(entity.polyline.positions) ?? [];
|
|
3091
|
+
}
|
|
3092
|
+
if (entity.position) {
|
|
3093
|
+
const p = getValue(entity.position);
|
|
3094
|
+
return p ? [p] : [];
|
|
3095
|
+
}
|
|
3096
|
+
return [];
|
|
3097
|
+
}
|
|
3098
|
+
|
|
3099
|
+
/**
|
|
3100
|
+
* 获取图元顶点坐标
|
|
3101
|
+
* @param {string|Cesium.Entity} graphicIdOrEntity 图元ID或实体
|
|
3102
|
+
* @returns {Cesium.Cartesian3[]} 顶点坐标数组
|
|
3103
|
+
*/
|
|
3104
|
+
getPositions(graphicIdOrEntity) {
|
|
3105
|
+
const entity = typeof graphicIdOrEntity === 'string'
|
|
3106
|
+
? this.getGraphic(graphicIdOrEntity)
|
|
3107
|
+
: graphicIdOrEntity;
|
|
3108
|
+
return entity ? this._getEntityPositions(entity) : [];
|
|
3109
|
+
}
|
|
3110
|
+
|
|
3111
|
+
/**
|
|
3112
|
+
* 获取图元包围球
|
|
3113
|
+
* @param {string|Cesium.Entity} graphicIdOrEntity 图元ID或实体
|
|
3114
|
+
* @returns {Cesium.BoundingSphere|null} 包围球
|
|
3115
|
+
*/
|
|
3116
|
+
getBoundingSphere(graphicIdOrEntity) {
|
|
3117
|
+
const positions = this.getPositions(graphicIdOrEntity);
|
|
3118
|
+
if (!positions.length) return null;
|
|
3119
|
+
|
|
3120
|
+
const sphere = Cesium$f.BoundingSphere.fromPoints(positions);
|
|
3121
|
+
// 点图元只有单个坐标,radius 为 0,给一个最小可视半径避免相机钻进点里
|
|
3122
|
+
if (positions.length === 1 && sphere.radius === 0) {
|
|
3123
|
+
sphere.radius = 5000;
|
|
3124
|
+
}
|
|
3125
|
+
return sphere;
|
|
3126
|
+
}
|
|
3127
|
+
|
|
3128
|
+
/**
|
|
3129
|
+
* 飞行定位到图元
|
|
3130
|
+
* @param {string|Cesium.Entity} graphicIdOrEntity 图元ID或实体
|
|
3131
|
+
* @param {object} options 配置项 { pitch?, padding?, duration? }
|
|
3132
|
+
* @returns {Promise<boolean>}
|
|
3133
|
+
*/
|
|
3134
|
+
flyTo(graphicIdOrEntity, options = {}) {
|
|
3135
|
+
const entity = typeof graphicIdOrEntity === 'string'
|
|
3136
|
+
? this.getGraphic(graphicIdOrEntity)
|
|
3137
|
+
: graphicIdOrEntity;
|
|
3138
|
+
if (!entity || !this.viewer) return Promise.resolve(false);
|
|
3139
|
+
|
|
3140
|
+
const sphere = this.getBoundingSphere(entity);
|
|
3141
|
+
if (!sphere) return Promise.resolve(false);
|
|
3142
|
+
|
|
3143
|
+
const pitch = options.pitch ?? -Cesium$f.Math.PI_OVER_TWO;
|
|
3144
|
+
const padding = options.padding ?? 2;
|
|
3145
|
+
const fovy = this.viewer.camera.frustum.fovy;
|
|
3146
|
+
const range = (sphere.radius / Math.tan(fovy / 2)) * padding;
|
|
3147
|
+
|
|
3148
|
+
return this.viewer.camera.flyToBoundingSphere(sphere, {
|
|
3149
|
+
duration: options.duration ?? 1.5,
|
|
3150
|
+
offset: new Cesium$f.HeadingPitchRange(0, pitch, range),
|
|
3151
|
+
}).then(() => true).catch((err) => {
|
|
3152
|
+
console.error('图元定位失败', err);
|
|
3153
|
+
return false;
|
|
3154
|
+
});
|
|
3155
|
+
}
|
|
3156
|
+
|
|
3157
|
+
/**
|
|
3158
|
+
* 瞬间定位到图元(无动画)
|
|
3159
|
+
* @param {string|Cesium.Entity} graphicIdOrEntity 图元ID或实体
|
|
3160
|
+
* @param {object} options 配置项 { pitch?, padding? }
|
|
3161
|
+
*/
|
|
3162
|
+
zoomTo(graphicIdOrEntity, options = {}) {
|
|
3163
|
+
const entity = typeof graphicIdOrEntity === 'string'
|
|
3164
|
+
? this.getGraphic(graphicIdOrEntity)
|
|
3165
|
+
: graphicIdOrEntity;
|
|
3166
|
+
if (!entity || !this.viewer) return;
|
|
3167
|
+
|
|
3168
|
+
const sphere = this.getBoundingSphere(entity);
|
|
3169
|
+
if (!sphere) return;
|
|
3170
|
+
|
|
3171
|
+
const pitch = options.pitch ?? -Cesium$f.Math.PI_OVER_TWO;
|
|
3172
|
+
const padding = options.padding ?? 2;
|
|
3173
|
+
const fovy = this.viewer.camera.frustum.fovy;
|
|
3174
|
+
const range = (sphere.radius / Math.tan(fovy / 2)) * padding;
|
|
3175
|
+
|
|
3176
|
+
this.viewer.camera.viewBoundingSphere(sphere, new Cesium$f.HeadingPitchRange(0, pitch, range));
|
|
3177
|
+
}
|
|
3178
|
+
|
|
3179
|
+
/**
|
|
3180
|
+
* 为面图元设置/移除外边框(用 polyline 模拟,解决 Cesium 贴地 polygon 不支持 outline 的问题)
|
|
3181
|
+
* @param {string} graphicId 图元ID
|
|
3182
|
+
* @param {object} options 配置项 { enabled, color, width }
|
|
3183
|
+
* @returns {boolean} 是否设置成功
|
|
3184
|
+
*/
|
|
3185
|
+
setOutline(graphicId, options = {}) {
|
|
3186
|
+
const entity = this.getGraphic(graphicId);
|
|
3187
|
+
if (!entity || !entity.polygon || !this.viewer) return false;
|
|
3188
|
+
|
|
3189
|
+
// 先移除旧的
|
|
3190
|
+
this.removeOutline(graphicId);
|
|
3191
|
+
|
|
3192
|
+
if (!options.enabled) return true;
|
|
3193
|
+
|
|
3194
|
+
const positions = this._getEntityPositions(entity);
|
|
3195
|
+
if (positions.length < 3) return false;
|
|
3196
|
+
|
|
3197
|
+
const closedPositions = [...positions, positions[0]];
|
|
3198
|
+
const outlineId = `${graphicId}_outline`;
|
|
3199
|
+
const color = options.color ?? Cesium$f.Color.WHITE;
|
|
3200
|
+
const width = options.width ?? 2;
|
|
3201
|
+
|
|
3202
|
+
this.viewer.entities.add({
|
|
3203
|
+
id: outlineId,
|
|
3204
|
+
polyline: {
|
|
3205
|
+
positions: closedPositions,
|
|
3206
|
+
width,
|
|
3207
|
+
material: color,
|
|
3208
|
+
clampToGround: true,
|
|
3209
|
+
},
|
|
3210
|
+
});
|
|
3211
|
+
return true;
|
|
3212
|
+
}
|
|
3213
|
+
|
|
3214
|
+
/**
|
|
3215
|
+
* 移除面图元的外边框
|
|
3216
|
+
* @param {string} graphicId 图元ID
|
|
3217
|
+
*/
|
|
3218
|
+
removeOutline(graphicId) {
|
|
3219
|
+
if (!this.viewer) return;
|
|
3220
|
+
this.viewer.entities.removeById(`${graphicId}_outline`);
|
|
3221
|
+
}
|
|
3065
3222
|
}
|
|
3066
3223
|
|
|
3067
|
-
const Cesium$
|
|
3224
|
+
const Cesium$e = getCesium();
|
|
3068
3225
|
|
|
3069
3226
|
/**
|
|
3070
3227
|
* 事件模块(对应平台 IEventModule)
|
|
@@ -3162,7 +3319,7 @@ class EventModule {
|
|
|
3162
3319
|
switch (baseType) {
|
|
3163
3320
|
// 鼠标事件
|
|
3164
3321
|
case 'mouse':
|
|
3165
|
-
this.handlers[eventKey] = new Cesium$
|
|
3322
|
+
this.handlers[eventKey] = new Cesium$e.ScreenSpaceEventHandler(this.viewer.scene.canvas);
|
|
3166
3323
|
// 绑定鼠标事件
|
|
3167
3324
|
const mouseEventType = this.getCesiumMouseEventType(subType);
|
|
3168
3325
|
this.handlers[eventKey].setInputAction((movement) => {
|
|
@@ -3183,10 +3340,10 @@ class EventModule {
|
|
|
3183
3340
|
const pickedEntity = this.viewer.scene.pick(screenPos);
|
|
3184
3341
|
|
|
3185
3342
|
if (position) {
|
|
3186
|
-
const cartographic = Cesium$
|
|
3343
|
+
const cartographic = Cesium$e.Cartographic.fromCartesian(position);
|
|
3187
3344
|
lngLat = [
|
|
3188
|
-
Cesium$
|
|
3189
|
-
Cesium$
|
|
3345
|
+
Cesium$e.Math.toDegrees(cartographic.longitude),
|
|
3346
|
+
Cesium$e.Math.toDegrees(cartographic.latitude),
|
|
3190
3347
|
cartographic.height
|
|
3191
3348
|
];
|
|
3192
3349
|
}
|
|
@@ -3252,12 +3409,12 @@ class EventModule {
|
|
|
3252
3409
|
// ========== 工具方法:映射 Cesium 鼠标事件类型 ==========
|
|
3253
3410
|
getCesiumMouseEventType(subType) {
|
|
3254
3411
|
switch (subType) {
|
|
3255
|
-
case 'click': return Cesium$
|
|
3256
|
-
case 'rightclick': return Cesium$
|
|
3257
|
-
case 'move': return Cesium$
|
|
3258
|
-
case 'down': return Cesium$
|
|
3259
|
-
case 'up': return Cesium$
|
|
3260
|
-
default: return Cesium$
|
|
3412
|
+
case 'click': return Cesium$e.ScreenSpaceEventType.LEFT_CLICK;
|
|
3413
|
+
case 'rightclick': return Cesium$e.ScreenSpaceEventType.RIGHT_CLICK;
|
|
3414
|
+
case 'move': return Cesium$e.ScreenSpaceEventType.MOUSE_MOVE;
|
|
3415
|
+
case 'down': return Cesium$e.ScreenSpaceEventType.LEFT_DOWN;
|
|
3416
|
+
case 'up': return Cesium$e.ScreenSpaceEventType.LEFT_UP;
|
|
3417
|
+
default: return Cesium$e.ScreenSpaceEventType.LEFT_CLICK;
|
|
3261
3418
|
}
|
|
3262
3419
|
}
|
|
3263
3420
|
|
|
@@ -3265,18 +3422,18 @@ class EventModule {
|
|
|
3265
3422
|
getZoomLevel() {
|
|
3266
3423
|
const camera = this.viewer.camera;
|
|
3267
3424
|
const positionCartographic = camera.positionCartographic;
|
|
3268
|
-
const positionCartesian = Cesium$
|
|
3425
|
+
const positionCartesian = Cesium$e.Cartesian3.fromRadians(
|
|
3269
3426
|
positionCartographic.longitude,
|
|
3270
3427
|
positionCartographic.latitude,
|
|
3271
3428
|
positionCartographic.height
|
|
3272
3429
|
);
|
|
3273
|
-
const distance = Cesium$
|
|
3430
|
+
const distance = Cesium$e.Cartesian3.distance(camera.position, positionCartesian);
|
|
3274
3431
|
// 映射为 0-20 级缩放(类似地图瓦片级别)
|
|
3275
3432
|
return Math.floor(Math.log2(6378137 * 2 * Math.PI / distance)) + 1;
|
|
3276
3433
|
}
|
|
3277
3434
|
}
|
|
3278
3435
|
|
|
3279
|
-
const Cesium$
|
|
3436
|
+
const Cesium$d = getCesium();
|
|
3280
3437
|
|
|
3281
3438
|
/**
|
|
3282
3439
|
* 工具基类
|
|
@@ -3371,17 +3528,17 @@ class BaseTool {
|
|
|
3371
3528
|
// 如果拾取失败(空白区域),fallback 到椭球体表面
|
|
3372
3529
|
if (!cartesian) {
|
|
3373
3530
|
cartesian = this._viewer.camera.pickEllipsoid(
|
|
3374
|
-
new Cesium$
|
|
3531
|
+
new Cesium$d.Cartesian3(screenPos.x, screenPos.y),
|
|
3375
3532
|
this._viewer.scene.globe.ellipsoid
|
|
3376
3533
|
);
|
|
3377
3534
|
}
|
|
3378
3535
|
|
|
3379
3536
|
if (!cartesian) return null;
|
|
3380
3537
|
|
|
3381
|
-
const cartographic = Cesium$
|
|
3538
|
+
const cartographic = Cesium$d.Cartographic.fromCartesian(cartesian);
|
|
3382
3539
|
return [
|
|
3383
|
-
Cesium$
|
|
3384
|
-
Cesium$
|
|
3540
|
+
Cesium$d.Math.toDegrees(cartographic.longitude),
|
|
3541
|
+
Cesium$d.Math.toDegrees(cartographic.latitude),
|
|
3385
3542
|
cartographic.height
|
|
3386
3543
|
];
|
|
3387
3544
|
}
|
|
@@ -3392,8 +3549,8 @@ class BaseTool {
|
|
|
3392
3549
|
* @returns {Promise<number>} 地形高度
|
|
3393
3550
|
*/
|
|
3394
3551
|
async getTerrainHeight(lonLat) {
|
|
3395
|
-
const cartographic = Cesium$
|
|
3396
|
-
const result = await Cesium$
|
|
3552
|
+
const cartographic = Cesium$d.Cartographic.fromDegrees(lonLat[0], lonLat[1]);
|
|
3553
|
+
const result = await Cesium$d.sampleTerrainMostDetailed(
|
|
3397
3554
|
this._viewer.terrainProvider,
|
|
3398
3555
|
[cartographic]
|
|
3399
3556
|
);
|
|
@@ -3434,7 +3591,7 @@ class BaseTool {
|
|
|
3434
3591
|
}
|
|
3435
3592
|
}
|
|
3436
3593
|
|
|
3437
|
-
const Cesium$
|
|
3594
|
+
const Cesium$c = getCesium();
|
|
3438
3595
|
|
|
3439
3596
|
/**
|
|
3440
3597
|
* 绘制类型枚举
|
|
@@ -3721,7 +3878,7 @@ class DrawTool extends BaseTool {
|
|
|
3721
3878
|
const id = this.generateId('point');
|
|
3722
3879
|
this._graphicModule.CreatePoint(id)
|
|
3723
3880
|
.setPosition(lonLat)
|
|
3724
|
-
.setColor(Cesium$
|
|
3881
|
+
.setColor(Cesium$c.Color.RED)
|
|
3725
3882
|
.setPixelSize(10);
|
|
3726
3883
|
|
|
3727
3884
|
this._emitGraphicCreated('point', id);
|
|
@@ -3733,9 +3890,9 @@ class DrawTool extends BaseTool {
|
|
|
3733
3890
|
|
|
3734
3891
|
// 创建辅助点
|
|
3735
3892
|
const tempPoint = this.createTempEntity(this.generateId('temp_point'), {
|
|
3736
|
-
position: Cesium$
|
|
3893
|
+
position: Cesium$c.Cartesian3.fromDegrees(...lonLat),
|
|
3737
3894
|
point: {
|
|
3738
|
-
color: Cesium$
|
|
3895
|
+
color: Cesium$c.Color.YELLOW,
|
|
3739
3896
|
pixelSize: 8
|
|
3740
3897
|
}
|
|
3741
3898
|
});
|
|
@@ -3755,9 +3912,9 @@ class DrawTool extends BaseTool {
|
|
|
3755
3912
|
|
|
3756
3913
|
// 创建辅助点
|
|
3757
3914
|
const tempPoint = this.createTempEntity(this.generateId('temp_point'), {
|
|
3758
|
-
position: Cesium$
|
|
3915
|
+
position: Cesium$c.Cartesian3.fromDegrees(...lonLat),
|
|
3759
3916
|
point: {
|
|
3760
|
-
color: Cesium$
|
|
3917
|
+
color: Cesium$c.Color.YELLOW,
|
|
3761
3918
|
pixelSize: 8
|
|
3762
3919
|
}
|
|
3763
3920
|
});
|
|
@@ -3777,9 +3934,9 @@ class DrawTool extends BaseTool {
|
|
|
3777
3934
|
this._startPos = lonLat;
|
|
3778
3935
|
// 创建起始点标记
|
|
3779
3936
|
const startMarker = this.createTempEntity(this.generateId('temp_start'), {
|
|
3780
|
-
position: Cesium$
|
|
3937
|
+
position: Cesium$c.Cartesian3.fromDegrees(...lonLat),
|
|
3781
3938
|
point: {
|
|
3782
|
-
color: Cesium$
|
|
3939
|
+
color: Cesium$c.Color.YELLOW,
|
|
3783
3940
|
pixelSize: 10
|
|
3784
3941
|
}
|
|
3785
3942
|
});
|
|
@@ -3794,9 +3951,9 @@ class DrawTool extends BaseTool {
|
|
|
3794
3951
|
if (!this._startPos) {
|
|
3795
3952
|
this._startPos = lonLat;
|
|
3796
3953
|
const startMarker = this.createTempEntity(this.generateId('temp_start'), {
|
|
3797
|
-
position: Cesium$
|
|
3954
|
+
position: Cesium$c.Cartesian3.fromDegrees(...lonLat),
|
|
3798
3955
|
point: {
|
|
3799
|
-
color: Cesium$
|
|
3956
|
+
color: Cesium$c.Color.YELLOW,
|
|
3800
3957
|
pixelSize: 10
|
|
3801
3958
|
}
|
|
3802
3959
|
});
|
|
@@ -3818,14 +3975,14 @@ class DrawTool extends BaseTool {
|
|
|
3818
3975
|
for (const c of previewPositions) {
|
|
3819
3976
|
flatCoords.push(c[0], c[1], c[2] || 0);
|
|
3820
3977
|
}
|
|
3821
|
-
const cartesians = Cesium$
|
|
3978
|
+
const cartesians = Cesium$c.Cartesian3.fromDegreesArrayHeights(flatCoords);
|
|
3822
3979
|
|
|
3823
3980
|
if (!this._previewLine) {
|
|
3824
3981
|
// 首次创建预览线
|
|
3825
3982
|
this._previewLine = this.createTempEntity(this.generateId('temp_line'), {
|
|
3826
3983
|
polyline: {
|
|
3827
3984
|
positions: cartesians,
|
|
3828
|
-
material: Cesium$
|
|
3985
|
+
material: Cesium$c.Color.YELLOW,
|
|
3829
3986
|
width: 2
|
|
3830
3987
|
}
|
|
3831
3988
|
});
|
|
@@ -3833,7 +3990,7 @@ class DrawTool extends BaseTool {
|
|
|
3833
3990
|
} else {
|
|
3834
3991
|
// 直接更新位置属性,避免重建实体
|
|
3835
3992
|
// this._previewLine.polyline.positions = cartesians;
|
|
3836
|
-
this._previewLine.polyline.positions = new Cesium$
|
|
3993
|
+
this._previewLine.polyline.positions = new Cesium$c.CallbackProperty(() => {
|
|
3837
3994
|
return cartesians;
|
|
3838
3995
|
}, false);
|
|
3839
3996
|
}
|
|
@@ -3853,23 +4010,23 @@ class DrawTool extends BaseTool {
|
|
|
3853
4010
|
for (const c of previewPositions) {
|
|
3854
4011
|
flatCoords.push(c[0], c[1], c[2] || 0);
|
|
3855
4012
|
}
|
|
3856
|
-
const cartesians = Cesium$
|
|
4013
|
+
const cartesians = Cesium$c.Cartesian3.fromDegreesArrayHeights(flatCoords);
|
|
3857
4014
|
|
|
3858
4015
|
if (!this._previewPolygon) {
|
|
3859
4016
|
// 首次创建预览面
|
|
3860
4017
|
this._previewPolygon = this.createTempEntity(this.generateId('temp_polygon'), {
|
|
3861
4018
|
polygon: {
|
|
3862
|
-
hierarchy: new Cesium$
|
|
3863
|
-
material: Cesium$
|
|
4019
|
+
hierarchy: new Cesium$c.PolygonHierarchy(cartesians),
|
|
4020
|
+
material: Cesium$c.Color.YELLOW.withAlpha(0.5),
|
|
3864
4021
|
outline: false,
|
|
3865
|
-
outlineColor: Cesium$
|
|
4022
|
+
outlineColor: Cesium$c.Color.YELLOW,
|
|
3866
4023
|
}
|
|
3867
4024
|
});
|
|
3868
4025
|
this._tempEntities.push(this._previewPolygon);
|
|
3869
4026
|
} else {
|
|
3870
4027
|
// 直接更新层级,避免重建实体,使用 CallbackProperty 防止闪烁
|
|
3871
|
-
this._previewPolygon.polygon.hierarchy = new Cesium$
|
|
3872
|
-
return new Cesium$
|
|
4028
|
+
this._previewPolygon.polygon.hierarchy = new Cesium$c.CallbackProperty(() => {
|
|
4029
|
+
return new Cesium$c.PolygonHierarchy(cartesians);
|
|
3873
4030
|
}, false);
|
|
3874
4031
|
}
|
|
3875
4032
|
}
|
|
@@ -3901,18 +4058,18 @@ class DrawTool extends BaseTool {
|
|
|
3901
4058
|
for (const c of positions) {
|
|
3902
4059
|
flatCoords.push(c[0], c[1], 0);
|
|
3903
4060
|
}
|
|
3904
|
-
const cartesians = Cesium$
|
|
4061
|
+
const cartesians = Cesium$c.Cartesian3.fromDegreesArrayHeights(flatCoords);
|
|
3905
4062
|
|
|
3906
4063
|
if (!this._previewRect) {
|
|
3907
4064
|
this._previewRect = this.createTempEntity(this.generateId('temp_rect'), {
|
|
3908
4065
|
polyline: {
|
|
3909
|
-
positions: new Cesium$
|
|
3910
|
-
material: Cesium$
|
|
4066
|
+
positions: new Cesium$c.CallbackProperty(() => cartesians, false),
|
|
4067
|
+
material: Cesium$c.Color.YELLOW.withAlpha(0.7),
|
|
3911
4068
|
width: 2
|
|
3912
4069
|
},
|
|
3913
4070
|
polygon: {
|
|
3914
|
-
hierarchy: new Cesium$
|
|
3915
|
-
material: Cesium$
|
|
4071
|
+
hierarchy: new Cesium$c.CallbackProperty(() => new Cesium$c.PolygonHierarchy(cartesians), false),
|
|
4072
|
+
material: Cesium$c.Color.YELLOW.withAlpha(0.2),
|
|
3916
4073
|
outline: false
|
|
3917
4074
|
}
|
|
3918
4075
|
});
|
|
@@ -3920,7 +4077,7 @@ class DrawTool extends BaseTool {
|
|
|
3920
4077
|
this._tempEntities.push(this._previewRect);
|
|
3921
4078
|
} else {
|
|
3922
4079
|
// 直接更新位置属性
|
|
3923
|
-
this._previewRect.polyline.positions = new Cesium$
|
|
4080
|
+
this._previewRect.polyline.positions = new Cesium$c.CallbackProperty(() => {
|
|
3924
4081
|
const c1 = this._startPos;
|
|
3925
4082
|
const c2 = this._currentMousePos;
|
|
3926
4083
|
if (!c1 || !c2) return cartesians;
|
|
@@ -3935,12 +4092,12 @@ class DrawTool extends BaseTool {
|
|
|
3935
4092
|
for (const p of pos) {
|
|
3936
4093
|
flat.push(p[0], p[1], 0);
|
|
3937
4094
|
}
|
|
3938
|
-
return Cesium$
|
|
4095
|
+
return Cesium$c.Cartesian3.fromDegreesArrayHeights(flat);
|
|
3939
4096
|
}, false);
|
|
3940
|
-
this._previewRect.polygon.hierarchy = new Cesium$
|
|
4097
|
+
this._previewRect.polygon.hierarchy = new Cesium$c.CallbackProperty(() => {
|
|
3941
4098
|
const c1 = this._startPos;
|
|
3942
4099
|
const c2 = this._currentMousePos;
|
|
3943
|
-
if (!c1 || !c2) return new Cesium$
|
|
4100
|
+
if (!c1 || !c2) return new Cesium$c.PolygonHierarchy(cartesians);
|
|
3944
4101
|
const pos = [
|
|
3945
4102
|
[c1[0], c1[1]],
|
|
3946
4103
|
[c2[0], c1[1]],
|
|
@@ -3952,7 +4109,7 @@ class DrawTool extends BaseTool {
|
|
|
3952
4109
|
for (const p of pos) {
|
|
3953
4110
|
flat.push(p[0], p[1], 0);
|
|
3954
4111
|
}
|
|
3955
|
-
return new Cesium$
|
|
4112
|
+
return new Cesium$c.PolygonHierarchy(Cesium$c.Cartesian3.fromDegreesArrayHeights(flat));
|
|
3956
4113
|
}, false);
|
|
3957
4114
|
}
|
|
3958
4115
|
}
|
|
@@ -3965,12 +4122,12 @@ class DrawTool extends BaseTool {
|
|
|
3965
4122
|
if (!this._previewCircle) {
|
|
3966
4123
|
this._previewCircle = this.createTempEntity(this.generateId('temp_circle'), {
|
|
3967
4124
|
polygon: {
|
|
3968
|
-
hierarchy: new Cesium$
|
|
4125
|
+
hierarchy: new Cesium$c.CallbackProperty(() => {
|
|
3969
4126
|
const positions = this._generateCirclePositions(center, radius, segments);
|
|
3970
4127
|
const flat = positions.flatMap(c => [c[0], c[1], 0]);
|
|
3971
|
-
return new Cesium$
|
|
4128
|
+
return new Cesium$c.PolygonHierarchy(Cesium$c.Cartesian3.fromDegreesArrayHeights(flat));
|
|
3972
4129
|
}, false),
|
|
3973
|
-
material: Cesium$
|
|
4130
|
+
material: Cesium$c.Color.YELLOW.withAlpha(0.2),
|
|
3974
4131
|
outline: false // 地形贴合时不支持 outline,设为 false 避免警告
|
|
3975
4132
|
}
|
|
3976
4133
|
});
|
|
@@ -3978,11 +4135,11 @@ class DrawTool extends BaseTool {
|
|
|
3978
4135
|
this._tempEntities.push(this._previewCircle);
|
|
3979
4136
|
} else {
|
|
3980
4137
|
// 直接更新
|
|
3981
|
-
this._previewCircle.polygon.hierarchy = new Cesium$
|
|
4138
|
+
this._previewCircle.polygon.hierarchy = new Cesium$c.CallbackProperty(() => {
|
|
3982
4139
|
const r = this._calcDistance(this._startPos, this._currentMousePos);
|
|
3983
4140
|
const pos = this._generateCirclePositions(this._startPos, r, 64);
|
|
3984
4141
|
const flat = pos.flatMap(c => [c[0], c[1], 0]);
|
|
3985
|
-
return new Cesium$
|
|
4142
|
+
return new Cesium$c.PolygonHierarchy(Cesium$c.Cartesian3.fromDegreesArrayHeights(flat));
|
|
3986
4143
|
}, false);
|
|
3987
4144
|
}
|
|
3988
4145
|
}
|
|
@@ -3999,10 +4156,10 @@ class DrawTool extends BaseTool {
|
|
|
3999
4156
|
const id = this.generateId('rectangle');
|
|
4000
4157
|
this._graphicModule.CreatePolygon(id)
|
|
4001
4158
|
.setPositions(positions)
|
|
4002
|
-
.setColor(Cesium$
|
|
4003
|
-
.setOutlineColor(Cesium$
|
|
4159
|
+
.setColor(Cesium$c.Color.BLUE.withAlpha(0.5))
|
|
4160
|
+
.setOutlineColor(Cesium$c.Color.BLUE)
|
|
4004
4161
|
.setOutlineWidth(2)
|
|
4005
|
-
.setHeightReference(Cesium$
|
|
4162
|
+
.setHeightReference(Cesium$c.HeightReference.NONE);
|
|
4006
4163
|
|
|
4007
4164
|
this.clearTempEntities();
|
|
4008
4165
|
this._startPos = null;
|
|
@@ -4020,8 +4177,8 @@ class DrawTool extends BaseTool {
|
|
|
4020
4177
|
// 创建圆并标记为圆形
|
|
4021
4178
|
const wrapper = this._graphicModule.CreatePolygon(id);
|
|
4022
4179
|
wrapper.setPositions(positions)
|
|
4023
|
-
.setColor(Cesium$
|
|
4024
|
-
.setOutlineColor(Cesium$
|
|
4180
|
+
.setColor(Cesium$c.Color.BLUE.withAlpha(0.5))
|
|
4181
|
+
.setOutlineColor(Cesium$c.Color.BLUE)
|
|
4025
4182
|
.setOutlineWidth(2);
|
|
4026
4183
|
|
|
4027
4184
|
// 给 entity 添加圆形标记(用于 EditTool 特殊处理)
|
|
@@ -4118,9 +4275,9 @@ class DrawTool extends BaseTool {
|
|
|
4118
4275
|
|
|
4119
4276
|
// 创建辅助点
|
|
4120
4277
|
const tempPoint = this.createTempEntity(this.generateId('temp_point'), {
|
|
4121
|
-
position: Cesium$
|
|
4278
|
+
position: Cesium$c.Cartesian3.fromDegrees(...lngLat),
|
|
4122
4279
|
point: {
|
|
4123
|
-
color: Cesium$
|
|
4280
|
+
color: Cesium$c.Color.YELLOW,
|
|
4124
4281
|
pixelSize: 8
|
|
4125
4282
|
}
|
|
4126
4283
|
});
|
|
@@ -4175,14 +4332,14 @@ class DrawTool extends BaseTool {
|
|
|
4175
4332
|
for (const c of positions) {
|
|
4176
4333
|
flatCoords.push(c[0], c[1], c[2] || 0);
|
|
4177
4334
|
}
|
|
4178
|
-
const cartesians = Cesium$
|
|
4335
|
+
const cartesians = Cesium$c.Cartesian3.fromDegreesArrayHeights(flatCoords);
|
|
4179
4336
|
|
|
4180
4337
|
if (!this._previewPlot) {
|
|
4181
4338
|
if (isLine) {
|
|
4182
4339
|
this._previewPlot = this.createTempEntity(this.generateId('temp_plot'), {
|
|
4183
4340
|
polyline: {
|
|
4184
|
-
positions: new Cesium$
|
|
4185
|
-
material: Cesium$
|
|
4341
|
+
positions: new Cesium$c.CallbackProperty(() => cartesians, false),
|
|
4342
|
+
material: Cesium$c.Color.YELLOW,
|
|
4186
4343
|
width: 2,
|
|
4187
4344
|
clampToGround: true
|
|
4188
4345
|
}
|
|
@@ -4190,13 +4347,13 @@ class DrawTool extends BaseTool {
|
|
|
4190
4347
|
} else {
|
|
4191
4348
|
this._previewPlot = this.createTempEntity(this.generateId('temp_plot'), {
|
|
4192
4349
|
polygon: {
|
|
4193
|
-
hierarchy: new Cesium$
|
|
4194
|
-
material: Cesium$
|
|
4350
|
+
hierarchy: new Cesium$c.CallbackProperty(() => new Cesium$c.PolygonHierarchy(cartesians), false),
|
|
4351
|
+
material: Cesium$c.Color.YELLOW.withAlpha(0.3),
|
|
4195
4352
|
outline: false
|
|
4196
4353
|
},
|
|
4197
4354
|
polyline: {
|
|
4198
|
-
positions: new Cesium$
|
|
4199
|
-
material: Cesium$
|
|
4355
|
+
positions: new Cesium$c.CallbackProperty(() => [...cartesians, cartesians[0]], false),
|
|
4356
|
+
material: Cesium$c.Color.YELLOW,
|
|
4200
4357
|
width: 1
|
|
4201
4358
|
}
|
|
4202
4359
|
});
|
|
@@ -4206,7 +4363,7 @@ class DrawTool extends BaseTool {
|
|
|
4206
4363
|
} else {
|
|
4207
4364
|
const self = this;
|
|
4208
4365
|
if (isLine) {
|
|
4209
|
-
this._previewPlot.polyline.positions = new Cesium$
|
|
4366
|
+
this._previewPlot.polyline.positions = new Cesium$c.CallbackProperty(() => {
|
|
4210
4367
|
const dynamicPositions = [...self._tempPositions];
|
|
4211
4368
|
if (self._currentMousePos) {
|
|
4212
4369
|
dynamicPositions.push(self._currentMousePos);
|
|
@@ -4217,23 +4374,23 @@ class DrawTool extends BaseTool {
|
|
|
4217
4374
|
for (const c of pos) {
|
|
4218
4375
|
flat.push(c[0], c[1], c[2] || 0);
|
|
4219
4376
|
}
|
|
4220
|
-
return Cesium$
|
|
4377
|
+
return Cesium$c.Cartesian3.fromDegreesArrayHeights(flat);
|
|
4221
4378
|
}, false);
|
|
4222
4379
|
} else {
|
|
4223
|
-
this._previewPlot.polygon.hierarchy = new Cesium$
|
|
4380
|
+
this._previewPlot.polygon.hierarchy = new Cesium$c.CallbackProperty(() => {
|
|
4224
4381
|
const dynamicPositions = [...self._tempPositions];
|
|
4225
4382
|
if (self._currentMousePos) {
|
|
4226
4383
|
dynamicPositions.push(self._currentMousePos);
|
|
4227
4384
|
}
|
|
4228
|
-
if (dynamicPositions.length < config.minPoints) return new Cesium$
|
|
4385
|
+
if (dynamicPositions.length < config.minPoints) return new Cesium$c.PolygonHierarchy([]);
|
|
4229
4386
|
const pos = PlotGeometryUtil[factoryName](normalizeForEllipse(dynamicPositions));
|
|
4230
4387
|
const flat = [];
|
|
4231
4388
|
for (const c of pos) {
|
|
4232
4389
|
flat.push(c[0], c[1], c[2] || 0);
|
|
4233
4390
|
}
|
|
4234
|
-
return new Cesium$
|
|
4391
|
+
return new Cesium$c.PolygonHierarchy(Cesium$c.Cartesian3.fromDegreesArrayHeights(flat));
|
|
4235
4392
|
}, false);
|
|
4236
|
-
this._previewPlot.polyline.positions = new Cesium$
|
|
4393
|
+
this._previewPlot.polyline.positions = new Cesium$c.CallbackProperty(() => {
|
|
4237
4394
|
const dynamicPositions = [...self._tempPositions];
|
|
4238
4395
|
if (self._currentMousePos) {
|
|
4239
4396
|
dynamicPositions.push(self._currentMousePos);
|
|
@@ -4244,7 +4401,7 @@ class DrawTool extends BaseTool {
|
|
|
4244
4401
|
for (const c of pos) {
|
|
4245
4402
|
flat.push(c[0], c[1], c[2] || 0);
|
|
4246
4403
|
}
|
|
4247
|
-
const cart = Cesium$
|
|
4404
|
+
const cart = Cesium$c.Cartesian3.fromDegreesArrayHeights(flat);
|
|
4248
4405
|
return [...cart, cart[0]];
|
|
4249
4406
|
}, false);
|
|
4250
4407
|
}
|
|
@@ -4281,11 +4438,11 @@ class DrawTool extends BaseTool {
|
|
|
4281
4438
|
|
|
4282
4439
|
// 应用默认样式
|
|
4283
4440
|
if (isLine) {
|
|
4284
|
-
wrapper.setColor(Cesium$
|
|
4441
|
+
wrapper.setColor(Cesium$c.Color.BLUE).setWidth(2);
|
|
4285
4442
|
} else {
|
|
4286
4443
|
wrapper
|
|
4287
|
-
.setColor(Cesium$
|
|
4288
|
-
.setOutlineColor(Cesium$
|
|
4444
|
+
.setColor(Cesium$c.Color.BLUE.withAlpha(0.5))
|
|
4445
|
+
.setOutlineColor(Cesium$c.Color.BLUE)
|
|
4289
4446
|
.setOutlineWidth(2);
|
|
4290
4447
|
}
|
|
4291
4448
|
|
|
@@ -4338,7 +4495,7 @@ class DrawTool extends BaseTool {
|
|
|
4338
4495
|
const id = this.generateId('line');
|
|
4339
4496
|
this._graphicModule.CreateLine(id)
|
|
4340
4497
|
.setPositions(this._tempPositions)
|
|
4341
|
-
.setColor(Cesium$
|
|
4498
|
+
.setColor(Cesium$c.Color.BLUE)
|
|
4342
4499
|
.setWidth(2);
|
|
4343
4500
|
|
|
4344
4501
|
this._emitGraphicCreated('line', id);
|
|
@@ -4347,8 +4504,8 @@ class DrawTool extends BaseTool {
|
|
|
4347
4504
|
const id = this.generateId('polygon');
|
|
4348
4505
|
this._graphicModule.CreatePolygon(id)
|
|
4349
4506
|
.setPositions(positions)
|
|
4350
|
-
.setColor(Cesium$
|
|
4351
|
-
.setOutlineColor(Cesium$
|
|
4507
|
+
.setColor(Cesium$c.Color.BLUE.withAlpha(0.5))
|
|
4508
|
+
.setOutlineColor(Cesium$c.Color.BLUE);
|
|
4352
4509
|
|
|
4353
4510
|
this._emitGraphicCreated('polygon', id);
|
|
4354
4511
|
}
|
|
@@ -4358,9 +4515,9 @@ class DrawTool extends BaseTool {
|
|
|
4358
4515
|
let deferredPreviewLine = null;
|
|
4359
4516
|
if (this._drawType === DrawType.LINE && this._previewLine) {
|
|
4360
4517
|
const previewLine = this._previewLine;
|
|
4361
|
-
previewLine.polyline.material = Cesium$
|
|
4518
|
+
previewLine.polyline.material = Cesium$c.Color.BLUE;
|
|
4362
4519
|
previewLine.polyline.width = 2;
|
|
4363
|
-
previewLine.polyline.positions = Cesium$
|
|
4520
|
+
previewLine.polyline.positions = Cesium$c.Cartesian3.fromDegreesArrayHeights(
|
|
4364
4521
|
this._tempPositions.flatMap((coord) => [coord[0], coord[1], coord[2] || 0])
|
|
4365
4522
|
);
|
|
4366
4523
|
|
|
@@ -4416,7 +4573,7 @@ class DrawTool extends BaseTool {
|
|
|
4416
4573
|
}
|
|
4417
4574
|
}
|
|
4418
4575
|
|
|
4419
|
-
const Cesium$
|
|
4576
|
+
const Cesium$b = getCesium();
|
|
4420
4577
|
|
|
4421
4578
|
/**
|
|
4422
4579
|
* 编辑模式枚举
|
|
@@ -4501,7 +4658,7 @@ class EditTool extends BaseTool {
|
|
|
4501
4658
|
const picked = this._viewer.scene.pick(screenPos);
|
|
4502
4659
|
console.log('EditTool _onClick:', { picked, screenPos });
|
|
4503
4660
|
|
|
4504
|
-
if (Cesium$
|
|
4661
|
+
if (Cesium$b.defined(picked) && Cesium$b.defined(picked.id)) {
|
|
4505
4662
|
const entityId = picked.id.id;
|
|
4506
4663
|
console.log('EditTool picked entity:', entityId);
|
|
4507
4664
|
|
|
@@ -4537,7 +4694,7 @@ class EditTool extends BaseTool {
|
|
|
4537
4694
|
// 如果已经选中了图元,检查是否点击了控制点
|
|
4538
4695
|
if (this._selectedEntity && !this._isDragging) {
|
|
4539
4696
|
const picked = this._viewer.scene.pick(screenPos);
|
|
4540
|
-
if (Cesium$
|
|
4697
|
+
if (Cesium$b.defined(picked) && Cesium$b.defined(picked.id)) {
|
|
4541
4698
|
const entityId = picked.id.id;
|
|
4542
4699
|
if (entityId && (entityId.startsWith('__edit_handle_') || entityId.includes('__edit_handle_'))) {
|
|
4543
4700
|
// 直接在 _editHandles 中查找被点击的控制点
|
|
@@ -4590,7 +4747,7 @@ class EditTool extends BaseTool {
|
|
|
4590
4747
|
|
|
4591
4748
|
// 检测是否悬停在控制点上
|
|
4592
4749
|
const picked = this._viewer.scene.pick(screenPos);
|
|
4593
|
-
const isOverHandle = Cesium$
|
|
4750
|
+
const isOverHandle = Cesium$b.defined(picked) && Cesium$b.defined(picked.id) &&
|
|
4594
4751
|
picked.id.id && picked.id.id.startsWith('__edit_handle_');
|
|
4595
4752
|
this._setCursorStyle(isOverHandle ? 'move' : 'default');
|
|
4596
4753
|
}
|
|
@@ -4601,14 +4758,14 @@ class EditTool extends BaseTool {
|
|
|
4601
4758
|
// 拖拽时优先使用椭球面拾取,避免拾取到控制点句柄本身导致图元跟随滞后
|
|
4602
4759
|
let lonLat = null;
|
|
4603
4760
|
const cartesian = this._viewer.camera.pickEllipsoid(
|
|
4604
|
-
new Cesium$
|
|
4761
|
+
new Cesium$b.Cartesian2(screenPos.x, screenPos.y),
|
|
4605
4762
|
this._viewer.scene.globe.ellipsoid
|
|
4606
4763
|
);
|
|
4607
4764
|
if (cartesian) {
|
|
4608
|
-
const c = Cesium$
|
|
4765
|
+
const c = Cesium$b.Cartographic.fromCartesian(cartesian);
|
|
4609
4766
|
lonLat = [
|
|
4610
|
-
Cesium$
|
|
4611
|
-
Cesium$
|
|
4767
|
+
Cesium$b.Math.toDegrees(c.longitude),
|
|
4768
|
+
Cesium$b.Math.toDegrees(c.latitude),
|
|
4612
4769
|
c.height || 0
|
|
4613
4770
|
];
|
|
4614
4771
|
} else {
|
|
@@ -4632,16 +4789,16 @@ class EditTool extends BaseTool {
|
|
|
4632
4789
|
const deltaZ = newAnchorCartesian.z - oldAnchorCartesian.z;
|
|
4633
4790
|
|
|
4634
4791
|
const controlPoints = this._selectedEntity._controlPoints.map(cp => {
|
|
4635
|
-
const cpCart = Cesium$
|
|
4636
|
-
const newCpCart = new Cesium$
|
|
4792
|
+
const cpCart = Cesium$b.Cartesian3.fromDegrees(cp[0], cp[1], cp[2] || 0);
|
|
4793
|
+
const newCpCart = new Cesium$b.Cartesian3(
|
|
4637
4794
|
cpCart.x + deltaX,
|
|
4638
4795
|
cpCart.y + deltaY,
|
|
4639
4796
|
cpCart.z + deltaZ
|
|
4640
4797
|
);
|
|
4641
|
-
const newCpCarto = Cesium$
|
|
4798
|
+
const newCpCarto = Cesium$b.Cartographic.fromCartesian(newCpCart);
|
|
4642
4799
|
return [
|
|
4643
|
-
Cesium$
|
|
4644
|
-
Cesium$
|
|
4800
|
+
Cesium$b.Math.toDegrees(newCpCarto.longitude),
|
|
4801
|
+
Cesium$b.Math.toDegrees(newCpCarto.latitude),
|
|
4645
4802
|
newCpCarto.height || 0
|
|
4646
4803
|
];
|
|
4647
4804
|
});
|
|
@@ -4662,8 +4819,8 @@ class EditTool extends BaseTool {
|
|
|
4662
4819
|
const center = (plotType === PlotGraphicType.SECTOR || plotType === PlotGraphicType.ELLIPSE)
|
|
4663
4820
|
? controlPoints[0]
|
|
4664
4821
|
: this._getPlotControlPointsCenter(controlPoints);
|
|
4665
|
-
handle.position = new Cesium$
|
|
4666
|
-
this._clampPositionToGround(Cesium$
|
|
4822
|
+
handle.position = new Cesium$b.ConstantPositionProperty(
|
|
4823
|
+
this._clampPositionToGround(Cesium$b.Cartesian3.fromDegrees(center[0], center[1], center[2] || 0))
|
|
4667
4824
|
);
|
|
4668
4825
|
return;
|
|
4669
4826
|
}
|
|
@@ -4672,8 +4829,8 @@ class EditTool extends BaseTool {
|
|
|
4672
4829
|
if (match) {
|
|
4673
4830
|
const cpIndex = parseInt(match[1], 10);
|
|
4674
4831
|
const cp = controlPoints[cpIndex];
|
|
4675
|
-
handle.position = new Cesium$
|
|
4676
|
-
this._clampPositionToGround(Cesium$
|
|
4832
|
+
handle.position = new Cesium$b.ConstantPositionProperty(
|
|
4833
|
+
this._clampPositionToGround(Cesium$b.Cartesian3.fromDegrees(cp[0], cp[1], cp[2] || 0))
|
|
4677
4834
|
);
|
|
4678
4835
|
}
|
|
4679
4836
|
});
|
|
@@ -4741,10 +4898,10 @@ class EditTool extends BaseTool {
|
|
|
4741
4898
|
*/
|
|
4742
4899
|
_clampPositionToGround(position) {
|
|
4743
4900
|
if (!position) return position;
|
|
4744
|
-
const cartographic = Cesium$
|
|
4745
|
-
return Cesium$
|
|
4746
|
-
Cesium$
|
|
4747
|
-
Cesium$
|
|
4901
|
+
const cartographic = Cesium$b.Cartographic.fromCartesian(position);
|
|
4902
|
+
return Cesium$b.Cartesian3.fromDegrees(
|
|
4903
|
+
Cesium$b.Math.toDegrees(cartographic.longitude),
|
|
4904
|
+
Cesium$b.Math.toDegrees(cartographic.latitude),
|
|
4748
4905
|
0
|
|
4749
4906
|
);
|
|
4750
4907
|
}
|
|
@@ -4766,17 +4923,17 @@ class EditTool extends BaseTool {
|
|
|
4766
4923
|
if ((isSector || isEllipse) && index === 0) return; // 扇形/椭圆圆心/中心由中心控制点处理
|
|
4767
4924
|
|
|
4768
4925
|
const clampedPos = this._clampPositionToGround(
|
|
4769
|
-
Cesium$
|
|
4926
|
+
Cesium$b.Cartesian3.fromDegrees(cp[0], cp[1], cp[2] || 0)
|
|
4770
4927
|
);
|
|
4771
4928
|
const handle = this.createTempEntity(`__edit_handle_${index}`, {
|
|
4772
4929
|
position: clampedPos,
|
|
4773
4930
|
point: {
|
|
4774
|
-
color: Cesium$
|
|
4931
|
+
color: Cesium$b.Color.YELLOW,
|
|
4775
4932
|
pixelSize: 12,
|
|
4776
|
-
outlineColor: Cesium$
|
|
4933
|
+
outlineColor: Cesium$b.Color.RED,
|
|
4777
4934
|
outlineWidth: 2,
|
|
4778
4935
|
disableDepthTestDistance: Number.POSITIVE_INFINITY,
|
|
4779
|
-
heightReference: Cesium$
|
|
4936
|
+
heightReference: Cesium$b.HeightReference.CLAMP_TO_GROUND
|
|
4780
4937
|
}
|
|
4781
4938
|
});
|
|
4782
4939
|
this._editHandles.push(handle);
|
|
@@ -4813,18 +4970,18 @@ class EditTool extends BaseTool {
|
|
|
4813
4970
|
if (!center) return;
|
|
4814
4971
|
|
|
4815
4972
|
this._originalEntityCenter = this._clampPositionToGround(
|
|
4816
|
-
Cesium$
|
|
4973
|
+
Cesium$b.Cartesian3.fromDegrees(center[0], center[1], center[2] || 0)
|
|
4817
4974
|
);
|
|
4818
4975
|
|
|
4819
4976
|
const handle = this.createTempEntity('__edit_handle_center_plot', {
|
|
4820
4977
|
position: this._originalEntityCenter,
|
|
4821
4978
|
point: {
|
|
4822
|
-
color: Cesium$
|
|
4979
|
+
color: Cesium$b.Color.CYAN,
|
|
4823
4980
|
pixelSize: 14,
|
|
4824
|
-
outlineColor: Cesium$
|
|
4981
|
+
outlineColor: Cesium$b.Color.BLUE,
|
|
4825
4982
|
outlineWidth: 2,
|
|
4826
4983
|
disableDepthTestDistance: Number.POSITIVE_INFINITY,
|
|
4827
|
-
heightReference: Cesium$
|
|
4984
|
+
heightReference: Cesium$b.HeightReference.CLAMP_TO_GROUND
|
|
4828
4985
|
}
|
|
4829
4986
|
});
|
|
4830
4987
|
this._editHandles.push(handle);
|
|
@@ -4852,7 +5009,7 @@ class EditTool extends BaseTool {
|
|
|
4852
5009
|
_createPlotPositionOutline() {
|
|
4853
5010
|
const self = this;
|
|
4854
5011
|
const entity = this._selectedEntity;
|
|
4855
|
-
const isLine = Cesium$
|
|
5012
|
+
const isLine = Cesium$b.defined(entity.polyline);
|
|
4856
5013
|
|
|
4857
5014
|
// 以下标绘图元的控制点连线会干扰真实几何,不绘制轮廓辅助线
|
|
4858
5015
|
const skipOutlineTypes = new Set([
|
|
@@ -4869,7 +5026,7 @@ class EditTool extends BaseTool {
|
|
|
4869
5026
|
|
|
4870
5027
|
this._positionOutline = this.createTempEntity(this.generateId('temp_plot_outline'), {
|
|
4871
5028
|
polyline: {
|
|
4872
|
-
positions: new Cesium$
|
|
5029
|
+
positions: new Cesium$b.CallbackProperty(function () {
|
|
4873
5030
|
const handles = self._editHandles;
|
|
4874
5031
|
if (!handles || handles.length === 0) return [];
|
|
4875
5032
|
|
|
@@ -4884,7 +5041,7 @@ class EditTool extends BaseTool {
|
|
|
4884
5041
|
let positions = null;
|
|
4885
5042
|
if (hierarchy) {
|
|
4886
5043
|
if (typeof hierarchy.getValue === 'function') {
|
|
4887
|
-
const value = hierarchy.getValue(Cesium$
|
|
5044
|
+
const value = hierarchy.getValue(Cesium$b.JulianDate.now());
|
|
4888
5045
|
positions = value ? value.positions : null;
|
|
4889
5046
|
} else if (hierarchy.positions) {
|
|
4890
5047
|
positions = hierarchy.positions;
|
|
@@ -4904,24 +5061,24 @@ class EditTool extends BaseTool {
|
|
|
4904
5061
|
// 跳过中心平移控制点
|
|
4905
5062
|
if (handle.id && handle.id.includes('center')) return;
|
|
4906
5063
|
|
|
4907
|
-
const pos = handle.position.getValue(Cesium$
|
|
5064
|
+
const pos = handle.position.getValue(Cesium$b.JulianDate.now());
|
|
4908
5065
|
if (pos) {
|
|
4909
|
-
const c = Cesium$
|
|
4910
|
-
degrees.push(Cesium$
|
|
4911
|
-
degrees.push(Cesium$
|
|
5066
|
+
const c = Cesium$b.Cartographic.fromCartesian(pos);
|
|
5067
|
+
degrees.push(Cesium$b.Math.toDegrees(c.longitude));
|
|
5068
|
+
degrees.push(Cesium$b.Math.toDegrees(c.latitude));
|
|
4912
5069
|
degrees.push(c.height || 0);
|
|
4913
5070
|
}
|
|
4914
5071
|
});
|
|
4915
5072
|
|
|
4916
5073
|
if (degrees.length === 0) return [];
|
|
4917
5074
|
|
|
4918
|
-
const cartesians = Cesium$
|
|
5075
|
+
const cartesians = Cesium$b.Cartesian3.fromDegreesArrayHeights(degrees);
|
|
4919
5076
|
if (isLine) {
|
|
4920
5077
|
return cartesians;
|
|
4921
5078
|
}
|
|
4922
5079
|
return [...cartesians, cartesians[0]];
|
|
4923
5080
|
}, false),
|
|
4924
|
-
material: Cesium$
|
|
5081
|
+
material: Cesium$b.Color.YELLOW,
|
|
4925
5082
|
width: 2,
|
|
4926
5083
|
clampToGround: true
|
|
4927
5084
|
}
|
|
@@ -4937,17 +5094,17 @@ class EditTool extends BaseTool {
|
|
|
4937
5094
|
const self = this;
|
|
4938
5095
|
const axisLine = this.createTempEntity(this.generateId('temp_ellipse_axis'), {
|
|
4939
5096
|
polyline: {
|
|
4940
|
-
positions: new Cesium$
|
|
5097
|
+
positions: new Cesium$b.CallbackProperty(function () {
|
|
4941
5098
|
const entity = self._selectedEntity;
|
|
4942
5099
|
const cps = entity?._controlPoints;
|
|
4943
5100
|
if (!cps || cps.length < 3) return [];
|
|
4944
5101
|
|
|
4945
|
-
const center = Cesium$
|
|
4946
|
-
const major = Cesium$
|
|
4947
|
-
const minor = Cesium$
|
|
5102
|
+
const center = Cesium$b.Cartesian3.fromDegrees(cps[0][0], cps[0][1], cps[0][2] || 0);
|
|
5103
|
+
const major = Cesium$b.Cartesian3.fromDegrees(cps[1][0], cps[1][1], cps[1][2] || 0);
|
|
5104
|
+
const minor = Cesium$b.Cartesian3.fromDegrees(cps[2][0], cps[2][1], cps[2][2] || 0);
|
|
4948
5105
|
return [center, major, center, minor];
|
|
4949
5106
|
}, false),
|
|
4950
|
-
material: Cesium$
|
|
5107
|
+
material: Cesium$b.Color.YELLOW,
|
|
4951
5108
|
width: 2,
|
|
4952
5109
|
clampToGround: true
|
|
4953
5110
|
}
|
|
@@ -4962,7 +5119,7 @@ class EditTool extends BaseTool {
|
|
|
4962
5119
|
*/
|
|
4963
5120
|
_createVertexHandles(positions) {
|
|
4964
5121
|
// 判断是否是矩形(4个顶点形成矩形)
|
|
4965
|
-
const isRectangle = Cesium$
|
|
5122
|
+
const isRectangle = Cesium$b.defined(this._selectedEntity.polygon) && positions.length === 4 &&
|
|
4966
5123
|
this._isRectangle(positions);
|
|
4967
5124
|
|
|
4968
5125
|
if (isRectangle) {
|
|
@@ -4976,12 +5133,12 @@ class EditTool extends BaseTool {
|
|
|
4976
5133
|
const handle = this.createTempEntity(`__edit_handle_${handleIdx}`, {
|
|
4977
5134
|
position: clampedPos,
|
|
4978
5135
|
point: {
|
|
4979
|
-
color: Cesium$
|
|
5136
|
+
color: Cesium$b.Color.YELLOW,
|
|
4980
5137
|
pixelSize: 12,
|
|
4981
|
-
outlineColor: Cesium$
|
|
5138
|
+
outlineColor: Cesium$b.Color.RED,
|
|
4982
5139
|
outlineWidth: 2,
|
|
4983
5140
|
disableDepthTestDistance: Number.POSITIVE_INFINITY,
|
|
4984
|
-
heightReference: Cesium$
|
|
5141
|
+
heightReference: Cesium$b.HeightReference.CLAMP_TO_GROUND,
|
|
4985
5142
|
}
|
|
4986
5143
|
});
|
|
4987
5144
|
this._editHandles.push(handle);
|
|
@@ -4994,20 +5151,20 @@ class EditTool extends BaseTool {
|
|
|
4994
5151
|
|
|
4995
5152
|
const { center, radius } = circleInfo;
|
|
4996
5153
|
// 修复:圆心位置贴地
|
|
4997
|
-
const centerCartesian = Cesium$
|
|
5154
|
+
const centerCartesian = Cesium$b.Cartesian3.fromDegrees(center[0], center[1], 0);
|
|
4998
5155
|
const radiusPoint = this._getPointOnCircle(center, radius, 0);
|
|
4999
|
-
const radiusCartesian = Cesium$
|
|
5156
|
+
const radiusCartesian = Cesium$b.Cartesian3.fromDegrees(radiusPoint[0], radiusPoint[1], 0);
|
|
5000
5157
|
|
|
5001
5158
|
// 圆心控制点(可平移)- 使用与其他类型不同的ID格式
|
|
5002
5159
|
const centerHandle = this.createTempEntity('__edit_handle_center', {
|
|
5003
5160
|
position: centerCartesian,
|
|
5004
5161
|
point: {
|
|
5005
|
-
color: Cesium$
|
|
5162
|
+
color: Cesium$b.Color.CYAN,
|
|
5006
5163
|
pixelSize: 14,
|
|
5007
|
-
outlineColor: Cesium$
|
|
5164
|
+
outlineColor: Cesium$b.Color.BLUE,
|
|
5008
5165
|
outlineWidth: 2,
|
|
5009
5166
|
disableDepthTestDistance: Number.POSITIVE_INFINITY,
|
|
5010
|
-
heightReference: Cesium$
|
|
5167
|
+
heightReference: Cesium$b.HeightReference.CLAMP_TO_GROUND
|
|
5011
5168
|
}
|
|
5012
5169
|
});
|
|
5013
5170
|
this._editHandles.push(centerHandle);
|
|
@@ -5016,12 +5173,12 @@ class EditTool extends BaseTool {
|
|
|
5016
5173
|
const radiusHandle = this.createTempEntity('__edit_handle_radius', {
|
|
5017
5174
|
position: radiusCartesian,
|
|
5018
5175
|
point: {
|
|
5019
|
-
color: Cesium$
|
|
5176
|
+
color: Cesium$b.Color.RED,
|
|
5020
5177
|
pixelSize: 12,
|
|
5021
|
-
outlineColor: Cesium$
|
|
5178
|
+
outlineColor: Cesium$b.Color.YELLOW,
|
|
5022
5179
|
outlineWidth: 2,
|
|
5023
5180
|
disableDepthTestDistance: Number.POSITIVE_INFINITY,
|
|
5024
|
-
heightReference: Cesium$
|
|
5181
|
+
heightReference: Cesium$b.HeightReference.CLAMP_TO_GROUND
|
|
5025
5182
|
}
|
|
5026
5183
|
});
|
|
5027
5184
|
this._editHandles.push(radiusHandle);
|
|
@@ -5041,9 +5198,9 @@ class EditTool extends BaseTool {
|
|
|
5041
5198
|
const handle = this.createTempEntity(`__edit_handle_${index}`, {
|
|
5042
5199
|
position: clampedPos,
|
|
5043
5200
|
point: {
|
|
5044
|
-
color: Cesium$
|
|
5201
|
+
color: Cesium$b.Color.YELLOW,
|
|
5045
5202
|
pixelSize: 12,
|
|
5046
|
-
outlineColor: Cesium$
|
|
5203
|
+
outlineColor: Cesium$b.Color.RED,
|
|
5047
5204
|
outlineWidth: 2,
|
|
5048
5205
|
disableDepthTestDistance: Number.POSITIVE_INFINITY,
|
|
5049
5206
|
// heightReference: Cesium.HeightReference.CLAMP_TO_GROUND,
|
|
@@ -5083,12 +5240,12 @@ class EditTool extends BaseTool {
|
|
|
5083
5240
|
const handle = this.createTempEntity('__edit_handle_center_vertex', {
|
|
5084
5241
|
position: clampedCenter,
|
|
5085
5242
|
point: {
|
|
5086
|
-
color: Cesium$
|
|
5243
|
+
color: Cesium$b.Color.CYAN,
|
|
5087
5244
|
pixelSize: 14,
|
|
5088
|
-
outlineColor: Cesium$
|
|
5245
|
+
outlineColor: Cesium$b.Color.BLUE,
|
|
5089
5246
|
outlineWidth: 2,
|
|
5090
5247
|
disableDepthTestDistance: Number.POSITIVE_INFINITY,
|
|
5091
|
-
heightReference: Cesium$
|
|
5248
|
+
heightReference: Cesium$b.HeightReference.CLAMP_TO_GROUND
|
|
5092
5249
|
}
|
|
5093
5250
|
});
|
|
5094
5251
|
this._editHandles.push(handle);
|
|
@@ -5112,7 +5269,7 @@ class EditTool extends BaseTool {
|
|
|
5112
5269
|
const clampedCenter = this._clampPositionToGround(newCenter);
|
|
5113
5270
|
|
|
5114
5271
|
// 更新中心控制点位置
|
|
5115
|
-
centerHandle.position = new Cesium$
|
|
5272
|
+
centerHandle.position = new Cesium$b.ConstantPositionProperty(clampedCenter);
|
|
5116
5273
|
// 更新原始中心点缓存(用于下次平移计算)
|
|
5117
5274
|
this._originalEntityCenter = clampedCenter;
|
|
5118
5275
|
}
|
|
@@ -5120,11 +5277,11 @@ class EditTool extends BaseTool {
|
|
|
5120
5277
|
_createPositionOutline() {
|
|
5121
5278
|
// 从控制点获取位置,性能更好(避免每次从实体重新获取和转换)
|
|
5122
5279
|
const self = this;
|
|
5123
|
-
const isPolyline = Cesium$
|
|
5280
|
+
const isPolyline = Cesium$b.defined(this._selectedEntity.polyline);
|
|
5124
5281
|
|
|
5125
5282
|
this._positionOutline = this.createTempEntity(this.generateId('temp_outline'), {
|
|
5126
5283
|
polyline: {
|
|
5127
|
-
positions: new Cesium$
|
|
5284
|
+
positions: new Cesium$b.CallbackProperty(function () {
|
|
5128
5285
|
// 从控制点获取位置(已被更新),排除中心控制点
|
|
5129
5286
|
const handles = self._editHandles;
|
|
5130
5287
|
if (!handles || handles.length === 0) return [];
|
|
@@ -5135,11 +5292,11 @@ class EditTool extends BaseTool {
|
|
|
5135
5292
|
// 跳过所有中心控制点(用于平移)- 修复:统一使用 includes('center')
|
|
5136
5293
|
if (handle.id && handle.id.includes('center')) return;
|
|
5137
5294
|
|
|
5138
|
-
const pos = handle.position.getValue(Cesium$
|
|
5295
|
+
const pos = handle.position.getValue(Cesium$b.JulianDate.now());
|
|
5139
5296
|
if (pos) {
|
|
5140
|
-
const c = Cesium$
|
|
5141
|
-
degrees.push(Cesium$
|
|
5142
|
-
degrees.push(Cesium$
|
|
5297
|
+
const c = Cesium$b.Cartographic.fromCartesian(pos);
|
|
5298
|
+
degrees.push(Cesium$b.Math.toDegrees(c.longitude));
|
|
5299
|
+
degrees.push(Cesium$b.Math.toDegrees(c.latitude));
|
|
5143
5300
|
degrees.push(c.height || 0);
|
|
5144
5301
|
}
|
|
5145
5302
|
});
|
|
@@ -5148,12 +5305,12 @@ class EditTool extends BaseTool {
|
|
|
5148
5305
|
|
|
5149
5306
|
// 线不闭合,面需要闭合
|
|
5150
5307
|
if (isPolyline) {
|
|
5151
|
-
return Cesium$
|
|
5308
|
+
return Cesium$b.Cartesian3.fromDegreesArrayHeights(degrees);
|
|
5152
5309
|
}
|
|
5153
5310
|
// 闭合多边形(首尾点相同)
|
|
5154
|
-
return Cesium$
|
|
5311
|
+
return Cesium$b.Cartesian3.fromDegreesArrayHeights([...degrees, degrees[0], degrees[1], degrees[2] || 0]);
|
|
5155
5312
|
}, false),
|
|
5156
|
-
material: Cesium$
|
|
5313
|
+
material: Cesium$b.Color.YELLOW,
|
|
5157
5314
|
width: 2,
|
|
5158
5315
|
clampToGround: true
|
|
5159
5316
|
}
|
|
@@ -5185,12 +5342,12 @@ class EditTool extends BaseTool {
|
|
|
5185
5342
|
_getEditablePositions(entity) {
|
|
5186
5343
|
if (!entity) return [];
|
|
5187
5344
|
|
|
5188
|
-
if (Cesium$
|
|
5189
|
-
return entity.polyline.positions.getValue(Cesium$
|
|
5345
|
+
if (Cesium$b.defined(entity.polyline) && Cesium$b.defined(entity.polyline.positions)) {
|
|
5346
|
+
return entity.polyline.positions.getValue(Cesium$b.JulianDate.now());
|
|
5190
5347
|
}
|
|
5191
5348
|
|
|
5192
|
-
if (Cesium$
|
|
5193
|
-
const hierarchy = entity.polygon.hierarchy.getValue(Cesium$
|
|
5349
|
+
if (Cesium$b.defined(entity.polygon) && Cesium$b.defined(entity.polygon.hierarchy)) {
|
|
5350
|
+
const hierarchy = entity.polygon.hierarchy.getValue(Cesium$b.JulianDate.now());
|
|
5194
5351
|
if (hierarchy && hierarchy.positions) {
|
|
5195
5352
|
let positions = hierarchy.positions;
|
|
5196
5353
|
|
|
@@ -5199,7 +5356,7 @@ class EditTool extends BaseTool {
|
|
|
5199
5356
|
const first = positions[0];
|
|
5200
5357
|
const last = positions[positions.length - 1];
|
|
5201
5358
|
// 使用距离判断而不是精确相等(避免浮点误差)
|
|
5202
|
-
const distance = Cesium$
|
|
5359
|
+
const distance = Cesium$b.Cartesian3.distance(first, last);
|
|
5203
5360
|
if (distance < EditTool.CLOSE_POINT_TOLERANCE) {
|
|
5204
5361
|
positions = positions.slice(0, -1); // 移除最后一个点
|
|
5205
5362
|
}
|
|
@@ -5209,8 +5366,8 @@ class EditTool extends BaseTool {
|
|
|
5209
5366
|
}
|
|
5210
5367
|
}
|
|
5211
5368
|
|
|
5212
|
-
if (Cesium$
|
|
5213
|
-
return [entity.position.getValue(Cesium$
|
|
5369
|
+
if (Cesium$b.defined(entity.position)) {
|
|
5370
|
+
return [entity.position.getValue(Cesium$b.JulianDate.now())];
|
|
5214
5371
|
}
|
|
5215
5372
|
|
|
5216
5373
|
return [];
|
|
@@ -5234,7 +5391,7 @@ class EditTool extends BaseTool {
|
|
|
5234
5391
|
z += p.z;
|
|
5235
5392
|
});
|
|
5236
5393
|
const count = positions.length;
|
|
5237
|
-
return new Cesium$
|
|
5394
|
+
return new Cesium$b.Cartesian3(x / count, y / count, z / count);
|
|
5238
5395
|
}
|
|
5239
5396
|
|
|
5240
5397
|
/**
|
|
@@ -5259,7 +5416,7 @@ class EditTool extends BaseTool {
|
|
|
5259
5416
|
const deltaZ = clampedNewCenter.z - this._originalEntityCenter.z;
|
|
5260
5417
|
|
|
5261
5418
|
// 计算真正的新中心位置(不是鼠标位置)
|
|
5262
|
-
const actualNewCenter = new Cesium$
|
|
5419
|
+
const actualNewCenter = new Cesium$b.Cartesian3(
|
|
5263
5420
|
this._originalEntityCenter.x + deltaX,
|
|
5264
5421
|
this._originalEntityCenter.y + deltaY,
|
|
5265
5422
|
this._originalEntityCenter.z + deltaZ
|
|
@@ -5269,12 +5426,12 @@ class EditTool extends BaseTool {
|
|
|
5269
5426
|
this._originalEntityCenter = actualNewCenter;
|
|
5270
5427
|
|
|
5271
5428
|
// 更新中心控制点位置
|
|
5272
|
-
this._dragHandle.position = new Cesium$
|
|
5429
|
+
this._dragHandle.position = new Cesium$b.ConstantPositionProperty(actualNewCenter);
|
|
5273
5430
|
|
|
5274
|
-
if (Cesium$
|
|
5431
|
+
if (Cesium$b.defined(this._selectedEntity.polyline)) {
|
|
5275
5432
|
// 线图元:平移所有位置
|
|
5276
5433
|
const newPositions = this._originalPositions.map(p => {
|
|
5277
|
-
const newPos = new Cesium$
|
|
5434
|
+
const newPos = new Cesium$b.Cartesian3(p.x + deltaX, p.y + deltaY, p.z + deltaZ);
|
|
5278
5435
|
// 修复:贴地
|
|
5279
5436
|
return this._clampPositionToGround(newPos);
|
|
5280
5437
|
});
|
|
@@ -5292,32 +5449,32 @@ class EditTool extends BaseTool {
|
|
|
5292
5449
|
if (match) {
|
|
5293
5450
|
const index = parseInt(match[1], 10);
|
|
5294
5451
|
if (newPositions[index]) {
|
|
5295
|
-
handle.position = new Cesium$
|
|
5452
|
+
handle.position = new Cesium$b.ConstantPositionProperty(newPositions[index]);
|
|
5296
5453
|
}
|
|
5297
5454
|
}
|
|
5298
5455
|
});
|
|
5299
5456
|
|
|
5300
5457
|
// 更新原始位置缓存
|
|
5301
5458
|
this._originalPositions = newPositions;
|
|
5302
|
-
} else if (Cesium$
|
|
5459
|
+
} else if (Cesium$b.defined(this._selectedEntity.polygon)) {
|
|
5303
5460
|
if (this._isCircle(this._selectedEntity)) {
|
|
5304
5461
|
// 圆形平移
|
|
5305
5462
|
const oldCenter = this._selectedEntity._circleCenter; // [lon, lat]
|
|
5306
5463
|
|
|
5307
5464
|
// 将旧的圆心经纬度转为 Cartesian3
|
|
5308
|
-
const oldCenterCartesian = Cesium$
|
|
5465
|
+
const oldCenterCartesian = Cesium$b.Cartesian3.fromDegrees(oldCenter[0], oldCenter[1], 0);
|
|
5309
5466
|
|
|
5310
5467
|
// 应用偏移量计算新的 Cartesian3 位置
|
|
5311
|
-
const newCenterCartesian = new Cesium$
|
|
5468
|
+
const newCenterCartesian = new Cesium$b.Cartesian3(
|
|
5312
5469
|
oldCenterCartesian.x + deltaX,
|
|
5313
5470
|
oldCenterCartesian.y + deltaY,
|
|
5314
5471
|
oldCenterCartesian.z + deltaZ
|
|
5315
5472
|
);
|
|
5316
5473
|
|
|
5317
5474
|
// 将新的 Cartesian3 转回经纬度
|
|
5318
|
-
const newCenterCartographic = Cesium$
|
|
5319
|
-
const newCenterLon = Cesium$
|
|
5320
|
-
const newCenterLat = Cesium$
|
|
5475
|
+
const newCenterCartographic = Cesium$b.Cartographic.fromCartesian(newCenterCartesian);
|
|
5476
|
+
const newCenterLon = Cesium$b.Math.toDegrees(newCenterCartographic.longitude);
|
|
5477
|
+
const newCenterLat = Cesium$b.Math.toDegrees(newCenterCartographic.latitude);
|
|
5321
5478
|
|
|
5322
5479
|
this._selectedEntity._circleCenter = [newCenterLon, newCenterLat];
|
|
5323
5480
|
|
|
@@ -5328,25 +5485,25 @@ class EditTool extends BaseTool {
|
|
|
5328
5485
|
256
|
|
5329
5486
|
);
|
|
5330
5487
|
const flat = positions.flatMap(c => [c[0], c[1], 0]);
|
|
5331
|
-
this._selectedEntity.polygon.hierarchy = new Cesium$
|
|
5332
|
-
Cesium$
|
|
5488
|
+
this._selectedEntity.polygon.hierarchy = new Cesium$b.PolygonHierarchy(
|
|
5489
|
+
Cesium$b.Cartesian3.fromDegreesArrayHeights(flat)
|
|
5333
5490
|
);
|
|
5334
5491
|
|
|
5335
5492
|
// 更新圆心控制点位置
|
|
5336
5493
|
const centerHandle = this._editHandles.find(h => h.id && h.id.includes('__edit_handle_center'));
|
|
5337
5494
|
if (centerHandle) {
|
|
5338
|
-
centerHandle.position = new Cesium$
|
|
5495
|
+
centerHandle.position = new Cesium$b.ConstantPositionProperty(newCenterCartesian);
|
|
5339
5496
|
}
|
|
5340
5497
|
} else {
|
|
5341
5498
|
// 普通多边形:平移所有顶点
|
|
5342
5499
|
const newPositions = this._originalPositions.map(p => {
|
|
5343
|
-
const newPos = new Cesium$
|
|
5500
|
+
const newPos = new Cesium$b.Cartesian3(p.x + deltaX, p.y + deltaY, p.z + deltaZ);
|
|
5344
5501
|
// 修复:贴地
|
|
5345
5502
|
return this._clampPositionToGround(newPos);
|
|
5346
5503
|
});
|
|
5347
5504
|
// 添加闭合点
|
|
5348
5505
|
newPositions.push(newPositions[0].clone());
|
|
5349
|
-
this._selectedEntity.polygon.hierarchy = new Cesium$
|
|
5506
|
+
this._selectedEntity.polygon.hierarchy = new Cesium$b.PolygonHierarchy(newPositions);
|
|
5350
5507
|
|
|
5351
5508
|
// 修复:更新顶点控制点位置,使用更可靠的ID匹配
|
|
5352
5509
|
this._editHandles.forEach((handle) => {
|
|
@@ -5359,7 +5516,7 @@ class EditTool extends BaseTool {
|
|
|
5359
5516
|
if (match) {
|
|
5360
5517
|
const index = parseInt(match[1], 10);
|
|
5361
5518
|
if (newPositions[index]) {
|
|
5362
|
-
handle.position = new Cesium$
|
|
5519
|
+
handle.position = new Cesium$b.ConstantPositionProperty(newPositions[index]);
|
|
5363
5520
|
}
|
|
5364
5521
|
}
|
|
5365
5522
|
});
|
|
@@ -5367,9 +5524,9 @@ class EditTool extends BaseTool {
|
|
|
5367
5524
|
// 更新原始位置缓存
|
|
5368
5525
|
this._originalPositions = newPositions.slice(0, -1);
|
|
5369
5526
|
}
|
|
5370
|
-
} else if (Cesium$
|
|
5527
|
+
} else if (Cesium$b.defined(this._selectedEntity.position)) {
|
|
5371
5528
|
// 点/文本图元:平移位置
|
|
5372
|
-
this._selectedEntity.position = new Cesium$
|
|
5529
|
+
this._selectedEntity.position = new Cesium$b.ConstantPositionProperty(actualNewCenter);
|
|
5373
5530
|
this._originalPositions = [actualNewCenter];
|
|
5374
5531
|
}
|
|
5375
5532
|
}
|
|
@@ -5498,16 +5655,16 @@ class EditTool extends BaseTool {
|
|
|
5498
5655
|
// 圆周辅助线(黄色)
|
|
5499
5656
|
this._positionOutline = this.createTempEntity(this.generateId('temp_circle_outline'), {
|
|
5500
5657
|
polyline: {
|
|
5501
|
-
positions: new Cesium$
|
|
5658
|
+
positions: new Cesium$b.CallbackProperty(function () {
|
|
5502
5659
|
const circleInfo = self._getCircleInfo(self._selectedEntity);
|
|
5503
5660
|
if (!circleInfo) return [];
|
|
5504
5661
|
|
|
5505
5662
|
const { center, radius } = circleInfo;
|
|
5506
5663
|
const positions = self._generateCirclePositions(center, radius, 256);
|
|
5507
5664
|
const flat = positions.flatMap(c => [c[0], c[1], 0]);
|
|
5508
|
-
return Cesium$
|
|
5665
|
+
return Cesium$b.Cartesian3.fromDegreesArrayHeights(flat);
|
|
5509
5666
|
}, false),
|
|
5510
|
-
material: Cesium$
|
|
5667
|
+
material: Cesium$b.Color.YELLOW,
|
|
5511
5668
|
width: 2,
|
|
5512
5669
|
clampToGround: true
|
|
5513
5670
|
}
|
|
@@ -5519,7 +5676,7 @@ class EditTool extends BaseTool {
|
|
|
5519
5676
|
// 修复:正确获取半径控制点的位置
|
|
5520
5677
|
this._radiusLine = this.createTempEntity(this.generateId('temp_radius_line'), {
|
|
5521
5678
|
polyline: {
|
|
5522
|
-
positions: new Cesium$
|
|
5679
|
+
positions: new Cesium$b.CallbackProperty(function () {
|
|
5523
5680
|
const circleInfo = self._getCircleInfo(self._selectedEntity);
|
|
5524
5681
|
if (!circleInfo) return [];
|
|
5525
5682
|
|
|
@@ -5528,13 +5685,13 @@ class EditTool extends BaseTool {
|
|
|
5528
5685
|
const radiusHandle = self._editHandles.find(h => h.id && h.id.includes('__edit_handle_radius'));
|
|
5529
5686
|
if (!radiusHandle) return [];
|
|
5530
5687
|
|
|
5531
|
-
const radiusPos = radiusHandle.position.getValue(Cesium$
|
|
5688
|
+
const radiusPos = radiusHandle.position.getValue(Cesium$b.JulianDate.now());
|
|
5532
5689
|
if (!radiusPos) return [];
|
|
5533
5690
|
|
|
5534
|
-
const centerCart = Cesium$
|
|
5691
|
+
const centerCart = Cesium$b.Cartesian3.fromDegrees(center[0], center[1], 0);
|
|
5535
5692
|
return [centerCart, radiusPos];
|
|
5536
5693
|
}, false),
|
|
5537
|
-
material: Cesium$
|
|
5694
|
+
material: Cesium$b.Color.RED,
|
|
5538
5695
|
width: 3,
|
|
5539
5696
|
clampToGround: true
|
|
5540
5697
|
}
|
|
@@ -5574,8 +5731,8 @@ class EditTool extends BaseTool {
|
|
|
5574
5731
|
_computeRectangleNewPositions(newPos, originalPositions, draggedIndex) {
|
|
5575
5732
|
// 对角顶点索引:0->2, 1->3, 2->0, 3->1
|
|
5576
5733
|
const oppositeIndex = (draggedIndex + 2) % 4;
|
|
5577
|
-
const newP = Cesium$
|
|
5578
|
-
const currentPos = originalPositions.map(p => Cesium$
|
|
5734
|
+
const newP = Cesium$b.Cartographic.fromCartesian(newPos);
|
|
5735
|
+
const currentPos = originalPositions.map(p => Cesium$b.Cartographic.fromCartesian(p));
|
|
5579
5736
|
const oppositePos = currentPos[oppositeIndex];
|
|
5580
5737
|
|
|
5581
5738
|
const newPositions = new Array(4);
|
|
@@ -5588,14 +5745,14 @@ class EditTool extends BaseTool {
|
|
|
5588
5745
|
const neighbor2 = (draggedIndex + 3) % 4;
|
|
5589
5746
|
|
|
5590
5747
|
// neighbor1 使用 newPos 的 longitude 和 opposite 的 latitude
|
|
5591
|
-
newPositions[neighbor1] = Cesium$
|
|
5748
|
+
newPositions[neighbor1] = Cesium$b.Cartesian3.fromRadians(
|
|
5592
5749
|
newP.longitude,
|
|
5593
5750
|
oppositePos.latitude,
|
|
5594
5751
|
oppositePos.height
|
|
5595
5752
|
);
|
|
5596
5753
|
|
|
5597
5754
|
// neighbor2 使用 opposite 的 longitude 和 newPos 的 latitude
|
|
5598
|
-
newPositions[neighbor2] = Cesium$
|
|
5755
|
+
newPositions[neighbor2] = Cesium$b.Cartesian3.fromRadians(
|
|
5599
5756
|
oppositePos.longitude,
|
|
5600
5757
|
newP.latitude,
|
|
5601
5758
|
oppositePos.height
|
|
@@ -5611,7 +5768,7 @@ class EditTool extends BaseTool {
|
|
|
5611
5768
|
if (handleIndex === -1) return;
|
|
5612
5769
|
|
|
5613
5770
|
// 修复:新位置贴地(高度设为0)
|
|
5614
|
-
const newCartesian = Cesium$
|
|
5771
|
+
const newCartesian = Cesium$b.Cartesian3.fromDegrees(newLonLat[0], newLonLat[1], 0);
|
|
5615
5772
|
|
|
5616
5773
|
// 标绘图元:拖拽控制点重新生成几何
|
|
5617
5774
|
if (this._selectedEntity._isPlotGraphic) {
|
|
@@ -5634,12 +5791,12 @@ class EditTool extends BaseTool {
|
|
|
5634
5791
|
// 扇形:拖拽圆心(索引0)时整体平移,保持两半径等长
|
|
5635
5792
|
if (plotType === PlotGraphicType.SECTOR && index === 0) {
|
|
5636
5793
|
const oldCenter = this._selectedEntity._controlPoints[0];
|
|
5637
|
-
const oldCenterCart = Cesium$
|
|
5794
|
+
const oldCenterCart = Cesium$b.Cartesian3.fromDegrees(oldCenter[0], oldCenter[1], oldCenter[2] || 0);
|
|
5638
5795
|
const clampedNewCenter = this._clampPositionToGround(newCartesian);
|
|
5639
5796
|
this._translatePlotControlPoints(clampedNewCenter, oldCenterCart);
|
|
5640
5797
|
// 中心控制点固定在圆心
|
|
5641
5798
|
this._originalEntityCenter = this._clampPositionToGround(
|
|
5642
|
-
Cesium$
|
|
5799
|
+
Cesium$b.Cartesian3.fromDegrees(
|
|
5643
5800
|
this._selectedEntity._controlPoints[0][0],
|
|
5644
5801
|
this._selectedEntity._controlPoints[0][1],
|
|
5645
5802
|
this._selectedEntity._controlPoints[0][2] || 0
|
|
@@ -5715,8 +5872,8 @@ class EditTool extends BaseTool {
|
|
|
5715
5872
|
if (match) {
|
|
5716
5873
|
const cpIndex = parseInt(match[1], 10);
|
|
5717
5874
|
const cp = controlPoints[cpIndex];
|
|
5718
|
-
handle.position = new Cesium$
|
|
5719
|
-
this._clampPositionToGround(Cesium$
|
|
5875
|
+
handle.position = new Cesium$b.ConstantPositionProperty(
|
|
5876
|
+
this._clampPositionToGround(Cesium$b.Cartesian3.fromDegrees(cp[0], cp[1], cp[2] || 0))
|
|
5720
5877
|
);
|
|
5721
5878
|
}
|
|
5722
5879
|
});
|
|
@@ -5728,11 +5885,11 @@ class EditTool extends BaseTool {
|
|
|
5728
5885
|
const newCenter = (plotType === PlotGraphicType.SECTOR || plotType === PlotGraphicType.ELLIPSE)
|
|
5729
5886
|
? controlPoints[0]
|
|
5730
5887
|
: this._getPlotControlPointsCenter(controlPoints);
|
|
5731
|
-
centerHandle.position = new Cesium$
|
|
5732
|
-
this._clampPositionToGround(Cesium$
|
|
5888
|
+
centerHandle.position = new Cesium$b.ConstantPositionProperty(
|
|
5889
|
+
this._clampPositionToGround(Cesium$b.Cartesian3.fromDegrees(newCenter[0], newCenter[1], newCenter[2] || 0))
|
|
5733
5890
|
);
|
|
5734
5891
|
this._originalEntityCenter = this._clampPositionToGround(
|
|
5735
|
-
Cesium$
|
|
5892
|
+
Cesium$b.Cartesian3.fromDegrees(newCenter[0], newCenter[1], newCenter[2] || 0)
|
|
5736
5893
|
);
|
|
5737
5894
|
}
|
|
5738
5895
|
|
|
@@ -5741,7 +5898,7 @@ class EditTool extends BaseTool {
|
|
|
5741
5898
|
return;
|
|
5742
5899
|
}
|
|
5743
5900
|
|
|
5744
|
-
const hierarchy = this._selectedEntity.polygon?.hierarchy?.getValue(Cesium$
|
|
5901
|
+
const hierarchy = this._selectedEntity.polygon?.hierarchy?.getValue(Cesium$b.JulianDate.now());
|
|
5745
5902
|
|
|
5746
5903
|
// 拖动中心控制点:平移整个图元
|
|
5747
5904
|
// 修复:统一使用 includes('center') 来判断
|
|
@@ -5755,7 +5912,7 @@ class EditTool extends BaseTool {
|
|
|
5755
5912
|
if (this._handleVertexIndices &&
|
|
5756
5913
|
Array.isArray(this._handleVertexIndices) &&
|
|
5757
5914
|
typeof this._handleVertexIndices[0] === 'number' &&
|
|
5758
|
-
Cesium$
|
|
5915
|
+
Cesium$b.defined(this._selectedEntity.polygon)) {
|
|
5759
5916
|
if (!hierarchy || !hierarchy.positions || hierarchy.positions.length < 4) return;
|
|
5760
5917
|
|
|
5761
5918
|
const draggedVertexIndex = this._handleVertexIndices[handleIndex];
|
|
@@ -5765,13 +5922,13 @@ class EditTool extends BaseTool {
|
|
|
5765
5922
|
const clampedPositions = newPositions.map(pos => this._clampPositionToGround(pos));
|
|
5766
5923
|
|
|
5767
5924
|
// 更新多边形
|
|
5768
|
-
this._selectedEntity.polygon.hierarchy = new Cesium$
|
|
5925
|
+
this._selectedEntity.polygon.hierarchy = new Cesium$b.PolygonHierarchy(clampedPositions);
|
|
5769
5926
|
|
|
5770
5927
|
// 更新所有控制点位置(使用 ConstantPositionProperty 确保正确更新)
|
|
5771
5928
|
this._editHandles.forEach((handle, i) => {
|
|
5772
5929
|
// 修复:跳过中心控制点
|
|
5773
5930
|
if (handle.id && handle.id.includes('center')) return;
|
|
5774
|
-
handle.position = new Cesium$
|
|
5931
|
+
handle.position = new Cesium$b.ConstantPositionProperty(clampedPositions[i]);
|
|
5775
5932
|
});
|
|
5776
5933
|
|
|
5777
5934
|
// 修复:顶点编辑后重新计算并更新中心控制点位置
|
|
@@ -5804,16 +5961,16 @@ class EditTool extends BaseTool {
|
|
|
5804
5961
|
// 更新多边形顶点
|
|
5805
5962
|
const positions = this._generateCirclePositions(newCenterLonLat, circleInfo.radius, 256);
|
|
5806
5963
|
const flat = positions.flatMap(c => [c[0], c[1], 0]);
|
|
5807
|
-
this._selectedEntity.polygon.hierarchy = new Cesium$
|
|
5808
|
-
Cesium$
|
|
5964
|
+
this._selectedEntity.polygon.hierarchy = new Cesium$b.PolygonHierarchy(
|
|
5965
|
+
Cesium$b.Cartesian3.fromDegreesArrayHeights(flat)
|
|
5809
5966
|
);
|
|
5810
5967
|
|
|
5811
5968
|
// 更新半径控制点位置
|
|
5812
5969
|
const radiusHandle = this._editHandles.find(h => h.id && h.id.includes('radius'));
|
|
5813
5970
|
if (radiusHandle) {
|
|
5814
5971
|
const radiusPoint = this._getPointOnCircle(newCenterLonLat, circleInfo.radius, 0);
|
|
5815
|
-
radiusHandle.position = new Cesium$
|
|
5816
|
-
Cesium$
|
|
5972
|
+
radiusHandle.position = new Cesium$b.ConstantPositionProperty(
|
|
5973
|
+
Cesium$b.Cartesian3.fromDegrees(radiusPoint[0], radiusPoint[1], 0)
|
|
5817
5974
|
);
|
|
5818
5975
|
}
|
|
5819
5976
|
|
|
@@ -5825,8 +5982,8 @@ class EditTool extends BaseTool {
|
|
|
5825
5982
|
// 更新半径控制点位置(在圆周上)
|
|
5826
5983
|
const angle = Math.atan2(newLonLat[1] - circleInfo.center[1], newLonLat[0] - circleInfo.center[0]);
|
|
5827
5984
|
const radiusPoint = this._getPointOnCircle(circleInfo.center, newRadius, angle);
|
|
5828
|
-
this._dragHandle.position = new Cesium$
|
|
5829
|
-
Cesium$
|
|
5985
|
+
this._dragHandle.position = new Cesium$b.ConstantPositionProperty(
|
|
5986
|
+
Cesium$b.Cartesian3.fromDegrees(radiusPoint[0], radiusPoint[1], 0)
|
|
5830
5987
|
);
|
|
5831
5988
|
|
|
5832
5989
|
// 更新圆的实体属性
|
|
@@ -5836,25 +5993,25 @@ class EditTool extends BaseTool {
|
|
|
5836
5993
|
// 更新多边形顶点
|
|
5837
5994
|
const positions = this._generateCirclePositions(circleInfo.center, newRadius, 256);
|
|
5838
5995
|
const flat = positions.flatMap(c => [c[0], c[1], 0]);
|
|
5839
|
-
this._selectedEntity.polygon.hierarchy = new Cesium$
|
|
5840
|
-
Cesium$
|
|
5996
|
+
this._selectedEntity.polygon.hierarchy = new Cesium$b.PolygonHierarchy(
|
|
5997
|
+
Cesium$b.Cartesian3.fromDegreesArrayHeights(flat)
|
|
5841
5998
|
);
|
|
5842
5999
|
|
|
5843
6000
|
return;
|
|
5844
6001
|
}
|
|
5845
6002
|
|
|
5846
|
-
if (Cesium$
|
|
5847
|
-
const positions = this._selectedEntity.polyline.positions.getValue(Cesium$
|
|
6003
|
+
if (Cesium$b.defined(this._selectedEntity.polyline)) {
|
|
6004
|
+
const positions = this._selectedEntity.polyline.positions.getValue(Cesium$b.JulianDate.now());
|
|
5848
6005
|
if (positions && positions[handleIndex]) {
|
|
5849
6006
|
// 直接修改数组元素触发更新
|
|
5850
6007
|
positions[handleIndex] = newCartesian;
|
|
5851
6008
|
this._selectedEntity.polyline.positions = positions;
|
|
5852
|
-
this._dragHandle.position = new Cesium$
|
|
6009
|
+
this._dragHandle.position = new Cesium$b.ConstantPositionProperty(newCartesian);
|
|
5853
6010
|
|
|
5854
6011
|
// 修复:线编辑后重新计算并更新中心控制点位置
|
|
5855
6012
|
this._updateCenterHandlePosition();
|
|
5856
6013
|
}
|
|
5857
|
-
} else if (Cesium$
|
|
6014
|
+
} else if (Cesium$b.defined(this._selectedEntity.polygon)) {
|
|
5858
6015
|
// 获取当前实际顶点数(不包含闭合点)
|
|
5859
6016
|
this._editHandles.filter(h => !h.id.includes('center')).length;
|
|
5860
6017
|
|
|
@@ -5869,7 +6026,7 @@ class EditTool extends BaseTool {
|
|
|
5869
6026
|
newPositions.push(newCartesian);
|
|
5870
6027
|
} else {
|
|
5871
6028
|
// 从控制点获取当前位置
|
|
5872
|
-
const pos = handle.position.getValue(Cesium$
|
|
6029
|
+
const pos = handle.position.getValue(Cesium$b.JulianDate.now());
|
|
5873
6030
|
// 修复:确保位置贴地
|
|
5874
6031
|
newPositions.push(this._clampPositionToGround(pos));
|
|
5875
6032
|
}
|
|
@@ -5879,47 +6036,47 @@ class EditTool extends BaseTool {
|
|
|
5879
6036
|
newPositions.push(newPositions[0].clone());
|
|
5880
6037
|
|
|
5881
6038
|
// 更新多边形
|
|
5882
|
-
this._selectedEntity.polygon.hierarchy = new Cesium$
|
|
6039
|
+
this._selectedEntity.polygon.hierarchy = new Cesium$b.PolygonHierarchy(newPositions);
|
|
5883
6040
|
|
|
5884
6041
|
// 更新控制点
|
|
5885
|
-
this._dragHandle.position = new Cesium$
|
|
6042
|
+
this._dragHandle.position = new Cesium$b.ConstantPositionProperty(newCartesian);
|
|
5886
6043
|
|
|
5887
6044
|
// 修复:多边形编辑后重新计算并更新中心控制点位置
|
|
5888
6045
|
this._updateCenterHandlePosition();
|
|
5889
6046
|
|
|
5890
6047
|
return;
|
|
5891
|
-
} else if (Cesium$
|
|
5892
|
-
this._selectedEntity.position = new Cesium$
|
|
5893
|
-
this._dragHandle.position = new Cesium$
|
|
6048
|
+
} else if (Cesium$b.defined(this._selectedEntity.position)) {
|
|
6049
|
+
this._selectedEntity.position = new Cesium$b.ConstantPositionProperty(newCartesian);
|
|
6050
|
+
this._dragHandle.position = new Cesium$b.ConstantPositionProperty(newCartesian);
|
|
5894
6051
|
}
|
|
5895
6052
|
}
|
|
5896
6053
|
|
|
5897
6054
|
_highlightEntity(entity, highlight) {
|
|
5898
6055
|
if (!entity) return;
|
|
5899
6056
|
|
|
5900
|
-
if (Cesium$
|
|
6057
|
+
if (Cesium$b.defined(entity.point)) {
|
|
5901
6058
|
if (highlight) {
|
|
5902
|
-
entity.point.outlineColor = Cesium$
|
|
6059
|
+
entity.point.outlineColor = Cesium$b.Color.CYAN;
|
|
5903
6060
|
entity.point.outlineWidth = 3;
|
|
5904
6061
|
} else {
|
|
5905
|
-
entity.point.outlineColor = Cesium$
|
|
6062
|
+
entity.point.outlineColor = Cesium$b.Color.WHITE;
|
|
5906
6063
|
entity.point.outlineWidth = 1;
|
|
5907
6064
|
}
|
|
5908
6065
|
}
|
|
5909
6066
|
|
|
5910
|
-
if (Cesium$
|
|
6067
|
+
if (Cesium$b.defined(entity.polyline)) {
|
|
5911
6068
|
if (highlight) {
|
|
5912
|
-
entity.polyline.material = Cesium$
|
|
6069
|
+
entity.polyline.material = Cesium$b.Color.CYAN;
|
|
5913
6070
|
} else {
|
|
5914
|
-
entity.polyline.material = Cesium$
|
|
6071
|
+
entity.polyline.material = Cesium$b.Color.BLUE;
|
|
5915
6072
|
}
|
|
5916
6073
|
}
|
|
5917
6074
|
|
|
5918
|
-
if (Cesium$
|
|
6075
|
+
if (Cesium$b.defined(entity.polygon)) {
|
|
5919
6076
|
if (highlight) {
|
|
5920
|
-
entity.polygon.outlineColor = Cesium$
|
|
6077
|
+
entity.polygon.outlineColor = Cesium$b.Color.CYAN;
|
|
5921
6078
|
} else {
|
|
5922
|
-
entity.polygon.outlineColor = Cesium$
|
|
6079
|
+
entity.polygon.outlineColor = Cesium$b.Color.WHITE;
|
|
5923
6080
|
}
|
|
5924
6081
|
}
|
|
5925
6082
|
}
|
|
@@ -5956,8 +6113,8 @@ class EditTool extends BaseTool {
|
|
|
5956
6113
|
// 更新多边形顶点
|
|
5957
6114
|
const positions = this._generateCirclePositions(center, radius, 256);
|
|
5958
6115
|
const flat = positions.flatMap(c => [c[0], c[1], 0]);
|
|
5959
|
-
this._selectedEntity.polygon.hierarchy = new Cesium$
|
|
5960
|
-
Cesium$
|
|
6116
|
+
this._selectedEntity.polygon.hierarchy = new Cesium$b.PolygonHierarchy(
|
|
6117
|
+
Cesium$b.Cartesian3.fromDegreesArrayHeights(flat)
|
|
5961
6118
|
);
|
|
5962
6119
|
|
|
5963
6120
|
this._createEditHandles();
|
|
@@ -5972,10 +6129,10 @@ class EditTool extends BaseTool {
|
|
|
5972
6129
|
// 拷贝一份避免直接修改原始数据
|
|
5973
6130
|
const positionsCopy = originalPositions.map(p => p.clone ? p.clone() : p);
|
|
5974
6131
|
|
|
5975
|
-
if (Cesium$
|
|
6132
|
+
if (Cesium$b.defined(this._selectedEntity.polyline)) {
|
|
5976
6133
|
this._selectedEntity.polyline.positions = positionsCopy;
|
|
5977
|
-
} else if (Cesium$
|
|
5978
|
-
this._selectedEntity.polygon.hierarchy = new Cesium$
|
|
6134
|
+
} else if (Cesium$b.defined(this._selectedEntity.polygon)) {
|
|
6135
|
+
this._selectedEntity.polygon.hierarchy = new Cesium$b.PolygonHierarchy(positionsCopy);
|
|
5979
6136
|
}
|
|
5980
6137
|
|
|
5981
6138
|
this._createEditHandles();
|
|
@@ -5998,7 +6155,7 @@ class EditTool extends BaseTool {
|
|
|
5998
6155
|
}
|
|
5999
6156
|
}
|
|
6000
6157
|
|
|
6001
|
-
const Cesium$
|
|
6158
|
+
const Cesium$a = getCesium();
|
|
6002
6159
|
|
|
6003
6160
|
/**
|
|
6004
6161
|
* 选择类型枚举
|
|
@@ -6085,7 +6242,7 @@ class SelectTool extends BaseTool {
|
|
|
6085
6242
|
|
|
6086
6243
|
const picked = this._viewer.scene.pick(screenPos);
|
|
6087
6244
|
|
|
6088
|
-
if (Cesium$
|
|
6245
|
+
if (Cesium$a.defined(picked) && Cesium$a.defined(picked.id)) {
|
|
6089
6246
|
const entityId = picked.id.id;
|
|
6090
6247
|
|
|
6091
6248
|
// 忽略临时图元
|
|
@@ -6127,9 +6284,9 @@ class SelectTool extends BaseTool {
|
|
|
6127
6284
|
|
|
6128
6285
|
_createSelectionStartMarker(pos) {
|
|
6129
6286
|
const marker = this.createTempEntity(this.generateId('sel_start'), {
|
|
6130
|
-
position: Cesium$
|
|
6287
|
+
position: Cesium$a.Cartesian3.fromDegrees(...pos),
|
|
6131
6288
|
point: {
|
|
6132
|
-
color: Cesium$
|
|
6289
|
+
color: Cesium$a.Color.GREEN,
|
|
6133
6290
|
pixelSize: 10
|
|
6134
6291
|
}
|
|
6135
6292
|
});
|
|
@@ -6154,27 +6311,27 @@ class SelectTool extends BaseTool {
|
|
|
6154
6311
|
if (!this._selectionRect) {
|
|
6155
6312
|
this._selectionRect = this.createTempEntity(this.generateId('sel_rect'), {
|
|
6156
6313
|
polyline: {
|
|
6157
|
-
positions: new Cesium$
|
|
6314
|
+
positions: new Cesium$a.CallbackProperty(() => {
|
|
6158
6315
|
const c1 = this._startPos;
|
|
6159
6316
|
const c2 = this._currentEndPos;
|
|
6160
6317
|
if (!c1 || !c2) return [];
|
|
6161
6318
|
const pos = this._getRectPositions(c1, c2);
|
|
6162
|
-
return Cesium$
|
|
6319
|
+
return Cesium$a.Cartesian3.fromDegreesArrayHeights(pos.flatMap(c => [c[0], c[1], 0]));
|
|
6163
6320
|
}, false),
|
|
6164
|
-
material: Cesium$
|
|
6321
|
+
material: Cesium$a.Color.CYAN,
|
|
6165
6322
|
width: 2
|
|
6166
6323
|
},
|
|
6167
6324
|
polygon: {
|
|
6168
|
-
hierarchy: new Cesium$
|
|
6325
|
+
hierarchy: new Cesium$a.CallbackProperty(() => {
|
|
6169
6326
|
const c1 = this._startPos;
|
|
6170
6327
|
const c2 = this._currentEndPos;
|
|
6171
|
-
if (!c1 || !c2) return new Cesium$
|
|
6328
|
+
if (!c1 || !c2) return new Cesium$a.PolygonHierarchy([]);
|
|
6172
6329
|
const pos = this._getRectPositions(c1, c2);
|
|
6173
|
-
return new Cesium$
|
|
6174
|
-
Cesium$
|
|
6330
|
+
return new Cesium$a.PolygonHierarchy(
|
|
6331
|
+
Cesium$a.Cartesian3.fromDegreesArrayHeights(pos.flatMap(c => [c[0], c[1], 0]))
|
|
6175
6332
|
);
|
|
6176
6333
|
}, false),
|
|
6177
|
-
material: Cesium$
|
|
6334
|
+
material: Cesium$a.Color.CYAN.withAlpha(0.2),
|
|
6178
6335
|
outline: false
|
|
6179
6336
|
}
|
|
6180
6337
|
});
|
|
@@ -6191,21 +6348,21 @@ class SelectTool extends BaseTool {
|
|
|
6191
6348
|
if (!this._selectionRect) {
|
|
6192
6349
|
this._selectionRect = this.createTempEntity(this.generateId('sel_circle'), {
|
|
6193
6350
|
polygon: {
|
|
6194
|
-
hierarchy: new Cesium$
|
|
6351
|
+
hierarchy: new Cesium$a.CallbackProperty(() => {
|
|
6195
6352
|
const c = this._startPos;
|
|
6196
6353
|
const edge = this._currentEndPos;
|
|
6197
|
-
if (!c || !edge) return new Cesium$
|
|
6354
|
+
if (!c || !edge) return new Cesium$a.PolygonHierarchy([]);
|
|
6198
6355
|
const radius = this._calcDistance(c, edge);
|
|
6199
6356
|
const positions = this._generateCirclePositions(c, radius, 36);
|
|
6200
|
-
return new Cesium$
|
|
6201
|
-
Cesium$
|
|
6357
|
+
return new Cesium$a.PolygonHierarchy(
|
|
6358
|
+
Cesium$a.Cartesian3.fromDegreesArrayHeights(
|
|
6202
6359
|
positions.flatMap(c => [c[0], c[1], 0])
|
|
6203
6360
|
)
|
|
6204
6361
|
);
|
|
6205
6362
|
}, false),
|
|
6206
|
-
material: Cesium$
|
|
6363
|
+
material: Cesium$a.Color.CYAN.withAlpha(0.2),
|
|
6207
6364
|
outline: true,
|
|
6208
|
-
outlineColor: Cesium$
|
|
6365
|
+
outlineColor: Cesium$a.Color.CYAN
|
|
6209
6366
|
}
|
|
6210
6367
|
});
|
|
6211
6368
|
this._selectionRect._isPreview = true;
|
|
@@ -6294,7 +6451,7 @@ class SelectTool extends BaseTool {
|
|
|
6294
6451
|
|
|
6295
6452
|
const styleKey = entityId;
|
|
6296
6453
|
|
|
6297
|
-
if (Cesium$
|
|
6454
|
+
if (Cesium$a.defined(entity.point)) {
|
|
6298
6455
|
if (highlight) {
|
|
6299
6456
|
if (!this._originalStyles.has(styleKey)) {
|
|
6300
6457
|
this._originalStyles.set(styleKey, {
|
|
@@ -6304,7 +6461,7 @@ class SelectTool extends BaseTool {
|
|
|
6304
6461
|
}
|
|
6305
6462
|
});
|
|
6306
6463
|
}
|
|
6307
|
-
entity.point.outlineColor = Cesium$
|
|
6464
|
+
entity.point.outlineColor = Cesium$a.Color.YELLOW;
|
|
6308
6465
|
entity.point.outlineWidth = 2;
|
|
6309
6466
|
} else {
|
|
6310
6467
|
const original = this._originalStyles.get(styleKey)?.point;
|
|
@@ -6312,13 +6469,13 @@ class SelectTool extends BaseTool {
|
|
|
6312
6469
|
entity.point.outlineColor = original.outlineColor;
|
|
6313
6470
|
entity.point.outlineWidth = original.outlineWidth;
|
|
6314
6471
|
} else {
|
|
6315
|
-
entity.point.outlineColor = Cesium$
|
|
6472
|
+
entity.point.outlineColor = Cesium$a.Color.WHITE;
|
|
6316
6473
|
entity.point.outlineWidth = 1;
|
|
6317
6474
|
}
|
|
6318
6475
|
}
|
|
6319
6476
|
}
|
|
6320
6477
|
|
|
6321
|
-
if (Cesium$
|
|
6478
|
+
if (Cesium$a.defined(entity.polyline)) {
|
|
6322
6479
|
if (highlight) {
|
|
6323
6480
|
if (!this._originalStyles.has(styleKey)) {
|
|
6324
6481
|
this._originalStyles.set(styleKey, {
|
|
@@ -6327,14 +6484,14 @@ class SelectTool extends BaseTool {
|
|
|
6327
6484
|
}
|
|
6328
6485
|
});
|
|
6329
6486
|
}
|
|
6330
|
-
entity.polyline.material = Cesium$
|
|
6487
|
+
entity.polyline.material = Cesium$a.Color.CYAN;
|
|
6331
6488
|
} else {
|
|
6332
6489
|
const original = this._originalStyles.get(styleKey)?.polyline;
|
|
6333
|
-
entity.polyline.material = original?.material || Cesium$
|
|
6490
|
+
entity.polyline.material = original?.material || Cesium$a.Color.BLUE;
|
|
6334
6491
|
}
|
|
6335
6492
|
}
|
|
6336
6493
|
|
|
6337
|
-
if (Cesium$
|
|
6494
|
+
if (Cesium$a.defined(entity.polygon)) {
|
|
6338
6495
|
if (highlight) {
|
|
6339
6496
|
if (!this._originalStyles.has(styleKey)) {
|
|
6340
6497
|
this._originalStyles.set(styleKey, {
|
|
@@ -6343,10 +6500,10 @@ class SelectTool extends BaseTool {
|
|
|
6343
6500
|
}
|
|
6344
6501
|
});
|
|
6345
6502
|
}
|
|
6346
|
-
entity.polygon.outlineColor = Cesium$
|
|
6503
|
+
entity.polygon.outlineColor = Cesium$a.Color.CYAN;
|
|
6347
6504
|
} else {
|
|
6348
6505
|
const original = this._originalStyles.get(styleKey)?.polygon;
|
|
6349
|
-
entity.polygon.outlineColor = original?.outlineColor || Cesium$
|
|
6506
|
+
entity.polygon.outlineColor = original?.outlineColor || Cesium$a.Color.WHITE;
|
|
6350
6507
|
}
|
|
6351
6508
|
}
|
|
6352
6509
|
|
|
@@ -6433,9 +6590,9 @@ class SelectTool extends BaseTool {
|
|
|
6433
6590
|
// 检查是否所有点都在范围内
|
|
6434
6591
|
let allInBounds = true;
|
|
6435
6592
|
for (const pos of positions) {
|
|
6436
|
-
const c = Cesium$
|
|
6437
|
-
const lon = Cesium$
|
|
6438
|
-
const lat = Cesium$
|
|
6593
|
+
const c = Cesium$a.Cartographic.fromCartesian(pos);
|
|
6594
|
+
const lon = Cesium$a.Math.toDegrees(c.longitude);
|
|
6595
|
+
const lat = Cesium$a.Math.toDegrees(c.latitude);
|
|
6439
6596
|
|
|
6440
6597
|
if (lon < minLon || lon > maxLon || lat < minLat || lat > maxLat) {
|
|
6441
6598
|
allInBounds = false;
|
|
@@ -6452,13 +6609,13 @@ class SelectTool extends BaseTool {
|
|
|
6452
6609
|
}
|
|
6453
6610
|
|
|
6454
6611
|
_getEntityPosition(entity) {
|
|
6455
|
-
if (Cesium$
|
|
6456
|
-
const pos = entity.position.getValue(Cesium$
|
|
6612
|
+
if (Cesium$a.defined(entity.position)) {
|
|
6613
|
+
const pos = entity.position.getValue(Cesium$a.JulianDate.now());
|
|
6457
6614
|
if (pos) {
|
|
6458
|
-
const c = Cesium$
|
|
6615
|
+
const c = Cesium$a.Cartographic.fromCartesian(pos);
|
|
6459
6616
|
return [
|
|
6460
|
-
Cesium$
|
|
6461
|
-
Cesium$
|
|
6617
|
+
Cesium$a.Math.toDegrees(c.longitude),
|
|
6618
|
+
Cesium$a.Math.toDegrees(c.latitude)
|
|
6462
6619
|
];
|
|
6463
6620
|
}
|
|
6464
6621
|
}
|
|
@@ -6466,11 +6623,11 @@ class SelectTool extends BaseTool {
|
|
|
6466
6623
|
}
|
|
6467
6624
|
|
|
6468
6625
|
_getEntityPositions(entity) {
|
|
6469
|
-
if (Cesium$
|
|
6470
|
-
return entity.polyline.positions.getValue(Cesium$
|
|
6626
|
+
if (Cesium$a.defined(entity.polyline) && Cesium$a.defined(entity.polyline.positions)) {
|
|
6627
|
+
return entity.polyline.positions.getValue(Cesium$a.JulianDate.now());
|
|
6471
6628
|
}
|
|
6472
|
-
if (Cesium$
|
|
6473
|
-
const hierarchy = entity.polygon.hierarchy.getValue(Cesium$
|
|
6629
|
+
if (Cesium$a.defined(entity.polygon) && Cesium$a.defined(entity.polygon.hierarchy)) {
|
|
6630
|
+
const hierarchy = entity.polygon.hierarchy.getValue(Cesium$a.JulianDate.now());
|
|
6474
6631
|
return hierarchy ? hierarchy.positions : [];
|
|
6475
6632
|
}
|
|
6476
6633
|
return [];
|
|
@@ -6535,7 +6692,7 @@ class SelectTool extends BaseTool {
|
|
|
6535
6692
|
}
|
|
6536
6693
|
}
|
|
6537
6694
|
|
|
6538
|
-
const Cesium$
|
|
6695
|
+
const Cesium$9 = getCesium();
|
|
6539
6696
|
|
|
6540
6697
|
/**
|
|
6541
6698
|
* 删除模式枚举
|
|
@@ -6586,7 +6743,7 @@ class DeleteTool extends BaseTool {
|
|
|
6586
6743
|
|
|
6587
6744
|
const picked = this._viewer.scene.pick(screenPos);
|
|
6588
6745
|
|
|
6589
|
-
if (Cesium$
|
|
6746
|
+
if (Cesium$9.defined(picked) && Cesium$9.defined(picked.id)) {
|
|
6590
6747
|
const entityId = picked.id.id;
|
|
6591
6748
|
|
|
6592
6749
|
// 忽略临时图元
|
|
@@ -6610,7 +6767,7 @@ class DeleteTool extends BaseTool {
|
|
|
6610
6767
|
|
|
6611
6768
|
let hoveredId = null;
|
|
6612
6769
|
|
|
6613
|
-
if (Cesium$
|
|
6770
|
+
if (Cesium$9.defined(picked) && Cesium$9.defined(picked.id)) {
|
|
6614
6771
|
const entityId = picked.id.id;
|
|
6615
6772
|
if (!entityId.startsWith('__temp_') && !entityId.startsWith('__edit_handle_')) {
|
|
6616
6773
|
hoveredId = entityId;
|
|
@@ -6690,7 +6847,7 @@ class DeleteTool extends BaseTool {
|
|
|
6690
6847
|
const styleKey = entityId;
|
|
6691
6848
|
|
|
6692
6849
|
// 红色高亮表示可删除,先保存原始样式
|
|
6693
|
-
if (Cesium$
|
|
6850
|
+
if (Cesium$9.defined(entity.point)) {
|
|
6694
6851
|
if (!this._originalStyles.has(styleKey)) {
|
|
6695
6852
|
this._originalStyles.set(styleKey, {
|
|
6696
6853
|
point: {
|
|
@@ -6699,11 +6856,11 @@ class DeleteTool extends BaseTool {
|
|
|
6699
6856
|
}
|
|
6700
6857
|
});
|
|
6701
6858
|
}
|
|
6702
|
-
entity.point.outlineColor = Cesium$
|
|
6859
|
+
entity.point.outlineColor = Cesium$9.Color.RED;
|
|
6703
6860
|
entity.point.outlineWidth = 3;
|
|
6704
6861
|
}
|
|
6705
6862
|
|
|
6706
|
-
if (Cesium$
|
|
6863
|
+
if (Cesium$9.defined(entity.polyline)) {
|
|
6707
6864
|
if (!this._originalStyles.has(styleKey)) {
|
|
6708
6865
|
this._originalStyles.set(styleKey, {
|
|
6709
6866
|
polyline: {
|
|
@@ -6711,10 +6868,10 @@ class DeleteTool extends BaseTool {
|
|
|
6711
6868
|
}
|
|
6712
6869
|
});
|
|
6713
6870
|
}
|
|
6714
|
-
entity.polyline.material = Cesium$
|
|
6871
|
+
entity.polyline.material = Cesium$9.Color.RED;
|
|
6715
6872
|
}
|
|
6716
6873
|
|
|
6717
|
-
if (Cesium$
|
|
6874
|
+
if (Cesium$9.defined(entity.polygon)) {
|
|
6718
6875
|
if (!this._originalStyles.has(styleKey)) {
|
|
6719
6876
|
this._originalStyles.set(styleKey, {
|
|
6720
6877
|
polygon: {
|
|
@@ -6722,7 +6879,7 @@ class DeleteTool extends BaseTool {
|
|
|
6722
6879
|
}
|
|
6723
6880
|
});
|
|
6724
6881
|
}
|
|
6725
|
-
entity.polygon.outlineColor = Cesium$
|
|
6882
|
+
entity.polygon.outlineColor = Cesium$9.Color.RED;
|
|
6726
6883
|
}
|
|
6727
6884
|
|
|
6728
6885
|
// 更改鼠标样式
|
|
@@ -6739,22 +6896,22 @@ class DeleteTool extends BaseTool {
|
|
|
6739
6896
|
const original = styleKey ? this._originalStyles.get(styleKey) : null;
|
|
6740
6897
|
|
|
6741
6898
|
// 恢复原始样式
|
|
6742
|
-
if (Cesium$
|
|
6899
|
+
if (Cesium$9.defined(entity.point)) {
|
|
6743
6900
|
if (original?.point) {
|
|
6744
6901
|
entity.point.outlineColor = original.point.outlineColor;
|
|
6745
6902
|
entity.point.outlineWidth = original.point.outlineWidth;
|
|
6746
6903
|
} else {
|
|
6747
|
-
entity.point.outlineColor = Cesium$
|
|
6904
|
+
entity.point.outlineColor = Cesium$9.Color.WHITE;
|
|
6748
6905
|
entity.point.outlineWidth = 1;
|
|
6749
6906
|
}
|
|
6750
6907
|
}
|
|
6751
6908
|
|
|
6752
|
-
if (Cesium$
|
|
6753
|
-
entity.polyline.material = original?.polyline?.material || Cesium$
|
|
6909
|
+
if (Cesium$9.defined(entity.polyline)) {
|
|
6910
|
+
entity.polyline.material = original?.polyline?.material || Cesium$9.Color.BLUE;
|
|
6754
6911
|
}
|
|
6755
6912
|
|
|
6756
|
-
if (Cesium$
|
|
6757
|
-
entity.polygon.outlineColor = original?.polygon?.outlineColor || Cesium$
|
|
6913
|
+
if (Cesium$9.defined(entity.polygon)) {
|
|
6914
|
+
entity.polygon.outlineColor = original?.polygon?.outlineColor || Cesium$9.Color.WHITE;
|
|
6758
6915
|
}
|
|
6759
6916
|
|
|
6760
6917
|
// 恢复鼠标样式
|
|
@@ -6788,7 +6945,7 @@ class DeleteTool extends BaseTool {
|
|
|
6788
6945
|
}
|
|
6789
6946
|
}
|
|
6790
6947
|
|
|
6791
|
-
const Cesium$
|
|
6948
|
+
const Cesium$8 = getCesium();
|
|
6792
6949
|
|
|
6793
6950
|
/**
|
|
6794
6951
|
* 地理计算工具(距离、面积、高程)
|
|
@@ -6801,9 +6958,9 @@ class GeoCalcUtil {
|
|
|
6801
6958
|
* @returns {number} 距离
|
|
6802
6959
|
*/
|
|
6803
6960
|
static calcDistance(point1, point2) {
|
|
6804
|
-
const coord1 = Cesium$
|
|
6805
|
-
const coord2 = Cesium$
|
|
6806
|
-
return Cesium$
|
|
6961
|
+
const coord1 = Cesium$8.Cartesian3.fromDegrees(...point1);
|
|
6962
|
+
const coord2 = Cesium$8.Cartesian3.fromDegrees(...point2);
|
|
6963
|
+
return Cesium$8.Cartesian3.distance(coord1, coord2);
|
|
6807
6964
|
}
|
|
6808
6965
|
|
|
6809
6966
|
/**
|
|
@@ -6815,11 +6972,11 @@ class GeoCalcUtil {
|
|
|
6815
6972
|
static calcArea(points) {
|
|
6816
6973
|
if (!points || points.length < 3) return 0;
|
|
6817
6974
|
|
|
6818
|
-
const positions = points.map(p => Cesium$
|
|
6819
|
-
const polygon = new Cesium$
|
|
6820
|
-
polygonHierarchy: new Cesium$
|
|
6975
|
+
const positions = points.map(p => Cesium$8.Cartesian3.fromDegrees(p[0], p[1], p[2] || 0));
|
|
6976
|
+
const polygon = new Cesium$8.PolygonGeometry({
|
|
6977
|
+
polygonHierarchy: new Cesium$8.PolygonHierarchy(positions)
|
|
6821
6978
|
});
|
|
6822
|
-
const geometry = Cesium$
|
|
6979
|
+
const geometry = Cesium$8.PolygonGeometry.createGeometry(polygon);
|
|
6823
6980
|
|
|
6824
6981
|
if (!geometry || !geometry.attributes || !geometry.attributes.position) {
|
|
6825
6982
|
return 0;
|
|
@@ -6828,7 +6985,7 @@ class GeoCalcUtil {
|
|
|
6828
6985
|
const values = geometry.attributes.position.values;
|
|
6829
6986
|
const vertexPositions = [];
|
|
6830
6987
|
for (let i = 0; i < values.length; i += 3) {
|
|
6831
|
-
vertexPositions.push(new Cesium$
|
|
6988
|
+
vertexPositions.push(new Cesium$8.Cartesian3(values[i], values[i + 1], values[i + 2]));
|
|
6832
6989
|
}
|
|
6833
6990
|
|
|
6834
6991
|
// 球面多边形面积(基于单位球上的多边形面积公式)
|
|
@@ -6844,23 +7001,23 @@ class GeoCalcUtil {
|
|
|
6844
7001
|
* @returns {number} 面积(平方米)
|
|
6845
7002
|
*/
|
|
6846
7003
|
static #sphericalPolygonArea(positions) {
|
|
6847
|
-
const ellipsoid = Cesium$
|
|
7004
|
+
const ellipsoid = Cesium$8.Ellipsoid.WGS84;
|
|
6848
7005
|
const n = positions.length;
|
|
6849
7006
|
if (n < 3) return 0;
|
|
6850
7007
|
|
|
6851
7008
|
// 计算近似重心(归一化到椭球面)
|
|
6852
|
-
let center = new Cesium$
|
|
7009
|
+
let center = new Cesium$8.Cartesian3(0, 0, 0);
|
|
6853
7010
|
for (const p of positions) {
|
|
6854
|
-
center = Cesium$
|
|
7011
|
+
center = Cesium$8.Cartesian3.add(center, p, center);
|
|
6855
7012
|
}
|
|
6856
|
-
center = Cesium$
|
|
6857
|
-
center = ellipsoid.scaleToGeodeticSurface(center, new Cesium$
|
|
7013
|
+
center = Cesium$8.Cartesian3.normalize(center, new Cesium$8.Cartesian3());
|
|
7014
|
+
center = ellipsoid.scaleToGeodeticSurface(center, new Cesium$8.Cartesian3()) || center;
|
|
6858
7015
|
|
|
6859
7016
|
// 在重心处建立东北天(ENU)局部坐标系
|
|
6860
|
-
const tangentPlane = new Cesium$
|
|
7017
|
+
const tangentPlane = new Cesium$8.EllipsoidTangentPlane(center, ellipsoid);
|
|
6861
7018
|
|
|
6862
7019
|
// 投影到切平面
|
|
6863
|
-
const projected = positions.map(p => tangentPlane.projectPointOntoPlane(p, new Cesium$
|
|
7020
|
+
const projected = positions.map(p => tangentPlane.projectPointOntoPlane(p, new Cesium$8.Cartesian2()));
|
|
6864
7021
|
|
|
6865
7022
|
// 计算二维多边形面积(Shoelace 公式)
|
|
6866
7023
|
let area2 = 0;
|
|
@@ -6880,521 +7037,521 @@ class GeoCalcUtil {
|
|
|
6880
7037
|
* @returns {Promise<number>} 高程值
|
|
6881
7038
|
*/
|
|
6882
7039
|
static async getHeight(viewer, coord) {
|
|
6883
|
-
const cartographic = Cesium$
|
|
6884
|
-
const results = await Cesium$
|
|
7040
|
+
const cartographic = Cesium$8.Cartographic.fromDegrees(coord[0], coord[1]);
|
|
7041
|
+
const results = await Cesium$8.sampleTerrainMostDetailed(viewer.terrainProvider, [cartographic]);
|
|
6885
7042
|
return results[0]?.height ?? 0;
|
|
6886
7043
|
}
|
|
6887
7044
|
}
|
|
6888
7045
|
|
|
6889
|
-
const Cesium$
|
|
6890
|
-
|
|
6891
|
-
/**
|
|
6892
|
-
* 测量类型枚举
|
|
6893
|
-
*/
|
|
6894
|
-
const MeasureType = {
|
|
6895
|
-
DISTANCE: 'distance',
|
|
6896
|
-
AREA: 'area'
|
|
6897
|
-
};
|
|
6898
|
-
|
|
6899
|
-
/**
|
|
6900
|
-
* 测量工具
|
|
6901
|
-
* 支持交互式测距(折线)和测面积(多边形)。
|
|
6902
|
-
* 左键加点,右键 / Enter 完成,Esc 取消,Backspace 撤销上一点。
|
|
6903
|
-
*/
|
|
6904
|
-
class MeasureTool extends BaseTool {
|
|
6905
|
-
constructor(editorModule, options = {}) {
|
|
6906
|
-
super(editorModule, options);
|
|
6907
|
-
|
|
6908
|
-
this._measureType = options.measureType || MeasureType.DISTANCE;
|
|
6909
|
-
this._positions = []; // 已点击的经纬度点
|
|
6910
|
-
this._mousePos = null; // 当前鼠标位置(经纬度)
|
|
6911
|
-
this._isMeasuring = false; // 是否正在一次测量中
|
|
6912
|
-
this._lastResult = null; // 最后一次测量结果
|
|
6913
|
-
|
|
6914
|
-
// 临时图元引用
|
|
6915
|
-
this._pointEntities = []; // 点击点标记
|
|
6916
|
-
this._previewLine = null; // 测距预览线
|
|
6917
|
-
this._previewPolygon = null; // 测面积预览面
|
|
6918
|
-
this._previewOutline = null; // 测面积预览轮廓线
|
|
6919
|
-
this._previewCartesians = []; // 当前预览几何的笛卡尔坐标数组(CallbackProperty 共享引用)
|
|
6920
|
-
this._segmentLabelEntities = []; // 测距每段标注
|
|
6921
|
-
this._totalLabelEntity = null; // 总距离 / 面积标注
|
|
6922
|
-
|
|
6923
|
-
// 已完成的测量结果图元分组,支持一次激活中保留多个测量结果
|
|
6924
|
-
this._finishedResults = [];
|
|
6925
|
-
}
|
|
6926
|
-
|
|
6927
|
-
/**
|
|
6928
|
-
* 设置测量类型
|
|
6929
|
-
* @param {string} type MeasureType
|
|
6930
|
-
*/
|
|
6931
|
-
setMeasureType(type) {
|
|
6932
|
-
this._measureType = type;
|
|
6933
|
-
return this;
|
|
6934
|
-
}
|
|
6935
|
-
|
|
6936
|
-
/**
|
|
6937
|
-
* 获取当前测量类型
|
|
6938
|
-
*/
|
|
6939
|
-
getMeasureType() {
|
|
6940
|
-
return this._measureType;
|
|
6941
|
-
}
|
|
6942
|
-
|
|
6943
|
-
/**
|
|
6944
|
-
* 获取最后一次测量结果
|
|
6945
|
-
*/
|
|
6946
|
-
getLastResult() {
|
|
6947
|
-
return this._lastResult;
|
|
6948
|
-
}
|
|
6949
|
-
|
|
6950
|
-
onActivate() {
|
|
6951
|
-
this.registerObserver('mouse:click', this._onClick.bind(this));
|
|
6952
|
-
this.registerObserver('mouse:move', this._onMove.bind(this));
|
|
6953
|
-
this.registerObserver('mouse:rightclick', this._onRightClick.bind(this));
|
|
6954
|
-
this.registerObserver('keyboard:keydown', this._onKeyDown.bind(this));
|
|
6955
|
-
}
|
|
6956
|
-
|
|
6957
|
-
onDeactivate() {
|
|
6958
|
-
this.clearMeasurements();
|
|
6959
|
-
}
|
|
6960
|
-
|
|
6961
|
-
_onClick(lngLat) {
|
|
6962
|
-
if (!lngLat) return;
|
|
6963
|
-
|
|
6964
|
-
this._isMeasuring = true;
|
|
6965
|
-
this._positions.push(lngLat);
|
|
6966
|
-
this._addPointMarker(lngLat);
|
|
6967
|
-
this._updateMeasurement();
|
|
6968
|
-
}
|
|
6969
|
-
|
|
6970
|
-
_onMove(data) {
|
|
6971
|
-
const screenPos = data.position || data.endPosition;
|
|
6972
|
-
if (!screenPos) return;
|
|
6973
|
-
|
|
6974
|
-
const lonLat = this.screenToLonLat({ x: screenPos.x, y: screenPos.y });
|
|
6975
|
-
if (!lonLat) return;
|
|
6976
|
-
|
|
6977
|
-
this._mousePos = lonLat;
|
|
6978
|
-
if (this._isMeasuring) {
|
|
6979
|
-
this._updateMeasurement();
|
|
6980
|
-
}
|
|
6981
|
-
}
|
|
6982
|
-
|
|
6983
|
-
_onRightClick() {
|
|
6984
|
-
this._finishMeasurement();
|
|
6985
|
-
}
|
|
6986
|
-
|
|
6987
|
-
_onKeyDown(data) {
|
|
6988
|
-
if (data.key === 'Escape') {
|
|
6989
|
-
this.cancelMeasurement();
|
|
6990
|
-
return;
|
|
6991
|
-
}
|
|
6992
|
-
|
|
6993
|
-
if (data.key === 'Enter') {
|
|
6994
|
-
this._finishMeasurement();
|
|
6995
|
-
return;
|
|
6996
|
-
}
|
|
6997
|
-
|
|
6998
|
-
if (data.key === 'Backspace' && this._isMeasuring && this._positions.length > 0) {
|
|
6999
|
-
this._positions.pop();
|
|
7000
|
-
const lastPoint = this._pointEntities.pop();
|
|
7001
|
-
if (lastPoint) {
|
|
7002
|
-
this.removeTempEntity(lastPoint);
|
|
7003
|
-
}
|
|
7004
|
-
this._updateMeasurement();
|
|
7005
|
-
}
|
|
7006
|
-
}
|
|
7007
|
-
|
|
7008
|
-
/**
|
|
7009
|
-
* 完成当前测量
|
|
7010
|
-
*/
|
|
7011
|
-
_finishMeasurement() {
|
|
7012
|
-
const minPoints = this._measureType === MeasureType.AREA ? 3 : 2;
|
|
7013
|
-
if (this._positions.length < minPoints) return;
|
|
7014
|
-
|
|
7015
|
-
this._isMeasuring = false;
|
|
7016
|
-
this._mousePos = null;
|
|
7017
|
-
this._updateMeasurement();
|
|
7018
|
-
|
|
7019
|
-
const result = this._computeResult(this._positions);
|
|
7020
|
-
this._lastResult = result;
|
|
7021
|
-
|
|
7022
|
-
// 将当前测量结果保留在场景中,并清空工作态以便继续下一次测量
|
|
7023
|
-
this._commitCurrentResult();
|
|
7024
|
-
|
|
7025
|
-
this._emitMeasureComplete(result);
|
|
7026
|
-
}
|
|
7027
|
-
|
|
7028
|
-
/**
|
|
7029
|
-
* 把当前测量图元归档为已完成结果,重置工作态
|
|
7030
|
-
*/
|
|
7031
|
-
_commitCurrentResult() {
|
|
7032
|
-
const finalCartesians = this._previewCartesians.slice();
|
|
7033
|
-
|
|
7034
|
-
// 将动态 CallbackProperty 替换为常量几何,避免归档后随 _previewCartesians 变化而消失
|
|
7035
|
-
if (this._previewLine) {
|
|
7036
|
-
this._previewLine.polyline.positions = finalCartesians.length > 0 ? finalCartesians : [];
|
|
7037
|
-
}
|
|
7038
|
-
if (this._previewPolygon) {
|
|
7039
|
-
this._previewPolygon.polygon.hierarchy = finalCartesians.length >= 3
|
|
7040
|
-
? new Cesium$
|
|
7041
|
-
: new Cesium$
|
|
7042
|
-
}
|
|
7043
|
-
if (this._previewOutline) {
|
|
7044
|
-
this._previewOutline.polyline.positions = finalCartesians.length >= 3
|
|
7045
|
-
? [...finalCartesians, finalCartesians[0]]
|
|
7046
|
-
: [];
|
|
7047
|
-
}
|
|
7048
|
-
|
|
7049
|
-
this._finishedResults.push({
|
|
7050
|
-
pointEntities: this._pointEntities,
|
|
7051
|
-
segmentLabels: this._segmentLabelEntities,
|
|
7052
|
-
totalLabel: this._totalLabelEntity,
|
|
7053
|
-
previewLine: this._previewLine,
|
|
7054
|
-
previewPolygon: this._previewPolygon,
|
|
7055
|
-
previewOutline: this._previewOutline
|
|
7056
|
-
});
|
|
7057
|
-
|
|
7058
|
-
this._positions = [];
|
|
7059
|
-
this._mousePos = null;
|
|
7060
|
-
this._isMeasuring = false;
|
|
7061
|
-
this._previewCartesians = [];
|
|
7062
|
-
|
|
7063
|
-
this._pointEntities = [];
|
|
7064
|
-
this._segmentLabelEntities = [];
|
|
7065
|
-
this._totalLabelEntity = null;
|
|
7066
|
-
this._previewLine = null;
|
|
7067
|
-
this._previewPolygon = null;
|
|
7068
|
-
this._previewOutline = null;
|
|
7069
|
-
}
|
|
7070
|
-
|
|
7071
|
-
/**
|
|
7072
|
-
* 取消当前测量
|
|
7073
|
-
*/
|
|
7074
|
-
cancelMeasurement() {
|
|
7075
|
-
this.clearMeasurements();
|
|
7076
|
-
this._emitMeasureCancel();
|
|
7077
|
-
}
|
|
7078
|
-
|
|
7079
|
-
/**
|
|
7080
|
-
* 清空所有测量结果与临时图元
|
|
7081
|
-
*/
|
|
7082
|
-
clearMeasurements() {
|
|
7083
|
-
this._positions = [];
|
|
7084
|
-
this._mousePos = null;
|
|
7085
|
-
this._isMeasuring = false;
|
|
7086
|
-
this._lastResult = null;
|
|
7087
|
-
this._previewCartesians = [];
|
|
7088
|
-
|
|
7089
|
-
this._pointEntities.forEach(e => this.removeTempEntity(e));
|
|
7090
|
-
this._pointEntities = [];
|
|
7091
|
-
|
|
7092
|
-
this._segmentLabelEntities.forEach(e => this.removeTempEntity(e));
|
|
7093
|
-
this._segmentLabelEntities = [];
|
|
7094
|
-
|
|
7095
|
-
if (this._totalLabelEntity) {
|
|
7096
|
-
this.removeTempEntity(this._totalLabelEntity);
|
|
7097
|
-
this._totalLabelEntity = null;
|
|
7098
|
-
}
|
|
7099
|
-
|
|
7100
|
-
if (this._previewLine) {
|
|
7101
|
-
this.removeTempEntity(this._previewLine);
|
|
7102
|
-
this._previewLine = null;
|
|
7103
|
-
}
|
|
7104
|
-
|
|
7105
|
-
if (this._previewPolygon) {
|
|
7106
|
-
this.removeTempEntity(this._previewPolygon);
|
|
7107
|
-
this._previewPolygon = null;
|
|
7108
|
-
}
|
|
7109
|
-
|
|
7110
|
-
if (this._previewOutline) {
|
|
7111
|
-
this.removeTempEntity(this._previewOutline);
|
|
7112
|
-
this._previewOutline = null;
|
|
7113
|
-
}
|
|
7114
|
-
|
|
7115
|
-
this._finishedResults.forEach(group => {
|
|
7116
|
-
group.pointEntities.forEach(e => this.removeTempEntity(e));
|
|
7117
|
-
group.segmentLabels.forEach(e => this.removeTempEntity(e));
|
|
7118
|
-
if (group.totalLabel) this.removeTempEntity(group.totalLabel);
|
|
7119
|
-
if (group.previewLine) this.removeTempEntity(group.previewLine);
|
|
7120
|
-
if (group.previewPolygon) this.removeTempEntity(group.previewPolygon);
|
|
7121
|
-
if (group.previewOutline) this.removeTempEntity(group.previewOutline);
|
|
7122
|
-
});
|
|
7123
|
-
this._finishedResults = [];
|
|
7124
|
-
}
|
|
7125
|
-
|
|
7126
|
-
/**
|
|
7127
|
-
* 更新预览几何与标注
|
|
7128
|
-
*/
|
|
7129
|
-
_updateMeasurement() {
|
|
7130
|
-
if (this._positions.length === 0) return;
|
|
7131
|
-
|
|
7132
|
-
const positions = [...this._positions];
|
|
7133
|
-
if (this._isMeasuring && this._mousePos) {
|
|
7134
|
-
positions.push(this._mousePos);
|
|
7135
|
-
}
|
|
7136
|
-
|
|
7137
|
-
if (this._measureType === MeasureType.DISTANCE) {
|
|
7138
|
-
this._updateDistancePreview(positions);
|
|
7139
|
-
} else {
|
|
7140
|
-
this._updateAreaPreview(positions);
|
|
7141
|
-
}
|
|
7142
|
-
|
|
7143
|
-
if (this._isMeasuring) {
|
|
7144
|
-
this._emitMeasureProgress(this._computeResult(positions));
|
|
7145
|
-
}
|
|
7146
|
-
}
|
|
7147
|
-
|
|
7148
|
-
_updateDistancePreview(positions) {
|
|
7149
|
-
const cartesians = positions.length >= 2
|
|
7150
|
-
? positions.map(p => Cesium$
|
|
7151
|
-
: [];
|
|
7152
|
-
this._previewCartesians = cartesians;
|
|
7153
|
-
|
|
7154
|
-
// 预览线
|
|
7155
|
-
if (!this._previewLine) {
|
|
7156
|
-
this._previewLine = this.createTempEntity(this.generateId('measure_line'), {
|
|
7157
|
-
polyline: {
|
|
7158
|
-
positions: new Cesium$
|
|
7159
|
-
material: Cesium$
|
|
7160
|
-
width: 2,
|
|
7161
|
-
clampToGround: true
|
|
7162
|
-
}
|
|
7163
|
-
});
|
|
7164
|
-
}
|
|
7165
|
-
this._previewLine.show = cartesians.length >= 2;
|
|
7166
|
-
|
|
7167
|
-
// 每段标注
|
|
7168
|
-
const segmentCount = Math.max(0, positions.length - 1);
|
|
7169
|
-
this._ensureSegmentLabels(segmentCount);
|
|
7170
|
-
|
|
7171
|
-
let total = 0;
|
|
7172
|
-
for (let i = 0; i < segmentCount; i++) {
|
|
7173
|
-
const p1 = positions[i];
|
|
7174
|
-
const p2 = positions[i + 1];
|
|
7175
|
-
const dist = GeoCalcUtil.calcDistance(p1, p2);
|
|
7176
|
-
total += dist;
|
|
7177
|
-
|
|
7178
|
-
const mid = Cesium$
|
|
7179
|
-
Cesium$
|
|
7180
|
-
Cesium$
|
|
7181
|
-
new Cesium$
|
|
7182
|
-
);
|
|
7183
|
-
|
|
7184
|
-
const label = this._segmentLabelEntities[i];
|
|
7185
|
-
label.position = mid;
|
|
7186
|
-
label.label.text = this._formatDistance(dist).text;
|
|
7187
|
-
label.show = true;
|
|
7188
|
-
}
|
|
7189
|
-
|
|
7190
|
-
// 总距离标注
|
|
7191
|
-
const lastCartesian = cartesians[cartesians.length - 1];
|
|
7192
|
-
if (positions.length >= 2) {
|
|
7193
|
-
if (!this._totalLabelEntity) {
|
|
7194
|
-
this._totalLabelEntity = this._createLabelEntity(
|
|
7195
|
-
this.generateId('measure_total'),
|
|
7196
|
-
lastCartesian,
|
|
7197
|
-
`总长:${this._formatDistance(total).text}`
|
|
7198
|
-
);
|
|
7199
|
-
} else {
|
|
7200
|
-
this._totalLabelEntity.position = lastCartesian;
|
|
7201
|
-
this._totalLabelEntity.label.text = `总长:${this._formatDistance(total).text}`;
|
|
7202
|
-
this._totalLabelEntity.show = true;
|
|
7203
|
-
}
|
|
7204
|
-
} else if (this._totalLabelEntity) {
|
|
7205
|
-
this._totalLabelEntity.show = false;
|
|
7206
|
-
}
|
|
7207
|
-
}
|
|
7208
|
-
|
|
7209
|
-
_updateAreaPreview(positions) {
|
|
7210
|
-
const cartesians = positions.map(p => Cesium$
|
|
7211
|
-
this._previewCartesians = cartesians;
|
|
7212
|
-
|
|
7213
|
-
if (positions.length >= 3) {
|
|
7214
|
-
// 显示面 + 闭合轮廓
|
|
7215
|
-
if (!this._previewPolygon) {
|
|
7216
|
-
this._previewPolygon = this.createTempEntity(this.generateId('measure_polygon'), {
|
|
7217
|
-
polygon: {
|
|
7218
|
-
hierarchy: new Cesium$
|
|
7219
|
-
material: Cesium$
|
|
7220
|
-
outline: false
|
|
7221
|
-
}
|
|
7222
|
-
});
|
|
7223
|
-
this._previewOutline = this.createTempEntity(this.generateId('measure_outline'), {
|
|
7224
|
-
polyline: {
|
|
7225
|
-
positions: new Cesium$
|
|
7226
|
-
? [...this._previewCartesians, this._previewCartesians[0]]
|
|
7227
|
-
: [], false),
|
|
7228
|
-
material: Cesium$
|
|
7229
|
-
width: 2,
|
|
7230
|
-
clampToGround: true
|
|
7231
|
-
}
|
|
7232
|
-
});
|
|
7233
|
-
}
|
|
7234
|
-
this._previewPolygon.show = true;
|
|
7235
|
-
this._previewOutline.show = true;
|
|
7236
|
-
if (this._previewLine) {
|
|
7237
|
-
this._previewLine.show = false;
|
|
7238
|
-
}
|
|
7239
|
-
|
|
7240
|
-
const area = GeoCalcUtil.calcArea(positions);
|
|
7241
|
-
const centroid = this._computeCentroid(cartesians);
|
|
7242
|
-
|
|
7243
|
-
if (!this._totalLabelEntity) {
|
|
7244
|
-
this._totalLabelEntity = this._createLabelEntity(
|
|
7245
|
-
this.generateId('measure_area'),
|
|
7246
|
-
centroid,
|
|
7247
|
-
`面积:${this._formatArea(area).text}`
|
|
7248
|
-
);
|
|
7249
|
-
} else {
|
|
7250
|
-
this._totalLabelEntity.position = centroid;
|
|
7251
|
-
this._totalLabelEntity.label.text = `面积:${this._formatArea(area).text}`;
|
|
7252
|
-
this._totalLabelEntity.show = true;
|
|
7253
|
-
}
|
|
7254
|
-
} else {
|
|
7255
|
-
// 不足 3 点时只显示连线,并隐藏已有的面、轮廓、面积标注
|
|
7256
|
-
if (this._previewPolygon) {
|
|
7257
|
-
this._previewPolygon.show = false;
|
|
7258
|
-
}
|
|
7259
|
-
if (this._previewOutline) {
|
|
7260
|
-
this._previewOutline.show = false;
|
|
7261
|
-
}
|
|
7262
|
-
if (this._totalLabelEntity) {
|
|
7263
|
-
this._totalLabelEntity.show = false;
|
|
7264
|
-
}
|
|
7265
|
-
|
|
7266
|
-
if (!this._previewLine) {
|
|
7267
|
-
this._previewLine = this.createTempEntity(this.generateId('measure_line'), {
|
|
7268
|
-
polyline: {
|
|
7269
|
-
positions: new Cesium$
|
|
7270
|
-
material: Cesium$
|
|
7271
|
-
width: 2,
|
|
7272
|
-
clampToGround: true
|
|
7273
|
-
}
|
|
7274
|
-
});
|
|
7275
|
-
}
|
|
7276
|
-
this._previewLine.show = positions.length >= 2;
|
|
7277
|
-
}
|
|
7278
|
-
}
|
|
7279
|
-
|
|
7280
|
-
_ensureSegmentLabels(count) {
|
|
7281
|
-
// 移除多余的标注
|
|
7282
|
-
while (this._segmentLabelEntities.length > count) {
|
|
7283
|
-
const label = this._segmentLabelEntities.pop();
|
|
7284
|
-
this.removeTempEntity(label);
|
|
7285
|
-
}
|
|
7286
|
-
|
|
7287
|
-
// 创建缺少的标注
|
|
7288
|
-
while (this._segmentLabelEntities.length < count) {
|
|
7289
|
-
const label = this._createLabelEntity(
|
|
7290
|
-
this.generateId('measure_segment'),
|
|
7291
|
-
Cesium$
|
|
7292
|
-
''
|
|
7293
|
-
);
|
|
7294
|
-
this._segmentLabelEntities.push(label);
|
|
7295
|
-
}
|
|
7296
|
-
}
|
|
7297
|
-
|
|
7298
|
-
_createLabelEntity(id, position, text) {
|
|
7299
|
-
return this.createTempEntity(id, {
|
|
7300
|
-
position,
|
|
7301
|
-
label: {
|
|
7302
|
-
text,
|
|
7303
|
-
font: '14px Microsoft YaHei',
|
|
7304
|
-
fillColor: Cesium$
|
|
7305
|
-
outlineColor: Cesium$
|
|
7306
|
-
outlineWidth: 2,
|
|
7307
|
-
style: Cesium$
|
|
7308
|
-
verticalOrigin: Cesium$
|
|
7309
|
-
horizontalOrigin: Cesium$
|
|
7310
|
-
heightReference: Cesium$
|
|
7311
|
-
disableDepthTestDistance: Number.POSITIVE_INFINITY,
|
|
7312
|
-
pixelOffset: new Cesium$
|
|
7313
|
-
}
|
|
7314
|
-
});
|
|
7315
|
-
}
|
|
7316
|
-
|
|
7317
|
-
_addPointMarker(lonLat) {
|
|
7318
|
-
const point = this.createTempEntity(this.generateId('measure_point'), {
|
|
7319
|
-
position: Cesium$
|
|
7320
|
-
point: {
|
|
7321
|
-
color: Cesium$
|
|
7322
|
-
pixelSize: 8,
|
|
7323
|
-
outlineColor: Cesium$
|
|
7324
|
-
outlineWidth: 1,
|
|
7325
|
-
heightReference: Cesium$
|
|
7326
|
-
disableDepthTestDistance: Number.POSITIVE_INFINITY
|
|
7327
|
-
}
|
|
7328
|
-
});
|
|
7329
|
-
this._pointEntities.push(point);
|
|
7330
|
-
}
|
|
7331
|
-
|
|
7332
|
-
_computeResult(positions) {
|
|
7333
|
-
if (this._measureType === MeasureType.DISTANCE) {
|
|
7334
|
-
let total = 0;
|
|
7335
|
-
for (let i = 0; i < positions.length - 1; i++) {
|
|
7336
|
-
total += GeoCalcUtil.calcDistance(positions[i], positions[i + 1]);
|
|
7337
|
-
}
|
|
7338
|
-
const fmt = this._formatDistance(total);
|
|
7339
|
-
return {
|
|
7340
|
-
type: MeasureType.DISTANCE,
|
|
7341
|
-
value: total,
|
|
7342
|
-
unit: fmt.unit,
|
|
7343
|
-
formatted: fmt.text,
|
|
7344
|
-
positions: positions.slice()
|
|
7345
|
-
};
|
|
7346
|
-
}
|
|
7347
|
-
|
|
7348
|
-
const area = GeoCalcUtil.calcArea(positions);
|
|
7349
|
-
const fmt = this._formatArea(area);
|
|
7350
|
-
return {
|
|
7351
|
-
type: MeasureType.AREA,
|
|
7352
|
-
value: area,
|
|
7353
|
-
unit: fmt.unit,
|
|
7354
|
-
formatted: fmt.text,
|
|
7355
|
-
positions: positions.slice()
|
|
7356
|
-
};
|
|
7357
|
-
}
|
|
7358
|
-
|
|
7359
|
-
_computeCentroid(cartesians) {
|
|
7360
|
-
const center = new Cesium$
|
|
7361
|
-
for (const c of cartesians) {
|
|
7362
|
-
Cesium$
|
|
7363
|
-
}
|
|
7364
|
-
return Cesium$
|
|
7365
|
-
}
|
|
7366
|
-
|
|
7367
|
-
_formatDistance(meters) {
|
|
7368
|
-
if (meters >= 1000) {
|
|
7369
|
-
return { text: `${(meters / 1000).toFixed(2)} km`, unit: 'km' };
|
|
7370
|
-
}
|
|
7371
|
-
return { text: `${meters.toFixed(2)} m`, unit: 'm' };
|
|
7372
|
-
}
|
|
7373
|
-
|
|
7374
|
-
_formatArea(squareMeters) {
|
|
7375
|
-
if (squareMeters >= 1000000) {
|
|
7376
|
-
return { text: `${(squareMeters / 1000000).toFixed(3)} km²`, unit: 'km²' };
|
|
7377
|
-
}
|
|
7378
|
-
return { text: `${squareMeters.toFixed(2)} m²`, unit: 'm²' };
|
|
7379
|
-
}
|
|
7380
|
-
|
|
7381
|
-
_emitMeasureProgress(result) {
|
|
7382
|
-
if (this._options.onMeasureProgress) {
|
|
7383
|
-
this._options.onMeasureProgress(result);
|
|
7384
|
-
}
|
|
7385
|
-
}
|
|
7386
|
-
|
|
7387
|
-
_emitMeasureComplete(result) {
|
|
7388
|
-
if (this._options.onMeasureComplete) {
|
|
7389
|
-
this._options.onMeasureComplete(result);
|
|
7390
|
-
}
|
|
7391
|
-
}
|
|
7392
|
-
|
|
7393
|
-
_emitMeasureCancel() {
|
|
7394
|
-
if (this._options.onMeasureCancel) {
|
|
7395
|
-
this._options.onMeasureCancel();
|
|
7396
|
-
}
|
|
7397
|
-
}
|
|
7046
|
+
const Cesium$7 = getCesium();
|
|
7047
|
+
|
|
7048
|
+
/**
|
|
7049
|
+
* 测量类型枚举
|
|
7050
|
+
*/
|
|
7051
|
+
const MeasureType = {
|
|
7052
|
+
DISTANCE: 'distance',
|
|
7053
|
+
AREA: 'area'
|
|
7054
|
+
};
|
|
7055
|
+
|
|
7056
|
+
/**
|
|
7057
|
+
* 测量工具
|
|
7058
|
+
* 支持交互式测距(折线)和测面积(多边形)。
|
|
7059
|
+
* 左键加点,右键 / Enter 完成,Esc 取消,Backspace 撤销上一点。
|
|
7060
|
+
*/
|
|
7061
|
+
class MeasureTool extends BaseTool {
|
|
7062
|
+
constructor(editorModule, options = {}) {
|
|
7063
|
+
super(editorModule, options);
|
|
7064
|
+
|
|
7065
|
+
this._measureType = options.measureType || MeasureType.DISTANCE;
|
|
7066
|
+
this._positions = []; // 已点击的经纬度点
|
|
7067
|
+
this._mousePos = null; // 当前鼠标位置(经纬度)
|
|
7068
|
+
this._isMeasuring = false; // 是否正在一次测量中
|
|
7069
|
+
this._lastResult = null; // 最后一次测量结果
|
|
7070
|
+
|
|
7071
|
+
// 临时图元引用
|
|
7072
|
+
this._pointEntities = []; // 点击点标记
|
|
7073
|
+
this._previewLine = null; // 测距预览线
|
|
7074
|
+
this._previewPolygon = null; // 测面积预览面
|
|
7075
|
+
this._previewOutline = null; // 测面积预览轮廓线
|
|
7076
|
+
this._previewCartesians = []; // 当前预览几何的笛卡尔坐标数组(CallbackProperty 共享引用)
|
|
7077
|
+
this._segmentLabelEntities = []; // 测距每段标注
|
|
7078
|
+
this._totalLabelEntity = null; // 总距离 / 面积标注
|
|
7079
|
+
|
|
7080
|
+
// 已完成的测量结果图元分组,支持一次激活中保留多个测量结果
|
|
7081
|
+
this._finishedResults = [];
|
|
7082
|
+
}
|
|
7083
|
+
|
|
7084
|
+
/**
|
|
7085
|
+
* 设置测量类型
|
|
7086
|
+
* @param {string} type MeasureType
|
|
7087
|
+
*/
|
|
7088
|
+
setMeasureType(type) {
|
|
7089
|
+
this._measureType = type;
|
|
7090
|
+
return this;
|
|
7091
|
+
}
|
|
7092
|
+
|
|
7093
|
+
/**
|
|
7094
|
+
* 获取当前测量类型
|
|
7095
|
+
*/
|
|
7096
|
+
getMeasureType() {
|
|
7097
|
+
return this._measureType;
|
|
7098
|
+
}
|
|
7099
|
+
|
|
7100
|
+
/**
|
|
7101
|
+
* 获取最后一次测量结果
|
|
7102
|
+
*/
|
|
7103
|
+
getLastResult() {
|
|
7104
|
+
return this._lastResult;
|
|
7105
|
+
}
|
|
7106
|
+
|
|
7107
|
+
onActivate() {
|
|
7108
|
+
this.registerObserver('mouse:click', this._onClick.bind(this));
|
|
7109
|
+
this.registerObserver('mouse:move', this._onMove.bind(this));
|
|
7110
|
+
this.registerObserver('mouse:rightclick', this._onRightClick.bind(this));
|
|
7111
|
+
this.registerObserver('keyboard:keydown', this._onKeyDown.bind(this));
|
|
7112
|
+
}
|
|
7113
|
+
|
|
7114
|
+
onDeactivate() {
|
|
7115
|
+
this.clearMeasurements();
|
|
7116
|
+
}
|
|
7117
|
+
|
|
7118
|
+
_onClick(lngLat) {
|
|
7119
|
+
if (!lngLat) return;
|
|
7120
|
+
|
|
7121
|
+
this._isMeasuring = true;
|
|
7122
|
+
this._positions.push(lngLat);
|
|
7123
|
+
this._addPointMarker(lngLat);
|
|
7124
|
+
this._updateMeasurement();
|
|
7125
|
+
}
|
|
7126
|
+
|
|
7127
|
+
_onMove(data) {
|
|
7128
|
+
const screenPos = data.position || data.endPosition;
|
|
7129
|
+
if (!screenPos) return;
|
|
7130
|
+
|
|
7131
|
+
const lonLat = this.screenToLonLat({ x: screenPos.x, y: screenPos.y });
|
|
7132
|
+
if (!lonLat) return;
|
|
7133
|
+
|
|
7134
|
+
this._mousePos = lonLat;
|
|
7135
|
+
if (this._isMeasuring) {
|
|
7136
|
+
this._updateMeasurement();
|
|
7137
|
+
}
|
|
7138
|
+
}
|
|
7139
|
+
|
|
7140
|
+
_onRightClick() {
|
|
7141
|
+
this._finishMeasurement();
|
|
7142
|
+
}
|
|
7143
|
+
|
|
7144
|
+
_onKeyDown(data) {
|
|
7145
|
+
if (data.key === 'Escape') {
|
|
7146
|
+
this.cancelMeasurement();
|
|
7147
|
+
return;
|
|
7148
|
+
}
|
|
7149
|
+
|
|
7150
|
+
if (data.key === 'Enter') {
|
|
7151
|
+
this._finishMeasurement();
|
|
7152
|
+
return;
|
|
7153
|
+
}
|
|
7154
|
+
|
|
7155
|
+
if (data.key === 'Backspace' && this._isMeasuring && this._positions.length > 0) {
|
|
7156
|
+
this._positions.pop();
|
|
7157
|
+
const lastPoint = this._pointEntities.pop();
|
|
7158
|
+
if (lastPoint) {
|
|
7159
|
+
this.removeTempEntity(lastPoint);
|
|
7160
|
+
}
|
|
7161
|
+
this._updateMeasurement();
|
|
7162
|
+
}
|
|
7163
|
+
}
|
|
7164
|
+
|
|
7165
|
+
/**
|
|
7166
|
+
* 完成当前测量
|
|
7167
|
+
*/
|
|
7168
|
+
_finishMeasurement() {
|
|
7169
|
+
const minPoints = this._measureType === MeasureType.AREA ? 3 : 2;
|
|
7170
|
+
if (this._positions.length < minPoints) return;
|
|
7171
|
+
|
|
7172
|
+
this._isMeasuring = false;
|
|
7173
|
+
this._mousePos = null;
|
|
7174
|
+
this._updateMeasurement();
|
|
7175
|
+
|
|
7176
|
+
const result = this._computeResult(this._positions);
|
|
7177
|
+
this._lastResult = result;
|
|
7178
|
+
|
|
7179
|
+
// 将当前测量结果保留在场景中,并清空工作态以便继续下一次测量
|
|
7180
|
+
this._commitCurrentResult();
|
|
7181
|
+
|
|
7182
|
+
this._emitMeasureComplete(result);
|
|
7183
|
+
}
|
|
7184
|
+
|
|
7185
|
+
/**
|
|
7186
|
+
* 把当前测量图元归档为已完成结果,重置工作态
|
|
7187
|
+
*/
|
|
7188
|
+
_commitCurrentResult() {
|
|
7189
|
+
const finalCartesians = this._previewCartesians.slice();
|
|
7190
|
+
|
|
7191
|
+
// 将动态 CallbackProperty 替换为常量几何,避免归档后随 _previewCartesians 变化而消失
|
|
7192
|
+
if (this._previewLine) {
|
|
7193
|
+
this._previewLine.polyline.positions = finalCartesians.length > 0 ? finalCartesians : [];
|
|
7194
|
+
}
|
|
7195
|
+
if (this._previewPolygon) {
|
|
7196
|
+
this._previewPolygon.polygon.hierarchy = finalCartesians.length >= 3
|
|
7197
|
+
? new Cesium$7.PolygonHierarchy(finalCartesians)
|
|
7198
|
+
: new Cesium$7.PolygonHierarchy([]);
|
|
7199
|
+
}
|
|
7200
|
+
if (this._previewOutline) {
|
|
7201
|
+
this._previewOutline.polyline.positions = finalCartesians.length >= 3
|
|
7202
|
+
? [...finalCartesians, finalCartesians[0]]
|
|
7203
|
+
: [];
|
|
7204
|
+
}
|
|
7205
|
+
|
|
7206
|
+
this._finishedResults.push({
|
|
7207
|
+
pointEntities: this._pointEntities,
|
|
7208
|
+
segmentLabels: this._segmentLabelEntities,
|
|
7209
|
+
totalLabel: this._totalLabelEntity,
|
|
7210
|
+
previewLine: this._previewLine,
|
|
7211
|
+
previewPolygon: this._previewPolygon,
|
|
7212
|
+
previewOutline: this._previewOutline
|
|
7213
|
+
});
|
|
7214
|
+
|
|
7215
|
+
this._positions = [];
|
|
7216
|
+
this._mousePos = null;
|
|
7217
|
+
this._isMeasuring = false;
|
|
7218
|
+
this._previewCartesians = [];
|
|
7219
|
+
|
|
7220
|
+
this._pointEntities = [];
|
|
7221
|
+
this._segmentLabelEntities = [];
|
|
7222
|
+
this._totalLabelEntity = null;
|
|
7223
|
+
this._previewLine = null;
|
|
7224
|
+
this._previewPolygon = null;
|
|
7225
|
+
this._previewOutline = null;
|
|
7226
|
+
}
|
|
7227
|
+
|
|
7228
|
+
/**
|
|
7229
|
+
* 取消当前测量
|
|
7230
|
+
*/
|
|
7231
|
+
cancelMeasurement() {
|
|
7232
|
+
this.clearMeasurements();
|
|
7233
|
+
this._emitMeasureCancel();
|
|
7234
|
+
}
|
|
7235
|
+
|
|
7236
|
+
/**
|
|
7237
|
+
* 清空所有测量结果与临时图元
|
|
7238
|
+
*/
|
|
7239
|
+
clearMeasurements() {
|
|
7240
|
+
this._positions = [];
|
|
7241
|
+
this._mousePos = null;
|
|
7242
|
+
this._isMeasuring = false;
|
|
7243
|
+
this._lastResult = null;
|
|
7244
|
+
this._previewCartesians = [];
|
|
7245
|
+
|
|
7246
|
+
this._pointEntities.forEach(e => this.removeTempEntity(e));
|
|
7247
|
+
this._pointEntities = [];
|
|
7248
|
+
|
|
7249
|
+
this._segmentLabelEntities.forEach(e => this.removeTempEntity(e));
|
|
7250
|
+
this._segmentLabelEntities = [];
|
|
7251
|
+
|
|
7252
|
+
if (this._totalLabelEntity) {
|
|
7253
|
+
this.removeTempEntity(this._totalLabelEntity);
|
|
7254
|
+
this._totalLabelEntity = null;
|
|
7255
|
+
}
|
|
7256
|
+
|
|
7257
|
+
if (this._previewLine) {
|
|
7258
|
+
this.removeTempEntity(this._previewLine);
|
|
7259
|
+
this._previewLine = null;
|
|
7260
|
+
}
|
|
7261
|
+
|
|
7262
|
+
if (this._previewPolygon) {
|
|
7263
|
+
this.removeTempEntity(this._previewPolygon);
|
|
7264
|
+
this._previewPolygon = null;
|
|
7265
|
+
}
|
|
7266
|
+
|
|
7267
|
+
if (this._previewOutline) {
|
|
7268
|
+
this.removeTempEntity(this._previewOutline);
|
|
7269
|
+
this._previewOutline = null;
|
|
7270
|
+
}
|
|
7271
|
+
|
|
7272
|
+
this._finishedResults.forEach(group => {
|
|
7273
|
+
group.pointEntities.forEach(e => this.removeTempEntity(e));
|
|
7274
|
+
group.segmentLabels.forEach(e => this.removeTempEntity(e));
|
|
7275
|
+
if (group.totalLabel) this.removeTempEntity(group.totalLabel);
|
|
7276
|
+
if (group.previewLine) this.removeTempEntity(group.previewLine);
|
|
7277
|
+
if (group.previewPolygon) this.removeTempEntity(group.previewPolygon);
|
|
7278
|
+
if (group.previewOutline) this.removeTempEntity(group.previewOutline);
|
|
7279
|
+
});
|
|
7280
|
+
this._finishedResults = [];
|
|
7281
|
+
}
|
|
7282
|
+
|
|
7283
|
+
/**
|
|
7284
|
+
* 更新预览几何与标注
|
|
7285
|
+
*/
|
|
7286
|
+
_updateMeasurement() {
|
|
7287
|
+
if (this._positions.length === 0) return;
|
|
7288
|
+
|
|
7289
|
+
const positions = [...this._positions];
|
|
7290
|
+
if (this._isMeasuring && this._mousePos) {
|
|
7291
|
+
positions.push(this._mousePos);
|
|
7292
|
+
}
|
|
7293
|
+
|
|
7294
|
+
if (this._measureType === MeasureType.DISTANCE) {
|
|
7295
|
+
this._updateDistancePreview(positions);
|
|
7296
|
+
} else {
|
|
7297
|
+
this._updateAreaPreview(positions);
|
|
7298
|
+
}
|
|
7299
|
+
|
|
7300
|
+
if (this._isMeasuring) {
|
|
7301
|
+
this._emitMeasureProgress(this._computeResult(positions));
|
|
7302
|
+
}
|
|
7303
|
+
}
|
|
7304
|
+
|
|
7305
|
+
_updateDistancePreview(positions) {
|
|
7306
|
+
const cartesians = positions.length >= 2
|
|
7307
|
+
? positions.map(p => Cesium$7.Cartesian3.fromDegrees(...p))
|
|
7308
|
+
: [];
|
|
7309
|
+
this._previewCartesians = cartesians;
|
|
7310
|
+
|
|
7311
|
+
// 预览线
|
|
7312
|
+
if (!this._previewLine) {
|
|
7313
|
+
this._previewLine = this.createTempEntity(this.generateId('measure_line'), {
|
|
7314
|
+
polyline: {
|
|
7315
|
+
positions: new Cesium$7.CallbackProperty(() => this._previewCartesians, false),
|
|
7316
|
+
material: Cesium$7.Color.YELLOW,
|
|
7317
|
+
width: 2,
|
|
7318
|
+
clampToGround: true
|
|
7319
|
+
}
|
|
7320
|
+
});
|
|
7321
|
+
}
|
|
7322
|
+
this._previewLine.show = cartesians.length >= 2;
|
|
7323
|
+
|
|
7324
|
+
// 每段标注
|
|
7325
|
+
const segmentCount = Math.max(0, positions.length - 1);
|
|
7326
|
+
this._ensureSegmentLabels(segmentCount);
|
|
7327
|
+
|
|
7328
|
+
let total = 0;
|
|
7329
|
+
for (let i = 0; i < segmentCount; i++) {
|
|
7330
|
+
const p1 = positions[i];
|
|
7331
|
+
const p2 = positions[i + 1];
|
|
7332
|
+
const dist = GeoCalcUtil.calcDistance(p1, p2);
|
|
7333
|
+
total += dist;
|
|
7334
|
+
|
|
7335
|
+
const mid = Cesium$7.Cartesian3.midpoint(
|
|
7336
|
+
Cesium$7.Cartesian3.fromDegrees(...p1),
|
|
7337
|
+
Cesium$7.Cartesian3.fromDegrees(...p2),
|
|
7338
|
+
new Cesium$7.Cartesian3()
|
|
7339
|
+
);
|
|
7340
|
+
|
|
7341
|
+
const label = this._segmentLabelEntities[i];
|
|
7342
|
+
label.position = mid;
|
|
7343
|
+
label.label.text = this._formatDistance(dist).text;
|
|
7344
|
+
label.show = true;
|
|
7345
|
+
}
|
|
7346
|
+
|
|
7347
|
+
// 总距离标注
|
|
7348
|
+
const lastCartesian = cartesians[cartesians.length - 1];
|
|
7349
|
+
if (positions.length >= 2) {
|
|
7350
|
+
if (!this._totalLabelEntity) {
|
|
7351
|
+
this._totalLabelEntity = this._createLabelEntity(
|
|
7352
|
+
this.generateId('measure_total'),
|
|
7353
|
+
lastCartesian,
|
|
7354
|
+
`总长:${this._formatDistance(total).text}`
|
|
7355
|
+
);
|
|
7356
|
+
} else {
|
|
7357
|
+
this._totalLabelEntity.position = lastCartesian;
|
|
7358
|
+
this._totalLabelEntity.label.text = `总长:${this._formatDistance(total).text}`;
|
|
7359
|
+
this._totalLabelEntity.show = true;
|
|
7360
|
+
}
|
|
7361
|
+
} else if (this._totalLabelEntity) {
|
|
7362
|
+
this._totalLabelEntity.show = false;
|
|
7363
|
+
}
|
|
7364
|
+
}
|
|
7365
|
+
|
|
7366
|
+
_updateAreaPreview(positions) {
|
|
7367
|
+
const cartesians = positions.map(p => Cesium$7.Cartesian3.fromDegrees(...p));
|
|
7368
|
+
this._previewCartesians = cartesians;
|
|
7369
|
+
|
|
7370
|
+
if (positions.length >= 3) {
|
|
7371
|
+
// 显示面 + 闭合轮廓
|
|
7372
|
+
if (!this._previewPolygon) {
|
|
7373
|
+
this._previewPolygon = this.createTempEntity(this.generateId('measure_polygon'), {
|
|
7374
|
+
polygon: {
|
|
7375
|
+
hierarchy: new Cesium$7.CallbackProperty(() => new Cesium$7.PolygonHierarchy(this._previewCartesians), false),
|
|
7376
|
+
material: Cesium$7.Color.YELLOW.withAlpha(0.2),
|
|
7377
|
+
outline: false
|
|
7378
|
+
}
|
|
7379
|
+
});
|
|
7380
|
+
this._previewOutline = this.createTempEntity(this.generateId('measure_outline'), {
|
|
7381
|
+
polyline: {
|
|
7382
|
+
positions: new Cesium$7.CallbackProperty(() => this._previewCartesians.length > 0
|
|
7383
|
+
? [...this._previewCartesians, this._previewCartesians[0]]
|
|
7384
|
+
: [], false),
|
|
7385
|
+
material: Cesium$7.Color.YELLOW,
|
|
7386
|
+
width: 2,
|
|
7387
|
+
clampToGround: true
|
|
7388
|
+
}
|
|
7389
|
+
});
|
|
7390
|
+
}
|
|
7391
|
+
this._previewPolygon.show = true;
|
|
7392
|
+
this._previewOutline.show = true;
|
|
7393
|
+
if (this._previewLine) {
|
|
7394
|
+
this._previewLine.show = false;
|
|
7395
|
+
}
|
|
7396
|
+
|
|
7397
|
+
const area = GeoCalcUtil.calcArea(positions);
|
|
7398
|
+
const centroid = this._computeCentroid(cartesians);
|
|
7399
|
+
|
|
7400
|
+
if (!this._totalLabelEntity) {
|
|
7401
|
+
this._totalLabelEntity = this._createLabelEntity(
|
|
7402
|
+
this.generateId('measure_area'),
|
|
7403
|
+
centroid,
|
|
7404
|
+
`面积:${this._formatArea(area).text}`
|
|
7405
|
+
);
|
|
7406
|
+
} else {
|
|
7407
|
+
this._totalLabelEntity.position = centroid;
|
|
7408
|
+
this._totalLabelEntity.label.text = `面积:${this._formatArea(area).text}`;
|
|
7409
|
+
this._totalLabelEntity.show = true;
|
|
7410
|
+
}
|
|
7411
|
+
} else {
|
|
7412
|
+
// 不足 3 点时只显示连线,并隐藏已有的面、轮廓、面积标注
|
|
7413
|
+
if (this._previewPolygon) {
|
|
7414
|
+
this._previewPolygon.show = false;
|
|
7415
|
+
}
|
|
7416
|
+
if (this._previewOutline) {
|
|
7417
|
+
this._previewOutline.show = false;
|
|
7418
|
+
}
|
|
7419
|
+
if (this._totalLabelEntity) {
|
|
7420
|
+
this._totalLabelEntity.show = false;
|
|
7421
|
+
}
|
|
7422
|
+
|
|
7423
|
+
if (!this._previewLine) {
|
|
7424
|
+
this._previewLine = this.createTempEntity(this.generateId('measure_line'), {
|
|
7425
|
+
polyline: {
|
|
7426
|
+
positions: new Cesium$7.CallbackProperty(() => this._previewCartesians, false),
|
|
7427
|
+
material: Cesium$7.Color.YELLOW,
|
|
7428
|
+
width: 2,
|
|
7429
|
+
clampToGround: true
|
|
7430
|
+
}
|
|
7431
|
+
});
|
|
7432
|
+
}
|
|
7433
|
+
this._previewLine.show = positions.length >= 2;
|
|
7434
|
+
}
|
|
7435
|
+
}
|
|
7436
|
+
|
|
7437
|
+
_ensureSegmentLabels(count) {
|
|
7438
|
+
// 移除多余的标注
|
|
7439
|
+
while (this._segmentLabelEntities.length > count) {
|
|
7440
|
+
const label = this._segmentLabelEntities.pop();
|
|
7441
|
+
this.removeTempEntity(label);
|
|
7442
|
+
}
|
|
7443
|
+
|
|
7444
|
+
// 创建缺少的标注
|
|
7445
|
+
while (this._segmentLabelEntities.length < count) {
|
|
7446
|
+
const label = this._createLabelEntity(
|
|
7447
|
+
this.generateId('measure_segment'),
|
|
7448
|
+
Cesium$7.Cartesian3.ZERO,
|
|
7449
|
+
''
|
|
7450
|
+
);
|
|
7451
|
+
this._segmentLabelEntities.push(label);
|
|
7452
|
+
}
|
|
7453
|
+
}
|
|
7454
|
+
|
|
7455
|
+
_createLabelEntity(id, position, text) {
|
|
7456
|
+
return this.createTempEntity(id, {
|
|
7457
|
+
position,
|
|
7458
|
+
label: {
|
|
7459
|
+
text,
|
|
7460
|
+
font: '14px Microsoft YaHei',
|
|
7461
|
+
fillColor: Cesium$7.Color.WHITE,
|
|
7462
|
+
outlineColor: Cesium$7.Color.BLACK,
|
|
7463
|
+
outlineWidth: 2,
|
|
7464
|
+
style: Cesium$7.LabelStyle.FILL_AND_OUTLINE,
|
|
7465
|
+
verticalOrigin: Cesium$7.VerticalOrigin.BOTTOM,
|
|
7466
|
+
horizontalOrigin: Cesium$7.HorizontalOrigin.CENTER,
|
|
7467
|
+
heightReference: Cesium$7.HeightReference.CLAMP_TO_GROUND,
|
|
7468
|
+
disableDepthTestDistance: Number.POSITIVE_INFINITY,
|
|
7469
|
+
pixelOffset: new Cesium$7.Cartesian2(0, -10)
|
|
7470
|
+
}
|
|
7471
|
+
});
|
|
7472
|
+
}
|
|
7473
|
+
|
|
7474
|
+
_addPointMarker(lonLat) {
|
|
7475
|
+
const point = this.createTempEntity(this.generateId('measure_point'), {
|
|
7476
|
+
position: Cesium$7.Cartesian3.fromDegrees(...lonLat),
|
|
7477
|
+
point: {
|
|
7478
|
+
color: Cesium$7.Color.YELLOW,
|
|
7479
|
+
pixelSize: 8,
|
|
7480
|
+
outlineColor: Cesium$7.Color.BLACK,
|
|
7481
|
+
outlineWidth: 1,
|
|
7482
|
+
heightReference: Cesium$7.HeightReference.CLAMP_TO_GROUND,
|
|
7483
|
+
disableDepthTestDistance: Number.POSITIVE_INFINITY
|
|
7484
|
+
}
|
|
7485
|
+
});
|
|
7486
|
+
this._pointEntities.push(point);
|
|
7487
|
+
}
|
|
7488
|
+
|
|
7489
|
+
_computeResult(positions) {
|
|
7490
|
+
if (this._measureType === MeasureType.DISTANCE) {
|
|
7491
|
+
let total = 0;
|
|
7492
|
+
for (let i = 0; i < positions.length - 1; i++) {
|
|
7493
|
+
total += GeoCalcUtil.calcDistance(positions[i], positions[i + 1]);
|
|
7494
|
+
}
|
|
7495
|
+
const fmt = this._formatDistance(total);
|
|
7496
|
+
return {
|
|
7497
|
+
type: MeasureType.DISTANCE,
|
|
7498
|
+
value: total,
|
|
7499
|
+
unit: fmt.unit,
|
|
7500
|
+
formatted: fmt.text,
|
|
7501
|
+
positions: positions.slice()
|
|
7502
|
+
};
|
|
7503
|
+
}
|
|
7504
|
+
|
|
7505
|
+
const area = GeoCalcUtil.calcArea(positions);
|
|
7506
|
+
const fmt = this._formatArea(area);
|
|
7507
|
+
return {
|
|
7508
|
+
type: MeasureType.AREA,
|
|
7509
|
+
value: area,
|
|
7510
|
+
unit: fmt.unit,
|
|
7511
|
+
formatted: fmt.text,
|
|
7512
|
+
positions: positions.slice()
|
|
7513
|
+
};
|
|
7514
|
+
}
|
|
7515
|
+
|
|
7516
|
+
_computeCentroid(cartesians) {
|
|
7517
|
+
const center = new Cesium$7.Cartesian3(0, 0, 0);
|
|
7518
|
+
for (const c of cartesians) {
|
|
7519
|
+
Cesium$7.Cartesian3.add(center, c, center);
|
|
7520
|
+
}
|
|
7521
|
+
return Cesium$7.Cartesian3.multiplyByScalar(center, 1 / cartesians.length, center);
|
|
7522
|
+
}
|
|
7523
|
+
|
|
7524
|
+
_formatDistance(meters) {
|
|
7525
|
+
if (meters >= 1000) {
|
|
7526
|
+
return { text: `${(meters / 1000).toFixed(2)} km`, unit: 'km' };
|
|
7527
|
+
}
|
|
7528
|
+
return { text: `${meters.toFixed(2)} m`, unit: 'm' };
|
|
7529
|
+
}
|
|
7530
|
+
|
|
7531
|
+
_formatArea(squareMeters) {
|
|
7532
|
+
if (squareMeters >= 1000000) {
|
|
7533
|
+
return { text: `${(squareMeters / 1000000).toFixed(3)} km²`, unit: 'km²' };
|
|
7534
|
+
}
|
|
7535
|
+
return { text: `${squareMeters.toFixed(2)} m²`, unit: 'm²' };
|
|
7536
|
+
}
|
|
7537
|
+
|
|
7538
|
+
_emitMeasureProgress(result) {
|
|
7539
|
+
if (this._options.onMeasureProgress) {
|
|
7540
|
+
this._options.onMeasureProgress(result);
|
|
7541
|
+
}
|
|
7542
|
+
}
|
|
7543
|
+
|
|
7544
|
+
_emitMeasureComplete(result) {
|
|
7545
|
+
if (this._options.onMeasureComplete) {
|
|
7546
|
+
this._options.onMeasureComplete(result);
|
|
7547
|
+
}
|
|
7548
|
+
}
|
|
7549
|
+
|
|
7550
|
+
_emitMeasureCancel() {
|
|
7551
|
+
if (this._options.onMeasureCancel) {
|
|
7552
|
+
this._options.onMeasureCancel();
|
|
7553
|
+
}
|
|
7554
|
+
}
|
|
7398
7555
|
}
|
|
7399
7556
|
|
|
7400
7557
|
/**
|
|
@@ -8083,7 +8240,7 @@ class BaseControl {
|
|
|
8083
8240
|
_destroy() { }
|
|
8084
8241
|
}
|
|
8085
8242
|
|
|
8086
|
-
const Cesium$
|
|
8243
|
+
const Cesium$6 = getCesium();
|
|
8087
8244
|
|
|
8088
8245
|
/**
|
|
8089
8246
|
* 状态栏控件
|
|
@@ -8163,7 +8320,7 @@ class LocationBar extends BaseControl {
|
|
|
8163
8320
|
const rect = this._viewer.scene.canvas.getBoundingClientRect();
|
|
8164
8321
|
const x = e.clientX - rect.left;
|
|
8165
8322
|
const y = e.clientY - rect.top;
|
|
8166
|
-
const screenPos = new Cesium$
|
|
8323
|
+
const screenPos = new Cesium$6.Cartesian2(x, y);
|
|
8167
8324
|
|
|
8168
8325
|
let cartesian = null;
|
|
8169
8326
|
|
|
@@ -8179,10 +8336,10 @@ class LocationBar extends BaseControl {
|
|
|
8179
8336
|
}
|
|
8180
8337
|
|
|
8181
8338
|
if (cartesian) {
|
|
8182
|
-
const cartographic = Cesium$
|
|
8339
|
+
const cartographic = Cesium$6.Cartographic.fromCartesian(cartesian);
|
|
8183
8340
|
this._lastMouseData = {
|
|
8184
|
-
lng: Cesium$
|
|
8185
|
-
lat: Cesium$
|
|
8341
|
+
lng: Cesium$6.Math.toDegrees(cartographic.longitude).toFixed(this._lngDecimal),
|
|
8342
|
+
lat: Cesium$6.Math.toDegrees(cartographic.latitude).toFixed(this._latDecimal),
|
|
8186
8343
|
alt: cartographic.height.toFixed(2)
|
|
8187
8344
|
};
|
|
8188
8345
|
} else {
|
|
@@ -8202,8 +8359,8 @@ class LocationBar extends BaseControl {
|
|
|
8202
8359
|
const positionCartographic = camera.positionCartographic;
|
|
8203
8360
|
|
|
8204
8361
|
this._lastCameraData = {
|
|
8205
|
-
heading: Cesium$
|
|
8206
|
-
pitch: Cesium$
|
|
8362
|
+
heading: Cesium$6.Math.toDegrees(camera.heading).toFixed(2),
|
|
8363
|
+
pitch: Cesium$6.Math.toDegrees(camera.pitch).toFixed(2),
|
|
8207
8364
|
cameraHeight: positionCartographic.height.toFixed(2),
|
|
8208
8365
|
level: this._getZoomLevel().toFixed(0)
|
|
8209
8366
|
};
|
|
@@ -8229,12 +8386,12 @@ class LocationBar extends BaseControl {
|
|
|
8229
8386
|
const positionCartographic = camera.positionCartographic;
|
|
8230
8387
|
|
|
8231
8388
|
// 计算相机到正下方地表点的距离(视高),而不是到自己位置的距离
|
|
8232
|
-
const surfaceCartesian = Cesium$
|
|
8389
|
+
const surfaceCartesian = Cesium$6.Cartesian3.fromRadians(
|
|
8233
8390
|
positionCartographic.longitude,
|
|
8234
8391
|
positionCartographic.latitude,
|
|
8235
8392
|
0
|
|
8236
8393
|
);
|
|
8237
|
-
const distance = Cesium$
|
|
8394
|
+
const distance = Cesium$6.Cartesian3.distance(camera.position, surfaceCartesian);
|
|
8238
8395
|
|
|
8239
8396
|
if (!distance || distance <= 0 || !Number.isFinite(distance)) return 0;
|
|
8240
8397
|
|
|
@@ -8266,140 +8423,140 @@ class LocationBar extends BaseControl {
|
|
|
8266
8423
|
}
|
|
8267
8424
|
}
|
|
8268
8425
|
|
|
8269
|
-
const Cesium$
|
|
8270
|
-
|
|
8271
|
-
/**
|
|
8272
|
-
* 缩放控件
|
|
8273
|
-
* 提供放大/缩小两个按钮,默认挂到 SDK 统一工具栏(xs3d-viewer-toolbar)。
|
|
8274
|
-
*/
|
|
8275
|
-
class Zoom extends BaseControl {
|
|
8276
|
-
/**
|
|
8277
|
-
* @param {object} options
|
|
8278
|
-
* @param {number} [options.duration=0.5] 缩放动画时长(秒)
|
|
8279
|
-
*/
|
|
8280
|
-
constructor(options = {}) {
|
|
8281
|
-
super({
|
|
8282
|
-
type: 'zoom',
|
|
8283
|
-
...options
|
|
8284
|
-
});
|
|
8285
|
-
|
|
8286
|
-
this._duration = options.duration ?? 0.5;
|
|
8287
|
-
}
|
|
8288
|
-
|
|
8289
|
-
_createContainer() {
|
|
8290
|
-
const div = super._createContainer();
|
|
8291
|
-
div.className += ' xs3d-zoom';
|
|
8292
|
-
// 只有在统一工具栏内才使用 display: contents,让按钮直接参与工具栏 flex 布局;
|
|
8293
|
-
// 自定义容器挂载时保留正常 absolute 定位,支持 top/left/right/bottom。
|
|
8294
|
-
if (this._parentContainer?.classList?.contains('xs3d-viewer-toolbar')) {
|
|
8295
|
-
div.style.display = 'contents';
|
|
8296
|
-
}
|
|
8297
|
-
return div;
|
|
8298
|
-
}
|
|
8299
|
-
|
|
8300
|
-
_getParentContainer() {
|
|
8301
|
-
if (this._options.container) {
|
|
8302
|
-
return super._getParentContainer();
|
|
8303
|
-
}
|
|
8304
|
-
return this._getOrCreateToolbar();
|
|
8305
|
-
}
|
|
8306
|
-
|
|
8307
|
-
_mount() {
|
|
8308
|
-
this._clearAbsolutePositionIfInToolbar();
|
|
8309
|
-
|
|
8310
|
-
this._zoomInBtn = this._createButton('+', '放大');
|
|
8311
|
-
this._zoomOutBtn = this._createButton('-', '缩小');
|
|
8312
|
-
|
|
8313
|
-
this._container.appendChild(this._zoomInBtn);
|
|
8314
|
-
this._container.appendChild(this._zoomOutBtn);
|
|
8315
|
-
}
|
|
8316
|
-
|
|
8317
|
-
_createButton(label, title) {
|
|
8318
|
-
const btn = document.createElement('button');
|
|
8319
|
-
btn.type = 'button';
|
|
8320
|
-
btn.title = title;
|
|
8321
|
-
btn.className = 'cesium-button cesium-toolbar-button xs3d-zoom-button';
|
|
8322
|
-
btn.textContent = label;
|
|
8323
|
-
btn.style.width = '32px';
|
|
8324
|
-
btn.style.height = '32px';
|
|
8325
|
-
btn.style.lineHeight = '1';
|
|
8326
|
-
btn.style.fontSize = '18px';
|
|
8327
|
-
btn.style.fontWeight = 'bold';
|
|
8328
|
-
btn.style.display = 'flex';
|
|
8329
|
-
btn.style.alignItems = 'center';
|
|
8330
|
-
btn.style.justifyContent = 'center';
|
|
8331
|
-
btn.style.cursor = 'pointer';
|
|
8332
|
-
// 在统一工具栏内按 order 排列:指南针 -1,放大 1,缩小 2
|
|
8333
|
-
btn.style.order = label === '+' ? '1' : '2';
|
|
8334
|
-
return btn;
|
|
8335
|
-
}
|
|
8336
|
-
|
|
8337
|
-
_bindEvents() {
|
|
8338
|
-
this._addDomEvent(this._zoomInBtn, 'click', (e) => {
|
|
8339
|
-
e.stopPropagation();
|
|
8340
|
-
this._zoomIn();
|
|
8341
|
-
});
|
|
8342
|
-
|
|
8343
|
-
this._addDomEvent(this._zoomOutBtn, 'click', (e) => {
|
|
8344
|
-
e.stopPropagation();
|
|
8345
|
-
this._zoomOut();
|
|
8346
|
-
});
|
|
8347
|
-
}
|
|
8348
|
-
|
|
8349
|
-
_zoomIn() {
|
|
8350
|
-
this._zoomBy(1);
|
|
8351
|
-
}
|
|
8352
|
-
|
|
8353
|
-
_zoomOut() {
|
|
8354
|
-
this._zoomBy(-1);
|
|
8355
|
-
}
|
|
8356
|
-
|
|
8357
|
-
/**
|
|
8358
|
-
* 按地图层级步进缩放
|
|
8359
|
-
* @param {number} levelDelta 层级变化量,+1 放大一级,-1 缩小一级
|
|
8360
|
-
*/
|
|
8361
|
-
_zoomBy(levelDelta) {
|
|
8362
|
-
const camera = this._viewer.camera;
|
|
8363
|
-
const cartographic = camera.positionCartographic;
|
|
8364
|
-
const currentLevel = this._getZoomLevel();
|
|
8365
|
-
const targetLevel = Math.max(0, Math.min(24, currentLevel + levelDelta));
|
|
8366
|
-
const targetHeight = this._getHeightByZoomLevel(targetLevel);
|
|
8367
|
-
|
|
8368
|
-
camera.flyTo({
|
|
8369
|
-
destination: Cesium$
|
|
8370
|
-
cartographic.longitude,
|
|
8371
|
-
cartographic.latitude,
|
|
8372
|
-
targetHeight
|
|
8373
|
-
),
|
|
8374
|
-
orientation: {
|
|
8375
|
-
heading: camera.heading,
|
|
8376
|
-
pitch: camera.pitch,
|
|
8377
|
-
roll: camera.roll
|
|
8378
|
-
},
|
|
8379
|
-
duration: this._duration
|
|
8380
|
-
});
|
|
8381
|
-
}
|
|
8382
|
-
|
|
8383
|
-
_getZoomLevel() {
|
|
8384
|
-
const positionCartographic = this._viewer.camera.positionCartographic;
|
|
8385
|
-
const surfaceCartesian = Cesium$
|
|
8386
|
-
positionCartographic.longitude,
|
|
8387
|
-
positionCartographic.latitude,
|
|
8388
|
-
0
|
|
8389
|
-
);
|
|
8390
|
-
const distance = Cesium$
|
|
8391
|
-
if (!distance || distance <= 0 || !Number.isFinite(distance)) return 0;
|
|
8392
|
-
const equatorCircumference = 6378137 * 2 * Math.PI;
|
|
8393
|
-
return Math.max(0, Math.floor(Math.log2(equatorCircumference / distance)) + 1);
|
|
8394
|
-
}
|
|
8395
|
-
|
|
8396
|
-
_getHeightByZoomLevel(level) {
|
|
8397
|
-
const equatorCircumference = 6378137 * 2 * Math.PI;
|
|
8398
|
-
return equatorCircumference / Math.pow(2, Math.max(0, level - 1));
|
|
8399
|
-
}
|
|
8426
|
+
const Cesium$5 = getCesium();
|
|
8427
|
+
|
|
8428
|
+
/**
|
|
8429
|
+
* 缩放控件
|
|
8430
|
+
* 提供放大/缩小两个按钮,默认挂到 SDK 统一工具栏(xs3d-viewer-toolbar)。
|
|
8431
|
+
*/
|
|
8432
|
+
class Zoom extends BaseControl {
|
|
8433
|
+
/**
|
|
8434
|
+
* @param {object} options
|
|
8435
|
+
* @param {number} [options.duration=0.5] 缩放动画时长(秒)
|
|
8436
|
+
*/
|
|
8437
|
+
constructor(options = {}) {
|
|
8438
|
+
super({
|
|
8439
|
+
type: 'zoom',
|
|
8440
|
+
...options
|
|
8441
|
+
});
|
|
8442
|
+
|
|
8443
|
+
this._duration = options.duration ?? 0.5;
|
|
8444
|
+
}
|
|
8445
|
+
|
|
8446
|
+
_createContainer() {
|
|
8447
|
+
const div = super._createContainer();
|
|
8448
|
+
div.className += ' xs3d-zoom';
|
|
8449
|
+
// 只有在统一工具栏内才使用 display: contents,让按钮直接参与工具栏 flex 布局;
|
|
8450
|
+
// 自定义容器挂载时保留正常 absolute 定位,支持 top/left/right/bottom。
|
|
8451
|
+
if (this._parentContainer?.classList?.contains('xs3d-viewer-toolbar')) {
|
|
8452
|
+
div.style.display = 'contents';
|
|
8453
|
+
}
|
|
8454
|
+
return div;
|
|
8455
|
+
}
|
|
8456
|
+
|
|
8457
|
+
_getParentContainer() {
|
|
8458
|
+
if (this._options.container) {
|
|
8459
|
+
return super._getParentContainer();
|
|
8460
|
+
}
|
|
8461
|
+
return this._getOrCreateToolbar();
|
|
8462
|
+
}
|
|
8463
|
+
|
|
8464
|
+
_mount() {
|
|
8465
|
+
this._clearAbsolutePositionIfInToolbar();
|
|
8466
|
+
|
|
8467
|
+
this._zoomInBtn = this._createButton('+', '放大');
|
|
8468
|
+
this._zoomOutBtn = this._createButton('-', '缩小');
|
|
8469
|
+
|
|
8470
|
+
this._container.appendChild(this._zoomInBtn);
|
|
8471
|
+
this._container.appendChild(this._zoomOutBtn);
|
|
8472
|
+
}
|
|
8473
|
+
|
|
8474
|
+
_createButton(label, title) {
|
|
8475
|
+
const btn = document.createElement('button');
|
|
8476
|
+
btn.type = 'button';
|
|
8477
|
+
btn.title = title;
|
|
8478
|
+
btn.className = 'cesium-button cesium-toolbar-button xs3d-zoom-button';
|
|
8479
|
+
btn.textContent = label;
|
|
8480
|
+
btn.style.width = '32px';
|
|
8481
|
+
btn.style.height = '32px';
|
|
8482
|
+
btn.style.lineHeight = '1';
|
|
8483
|
+
btn.style.fontSize = '18px';
|
|
8484
|
+
btn.style.fontWeight = 'bold';
|
|
8485
|
+
btn.style.display = 'flex';
|
|
8486
|
+
btn.style.alignItems = 'center';
|
|
8487
|
+
btn.style.justifyContent = 'center';
|
|
8488
|
+
btn.style.cursor = 'pointer';
|
|
8489
|
+
// 在统一工具栏内按 order 排列:指南针 -1,放大 1,缩小 2
|
|
8490
|
+
btn.style.order = label === '+' ? '1' : '2';
|
|
8491
|
+
return btn;
|
|
8492
|
+
}
|
|
8493
|
+
|
|
8494
|
+
_bindEvents() {
|
|
8495
|
+
this._addDomEvent(this._zoomInBtn, 'click', (e) => {
|
|
8496
|
+
e.stopPropagation();
|
|
8497
|
+
this._zoomIn();
|
|
8498
|
+
});
|
|
8499
|
+
|
|
8500
|
+
this._addDomEvent(this._zoomOutBtn, 'click', (e) => {
|
|
8501
|
+
e.stopPropagation();
|
|
8502
|
+
this._zoomOut();
|
|
8503
|
+
});
|
|
8504
|
+
}
|
|
8505
|
+
|
|
8506
|
+
_zoomIn() {
|
|
8507
|
+
this._zoomBy(1);
|
|
8508
|
+
}
|
|
8509
|
+
|
|
8510
|
+
_zoomOut() {
|
|
8511
|
+
this._zoomBy(-1);
|
|
8512
|
+
}
|
|
8513
|
+
|
|
8514
|
+
/**
|
|
8515
|
+
* 按地图层级步进缩放
|
|
8516
|
+
* @param {number} levelDelta 层级变化量,+1 放大一级,-1 缩小一级
|
|
8517
|
+
*/
|
|
8518
|
+
_zoomBy(levelDelta) {
|
|
8519
|
+
const camera = this._viewer.camera;
|
|
8520
|
+
const cartographic = camera.positionCartographic;
|
|
8521
|
+
const currentLevel = this._getZoomLevel();
|
|
8522
|
+
const targetLevel = Math.max(0, Math.min(24, currentLevel + levelDelta));
|
|
8523
|
+
const targetHeight = this._getHeightByZoomLevel(targetLevel);
|
|
8524
|
+
|
|
8525
|
+
camera.flyTo({
|
|
8526
|
+
destination: Cesium$5.Cartesian3.fromRadians(
|
|
8527
|
+
cartographic.longitude,
|
|
8528
|
+
cartographic.latitude,
|
|
8529
|
+
targetHeight
|
|
8530
|
+
),
|
|
8531
|
+
orientation: {
|
|
8532
|
+
heading: camera.heading,
|
|
8533
|
+
pitch: camera.pitch,
|
|
8534
|
+
roll: camera.roll
|
|
8535
|
+
},
|
|
8536
|
+
duration: this._duration
|
|
8537
|
+
});
|
|
8538
|
+
}
|
|
8539
|
+
|
|
8540
|
+
_getZoomLevel() {
|
|
8541
|
+
const positionCartographic = this._viewer.camera.positionCartographic;
|
|
8542
|
+
const surfaceCartesian = Cesium$5.Cartesian3.fromRadians(
|
|
8543
|
+
positionCartographic.longitude,
|
|
8544
|
+
positionCartographic.latitude,
|
|
8545
|
+
0
|
|
8546
|
+
);
|
|
8547
|
+
const distance = Cesium$5.Cartesian3.distance(this._viewer.camera.position, surfaceCartesian);
|
|
8548
|
+
if (!distance || distance <= 0 || !Number.isFinite(distance)) return 0;
|
|
8549
|
+
const equatorCircumference = 6378137 * 2 * Math.PI;
|
|
8550
|
+
return Math.max(0, Math.floor(Math.log2(equatorCircumference / distance)) + 1);
|
|
8551
|
+
}
|
|
8552
|
+
|
|
8553
|
+
_getHeightByZoomLevel(level) {
|
|
8554
|
+
const equatorCircumference = 6378137 * 2 * Math.PI;
|
|
8555
|
+
return equatorCircumference / Math.pow(2, Math.max(0, level - 1));
|
|
8556
|
+
}
|
|
8400
8557
|
}
|
|
8401
8558
|
|
|
8402
|
-
const Cesium$
|
|
8559
|
+
const Cesium$4 = getCesium();
|
|
8403
8560
|
|
|
8404
8561
|
/**
|
|
8405
8562
|
* 指南针控件
|
|
@@ -8550,7 +8707,7 @@ class Compass extends BaseControl {
|
|
|
8550
8707
|
|
|
8551
8708
|
_updateRotation() {
|
|
8552
8709
|
if (!this._outerEl) return;
|
|
8553
|
-
const heading = Cesium$
|
|
8710
|
+
const heading = Cesium$4.Math.toDegrees(this._viewer.camera.heading);
|
|
8554
8711
|
this._outerEl.style.transform = `rotate(${-heading}deg)`;
|
|
8555
8712
|
}
|
|
8556
8713
|
|
|
@@ -8603,7 +8760,7 @@ class Compass extends BaseControl {
|
|
|
8603
8760
|
|
|
8604
8761
|
const camera = this._viewer.camera;
|
|
8605
8762
|
if (this._rotateFrame) {
|
|
8606
|
-
const oldTransform = Cesium$
|
|
8763
|
+
const oldTransform = Cesium$4.Matrix4.clone(camera.transform);
|
|
8607
8764
|
camera.lookAtTransform(this._rotateFrame);
|
|
8608
8765
|
camera.rotateRight(delta);
|
|
8609
8766
|
camera.lookAtTransform(oldTransform);
|
|
@@ -8645,10 +8802,10 @@ class Compass extends BaseControl {
|
|
|
8645
8802
|
if (this._mode !== 'orbit') return;
|
|
8646
8803
|
const deltaY = this._startY - e.clientY;
|
|
8647
8804
|
const sensitivity = 0.004;
|
|
8648
|
-
const newPitch = Cesium$
|
|
8805
|
+
const newPitch = Cesium$4.Math.clamp(
|
|
8649
8806
|
this._startPitch + deltaY * sensitivity,
|
|
8650
|
-
-Cesium$
|
|
8651
|
-
Cesium$
|
|
8807
|
+
-Cesium$4.Math.PI_OVER_TWO + 0.01,
|
|
8808
|
+
Cesium$4.Math.PI_OVER_TWO - 0.01
|
|
8652
8809
|
);
|
|
8653
8810
|
this._viewer.camera.setView({
|
|
8654
8811
|
destination: this._viewer.camera.position,
|
|
@@ -8672,26 +8829,26 @@ class Compass extends BaseControl {
|
|
|
8672
8829
|
_getRotateFrame() {
|
|
8673
8830
|
const scene = this._viewer.scene;
|
|
8674
8831
|
const camera = this._viewer.camera;
|
|
8675
|
-
if (scene.mode === Cesium$
|
|
8832
|
+
if (scene.mode === Cesium$4.SceneMode.MORPHING) return null;
|
|
8676
8833
|
|
|
8677
8834
|
let center;
|
|
8678
8835
|
if (this._viewer.trackedEntity) {
|
|
8679
8836
|
center = this._viewer.trackedEntity.position.getValue(this._viewer.clock.currentTime);
|
|
8680
8837
|
} else {
|
|
8681
|
-
const ray = new Cesium$
|
|
8838
|
+
const ray = new Cesium$4.Ray(camera.positionWC, camera.directionWC);
|
|
8682
8839
|
center = scene.globe.pick(ray, scene);
|
|
8683
8840
|
}
|
|
8684
8841
|
if (!center) {
|
|
8685
8842
|
center = camera.positionWC;
|
|
8686
8843
|
}
|
|
8687
|
-
return Cesium$
|
|
8844
|
+
return Cesium$4.Transforms.eastNorthUpToFixedFrame(center, scene.globe.ellipsoid);
|
|
8688
8845
|
}
|
|
8689
8846
|
|
|
8690
8847
|
_onDoubleClick() {
|
|
8691
8848
|
const camera = this._viewer.camera;
|
|
8692
8849
|
const cartographic = camera.positionCartographic;
|
|
8693
8850
|
camera.flyTo({
|
|
8694
|
-
destination: Cesium$
|
|
8851
|
+
destination: Cesium$4.Cartesian3.fromRadians(
|
|
8695
8852
|
cartographic.longitude,
|
|
8696
8853
|
cartographic.latitude,
|
|
8697
8854
|
cartographic.height
|
|
@@ -8712,7 +8869,7 @@ class Compass extends BaseControl {
|
|
|
8712
8869
|
}
|
|
8713
8870
|
}
|
|
8714
8871
|
|
|
8715
|
-
const Cesium$
|
|
8872
|
+
const Cesium$3 = getCesium();
|
|
8716
8873
|
|
|
8717
8874
|
/**
|
|
8718
8875
|
* 比例尺控件
|
|
@@ -8744,7 +8901,7 @@ class DistanceLegend extends BaseControl {
|
|
|
8744
8901
|
base.forEach(b => this._distances.push(b * factor));
|
|
8745
8902
|
}
|
|
8746
8903
|
|
|
8747
|
-
this._geodesic = new Cesium$
|
|
8904
|
+
this._geodesic = new Cesium$3.EllipsoidGeodesic();
|
|
8748
8905
|
this._lastUpdate = 0;
|
|
8749
8906
|
}
|
|
8750
8907
|
|
|
@@ -8802,8 +8959,8 @@ class DistanceLegend extends BaseControl {
|
|
|
8802
8959
|
const x = Math.floor(width / 2);
|
|
8803
8960
|
const y = Math.max(0, height - 1);
|
|
8804
8961
|
|
|
8805
|
-
const leftRay = camera.getPickRay(new Cesium$
|
|
8806
|
-
const rightRay = camera.getPickRay(new Cesium$
|
|
8962
|
+
const leftRay = camera.getPickRay(new Cesium$3.Cartesian2(x, y));
|
|
8963
|
+
const rightRay = camera.getPickRay(new Cesium$3.Cartesian2(x + 1, y));
|
|
8807
8964
|
if (!leftRay || !rightRay) return;
|
|
8808
8965
|
|
|
8809
8966
|
const leftPosition = scene.globe.pick(leftRay, scene);
|
|
@@ -9037,6 +9194,483 @@ class ControlModule {
|
|
|
9037
9194
|
}
|
|
9038
9195
|
}
|
|
9039
9196
|
|
|
9197
|
+
const toDataUri = (svg) => `data:image/svg+xml;charset=utf-8,${encodeURIComponent(svg)}`;
|
|
9198
|
+
|
|
9199
|
+
/**
|
|
9200
|
+
* 军标内置默认图标。
|
|
9201
|
+
* SDK 内置常见军标类型的默认图标,业务层可通过 imgUrl / useDefaultIcon 参数覆盖或追加。
|
|
9202
|
+
*/
|
|
9203
|
+
const DEFAULT_SYMBOL_IMAGES = {
|
|
9204
|
+
'small-radio': toDataUri(`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 80 80" width="80" height="80"><g id="图层_2" data-name="图层 2"><g id="图层_1-2" data-name="图层 1"><circle cx="36.93" cy="48.5" r="22" style="fill:none;stroke:red;stroke-miterlimit:10;stroke-width:4.535433070866142px"/><polyline points="42.56 25.87 53.06 9.51 54.06 27.5 65.07 10.37" style="fill:none;stroke:red;stroke-linejoin:bevel;stroke-width:4.535433070866142px"/><rect width="80" height="80" style="fill:red;opacity:0"/></g></g></svg>`),
|
|
9205
|
+
'large-radio': toDataUri(`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 80 80" width="80" height="80"><g id="图层_2" data-name="图层 2"><g id="图层_1-2" data-name="图层 1"><polygon points="39.96 28.87 51.18 48.3 62.4 67.73 39.96 67.73 17.53 67.73 28.75 48.3 39.96 28.87" style="fill:none;stroke:red;stroke-miterlimit:10;stroke-width:4.535433070866142px"/><polyline points="39.96 28.64 50.46 12.27 51.46 30.27 62.47 13.14" style="fill:none;stroke:red;stroke-linejoin:bevel;stroke-width:4.535433070866142px"/><rect width="80" height="80" style="fill:red;opacity:0"/></g></g></svg>`),
|
|
9206
|
+
};
|
|
9207
|
+
|
|
9208
|
+
const Cesium$2 = getCesium();
|
|
9209
|
+
|
|
9210
|
+
/**
|
|
9211
|
+
* 军标模块
|
|
9212
|
+
* 封装军标图元的创建、更新、删除、可见性控制及拖拽编辑位置能力。
|
|
9213
|
+
* SDK 内部维护军标状态,业务层只需传入类型、位置等渲染元数据。
|
|
9214
|
+
*/
|
|
9215
|
+
class MilitarySymbolModule {
|
|
9216
|
+
constructor(viewer) {
|
|
9217
|
+
this.viewer = viewer;
|
|
9218
|
+
this.config = Config.getInstance().getConfig();
|
|
9219
|
+
/** @type {Map<string, {entity: Cesium.Entity, metadata: object}>} */
|
|
9220
|
+
this.symbolMap = new Map();
|
|
9221
|
+
/** @type {Map<string, string>} 业务自定义的默认图标(按 type) */
|
|
9222
|
+
this.defaultImageMap = new Map();
|
|
9223
|
+
this.eventModule = null;
|
|
9224
|
+
|
|
9225
|
+
this._editMode = false;
|
|
9226
|
+
this._draggingId = null;
|
|
9227
|
+
this._dragObserverIds = [];
|
|
9228
|
+
/** @type {Set<Function>} */
|
|
9229
|
+
this._positionChangedCallbacks = new Set();
|
|
9230
|
+
}
|
|
9231
|
+
|
|
9232
|
+
/**
|
|
9233
|
+
* 注入依赖模块
|
|
9234
|
+
* @param {Object} deps
|
|
9235
|
+
* @param {EventModule} deps.eventModule 事件模块,用于拖拽交互
|
|
9236
|
+
* @returns {MilitarySymbolModule}
|
|
9237
|
+
*/
|
|
9238
|
+
setDependencies(deps = {}) {
|
|
9239
|
+
this.eventModule = deps.eventModule || null;
|
|
9240
|
+
return this;
|
|
9241
|
+
}
|
|
9242
|
+
|
|
9243
|
+
/**
|
|
9244
|
+
* 解析军标图标
|
|
9245
|
+
* - iconMode = 'default':使用 SDK 内置默认图标;没有默认图标时回退到 imgUrl
|
|
9246
|
+
* - iconMode = 'custom':使用业务层传入的 imgUrl
|
|
9247
|
+
* - iconMode = 'overlay':在 SDK 默认图标上叠加业务层 imgUrl
|
|
9248
|
+
* @private
|
|
9249
|
+
*/
|
|
9250
|
+
_resolveImage(id, options) {
|
|
9251
|
+
const mode = options.iconMode || 'default';
|
|
9252
|
+
const defaultImage = DEFAULT_SYMBOL_IMAGES[options.type];
|
|
9253
|
+
|
|
9254
|
+
if (mode === 'custom') {
|
|
9255
|
+
if (!options.imgUrl) {
|
|
9256
|
+
console.warn(`iconMode 为 custom 时需提供 imgUrl,将尝试使用默认图标`);
|
|
9257
|
+
return defaultImage || null;
|
|
9258
|
+
}
|
|
9259
|
+
return options.imgUrl;
|
|
9260
|
+
}
|
|
9261
|
+
|
|
9262
|
+
if (mode === 'overlay') {
|
|
9263
|
+
if (!options.imgUrl || !defaultImage) {
|
|
9264
|
+
return options.imgUrl || defaultImage || null;
|
|
9265
|
+
}
|
|
9266
|
+
// 异步合成叠加图标,创建时先返回默认图标,合成完成后再替换
|
|
9267
|
+
this._composeOverlayImage(defaultImage, options.imgUrl).then((compositeUrl) => {
|
|
9268
|
+
const symbol = this.symbolMap.get(id);
|
|
9269
|
+
if (symbol?.entity?.billboard) {
|
|
9270
|
+
symbol.entity.billboard.image = compositeUrl;
|
|
9271
|
+
}
|
|
9272
|
+
}).catch((err) => {
|
|
9273
|
+
console.warn('军标叠加图标合成失败', err);
|
|
9274
|
+
});
|
|
9275
|
+
return defaultImage;
|
|
9276
|
+
}
|
|
9277
|
+
|
|
9278
|
+
// 默认模式
|
|
9279
|
+
if (!defaultImage) {
|
|
9280
|
+
if (options.imgUrl) return options.imgUrl;
|
|
9281
|
+
console.warn(`军标类型 ${options.type} 未提供图标,也未找到内置默认图标`);
|
|
9282
|
+
return null;
|
|
9283
|
+
}
|
|
9284
|
+
return defaultImage;
|
|
9285
|
+
}
|
|
9286
|
+
|
|
9287
|
+
/**
|
|
9288
|
+
* 加载图片
|
|
9289
|
+
* @private
|
|
9290
|
+
*/
|
|
9291
|
+
_loadImage(url) {
|
|
9292
|
+
return new Promise((resolve, reject) => {
|
|
9293
|
+
const img = new Image();
|
|
9294
|
+
img.crossOrigin = 'anonymous';
|
|
9295
|
+
img.onload = () => resolve(img);
|
|
9296
|
+
img.onerror = (e) => reject(e);
|
|
9297
|
+
img.src = url;
|
|
9298
|
+
});
|
|
9299
|
+
}
|
|
9300
|
+
|
|
9301
|
+
/**
|
|
9302
|
+
* 把业务图标叠加到默认图标上,返回合成后的 dataURL
|
|
9303
|
+
* @private
|
|
9304
|
+
*/
|
|
9305
|
+
async _composeOverlayImage(defaultUrl, overlayUrl, size = 64) {
|
|
9306
|
+
if (typeof document === 'undefined') return defaultUrl;
|
|
9307
|
+
const [baseImg, overlayImg] = await Promise.all([
|
|
9308
|
+
this._loadImage(defaultUrl),
|
|
9309
|
+
this._loadImage(overlayUrl),
|
|
9310
|
+
]);
|
|
9311
|
+
const canvas = document.createElement('canvas');
|
|
9312
|
+
canvas.width = size;
|
|
9313
|
+
canvas.height = size;
|
|
9314
|
+
const ctx = canvas.getContext('2d');
|
|
9315
|
+
ctx.drawImage(baseImg, 0, 0, size, size);
|
|
9316
|
+
ctx.drawImage(overlayImg, 0, 0, size, size);
|
|
9317
|
+
return canvas.toDataURL('image/png');
|
|
9318
|
+
}
|
|
9319
|
+
|
|
9320
|
+
/**
|
|
9321
|
+
* 从军标实体中提取经纬高
|
|
9322
|
+
* @private
|
|
9323
|
+
*/
|
|
9324
|
+
_getPositionFromEntity(entity) {
|
|
9325
|
+
if (!entity?.position) return null;
|
|
9326
|
+
const pos = typeof entity.position.getValue === 'function'
|
|
9327
|
+
? entity.position.getValue(Cesium$2.JulianDate.now())
|
|
9328
|
+
: entity.position;
|
|
9329
|
+
if (!pos) return null;
|
|
9330
|
+
const c = Cesium$2.Cartographic.fromCartesian(pos);
|
|
9331
|
+
return [
|
|
9332
|
+
Cesium$2.Math.toDegrees(c.longitude),
|
|
9333
|
+
Cesium$2.Math.toDegrees(c.latitude),
|
|
9334
|
+
c.height
|
|
9335
|
+
];
|
|
9336
|
+
}
|
|
9337
|
+
|
|
9338
|
+
/**
|
|
9339
|
+
* 根据鼠标拾取结果判断是否为当前模块管理的军标
|
|
9340
|
+
* @private
|
|
9341
|
+
*/
|
|
9342
|
+
_getSymbolIdFromPick(pickedEntity) {
|
|
9343
|
+
if (!pickedEntity) return null;
|
|
9344
|
+
const id = typeof pickedEntity.id === 'string' ? pickedEntity.id : pickedEntity.id?.id;
|
|
9345
|
+
return this.symbolMap.has(id) ? id : null;
|
|
9346
|
+
}
|
|
9347
|
+
|
|
9348
|
+
/**
|
|
9349
|
+
* 创建军标图元
|
|
9350
|
+
* @param {string} id 军标唯一ID
|
|
9351
|
+
* @param {Object} options
|
|
9352
|
+
* @param {number[]} options.position 经纬高 [lon, lat, height]
|
|
9353
|
+
* @param {string} options.type 军标类型,如 small-radio / large-radio
|
|
9354
|
+
* @param {string} [options.name] 显示名称,默认使用 id
|
|
9355
|
+
* @param {string} [options.imgUrl] 自定义图标 URL
|
|
9356
|
+
* @param {'default'|'custom'|'overlay'} [options.iconMode] 图标模式,默认 'default'
|
|
9357
|
+
* @param {number} [options.scale] billboard 缩放,默认 0.6
|
|
9358
|
+
* @param {boolean} [options.visible] 是否可见,默认 true
|
|
9359
|
+
* @returns {{id: string, entity: Cesium.Entity, metadata: object}}
|
|
9360
|
+
*/
|
|
9361
|
+
create(id, options = {}) {
|
|
9362
|
+
if (this.symbolMap.has(id)) {
|
|
9363
|
+
console.warn(`军标 ${id} 已存在`);
|
|
9364
|
+
return this.getById(id);
|
|
9365
|
+
}
|
|
9366
|
+
|
|
9367
|
+
const position = options.position || [0, 0, 0];
|
|
9368
|
+
const image = this._resolveImage(id, options);
|
|
9369
|
+
const scale = options.scale ?? 0.6;
|
|
9370
|
+
const visible = options.visible !== false;
|
|
9371
|
+
const name = options.name ?? id;
|
|
9372
|
+
const iconMode = options.iconMode || 'default';
|
|
9373
|
+
|
|
9374
|
+
const entity = this.viewer.entities.add({
|
|
9375
|
+
id,
|
|
9376
|
+
position: Cesium$2.Cartesian3.fromDegrees(position[0], position[1], position[2] || 0),
|
|
9377
|
+
billboard: {
|
|
9378
|
+
image,
|
|
9379
|
+
scale,
|
|
9380
|
+
verticalOrigin: Cesium$2.VerticalOrigin.BOTTOM,
|
|
9381
|
+
horizontalOrigin: Cesium$2.HorizontalOrigin.CENTER,
|
|
9382
|
+
heightReference: Cesium$2.HeightReference.CLAMP_TO_GROUND,
|
|
9383
|
+
disableDepthTestDistance: 100000,
|
|
9384
|
+
},
|
|
9385
|
+
label: {
|
|
9386
|
+
text: name,
|
|
9387
|
+
font: '12px Microsoft YaHei',
|
|
9388
|
+
fillColor: Cesium$2.Color.WHITE,
|
|
9389
|
+
outlineColor: Cesium$2.Color.BLACK,
|
|
9390
|
+
outlineWidth: 2,
|
|
9391
|
+
style: Cesium$2.LabelStyle.FILL_AND_OUTLINE,
|
|
9392
|
+
verticalOrigin: Cesium$2.VerticalOrigin.TOP,
|
|
9393
|
+
horizontalOrigin: Cesium$2.HorizontalOrigin.CENTER,
|
|
9394
|
+
pixelOffset: new Cesium$2.Cartesian2(0, 4),
|
|
9395
|
+
heightReference: Cesium$2.HeightReference.CLAMP_TO_GROUND,
|
|
9396
|
+
disableDepthTestDistance: 100000,
|
|
9397
|
+
show: true,
|
|
9398
|
+
},
|
|
9399
|
+
show: visible,
|
|
9400
|
+
});
|
|
9401
|
+
|
|
9402
|
+
const metadata = {
|
|
9403
|
+
id,
|
|
9404
|
+
type: options.type || 'custom',
|
|
9405
|
+
name,
|
|
9406
|
+
position: [position[0], position[1], position[2] || 0],
|
|
9407
|
+
scale,
|
|
9408
|
+
visible,
|
|
9409
|
+
iconMode,
|
|
9410
|
+
imgUrl: options.imgUrl || null,
|
|
9411
|
+
};
|
|
9412
|
+
|
|
9413
|
+
this.symbolMap.set(id, { entity, metadata });
|
|
9414
|
+
return { id, entity, metadata };
|
|
9415
|
+
}
|
|
9416
|
+
|
|
9417
|
+
/**
|
|
9418
|
+
* 删除军标
|
|
9419
|
+
* @param {string} id 军标ID
|
|
9420
|
+
* @returns {boolean} 是否删除成功
|
|
9421
|
+
*/
|
|
9422
|
+
remove(id) {
|
|
9423
|
+
const symbol = this.symbolMap.get(id);
|
|
9424
|
+
if (!symbol) {
|
|
9425
|
+
console.warn(`军标 ${id} 不存在`);
|
|
9426
|
+
return false;
|
|
9427
|
+
}
|
|
9428
|
+
this.viewer.entities.remove(symbol.entity);
|
|
9429
|
+
this.symbolMap.delete(id);
|
|
9430
|
+
if (this._draggingId === id) {
|
|
9431
|
+
this._draggingId = null;
|
|
9432
|
+
this.viewer.scene.screenSpaceCameraController.enableInputs = true;
|
|
9433
|
+
}
|
|
9434
|
+
return true;
|
|
9435
|
+
}
|
|
9436
|
+
|
|
9437
|
+
/**
|
|
9438
|
+
* 删除所有军标
|
|
9439
|
+
*/
|
|
9440
|
+
removeAll() {
|
|
9441
|
+
this.symbolMap.forEach((symbol) => {
|
|
9442
|
+
this.viewer.entities.remove(symbol.entity);
|
|
9443
|
+
});
|
|
9444
|
+
this.symbolMap.clear();
|
|
9445
|
+
this._draggingId = null;
|
|
9446
|
+
this.viewer.scene.screenSpaceCameraController.enableInputs = true;
|
|
9447
|
+
}
|
|
9448
|
+
|
|
9449
|
+
/**
|
|
9450
|
+
* 更新军标属性
|
|
9451
|
+
* @param {string} id 军标ID
|
|
9452
|
+
* @param {Object} fields 支持 position / name / scale / imgUrl / visible
|
|
9453
|
+
* @returns {boolean} 是否更新成功
|
|
9454
|
+
*/
|
|
9455
|
+
update(id, fields = {}) {
|
|
9456
|
+
const symbol = this.symbolMap.get(id);
|
|
9457
|
+
if (!symbol) {
|
|
9458
|
+
console.warn(`军标 ${id} 不存在`);
|
|
9459
|
+
return false;
|
|
9460
|
+
}
|
|
9461
|
+
|
|
9462
|
+
const { entity, metadata } = symbol;
|
|
9463
|
+
|
|
9464
|
+
if (fields.position) {
|
|
9465
|
+
const pos = fields.position;
|
|
9466
|
+
entity.position = Cesium$2.Cartesian3.fromDegrees(pos[0], pos[1], pos[2] || 0);
|
|
9467
|
+
metadata.position = [pos[0], pos[1], pos[2] || 0];
|
|
9468
|
+
}
|
|
9469
|
+
|
|
9470
|
+
if (fields.name !== undefined) {
|
|
9471
|
+
entity.label.text = fields.name;
|
|
9472
|
+
metadata.name = fields.name;
|
|
9473
|
+
}
|
|
9474
|
+
|
|
9475
|
+
if (fields.scale !== undefined) {
|
|
9476
|
+
entity.billboard.scale = fields.scale;
|
|
9477
|
+
metadata.scale = fields.scale;
|
|
9478
|
+
}
|
|
9479
|
+
|
|
9480
|
+
if (fields.imgUrl !== undefined || fields.iconMode !== undefined) {
|
|
9481
|
+
const newIconMode = fields.iconMode || metadata.iconMode;
|
|
9482
|
+
const newImgUrl = fields.imgUrl !== undefined ? fields.imgUrl : metadata.imgUrl;
|
|
9483
|
+
entity.billboard.image = this._resolveImage(id, {
|
|
9484
|
+
type: metadata.type,
|
|
9485
|
+
iconMode: newIconMode,
|
|
9486
|
+
imgUrl: newImgUrl,
|
|
9487
|
+
});
|
|
9488
|
+
metadata.imgUrl = newImgUrl;
|
|
9489
|
+
metadata.iconMode = newIconMode;
|
|
9490
|
+
}
|
|
9491
|
+
|
|
9492
|
+
if (fields.visible !== undefined) {
|
|
9493
|
+
entity.show = fields.visible;
|
|
9494
|
+
metadata.visible = fields.visible;
|
|
9495
|
+
}
|
|
9496
|
+
|
|
9497
|
+
return true;
|
|
9498
|
+
}
|
|
9499
|
+
|
|
9500
|
+
/**
|
|
9501
|
+
* 设置军标可见性
|
|
9502
|
+
* @param {string} id 军标ID
|
|
9503
|
+
* @param {boolean} visible 是否可见
|
|
9504
|
+
* @returns {boolean}
|
|
9505
|
+
*/
|
|
9506
|
+
setVisible(id, visible) {
|
|
9507
|
+
return this.update(id, { visible });
|
|
9508
|
+
}
|
|
9509
|
+
|
|
9510
|
+
/**
|
|
9511
|
+
* 获取军标信息
|
|
9512
|
+
* @param {string} id 军标ID
|
|
9513
|
+
* @returns {{id: string, entity: Cesium.Entity, metadata: object} | undefined}
|
|
9514
|
+
*/
|
|
9515
|
+
getById(id) {
|
|
9516
|
+
const symbol = this.symbolMap.get(id);
|
|
9517
|
+
if (!symbol) return undefined;
|
|
9518
|
+
return { id, entity: symbol.entity, metadata: { ...symbol.metadata } };
|
|
9519
|
+
}
|
|
9520
|
+
|
|
9521
|
+
/**
|
|
9522
|
+
* 获取军标实体
|
|
9523
|
+
* @param {string} id 军标ID
|
|
9524
|
+
* @returns {Cesium.Entity | undefined}
|
|
9525
|
+
*/
|
|
9526
|
+
getEntity(id) {
|
|
9527
|
+
return this.symbolMap.get(id)?.entity;
|
|
9528
|
+
}
|
|
9529
|
+
|
|
9530
|
+
/**
|
|
9531
|
+
* 获取全部军标信息
|
|
9532
|
+
* @returns {Array<{id: string, entity: Cesium.Entity, metadata: object}>}
|
|
9533
|
+
*/
|
|
9534
|
+
getAll() {
|
|
9535
|
+
const result = [];
|
|
9536
|
+
this.symbolMap.forEach((symbol, id) => {
|
|
9537
|
+
result.push({ id, entity: symbol.entity, metadata: { ...symbol.metadata } });
|
|
9538
|
+
});
|
|
9539
|
+
return result;
|
|
9540
|
+
}
|
|
9541
|
+
|
|
9542
|
+
/**
|
|
9543
|
+
* 飞行定位到军标
|
|
9544
|
+
* @param {string} id 军标ID
|
|
9545
|
+
* @param {Object} options { duration?, pitch?, range? }
|
|
9546
|
+
* @returns {Promise<boolean>}
|
|
9547
|
+
*/
|
|
9548
|
+
flyTo(id, options = {}) {
|
|
9549
|
+
const entity = this.getEntity(id);
|
|
9550
|
+
if (!entity || !this.viewer) return Promise.resolve(false);
|
|
9551
|
+
|
|
9552
|
+
const position = this._getPositionFromEntity(entity);
|
|
9553
|
+
if (!position) return Promise.resolve(false);
|
|
9554
|
+
|
|
9555
|
+
const duration = options.duration ?? 1.5;
|
|
9556
|
+
const pitch = options.pitch ?? -Cesium$2.Math.PI_OVER_TWO;
|
|
9557
|
+
const range = options.range ?? 5000;
|
|
9558
|
+
|
|
9559
|
+
return this.viewer.camera.flyTo({
|
|
9560
|
+
destination: Cesium$2.Cartesian3.fromDegrees(position[0], position[1], (position[2] || 0) + range),
|
|
9561
|
+
orientation: { heading: 0, pitch, roll: 0 },
|
|
9562
|
+
duration,
|
|
9563
|
+
}).then(() => true).catch((err) => {
|
|
9564
|
+
console.error('军标定位失败', err);
|
|
9565
|
+
return false;
|
|
9566
|
+
});
|
|
9567
|
+
}
|
|
9568
|
+
|
|
9569
|
+
/**
|
|
9570
|
+
* 瞬间定位到军标
|
|
9571
|
+
* @param {string} id 军标ID
|
|
9572
|
+
* @param {Object} options { pitch?, range? }
|
|
9573
|
+
*/
|
|
9574
|
+
zoomTo(id, options = {}) {
|
|
9575
|
+
const entity = this.getEntity(id);
|
|
9576
|
+
if (!entity || !this.viewer) return;
|
|
9577
|
+
|
|
9578
|
+
const position = this._getPositionFromEntity(entity);
|
|
9579
|
+
if (!position) return;
|
|
9580
|
+
|
|
9581
|
+
const pitch = options.pitch ?? -Cesium$2.Math.PI_OVER_TWO;
|
|
9582
|
+
const range = options.range ?? 5000;
|
|
9583
|
+
|
|
9584
|
+
this.viewer.camera.setView({
|
|
9585
|
+
destination: Cesium$2.Cartesian3.fromDegrees(position[0], position[1], (position[2] || 0) + range),
|
|
9586
|
+
orientation: { heading: 0, pitch, roll: 0 },
|
|
9587
|
+
});
|
|
9588
|
+
}
|
|
9589
|
+
|
|
9590
|
+
/**
|
|
9591
|
+
* 启用拖拽编辑模式
|
|
9592
|
+
* 鼠标在军标上按下即可拖拽,拖拽结束后触发 onPositionChanged 回调。
|
|
9593
|
+
*/
|
|
9594
|
+
enableEditMode() {
|
|
9595
|
+
if (this._editMode) return;
|
|
9596
|
+
if (!this.eventModule) {
|
|
9597
|
+
console.warn('MilitarySymbolModule 未注入 EventModule,无法启用拖拽编辑');
|
|
9598
|
+
return;
|
|
9599
|
+
}
|
|
9600
|
+
|
|
9601
|
+
this._editMode = true;
|
|
9602
|
+
|
|
9603
|
+
const downId = this.eventModule.registerObserver('mouse:down', (lngLat, pickedEntity) => {
|
|
9604
|
+
const symbolId = this._getSymbolIdFromPick(pickedEntity);
|
|
9605
|
+
if (!symbolId) return;
|
|
9606
|
+
this._draggingId = symbolId;
|
|
9607
|
+
this.viewer.scene.screenSpaceCameraController.enableInputs = false;
|
|
9608
|
+
});
|
|
9609
|
+
|
|
9610
|
+
const moveId = this.eventModule.registerObserver('mouse:move', (lngLat, pickedEntity, movement) => {
|
|
9611
|
+
if (!this._draggingId || !movement?.endPosition) return;
|
|
9612
|
+
|
|
9613
|
+
const cartesian = this.viewer.scene.pickPosition(movement.endPosition)
|
|
9614
|
+
|| this.viewer.scene.camera.pickEllipsoid(movement.endPosition, this.viewer.scene.globe.ellipsoid);
|
|
9615
|
+
if (!cartesian) return;
|
|
9616
|
+
|
|
9617
|
+
const carto = Cesium$2.Cartographic.fromCartesian(cartesian);
|
|
9618
|
+
const position = [
|
|
9619
|
+
Cesium$2.Math.toDegrees(carto.longitude),
|
|
9620
|
+
Cesium$2.Math.toDegrees(carto.latitude),
|
|
9621
|
+
carto.height,
|
|
9622
|
+
];
|
|
9623
|
+
this.update(this._draggingId, { position });
|
|
9624
|
+
});
|
|
9625
|
+
|
|
9626
|
+
const upId = this.eventModule.registerObserver('mouse:up', () => {
|
|
9627
|
+
if (!this._draggingId) return;
|
|
9628
|
+
const symbol = this.symbolMap.get(this._draggingId);
|
|
9629
|
+
const payload = symbol ? { id: this._draggingId, position: [...symbol.metadata.position] } : null;
|
|
9630
|
+
this._draggingId = null;
|
|
9631
|
+
this.viewer.scene.screenSpaceCameraController.enableInputs = true;
|
|
9632
|
+
if (payload) {
|
|
9633
|
+
this._positionChangedCallbacks.forEach((callback) => callback(payload));
|
|
9634
|
+
}
|
|
9635
|
+
});
|
|
9636
|
+
|
|
9637
|
+
this._dragObserverIds = [downId, moveId, upId];
|
|
9638
|
+
}
|
|
9639
|
+
|
|
9640
|
+
/**
|
|
9641
|
+
* 禁用拖拽编辑模式
|
|
9642
|
+
*/
|
|
9643
|
+
disableEditMode() {
|
|
9644
|
+
if (!this._editMode) return;
|
|
9645
|
+
if (this.eventModule) {
|
|
9646
|
+
this._dragObserverIds.forEach((observerId) => {
|
|
9647
|
+
// 每个观察者注册时的事件类型固定,分别注销
|
|
9648
|
+
['mouse:down', 'mouse:move', 'mouse:up'].forEach((eventType) => {
|
|
9649
|
+
try {
|
|
9650
|
+
this.eventModule.unregisterObserver(eventType, observerId);
|
|
9651
|
+
} catch (e) {
|
|
9652
|
+
// 忽略跨事件类型注销失败
|
|
9653
|
+
}
|
|
9654
|
+
});
|
|
9655
|
+
});
|
|
9656
|
+
}
|
|
9657
|
+
this._dragObserverIds = [];
|
|
9658
|
+
this._draggingId = null;
|
|
9659
|
+
this.viewer.scene.screenSpaceCameraController.enableInputs = true;
|
|
9660
|
+
this._editMode = false;
|
|
9661
|
+
}
|
|
9662
|
+
|
|
9663
|
+
/**
|
|
9664
|
+
* 注册位置变化回调
|
|
9665
|
+
* @param {Function} callback 回调参数 { id, position }
|
|
9666
|
+
* @returns {Function} 注销函数
|
|
9667
|
+
*/
|
|
9668
|
+
onPositionChanged(callback) {
|
|
9669
|
+
this._positionChangedCallbacks.add(callback);
|
|
9670
|
+
return () => this._positionChangedCallbacks.delete(callback);
|
|
9671
|
+
}
|
|
9672
|
+
}
|
|
9673
|
+
|
|
9040
9674
|
/**
|
|
9041
9675
|
* 模块管理器(对应平台 GetModule 逻辑)
|
|
9042
9676
|
* 统一管理场景、图元、事件模块的实例
|
|
@@ -9093,6 +9727,13 @@ class ModuleManager {
|
|
|
9093
9727
|
}).init();
|
|
9094
9728
|
this.registerModule('EditorModule', editorModule);
|
|
9095
9729
|
|
|
9730
|
+
// 初始化军标模块(依赖事件模块)
|
|
9731
|
+
const militarySymbolModule = new MilitarySymbolModule(this.cesiumViewer);
|
|
9732
|
+
militarySymbolModule.setDependencies({
|
|
9733
|
+
eventModule: this.getModule('EventModule')
|
|
9734
|
+
});
|
|
9735
|
+
this.registerModule('MilitarySymbolModule', militarySymbolModule);
|
|
9736
|
+
|
|
9096
9737
|
// 初始化控件模块
|
|
9097
9738
|
const controlModule = new ControlModule(this.cesiumViewer);
|
|
9098
9739
|
this.registerModule('ControlModule', controlModule);
|
|
@@ -9158,6 +9799,14 @@ class ModuleManager {
|
|
|
9158
9799
|
return this.getModule('EditorModule');
|
|
9159
9800
|
}
|
|
9160
9801
|
|
|
9802
|
+
/**
|
|
9803
|
+
* 军标模块快捷访问
|
|
9804
|
+
* @returns {MilitarySymbolModule}
|
|
9805
|
+
*/
|
|
9806
|
+
get militarySymbolModule() {
|
|
9807
|
+
return this.getModule('MilitarySymbolModule');
|
|
9808
|
+
}
|
|
9809
|
+
|
|
9161
9810
|
/**
|
|
9162
9811
|
* 控件模块快捷访问
|
|
9163
9812
|
* @returns {ControlModule}
|
|
@@ -9330,6 +9979,7 @@ const xs3d = {
|
|
|
9330
9979
|
EventModule,
|
|
9331
9980
|
EditorModule,
|
|
9332
9981
|
ControlModule,
|
|
9982
|
+
MilitarySymbolModule,
|
|
9333
9983
|
CoordinateUtil,
|
|
9334
9984
|
GeoCalcUtil,
|
|
9335
9985
|
// 导出控件类
|