leiting-bim 2.1.48 → 2.1.52
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/package.json +16 -2
- package/plugins/cesium-core/dist/cesium-core.mjs +587 -535
- package/plugins/cesium-core/dist/cesium-core.mjs.map +1 -0
- package/plugins/cesium-core/dist/cesium-core.umd.js +19 -18
- package/plugins/cesium-core/dist/cesium-core.umd.js.map +1 -0
- package/plugins/cesium-core/dist/components/BufferedHierarchicalAggregator.d.ts +76 -73
- package/plugins/cesium-vue/dist/_commonjsHelpers-DaMA6jEr.js +1 -0
- package/plugins/cesium-vue/dist/_commonjsHelpers-DaMA6jEr.js.map +1 -0
- package/plugins/cesium-vue/dist/components/basic-audio.js +3 -2
- package/plugins/cesium-vue/dist/components/basic-audio.js.map +1 -0
- package/plugins/cesium-vue/dist/components/basic-video.js +3 -2
- package/plugins/cesium-vue/dist/components/basic-video.js.map +1 -0
- package/plugins/cesium-vue/dist/components/card-carousel.js +2 -1
- package/plugins/cesium-vue/dist/components/card-carousel.js.map +1 -0
- package/plugins/cesium-vue/dist/components/card-content.js +13 -12
- package/plugins/cesium-vue/dist/components/card-content.js.map +1 -0
- package/plugins/cesium-vue/dist/components/card-page.js +2 -1
- package/plugins/cesium-vue/dist/components/card-page.js.map +1 -0
- package/plugins/cesium-vue/dist/components/carousel-img.js +6 -5
- package/plugins/cesium-vue/dist/components/carousel-img.js.map +1 -0
- package/plugins/cesium-vue/dist/components/echarts-pro.js +2 -1
- package/plugins/cesium-vue/dist/components/echarts-pro.js.map +1 -0
- package/plugins/cesium-vue/dist/components/marker-bubble.js +5 -4
- package/plugins/cesium-vue/dist/components/marker-bubble.js.map +1 -0
- package/plugins/cesium-vue/dist/components/marker-default.js +6 -5
- package/plugins/cesium-vue/dist/components/marker-default.js.map +1 -0
- package/plugins/cesium-vue/dist/components/marker-html.js +6 -5
- package/plugins/cesium-vue/dist/components/marker-html.js.map +1 -0
- package/plugins/cesium-vue/dist/components/marker-manage.js +112 -94
- package/plugins/cesium-vue/dist/components/marker-manage.js.map +1 -0
- package/plugins/cesium-vue/dist/components/marker-text.js +6 -5
- package/plugins/cesium-vue/dist/components/marker-text.js.map +1 -0
- package/plugins/cesium-vue/dist/components/measurement.js +4 -3
- package/plugins/cesium-vue/dist/components/measurement.js.map +1 -0
- package/plugins/cesium-vue/dist/components/position-picker/index.d.ts +58 -0
- package/plugins/cesium-vue/dist/components/position-picker.d.ts +6 -0
- package/plugins/cesium-vue/dist/components/position-picker.js +243 -0
- package/plugins/cesium-vue/dist/components/position-picker.js.map +1 -0
- package/plugins/cesium-vue/dist/create-DynflqE1.js +1 -0
- package/plugins/cesium-vue/dist/create-DynflqE1.js.map +1 -0
- package/plugins/cesium-vue/dist/{index-B03tSn8_.js → index-C0pspk3x.js} +3 -2
- package/plugins/cesium-vue/dist/index-C0pspk3x.js.map +1 -0
- package/plugins/cesium-vue/dist/index-CUs_hd1V.js +1 -0
- package/plugins/cesium-vue/dist/index-CUs_hd1V.js.map +1 -0
- package/plugins/cesium-vue/dist/index.d.ts +3 -1
- package/plugins/cesium-vue/dist/index.js +31 -27
- package/plugins/cesium-vue/dist/index.js.map +1 -0
- package/plugins/cesium-vue/package.json +4 -0
- package/plugins/theme-chalk/dist/debug.log +1 -0
- package/plugins/.gitmodules +0 -4
- package/plugins/README.md +0 -2
- package/plugins/build.cjs +0 -63
- package/plugins/cesium-core/pnpm-lock.yaml +0 -872
- package/plugins/cesium-core/src/components/BufferedHierarchicalAggregator.ts +0 -546
- package/plugins/cesium-core/src/components/HtmlOverlayLabelPool.ts +0 -489
- package/plugins/cesium-core/src/components/MarkerEvent.ts +0 -92
- package/plugins/cesium-core/src/components/Material/MaterialManager.ts +0 -129
- package/plugins/cesium-core/src/components/Material/help/PolylineFlowMaterialProperty.ts +0 -116
- package/plugins/cesium-core/src/components/Material/help/dynamicImgMaterial.ts +0 -236
- package/plugins/cesium-core/src/components/Material/index.ts +0 -3
- package/plugins/cesium-core/src/components/TooltipManager.ts +0 -52
- package/plugins/cesium-core/src/components/draw/DrawTool.ts +0 -55
- package/plugins/cesium-core/src/components/draw/handlers/CircleDrawer.ts +0 -159
- package/plugins/cesium-core/src/components/draw/handlers/LineDrawer.ts +0 -113
- package/plugins/cesium-core/src/components/draw/handlers/PointDrawer.ts +0 -70
- package/plugins/cesium-core/src/components/draw/handlers/PolygonDrawer.ts +0 -112
- package/plugins/cesium-core/src/components/draw/handlers/RectangleDrawer.ts +0 -115
- package/plugins/cesium-core/src/components/draw/types.ts +0 -28
- package/plugins/cesium-core/src/components/entity/EntityLayer.ts +0 -453
- package/plugins/cesium-core/src/components/gltf/GLTFManage.ts +0 -799
- package/plugins/cesium-core/src/components/gltf/index.ts +0 -1
- package/plugins/cesium-core/src/components/measurement/MeasurementTool.ts +0 -416
- package/plugins/cesium-core/src/components/measurement/handlers/AreaMeasure.ts +0 -552
- package/plugins/cesium-core/src/components/measurement/handlers/CircleMeasure.ts +0 -289
- package/plugins/cesium-core/src/components/measurement/handlers/CoordinateMeasure.ts +0 -139
- package/plugins/cesium-core/src/components/measurement/handlers/HorizontalMeasure.ts +0 -427
- package/plugins/cesium-core/src/components/measurement/handlers/PolylineDistanceMeasure.ts +0 -356
- package/plugins/cesium-core/src/components/measurement/handlers/RectangleMeasure.ts +0 -516
- package/plugins/cesium-core/src/components/measurement/handlers/RegularPolygonMeasure.ts +0 -472
- package/plugins/cesium-core/src/components/measurement/handlers/SpaceMeasure.ts +0 -250
- package/plugins/cesium-core/src/components/measurement/handlers/TerrainHeightMeasure.ts +0 -185
- package/plugins/cesium-core/src/components/measurement/handlers/TriangleMeasure.ts +0 -561
- package/plugins/cesium-core/src/components/measurement/handlers/VerticalMeasure.ts +0 -361
- package/plugins/cesium-core/src/components/measurement/index.ts +0 -13
- package/plugins/cesium-core/src/components/measurement/types.ts +0 -57
- package/plugins/cesium-core/src/components/primitive/PrimitiveManager.ts +0 -556
- package/plugins/cesium-core/src/components/roaming/CameraRoamTool.ts +0 -286
- package/plugins/cesium-core/src/components/roaming/PathRoamTool.ts +0 -174
- package/plugins/cesium-core/src/components/roaming/index.ts +0 -3
- package/plugins/cesium-core/src/components/roaming/types.ts +0 -71
- package/plugins/cesium-core/src/components/utils/convertGeoJsonToEntityData.ts +0 -98
- package/plugins/cesium-core/src/components/utils/uuid.ts +0 -7
- package/plugins/cesium-core/src/index.ts +0 -17
- package/plugins/cesium-core/src/test/measurement/index.html +0 -166
- package/plugins/cesium-core/src/test/roaming/c.gltf +0 -1
- package/plugins/cesium-core/src/test/roaming/f87cc3ea918a4b76bff2c88a3655eb1f.bin +0 -0
- package/plugins/cesium-core/src/test/roaming/index.html +0 -51
- package/plugins/cesium-core/src/test/roaming/path.html +0 -448
- package/plugins/cesium-core/src/test/roaming/view.html +0 -520
- package/plugins/cesium-core/stats.html +0 -4949
- package/plugins/cesium-core/tsconfig.json +0 -14
- package/plugins/cesium-core/vite.config.ts +0 -35
- package/plugins/cesium-vue/src/assets/icons/icon-001.png +0 -0
- package/plugins/cesium-vue/src/assets/icons/icon-002.png +0 -0
- package/plugins/cesium-vue/src/assets/icons/icon-003.png +0 -0
- package/plugins/cesium-vue/src/assets/icons/icon-004.png +0 -0
- package/plugins/cesium-vue/src/assets/icons/icon-005.png +0 -0
- package/plugins/cesium-vue/src/assets/icons/icon-006.png +0 -0
- package/plugins/cesium-vue/src/assets/icons/icon-007.png +0 -0
- package/plugins/cesium-vue/src/assets/icons/icon-008.png +0 -0
- package/plugins/cesium-vue/src/assets/icons/icon-009.png +0 -0
- package/plugins/cesium-vue/src/assets/icons/icon-010.png +0 -0
- package/plugins/cesium-vue/src/assets/icons/icon-011.png +0 -0
- package/plugins/cesium-vue/src/assets/icons/icon-012.png +0 -0
- package/plugins/cesium-vue/src/assets/img/Card3-BG.png +0 -0
- package/plugins/cesium-vue/src/assets/img/card_bg3.png +0 -0
- package/plugins/cesium-vue/src/components/basic-audio/index.ts +0 -6
- package/plugins/cesium-vue/src/components/basic-audio/src/BasicAudio.vue +0 -119
- package/plugins/cesium-vue/src/components/basic-audio/src/basicAudio.ts +0 -6
- package/plugins/cesium-vue/src/components/basic-video/index.ts +0 -7
- package/plugins/cesium-vue/src/components/basic-video/src/BasicVideo.vue +0 -58
- package/plugins/cesium-vue/src/components/basic-video/src/basicVideo.ts +0 -14
- package/plugins/cesium-vue/src/components/card-carousel/index.ts +0 -7
- package/plugins/cesium-vue/src/components/card-carousel/src/CardCarousel.vue +0 -124
- package/plugins/cesium-vue/src/components/card-carousel/src/cardCarousel.ts +0 -60
- package/plugins/cesium-vue/src/components/card-content/index.ts +0 -7
- package/plugins/cesium-vue/src/components/card-content/src/CardContent.vue +0 -41
- package/plugins/cesium-vue/src/components/card-content/src/cardContent.ts +0 -22
- package/plugins/cesium-vue/src/components/card-page/index.ts +0 -7
- package/plugins/cesium-vue/src/components/card-page/src/CardPage.vue +0 -102
- package/plugins/cesium-vue/src/components/card-page/src/cardPage.ts +0 -37
- package/plugins/cesium-vue/src/components/carousel-img/index.ts +0 -7
- package/plugins/cesium-vue/src/components/carousel-img/src/CarouselImg.vue +0 -84
- package/plugins/cesium-vue/src/components/carousel-img/src/carouselImg.ts +0 -8
- package/plugins/cesium-vue/src/components/echarts-pro/index.ts +0 -7
- package/plugins/cesium-vue/src/components/echarts-pro/src/EchartsPro.vue +0 -107
- package/plugins/cesium-vue/src/components/echarts-pro/src/echartsPro.ts +0 -12
- package/plugins/cesium-vue/src/components/echarts-pro/src/hook/useECharts.ts +0 -55
- package/plugins/cesium-vue/src/components/marker-bubble/index.ts +0 -7
- package/plugins/cesium-vue/src/components/marker-bubble/src/MarkerBubble.vue +0 -235
- package/plugins/cesium-vue/src/components/marker-bubble/src/markerBubble.ts +0 -35
- package/plugins/cesium-vue/src/components/marker-default/index.ts +0 -7
- package/plugins/cesium-vue/src/components/marker-default/src/MarkerDefault.vue +0 -19
- package/plugins/cesium-vue/src/components/marker-default/src/markerDefault.ts +0 -12
- package/plugins/cesium-vue/src/components/marker-html/index.ts +0 -7
- package/plugins/cesium-vue/src/components/marker-html/src/MarkerHtml.vue +0 -21
- package/plugins/cesium-vue/src/components/marker-html/src/markerHtml.ts +0 -12
- package/plugins/cesium-vue/src/components/marker-manage/index.ts +0 -9
- package/plugins/cesium-vue/src/components/marker-manage/src/components/MarkerManage.vue +0 -106
- package/plugins/cesium-vue/src/components/marker-manage/src/config/theme.ts +0 -8
- package/plugins/cesium-vue/src/components/marker-manage/src/core/MarkerManage.ts +0 -466
- package/plugins/cesium-vue/src/components/marker-manage/src/core/MarkerManagerCore.ts +0 -148
- package/plugins/cesium-vue/src/components/marker-manage/src/hook/useMarkerManage.ts +0 -45
- package/plugins/cesium-vue/src/components/marker-manage/src/type/markerManage.ts +0 -75
- package/plugins/cesium-vue/src/components/marker-manage/src/utils/themeTool.ts +0 -154
- package/plugins/cesium-vue/src/components/marker-text/index.ts +0 -7
- package/plugins/cesium-vue/src/components/marker-text/src/MarkerText.vue +0 -14
- package/plugins/cesium-vue/src/components/marker-text/src/markerText.ts +0 -10
- package/plugins/cesium-vue/src/components/measurement/index.ts +0 -7
- package/plugins/cesium-vue/src/components/measurement/src/Measurement.vue +0 -183
- package/plugins/cesium-vue/src/components/measurement/src/measurement.ts +0 -20
- package/plugins/cesium-vue/src/index.ts +0 -89
- package/plugins/cesium-vue/stats.html +0 -4949
- package/plugins/cesium-vue/tsconfig.json +0 -18
- package/plugins/cesium-vue/vite.config.ts +0 -62
- package/plugins/plugins/README.md +0 -2
- package/plugins/plugins/build.cjs +0 -63
- package/plugins/plugins/cesium-core/dist/cesium-core.mjs +0 -5881
- package/plugins/plugins/cesium-core/dist/cesium-core.mjs.map +0 -1
- package/plugins/plugins/cesium-core/dist/cesium-core.umd.js +0 -77
- package/plugins/plugins/cesium-core/dist/cesium-core.umd.js.map +0 -1
- package/plugins/plugins/cesium-core/dist/components/BufferedHierarchicalAggregator.d.ts +0 -73
- package/plugins/plugins/cesium-core/dist/components/HtmlOverlayLabelPool.d.ts +0 -152
- package/plugins/plugins/cesium-core/dist/components/MarkerEvent.d.ts +0 -38
- package/plugins/plugins/cesium-core/dist/components/Material/MaterialManager.d.ts +0 -49
- package/plugins/plugins/cesium-core/dist/components/Material/help/PolylineFlowMaterialProperty.d.ts +0 -10
- package/plugins/plugins/cesium-core/dist/components/Material/help/dynamicImgMaterial.d.ts +0 -16
- package/plugins/plugins/cesium-core/dist/components/Material/index.d.ts +0 -3
- package/plugins/plugins/cesium-core/dist/components/TooltipManager.d.ts +0 -11
- package/plugins/plugins/cesium-core/dist/components/draw/DrawTool.d.ts +0 -10
- package/plugins/plugins/cesium-core/dist/components/draw/handlers/CircleDrawer.d.ts +0 -16
- package/plugins/plugins/cesium-core/dist/components/draw/handlers/LineDrawer.d.ts +0 -14
- package/plugins/plugins/cesium-core/dist/components/draw/handlers/PointDrawer.d.ts +0 -12
- package/plugins/plugins/cesium-core/dist/components/draw/handlers/PolygonDrawer.d.ts +0 -14
- package/plugins/plugins/cesium-core/dist/components/draw/handlers/RectangleDrawer.d.ts +0 -13
- package/plugins/plugins/cesium-core/dist/components/draw/types.d.ts +0 -29
- package/plugins/plugins/cesium-core/dist/components/entity/EntityLayer.d.ts +0 -65
- package/plugins/plugins/cesium-core/dist/components/gltf/GLTFManage.d.ts +0 -141
- package/plugins/plugins/cesium-core/dist/components/gltf/index.d.ts +0 -1
- package/plugins/plugins/cesium-core/dist/components/measurement/MeasurementTool.d.ts +0 -34
- package/plugins/plugins/cesium-core/dist/components/measurement/handlers/AreaMeasure.d.ts +0 -23
- package/plugins/plugins/cesium-core/dist/components/measurement/handlers/CircleMeasure.d.ts +0 -21
- package/plugins/plugins/cesium-core/dist/components/measurement/handlers/CoordinateMeasure.d.ts +0 -16
- package/plugins/plugins/cesium-core/dist/components/measurement/handlers/HorizontalMeasure.d.ts +0 -25
- package/plugins/plugins/cesium-core/dist/components/measurement/handlers/PolylineDistanceMeasure.d.ts +0 -24
- package/plugins/plugins/cesium-core/dist/components/measurement/handlers/RectangleMeasure.d.ts +0 -22
- package/plugins/plugins/cesium-core/dist/components/measurement/handlers/RegularPolygonMeasure.d.ts +0 -23
- package/plugins/plugins/cesium-core/dist/components/measurement/handlers/SpaceMeasure.d.ts +0 -20
- package/plugins/plugins/cesium-core/dist/components/measurement/handlers/TerrainHeightMeasure.d.ts +0 -18
- package/plugins/plugins/cesium-core/dist/components/measurement/handlers/TriangleMeasure.d.ts +0 -24
- package/plugins/plugins/cesium-core/dist/components/measurement/handlers/VerticalMeasure.d.ts +0 -23
- package/plugins/plugins/cesium-core/dist/components/measurement/index.d.ts +0 -13
- package/plugins/plugins/cesium-core/dist/components/measurement/types.d.ts +0 -42
- package/plugins/plugins/cesium-core/dist/components/primitive/PrimitiveManager.d.ts +0 -50
- package/plugins/plugins/cesium-core/dist/components/roaming/CameraRoamTool.d.ts +0 -27
- package/plugins/plugins/cesium-core/dist/components/roaming/PathRoamTool.d.ts +0 -23
- package/plugins/plugins/cesium-core/dist/components/roaming/index.d.ts +0 -3
- package/plugins/plugins/cesium-core/dist/components/roaming/types.d.ts +0 -66
- package/plugins/plugins/cesium-core/dist/components/utils/convertGeoJsonToEntityData.d.ts +0 -1
- package/plugins/plugins/cesium-core/dist/components/utils/uuid.d.ts +0 -1
- package/plugins/plugins/cesium-core/dist/index.d.ts +0 -12
- package/plugins/plugins/cesium-core/package.json +0 -26
- package/plugins/plugins/cesium-core/pnpm-lock.yaml +0 -872
- package/plugins/plugins/cesium-core/src/components/BufferedHierarchicalAggregator.ts +0 -546
- package/plugins/plugins/cesium-core/src/components/HtmlOverlayLabelPool.ts +0 -489
- package/plugins/plugins/cesium-core/src/components/MarkerEvent.ts +0 -92
- package/plugins/plugins/cesium-core/src/components/Material/MaterialManager.ts +0 -129
- package/plugins/plugins/cesium-core/src/components/Material/help/PolylineFlowMaterialProperty.ts +0 -116
- package/plugins/plugins/cesium-core/src/components/Material/help/dynamicImgMaterial.ts +0 -236
- package/plugins/plugins/cesium-core/src/components/Material/index.ts +0 -3
- package/plugins/plugins/cesium-core/src/components/TooltipManager.ts +0 -52
- package/plugins/plugins/cesium-core/src/components/draw/DrawTool.ts +0 -55
- package/plugins/plugins/cesium-core/src/components/draw/handlers/CircleDrawer.ts +0 -159
- package/plugins/plugins/cesium-core/src/components/draw/handlers/LineDrawer.ts +0 -113
- package/plugins/plugins/cesium-core/src/components/draw/handlers/PointDrawer.ts +0 -70
- package/plugins/plugins/cesium-core/src/components/draw/handlers/PolygonDrawer.ts +0 -112
- package/plugins/plugins/cesium-core/src/components/draw/handlers/RectangleDrawer.ts +0 -115
- package/plugins/plugins/cesium-core/src/components/draw/types.ts +0 -28
- package/plugins/plugins/cesium-core/src/components/entity/EntityLayer.ts +0 -453
- package/plugins/plugins/cesium-core/src/components/gltf/GLTFManage.ts +0 -799
- package/plugins/plugins/cesium-core/src/components/gltf/index.ts +0 -1
- package/plugins/plugins/cesium-core/src/components/measurement/MeasurementTool.ts +0 -416
- package/plugins/plugins/cesium-core/src/components/measurement/handlers/AreaMeasure.ts +0 -451
- package/plugins/plugins/cesium-core/src/components/measurement/handlers/CircleMeasure.ts +0 -267
- package/plugins/plugins/cesium-core/src/components/measurement/handlers/CoordinateMeasure.ts +0 -139
- package/plugins/plugins/cesium-core/src/components/measurement/handlers/HorizontalMeasure.ts +0 -418
- package/plugins/plugins/cesium-core/src/components/measurement/handlers/PolylineDistanceMeasure.ts +0 -352
- package/plugins/plugins/cesium-core/src/components/measurement/handlers/RectangleMeasure.ts +0 -388
- package/plugins/plugins/cesium-core/src/components/measurement/handlers/RegularPolygonMeasure.ts +0 -379
- package/plugins/plugins/cesium-core/src/components/measurement/handlers/SpaceMeasure.ts +0 -246
- package/plugins/plugins/cesium-core/src/components/measurement/handlers/TerrainHeightMeasure.ts +0 -185
- package/plugins/plugins/cesium-core/src/components/measurement/handlers/TriangleMeasure.ts +0 -541
- package/plugins/plugins/cesium-core/src/components/measurement/handlers/VerticalMeasure.ts +0 -360
- package/plugins/plugins/cesium-core/src/components/measurement/index.ts +0 -13
- package/plugins/plugins/cesium-core/src/components/measurement/types.ts +0 -57
- package/plugins/plugins/cesium-core/src/components/primitive/PrimitiveManager.ts +0 -556
- package/plugins/plugins/cesium-core/src/components/roaming/CameraRoamTool.ts +0 -286
- package/plugins/plugins/cesium-core/src/components/roaming/PathRoamTool.ts +0 -174
- package/plugins/plugins/cesium-core/src/components/roaming/index.ts +0 -3
- package/plugins/plugins/cesium-core/src/components/roaming/types.ts +0 -71
- package/plugins/plugins/cesium-core/src/components/utils/convertGeoJsonToEntityData.ts +0 -98
- package/plugins/plugins/cesium-core/src/components/utils/uuid.ts +0 -7
- package/plugins/plugins/cesium-core/src/index.ts +0 -17
- package/plugins/plugins/cesium-core/src/test/measurement/index.html +0 -166
- package/plugins/plugins/cesium-core/src/test/roaming/c.gltf +0 -1
- package/plugins/plugins/cesium-core/src/test/roaming/f87cc3ea918a4b76bff2c88a3655eb1f.bin +0 -0
- package/plugins/plugins/cesium-core/src/test/roaming/index.html +0 -51
- package/plugins/plugins/cesium-core/src/test/roaming/path.html +0 -448
- package/plugins/plugins/cesium-core/src/test/roaming/view.html +0 -520
- package/plugins/plugins/cesium-core/stats.html +0 -4949
- package/plugins/plugins/cesium-core/tsconfig.json +0 -14
- package/plugins/plugins/cesium-core/vite.config.ts +0 -35
- package/plugins/plugins/cesium-vue/dist/components/basic-audio/index.d.ts +0 -18
- package/plugins/plugins/cesium-vue/dist/components/basic-audio/index.d.ts.map +0 -1
- package/plugins/plugins/cesium-vue/dist/components/basic-video/index.d.ts +0 -92
- package/plugins/plugins/cesium-vue/dist/components/basic-video/index.d.ts.map +0 -1
- package/plugins/plugins/cesium-vue/dist/components/camera-roam/index.d.ts +0 -82
- package/plugins/plugins/cesium-vue/dist/components/camera-roam/index.d.ts.map +0 -1
- package/plugins/plugins/cesium-vue/dist/components/card-carousel/index.d.ts +0 -152
- package/plugins/plugins/cesium-vue/dist/components/card-carousel/index.d.ts.map +0 -1
- package/plugins/plugins/cesium-vue/dist/components/card-content/index.d.ts +0 -21
- package/plugins/plugins/cesium-vue/dist/components/card-content/index.d.ts.map +0 -1
- package/plugins/plugins/cesium-vue/dist/components/card-page/index.d.ts +0 -69
- package/plugins/plugins/cesium-vue/dist/components/card-page/index.d.ts.map +0 -1
- package/plugins/plugins/cesium-vue/dist/components/carousel-img/index.d.ts +0 -21
- package/plugins/plugins/cesium-vue/dist/components/carousel-img/index.d.ts.map +0 -1
- package/plugins/plugins/cesium-vue/dist/components/echarts-pro/index.d.ts +0 -68
- package/plugins/plugins/cesium-vue/dist/components/echarts-pro/index.d.ts.map +0 -1
- package/plugins/plugins/cesium-vue/dist/components/marker-bubble/index.d.ts +0 -78
- package/plugins/plugins/cesium-vue/dist/components/marker-bubble/index.d.ts.map +0 -1
- package/plugins/plugins/cesium-vue/dist/components/marker-default/index.d.ts +0 -48
- package/plugins/plugins/cesium-vue/dist/components/marker-default/index.d.ts.map +0 -1
- package/plugins/plugins/cesium-vue/dist/components/marker-html/index.d.ts +0 -48
- package/plugins/plugins/cesium-vue/dist/components/marker-html/index.d.ts.map +0 -1
- package/plugins/plugins/cesium-vue/dist/components/marker-manage/index.d.ts +0 -164
- package/plugins/plugins/cesium-vue/dist/components/marker-manage/index.d.ts.map +0 -1
- package/plugins/plugins/cesium-vue/dist/components/marker-text/index.d.ts +0 -30
- package/plugins/plugins/cesium-vue/dist/components/marker-text/index.d.ts.map +0 -1
- package/plugins/plugins/cesium-vue/dist/components/measurement/index.d.ts +0 -78
- package/plugins/plugins/cesium-vue/dist/components/measurement/index.d.ts.map +0 -1
- package/plugins/plugins/cesium-vue/dist/components/path-roam/index.d.ts +0 -82
- package/plugins/plugins/cesium-vue/dist/components/path-roam/index.d.ts.map +0 -1
- package/plugins/plugins/cesium-vue/dist/components/test/index.d.ts +0 -67
- package/plugins/plugins/cesium-vue/dist/components/test/index.d.ts.map +0 -1
- package/plugins/plugins/cesium-vue/dist/index.css +0 -1
- package/plugins/plugins/cesium-vue/dist/index.d.ts +0 -30
- package/plugins/plugins/cesium-vue/dist/index.d.ts.map +0 -1
- package/plugins/plugins/cesium-vue/dist/index.js +0 -10087
- package/plugins/plugins/cesium-vue/dist/index.js.map +0 -1
- package/plugins/plugins/cesium-vue/dist/index.umd.cjs +0 -46
- package/plugins/plugins/cesium-vue/dist/index.umd.cjs.map +0 -1
- package/plugins/plugins/cesium-vue/package.json +0 -48
- package/plugins/plugins/cesium-vue/src/assets/icons/icon-001.png +0 -0
- package/plugins/plugins/cesium-vue/src/assets/icons/icon-002.png +0 -0
- package/plugins/plugins/cesium-vue/src/assets/icons/icon-003.png +0 -0
- package/plugins/plugins/cesium-vue/src/assets/icons/icon-004.png +0 -0
- package/plugins/plugins/cesium-vue/src/assets/icons/icon-005.png +0 -0
- package/plugins/plugins/cesium-vue/src/assets/icons/icon-006.png +0 -0
- package/plugins/plugins/cesium-vue/src/assets/icons/icon-007.png +0 -0
- package/plugins/plugins/cesium-vue/src/assets/icons/icon-008.png +0 -0
- package/plugins/plugins/cesium-vue/src/assets/icons/icon-009.png +0 -0
- package/plugins/plugins/cesium-vue/src/assets/icons/icon-010.png +0 -0
- package/plugins/plugins/cesium-vue/src/assets/icons/icon-011.png +0 -0
- package/plugins/plugins/cesium-vue/src/assets/icons/icon-012.png +0 -0
- package/plugins/plugins/cesium-vue/src/assets/img/Card3-BG.png +0 -0
- package/plugins/plugins/cesium-vue/src/assets/img/card_bg3.png +0 -0
- package/plugins/plugins/cesium-vue/src/components/basic-audio/index.ts +0 -11
- package/plugins/plugins/cesium-vue/src/components/basic-audio/src/BasicAudio.vue +0 -110
- package/plugins/plugins/cesium-vue/src/components/basic-audio/src/basicAudio.ts +0 -6
- package/plugins/plugins/cesium-vue/src/components/basic-video/index.ts +0 -12
- package/plugins/plugins/cesium-vue/src/components/basic-video/src/BasicVideo.vue +0 -99
- package/plugins/plugins/cesium-vue/src/components/basic-video/src/basicVideo.ts +0 -13
- package/plugins/plugins/cesium-vue/src/components/camera-roam/index.ts +0 -4
- package/plugins/plugins/cesium-vue/src/components/camera-roam/src/CameraRoam.vue +0 -434
- package/plugins/plugins/cesium-vue/src/components/camera-roam/src/cameraRoam.ts +0 -28
- package/plugins/plugins/cesium-vue/src/components/card-carousel/index.ts +0 -12
- package/plugins/plugins/cesium-vue/src/components/card-carousel/src/CardCarousel.vue +0 -124
- package/plugins/plugins/cesium-vue/src/components/card-carousel/src/cardCarousel.ts +0 -60
- package/plugins/plugins/cesium-vue/src/components/card-content/index.ts +0 -12
- package/plugins/plugins/cesium-vue/src/components/card-content/src/CardContent.vue +0 -41
- package/plugins/plugins/cesium-vue/src/components/card-content/src/cardContent.ts +0 -22
- package/plugins/plugins/cesium-vue/src/components/card-page/index.ts +0 -12
- package/plugins/plugins/cesium-vue/src/components/card-page/src/CardPage.vue +0 -102
- package/plugins/plugins/cesium-vue/src/components/card-page/src/cardPage.ts +0 -37
- package/plugins/plugins/cesium-vue/src/components/carousel-img/index.ts +0 -12
- package/plugins/plugins/cesium-vue/src/components/carousel-img/src/CarouselImg.vue +0 -15
- package/plugins/plugins/cesium-vue/src/components/carousel-img/src/carouselImg.ts +0 -6
- package/plugins/plugins/cesium-vue/src/components/echarts-pro/index.ts +0 -12
- package/plugins/plugins/cesium-vue/src/components/echarts-pro/src/EchartsPro.vue +0 -107
- package/plugins/plugins/cesium-vue/src/components/echarts-pro/src/echartsPro.ts +0 -12
- package/plugins/plugins/cesium-vue/src/components/echarts-pro/src/hook/useECharts.ts +0 -55
- package/plugins/plugins/cesium-vue/src/components/marker-bubble/index.ts +0 -12
- package/plugins/plugins/cesium-vue/src/components/marker-bubble/src/MarkerBubble.vue +0 -235
- package/plugins/plugins/cesium-vue/src/components/marker-bubble/src/markerBubble.ts +0 -35
- package/plugins/plugins/cesium-vue/src/components/marker-default/index.ts +0 -12
- package/plugins/plugins/cesium-vue/src/components/marker-default/src/MarkerDefault.vue +0 -19
- package/plugins/plugins/cesium-vue/src/components/marker-default/src/markerDefault.ts +0 -12
- package/plugins/plugins/cesium-vue/src/components/marker-html/index.ts +0 -12
- package/plugins/plugins/cesium-vue/src/components/marker-html/src/MarkerHtml.vue +0 -21
- package/plugins/plugins/cesium-vue/src/components/marker-html/src/markerHtml.ts +0 -12
- package/plugins/plugins/cesium-vue/src/components/marker-manage/index.ts +0 -14
- package/plugins/plugins/cesium-vue/src/components/marker-manage/src/components/MarkerManage.vue +0 -106
- package/plugins/plugins/cesium-vue/src/components/marker-manage/src/config/theme.ts +0 -8
- package/plugins/plugins/cesium-vue/src/components/marker-manage/src/core/MarkerManage.ts +0 -466
- package/plugins/plugins/cesium-vue/src/components/marker-manage/src/core/MarkerManagerCore.ts +0 -148
- package/plugins/plugins/cesium-vue/src/components/marker-manage/src/hook/useMarkerManage.ts +0 -45
- package/plugins/plugins/cesium-vue/src/components/marker-manage/src/type/markerManage.ts +0 -75
- package/plugins/plugins/cesium-vue/src/components/marker-manage/src/utils/themeTool.ts +0 -154
- package/plugins/plugins/cesium-vue/src/components/marker-text/index.ts +0 -12
- package/plugins/plugins/cesium-vue/src/components/marker-text/src/MarkerText.vue +0 -14
- package/plugins/plugins/cesium-vue/src/components/marker-text/src/markerText.ts +0 -10
- package/plugins/plugins/cesium-vue/src/components/measurement/index.ts +0 -12
- package/plugins/plugins/cesium-vue/src/components/measurement/src/Measurement.vue +0 -183
- package/plugins/plugins/cesium-vue/src/components/measurement/src/measurement.ts +0 -20
- package/plugins/plugins/cesium-vue/src/components/path-roam/index.ts +0 -4
- package/plugins/plugins/cesium-vue/src/components/path-roam/src/PathRoam.vue +0 -429
- package/plugins/plugins/cesium-vue/src/components/path-roam/src/pathRoam.ts +0 -28
- package/plugins/plugins/cesium-vue/src/components/test/CardMarker.vue +0 -150
- package/plugins/plugins/cesium-vue/src/components/test/CesiumMarker.vue +0 -34
- package/plugins/plugins/cesium-vue/src/components/test/CesiumViewer.vue +0 -77
- package/plugins/plugins/cesium-vue/src/components/test/MyLabel.vue +0 -25
- package/plugins/plugins/cesium-vue/src/components/test/index.ts +0 -28
- package/plugins/plugins/cesium-vue/src/index.ts +0 -83
- package/plugins/plugins/cesium-vue/stats.html +0 -4949
- package/plugins/plugins/cesium-vue/tsconfig.json +0 -18
- package/plugins/plugins/cesium-vue/vite.config.ts +0 -56
- package/plugins/plugins/theme-chalk/dist/theme-chalk.css +0 -819
- package/plugins/plugins/theme-chalk/index.less +0 -11
- package/plugins/plugins/theme-chalk/package.json +0 -27
- package/plugins/plugins/theme-chalk/src/basicAudio.less +0 -41
- package/plugins/plugins/theme-chalk/src/basicVideo.less +0 -17
- package/plugins/plugins/theme-chalk/src/cameraRoam.less +0 -239
- package/plugins/plugins/theme-chalk/src/cardCarousel.less +0 -71
- package/plugins/plugins/theme-chalk/src/cardContent.less +0 -73
- package/plugins/plugins/theme-chalk/src/cardPage.less +0 -61
- package/plugins/plugins/theme-chalk/src/carouselImg.less +0 -34
- package/plugins/plugins/theme-chalk/src/marker.less +0 -107
- package/plugins/plugins/theme-chalk/src/markerManage.less +0 -25
- package/plugins/plugins/theme-chalk/src/measurement.less +0 -106
- package/plugins/plugins/theme-chalk/src/mixins/config.less +0 -4
- package/plugins/plugins/theme-chalk/src/mixins/mixins.less +0 -64
- package/plugins/plugins/theme-chalk/src/pathRoam.less +0 -198
- package/plugins/plugins/utils/create.ts +0 -45
- package/plugins/plugins/utils/package.json +0 -12
- package/plugins/plugins/utils/uuid.ts +0 -43
- package/plugins/plugins/utils/with-install.ts +0 -10
- package/plugins/theme-chalk/index.less +0 -11
- package/plugins/theme-chalk/src/basicAudio.less +0 -44
- package/plugins/theme-chalk/src/basicVideo.less +0 -17
- package/plugins/theme-chalk/src/cameraRoam.less +0 -239
- package/plugins/theme-chalk/src/cardCarousel.less +0 -71
- package/plugins/theme-chalk/src/cardContent.less +0 -73
- package/plugins/theme-chalk/src/cardPage.less +0 -61
- package/plugins/theme-chalk/src/carouselImg.less +0 -66
- package/plugins/theme-chalk/src/marker.less +0 -107
- package/plugins/theme-chalk/src/markerManage.less +0 -25
- package/plugins/theme-chalk/src/measurement.less +0 -106
- package/plugins/theme-chalk/src/mixins/config.less +0 -4
- package/plugins/theme-chalk/src/mixins/mixins.less +0 -64
- package/plugins/theme-chalk/src/pathRoam.less +0 -198
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
(function(T,ne){typeof exports=="object"&&typeof module<"u"?ne(exports):typeof define=="function"&&define.amd?define(["exports"],ne):(T=typeof globalThis<"u"?globalThis:T||self,ne(T.CesiumCore={}))})(this,(function(T){"use strict";var Fr=Object.defineProperty;var Or=(T,ne,Z)=>ne in T?Fr(T,ne,{enumerable:!0,configurable:!0,writable:!0,value:Z}):T[ne]=Z;var d=(T,ne,Z)=>Or(T,typeof ne!="symbol"?ne+"":ne,Z);class ne{constructor(t,e,i){d(this,"Cesium");d(this,"viewer");d(this,"labelPool");d(this,"threshold");d(this,"displayLimit");d(this,"maxLevel");d(this,"debugCurrentGrids");d(this,"levels");d(this,"points",[]);d(this,"gridLayers",new Map);d(this,"debugGrids",[]);d(this,"_updateFn");d(this,"clusterTheme");d(this,"pointTheme");d(this,"centralPointMode");d(this,"minGlobalPointCount");d(this,"groupByTheme");d(this,"tilingScheme");d(this,"levelIndexByTileLevel",new Map);d(this,"_updateTimer",null);d(this,"_updateDelay",100);d(this,"_tilesRetryCount",0);d(this,"_tilesRetryMax",100);this.Cesium=t,this.viewer=e,this.labelPool=i.labelPool,this.threshold=i.threshold??10,this.displayLimit=i.displayLimit??100,this.maxLevel=i.maxLevel??5,this.debugCurrentGrids=i.debugCurrentGrids??!1,this.clusterTheme=i.clusterTheme??"cluster-label",this.pointTheme=i.pointTheme??"point-label",this.centralPointMode=i.centralPointMode??"central",this.minGlobalPointCount=i.minGlobalPointCount??0,this.groupByTheme=i.groupByTheme??!1;const r=this.viewer.scene&&this.viewer.scene.globe,s=r&&r._surface,o=s&&s._tileProvider;this.tilingScheme=(o==null?void 0:o.tilingScheme)||new this.Cesium.GeographicTilingScheme,this.levels=this._createLevels(),this._buildLevels(),this._updateFn=this._update.bind(this),this.viewer.camera.changed.addEventListener(this._updateFn)}setGroupByTheme(t,e=!0,i=!0){if(this.groupByTheme===t){i&&this._update();return}this.groupByTheme=t,e&&this._buildLevels(),i&&this._update()}setMinGlobalPointCount(t,e=!0){this.minGlobalPointCount=t,e&&this._update()}setThreshold(t,e=!0){this.threshold=t,e&&this._update()}setDebugCurrentGrids(t,e=!0){this.debugCurrentGrids=t,t||this._clearDebugGrids(),e&&this._update()}_createLevels(){const t=[];this.levelIndexByTileLevel=new Map;const e=0,i=this.maxLevel;let r=0;for(let s=e;s<=i;s++,r++){const o=360/Math.pow(2,s);t.push({level:s,size:o,minViewWidth:o*4}),this.levelIndexByTileLevel.set(s,r)}return t}addPoints(t){this.points=t,this._buildLevels()}appendPoints(t,e=!0){for(const i of t)this.points.push(i);for(const i of t)this._addPointToGrid(i);e&&this._scheduleUpdate()}_scheduleUpdate(){this._updateTimer!==null&&clearTimeout(this._updateTimer),this._updateTimer=window.setTimeout(()=>{this._update(),this._updateTimer=null},this._updateDelay)}updatePoint(t){var s,o;const e=this.points.findIndex(n=>n.id===t.id);if(e===-1)return;const i=this.points[e];for(const n of this.levels){const h=n.level,l=this.gridLayers.get(h);if(!l)continue;const c=this.Cesium.Cartographic.fromDegrees(i.lon,i.lat),u=this.tilingScheme.positionToTileXY(c,h,new this.Cesium.Cartesian2);if(!u)continue;const m=`${u.x}_${u.y}`,g=l.get(m);if(g){const p=g.allPoints.findIndex(f=>f.id===t.id);if(p!==-1&&g.allPoints.splice(p,1),(s=i.data)!=null&&s.skipAggregation){const f=g.skipPoints.findIndex(w=>w.id===t.id);f!==-1&&g.skipPoints.splice(f,1)}else{const f=this.groupByTheme?(o=i.data)==null?void 0:o.theme:this.clusterTheme,w=g.groups.get(f);if(w){const y=w.findIndex(C=>C.id===t.id);y!==-1&&w.splice(y,1),w.length===0&&g.groups.delete(f)}}}}const r={...i,...t};this.points[e]=r,this._addPointToGrid(r),this._update()}removePointsById(t){const e=new Set(t);this.points=this.points.filter(i=>!e.has(i.id));for(const i of this.levels){const r=this.gridLayers.get(i.level);if(r)for(const[s,o]of r.entries()){o.allPoints=o.allPoints.filter(n=>!e.has(n.id)),o.skipPoints=o.skipPoints.filter(n=>!e.has(n.id));for(const[n,h]of o.groups.entries()){const l=h.filter(c=>!e.has(c.id));l.length===0?o.groups.delete(n):o.groups.set(n,l)}o.allPoints.length===0&&r.delete(s)}}this._update()}_buildLevels(){this.gridLayers.clear();for(const t of this.levels)this.gridLayers.set(t.level,new Map);for(const t of this.points)this._addPointToGrid(t)}_addPointToGrid(t){var e,i,r,s,o,n;for(const h of this.levels){const l=h.level,c=this.gridLayers.get(l);if(!c)continue;const u=this.Cesium.Cartographic.fromDegrees(t.lon,t.lat),m=this.tilingScheme.positionToTileXY(u,l,new this.Cesium.Cartesian2);if(!m)continue;const g=`${m.x}_${m.y}`;let p=c.get(g);if(p||(p={allPoints:[],groups:new Map,skipPoints:[]},c.set(g,p)),p.allPoints.push(t),(r=(i=(e=t.data)==null?void 0:e.billboard)==null?void 0:i[0])!=null&&r.skipAggregation)p.skipPoints.push(t);else{const f=this.groupByTheme?(n=(o=(s=t.data)==null?void 0:s.billboard)==null?void 0:o[0])==null?void 0:n.theme:this.clusterTheme;p.groups.has(f)||p.groups.set(f,[]),p.groups.get(f).push(t)}}}_update(){if(!this.labelPool)return;this.labelPool.reset(),this.debugCurrentGrids&&this._clearDebugGrids();const t=this.points.length<this.minGlobalPointCount?1/0:this.threshold;let e=0;const i=(r,s,o)=>{var v,b,E,M,P,L,I,x,A,$,R,S,_,F,N;if(e>=this.displayLimit||r<0)return;r>=this.levels.length&&(r=this.levels.length-1);const h=this.levels[r].level,l=this.gridLayers.get(h);if(!l)return;const c=`${s}_${o}`,u=l.get(c);if(!u)return;const m=this.tilingScheme.tileXYToRectangle(s,o,h),g=this.Cesium.Math.toDegrees(m.west),p=this.Cesium.Math.toDegrees(m.south),f=this.Cesium.Math.toDegrees(m.east),w=this.Cesium.Math.toDegrees(m.north),y=(g+f)/2,C=(p+w)/2;for(const D of u.skipPoints)if(((v=D.data)==null?void 0:v.show)!==!1){if(e>=this.displayLimit)break;this.labelPool.add(D.data,{id:`point-${D.id}`,lon:D.lon,lat:D.lat,height:D.height,theme:((M=(E=(b=D.data)==null?void 0:b.billboard)==null?void 0:E[0])==null?void 0:M.theme)||this.pointTheme,style:D.style}),e++}if(e>=this.displayLimit){this.debugCurrentGrids&&this._drawDebugGrid(g,p,f,w,c);return}for(const[D,Y]of u.groups){const G=Y.filter(k=>{var Q;return((Q=k.data)==null?void 0:Q.show)!==!1});if(G.length===0)continue;let X=y,J=C;if(this.centralPointMode=="firstPoint"&&(X=((P=G[0])==null?void 0:P.lon)||0,J=((L=G[0])==null?void 0:L.lat)||0),G.length<t)for(const k of G){if(e>=this.displayLimit)break;this.labelPool.add(k.data,{id:`point-${k.id}`,lon:k.lon,lat:k.lat,height:k.height,theme:((A=(x=(I=k.data)==null?void 0:I.billboard)==null?void 0:x[0])==null?void 0:A.theme)||this.pointTheme,style:k.style}),e++}else{if(e>=this.displayLimit)break;const Q=((_=(S=(R=($=G[0])==null?void 0:$.data)==null?void 0:R.billboard)==null?void 0:S[0])==null?void 0:_.theme)||this.clusterTheme,V=this.groupByTheme?`cluster-${r}-${s}-${o}-${D}`:`cluster-${r}-${s}-${o}`;this.labelPool.add({id:V,billboard:((N=(F=G[0])==null?void 0:F.data)==null?void 0:N.billboard)||[],count:G.length,gridKey:c,points:G,aggregationGroup:D},{id:V,lon:X,lat:J,theme:Q}),e++}}if(this.debugCurrentGrids){const D=this.levels[r].level;this._drawDebugGrid(g,p,f,w,`L:${D} X:${s} Y:${o}`)}};try{const r=this.viewer.scene&&this.viewer.scene.globe,s=r&&r._surface;let o;if(s&&(o=s._tilesToRender||s._tilesToRenderByTextureCount),!o||o.length===0){this.labelPool.cleanup(),this.points.length>0&&this._tilesRetryCount<this._tilesRetryMax&&(this._tilesRetryCount++,this._scheduleUpdate());return}this._tilesRetryCount=0;const n=new Set;for(const h of o){const l=h.rectangle,c=h._level??h.level;if(!l||typeof c!="number")continue;const u=this.levelIndexByTileLevel.get(c);if(u===void 0)continue;const m=h._x??h.x,g=h._y??h.y;if(typeof m=="number"&&typeof g=="number"){const L=`${c}_${m}_${g}`;if(n.has(L))continue;n.add(L),i(u,m,g);continue}const f=this.levels[u].size,w=this.Cesium.Math.toDegrees(l.west),y=this.Cesium.Math.toDegrees(l.east),C=this.Cesium.Math.toDegrees(l.south),v=this.Cesium.Math.toDegrees(l.north),b=Math.floor((w- -180)/f),E=Math.floor((y- -180)/f),M=Math.floor((C- -90)/f),P=Math.floor((v- -90)/f);for(let L=b;L<=E;L++)for(let I=M;I<=P;I++){const x=`${c}_${L}_${I}`;n.has(x)||(n.add(x),i(u,L,I))}}}catch{this.labelPool.cleanup();return}this.labelPool.cleanup()}refresh(){this._update()}_drawDebugGrid(t,e,i,r,s){const o=this.Cesium.Rectangle.fromDegrees(t,e,i,r),n=this.viewer.entities.add({rectangle:{coordinates:o,material:this.Cesium.Color.YELLOW.withAlpha(.2),outline:!0,outlineColor:this.Cesium.Color.RED,height:0},label:{text:s,font:"14px sans-serif",fillColor:this.Cesium.Color.BLACK,outlineColor:this.Cesium.Color.WHITE,outlineWidth:2,style:this.Cesium.LabelStyle.FILL_AND_OUTLINE,verticalOrigin:this.Cesium.VerticalOrigin.CENTER,horizontalOrigin:this.Cesium.HorizontalOrigin.CENTER}});this.debugGrids.push(n)}_clearDebugGrids(){for(const t of this.debugGrids)this.viewer.entities.remove(t);this.debugGrids=[]}destroy(){this.viewer.camera.changed.removeEventListener(this._updateFn),this._updateTimer!==null&&(clearTimeout(this._updateTimer),this._updateTimer=null),this.labelPool.reset(),this._clearDebugGrids()}}var Z=(a=>(a.Click="marker:click",a.DoubleClick="marker:dblclick",a.RightClick="marker:rightclick",a.MouseEnter="marker:mouseenter",a.MouseLeave="marker:mouseleave",a.MouseDown="marker:mousedown",a.MouseUp="marker:mouseup",a))(Z||{});class tt{constructor(){d(this,"listenerMap",new Map)}addListener(t,e,i=!1){let r=this.listenerMap.get(t);return r||(r=new Map,this.listenerMap.set(t,r)),r.has(e.name)?i?(console.warn(`[MarkerEventBus] Overwriting listener "${e.name}" for event "${t}".`),r.set(e.name,e),!0):(console.warn(`[MarkerEventBus] Listener "${e.name}" for event "${t}" already exists. Use overwrite=true to replace it.`),!1):(r.set(e.name,e),!0)}removeListenerByKey(t){const e=this.listenerMap.has(t);return this.listenerMap.set(t,new Map),e}removeListenerByKeyAndName(t,e){const i=this.listenerMap.get(t);return i?i.delete(e):!1}runListener(t,e,i){const r=this.listenerMap.get(t);if(r)for(const[s,o]of r.entries()){try{o.fn(e,i)}catch(n){console.error(`Error in listener "${s}" for event "${t}":`,n)}o.once&&r.delete(s)}}}const it={[Z.Click]:"click",[Z.DoubleClick]:"dblclick",[Z.RightClick]:"contextmenu",[Z.MouseEnter]:"mouseenter",[Z.MouseLeave]:"mouseleave",[Z.MouseDown]:"mousedown",[Z.MouseUp]:"mouseup"};class W{constructor(t,e,i="html-label-container",r,s=!0){d(this,"viewer");d(this,"Cesium");d(this,"container");d(this,"labels",new Map);d(this,"activeIds",new Set);d(this,"_updateFn");d(this,"themes",{});d(this,"eventBus");d(this,"openWheel",!0);this.Cesium=t,this.viewer=e,this.container=this._createContainer(i),this._updateFn=this._update.bind(this),this.viewer.scene.postRender.addEventListener(this._updateFn),this.eventBus=r||new tt,this.openWheel=s}_createContainer(t){let e=document.getElementById(t);return e||(e=document.createElement("div"),e.id=t,Object.assign(e.style,{position:"absolute",top:"0",left:"0",pointerEvents:"none",width:"100%",height:"100%",zIndex:"100",overflow:"hidden"}),document.body.appendChild(e)),e}registerTheme(t,e){this.themes[t]=e}add(t,e){const{id:i,lon:r,lat:s,height:o=0,theme:n,show:h=!0,notCreateElement:l=!1,style:c}=e,u=this.themes[n];if(!u){console.warn(`Theme "${n}" not registered`);return}let m=this.labels.get(i);if(m){m.theme=n,m.data=t,m.notCreateElement=l;try{m.unload=u.createElement(m.el,{id:i,theme:n,data:t},u),(!l||h)&&this.container.appendChild(m.el)}catch(g){console.error(`Error updating label element for id "${i}":`,g)}}else{const g=document.createElement("div");Object.assign(g.style,{position:"absolute",transform:"translate(0, 0)",pointerEvents:"auto",...e.style||{}});for(const[f,w]of Object.entries(it)){g.addEventListener(w,C=>{C.stopPropagation();const v=this.labels.get(i);this.eventBus.runListener(f,v,C)});let y=0;g.addEventListener("wheel",C=>{if(!this.openWheel)return;const v=C.currentTarget;y=Date.now();const b=y;v.style.pointerEvents="none",setTimeout(()=>{y===b&&(v.style.pointerEvents="auto")},2e3)})}let p=null;if(!l||h){try{p=u.createElement(g,{id:i,theme:n,data:t},u)||{}}catch(f){console.error(`Error updating label element for id "${i}":`,f)}this.container.appendChild(g)}m={id:i,el:g,theme:n,data:t,notCreateElement:l,unload:p},this.labels.set(i,m)}m.el.dataset.lon=String(r),m.el.dataset.lat=String(s),m.el.dataset.height=String(o),m.el.style.zIndex=(c==null?void 0:c.zIndex)||"1",m.el.style.display=h?"block":"none",h&&this.activeIds.add(i)}addBatch(t){for(const{data:e,options:i}of t)this.add(e,i)}removeByIds(t){for(const e of t){const i=this.labels.get(e);i&&(this.unloadByLabel(i),this.labels.delete(e),this.activeIds.delete(e))}}unloadByLabel(t){t.el.remove(),t!=null&&t.unload&&typeof t.unload=="function"&&(t==null||t.unload()),t.unload=null}removeAll(){for(const t of this.labels.values())this.unloadByLabel(t);this.labels.clear(),this.activeIds.clear()}update(t,e){const i=this.labels.get(t);if(!i){console.warn(`Label with id "${t}" not found for update.`);return}const r=this.themes[i.theme];if(!r){console.warn(`Theme "${i.theme}" not registered.`);return}try{r.createElement(i.el,{id:t,theme:i.theme,data:e},r)}catch(s){console.error(`Failed to update label "${t}":`,s)}}hideByIds(t){for(const e of t){const i=this.labels.get(e);i&&(i.notCreateElement&&this.unloadByLabel(i),i.el.style.display="none",this.activeIds.delete(e))}}hideAll(){for(const t of this.labels.values())t.notCreateElement&&this.unloadByLabel(t),t.el.style.display="none",this.activeIds.delete(t.id)}hideFilter(t){for(const e of this.labels.values())t(e.data)&&(e.notCreateElement&&this.unloadByLabel(e),e.el.style.display="none",this.activeIds.delete(e.id))}showByIds(t){for(const e of t){const i=this.labels.get(e);if(i){if((i.notCreateElement||!i.el.parentNode)&&this.container.appendChild(i.el),!i.unload)try{const r=this.themes[i.theme];if(!r){console.warn(`Theme "${i.theme}" not registered`);return}i.unload=r.createElement(i.el,{id:e,theme:i.theme,data:i.data},r)||{}}catch(r){console.error(`Error creating label element for theme "${i.theme}":`,r);return}i.el.style.display="block",this.activeIds.add(e)}}}has(t){return this.labels.has(t)}reset(){for(const t of this.activeIds.values()){let e=this.labels.get(t);e&&this.unloadByLabel(e)}this.activeIds.clear()}cleanup(){for(const[t,e]of this.labels.entries())this.activeIds.has(t)||(e.el.style.display="none")}async toWindowPositionByLonLat(t,e){const i=this.Cesium,r=this.viewer.scene,s=[i.Cartographic.fromDegrees(t,e)];let o;try{o=await r.clampToHeightMostDetailed(s)}catch{console.warn("clampToHeightMostDetailed failed, fallback to ellipsoid height.")}let n=0;o&&o[0]&&o[0].height!=null?n=o[0].height:n=0;const h=i.Cartesian3.fromDegrees(t,e,n);return this.toWindowCoordinates(h)}toWindowCoordinates(t){const e=this.viewer.scene,i=this.Cesium.SceneTransforms;if(typeof(i==null?void 0:i.wgs84ToWindowCoordinates)=="function")return i.wgs84ToWindowCoordinates(e,t);if(typeof(i==null?void 0:i.worldToWindowCoordinates)=="function")return i.worldToWindowCoordinates(e,t);console.warn("No compatible window coordinate transform function found.")}async _update(){var t;this.viewer.scene;for(const e of this.activeIds){const i=this.labels.get(e);if(!i)continue;const r=parseFloat(i.el.dataset.lon),s=parseFloat(i.el.dataset.lat),o=parseFloat(i.el.dataset.height||"0"),n=this.Cesium.Cartesian3.fromDegrees(r,s,o),h=this.toWindowCoordinates(n);if(this.Cesium.defined(h)){const c=((t=this.themes[i.theme].options)==null?void 0:t.offset)||{},u=c.x||0,m=c.y||0;i.el.style.left=`${h.x}px`,i.el.style.top=`${h.y}px`,i.el.style.transform=`translate(${u}px, ${m}px)`,i.el.style.display="block"}else i.el.style.display="none"}}destroy(){this.viewer.scene.postRender.removeEventListener(this._updateFn),this.labels.clear(),this.activeIds.clear()}}class xe{constructor(){d(this,"tooltipEl");d(this,"visible",!1);d(this,"offsetX",10);d(this,"offsetY",-20);d(this,"onMouseMove",null);this.tooltipEl=document.createElement("div"),this.tooltipEl.style.position="fixed",this.tooltipEl.style.pointerEvents="none",this.tooltipEl.style.zIndex="10000",this.tooltipEl.style.padding="4px 8px",this.tooltipEl.style.borderRadius="4px",this.tooltipEl.style.background="rgba(0, 0, 0, 0.7)",this.tooltipEl.style.color="#fff",this.tooltipEl.style.fontSize="13px",this.tooltipEl.style.transition="opacity 0.1s ease",this.tooltipEl.style.opacity="0",document.body.appendChild(this.tooltipEl),this.onMouseMove=t=>{this.visible&&(this.tooltipEl.style.left=`${t.clientX+this.offsetX}px`,this.tooltipEl.style.top=`${t.clientY+this.offsetY}px`)},window.addEventListener("mousemove",this.onMouseMove)}show(t){this.tooltipEl.innerText=t,this.tooltipEl.style.opacity="1",this.visible=!0}hide(){this.tooltipEl.style.opacity="0",this.visible=!1}destroy(){this.onMouseMove&&(window.removeEventListener("mousemove",this.onMouseMove),this.onMouseMove=null),this.tooltipEl.parentElement&&this.tooltipEl.parentElement.removeChild(this.tooltipEl)}}class Bt{constructor(t,e){d(this,"Cesium");d(this,"viewer");d(this,"handler",null);d(this,"entity",null);d(this,"tooltip",null);this.Cesium=t,this.viewer=e}startDrawing(t){const{Cesium:e,viewer:i}=this;this.tooltip=new xe,this.tooltip.show("左键添加点"),this.handler=new e.ScreenSpaceEventHandler(i.canvas),this.handler.setInputAction(r=>{var m,g;const s=i.scene.pickPosition(r.position);if(!s)return;const o=e.Cartographic.fromCartesian(s),n=e.Math.toDegrees(o.longitude),h=e.Math.toDegrees(o.latitude),l=o.height,c=i.entities.add({position:s,point:{pixelSize:10,color:t.color||e.Color.YELLOW,disableDepthTestDistance:Number.POSITIVE_INFINITY}});this.entity=c;const u={entity:c,position:s,lnglat:{lng:n,lat:h,height:l},clear:()=>{this.clear()}};(m=t.onComplete)==null||m.call(t,u),this.stopDrawing(),(g=this.tooltip)==null||g.hide(),this.tooltip=null},e.ScreenSpaceEventType.LEFT_CLICK)}stopDrawing(){var t;(t=this.handler)==null||t.destroy(),this.handler=null}clear(){this.entity&&(this.viewer.entities.remove(this.entity),this.entity=null),this.stopDrawing()}}class Nt{constructor(t,e){d(this,"Cesium");d(this,"viewer");d(this,"handler",null);d(this,"positions",[]);d(this,"entity",null);d(this,"tooltip",null);d(this,"tempPoints",[]);this.Cesium=t,this.viewer=e}startDrawing(t){const{Cesium:e,viewer:i}=this;this.positions=[],this.tempPoints=[],this.tooltip=new xe,this.tooltip.show("单击左键添加点,双击左键结束"),this.handler=new e.ScreenSpaceEventHandler(i.canvas),this.handler.setInputAction(r=>{var n,h;const s=i.scene.pickPosition(r.position);if(!s)return;this.positions.push(s);const o=i.entities.add({position:s,point:{pixelSize:8,color:e.Color.YELLOW,disableDepthTestDistance:Number.POSITIVE_INFINITY}});this.tempPoints.push(o),this.entity||(this.entity=i.entities.add({polyline:{positions:new e.CallbackProperty(()=>this.positions,!1),width:3,material:t.color||e.Color.YELLOW,disableDepthTestDistance:Number.POSITIVE_INFINITY,depthFailMaterial:((h=(n=t.color)==null?void 0:n.withAlpha)==null?void 0:h.call(n,.5))||e.Color.YELLOW.withAlpha(.5)}}))},e.ScreenSpaceEventType.LEFT_CLICK),this.handler.setInputAction(()=>{var o,n;if(this.stopDrawing(),(o=this.tooltip)==null||o.hide(),this.tooltip=null,this.positions.length<2)return;this.positions.length=this.positions.length-1;const r=this.positions.map(h=>{const l=e.Cartographic.fromCartesian(h);return{lng:e.Math.toDegrees(l.longitude),lat:e.Math.toDegrees(l.latitude),height:l.height}}),s={entity:this.entity,positions:this.positions,lnglats:r,clear:()=>{this.clear()}};(n=t.onComplete)==null||n.call(t,s)},e.ScreenSpaceEventType.LEFT_DOUBLE_CLICK)}stopDrawing(){var t;(t=this.handler)==null||t.destroy(),this.handler=null}clear(){var e;const{viewer:t}=this;this.entity&&(t.entities.remove(this.entity),this.entity=null),this.tempPoints.forEach(i=>t.entities.remove(i)),this.tempPoints=[],(e=this.tooltip)==null||e.hide(),this.tooltip=null,this.positions=[],this.stopDrawing()}}class jt{constructor(t,e){d(this,"Cesium");d(this,"viewer");d(this,"handler",null);d(this,"startPoint",null);d(this,"endPoint",null);d(this,"entity",null);this.Cesium=t,this.viewer=e}startDrawing(t){const{Cesium:e,viewer:i}=this;this.handler=new e.ScreenSpaceEventHandler(i.canvas),this.handler.setInputAction(r=>{var o;const s=i.scene.pickPosition(r.position);if(s)if(!this.startPoint)this.startPoint=s,this.entity=i.entities.add({rectangle:{coordinates:new e.CallbackProperty(()=>{if(!(!this.startPoint||!this.endPoint))try{const n=e.Cartographic.fromCartesian(this.startPoint),h=e.Cartographic.fromCartesian(this.endPoint),l=Math.min(n.longitude,h.longitude),c=Math.max(n.longitude,h.longitude),u=Math.min(n.latitude,h.latitude),m=Math.max(n.latitude,h.latitude);return new e.Rectangle(l,u,c,m)}catch(n){console.warn("Rectangle calculation error:",n);return}},!1),material:t.color||e.Color.YELLOW.withAlpha(.5),outline:!0,outlineColor:e.Color.BLACK,disableDepthTestDistance:Number.POSITIVE_INFINITY}});else{this.stopDrawing();const n=e.Cartographic.fromCartesian(this.startPoint),h=e.Cartographic.fromCartesian(this.endPoint),l={lng:e.Math.toDegrees(Math.min(n.longitude,h.longitude)),lat:e.Math.toDegrees(Math.min(n.latitude,h.latitude)),height:0},c={lng:e.Math.toDegrees(Math.max(n.longitude,h.longitude)),lat:e.Math.toDegrees(Math.max(n.latitude,h.latitude)),height:0},u={entity:this.entity,position:this.startPoint,lnglat:{lng:e.Math.toDegrees(n.longitude),lat:e.Math.toDegrees(n.latitude),height:n.height},positions:[this.startPoint,this.endPoint],lnglats:[l,c],clear:()=>{this.clear()}};(o=t.onComplete)==null||o.call(t,u)}},e.ScreenSpaceEventType.LEFT_CLICK),this.handler.setInputAction(r=>{if(!this.startPoint)return;const s=i.scene.pickPosition(r.endPosition);s&&(this.endPoint=s)},e.ScreenSpaceEventType.MOUSE_MOVE)}stopDrawing(){var t;(t=this.handler)==null||t.destroy(),this.handler=null}clear(){this.entity&&(this.viewer.entities.remove(this.entity),this.entity=null),this.startPoint=null,this.endPoint=null,this.stopDrawing()}}class Wt{constructor(t,e){d(this,"viewer");d(this,"Cesium");d(this,"handler",null);d(this,"entity",null);d(this,"positions",[]);d(this,"_isDrawing",!1);d(this,"currentRadius",0);this.Cesium=t,this.viewer=e}startDrawing(t){this.clear(),this.handler=new this.Cesium.ScreenSpaceEventHandler(this.viewer.canvas),this._isDrawing=!0,this.handler.setInputAction(e=>{const i=this.viewer.scene.pickPosition(e.position);i&&(this.positions.push(i),this.positions.length===2&&(this.stopDrawing(),this.drawFinalCircle(t)))},this.Cesium.ScreenSpaceEventType.LEFT_CLICK),this.handler.setInputAction(e=>{if(this.positions.length!==1)return;const i=this.positions[0],r=this.viewer.camera.getPickRay(e.endPosition),s=this.viewer.scene.globe.pick(r,this.viewer.scene);s&&this.drawPreviewCircle(i,s,t)},this.Cesium.ScreenSpaceEventType.MOUSE_MOVE)}drawPreviewCircle(t,e,i){const r=this.Cesium.Cartesian3.distance(t,e);if(this.entity)Math.abs(this.currentRadius-r)>.5&&(this.currentRadius=r);else{this.currentRadius=r;const s=new this.Cesium.CallbackProperty(()=>this.currentRadius,!1);this.entity=this.viewer.entities.add({position:t,ellipse:{semiMajorAxis:s,semiMinorAxis:s,material:i.color||this.Cesium.Color.YELLOW.withAlpha(.5),outline:!0,outlineColor:i.color||this.Cesium.Color.YELLOW,heightReference:this.Cesium.HeightReference.NONE,disableDepthTestDistance:Number.POSITIVE_INFINITY}})}}drawFinalCircle(t){var u;const[e,i]=this.positions,r=this.Cesium.Cartesian3.distance(e,i),s=this.Cesium.Cartographic.fromCartesian(e),o={lng:this.Cesium.Math.toDegrees(s.longitude),lat:this.Cesium.Math.toDegrees(s.latitude),height:s.height},n=(t==null?void 0:t.step)||1,h=[],l=[];for(let m=0;m<360;m+=n){const g=this.Cesium.Math.toRadians(m),p=new this.Cesium.EllipsoidGeodesic;p.setEndPoints(s,new this.Cesium.Cartographic(s.longitude+1e-4*Math.cos(g),s.latitude+1e-4*Math.sin(g)));const f=p.interpolateUsingSurfaceDistance(r),w=this.Cesium.Ellipsoid.WGS84.cartographicToCartesian(f);h.push(w);const y=this.Cesium.Cartographic.fromCartesian(w);l.push({lng:this.Cesium.Math.toDegrees(y.longitude),lat:this.Cesium.Math.toDegrees(y.latitude),height:y.height})}l.push(l[0]);const c=this.positions.map(m=>{const g=this.Cesium.Cartographic.fromCartesian(m);return{lng:this.Cesium.Math.toDegrees(g.longitude),lat:this.Cesium.Math.toDegrees(g.latitude),height:g.height}});(u=t.onComplete)==null||u.call(t,{entity:this.entity,positions:this.positions,lnglats:c,circlePoints:h,circleLnglats:l,center:o,radius:r,clear:()=>{this.clear()}})}stopDrawing(){this.handler&&(this.handler.destroy(),this.handler=null),this._isDrawing=!1}clear(){this.stopDrawing(),this.entity&&(this.viewer.entities.remove(this.entity),this.entity=null),this.positions=[],this.currentRadius=0}}class Vt{constructor(t,e){d(this,"Cesium");d(this,"viewer");d(this,"handler",null);d(this,"positions",[]);d(this,"entity",null);d(this,"tooltip",null);d(this,"tempPoints",[]);this.Cesium=t,this.viewer=e}startDrawing(t){const{Cesium:e,viewer:i}=this;this.positions=[],this.tempPoints=[],this.tooltip=new xe,this.tooltip.show("单击左键添加点,双击左键结束"),this.handler=new e.ScreenSpaceEventHandler(i.canvas),this.handler.setInputAction(r=>{const s=i.scene.pickPosition(r.position);if(!s)return;this.positions.push(s);const o=i.entities.add({position:s,point:{pixelSize:8,color:e.Color.YELLOW,disableDepthTestDistance:Number.POSITIVE_INFINITY,heightReference:e.HeightReference.CLAMP_TO_GROUND}});this.tempPoints.push(o),this.entity||(this.entity=i.entities.add({polygon:{hierarchy:new e.CallbackProperty(()=>({positions:this.positions}),!1),material:t.color||e.Color.YELLOW.withAlpha(.5)}}))},e.ScreenSpaceEventType.LEFT_CLICK),this.handler.setInputAction(()=>{var o,n;if(this.stopDrawing(),(o=this.tooltip)==null||o.hide(),this.tooltip=null,this.positions.length<3)return;this.positions.length=this.positions.length-1;const r=this.positions.map(h=>{const l=e.Cartographic.fromCartesian(h);return{lng:e.Math.toDegrees(l.longitude),lat:e.Math.toDegrees(l.latitude),height:l.height}}),s={entity:this.entity,positions:this.positions,lnglats:r,clear:()=>{this.clear()}};(n=t.onComplete)==null||n.call(t,s)},e.ScreenSpaceEventType.LEFT_DOUBLE_CLICK)}stopDrawing(){var t;(t=this.handler)==null||t.destroy(),this.handler=null}clear(){var e;const{viewer:t}=this;this.entity&&(t.entities.remove(this.entity),this.entity=null),this.tempPoints.forEach(i=>t.entities.remove(i)),this.tempPoints=[],(e=this.tooltip)==null||e.hide(),this.tooltip=null,this.positions=[],this.stopDrawing()}}class Yt{constructor(t,e){d(this,"viewer");d(this,"Cesium");d(this,"activeDrawer",null);this.viewer=e,this.Cesium=t}draw(t,e){var i;switch(this.clear(),t){case"point":this.activeDrawer=new Bt(this.Cesium,this.viewer);break;case"line":this.activeDrawer=new Nt(this.Cesium,this.viewer);break;case"rectangle":this.activeDrawer=new jt(this.Cesium,this.viewer);break;case"circle":this.activeDrawer=new Wt(this.Cesium,this.viewer);break;case"polygon":this.activeDrawer=new Vt(this.Cesium,this.viewer);break;default:throw new Error(`Unsupported draw type: ${t}`)}(i=this.activeDrawer)==null||i.startDrawing(e)}clear(){this.activeDrawer&&(this.activeDrawer.stopDrawing(),this.activeDrawer.clear(),this.activeDrawer=null)}cancel(){this.clear()}}var st=typeof global=="object"&&global&&global.Object===Object&&global,Ut=typeof self=="object"&&self&&self.Object===Object&&self,he=st||Ut||Function("return this")(),we=he.Symbol,ot=Object.prototype,Kt=ot.hasOwnProperty,qt=ot.toString,Pe=we?we.toStringTag:void 0;function Xt(a){var t=Kt.call(a,Pe),e=a[Pe];try{a[Pe]=void 0;var i=!0}catch{}var r=qt.call(a);return i&&(t?a[Pe]=e:delete a[Pe]),r}var Jt=Object.prototype,Qt=Jt.toString;function Zt(a){return Qt.call(a)}var ei="[object Null]",ti="[object Undefined]",rt=we?we.toStringTag:void 0;function Le(a){return a==null?a===void 0?ti:ei:rt&&rt in Object(a)?Xt(a):Zt(a)}function Me(a){return a!=null&&typeof a=="object"}var _e=Array.isArray;function De(a){var t=typeof a;return a!=null&&(t=="object"||t=="function")}var ii="[object AsyncFunction]",si="[object Function]",oi="[object GeneratorFunction]",ri="[object Proxy]";function nt(a){if(!De(a))return!1;var t=Le(a);return t==si||t==oi||t==ii||t==ri}var Re=he["__core-js_shared__"],at=(function(){var a=/[^.]+$/.exec(Re&&Re.keys&&Re.keys.IE_PROTO||"");return a?"Symbol(src)_1."+a:""})();function ni(a){return!!at&&at in a}var ai=Function.prototype,li=ai.toString;function me(a){if(a!=null){try{return li.call(a)}catch{}try{return a+""}catch{}}return""}var hi=/[\\^$.*+?()[\]{}|]/g,ci=/^\[object .+?Constructor\]$/,di=Function.prototype,pi=Object.prototype,ui=di.toString,mi=pi.hasOwnProperty,gi=RegExp("^"+ui.call(mi).replace(hi,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function fi(a){if(!De(a)||ni(a))return!1;var t=nt(a)?gi:ci;return t.test(me(a))}function yi(a,t){return a==null?void 0:a[t]}function ge(a,t){var e=yi(a,t);return fi(e)?e:void 0}var He=ge(he,"WeakMap"),lt=Object.create,wi=(function(){function a(){}return function(t){if(!De(t))return{};if(lt)return lt(t);a.prototype=t;var e=new a;return a.prototype=void 0,e}})(),ht=(function(){try{var a=ge(Object,"defineProperty");return a({},"",{}),a}catch{}})();function Ci(a,t){for(var e=-1,i=a==null?0:a.length;++e<i&&t(a[e],e,a)!==!1;);return a}var vi=9007199254740991,bi=/^(?:0|[1-9]\d*)$/;function Pi(a,t){var e=typeof a;return t=t??vi,!!t&&(e=="number"||e!="symbol"&&bi.test(a))&&a>-1&&a%1==0&&a<t}function Li(a,t,e){t=="__proto__"&&ht?ht(a,t,{configurable:!0,enumerable:!0,value:e,writable:!0}):a[t]=e}function ct(a,t){return a===t||a!==a&&t!==t}var Mi=Object.prototype,Ei=Mi.hasOwnProperty;function Ii(a,t,e){var i=a[t];(!(Ei.call(a,t)&&ct(i,e))||e===void 0&&!(t in a))&&Li(a,t,e)}var Ti=9007199254740991;function dt(a){return typeof a=="number"&&a>-1&&a%1==0&&a<=Ti}function xi(a){return a!=null&&dt(a.length)&&!nt(a)}var _i=Object.prototype;function pt(a){var t=a&&a.constructor,e=typeof t=="function"&&t.prototype||_i;return a===e}function Di(a,t){for(var e=-1,i=Array(a);++e<a;)i[e]=t(e);return i}var Si="[object Arguments]";function ut(a){return Me(a)&&Le(a)==Si}var mt=Object.prototype,Ai=mt.hasOwnProperty,$i=mt.propertyIsEnumerable,Fi=ut((function(){return arguments})())?ut:function(a){return Me(a)&&Ai.call(a,"callee")&&!$i.call(a,"callee")};function Oi(){return!1}var gt=typeof T=="object"&&T&&!T.nodeType&&T,ft=gt&&typeof module=="object"&&module&&!module.nodeType&&module,Ri=ft&&ft.exports===gt,yt=Ri?he.Buffer:void 0,Hi=yt?yt.isBuffer:void 0,wt=Hi||Oi,ki="[object Arguments]",zi="[object Array]",Gi="[object Boolean]",Bi="[object Date]",Ni="[object Error]",ji="[object Function]",Wi="[object Map]",Vi="[object Number]",Yi="[object Object]",Ui="[object RegExp]",Ki="[object Set]",qi="[object String]",Xi="[object WeakMap]",Ji="[object ArrayBuffer]",Qi="[object DataView]",Zi="[object Float32Array]",es="[object Float64Array]",ts="[object Int8Array]",is="[object Int16Array]",ss="[object Int32Array]",os="[object Uint8Array]",rs="[object Uint8ClampedArray]",ns="[object Uint16Array]",as="[object Uint32Array]",j={};j[Zi]=j[es]=j[ts]=j[is]=j[ss]=j[os]=j[rs]=j[ns]=j[as]=!0,j[ki]=j[zi]=j[Ji]=j[Gi]=j[Qi]=j[Bi]=j[Ni]=j[ji]=j[Wi]=j[Vi]=j[Yi]=j[Ui]=j[Ki]=j[qi]=j[Xi]=!1;function ls(a){return Me(a)&&dt(a.length)&&!!j[Le(a)]}function ke(a){return function(t){return a(t)}}var Ct=typeof T=="object"&&T&&!T.nodeType&&T,Ee=Ct&&typeof module=="object"&&module&&!module.nodeType&&module,hs=Ee&&Ee.exports===Ct,ze=hs&&st.process,Ce=(function(){try{var a=Ee&&Ee.require&&Ee.require("util").types;return a||ze&&ze.binding&&ze.binding("util")}catch{}})(),vt=Ce&&Ce.isTypedArray,cs=vt?ke(vt):ls,ds=Object.prototype,ps=ds.hasOwnProperty;function us(a,t){var e=_e(a),i=!e&&Fi(a),r=!e&&!i&&wt(a),s=!e&&!i&&!r&&cs(a),o=e||i||r||s,n=o?Di(a.length,String):[],h=n.length;for(var l in a)ps.call(a,l)&&!(o&&(l=="length"||r&&(l=="offset"||l=="parent")||s&&(l=="buffer"||l=="byteLength"||l=="byteOffset")||Pi(l,h)))&&n.push(l);return n}function bt(a,t){return function(e){return a(t(e))}}var ms=bt(Object.keys,Object),gs=Object.prototype,fs=gs.hasOwnProperty;function ys(a){if(!pt(a))return ms(a);var t=[];for(var e in Object(a))fs.call(a,e)&&e!="constructor"&&t.push(e);return t}function ws(a){return xi(a)?us(a):ys(a)}var Ie=ge(Object,"create");function Cs(){this.__data__=Ie?Ie(null):{},this.size=0}function vs(a){var t=this.has(a)&&delete this.__data__[a];return this.size-=t?1:0,t}var bs="__lodash_hash_undefined__",Ps=Object.prototype,Ls=Ps.hasOwnProperty;function Ms(a){var t=this.__data__;if(Ie){var e=t[a];return e===bs?void 0:e}return Ls.call(t,a)?t[a]:void 0}var Es=Object.prototype,Is=Es.hasOwnProperty;function Ts(a){var t=this.__data__;return Ie?t[a]!==void 0:Is.call(t,a)}var xs="__lodash_hash_undefined__";function _s(a,t){var e=this.__data__;return this.size+=this.has(a)?0:1,e[a]=Ie&&t===void 0?xs:t,this}function fe(a){var t=-1,e=a==null?0:a.length;for(this.clear();++t<e;){var i=a[t];this.set(i[0],i[1])}}fe.prototype.clear=Cs,fe.prototype.delete=vs,fe.prototype.get=Ms,fe.prototype.has=Ts,fe.prototype.set=_s;function Ds(){this.__data__=[],this.size=0}function Se(a,t){for(var e=a.length;e--;)if(ct(a[e][0],t))return e;return-1}var Ss=Array.prototype,As=Ss.splice;function $s(a){var t=this.__data__,e=Se(t,a);if(e<0)return!1;var i=t.length-1;return e==i?t.pop():As.call(t,e,1),--this.size,!0}function Fs(a){var t=this.__data__,e=Se(t,a);return e<0?void 0:t[e][1]}function Os(a){return Se(this.__data__,a)>-1}function Rs(a,t){var e=this.__data__,i=Se(e,a);return i<0?(++this.size,e.push([a,t])):e[i][1]=t,this}function de(a){var t=-1,e=a==null?0:a.length;for(this.clear();++t<e;){var i=a[t];this.set(i[0],i[1])}}de.prototype.clear=Ds,de.prototype.delete=$s,de.prototype.get=Fs,de.prototype.has=Os,de.prototype.set=Rs;var Te=ge(he,"Map");function Hs(){this.size=0,this.__data__={hash:new fe,map:new(Te||de),string:new fe}}function ks(a){var t=typeof a;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?a!=="__proto__":a===null}function Ae(a,t){var e=a.__data__;return ks(t)?e[typeof t=="string"?"string":"hash"]:e.map}function zs(a){var t=Ae(this,a).delete(a);return this.size-=t?1:0,t}function Gs(a){return Ae(this,a).get(a)}function Bs(a){return Ae(this,a).has(a)}function Ns(a,t){var e=Ae(this,a),i=e.size;return e.set(a,t),this.size+=e.size==i?0:1,this}function ve(a){var t=-1,e=a==null?0:a.length;for(this.clear();++t<e;){var i=a[t];this.set(i[0],i[1])}}ve.prototype.clear=Hs,ve.prototype.delete=zs,ve.prototype.get=Gs,ve.prototype.has=Bs,ve.prototype.set=Ns;function js(a,t){for(var e=-1,i=t.length,r=a.length;++e<i;)a[r+e]=t[e];return a}var Ws=bt(Object.getPrototypeOf,Object);function Vs(){this.__data__=new de,this.size=0}function Ys(a){var t=this.__data__,e=t.delete(a);return this.size=t.size,e}function Us(a){return this.__data__.get(a)}function Ks(a){return this.__data__.has(a)}var qs=200;function Xs(a,t){var e=this.__data__;if(e instanceof de){var i=e.__data__;if(!Te||i.length<qs-1)return i.push([a,t]),this.size=++e.size,this;e=this.__data__=new ve(i)}return e.set(a,t),this.size=e.size,this}function be(a){var t=this.__data__=new de(a);this.size=t.size}be.prototype.clear=Vs,be.prototype.delete=Ys,be.prototype.get=Us,be.prototype.has=Ks,be.prototype.set=Xs;var Pt=typeof T=="object"&&T&&!T.nodeType&&T,Lt=Pt&&typeof module=="object"&&module&&!module.nodeType&&module,Js=Lt&&Lt.exports===Pt,Mt=Js?he.Buffer:void 0;Mt&&Mt.allocUnsafe;function Qs(a,t){return a.slice()}function Zs(a,t){for(var e=-1,i=a==null?0:a.length,r=0,s=[];++e<i;){var o=a[e];t(o,e,a)&&(s[r++]=o)}return s}function eo(){return[]}var to=Object.prototype,io=to.propertyIsEnumerable,Et=Object.getOwnPropertySymbols,so=Et?function(a){return a==null?[]:(a=Object(a),Zs(Et(a),function(t){return io.call(a,t)}))}:eo;function oo(a,t,e){var i=t(a);return _e(a)?i:js(i,e(a))}function ro(a){return oo(a,ws,so)}var Ge=ge(he,"DataView"),Be=ge(he,"Promise"),Ne=ge(he,"Set"),It="[object Map]",no="[object Object]",Tt="[object Promise]",xt="[object Set]",_t="[object WeakMap]",Dt="[object DataView]",ao=me(Ge),lo=me(Te),ho=me(Be),co=me(Ne),po=me(He),pe=Le;(Ge&&pe(new Ge(new ArrayBuffer(1)))!=Dt||Te&&pe(new Te)!=It||Be&&pe(Be.resolve())!=Tt||Ne&&pe(new Ne)!=xt||He&&pe(new He)!=_t)&&(pe=function(a){var t=Le(a),e=t==no?a.constructor:void 0,i=e?me(e):"";if(i)switch(i){case ao:return Dt;case lo:return It;case ho:return Tt;case co:return xt;case po:return _t}return t});var uo=Object.prototype,mo=uo.hasOwnProperty;function go(a){var t=a.length,e=new a.constructor(t);return t&&typeof a[0]=="string"&&mo.call(a,"index")&&(e.index=a.index,e.input=a.input),e}var St=he.Uint8Array;function je(a){var t=new a.constructor(a.byteLength);return new St(t).set(new St(a)),t}function fo(a,t){var e=je(a.buffer);return new a.constructor(e,a.byteOffset,a.byteLength)}var yo=/\w*$/;function wo(a){var t=new a.constructor(a.source,yo.exec(a));return t.lastIndex=a.lastIndex,t}var At=we?we.prototype:void 0,$t=At?At.valueOf:void 0;function Co(a){return $t?Object($t.call(a)):{}}function vo(a,t){var e=je(a.buffer);return new a.constructor(e,a.byteOffset,a.length)}var bo="[object Boolean]",Po="[object Date]",Lo="[object Map]",Mo="[object Number]",Eo="[object RegExp]",Io="[object Set]",To="[object String]",xo="[object Symbol]",_o="[object ArrayBuffer]",Do="[object DataView]",So="[object Float32Array]",Ao="[object Float64Array]",$o="[object Int8Array]",Fo="[object Int16Array]",Oo="[object Int32Array]",Ro="[object Uint8Array]",Ho="[object Uint8ClampedArray]",ko="[object Uint16Array]",zo="[object Uint32Array]";function Go(a,t,e){var i=a.constructor;switch(t){case _o:return je(a);case bo:case Po:return new i(+a);case Do:return fo(a);case So:case Ao:case $o:case Fo:case Oo:case Ro:case Ho:case ko:case zo:return vo(a);case Lo:return new i;case Mo:case To:return new i(a);case Eo:return wo(a);case Io:return new i;case xo:return Co(a)}}function Bo(a){return typeof a.constructor=="function"&&!pt(a)?wi(Ws(a)):{}}var No="[object Map]";function jo(a){return Me(a)&&pe(a)==No}var Ft=Ce&&Ce.isMap,Wo=Ft?ke(Ft):jo,Vo="[object Set]";function Yo(a){return Me(a)&&pe(a)==Vo}var Ot=Ce&&Ce.isSet,Uo=Ot?ke(Ot):Yo,Rt="[object Arguments]",Ko="[object Array]",qo="[object Boolean]",Xo="[object Date]",Jo="[object Error]",Ht="[object Function]",Qo="[object GeneratorFunction]",Zo="[object Map]",er="[object Number]",kt="[object Object]",tr="[object RegExp]",ir="[object Set]",sr="[object String]",or="[object Symbol]",rr="[object WeakMap]",nr="[object ArrayBuffer]",ar="[object DataView]",lr="[object Float32Array]",hr="[object Float64Array]",cr="[object Int8Array]",dr="[object Int16Array]",pr="[object Int32Array]",ur="[object Uint8Array]",mr="[object Uint8ClampedArray]",gr="[object Uint16Array]",fr="[object Uint32Array]",B={};B[Rt]=B[Ko]=B[nr]=B[ar]=B[qo]=B[Xo]=B[lr]=B[hr]=B[cr]=B[dr]=B[pr]=B[Zo]=B[er]=B[kt]=B[tr]=B[ir]=B[sr]=B[or]=B[ur]=B[mr]=B[gr]=B[fr]=!0,B[Jo]=B[Ht]=B[rr]=!1;function $e(a,t,e,i,r,s){var o;if(o!==void 0)return o;if(!De(a))return a;var n=_e(a);if(n)o=go(a);else{var h=pe(a),l=h==Ht||h==Qo;if(wt(a))return Qs(a);if(h==kt||h==Rt||l&&!r)o=l?{}:Bo(a);else{if(!B[h])return r?a:{};o=Go(a,h)}}s||(s=new be);var c=s.get(a);if(c)return c;s.set(a,o),Uo(a)?a.forEach(function(g){o.add($e(g,t,e,g,a,s))}):Wo(a)&&a.forEach(function(g,p){o.set(p,$e(g,t,e,p,a,s))});var u=ro,m=n?void 0:u(a);return Ci(m||a,function(g,p){m&&(p=g,g=a[p]),Ii(o,p,$e(g,t,e,p,a,s))}),o}var yr=1,wr=4;function Fe(a){return $e(a,yr|wr)}var zt=(a=>(a.Rotate="rotate",a.Move="move",a.Scale="scale",a.MoveHeight="moveHeight",a.Empty="",a))(zt||{}),Gt=(a=>(a.Scale="addScale",a.Rotate="rotate",a.Translation="translation",a.Remove="removeById",a.Add="add",a))(Gt||{});class Cr{constructor(t){d(this,"primitives",new Map);d(this,"eventListener",new Map);d(this,"Cesium");d(this,"viewer");d(this,"handler");d(this,"rotationRing");d(this,"translationSquare");d(this,"heightArrow");d(this,"editMode","");d(this,"dragEndCallbackMap",new Map);this.Cesium=t.Cesium,this.viewer=t.viewer,this.handler=new this.Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas)}init(t,e=!1){const i=this.viewer;this.primitives.forEach(r=>{i.scene.primitives.remove(r)}),t.forEach(r=>{this.primitives.has(r.id)||this.add(r,e)})}get(t){return this.primitives.get(t)}add(t,e=!0){var u,m,g;const i=this.viewer,r=this.Cesium,s=r.Math.toRadians(((u=t.headingPitchRoll)==null?void 0:u.heading)||0),o=r.Math.toRadians(((m=t.headingPitchRoll)==null?void 0:m.pitch)||0),n=r.Math.toRadians(((g=t.headingPitchRoll)==null?void 0:g.roll)||0),h=new r.HeadingPitchRoll(s,o,n),l=r.Transforms.headingPitchRollToFixedFrame(t.position,h,i.scene.globe.ellipsoid,r.Transforms.eastNorthUpToFixedFrame,new r.Matrix4);let c=i.scene.primitives.add(r.Model.fromGltf({id:t.id,...t.model,modelMatrix:l}));c.scale=t.scale||1,this.primitives.set(t.id,c),c.show=e,this.runEventListener("add",{info:t,gltf:c})}flyTo(t){const e=this.viewer,i=this.Cesium;let r=this.primitives.get(t);const s=r.boundingSphere,o=i.Matrix4.multiplyByPoint(r.modelMatrix,s.center,new i.Cartesian3),n=new i.BoundingSphere(o,s.radius);e.camera.flyToBoundingSphere(n,{duration:1.5,offset:new i.HeadingPitchRange(0,-.5,s.radius*2)})}removeById(t){var r;const e=this.viewer;let i=this.primitives.get(t);if(!i){console.error(`No model found with id: ${t}`);return}e.scene.primitives.remove(i),this.primitives.delete(t),(!((r=this.rotationRing)!=null&&r._instanceIds.includes(`rotationRing_${t}`))||!this.rotationRing)&&this.removeTool(),this.runEventListener("removeById",{id:t,gltf:i})}show(t){let e=this.primitives.get(t);e&&(e.show=!0)}hide(t){let e=this.primitives.get(t);e&&(e.show=!1)}addScale(t,e=.1){let i=this.primitives.get(t.id);i&&(i.scale=i.scale+e,this.updatedTool(i.modelMatrix),this.runEventListener("addScale",{id:t.id,scale:i.scale}))}setScale(t,e=.1){let i=this.primitives.get(t);i&&(i.scale=e,this.updatedTool(i.modelMatrix),this.runEventListener("addScale",{id:t,scale:i.scale}))}setEditMode(t){this.editMode=t}lockCamera(){const t=this.viewer.scene.screenSpaceCameraController;t.enableRotate=!1,t.enableTranslate=!1,t.enableZoom=!1}unlockCamera(){const t=this.viewer.scene.screenSpaceCameraController;t.enableRotate=!0,t.enableTranslate=!0,t.enableZoom=!0}toCartographic(t){const e=this.Cesium.Cartographic.fromCartesian(t);return{longitude:e.longitude,latitude:e.latitude}}calculateHeading(t,e){const i=e.longitude-t.longitude,r=e.latitude-t.latitude;return Math.atan2(r,i)}getModelHeadingPitchRoll(t){const e=this.Cesium,i=this.viewer,r=e.Transforms.eastNorthUpToFixedFrame(e.Matrix4.getTranslation(t,new e.Cartesian3),i.scene.globe.ellipsoid,new e.Matrix4),s=e.Matrix4.multiply(e.Matrix4.inverse(r,new e.Matrix4),t,new e.Matrix4),o=e.Matrix4.getRotation(s,new e.Matrix3),n=e.Quaternion.fromRotationMatrix(o);return e.HeadingPitchRoll.fromQuaternion(n)}addEventListener(t,e,i){let r={f:e,options:i};return this.eventListener.get(t)?(this.eventListener.get(t)||[]).push(r):this.eventListener.set(t,[r]),r}removeEventListener(t,e){let i=this.eventListener.get(t);if(!i)return console.error("key不存在");let r=i.findIndex(s=>s==e);r>=0?i.splice(r,1):console.error("instantiation不存在")}runEventListener(t,e){let i=this.eventListener.get(t);return i?(i.forEach(r=>{typeof r.f=="function"&&r.f(e)}),!0):!1}initEditBox(t){const e=this.Cesium,i=this.viewer,r=i.scene;let s=null,o=null,n=null,h=null,l=null;const c=()=>{s=null,o=null,n=null,l=null,h=null,this.setEditMode(""),this.unlockCamera()},u=(m,g)=>{if(s=this.primitives.get(m),s){o=e.Matrix4.clone(s.modelMatrix);const p=e.Matrix4.getTranslation(o,new e.Cartesian3);n=this.toCartographic(p),l=g.position;const f=r.globe.pick(i.camera.getPickRay(g.position),r);h=this.toCartographic(f),this.lockCamera()}};this.handler.setInputAction(m=>{var f,w,y,C,v,b,E,M,P,L;if(!t())return;const p=r.pick(m.position);if(p&&p.id&&((f=p.id)!=null&&f.includes("rotationRing"))){let I=p.id.split("rotationRing_")[1];this.setEditMode("rotate"),u(I,m)}else if(p&&p.id&&((w=p.id)!=null&&w.includes("translationSquare_"))){let I=p.id.split("translationSquare_")[1];this.setEditMode("move"),u(I,m)}else if(p&&p.id&&((y=p.id)!=null&&y.includes("heightArrow-line_"))){let I=p.id.split("heightArrow-line_")[1];this.setEditMode("moveHeight"),u(I,m)}else if(p&&p.id&&((C=p.id)!=null&&C.includes("heightArrow-arrow_"))){let I=p.id.split("heightArrow-arrow_")[1];this.setEditMode("moveHeight"),u(I,m)}else if(p&&p.id){if(s=this.primitives.get(p.id),!s)return;(!this.rotationRing||!((b=(v=this.rotationRing)==null?void 0:v._instanceIds)!=null&&b.includes(`rotationRing_${s.id}`)))&&this.createRotationRing(s),(!this.translationSquare||!((M=(E=this.translationSquare)==null?void 0:E._instanceIds)!=null&&M.includes(`translationSquare_${s.id}`)))&&this.createTranslationSquare(s),(!this.heightArrow||!((L=(P=this.heightArrow)==null?void 0:P._instanceIds)!=null&&L.includes(`heightArrow_${s.id}`)))&&this.createHeightArrow(s)}else c()},e.ScreenSpaceEventType.LEFT_DOWN),this.handler.setInputAction(m=>{if(t()&&this.editMode!=""&&s){const p=r.globe.pick(i.camera.getPickRay(m.endPosition),r),f=this.toCartographic(p);let w=0;if(this.editMode==="rotate"){let y=this.calculateHeading(n,f);w=this.calculateHeading(n,h)-y,this.rotateModel(s,o,w)}else this.editMode==="move"?this.moveModel(s,o,m):this.editMode==="moveHeight"&&this.moveModelHeight(s,o,m,l)}},e.ScreenSpaceEventType.MOUSE_MOVE),this.handler.setInputAction(()=>{if(!t())return;let g=this.dragEndCallbackMap.get(s==null?void 0:s.id);if(g&&(this.editMode==="move"||this.editMode==="moveHeight")){let p=g.get("translation");p&&(this.runEventListener("translation",p),g.delete("translation"))}else if(g&&this.editMode==="rotate"){let p=g.get("rotate");p&&(this.runEventListener("rotate",p),g.delete("rotate"))}c()},e.ScreenSpaceEventType.LEFT_UP),this.handler.setInputAction(()=>{this.removeTool()},e.ScreenSpaceEventType.RIGHT_UP)}createRotationRing(t){const e=this.Cesium,i=this.viewer;this.rotationRing&&i.scene.primitives.remove(this.rotationRing);const r=[];for(let n=0;n<=360;n+=3){const h=Math.sin(e.Math.toRadians(n)),l=Math.cos(e.Math.toRadians(n)),c=t.boundingSphere.radius*l,u=t.boundingSphere.radius*h;r.push(new e.Cartesian3(c,u,0))}const s=new e.PolylineGeometry({positions:r,width:Math.max(t.boundingSphere.radius*.05,1)}),o=new e.GeometryInstance({id:`rotationRing_${t.id}`,geometry:s,attributes:{color:e.ColorGeometryInstanceAttribute.fromColor(e.Color.RED)}});this.rotationRing=new e.Primitive({geometryInstances:o,appearance:new e.PolylineColorAppearance({translucent:!0}),depthFailAppearance:new e.PolylineMaterialAppearance({material:e.Material.fromType("Color",{color:e.Color.RED.withAlpha(.3)}),translucent:!0}),modelMatrix:t.modelMatrix,cull:!1}),i.scene.primitives.add(this.rotationRing)}createTranslationSquare(t){const e=this.Cesium,i=this.viewer;this.translationSquare&&i.scene.primitives.remove(this.translationSquare);const s=Math.max(t.boundingSphere.radius*.2,1)/2,o=new e.BoxGeometry({maximum:new e.Cartesian3(s,s,s),minimum:new e.Cartesian3(-s,-s,-s)}),n=new e.GeometryInstance({id:`translationSquare_${t.id}`,geometry:o,attributes:{color:e.ColorGeometryInstanceAttribute.fromColor(e.Color.BLUE)}});this.translationSquare=new e.Primitive({geometryInstances:n,appearance:new e.PolylineColorAppearance({translucent:!0}),depthFailAppearance:new e.PolylineMaterialAppearance({material:e.Material.fromType("Color",{color:e.Color.BLUE.withAlpha(.3)}),translucent:!0}),cull:!1,modelMatrix:t.modelMatrix}),i.scene.primitives.add(this.translationSquare)}createHeightArrow(t){const e=this.Cesium,i=this.viewer;this.heightArrow&&i.scene.primitives.remove(this.heightArrow);let r=e.Color.GREEN,s=Math.max(t.boundingSphere.radius*.025,1),o=2*s,n=t.boundingSphere.radius+50,h=n*.1;const l=Math.max(t.boundingSphere.radius*.2,1),c=e.CylinderGeometry.createGeometry(new e.CylinderGeometry({length:n,topRadius:s,bottomRadius:s})),u=e.CylinderGeometry.createGeometry(new e.CylinderGeometry({length:h,topRadius:0,bottomRadius:o}));let m=n+l,g=(n+l)/2;this.translate(c,[0,0,g]),this.translate(u,[0,0,m]),this.heightArrow=new e.Primitive({modelMatrix:t.modelMatrix,geometryInstances:[new e.GeometryInstance({id:`heightArrow-line_${t.id}`,geometry:c}),new e.GeometryInstance({id:`heightArrow-arrow_${t.id}`,geometry:u})],appearance:new e.PolylineMaterialAppearance({material:e.Material.fromType("Color",{color:r}),translucent:!0}),depthFailAppearance:new e.PolylineMaterialAppearance({material:e.Material.fromType("Color",{color:r.withAlpha(.3)}),translucent:!0}),cull:!1}),i.scene.primitives.add(this.heightArrow)}translate(t,e){let i=this.Cesium;const r=new i.Cartesian3;_e(e)?(r.x=e[0],r.y=e[1],r.z=e[2]):i.Cartesian3.clone(e,r);for(let s=0;s<t.attributes.position.values.length;s+=3)t.attributes.position.values[s]+=r.x,t.attributes.position.values[s+1]+=r.y,t.attributes.position.values[s+2]+=r.z}removeTool(){this.rotationRing&&this.viewer.scene.primitives.remove(this.rotationRing),this.translationSquare&&this.viewer.scene.primitives.remove(this.translationSquare),this.heightArrow&&this.viewer.scene.primitives.remove(this.heightArrow)}updatedTool(t){this.rotationRing&&(this.rotationRing.modelMatrix=t),this.translationSquare&&(this.translationSquare.modelMatrix=t),this.heightArrow&&(this.heightArrow.modelMatrix=t)}moveModel(t,e,i){const r=this.Cesium,s=this.viewer,o=s.scene,n=o.globe.pick(s.camera.getPickRay(i.endPosition),o);if(n){const h=r.Matrix4.getTranslation(e,new r.Cartesian3),l=r.Cartographic.fromCartesian(h),c=r.Cartographic.fromCartesian(n),u=new r.Cartographic(c.longitude,c.latitude,l.height),m=r.Cartographic.toCartesian(u),g=r.Matrix4.getRotation(e,new r.Matrix3),p=r.Matrix4.fromRotationTranslation(g,m);t.modelMatrix=p,this.updatedTool(p);let f=new r.Cartesian3(p[12],p[13],p[14]),w=this.dragEndCallbackMap.get(t.id);w||(w=new Map,this.dragEndCallbackMap.set(t.id,w)),w.set("translation",{id:t.id,position:f})}}moveModelHeight(t,e,i,r){const s=this.Cesium,o=this.viewer,n=o.scene,h=r.y-i.endPosition.y;if(n.globe.pick(o.camera.getPickRay(i.endPosition),n)){const c=s.Matrix4.getTranslation(e,new s.Cartesian3),u=s.Cartographic.fromCartesian(c),m=new s.Cartographic(u.longitude,u.latitude,u.height+h*.001*Math.max(o.camera.positionCartographic.height,1)),g=s.Cartographic.toCartesian(m),p=s.Matrix4.getRotation(e,new s.Matrix3),f=s.Matrix4.fromRotationTranslation(p,g);t.modelMatrix=f,this.updatedTool(f);let w=new s.Cartesian3(f[12],f[13],f[14]),y=this.dragEndCallbackMap.get(t.id);y||(y=new Map,this.dragEndCallbackMap.set(t.id,y)),y.set("translation",{id:t.id,position:w})}}rotateModel(t,e,i){const r=this.Cesium,s=this.viewer,o=this.getModelHeadingPitchRoll(e),n=o.heading+i,h=new r.HeadingPitchRoll(n,o.pitch,o.roll),l=r.Transforms.headingPitchRollToFixedFrame(r.Matrix4.getTranslation(t.modelMatrix,new r.Cartesian3),h,s.scene.globe.ellipsoid,r.Transforms.eastNorthUpToFixedFrame,new r.Matrix4);t.modelMatrix=l;let c=this.dragEndCallbackMap.get(t.id);c||(c=new Map,this.dragEndCallbackMap.set(t.id,c)),c.set("rotate",{id:t.id,headingPitchRoll:{heading:r.Math.toDegrees(n),pitch:r.Math.toDegrees(o.pitch),roll:r.Math.toDegrees(o.roll)}})}cleanup(){this.handler&&(this.handler.destroy(),this.handler=null)}}function vr(a,t){const e=t.materialType||"DynamicImgMaterial"+Date.now()+Math.floor(Math.random()*1e3);function i(s){this._definitionChanged=new a.Event,this._color=s.color,this._colorSubscription=void 0,this.color=s.color,this.duration=s.duration,this._time=Date.now()}Object.defineProperties(i.prototype,{isConstant:{get(){return!1}},definitionChanged:{get(){return this._definitionChanged}},color:a.createPropertyDescriptor("color")}),i.prototype.getType=function(){return e},i.prototype.getValue=function(s,o){return a.defined(o)||(o={}),o.color=a.Property.getValueOrClonedDefault(this._color,s,a.Color.WHITE,o.color),o.image=t.image,o},i.prototype.equals=function(s){return this===s||s instanceof i&&a.Property.equals(this._color,s._color)};const r=function(s){return`
|
|
2
|
-
czm_material czm_getMaterial(czm_materialInput materialInput)
|
|
3
|
-
{
|
|
4
|
-
czm_material material = czm_getDefaultMaterial(materialInput);
|
|
5
|
-
vec2 st = materialInput.st;
|
|
6
|
-
float time = fract(mod(float(czm_frameNumber * 33.0) , float(${s.duration})) / float(${s.duration}));
|
|
7
|
-
${s.freely==="vertical"?`vec4 colorImage = texture(image, vec2(fract(float(${s.count}) *st.t ${s.direction} time), fract(st.s)));`:`vec4 colorImage = texture(image, vec2(fract(float(${s.count}) *st.s ${s.direction} time), fract(st.t)));`}
|
|
8
|
-
${s.isCustomColor?"material.diffuse = color.rgb;":"material.diffuse = colorImage.rgb;"}
|
|
9
|
-
material.alpha = colorImage.a;
|
|
10
|
-
return material;
|
|
11
|
-
}`};return a.Material._materialCache.addMaterial(e,{fabric:{type:e,uniforms:{color:t.color,image:t.image,time:1e3},source:r({count:t.count,freely:t.freely||"",direction:t.direction,duration:t.duration||100,isCustomColor:t.isCustomColor})},translucent(){return!0}}),new i(t)}function br(a,t){const e=t.MaterialType||"wallType"+new Date().getTime()+parseInt(Math.random()*1e3+"");function i(s){this._definitionChanged=new a.Event,this._color=void 0,this._colorSubscription=void 0,this.color=s.color,this.duration=s.duration,this._time=new Date().getTime()}Object.defineProperties(i.prototype,{isConstant:{get:function(){return!1}},definitionChanged:{get:function(){return this._definitionChanged}},color:a.createPropertyDescriptor("color")}),i.prototype.getType=function(){return e},i.prototype.getValue=function(s,o){return a.defined(o)||(o={}),o.image=t.image,this.duration&&(o.time=(new Date().getTime()-this._time)%this.duration/this.duration),o},i.prototype.equals=function(s){return this===s||s instanceof i&&a.Property.equals(this._color,s._color)};const r=function(s){let o=`czm_material czm_getMaterial(czm_materialInput materialInput)
|
|
12
|
-
{
|
|
13
|
-
czm_material material = czm_getDefaultMaterial(materialInput);
|
|
14
|
-
vec2 st = materialInput.st;
|
|
15
|
-
|
|
16
|
-
`;return s.freely=="vertical"?o+="vec4 colorImage = texture(image, vec2(fract(float("+s.count+")*st.t "+s.direction+` time), fract(st.s)));
|
|
17
|
-
`:o+="vec4 colorImage = texture(image, vec2(fract(float("+s.count+")*st.s "+s.direction+` time), fract(st.t)));
|
|
18
|
-
`,o+=`vec4 fragColor;
|
|
19
|
-
fragColor.rgb = (colorImage.rgb) / 1.0;
|
|
20
|
-
fragColor = czm_gammaCorrect(fragColor);
|
|
21
|
-
`,o+=` material.diffuse = colorImage.rgb;
|
|
22
|
-
material.alpha = colorImage.a;
|
|
23
|
-
material.emission = fragColor.rgb;
|
|
24
|
-
|
|
25
|
-
return material;
|
|
26
|
-
}
|
|
27
|
-
`,o};return a.Material._materialCache.addMaterial(e,{fabric:{type:e,uniforms:{color:new a.Color(1,0,0,.5),image:t.image,time:0},source:r({count:t.count,freely:t.freely,direction:t.direction})},translucent:function(){return!0}}),new i(t)}function Pr(a,t){const e=a.Color,i=a.defaultValue,r=Object.defineProperties,s=a.Event,o=a.createPropertyDescriptor,n=a.Property;let h=t.materialType||"PolylineFlow"+Date.now()+Math.floor(Math.random()*1e3);function l(c){c=i(c,i.EMPTY_OBJECT),this._definitionChanged=new s,this._color=void 0,this._colorSubscription=void 0,this.color=c.color||e.fromBytes(0,255,255,255),this._duration=void 0,this._durationSubscription=void 0,this.duration=i(c.duration,45)}return r(l.prototype,{isConstant:{get(){return!1}},definitionChanged:{get(){return this._definitionChanged}}}),l.prototype.getType=function(c){return h},l.prototype.getValue=function(c,u){return u||(u={}),u.color=n.getValueOrClonedDefault(this._color,c,a.Color.WHITE,u.color),u.duration=this._duration,u},l.prototype.equals=function(c){return this===c||c instanceof l&&n.equals(this._color,c._color)},r(l.prototype,{color:o("color"),duration:o("duration")}),a.PolylineFlowMaterialProperty=l,a.Material._materialCache.addMaterial(h,{fabric:{type:h,uniforms:{color:new e(1,1,1,1),duration:45},source:(function(){return`uniform vec4 color;
|
|
28
|
-
uniform float duration;
|
|
29
|
-
czm_material czm_getMaterial(czm_materialInput materialInput){
|
|
30
|
-
czm_material material = czm_getDefaultMaterial(materialInput);
|
|
31
|
-
vec2 st = materialInput.st;
|
|
32
|
-
float t = fract(czm_frameNumber / duration);
|
|
33
|
-
t *= 1.03;
|
|
34
|
-
float alpha = smoothstep(t - 0.03, t, st.s) * step(-t, -st.s);
|
|
35
|
-
alpha += 0.2;
|
|
36
|
-
vec4 fragColor;
|
|
37
|
-
fragColor.rgb = color.rgb;
|
|
38
|
-
fragColor = czm_gammaCorrect(fragColor);
|
|
39
|
-
material.diffuse = fragColor.rgb;
|
|
40
|
-
material.alpha = alpha;
|
|
41
|
-
material.emission = fragColor.rgb;
|
|
42
|
-
return material;
|
|
43
|
-
}`})()},translucent(){return!0}}),new l(t)}class Lr{constructor(){d(this,"categoryMap",new Map);d(this,"CategoryGet",{})}registerCategoryGet(t,e){if(!t)return console.warn("分类不能为空");this.CategoryGet[t]=e}register(t){const{themeKey:e,material:i,force:r=!1,category:s="default"}=t;this.categoryMap.has(s)||this.categoryMap.set(s,new Map);const o=this.categoryMap.get(s);if(o.has(e))if(r)console.info(`[MaterialManager] themeKey '${e}' 在分类 '${s}' 已被覆盖`);else{console.warn(`[MaterialManager] 已存在 themeKey '${e}' 在分类 '${s}',如需覆盖请设置 force = true`);return}o.set(e,i)}get({themeKey:t,category:e,options:i}){var r;return e=e||"default",this.CategoryGet[e]?this.CategoryGet[e]({themeKey:t,materialMap:this.categoryMap,options:i||{}}):(r=this.categoryMap.get(e))==null?void 0:r.get(t)}has(t,e="default"){var i;return((i=this.categoryMap.get(e))==null?void 0:i.has(t))??!1}remove(t,e="default"){const i=this.categoryMap.get(e);if(!i)return;const r=i.get(t);r!=null&&r.destroy&&r.destroy(),i.delete(t),i.size===0&&this.categoryMap.delete(e)}keys(t="default"){var e;return[...((e=this.categoryMap.get(t))==null?void 0:e.keys())||[]]}clearCategory(t="default"){var i;const e=this.categoryMap.get(t);if(e){for(const r of e.values())(i=r==null?void 0:r.destroy)==null||i.call(r);e.clear(),this.categoryMap.delete(t)}}clearAll(){var t;for(const e of this.categoryMap.values())for(const i of e.values())(t=i==null?void 0:i.destroy)==null||t.call(i);this.categoryMap.clear()}categories(){return[...this.categoryMap.keys()]}}class Mr{constructor(t){d(this,"id");d(this,"entities",[]);d(this,"primitives",[]);d(this,"dataItem",{});d(this,"aggregator");d(this,"cardPool");const{id:e,entities:i=[],primitives:r=[],dataItem:s={},aggregator:o,cardPool:n}=t;this.id=e,this.entities=i,this.primitives=r,this.dataItem=s,this.aggregator=o,this.cardPool=n}setVisible(t){this.entities.forEach(e=>{e&&(e.show=t)}),this.primitives.forEach(e=>{e&&(e.show=t)}),this.aggregator&&Array.isArray(this.dataItem.billboard)&&this.dataItem.billboard.map((i,r)=>{var o;return{id:this.dataItem.id,data:{...this.dataItem,show:t&&(((o=i.data)==null?void 0:o.show)??!0)}}}).forEach(i=>{var r;(r=this.aggregator)==null||r.updatePoint(i)}),this.cardPool&&this.dataItem.card&&(t?this.cardPool.showByIds([this.dataItem.id]):this.cardPool.hideByIds([this.dataItem.id]))}removeAll(t,e=!0){return this.entities.forEach(i=>{i&&t.entities.remove(i)}),this.entities=[],this.primitives.forEach(i=>{i&&t.scene.primitives.remove(i)}),this.primitives=[],e&&this.aggregator&&Array.isArray(this.dataItem.billboard)&&this.aggregator.removePointsById([this.dataItem.id]),e&&this.cardPool&&this.dataItem.card&&this.cardPool.removeByIds([this.dataItem.id]),this.dataItem.id}}class Er{constructor(t,e,i,r,s,o){d(this,"id");d(this,"groupMap",new Map);d(this,"Cesium");d(this,"viewer");d(this,"materialManager");d(this,"aggregator");d(this,"cardPool");this.id=t,this.Cesium=e,this.viewer=i,this.materialManager=r,this.aggregator=s,this.cardPool=o,this.aggregator.labelPool.eventBus.addListener(Z.Click,{name:"BufferedHierarchicalAggregator_maker_click",fn:(h,l)=>{this.cardPool.showByIds([h.data.id])}}),new e.ScreenSpaceEventHandler(i.scene.canvas).setInputAction(()=>{this.cardPool.hideFilter(h=>!h.initShow)},e.ScreenSpaceEventType.LEFT_CLICK)}createPolyline(t,e){if(!t.positions||t.positions.length<1)return null;const i=this.materialManager.get({themeKey:t.theme,category:"polyline",options:t}),r=Array.isArray(t.positions[0])?t.positions.flat():t.positions;let s={...t};return i&&(s.material=i),this.viewer.entities.add({polyline:{...s,positions:this.Cesium.Cartesian3.fromDegreesArrayHeights(r)},show:(t.show??!0)&&e})}createWall(t,e){var h,l;if(!t.positions||t.positions.length<1)return null;const i=this.materialManager.get({themeKey:t.theme,category:"wall",options:t}),r=t.positions.length===((h=t.minimumHeights)==null?void 0:h.length)?t.minimumHeights.map(c=>c-Number(t.minHeight||0)):t.positions.map(c=>(c[2]||0)-Number(t.minHeight||0)),s=t.positions.length===((l=t.maximumHeights)==null?void 0:l.length)?t.maximumHeights.map(c=>c+Number(t.maxHeight||0)):t.positions.map(c=>(c[2]||0)+Number(t.maxHeight||0)),o=t.positions.map(c=>this.Cesium.Cartesian3.fromDegrees(c[0],c[1],c[2]||0));let n={...t};return i&&(n.material=i),this.viewer.entities.add({wall:{...n,positions:o,minimumHeights:r,maximumHeights:s},show:(t.show??!0)&&e})}createPolygon(t,e){var l;if(!t.hierarchy||t.hierarchy.length<1)return null;const i=this.materialManager.get({themeKey:t.theme,category:"polygon",options:t}),r=Array.isArray(t.hierarchy[0])?t.hierarchy.flat():t.hierarchy,s=this.Cesium.Cartesian3.fromDegreesArrayHeights(r),o=((l=t.holes)==null?void 0:l.map(c=>{let u=Array.isArray(c[0])?t.hierarchy.flat():t.hole;return this.Cesium.Cartesian3.fromDegreesArrayHeights(u.flat())}))||[],n=new this.Cesium.PolygonHierarchy(s,o);let h={...t};return i&&(h.material=i),this.viewer.entities.add({polygon:{...h,hierarchy:n},show:(t.show??!0)&&e})}createBillboardPoints(t){var e;return!((e=t.billboard)!=null&&e.length)||!this.aggregator?[]:t.billboard.map(i=>{var n;const[r,s,o=0]=i.position||[0,0,0];return{id:t.id,lon:r,lat:s,height:o,name:((n=i.options)==null?void 0:n.text)||"",data:t,style:{zIndex:t.zIndex||"1"}}})}createCard(t){var e,i,r;(i=(e=t.card)==null?void 0:e.data)!=null&&i.length&&this.cardPool.add(t.card,{id:t.id,lon:t.card.position[0],lat:t.card.position[1],height:t.card.position[3]||0,theme:t.card.theme,show:t.show?t.card.initShow??!1:!1,notCreateElement:!0,style:{width:"0",height:"0",zIndex:((r=t==null?void 0:t.card)==null?void 0:r.zIndex)||"110"}})}addGroup(t,e=!0){const i=t.id||`${Date.now()}`;this.removeGroup(i);const r=[],s=t.show!==!1;(t.polyline||[]).forEach(h=>{const l=this.createPolyline(h,s);l&&r.push(l)}),(t.wall||[]).forEach(h=>{const l=this.createWall(h,s);l&&r.push(l)}),(t.polygon||[]).forEach(h=>{const l=this.createPolygon(h,s);l&&r.push(l)});const o=this.createBillboardPoints(t);o.length&&e&&this.aggregator.appendPoints(o,!1),this.createCard(t);const n=new Mr({id:i,entities:r,primitives:[],dataItem:t,aggregator:this.aggregator,cardPool:this.cardPool});return this.groupMap.set(i,n),o}async addGroups(t){const i=t.map(r=>this.addGroup(r,!1)).flat();i.length>0&&this.aggregator&&this.aggregator.appendPoints(i,!1)}removeGroup(t){const e=this.groupMap.get(t);e&&(e.removeAll(this.viewer),this.groupMap.delete(t))}removeGroups(t){let e=[];for(const i of t){const r=this.groupMap.get(i);if(r){let s=r.removeAll(this.viewer,!1);this.groupMap.delete(i),e.push(s)}}this.aggregator.removePointsById(e),this.cardPool.removeByIds(e)}updateGroup(t){const e=this.groupMap.get(t.id);e&&(e.removeAll(this.viewer),this.groupMap.delete(t.id)),this.addGroup(t)}async updateGroups(t){this.aggregator.removePointsById(t.map(r=>r.id)),this.cardPool.removeByIds(t.map(r=>r.id));const i=t.map(r=>{const s=this.groupMap.get(r.id);return s&&(s.removeAll(this.viewer,!1),this.groupMap.delete(r.id)),this.addGroup(r,!1)}).flat();i.length>0&&this.aggregator&&this.aggregator.appendPoints(i,!1)}setGroupVisible(t,e){var i;(i=this.groupMap.get(t))==null||i.setVisible(e)}clearAllGroups(){this.groupMap.forEach(t=>t.removeAll(this.viewer)),this.groupMap.clear()}}class Ir{constructor(t,e,i,r,s){d(this,"Cesium");d(this,"viewer");d(this,"layerMap",new Map);d(this,"materialManager");d(this,"aggregator");d(this,"cardPool");this.Cesium=t,this.viewer=e,this.materialManager=i,this.aggregator=r,this.cardPool=s}addLayer(t){this.layerMap.has(t)||this.layerMap.set(t,new Er(t,this.Cesium,this.viewer,this.materialManager,this.aggregator,this.cardPool))}removeLayer(t){const e=this.layerMap.get(t);e&&(e.clearAllGroups(),this.layerMap.delete(t))}getLayer(t){return this.layerMap.get(t)}async addGroupsToLayer(t,e){const i=this.layerMap.get(t);i&&(i.addGroups(e),this.aggregator.refresh())}updateGroupToLayer(t,e){const i=this.layerMap.get(t);i&&(i.updateGroups(e),this.aggregator.refresh())}setGroupVisible(t,e,i){var r;(r=this.layerMap.get(t))==null||r.setGroupVisible(e,i)}removeGroup(t,e){var i;(i=this.layerMap.get(t))==null||i.removeGroup(e)}removeGroups(t,e){var i;(i=this.layerMap.get(t))==null||i.removeGroups(e)}}function Tr(a){const t=[];return a.features.forEach((e,i)=>{if(e.geometry&&e.properties){const r=e.geometry,s=e.properties,o={id:s.id||`${Date.now()}`,show:!0,zIndex:s.zIndex||1,name:`${s.layer}_${i}`||"",billboard:[],polyline:[],wall:[],polygon:[],card:s.card||null};switch(r.type){case"Point":o.billboard.push({position:r.coordinates,options:s,name:`${s.layer}_${i}`});break;case"LineString":o.polyline.push({positions:r.coordinates,theme:s.theme||"default"});break;case"Polygon":o.polygon.push({hierarchy:r.coordinates[0],theme:s.theme||"default"});break;case"MultiLineString":r.coordinates.forEach(n=>{o.polyline.push({positions:n})});break;case"MultiPolygon":r.coordinates.forEach(n=>{o.polygon.push({hierarchy:n[0]})});break;case"GeometryCollection":r.geometries.forEach(n=>{n.type==="Point"?o.billboard.push({position:n.coordinates}):n.type==="LineString"?o.polyline.push({positions:n.coordinates}):n.type==="Polygon"&&o.polygon.push({hierarchy:n.coordinates[0]})});break;default:console.warn(`Unsupported geometry type: ${r.type}`);break}t.push(o)}}),t}class xr{constructor(t){d(this,"Cesium");d(this,"viewer");d(this,"layerMap");d(this,"hideLayerMap");d(this,"entityLayerManager");d(this,"PrimitiveThemeMap");d(this,"materialManager");let{Cesium:e,viewer:i,materialManager:r,entityLayerManager:s}=t;this.Cesium=e,this.viewer=i,this.layerMap=new Map,this.PrimitiveThemeMap=new Map,this.hideLayerMap=new Map,this.materialManager=r,this.entityLayerManager=s}createGeometryInstance(t){let e;return t.category==="polyline"&&t.positions?e=this.createPolyline(t):t.category==="polygon"&&t.hierarchy&&(e=this.createPolygon(t)),e}carateThemePrimitive(t){let e=Fe(t),i=this.PrimitiveThemeMap.get(e.theme);if(!i){this.initTheme(e);let r=this.createAppearance(e);i={Primitive:null,ids:new Map,appearance:r,geometryInstances:new Map},this.PrimitiveThemeMap.set(e.theme,i)}return i}initTheme(t){var r,s,o,n,h,l,c,u,m,g,p,f;let e=this.materialManager,i=this.Cesium;if(t.category=="polyline"){const w=((s=(r=t.properties)==null?void 0:r.lineType)==null?void 0:s.pattern)&&((n=(o=t.properties)==null?void 0:o.lineType)==null?void 0:n.patternLength);let y="";if(w){const C=((l=(h=t.properties)==null?void 0:h.lineType)==null?void 0:l.pattern)||[.25,-.125],v=((u=(c=t.properties)==null?void 0:c.lineType)==null?void 0:u.patternLength)||.375;let b=this.convertCadPatternToCesiumDash(C,v);y=`DashedLineMaterial_pattern_${b.dashPattern}_dashLength_${b.dashLength}_color_${(m=t.properties)==null?void 0:m.color}`,e.has(y)||e.register({themeKey:y,material:i.Material.fromType("PolylineDash",{color:i.Color.fromCssColorString(t.properties.color||"#FFFFFF").withAlpha(.8),dashLength:b.dashLength,dashPattern:b.dashPattern})})}else y=`LineMaterial_color_${(g=t.properties)==null?void 0:g.color}`,e.has(y)||e.register({themeKey:y,material:i.Material.fromType("Color",{color:i.Color.fromCssColorString(t.properties.color||"#FFFFFF").withAlpha(.8)})})}else if(t.category=="polygon"){let w=`polygonMaterial_color_${(p=t.properties)==null?void 0:p.color}`;e.has(w)||e.register({themeKey:w,material:i.Material.fromType("Color",{color:i.Color.fromCssColorString(((f=t.properties)==null?void 0:f.color)||"#FFFFFF").withAlpha(.8)})})}}convertCadPatternToCesiumDash(t,e){const r=e/16;let s=[],o=0;for(let h of t){const l=Math.floor(Math.abs(h)/r),c=h>=0?1:0;for(let u=0;u<l&&(s.push(c),o++,!(o>=16));u++);if(o>=16)break}for(;s.length<16;)s.push(0);s.length>16&&(s.length=16);let n=0;for(let h=0;h<16;h++)n=n<<1|s[h];return{dashPattern:n,dashLength:e}}async processBatch(t){const e=new Map;t.forEach(i=>{let{layerId:r,dataList:s}=i;Fe(s).forEach(n=>{let h=this.createGeometryInstance(n);if(h){let l=this.carateThemePrimitive(n);l.ids.set(n.id,n),l.geometryInstances.set(n.id,h);const c=this.layerMap.get(r);if(c)c.set(n.id,n);else{let u=new Map;this.layerMap.set(r,u),u.set(n.id,n)}e.set(n.theme,n)}})}),e.forEach(i=>{this.updatePrimitive(i)})}createPolyline(t){const e=Array.isArray(t.positions[0])?t.positions.flat():t.positions;return new this.Cesium.GeometryInstance({id:t.id,geometry:new this.Cesium.GroundPolylineGeometry({positions:this.Cesium.Cartesian3.fromDegreesArrayHeights(e),width:Math.max(t.width||2,2)})})}createPolygon(t){var o;const e=Array.isArray(t.hierarchy[0])?t.hierarchy.flat():t.hierarchy,i=this.Cesium.Cartesian3.fromDegreesArrayHeights(e),r=((o=t.holes)==null?void 0:o.map(n=>{let h=Array.isArray(n[0])?n.flat():n,l=this.Cesium.Cartesian3.fromDegreesArrayHeights(h.flat());return new this.Cesium.PolygonHierarchy(l)}))||[],s=new this.Cesium.PolygonHierarchy(i,r);return new this.Cesium.GeometryInstance({id:t.id,geometry:new this.Cesium.PolygonGeometry({polygonHierarchy:s})})}getMaterial(t){let e=this.materialManager.get({themeKey:t.theme,options:t});return e||(e=this.Cesium.Material.fromType("Color",{color:new this.Cesium.Color(1,0,0,1)})),e}updateGeometryInstance(t){let e=Fe(t);const i=this.layerMap.get(e.layerId);if(!i){console.warn(`没有找到图层 ${e.layerId}`);return}let r=i.get(e.id);if(i.set(e.id,e),!r){console.warn(`没有找到图元 ${e.id} 在图层 ${e.layerId} 中`);return}if(r.theme!==e.theme){let o=this.PrimitiveThemeMap.get(r.theme);o==null||o.geometryInstances.delete(e.id),o==null||o.ids.delete(e.id),this.updatePrimitive(r)}let s=this.carateThemePrimitive(e);if(s){const o=this.createGeometryInstance(e);s.geometryInstances.set(e.id,o),s.ids.set(e.id,e),this.updatePrimitive(e)}}deleteGeometryInstance(t){let e=new Set;t.forEach(i=>{let{layerId:r,ids:s}=i;const o=this.layerMap.get(r);if(!o){console.warn(`没有找到图层 ${r}`);return}s.forEach(n=>{let h=o.get(n);if(!h){console.warn(`没有找到图元 ${n} 在图层 ${r} 中`);return}let l=this.PrimitiveThemeMap.get(h.theme);l&&(l.geometryInstances.delete(h.id),l.ids.delete(h.id),e.add(h))})}),Array.from(e.values()).forEach(i=>{this.updatePrimitive(i)})}addGeometryInstance(t){let e=Fe(t);const i=this.layerMap.get(e.layerId);if(!i){console.warn(`没有找到图层 ${e.layerId}`);return}if(i.get(e.id)){console.warn(`图元 ${e.id} 已经存在图层 ${e.layerId} 中`);return}i.set(e.id,e);let s=this.carateThemePrimitive(e);if(s){const o=this.createGeometryInstance(e);s.geometryInstances.set(e.id,o),s.ids.set(e.id,e),this.updatePrimitive(e)}}createAppearance(t){let e=this.getMaterial({theme:t.theme}),i;return t.category==="polyline"?i=new this.Cesium.PolylineMaterialAppearance({material:e,translucent:!0}):t.category==="polygon"&&(i=new this.Cesium.MaterialAppearance({material:e,translucent:!0})),i}updatePrimitive(t){const e=this.PrimitiveThemeMap.get(t.theme);if(!e)return;e.Primitive&&(this.viewer.scene.primitives.remove(e.Primitive),e.Primitive=null);let r=Array.from(e.geometryInstances,([s,o])=>({key:s,value:o})).filter(s=>!Array.from(this.hideLayerMap.values()).some(o=>o.has(s.key))).map(s=>s.value);r.length<=0||(t.category==="polyline"?(e.Primitive=new this.Cesium.GroundPolylinePrimitive({geometryInstances:r,appearance:e.appearance}),this.viewer.scene.primitives.add(e.Primitive)):(e.Primitive=new this.Cesium.GroundPrimitive({geometryInstances:r,appearance:e.appearance}),this.viewer.scene.primitives.add(e.Primitive)))}hideByLayerAndId(t){let e=new Map;t.forEach(i=>{let{layerId:r,ids:s}=i,o=this.hideLayerMap.get(r);o||(o=new Set,this.hideLayerMap.set(r,o)),s.forEach(n=>{o.add(n);let h=this.getGeometryInstanceInfo(r,n);h&&e.set(h.theme,h)})}),Array.from(e.values()).forEach(i=>{this.updatePrimitive(i)})}showByLayerAndId(t){let e=new Map;t.forEach(i=>{let{layerId:r,ids:s}=i,o=this.hideLayerMap.get(r);o||(o=new Set,this.hideLayerMap.set(r,o)),s.forEach(n=>{o.delete(n);let h=this.getGeometryInstanceInfo(r,n);h&&e.set(h.theme,h)})}),Array.from(e.values()).forEach(i=>{this.updatePrimitive(i)})}hasGeometryInstance(t,e){const i=this.layerMap.get(t);if(!i)return!1;const r=i.get(e);if(!r)return!1;let s=this.PrimitiveThemeMap.get(r.theme);return!(!s||!s.geometryInstances.get(e))}getGeometryInstanceInfo(t,e){const i=this.layerMap.get(t);return i?i.get(e):null}focusOnGeometryInstance(t,e){const i=this.layerMap.get(t);if(!i){console.warn(`图层 ${t} 不存在`);return}const r=i.get(e);if(!r){console.warn(`没有找到图元 ${e} 在图层 ${t} 中`);return}let s=this.PrimitiveThemeMap.get(r.theme);if(!s){console.warn(`没有找到 ${e} 图元相关的Primitive`);return}const o=s.geometryInstances.get(e);if(!o){console.warn(`没有找到图元的几何体 ${e}`);return}const n=o.geometry,h=n._positions||n._polygonHierarchy.positions;if(h&&h.length>0){let l=h[0].x,c=h[0].y,u=h[0].z,m=h[0].x,g=h[0].y,p=h[0].z;h.forEach(v=>{l=Math.min(l,v.x),c=Math.min(c,v.y),u=Math.min(u,v.z),m=Math.max(m,v.x),g=Math.max(g,v.y),p=Math.max(p,v.z)});const f=new this.Cesium.Cartesian3((l+m)/2,(c+g)/2,(u+p)/2),y=new this.Cesium.Cartesian3(m-l,g-c,p-u).z,C=Math.abs(y||1)*1.5;this.viewer.camera.flyTo({destination:f,duration:2,complete:()=>{console.log(`已定位到图元 ${e}`)},offset:new this.Cesium.Cartesian3(0,0,C)})}else console.warn(`无法获取图元 ${e} 的顶点信息`)}}class We{constructor(t,e){d(this,"Cesium");d(this,"viewer");d(this,"handler",null);d(this,"positions",[]);d(this,"tempPoints",[]);d(this,"segmentEntities",[]);d(this,"segmentLabelIds",[]);d(this,"previewEntity",null);d(this,"previewGroundEntity",null);d(this,"hoverPos",null);d(this,"htmlLabelPool",null);d(this,"totalLabelId",null);d(this,"previewLabelId",null);d(this,"labelEntity",null);d(this,"firstHeight",null);d(this,"groundLineEntities",[]);this.Cesium=t,this.viewer=e}start(t){this.clear();const e=this.Cesium,i=this.viewer;if(!this.htmlLabelPool){const r=t.overlayContainerId||"html-label-container";this.htmlLabelPool=new W(e,i,r),this.htmlLabelPool.registerTheme("measure-horizontal-total",{createElement:(s,o)=>{var n;s.innerHTML=String(((n=o==null?void 0:o.data)==null?void 0:n.text)||""),s.style.background="rgba(0,0,0,0.6)",s.style.color="#fff",s.style.font="14px sans-serif",s.style.padding="4px 6px",s.style.borderRadius="4px",s.style.whiteSpace="pre"},options:{offset:{x:0,y:-10}}}),this.htmlLabelPool.registerTheme("measure-horizontal-seg",{createElement:(s,o)=>{var n;s.innerHTML=String(((n=o==null?void 0:o.data)==null?void 0:n.text)||""),s.style.background="rgba(0,0,0,0.6)",s.style.color="#fff",s.style.font="14px sans-serif",s.style.padding="4px 6px",s.style.borderRadius="4px",s.style.whiteSpace="pre"},options:{offset:{x:0,y:-10}}})}this.handler=new e.ScreenSpaceEventHandler(i.canvas),this.handler.setInputAction(r=>{var f,w,y,C;const s=i.scene.pickPosition(r.position);if(!s)return;const o=e.Cartographic.fromCartesian(s),n=e.Math.toDegrees(o.longitude),h=e.Math.toDegrees(o.latitude);this.positions.length===0&&(this.firstHeight=o.height||0);const l=e.Cartesian3.fromDegrees(n,h,this.firstHeight||0);this.positions.push(l);const c=i.entities.add({position:l,point:{pixelSize:8,color:t.pointColor||t.color||e.Color.YELLOW,disableDepthTestDistance:Number.POSITIVE_INFINITY}});this.tempPoints.push(c);const u=i.scene.globe.getHeight(new e.Cartographic(o.longitude,o.latitude,0))||0,m=e.Cartesian3.fromDegrees(n,h,u),g=((w=(f=t.dashLineColor||t.lineColor||t.color||e.Color.RED).withAlpha)==null?void 0:w.call(f,.9))||e.Color.RED,p=i.entities.add({polyline:{positions:[m,l],width:t.width||3,material:new e.PolylineDashMaterialProperty({color:g,dashLength:12,dashPattern:255})}});if(this.groundLineEntities.push(p),this.positions.length>=2){const v=this.positions[this.positions.length-2],b=this.positions[this.positions.length-1],E=e.Cartographic.fromCartesian(v),M=e.Cartographic.fromCartesian(b),P=i.entities.add({polyline:{positions:[v,b],width:t.width||3,material:t.lineColor||t.color||e.Color.YELLOW,depthFailMaterial:new e.PolylineDashMaterialProperty({color:((C=(y=t.dashLineColor||t.lineColor||t.color||e.Color.RED).withAlpha)==null?void 0:C.call(y,.9))||e.Color.RED,dashLength:12,dashPattern:255})}});this.segmentEntities.push(P);const I=new e.EllipsoidGeodesic(E,M).surfaceDistance,x=new e.Cartesian3((v.x+b.x)/2,(v.y+b.y)/2,(v.z+b.z)/2),A=e.Cartographic.fromCartesian(x),$=`measure_horizontal_seg_${this.segmentLabelIds.length}_${Date.now()}`;this.segmentLabelIds.push($),this.htmlLabelPool.add({text:`${I.toFixed(2)} m`},{id:$,lon:e.Math.toDegrees(A.longitude),lat:e.Math.toDegrees(A.latitude),height:A.height||this.firstHeight||0,theme:"measure-horizontal-seg",show:!0})}},e.ScreenSpaceEventType.LEFT_CLICK),this.handler.setInputAction(()=>{var l;if(this.positions.length<2){this.stop();return}this.stop(),this.previewLabelId&&(this.htmlLabelPool.removeByIds([this.previewLabelId]),this.previewLabelId=null),this.hoverPos&&(this.hoverPos=null),this.previewEntity&&(this.viewer.entities.remove(this.previewEntity),this.previewEntity=null),this.previewGroundEntity&&(this.viewer.entities.remove(this.previewGroundEntity),this.previewGroundEntity=null);let r=0;for(let c=1;c<this.positions.length;c++){const u=this.positions[c-1],m=this.positions[c],g=e.Cartographic.fromCartesian(u),p=e.Cartographic.fromCartesian(m),f=new e.EllipsoidGeodesic(g,p);r+=f.surfaceDistance}const s=this.positions[this.positions.length-1],o=e.Cartographic.fromCartesian(s),n=this.totalLabelId||`measure_horizontal_total_${Date.now()}`;this.totalLabelId=n,this.htmlLabelPool.add({text:`${r.toFixed(2)} m`},{id:n,lon:e.Math.toDegrees(o.longitude),lat:e.Math.toDegrees(o.latitude),height:o.height||this.firstHeight||0,theme:"measure-horizontal-total",show:!0}),this.labelEntity=this.totalLabelId;const h={entity:this.segmentEntities,label:this.labelEntity,segmentLabels:this.segmentLabelIds,positions:this.positions,distance:r,clear:()=>this.clear()};(l=t.onComplete)==null||l.call(t,h)},e.ScreenSpaceEventType.LEFT_DOUBLE_CLICK),this.handler.setInputAction(r=>{var E,M,P,L;if(this.positions.length===0)return;const s=i.scene.pickPosition(r.endPosition);if(!s)return;this.hoverPos=s;const o=e.Cartographic.fromCartesian(s),n=e.Math.toDegrees(o.longitude),h=e.Math.toDegrees(o.latitude),l=e.Cartesian3.fromDegrees(n,h,this.firstHeight||0),c=this.positions[this.positions.length-1],u=e.Cartographic.fromCartesian(c),m=e.Cartographic.fromCartesian(l),p=new e.EllipsoidGeodesic(u,m).surfaceDistance,f=new e.Cartesian3((c.x+l.x)/2,(c.y+l.y)/2,(c.z+l.z)/2),w=e.Cartographic.fromCartesian(f),y=this.previewLabelId||"measure_horizontal_preview";this.previewLabelId=y,this.htmlLabelPool.add({text:`${p.toFixed(2)} m`},{id:y,lon:e.Math.toDegrees(w.longitude),lat:e.Math.toDegrees(w.latitude),height:w.height||this.firstHeight||0,theme:"measure-horizontal-seg",show:!0});const C=i.scene.globe.getHeight(new e.Cartographic(o.longitude,o.latitude,0))||0,v=e.Cartesian3.fromDegrees(n,h,C),b=((M=(E=t.dashLineColor||t.lineColor||t.color||e.Color.RED).withAlpha)==null?void 0:M.call(E,.9))||e.Color.RED;this.previewGroundEntity?this.previewGroundEntity.polyline.positions=[v,l]:this.previewGroundEntity=i.entities.add({polyline:{positions:[v,l],width:t.width||3,material:new e.PolylineDashMaterialProperty({color:b,dashLength:12,dashPattern:255})}}),this.previewEntity?this.previewEntity.polyline.positions=[c,l]:this.previewEntity=i.entities.add({polyline:{positions:[c,l],width:t.width||3,material:t.lineColor||t.color||e.Color.YELLOW,depthFailMaterial:new e.PolylineDashMaterialProperty({color:((L=(P=t.dashLineColor||t.lineColor||t.color||e.Color.RED).withAlpha)==null?void 0:L.call(P,.9))||e.Color.RED,dashLength:12,dashPattern:255})}})},e.ScreenSpaceEventType.MOUSE_MOVE)}stop(){this.handler&&(this.handler.destroy(),this.handler=null)}clear(){this.stop(),this.segmentEntities.forEach(t=>this.viewer.entities.remove(t)),this.segmentEntities=[],this.groundLineEntities.forEach(t=>this.viewer.entities.remove(t)),this.groundLineEntities=[],this.tempPoints.forEach(t=>this.viewer.entities.remove(t)),this.tempPoints=[],this.totalLabelId&&this.htmlLabelPool&&(this.htmlLabelPool.removeByIds([this.totalLabelId]),this.totalLabelId=null),this.previewEntity&&(this.viewer.entities.remove(this.previewEntity),this.previewEntity=null),this.previewGroundEntity&&(this.viewer.entities.remove(this.previewGroundEntity),this.previewGroundEntity=null),this.previewLabelId&&this.htmlLabelPool&&(this.htmlLabelPool.removeByIds([this.previewLabelId]),this.previewLabelId=null),this.segmentLabelIds.length&&this.htmlLabelPool&&this.htmlLabelPool.removeByIds(this.segmentLabelIds.slice()),this.segmentLabelIds=[],this.positions=[],this.hoverPos=null,this.labelEntity=null,this.firstHeight=null}rehydrate(t,e){var p,f;const i=this.Cesium,r=this.viewer,s=t.options||{},o=s.lineColor||s.color||i.Color.YELLOW,n=((f=(p=s.dashLineColor||s.lineColor||s.color||i.Color.RED).withAlpha)==null?void 0:f.call(p,.9))||i.Color.RED,h=s.width||3,l=(t.positions||[]).map(w=>new i.Cartesian3(w[0],w[1],w[2]));if(!l.length)return;if(!this.htmlLabelPool){const w=s.overlayContainerId||"html-label-container";this.htmlLabelPool=e||new W(i,r,w),this.htmlLabelPool.registerTheme("measure-horizontal-total",{createElement:(y,C)=>{var v;y.innerHTML=String(((v=C==null?void 0:C.data)==null?void 0:v.text)||""),y.style.background="rgba(0,0,0,0.6)",y.style.color="#fff",y.style.font="14px sans-serif",y.style.padding="4px 6px",y.style.borderRadius="4px",y.style.whiteSpace="pre"},options:{offset:{x:0,y:-10}}}),this.htmlLabelPool.registerTheme("measure-horizontal-seg",{createElement:(y,C)=>{var v;y.innerHTML=String(((v=C==null?void 0:C.data)==null?void 0:v.text)||""),y.style.background="rgba(0,0,0,0.6)",y.style.color="#fff",y.style.font="14px sans-serif",y.style.padding="4px 6px",y.style.borderRadius="4px",y.style.whiteSpace="pre"},options:{offset:{x:0,y:-10}}})}for(const w of l){const y=r.entities.add({position:w,point:{pixelSize:8,color:s.pointColor||s.color||i.Color.YELLOW,disableDepthTestDistance:Number.POSITIVE_INFINITY}});this.tempPoints.push(y);const C=i.Cartographic.fromCartesian(w),v=i.Math.toDegrees(C.longitude),b=i.Math.toDegrees(C.latitude),E=r.scene.globe.getHeight(new i.Cartographic(C.longitude,C.latitude,0))||0,M=i.Cartesian3.fromDegrees(v,b,E),P=r.entities.add({polyline:{positions:[M,w],width:h,material:new i.PolylineDashMaterialProperty({color:n,dashLength:12,dashPattern:255})}});this.groundLineEntities.push(P)}for(let w=1;w<l.length;w++){const y=l[w-1],C=l[w],v=r.entities.add({polyline:{positions:[y,C],width:h,material:o,depthFailMaterial:new i.PolylineDashMaterialProperty({color:n,dashLength:12,dashPattern:255})}});this.segmentEntities.push(v);const b=i.Cartographic.fromCartesian(y),E=i.Cartographic.fromCartesian(C),P=new i.EllipsoidGeodesic(b,E).surfaceDistance,L=new i.Cartesian3((y.x+C.x)/2,(y.y+C.y)/2,(y.z+C.z)/2),I=i.Cartographic.fromCartesian(L),x=t.id+`_seg_${w-1}`;this.segmentLabelIds.push(x),this.htmlLabelPool.add({text:`${P.toFixed(2)} m`},{id:x,lon:i.Math.toDegrees(I.longitude),lat:i.Math.toDegrees(I.latitude),height:I.height||0,theme:"measure-horizontal-seg",show:!0,style:{pointerEvents:"none",userSelect:"none",cursor:"default"}})}let c=0;for(let w=1;w<l.length;w++){const y=i.Cartographic.fromCartesian(l[w-1]),C=i.Cartographic.fromCartesian(l[w]),v=new i.EllipsoidGeodesic(y,C);c+=v.surfaceDistance}const u=l[l.length-1],m=i.Cartographic.fromCartesian(u),g=t.id+"_total";this.totalLabelId=g,this.htmlLabelPool.add({text:`${c.toFixed(2)} m`},{id:g,lon:i.Math.toDegrees(m.longitude),lat:i.Math.toDegrees(m.latitude),height:m.height||0,theme:"measure-horizontal-total",show:!0,style:{pointerEvents:"none",userSelect:"none",cursor:"default"}})}}class Ve{constructor(t,e){d(this,"Cesium");d(this,"viewer");d(this,"handler",null);d(this,"entity",null);d(this,"labelEntity",null);d(this,"positions",[]);d(this,"htmlLabelPool",null);d(this,"htmlLabelId",null);d(this,"previewLabelId",null);d(this,"baseCarto",null);d(this,"baseUp",null);d(this,"tempPoints",[]);d(this,"previewPointEntity",null);d(this,"previewEntity",null);this.Cesium=t,this.viewer=e}start(t){this.clear();const e=this.Cesium,i=this.viewer;if(!this.htmlLabelPool){const r=t.overlayContainerId||"html-label-container";this.htmlLabelPool=new W(e,i,r),this.htmlLabelPool.registerTheme("measure-vertical",{createElement:(s,o)=>{var n;s.innerHTML=String(((n=o==null?void 0:o.data)==null?void 0:n.text)||""),s.style.background="rgba(0,0,0,0.6)",s.style.color="#fff",s.style.font="14px sans-serif",s.style.padding="4px 6px",s.style.borderRadius="4px",s.style.whiteSpace="pre"},options:{offset:{x:0,y:-10}}})}this.handler=new e.ScreenSpaceEventHandler(i.canvas),this.handler.setInputAction(r=>{var n,h,l,c,u;const s=i.camera.getPickRay(r.position);let o=s?i.scene.globe.pick(s,i.scene):null;if(o||(o=i.camera.pickEllipsoid(r.position,e.Ellipsoid.WGS84)),o||(o=i.scene.pickPosition(r.position)),!!o)if(this.positions.length===0){const m=e.Cartographic.fromCartesian(o);this.baseCarto=new e.Cartographic(m.longitude,m.latitude,0);const g=e.Ellipsoid.WGS84.cartographicToCartesian(this.baseCarto);this.baseUp=e.Ellipsoid.WGS84.geodeticSurfaceNormalCartographic(this.baseCarto),this.positions.push(g);const p=i.entities.add({position:g,point:{pixelSize:8,color:t.pointColor||t.color||e.Color.YELLOW,disableDepthTestDistance:Number.POSITIVE_INFINITY}});this.tempPoints.push(p);const f=t.lineColor||t.color||e.Color.CYAN,w=((h=(n=t.dashLineColor||t.lineColor||t.color||e.Color.RED).withAlpha)==null?void 0:h.call(n,.9))||e.Color.RED;this.previewEntity=i.entities.add({polyline:{positions:[g,g],width:t.width||3,material:f,depthFailMaterial:new e.PolylineDashMaterialProperty({color:w,dashLength:12,dashPattern:255})}})}else{if(!this.baseCarto||!this.baseUp)return;const m=this.positions[0],g=i.camera.getPickRay(r.position);if(!g)return;const p=g.origin,f=e.Cartesian3.normalize(g.direction,new e.Cartesian3),w=m,y=this.baseUp,C=e.Cartesian3.subtract(p,w,new e.Cartesian3),v=e.Cartesian3.dot(f,f),b=-e.Cartesian3.dot(f,y),E=e.Cartesian3.dot(y,y),M=-e.Cartesian3.dot(f,C),P=e.Cartesian3.dot(y,C),L=v*E-b*b;if(Math.abs(L)<1e-6)return;const I=(v*P-b*M)/L,x=e.Cartesian3.add(w,e.Cartesian3.multiplyByScalar(y,I,new e.Cartesian3),new e.Cartesian3);this.positions[1]=x,this.stop(),this.previewEntity&&(this.viewer.entities.remove(this.previewEntity),this.previewEntity=null),this.previewPointEntity&&(this.viewer.entities.remove(this.previewPointEntity),this.previewPointEntity=null);const A=t.lineColor||t.color||e.Color.CYAN,$=((c=(l=t.dashLineColor||t.lineColor||t.color||e.Color.RED).withAlpha)==null?void 0:c.call(l,.9))||e.Color.RED;this.entity=i.entities.add({polyline:{positions:[m,x],width:t.width||3,material:A,depthFailMaterial:new e.PolylineDashMaterialProperty({color:$,dashLength:12,dashPattern:255})}});const R=i.entities.add({position:x,point:{pixelSize:8,color:t.pointColor||t.color||e.Color.YELLOW,disableDepthTestDistance:Number.POSITIVE_INFINITY}});this.tempPoints.push(R);const S=this.baseCarto,_=e.Cartographic.fromCartesian(x),F=Math.abs((_.height||0)-(S.height||0)),N=new e.Cartesian3((this.positions[0].x+this.positions[1].x)/2,(this.positions[0].y+this.positions[1].y)/2,(this.positions[0].z+this.positions[1].z)/2),D=e.Cartographic.fromCartesian(N);this.previewLabelId&&this.htmlLabelPool&&(this.htmlLabelPool.removeByIds([this.previewLabelId]),this.previewLabelId=null);const Y=this.htmlLabelId||`measure_vertical_${Date.now()}`;this.htmlLabelId=Y,this.htmlLabelPool.add({text:`${F.toFixed(2)} m`},{id:Y,lon:e.Math.toDegrees(D.longitude),lat:e.Math.toDegrees(D.latitude),height:D.height||0,theme:"measure-vertical",show:!0,style:{pointerEvents:"none",userSelect:"none",cursor:"default"}});const G={entity:this.entity,label:this.labelEntity,positions:this.positions,vertical:F,clear:()=>this.clear()};(u=t.onComplete)==null||u.call(t,G)}},e.ScreenSpaceEventType.LEFT_CLICK),this.handler.setInputAction(r=>{var x,A;if(this.positions.length<1)return;if(!this.baseCarto||!this.baseUp){const $=e.Cartographic.fromCartesian(this.positions[0]);this.baseCarto=new e.Cartographic($.longitude,$.latitude,$.height||0),this.baseUp=e.Ellipsoid.WGS84.geodeticSurfaceNormalCartographic(this.baseCarto)}const s=this.positions[0],o=i.camera.getPickRay(r.endPosition);if(!o)return;const n=o.origin,h=e.Cartesian3.normalize(o.direction,new e.Cartesian3),l=s,c=this.baseUp,u=e.Cartesian3.subtract(n,l,new e.Cartesian3),m=e.Cartesian3.dot(h,h),g=-e.Cartesian3.dot(h,c),p=e.Cartesian3.dot(c,c),f=-e.Cartesian3.dot(h,u),w=e.Cartesian3.dot(c,u),y=m*p-g*g;if(Math.abs(y)<1e-6)return;const C=(m*w-g*f)/y,v=e.Cartesian3.add(l,e.Cartesian3.multiplyByScalar(c,C,new e.Cartesian3),new e.Cartesian3);if(this.positions[1]=v,this.previewEntity)this.previewEntity.polyline.positions=[l,v];else{const $=t.lineColor||t.color||e.Color.CYAN,R=((A=(x=t.dashLineColor||t.lineColor||t.color||e.Color.RED).withAlpha)==null?void 0:A.call(x,.9))||e.Color.RED;this.previewEntity=i.entities.add({polyline:{positions:[l,v],width:t.width||3,material:$,depthFailMaterial:new e.PolylineDashMaterialProperty({color:R,dashLength:12,dashPattern:255})}})}this.previewPointEntity?this.previewPointEntity.position=v:this.previewPointEntity=i.entities.add({position:v,point:{pixelSize:8,color:t.pointColor||t.color||e.Color.YELLOW,disableDepthTestDistance:Number.POSITIVE_INFINITY}});const b=this.baseCarto,E=e.Cartographic.fromCartesian(v),M=Math.abs((E.height||0)-(b.height||0)),P=new e.Cartesian3((this.positions[0].x+v.x)/2,(this.positions[0].y+v.y)/2,(this.positions[0].z+v.z)/2),L=e.Cartographic.fromCartesian(P),I=this.previewLabelId||"measure_vertical_preview";this.previewLabelId=I,this.htmlLabelPool.add({text:`${M.toFixed(2)} m`},{id:I,lon:e.Math.toDegrees(L.longitude),lat:e.Math.toDegrees(L.latitude),height:L.height||0,theme:"measure-vertical",show:!0,style:{pointerEvents:"none",userSelect:"none",cursor:"default"}})},e.ScreenSpaceEventType.MOUSE_MOVE)}stop(){this.handler&&(this.handler.destroy(),this.handler=null)}clear(){this.stop(),this.entity&&(this.viewer.entities.remove(this.entity),this.entity=null),this.labelEntity&&(this.viewer.entities.remove(this.labelEntity),this.labelEntity=null),this.tempPoints.forEach(t=>this.viewer.entities.remove(t)),this.tempPoints=[],this.previewPointEntity&&(this.viewer.entities.remove(this.previewPointEntity),this.previewPointEntity=null),this.previewEntity&&(this.viewer.entities.remove(this.previewEntity),this.previewEntity=null),this.htmlLabelPool&&this.htmlLabelId&&(this.htmlLabelPool.removeByIds([this.htmlLabelId]),this.htmlLabelId=null),this.previewLabelId&&this.htmlLabelPool&&(this.htmlLabelPool.removeByIds([this.previewLabelId]),this.previewLabelId=null),this.positions=[]}rehydrate(t,e){var b,E;const i=this.Cesium,r=this.viewer,s=t.options||{},o=s.lineColor||s.color||i.Color.CYAN,n=((E=(b=s.dashLineColor||s.lineColor||s.color||i.Color.RED).withAlpha)==null?void 0:E.call(b,.9))||i.Color.RED,h=s.width||3,l=(t.positions||[]).map(M=>new i.Cartesian3(M[0],M[1],M[2]));if(l.length<2)return;if(!this.htmlLabelPool){const M=s.overlayContainerId||"html-label-container";this.htmlLabelPool=e||new W(i,r,M),this.htmlLabelPool.registerTheme("measure-vertical",{createElement:(P,L)=>{var I;P.innerHTML=String(((I=L==null?void 0:L.data)==null?void 0:I.text)||""),P.style.background="rgba(0,0,0,0.6)",P.style.color="#fff",P.style.font="14px sans-serif",P.style.padding="4px 6px",P.style.borderRadius="4px",P.style.whiteSpace="pre"},options:{offset:{x:0,y:-10}}})}const c=l[0],u=l[1],m=r.entities.add({position:c,point:{pixelSize:8,color:s.pointColor||s.color||i.Color.YELLOW,disableDepthTestDistance:Number.POSITIVE_INFINITY}}),g=r.entities.add({position:u,point:{pixelSize:8,color:s.pointColor||s.color||i.Color.YELLOW,disableDepthTestDistance:Number.POSITIVE_INFINITY}});this.tempPoints.push(m),this.tempPoints.push(g),this.entity=r.entities.add({polyline:{positions:[c,u],width:h,material:o,depthFailMaterial:new i.PolylineDashMaterialProperty({color:n,dashLength:12,dashPattern:255})}});const p=i.Cartographic.fromCartesian(c),f=i.Cartographic.fromCartesian(u),w=Math.abs((f.height||0)-(p.height||0)),y=new i.Cartesian3((c.x+u.x)/2,(c.y+u.y)/2,(c.z+u.z)/2),C=i.Cartographic.fromCartesian(y),v=t.id+"_label";this.htmlLabelId=v,this.htmlLabelPool.add({text:`${w.toFixed(2)} m`},{id:v,lon:i.Math.toDegrees(C.longitude),lat:i.Math.toDegrees(C.latitude),height:C.height||0,theme:"measure-vertical",show:!0,style:{pointerEvents:"none",userSelect:"none",cursor:"default"}})}}class Ye{constructor(t,e){d(this,"Cesium");d(this,"viewer");d(this,"handler",null);d(this,"positions",[]);d(this,"htmlLabelPool",null);d(this,"htmlLabelId",null);d(this,"segmentEntities",[]);d(this,"angleMarkerEntities",[]);d(this,"pointEntities",[]);d(this,"segmentLabelIds",[]);d(this,"angleLabelIds",[]);d(this,"previewLabelId",null);d(this,"previewSegmentEntities",[]);d(this,"previewAngleMarkerEntities",[]);d(this,"previewPointEntity",null);this.Cesium=t,this.viewer=e}start(t){this.clear();const e=this.Cesium,i=this.viewer;if(!this.htmlLabelPool){const r=t.overlayContainerId||"html-label-container";this.htmlLabelPool=new W(e,i,r),this.htmlLabelPool.registerTheme("measure-triangle",{createElement:(s,o)=>{var n;s.innerHTML=String(((n=o==null?void 0:o.data)==null?void 0:n.text)||""),s.style.background="rgba(0,0,0,0.6)",s.style.color="#fff",s.style.font="14px sans-serif",s.style.padding="4px 6px",s.style.borderRadius="4px",s.style.whiteSpace="pre"},options:{offset:{x:0,y:-10}}}),this.htmlLabelPool.registerTheme("measure-triangle-seg",{createElement:(s,o)=>{var n;s.innerHTML=String(((n=o==null?void 0:o.data)==null?void 0:n.text)||""),s.style.background="rgba(0,0,0,0.6)",s.style.color="#fff",s.style.font="14px sans-serif",s.style.padding="4px 6px",s.style.borderRadius="4px",s.style.whiteSpace="pre"},options:{offset:{x:0,y:-10}}}),this.htmlLabelPool.registerTheme("measure-triangle-angle",{createElement:(s,o)=>{var n;s.innerHTML=String(((n=o==null?void 0:o.data)==null?void 0:n.text)||""),s.style.background="rgba(0,0,0,0.6)",s.style.color="#fff",s.style.font="14px sans-serif",s.style.padding="4px 6px",s.style.borderRadius="4px",s.style.whiteSpace="pre"},options:{offset:{x:0,y:-10}}})}this.handler=new e.ScreenSpaceEventHandler(i.canvas),this.handler.setInputAction(r=>{var n,h,l;const s=i.scene.pickPosition(r.position);if(!s)return;this.positions.push(s);const o=i.entities.add({position:s,point:{pixelSize:8,color:t.pointColor||t.color||e.Color.YELLOW,disableDepthTestDistance:Number.POSITIVE_INFINITY}});if(this.pointEntities.push(o),this.positions.length===2){this.stop(),this.previewSegmentEntities.forEach(ie=>i.entities.remove(ie)),this.previewSegmentEntities=[],this.previewAngleMarkerEntities.forEach(ie=>i.entities.remove(ie)),this.previewAngleMarkerEntities=[],this.previewPointEntity&&(i.entities.remove(this.previewPointEntity),this.previewPointEntity=null);const c=e.Cartographic.fromCartesian(this.positions[0]),u=e.Cartographic.fromCartesian(this.positions[1]),m=c.height||0,g=u.height||0,p=m<=g?this.positions[0]:this.positions[1],f=m>g?this.positions[0]:this.positions[1],w=e.Cartographic.fromCartesian(p);e.Cartographic.fromCartesian(f);const y=Math.max(m,g),C=e.Cartesian3.fromDegrees(e.Math.toDegrees(w.longitude),e.Math.toDegrees(w.latitude),y),v=t.lineColor||t.color||e.Color.YELLOW,b=((h=(n=t.dashLineColor||t.lineColor||t.color||e.Color.RED).withAlpha)==null?void 0:h.call(n,.9))||e.Color.RED,E=i.entities.add({polyline:{positions:[p,C],width:t.width||3,material:v,depthFailMaterial:new e.PolylineDashMaterialProperty({color:b,dashLength:12,dashPattern:255})}}),M=i.entities.add({polyline:{positions:[C,f],width:t.width||3,material:v,depthFailMaterial:new e.PolylineDashMaterialProperty({color:b,dashLength:12,dashPattern:255})}}),P=i.entities.add({polyline:{positions:[p,f],width:t.width||3,material:v,depthFailMaterial:new e.PolylineDashMaterialProperty({color:b,dashLength:12,dashPattern:255})}});this.segmentEntities.push(E,M,P);const L=e.Cartesian3.distance(p,C),I=e.Cartesian3.distance(C,f),x=e.Cartesian3.distance(p,f),A=new e.Cartesian3((p.x+C.x)/2,(p.y+C.y)/2,(p.z+C.z)/2),$=new e.Cartesian3((C.x+f.x)/2,(C.y+f.y)/2,(C.z+f.z)/2),R=new e.Cartesian3((p.x+f.x)/2,(p.y+f.y)/2,(p.z+f.z)/2),S=e.Cartographic.fromCartesian(A),_=e.Cartographic.fromCartesian($),F=e.Cartographic.fromCartesian(R),N="measure_triangle_seg_v",D="measure_triangle_seg_h",Y="measure_triangle_seg_hyp";this.segmentLabelIds=[N,D,Y],this.htmlLabelPool.add({text:`${L.toFixed(2)} m`},{id:N,lon:e.Math.toDegrees(S.longitude),lat:e.Math.toDegrees(S.latitude),height:S.height||0,theme:"measure-triangle-seg",show:!0,style:{pointerEvents:"none",userSelect:"none",cursor:"default"}}),this.htmlLabelPool.add({text:`${I.toFixed(2)} m`},{id:D,lon:e.Math.toDegrees(_.longitude),lat:e.Math.toDegrees(_.latitude),height:_.height||0,theme:"measure-triangle-seg",show:!0,style:{pointerEvents:"none",userSelect:"none",cursor:"default"}}),this.htmlLabelPool.add({text:`${x.toFixed(2)} m`},{id:Y,lon:e.Math.toDegrees(F.longitude),lat:e.Math.toDegrees(F.latitude),height:F.height||0,theme:"measure-triangle-seg",show:!0,style:{pointerEvents:"none",userSelect:"none",cursor:"default"}});const G=e.Cartesian3.subtract(f,p,new e.Cartesian3),X=e.Cartesian3.subtract(C,p,new e.Cartesian3),J=e.Cartesian3.subtract(C,f,new e.Cartesian3),k=e.Cartesian3.subtract(p,f,new e.Cartesian3),Q=e.Cartesian3.dot(G,X),V=Math.sqrt(e.Cartesian3.dot(G,G))*Math.sqrt(e.Cartesian3.dot(X,X)),z=e.Cartesian3.dot(J,k),U=Math.sqrt(e.Cartesian3.dot(J,J))*Math.sqrt(e.Cartesian3.dot(k,k)),H=Math.acos(Math.min(Math.max(Q/(V||1),-1),1)),ae=Math.acos(Math.min(Math.max(z/(U||1),-1),1)),se=e.Cartographic.fromCartesian(p),K=e.Cartographic.fromCartesian(f),oe="measure_triangle_angle_a",ce="measure_triangle_angle_b";this.angleLabelIds=[oe,ce],this.htmlLabelPool.add({text:`${(H*180/Math.PI).toFixed(2)}°`},{id:oe,lon:e.Math.toDegrees(se.longitude),lat:e.Math.toDegrees(se.latitude),height:se.height||0,theme:"measure-triangle-angle",show:!0,style:{pointerEvents:"none",userSelect:"none",cursor:"default"}}),this.htmlLabelPool.add({text:`${(ae*180/Math.PI).toFixed(2)}°`},{id:ce,lon:e.Math.toDegrees(K.longitude),lat:e.Math.toDegrees(K.latitude),height:K.height||0,theme:"measure-triangle-angle",show:!0,style:{pointerEvents:"none",userSelect:"none",cursor:"default"}});const ye=Math.max(.01,Math.min(.5,t.angleMarkerRatio??.2)),q=Math.min(L,I)*ye;if(L>.001&&I>.001){const ie=e.Cartesian3.normalize(e.Cartesian3.subtract(p,C,new e.Cartesian3),new e.Cartesian3),ue=e.Cartesian3.normalize(e.Cartesian3.subtract(f,C,new e.Cartesian3),new e.Cartesian3),re=new e.Cartesian3(C.x+ie.x*q,C.y+ie.y*q,C.z+ie.z*q),O=new e.Cartesian3(C.x+ue.x*q,C.y+ue.y*q,C.z+ue.z*q),te=new e.Cartesian3(C.x+ie.x*q+ue.x*q,C.y+ie.y*q+ue.y*q,C.z+ie.z*q+ue.z*q),le=i.entities.add({polyline:{positions:[re,te],width:t.width||3,material:v,depthFailMaterial:new e.PolylineDashMaterialProperty({color:b,dashLength:12,dashPattern:255})}}),Oe=i.entities.add({polyline:{positions:[O,te],width:t.width||3,material:v,depthFailMaterial:new e.PolylineDashMaterialProperty({color:b,dashLength:12,dashPattern:255})}});this.angleMarkerEntities.push(le,Oe)}this.previewLabelId&&this.htmlLabelPool&&(this.htmlLabelPool.removeByIds([this.previewLabelId]),this.previewLabelId=null);const ee={entity:this.segmentEntities,positions:[p,f,C],lengths:{vertical:L,horizontal:I,hypotenuse:x},angles:{acuteA:H,acuteB:ae},clear:()=>this.clear()};(l=t.onComplete)==null||l.call(t,ee)}},e.ScreenSpaceEventType.LEFT_CLICK),this.handler.setInputAction(r=>{var ae,se;if(this.positions.length!==1)return;const s=i.scene.pickPosition(r.endPosition);if(!s)return;const o=e.Cartographic.fromCartesian(this.positions[0]),n=e.Cartographic.fromCartesian(s),h=o.height||0,l=n.height||0,c=h<=l?this.positions[0]:s,u=h>l?this.positions[0]:s,m=e.Cartographic.fromCartesian(c),g=Math.max(h,l),p=e.Cartesian3.fromDegrees(this.Cesium.Math.toDegrees(m.longitude),this.Cesium.Math.toDegrees(m.latitude),g),f=t.lineColor||t.color||e.Color.YELLOW,w=((se=(ae=t.dashLineColor||t.lineColor||t.color||e.Color.RED).withAlpha)==null?void 0:se.call(ae,.9))||e.Color.RED;if(this.previewPointEntity?this.previewPointEntity.position=s:this.previewPointEntity=i.entities.add({position:s,point:{pixelSize:8,color:t.pointColor||t.color||e.Color.YELLOW,disableDepthTestDistance:Number.POSITIVE_INFINITY}}),this.previewSegmentEntities.length)this.previewSegmentEntities[0].polyline.positions=[c,p],this.previewSegmentEntities[1].polyline.positions=[p,u],this.previewSegmentEntities[2].polyline.positions=[c,u];else{const K=i.entities.add({polyline:{positions:[c,p],width:t.width||3,material:f,depthFailMaterial:new e.PolylineDashMaterialProperty({color:w,dashLength:12,dashPattern:255})}}),oe=i.entities.add({polyline:{positions:[p,u],width:t.width||3,material:f,depthFailMaterial:new e.PolylineDashMaterialProperty({color:w,dashLength:12,dashPattern:255})}}),ce=i.entities.add({polyline:{positions:[c,u],width:t.width||3,material:f,depthFailMaterial:new e.PolylineDashMaterialProperty({color:w,dashLength:12,dashPattern:255})}});this.previewSegmentEntities.push(K,oe,ce)}const y=e.Cartesian3.distance(c,p),C=e.Cartesian3.distance(p,u),v=e.Cartesian3.distance(c,u),b=e.Cartesian3.subtract(u,c,new e.Cartesian3),E=e.Cartesian3.subtract(p,c,new e.Cartesian3),M=e.Cartesian3.subtract(p,u,new e.Cartesian3),P=e.Cartesian3.subtract(c,u,new e.Cartesian3),L=e.Cartesian3.dot(b,E),I=Math.sqrt(e.Cartesian3.dot(b,b))*Math.sqrt(e.Cartesian3.dot(E,E)),x=e.Cartesian3.dot(M,P),A=Math.sqrt(e.Cartesian3.dot(M,M))*Math.sqrt(e.Cartesian3.dot(P,P)),$=Math.acos(Math.min(Math.max(L/(I||1),-1),1)),R=Math.acos(Math.min(Math.max(x/(A||1),-1),1)),S=new e.Cartesian3((c.x+p.x)/2,(c.y+p.y)/2,(c.z+p.z)/2),_=new e.Cartesian3((p.x+u.x)/2,(p.y+u.y)/2,(p.z+u.z)/2),F=new e.Cartesian3((c.x+u.x)/2,(c.y+u.y)/2,(c.z+u.z)/2),N=e.Cartographic.fromCartesian(S),D=e.Cartographic.fromCartesian(_),Y=e.Cartographic.fromCartesian(F),G=e.Cartographic.fromCartesian(c),X=e.Cartographic.fromCartesian(u),J="measure_triangle_seg_v",k="measure_triangle_seg_h",Q="measure_triangle_seg_hyp",V="measure_triangle_angle_a",z="measure_triangle_angle_b";this.segmentLabelIds.length===0&&(this.segmentLabelIds=[J,k,Q]),this.angleLabelIds.length===0&&(this.angleLabelIds=[V,z]),this.htmlLabelPool.add({text:`${y.toFixed(2)} m`},{id:J,lon:e.Math.toDegrees(N.longitude),lat:e.Math.toDegrees(N.latitude),height:N.height||0,theme:"measure-triangle-seg",show:!0,style:{pointerEvents:"none",userSelect:"none",cursor:"default"}}),this.htmlLabelPool.add({text:`${C.toFixed(2)} m`},{id:k,lon:e.Math.toDegrees(D.longitude),lat:e.Math.toDegrees(D.latitude),height:D.height||0,theme:"measure-triangle-seg",show:!0,style:{pointerEvents:"none",userSelect:"none",cursor:"default"}}),this.htmlLabelPool.add({text:`${v.toFixed(2)} m`},{id:Q,lon:e.Math.toDegrees(Y.longitude),lat:e.Math.toDegrees(Y.latitude),height:Y.height||0,theme:"measure-triangle-seg",show:!0,style:{pointerEvents:"none",userSelect:"none",cursor:"default"}}),this.htmlLabelPool.add({text:`${($*180/Math.PI).toFixed(2)}°`},{id:V,lon:e.Math.toDegrees(G.longitude),lat:e.Math.toDegrees(G.latitude),height:G.height||0,theme:"measure-triangle-angle",show:!0,style:{pointerEvents:"none",userSelect:"none",cursor:"default"}}),this.htmlLabelPool.add({text:`${(R*180/Math.PI).toFixed(2)}°`},{id:z,lon:e.Math.toDegrees(X.longitude),lat:e.Math.toDegrees(X.latitude),height:X.height||0,theme:"measure-triangle-angle",show:!0,style:{pointerEvents:"none",userSelect:"none",cursor:"default"}});const U=Math.max(.01,Math.min(.5,t.angleMarkerRatio??.2)),H=Math.min(y,C)*U;if(y>.001&&C>.001){const K=e.Cartesian3.normalize(e.Cartesian3.subtract(c,p,new e.Cartesian3),new e.Cartesian3),oe=e.Cartesian3.normalize(e.Cartesian3.subtract(u,p,new e.Cartesian3),new e.Cartesian3),ce=new e.Cartesian3(p.x+K.x*H,p.y+K.y*H,p.z+K.z*H),ye=new e.Cartesian3(p.x+oe.x*H,p.y+oe.y*H,p.z+oe.z*H),q=new e.Cartesian3(p.x+K.x*H+oe.x*H,p.y+K.y*H+oe.y*H,p.z+K.z*H+oe.z*H);if(this.previewAngleMarkerEntities.length)this.previewAngleMarkerEntities[0].polyline.positions=[ce,q],this.previewAngleMarkerEntities[1].polyline.positions=[ye,q];else{const ee=i.entities.add({polyline:{positions:[ce,q],width:t.width||3,material:f,depthFailMaterial:new e.PolylineDashMaterialProperty({color:w,dashLength:12,dashPattern:255})}}),ie=i.entities.add({polyline:{positions:[ye,q],width:t.width||3,material:f,depthFailMaterial:new e.PolylineDashMaterialProperty({color:w,dashLength:12,dashPattern:255})}});this.previewAngleMarkerEntities.push(ee,ie)}}},e.ScreenSpaceEventType.MOUSE_MOVE)}stop(){this.handler&&(this.handler.destroy(),this.handler=null)}clear(){this.stop(),this.segmentEntities.forEach(t=>this.viewer.entities.remove(t)),this.segmentEntities=[],this.angleMarkerEntities.forEach(t=>this.viewer.entities.remove(t)),this.angleMarkerEntities=[],this.pointEntities.forEach(t=>this.viewer.entities.remove(t)),this.pointEntities=[],this.previewSegmentEntities.forEach(t=>this.viewer.entities.remove(t)),this.previewSegmentEntities=[],this.previewAngleMarkerEntities.forEach(t=>this.viewer.entities.remove(t)),this.previewAngleMarkerEntities=[],this.previewPointEntity&&(this.viewer.entities.remove(this.previewPointEntity),this.previewPointEntity=null),this.htmlLabelPool&&this.htmlLabelId&&(this.htmlLabelPool.removeByIds([this.htmlLabelId]),this.htmlLabelId=null),this.previewLabelId&&this.htmlLabelPool&&(this.htmlLabelPool.removeByIds([this.previewLabelId]),this.previewLabelId=null),this.segmentLabelIds.length&&this.htmlLabelPool&&this.htmlLabelPool.removeByIds(this.segmentLabelIds.slice()),this.angleLabelIds.length&&this.htmlLabelPool&&this.htmlLabelPool.removeByIds(this.angleLabelIds.slice()),this.segmentLabelIds=[],this.angleLabelIds=[],this.positions=[]}rehydrate(t,e){var ie,ue;const i=this.Cesium,r=this.viewer,s=t.options||{},o=s.lineColor||s.color||i.Color.YELLOW,n=((ue=(ie=s.dashLineColor||s.lineColor||s.color||i.Color.RED).withAlpha)==null?void 0:ue.call(ie,.9))||i.Color.RED,h=s.width||3,l=(t.positions||[]).map(re=>new i.Cartesian3(re[0],re[1],re[2]));if(l.length<2)return;if(!this.htmlLabelPool){const re=s.overlayContainerId||"html-label-container";this.htmlLabelPool=e||new W(i,r,re),this.htmlLabelPool.registerTheme("measure-triangle",{createElement:(O,te)=>{var le;O.innerHTML=String(((le=te==null?void 0:te.data)==null?void 0:le.text)||""),O.style.background="rgba(0,0,0,0.6)",O.style.color="#fff",O.style.font="14px sans-serif",O.style.padding="4px 6px",O.style.borderRadius="4px",O.style.whiteSpace="pre"},options:{offset:{x:0,y:-10}}}),this.htmlLabelPool.registerTheme("measure-triangle-seg",{createElement:(O,te)=>{var le;O.innerHTML=String(((le=te==null?void 0:te.data)==null?void 0:le.text)||""),O.style.background="rgba(0,0,0,0.6)",O.style.color="#fff",O.style.font="14px sans-serif",O.style.padding="4px 6px",O.style.borderRadius="4px",O.style.whiteSpace="pre"},options:{offset:{x:0,y:-10}}}),this.htmlLabelPool.registerTheme("measure-triangle-angle",{createElement:(O,te)=>{var le;O.innerHTML=String(((le=te==null?void 0:te.data)==null?void 0:le.text)||""),O.style.background="rgba(0,0,0,0.6)",O.style.color="#fff",O.style.font="14px sans-serif",O.style.padding="4px 6px",O.style.borderRadius="4px",O.style.whiteSpace="pre"},options:{offset:{x:0,y:-10}}})}const c=i.Cartographic.fromCartesian(l[0]),u=i.Cartographic.fromCartesian(l[1]),m=c.height||0,g=u.height||0,p=m<=g?l[0]:l[1],f=m>g?l[0]:l[1],w=r.entities.add({position:p,point:{pixelSize:8,color:s.pointColor||s.color||i.Color.YELLOW,disableDepthTestDistance:Number.POSITIVE_INFINITY}}),y=r.entities.add({position:f,point:{pixelSize:8,color:s.pointColor||s.color||i.Color.YELLOW,disableDepthTestDistance:Number.POSITIVE_INFINITY}});this.pointEntities.push(w,y);const C=i.Cartographic.fromCartesian(p),v=Math.max(m,g),b=i.Cartesian3.fromDegrees(i.Math.toDegrees(C.longitude),i.Math.toDegrees(C.latitude),v),E=r.entities.add({polyline:{positions:[p,b],width:h,material:o,depthFailMaterial:new i.PolylineDashMaterialProperty({color:n,dashLength:12,dashPattern:255})}}),M=r.entities.add({polyline:{positions:[b,f],width:h,material:o,depthFailMaterial:new i.PolylineDashMaterialProperty({color:n,dashLength:12,dashPattern:255})}}),P=r.entities.add({polyline:{positions:[p,f],width:h,material:o,depthFailMaterial:new i.PolylineDashMaterialProperty({color:n,dashLength:12,dashPattern:255})}});this.segmentEntities.push(E,M,P);const L=i.Cartesian3.distance(p,b),I=i.Cartesian3.distance(b,f),x=i.Cartesian3.distance(p,f),A=new i.Cartesian3((p.x+b.x)/2,(p.y+b.y)/2,(p.z+b.z)/2),$=new i.Cartesian3((b.x+f.x)/2,(b.y+f.y)/2,(b.z+f.z)/2),R=new i.Cartesian3((p.x+f.x)/2,(p.y+f.y)/2,(p.z+f.z)/2),S=i.Cartographic.fromCartesian(A),_=i.Cartographic.fromCartesian($),F=i.Cartographic.fromCartesian(R),N=t.id+"_tri_v",D=t.id+"_tri_h",Y=t.id+"_tri_hyp";this.segmentLabelIds=[N,D,Y],this.htmlLabelPool.add({text:`${L.toFixed(2)} m`},{id:N,lon:i.Math.toDegrees(S.longitude),lat:i.Math.toDegrees(S.latitude),height:S.height||0,theme:"measure-triangle-seg",show:!0,style:{pointerEvents:"none",userSelect:"none",cursor:"default"}}),this.htmlLabelPool.add({text:`${I.toFixed(2)} m`},{id:D,lon:i.Math.toDegrees(_.longitude),lat:i.Math.toDegrees(_.latitude),height:_.height||0,theme:"measure-triangle-seg",show:!0,style:{pointerEvents:"none",userSelect:"none",cursor:"default"}}),this.htmlLabelPool.add({text:`${x.toFixed(2)} m`},{id:Y,lon:i.Math.toDegrees(F.longitude),lat:i.Math.toDegrees(F.latitude),height:F.height||0,theme:"measure-triangle-seg",show:!0,style:{pointerEvents:"none",userSelect:"none",cursor:"default"}});const G=i.Cartesian3.subtract(f,p,new i.Cartesian3),X=i.Cartesian3.subtract(b,p,new i.Cartesian3),J=i.Cartesian3.subtract(b,f,new i.Cartesian3),k=i.Cartesian3.subtract(p,f,new i.Cartesian3),Q=i.Cartesian3.dot(G,X),V=Math.sqrt(i.Cartesian3.dot(G,G))*Math.sqrt(i.Cartesian3.dot(X,X)),z=i.Cartesian3.dot(J,k),U=Math.sqrt(i.Cartesian3.dot(J,J))*Math.sqrt(i.Cartesian3.dot(k,k)),H=Math.acos(Math.min(Math.max(Q/(V||1),-1),1)),ae=Math.acos(Math.min(Math.max(z/(U||1),-1),1)),se=i.Cartographic.fromCartesian(p),K=i.Cartographic.fromCartesian(f),oe=s.labelText||{angle:"角度"},ce=t.id+"_tri_angA",ye=t.id+"_tri_angB";this.angleLabelIds=[ce,ye],this.htmlLabelPool.add({text:`${oe.angle}:${(H*180/Math.PI).toFixed(2)}°`},{id:ce,lon:i.Math.toDegrees(se.longitude),lat:i.Math.toDegrees(se.latitude),height:se.height||0,theme:"measure-triangle-angle",show:!0,style:{pointerEvents:"none",userSelect:"none",cursor:"default"}}),this.htmlLabelPool.add({text:`${oe.angle}:${(ae*180/Math.PI).toFixed(2)}°`},{id:ye,lon:i.Math.toDegrees(K.longitude),lat:i.Math.toDegrees(K.latitude),height:K.height||0,theme:"measure-triangle-angle",show:!0,style:{pointerEvents:"none",userSelect:"none",cursor:"default"}});const q=Math.max(.01,Math.min(.5,s.angleMarkerRatio??.2)),ee=Math.min(L,I)*q;if(L>.001&&I>.001){const re=i.Cartesian3.normalize(i.Cartesian3.subtract(p,b,new i.Cartesian3),new i.Cartesian3),O=i.Cartesian3.normalize(i.Cartesian3.subtract(f,b,new i.Cartesian3),new i.Cartesian3),te=new i.Cartesian3(b.x+re.x*ee,b.y+re.y*ee,b.z+re.z*ee),le=new i.Cartesian3(b.x+O.x*ee,b.y+O.y*ee,b.z+O.z*ee),Oe=new i.Cartesian3(b.x+re.x*ee+O.x*ee,b.y+re.y*ee+O.y*ee,b.z+re.z*ee+O.z*ee),Ar=r.entities.add({polyline:{positions:[te,Oe],width:h,material:o,depthFailMaterial:new i.PolylineDashMaterialProperty({color:n,dashLength:12,dashPattern:255})}}),$r=r.entities.add({polyline:{positions:[le,Oe],width:h,material:o,depthFailMaterial:new i.PolylineDashMaterialProperty({color:n,dashLength:12,dashPattern:255})}});this.angleMarkerEntities.push(Ar,$r)}}}class Ue{constructor(t,e){d(this,"Cesium");d(this,"viewer");d(this,"handler",null);d(this,"entity",null);d(this,"labelEntity",null);d(this,"positions",[]);d(this,"tempPoints",[]);d(this,"htmlLabelPool",null);d(this,"htmlLabelId",null);d(this,"previewEntity",null);d(this,"previewLabelId",null);this.Cesium=t,this.viewer=e}start(t){this.clear();const e=this.Cesium,i=this.viewer;if(!this.htmlLabelPool){const r=t.overlayContainerId||"html-label-container";this.htmlLabelPool=new W(e,i,r),this.htmlLabelPool.registerTheme("measure-space",{createElement:(s,o)=>{var n;s.innerHTML=String(((n=o==null?void 0:o.data)==null?void 0:n.text)||""),s.style.background="rgba(0,0,0,0.6)",s.style.color="#fff",s.style.font="14px sans-serif",s.style.padding="4px 6px",s.style.borderRadius="4px",s.style.whiteSpace="pre"},options:{offset:{x:0,y:-10}}})}this.handler=new e.ScreenSpaceEventHandler(i.canvas),this.handler.setInputAction(r=>{var n,h,l;const s=i.scene.pickPosition(r.position);if(!s)return;this.positions.push(s);const o=i.entities.add({position:s,point:{pixelSize:8,color:t.pointColor||t.color||e.Color.YELLOW,disableDepthTestDistance:Number.POSITIVE_INFINITY}});if(this.tempPoints.push(o),this.positions.length===2){this.stop(),this.previewEntity&&(this.viewer.entities.remove(this.previewEntity),this.previewEntity=null),this.previewLabelId&&this.htmlLabelPool&&(this.htmlLabelPool.removeByIds([this.previewLabelId]),this.previewLabelId=null);const c=this.positions[0],u=this.positions[1],m=t.lineColor||t.color||e.Color.YELLOW,g=((h=(n=t.dashLineColor||t.lineColor||t.color||e.Color.RED).withAlpha)==null?void 0:h.call(n,.9))||e.Color.RED;this.entity=i.entities.add({polyline:{positions:[c,u],width:t.width||3,material:m,depthFailMaterial:new e.PolylineDashMaterialProperty({color:g,dashLength:12,dashPattern:255})}});const p=e.Cartesian3.distance(c,u),f=u,w=e.Cartographic.fromCartesian(f),y=this.htmlLabelId||`measure_space_${Date.now()}`;this.htmlLabelId=y,this.htmlLabelPool.add({text:`${p.toFixed(2)} m`},{id:y,lon:e.Math.toDegrees(w.longitude),lat:e.Math.toDegrees(w.latitude),height:w.height||0,theme:"measure-space",show:!0,style:{pointerEvents:"none",userSelect:"none",cursor:"default"}});const C={entity:this.entity,label:this.labelEntity,positions:this.positions,distance:p,clear:()=>this.clear()};(l=t.onComplete)==null||l.call(t,C)}},e.ScreenSpaceEventType.LEFT_CLICK),this.handler.setInputAction(r=>{var g,p;if(this.positions.length!==1)return;const s=i.scene.pickPosition(r.endPosition);if(!s)return;const o=this.positions[0],n=e.Cartesian3.distance(o,s),h=new e.Cartesian3((o.x+s.x)/2,(o.y+s.y)/2,(o.z+s.z)/2),l=e.Cartographic.fromCartesian(h),c=this.previewLabelId||"measure_space_preview";this.previewLabelId=c,this.htmlLabelPool.add({text:`${n.toFixed(2)} m`},{id:c,lon:e.Math.toDegrees(l.longitude),lat:e.Math.toDegrees(l.latitude),height:l.height||0,theme:"measure-space",show:!0,style:{pointerEvents:"none",userSelect:"none",cursor:"default"}});const u=t.lineColor||t.color||e.Color.YELLOW,m=((p=(g=t.dashLineColor||t.lineColor||t.color||e.Color.RED).withAlpha)==null?void 0:p.call(g,.9))||e.Color.RED;this.previewEntity?this.previewEntity.polyline.positions=[o,s]:this.previewEntity=i.entities.add({polyline:{positions:[o,s],width:t.width||3,material:u,depthFailMaterial:new e.PolylineDashMaterialProperty({color:m,dashLength:12,dashPattern:255})}})},e.ScreenSpaceEventType.MOUSE_MOVE)}stop(){this.handler&&(this.handler.destroy(),this.handler=null)}clear(){this.stop(),this.entity&&(this.viewer.entities.remove(this.entity),this.entity=null),this.labelEntity&&(this.viewer.entities.remove(this.labelEntity),this.labelEntity=null),this.htmlLabelPool&&this.htmlLabelId&&(this.htmlLabelPool.removeByIds([this.htmlLabelId]),this.htmlLabelId=null),this.previewEntity&&(this.viewer.entities.remove(this.previewEntity),this.previewEntity=null),this.previewLabelId&&this.htmlLabelPool&&(this.htmlLabelPool.removeByIds([this.previewLabelId]),this.previewLabelId=null),this.tempPoints.forEach(t=>this.viewer.entities.remove(t)),this.tempPoints=[],this.positions=[]}rehydrate(t,e){var c,u;const i=this.Cesium,r=this.viewer,s=t.options||{},o=s.lineColor||s.color||i.Color.YELLOW,n=((u=(c=s.dashLineColor||s.lineColor||s.color||i.Color.RED).withAlpha)==null?void 0:u.call(c,.9))||i.Color.RED,h=s.width||3,l=(t.positions||[]).map(m=>new i.Cartesian3(m[0],m[1],m[2]));if(l.length){if(!this.htmlLabelPool){const m=s.overlayContainerId||"html-label-container";this.htmlLabelPool=e||new W(i,r,m),this.htmlLabelPool.registerTheme("measure-space",{createElement:(g,p)=>{var f;g.innerHTML=String(((f=p==null?void 0:p.data)==null?void 0:f.text)||""),g.style.background="rgba(0,0,0,0.6)",g.style.color="#fff",g.style.font="14px sans-serif",g.style.padding="4px 6px",g.style.borderRadius="4px",g.style.whiteSpace="pre"},options:{offset:{x:0,y:-10}}})}if(l.length>=1){const m=r.entities.add({position:l[0],point:{pixelSize:8,color:s.pointColor||s.color||i.Color.YELLOW,disableDepthTestDistance:Number.POSITIVE_INFINITY}});this.tempPoints.push(m)}if(l.length>=2){const m=r.entities.add({position:l[1],point:{pixelSize:8,color:s.pointColor||s.color||i.Color.YELLOW,disableDepthTestDistance:Number.POSITIVE_INFINITY}});this.tempPoints.push(m),this.entity=r.entities.add({polyline:{positions:[l[0],l[1]],width:h,material:o,depthFailMaterial:new i.PolylineDashMaterialProperty({color:n,dashLength:12,dashPattern:255})}});const g=i.Cartesian3.distance(l[0],l[1]),p=i.Cartographic.fromCartesian(l[1]),f=t.id+"_label";this.htmlLabelId=f,this.htmlLabelPool.add({text:`${g.toFixed(2)} m`},{id:f,lon:i.Math.toDegrees(p.longitude),lat:i.Math.toDegrees(p.latitude),height:p.height||0,theme:"measure-space",show:!0,style:{pointerEvents:"none",userSelect:"none",cursor:"default"}})}}}}class Ke{constructor(t,e){d(this,"Cesium");d(this,"viewer");d(this,"handler",null);d(this,"entity",null);d(this,"labelEntity",null);d(this,"positions",[]);d(this,"tempPoints",[]);d(this,"primitive",null);d(this,"previewPrimitive",null);d(this,"htmlLabelPool",null);d(this,"htmlLabelId",null);d(this,"previewLabelId",null);d(this,"segmentLabelIds",[]);d(this,"angleLabelIds",[]);this.Cesium=t,this.viewer=e}start(t){this.clear();const e=this.Cesium,i=this.viewer;if(!this.htmlLabelPool){const r=t.overlayContainerId||"html-label-container";this.htmlLabelPool=new W(e,i,r),this.htmlLabelPool.registerTheme("measure-area",{createElement:(s,o)=>{var n;s.innerHTML=String(((n=o==null?void 0:o.data)==null?void 0:n.text)||""),s.style.background="rgba(0,0,0,0.6)",s.style.color="#fff",s.style.font="14px sans-serif",s.style.padding="4px 6px",s.style.borderRadius="4px",s.style.whiteSpace="pre"},options:{offset:{x:0,y:-10}}}),this.htmlLabelPool.registerTheme("measure-area-seg",{createElement:(s,o)=>{var n;s.innerHTML=String(((n=o==null?void 0:o.data)==null?void 0:n.text)||""),s.style.background="rgba(0,0,0,0.6)",s.style.color="#fff",s.style.font="14px sans-serif",s.style.padding="4px 6px",s.style.borderRadius="4px",s.style.whiteSpace="pre"},options:{offset:{x:0,y:-10}}}),this.htmlLabelPool.registerTheme("measure-area-angle",{createElement:(s,o)=>{var n;s.innerHTML=String(((n=o==null?void 0:o.data)==null?void 0:n.text)||""),s.style.background="rgba(0,0,0,0.6)",s.style.color="#fff",s.style.font="14px sans-serif",s.style.padding="4px 6px",s.style.borderRadius="4px",s.style.whiteSpace="pre"},options:{offset:{x:0,y:-10}}})}this.handler=new e.ScreenSpaceEventHandler(i.canvas),this.handler.setInputAction(r=>{const s=i.scene.pickPosition(r.position);if(!s)return;this.positions.push(s);const o=i.entities.add({position:s,point:{pixelSize:8,color:t.color||e.Color.YELLOW,disableDepthTestDistance:Number.POSITIVE_INFINITY}});this.tempPoints.push(o),this.primitive&&(i.scene.primitives.remove(this.primitive),this.primitive=null);const n=new e.PolygonHierarchy(this.positions.slice()),h=new e.PolygonGeometry({polygonHierarchy:n,vertexFormat:e.MaterialAppearance.VERTEX_FORMAT,perPositionHeight:!0}),l=new e.GeometryInstance({geometry:h}),c=t.color||e.Color.YELLOW.withAlpha(.4),u=t.color&&t.color.withAlpha?t.color.withAlpha(.25):e.Color.RED.withAlpha(.4);this.primitive=new e.Primitive({geometryInstances:l,appearance:new e.MaterialAppearance({material:e.Material.fromType("Color",{color:c}),translucent:!0,closed:!0}),depthFailAppearance:new e.MaterialAppearance({material:e.Material.fromType("Color",{color:u}),translucent:!0,closed:!0})}),i.scene.primitives.add(this.primitive)},e.ScreenSpaceEventType.LEFT_CLICK),this.handler.setInputAction(r=>{if(this.positions.length===0)return;const s=i.scene.pickPosition(r.endPosition);if(!s)return;const o=this.positions.concat([s]),n=new e.Cartesian3(o.reduce((v,b)=>v+b.x,0)/o.length,o.reduce((v,b)=>v+b.y,0)/o.length,o.reduce((v,b)=>v+b.z,0)/o.length),l=new e.EllipsoidTangentPlane(n,e.Ellipsoid.WGS84).projectPointsOntoPlane(o);let c=0;for(let v=0;v<l.length;v++){const b=(v+1)%l.length;c+=l[v].x*l[b].y-l[b].x*l[v].y}c=Math.abs(c)/2;const u=e.Cartographic.fromCartesian(n),m=this.previewLabelId||"measure_area_preview";this.previewLabelId=m;const g=t.labelText||{area:"面积"};this.htmlLabelPool.add({text:`${g.area}:${c.toFixed(2)} m²`},{id:m,lon:e.Math.toDegrees(u.longitude),lat:e.Math.toDegrees(u.latitude),height:u.height||0,theme:"measure-area",show:!0}),this.previewPrimitive&&(i.scene.primitives.remove(this.previewPrimitive),this.previewPrimitive=null);const p=new e.PolygonHierarchy(o),f=new e.PolygonGeometry({polygonHierarchy:p,vertexFormat:e.MaterialAppearance.VERTEX_FORMAT,perPositionHeight:!0}),w=new e.GeometryInstance({geometry:f}),y=t.color||e.Color.YELLOW.withAlpha(.4),C=t.color&&t.color.withAlpha?t.color.withAlpha(.25):e.Color.RED.withAlpha(.4);this.previewPrimitive=new e.Primitive({geometryInstances:w,appearance:new e.MaterialAppearance({material:e.Material.fromType("Color",{color:y}),translucent:!0,closed:!0}),depthFailAppearance:new e.MaterialAppearance({material:e.Material.fromType("Color",{color:C}),translucent:!0,closed:!0})}),i.scene.primitives.add(this.previewPrimitive)},e.ScreenSpaceEventType.MOUSE_MOVE),this.handler.setInputAction(()=>{var g;if(this.positions.length<3){this.stop();return}if(this.positions.length>=3){this.positions.pop();const p=this.tempPoints.pop();p&&this.viewer.entities.remove(p)}this.stop();const r=new e.Cartesian3(this.positions.reduce((p,f)=>p+f.x,0)/this.positions.length,this.positions.reduce((p,f)=>p+f.y,0)/this.positions.length,this.positions.reduce((p,f)=>p+f.z,0)/this.positions.length),o=new e.EllipsoidTangentPlane(r,e.Ellipsoid.WGS84).projectPointsOntoPlane(this.positions);let n=0;for(let p=0;p<o.length;p++){const f=(p+1)%o.length;n+=o[p].x*o[f].y-o[f].x*o[p].y}n=Math.abs(n)/2;const h=e.Cartographic.fromCartesian(r),l=this.htmlLabelId||`measure_area_${Date.now()}`;this.htmlLabelId=l;const c=t.labelText||{area:"面积",side:"边长",angle:"角度"};this.previewLabelId&&this.htmlLabelPool&&(this.htmlLabelPool.removeByIds([this.previewLabelId]),this.previewLabelId=null),this.htmlLabelPool.add({text:`${c.area}:${n.toFixed(2)} m²`},{id:l,lon:e.Math.toDegrees(h.longitude),lat:e.Math.toDegrees(h.latitude),height:h.height||0,theme:"measure-area",show:!0}),this.labelEntity=this.htmlLabelId;for(let p=0;p<this.positions.length;p++){const f=(p+1)%this.positions.length,w=this.positions[p],y=this.positions[f],C=e.Cartographic.fromCartesian(w),v=e.Cartographic.fromCartesian(y),E=new e.EllipsoidGeodesic(C,v).surfaceDistance,M=new e.Cartesian3((w.x+y.x)/2,(w.y+y.y)/2,(w.z+y.z)/2),P=e.Cartographic.fromCartesian(M),L=`measure_area_seg_${Date.now()}_${p}`;this.segmentLabelIds.push(L),this.htmlLabelPool.add({text:`${c.side}:${E.toFixed(2)} m`},{id:L,lon:e.Math.toDegrees(P.longitude),lat:e.Math.toDegrees(P.latitude),height:P.height||0,theme:"measure-area-seg",show:!0})}const u=o;for(let p=0;p<u.length;p++){const f=u[(p-1+u.length)%u.length],w=u[p],y=u[(p+1)%u.length],C=f.x-w.x,v=f.y-w.y,b=y.x-w.x,E=y.y-w.y,M=Math.sqrt(C*C+v*v),P=Math.sqrt(b*b+E*E);if(!M||!P)continue;const L=C/M*(b/P)+v/M*(E/P),I=Math.acos(Math.min(1,Math.max(-1,L)))*(180/Math.PI),x=e.Cartographic.fromCartesian(this.positions[p]),A=`measure_area_angle_${Date.now()}_${p}`;this.angleLabelIds.push(A),this.htmlLabelPool.add({text:`${c.angle}:${I.toFixed(2)} °`},{id:A,lon:e.Math.toDegrees(x.longitude),lat:e.Math.toDegrees(x.latitude),height:x.height||0,theme:"measure-area-angle",show:!0})}const m={entity:this.primitive,label:this.labelEntity,positions:this.positions,area:n,clear:()=>this.clear()};(g=t.onComplete)==null||g.call(t,m)},e.ScreenSpaceEventType.LEFT_DOUBLE_CLICK)}stop(){this.handler&&(this.handler.destroy(),this.handler=null)}clear(){this.stop(),this.entity&&(this.viewer.entities.remove(this.entity),this.entity=null),this.primitive&&(this.viewer.scene.primitives.remove(this.primitive),this.primitive=null),this.previewPrimitive&&(this.viewer.scene.primitives.remove(this.previewPrimitive),this.previewPrimitive=null),this.labelEntity&&(this.viewer.entities.remove(this.labelEntity),this.labelEntity=null),this.htmlLabelPool&&this.htmlLabelId&&(this.htmlLabelPool.removeByIds([this.htmlLabelId]),this.htmlLabelId=null),this.previewLabelId&&this.htmlLabelPool&&(this.htmlLabelPool.removeByIds([this.previewLabelId]),this.previewLabelId=null),this.segmentLabelIds.length&&this.htmlLabelPool&&this.htmlLabelPool.removeByIds(this.segmentLabelIds.slice()),this.angleLabelIds.length&&this.htmlLabelPool&&this.htmlLabelPool.removeByIds(this.angleLabelIds.slice()),this.segmentLabelIds=[],this.angleLabelIds=[],this.tempPoints.forEach(t=>this.viewer.entities.remove(t)),this.tempPoints=[],this.positions=[]}rehydrate(t,e){const i=this.Cesium,r=this.viewer,s=t.options||{},o=(t.positions||[]).map(E=>new i.Cartesian3(E[0],E[1],E[2]));if(o.length<3)return;if(!this.htmlLabelPool){const E=s.overlayContainerId||"html-label-container";this.htmlLabelPool=e||new W(i,r,E),this.htmlLabelPool.registerTheme("measure-area",{createElement:(M,P)=>{var L;M.innerHTML=String(((L=P==null?void 0:P.data)==null?void 0:L.text)||""),M.style.background="rgba(0,0,0,0.6)",M.style.color="#fff",M.style.font="14px sans-serif",M.style.padding="4px 6px",M.style.borderRadius="4px",M.style.whiteSpace="pre"},options:{offset:{x:0,y:-10}}}),this.htmlLabelPool.registerTheme("measure-area-seg",{createElement:(M,P)=>{var L;M.innerHTML=String(((L=P==null?void 0:P.data)==null?void 0:L.text)||""),M.style.background="rgba(0,0,0,0.6)",M.style.color="#fff",M.style.font="14px sans-serif",M.style.padding="4px 6px",M.style.borderRadius="4px",M.style.whiteSpace="pre"},options:{offset:{x:0,y:-10}}}),this.htmlLabelPool.registerTheme("measure-area-angle",{createElement:(M,P)=>{var L;M.innerHTML=String(((L=P==null?void 0:P.data)==null?void 0:L.text)||""),M.style.background="rgba(0,0,0,0.6)",M.style.color="#fff",M.style.font="14px sans-serif",M.style.padding="4px 6px",M.style.borderRadius="4px",M.style.whiteSpace="pre"},options:{offset:{x:0,y:-10}}})}for(const E of o){const M=r.entities.add({position:E,point:{pixelSize:8,color:s.color||i.Color.YELLOW,disableDepthTestDistance:Number.POSITIVE_INFINITY}});this.tempPoints.push(M)}const n=new i.Cartesian3(o.reduce((E,M)=>E+M.x,0)/o.length,o.reduce((E,M)=>E+M.y,0)/o.length,o.reduce((E,M)=>E+M.z,0)/o.length),l=new i.EllipsoidTangentPlane(n,i.Ellipsoid.WGS84).projectPointsOntoPlane(o);let c=0;for(let E=0;E<l.length;E++){const M=(E+1)%l.length;c+=l[E].x*l[M].y-l[M].x*l[E].y}c=Math.abs(c)/2;const u=i.Cartographic.fromCartesian(n),m=t.id+"_area";this.htmlLabelId=m;const g=s.labelText||{area:"面积",side:"边长",angle:"角度"};this.htmlLabelPool.add({text:`${g.area}:${c.toFixed(2)} m²`},{id:m,lon:i.Math.toDegrees(u.longitude),lat:i.Math.toDegrees(u.latitude),height:u.height||0,theme:"measure-area",show:!0});const p=new i.PolygonHierarchy(o),f=new i.PolygonGeometry({polygonHierarchy:p,vertexFormat:i.MaterialAppearance.VERTEX_FORMAT,perPositionHeight:!0}),w=new i.GeometryInstance({geometry:f}),y=s.color||i.Color.YELLOW.withAlpha(.4),C=s.color&&s.color.withAlpha?s.color.withAlpha(.25):i.Color.RED.withAlpha(.4),v=new i.Primitive({geometryInstances:w,appearance:new i.MaterialAppearance({material:i.Material.fromType("Color",{color:y}),translucent:!0,closed:!0}),depthFailAppearance:new i.MaterialAppearance({material:i.Material.fromType("Color",{color:C}),translucent:!0,closed:!0})});r.scene.primitives.add(v),this.primitive=v;for(let E=0;E<o.length;E++){const M=(E+1)%o.length,P=o[E],L=o[M],I=i.Cartographic.fromCartesian(P),x=i.Cartographic.fromCartesian(L),$=new i.EllipsoidGeodesic(I,x).surfaceDistance,R=new i.Cartesian3((P.x+L.x)/2,(P.y+L.y)/2,(P.z+L.z)/2),S=i.Cartographic.fromCartesian(R),_=t.id+`_area_seg_${E}`;this.segmentLabelIds.push(_),this.htmlLabelPool.add({text:`${g.side}:${$.toFixed(2)} m`},{id:_,lon:i.Math.toDegrees(S.longitude),lat:i.Math.toDegrees(S.latitude),height:S.height||0,theme:"measure-area-seg",show:!0})}const b=l;for(let E=0;E<b.length;E++){const M=b[(E-1+b.length)%b.length],P=b[E],L=b[(E+1)%b.length],I=M.x-P.x,x=M.y-P.y,A=L.x-P.x,$=L.y-P.y,R=Math.sqrt(I*I+x*x),S=Math.sqrt(A*A+$*$);if(!R||!S)continue;const _=I/R*(A/S)+x/R*($/S),F=Math.acos(Math.min(1,Math.max(-1,_)))*(180/Math.PI),N=i.Cartographic.fromCartesian(o[E]),D=t.id+`_area_angle_${E}`;this.angleLabelIds.push(D),this.htmlLabelPool.add({text:`${g.angle}:${F.toFixed(2)} °`},{id:D,lon:i.Math.toDegrees(N.longitude),lat:i.Math.toDegrees(N.latitude),height:N.height||0,theme:"measure-area-angle",show:!0})}}}class qe{constructor(t,e){d(this,"Cesium");d(this,"viewer");d(this,"handler",null);d(this,"entity",null);d(this,"positions",[]);d(this,"currentRadius",0);d(this,"labelEntity",null);d(this,"previewLabel",null);d(this,"ellipsePrimitive",null);d(this,"isPrimitive",!1);d(this,"htmlLabelPool",null);d(this,"htmlLabelId",null);this.Cesium=t,this.viewer=e}start(t){this.clear();const e=this.Cesium,i=this.viewer;if(!this.htmlLabelPool){const r=t.overlayContainerId||"html-label-container";this.htmlLabelPool=new W(e,i,r),this.htmlLabelPool.registerTheme("measure-circle",{createElement:(s,o)=>{var h;const n=((h=o==null?void 0:o.data)==null?void 0:h.text)||"";s.innerHTML=String(n),s.style.background="rgba(0,0,0,0.6)",s.style.color="#fff",s.style.font="14px sans-serif",s.style.padding="4px 6px",s.style.borderRadius="4px",s.style.whiteSpace="pre"},options:{offset:{x:0,y:-10}}})}this.handler=new e.ScreenSpaceEventHandler(i.canvas),this.handler.setInputAction(r=>{var o;const s=i.scene.pickPosition(r.position);if(s&&(this.positions.push(s),this.positions.length===2)){this.stop();const n=this.positions[0],h=this.positions[1],l=e.Cartesian3.distance(n,h),c=Math.PI*l*l,u=2*Math.PI*l,m=t.labelText||{radius:"半径",area:"面积",circumference:"周长"},g=n;this.labelEntity?(this.labelEntity.position=g,this.labelEntity.label.text=`${m.radius}:${l.toFixed(2)} m
|
|
44
|
-
${m.area}:${c.toFixed(2)} m²
|
|
45
|
-
${m.circumference}:${u.toFixed(2)} m`):this.labelEntity=i.entities.add({position:g,label:{text:`${m.radius}:${l.toFixed(2)} m
|
|
46
|
-
${m.area}:${c.toFixed(2)} m²
|
|
47
|
-
${m.circumference}:${u.toFixed(2)} m`,font:"14px sans-serif",fillColor:e.Color.WHITE,outlineColor:e.Color.BLACK,outlineWidth:2,style:e.LabelStyle.FILL_AND_OUTLINE,verticalOrigin:e.VerticalOrigin.BOTTOM,pixelOffset:new e.Cartesian2(0,-10),disableDepthTestDistance:Number.POSITIVE_INFINITY,eyeOffset:new e.Cartesian3(0,0,-1e3),showBackground:!0,backgroundColor:e.Color.BLACK.withAlpha(.6),show:!1}});const p=e.Cartographic.fromCartesian(n),f=e.Math.toDegrees(p.longitude),w=e.Math.toDegrees(p.latitude),y=p.height||0,C=this.htmlLabelId||`measure_circle_${Date.now()}`;this.htmlLabelId=C;const v=`${m.radius}:${l.toFixed(2)} m
|
|
48
|
-
${m.area}:${c.toFixed(2)} m²
|
|
49
|
-
${m.circumference}:${u.toFixed(2)} m`;this.htmlLabelPool.add({text:v},{id:C,lon:f,lat:w,height:y,theme:"measure-circle",show:!0});const b={entity:this.entity,label:this.labelEntity,positions:this.positions,radius:l,area:c,perimeter:u,clear:()=>this.clear()};(o=t.onComplete)==null||o.call(t,b)}},e.ScreenSpaceEventType.LEFT_CLICK),this.handler.setInputAction(r=>{if(this.positions.length!==1)return;const s=this.positions[0],o=i.camera.getPickRay(r.endPosition),n=i.scene.globe.pick(o,i.scene);if(!n)return;const h=e.Cartesian3.distance(s,n);this.currentRadius=h;const l=e.Cartographic.fromCartesian(s),c=new e.EllipseGeometry({center:s,semiMajorAxis:h,semiMinorAxis:h,height:l.height||0,vertexFormat:e.MaterialAppearance.VERTEX_FORMAT}),u=new e.GeometryInstance({geometry:c}),m=t.color||e.Color.YELLOW.withAlpha(.5),g=t.color&&t.color.withAlpha?t.color.withAlpha(.25):e.Color.RED.withAlpha(.4);this.ellipsePrimitive&&(i.scene.primitives.remove(this.ellipsePrimitive),this.ellipsePrimitive=null),this.ellipsePrimitive=new e.Primitive({geometryInstances:u,appearance:new e.MaterialAppearance({material:e.Material.fromType("Color",{color:m}),translucent:!0,closed:!0}),depthFailAppearance:new e.MaterialAppearance({material:e.Material.fromType("Color",{color:g}),translucent:!0,closed:!0})}),i.scene.primitives.add(this.ellipsePrimitive),this.entity=this.ellipsePrimitive,this.isPrimitive=!0;const p=Math.PI*h*h,f=2*Math.PI*h,w=t.labelText||{radius:"半径",area:"面积",circumference:"周长"},y=s;this.labelEntity?(this.labelEntity.position=y,this.labelEntity.label.text=`${w.radius}:${h.toFixed(2)} m
|
|
50
|
-
${w.area}:${p.toFixed(2)} m²
|
|
51
|
-
${w.circumference}:${f.toFixed(2)} m`):this.labelEntity=i.entities.add({position:y,label:{text:`${w.radius}:${h.toFixed(2)} m
|
|
52
|
-
${w.area}:${p.toFixed(2)} m²
|
|
53
|
-
${w.circumference}:${f.toFixed(2)} m`,font:"14px sans-serif",fillColor:e.Color.WHITE,outlineColor:e.Color.BLACK,outlineWidth:2,style:e.LabelStyle.FILL_AND_OUTLINE,verticalOrigin:e.VerticalOrigin.BOTTOM,pixelOffset:new e.Cartesian2(0,-10),disableDepthTestDistance:Number.POSITIVE_INFINITY,eyeOffset:new e.Cartesian3(0,0,-1e3),showBackground:!0,backgroundColor:e.Color.BLACK.withAlpha(.6),show:!1}});const C=e.Cartographic.fromCartesian(s),v=e.Math.toDegrees(C.longitude),b=e.Math.toDegrees(C.latitude),E=C.height||0,M=this.htmlLabelId||`measure_circle_${Date.now()}`;this.htmlLabelId=M;const P=`${w.radius}:${h.toFixed(2)} m
|
|
54
|
-
${w.area}:${p.toFixed(2)} m²
|
|
55
|
-
${w.circumference}:${f.toFixed(2)} m`;this.htmlLabelPool.add({text:P},{id:M,lon:v,lat:b,height:E,theme:"measure-circle",show:!0})},e.ScreenSpaceEventType.MOUSE_MOVE)}stop(){this.handler&&(this.handler.destroy(),this.handler=null)}clear(){this.stop(),this.entity&&(this.isPrimitive?this.viewer.scene.primitives.remove(this.entity):this.viewer.entities.remove(this.entity),this.entity=null,this.isPrimitive=!1),this.labelEntity&&(this.viewer.entities.remove(this.labelEntity),this.labelEntity=null),this.previewLabel&&(this.viewer.entities.remove(this.previewLabel),this.previewLabel=null),this.ellipsePrimitive&&(this.viewer.scene.primitives.remove(this.ellipsePrimitive),this.ellipsePrimitive=null),this.htmlLabelPool&&this.htmlLabelId&&(this.htmlLabelPool.removeByIds([this.htmlLabelId]),this.htmlLabelId=null),this.positions=[],this.currentRadius=0}rehydrate(t,e){const i=this.Cesium,r=this.viewer,s=t.options||{},o=(t.positions||[]).map(M=>new i.Cartesian3(M[0],M[1],M[2]));if(o.length<2)return;if(!this.htmlLabelPool){const M=s.overlayContainerId||"html-label-container";this.htmlLabelPool=e||new W(i,r,M),this.htmlLabelPool.registerTheme("measure-circle",{createElement:(P,L)=>{var x;const I=((x=L==null?void 0:L.data)==null?void 0:x.text)||"";P.innerHTML=String(I),P.style.background="rgba(0,0,0,0.6)",P.style.color="#fff",P.style.font="14px sans-serif",P.style.padding="4px 6px",P.style.borderRadius="4px",P.style.whiteSpace="pre"},options:{offset:{x:0,y:-10}}})}const n=o[0],h=o[1],l=i.Cartesian3.distance(n,h),c=Math.PI*l*l,u=2*Math.PI*l,m=i.Cartographic.fromCartesian(n),g=new i.EllipseGeometry({center:n,semiMajorAxis:l,semiMinorAxis:l,height:m.height||0,vertexFormat:i.MaterialAppearance.VERTEX_FORMAT}),p=new i.GeometryInstance({geometry:g}),f=s.color||i.Color.YELLOW.withAlpha(.5),w=s.color&&s.color.withAlpha?s.color.withAlpha(.25):i.Color.RED.withAlpha(.4),y=new i.Primitive({geometryInstances:p,appearance:new i.MaterialAppearance({material:i.Material.fromType("Color",{color:f}),translucent:!0,closed:!0}),depthFailAppearance:new i.MaterialAppearance({material:i.Material.fromType("Color",{color:w}),translucent:!0,closed:!0})});r.scene.primitives.add(y),this.ellipsePrimitive=y,this.entity=y,this.isPrimitive=!0;const C=i.Cartographic.fromCartesian(n),v=t.id+"_circle";this.htmlLabelId=v;const b=s.labelText||{radius:"半径",area:"面积",circumference:"周长"},E=`${b.radius}:${l.toFixed(2)} m
|
|
56
|
-
${b.area}:${c.toFixed(2)} m²
|
|
57
|
-
${b.circumference}:${u.toFixed(2)} m`;this.htmlLabelPool.add({text:E},{id:v,lon:i.Math.toDegrees(C.longitude),lat:i.Math.toDegrees(C.latitude),height:C.height||0,theme:"measure-circle",show:!0})}}class Xe{constructor(t,e){d(this,"Cesium");d(this,"viewer");d(this,"handler",null);d(this,"entity",null);d(this,"labelEntity",null);d(this,"positions",[]);d(this,"tempPoints",[]);d(this,"segmentLabels",[]);d(this,"hoverPos",null);d(this,"previewLabel",null);d(this,"previewEntity",null);d(this,"htmlLabelPool",null);d(this,"totalLabelId",null);d(this,"segmentLabelIds",[]);d(this,"previewLabelId",null);this.Cesium=t,this.viewer=e}start(t){this.clear();const e=this.Cesium,i=this.viewer;if(!this.htmlLabelPool){const r=t.overlayContainerId||"html-label-container";this.htmlLabelPool=new W(e,i,r),this.htmlLabelPool.registerTheme("measure-polyline-total",{createElement:(s,o)=>{var n;s.innerHTML=String(((n=o==null?void 0:o.data)==null?void 0:n.text)||""),s.style.background="rgba(0,0,0,0.6)",s.style.color="#fff",s.style.font="14px sans-serif",s.style.padding="4px 6px",s.style.borderRadius="4px",s.style.whiteSpace="pre"},options:{offset:{x:0,y:-10}}}),this.htmlLabelPool.registerTheme("measure-polyline-seg",{createElement:(s,o)=>{var n;s.innerHTML=String(((n=o==null?void 0:o.data)==null?void 0:n.text)||""),s.style.background="rgba(0,0,0,0.6)",s.style.color="#fff",s.style.font="14px sans-serif",s.style.padding="4px 6px",s.style.borderRadius="4px",s.style.whiteSpace="pre"},options:{offset:{x:0,y:-10}}})}this.handler=new e.ScreenSpaceEventHandler(i.canvas),this.handler.setInputAction(r=>{var n,h;const s=i.scene.pickPosition(r.position);if(!s)return;this.positions.push(s);const o=i.entities.add({position:s,point:{pixelSize:8,color:t.pointColor||t.color||e.Color.YELLOW,disableDepthTestDistance:Number.POSITIVE_INFINITY}});if(this.tempPoints.push(o),this.entity?this.entity.polyline.positions=this.positions.slice():this.entity=i.entities.add({polyline:{positions:this.positions.slice(),width:t.width||3,material:t.lineColor||t.color||e.Color.YELLOW,depthFailMaterial:new e.PolylineDashMaterialProperty({color:((h=(n=t.dashLineColor||t.lineColor||t.color||e.Color.RED).withAlpha)==null?void 0:h.call(n,.9))||e.Color.RED,dashLength:12,dashPattern:255})}}),this.positions.length>=2){const l=this.positions[this.positions.length-2],c=this.positions[this.positions.length-1],u=e.Cartographic.fromCartesian(l),m=e.Cartographic.fromCartesian(c),p=new e.EllipsoidGeodesic(u,m).surfaceDistance,f=new e.Cartesian3((l.x+c.x)/2,(l.y+c.y)/2,(l.z+c.z)/2),w=e.Cartographic.fromCartesian(f),y=`measure_polyline_seg_${this.segmentLabelIds.length}_${Date.now()}`;this.segmentLabelIds.push(y),this.htmlLabelPool.add({text:`${p.toFixed(2)} m`},{id:y,lon:e.Math.toDegrees(w.longitude),lat:e.Math.toDegrees(w.latitude),height:w.height||0,theme:"measure-polyline-seg",show:!0})}},e.ScreenSpaceEventType.LEFT_CLICK),this.handler.setInputAction(()=>{var l;if(this.positions.length<2){this.stop();return}if(this.stop(),this.previewLabelId&&(this.htmlLabelPool.removeByIds([this.previewLabelId]),this.previewLabelId=null),this.hoverPos&&(this.hoverPos=null),this.previewEntity&&(this.viewer.entities.remove(this.previewEntity),this.previewEntity=null),this.positions.length>=2&&this.tempPoints.length>=2){const c=this.tempPoints[this.tempPoints.length-1];this.viewer.entities.remove(c),this.tempPoints.pop()}if(this.segmentLabelIds.length>=1){const c=this.segmentLabelIds[this.segmentLabelIds.length-1];c&&(this.htmlLabelPool.removeByIds([c]),this.segmentLabelIds.pop())}this.positions.length>=2&&this.positions.pop();let r=0;for(let c=1;c<this.positions.length;c++){const u=this.positions[c-1],m=this.positions[c],g=e.Cartographic.fromCartesian(u),p=e.Cartographic.fromCartesian(m),w=new e.EllipsoidGeodesic(g,p).surfaceDistance;r+=w}const s=this.positions[this.positions.length-1];this.entity&&this.entity.polyline&&(this.entity.polyline.positions=this.positions);const o=e.Cartographic.fromCartesian(s),n=this.totalLabelId||`measure_polyline_total_${Date.now()}`;this.totalLabelId=n,this.htmlLabelPool.add({text:`${r.toFixed(2)} m`},{id:n,lon:e.Math.toDegrees(o.longitude),lat:e.Math.toDegrees(o.latitude),height:o.height||0,theme:"measure-polyline-total",show:!0}),this.labelEntity=this.totalLabelId;const h={entity:this.entity,label:this.labelEntity,segmentLabels:this.segmentLabelIds,positions:this.positions,distance:r,clear:()=>this.clear()};(l=t.onComplete)==null||l.call(t,h)},e.ScreenSpaceEventType.LEFT_DOUBLE_CLICK),this.handler.setInputAction(r=>{var p,f;if(this.positions.length===0)return;const s=i.scene.pickPosition(r.endPosition);if(!s)return;this.hoverPos=s;const o=this.positions[this.positions.length-1],n=e.Cartographic.fromCartesian(o),h=e.Cartographic.fromCartesian(s),c=new e.EllipsoidGeodesic(n,h).surfaceDistance,u=new e.Cartesian3((o.x+s.x)/2,(o.y+s.y)/2,(o.z+s.z)/2),m=e.Cartographic.fromCartesian(u),g=this.previewLabelId||"measure_polyline_preview";this.previewLabelId=g,this.htmlLabelPool.add({text:`${c.toFixed(2)} m`},{id:g,lon:e.Math.toDegrees(m.longitude),lat:e.Math.toDegrees(m.latitude),height:m.height||0,theme:"measure-polyline-seg",show:!0}),this.previewEntity?this.previewEntity.polyline.positions=[o,s]:this.previewEntity=i.entities.add({polyline:{positions:[o,s],width:t.width||3,material:t.lineColor||t.color||e.Color.YELLOW,depthFailMaterial:new e.PolylineDashMaterialProperty({color:((f=(p=t.dashLineColor||t.lineColor||t.color||e.Color.RED).withAlpha)==null?void 0:f.call(p,.9))||e.Color.RED,dashLength:12,dashPattern:255})}})},e.ScreenSpaceEventType.MOUSE_MOVE)}stop(){this.handler&&(this.handler.destroy(),this.handler=null)}clear(){this.stop(),this.entity&&(this.viewer.entities.remove(this.entity),this.entity=null),this.totalLabelId&&this.htmlLabelPool&&(this.htmlLabelPool.removeByIds([this.totalLabelId]),this.totalLabelId=null),this.previewEntity&&(this.viewer.entities.remove(this.previewEntity),this.previewEntity=null),this.previewLabelId&&this.htmlLabelPool&&(this.htmlLabelPool.removeByIds([this.previewLabelId]),this.previewLabelId=null),this.hoverPos=null,this.segmentLabelIds.length&&this.htmlLabelPool&&this.htmlLabelPool.removeByIds(this.segmentLabelIds.slice()),this.segmentLabelIds=[],this.tempPoints.forEach(t=>this.viewer.entities.remove(t)),this.tempPoints=[],this.positions=[]}rehydrate(t,e){var p,f;const i=this.Cesium,r=this.viewer,s=t.options||{},o=s.lineColor||s.color||i.Color.YELLOW,n=((f=(p=s.dashLineColor||s.lineColor||s.color||i.Color.RED).withAlpha)==null?void 0:f.call(p,.9))||i.Color.RED,h=s.width||3,l=(t.positions||[]).map(w=>new i.Cartesian3(w[0],w[1],w[2]));if(l.length<2)return;if(!this.htmlLabelPool){const w=s.overlayContainerId||"html-label-container";this.htmlLabelPool=e||new W(i,r,w),this.htmlLabelPool.registerTheme("measure-polyline-total",{createElement:(y,C)=>{var v;y.innerHTML=String(((v=C==null?void 0:C.data)==null?void 0:v.text)||""),y.style.background="rgba(0,0,0,0.6)",y.style.color="#fff",y.style.font="14px sans-serif",y.style.padding="4px 6px",y.style.borderRadius="4px",y.style.whiteSpace="pre"},options:{offset:{x:0,y:-10}}}),this.htmlLabelPool.registerTheme("measure-polyline-seg",{createElement:(y,C)=>{var v;y.innerHTML=String(((v=C==null?void 0:C.data)==null?void 0:v.text)||""),y.style.background="rgba(0,0,0,0.6)",y.style.color="#fff",y.style.font="14px sans-serif",y.style.padding="4px 6px",y.style.borderRadius="4px",y.style.whiteSpace="pre"},options:{offset:{x:0,y:-10}}})}for(const w of l){const y=r.entities.add({position:w,point:{pixelSize:8,color:s.pointColor||s.color||i.Color.YELLOW,disableDepthTestDistance:Number.POSITIVE_INFINITY}});this.tempPoints.push(y)}this.entity=r.entities.add({polyline:{positions:l,width:h,material:o,depthFailMaterial:new i.PolylineDashMaterialProperty({color:n,dashLength:12,dashPattern:255})}});let c=0;for(let w=1;w<l.length;w++){const y=i.Cartographic.fromCartesian(l[w-1]),C=i.Cartographic.fromCartesian(l[w]),v=new i.EllipsoidGeodesic(y,C);c+=v.surfaceDistance;const b=l[w-1],E=l[w],M=new i.Cartesian3((b.x+E.x)/2,(b.y+E.y)/2,(b.z+E.z)/2),P=i.Cartographic.fromCartesian(M),L=t.id+`_seg_${w-1}`;this.segmentLabelIds.push(L),this.htmlLabelPool.add({text:`${v.surfaceDistance.toFixed(2)} m`},{id:L,lon:i.Math.toDegrees(P.longitude),lat:i.Math.toDegrees(P.latitude),height:P.height||0,theme:"measure-polyline-seg",show:!0,style:{pointerEvents:"none",userSelect:"none",cursor:"default"}})}const u=l[l.length-1],m=i.Cartographic.fromCartesian(u),g=t.id+"_total";this.totalLabelId=g,this.htmlLabelPool.add({text:`${c.toFixed(2)} m`},{id:g,lon:i.Math.toDegrees(m.longitude),lat:i.Math.toDegrees(m.latitude),height:m.height||0,theme:"measure-polyline-total",show:!0,style:{pointerEvents:"none",userSelect:"none",cursor:"default"}})}}class Je{constructor(t,e){d(this,"Cesium");d(this,"viewer");d(this,"handler",null);d(this,"labelEntity",null);d(this,"htmlLabelPool",null);d(this,"htmlLabelId",null);d(this,"topPoint",null);d(this,"zeroPoint",null);d(this,"lineEntity",null);this.Cesium=t,this.viewer=e}start(t){this.clear();const e=this.Cesium,i=this.viewer;if(!this.htmlLabelPool){const r=t.overlayContainerId||"html-label-container";this.htmlLabelPool=new W(e,i,r),this.htmlLabelPool.registerTheme("measure-terrainHeight",{createElement:(s,o)=>{var n;s.innerHTML=String(((n=o==null?void 0:o.data)==null?void 0:n.text)||""),s.style.background="rgba(0,0,0,0.6)",s.style.color="#fff",s.style.font="14px sans-serif",s.style.padding="4px 6px",s.style.borderRadius="4px",s.style.whiteSpace="pre"},options:{offset:{x:0,y:-10}}})}this.handler=new e.ScreenSpaceEventHandler(i.canvas),this.handler.setInputAction(r=>{var w;const s=i.scene.pickPosition(r.position);if(!s)return;const o=e.Cartographic.fromCartesian(s),n=i.scene.globe.getHeight(new e.Cartographic(o.longitude,o.latitude,0))||0,h=e.Math.toDegrees(o.longitude),l=e.Math.toDegrees(o.latitude),c=e.Cartesian3.fromDegrees(h,l,n);this.topPoint=i.entities.add({position:s,point:{pixelSize:8,color:t.color||e.Color.YELLOW,disableDepthTestDistance:Number.POSITIVE_INFINITY}}),this.zeroPoint=i.entities.add({position:c,point:{pixelSize:8,color:e.Color.YELLOW,disableDepthTestDistance:Number.POSITIVE_INFINITY}}),this.lineEntity=i.entities.add({polyline:{positions:[c,s],width:t.width||3,material:t.color||e.Color.YELLOW,depthFailMaterial:new e.PolylineDashMaterialProperty({color:e.Color.RED,dashLength:12,dashPattern:255})}});const u=t.labelText||{height:"高差"},m=(o.height||0)-n,g=`${u.height}:${m.toFixed(2)} m`,p=this.htmlLabelId||`measure_terrain_${Date.now()}`;this.htmlLabelId=p,this.htmlLabelPool.add({text:g},{id:p,lon:h,lat:l,height:o.height||0,theme:"measure-terrainHeight",show:!0}),this.labelEntity=this.htmlLabelId;const f={label:this.labelEntity,position:s,zeroPosition:c,line:this.lineEntity,terrainHeight:n,difference:m,clear:()=>this.clear()};(w=t.onComplete)==null||w.call(t,f),this.stop()},e.ScreenSpaceEventType.LEFT_CLICK)}stop(){this.handler&&(this.handler.destroy(),this.handler=null)}clear(){this.stop(),this.lineEntity&&(this.viewer.entities.remove(this.lineEntity),this.lineEntity=null),this.topPoint&&(this.viewer.entities.remove(this.topPoint),this.topPoint=null),this.zeroPoint&&(this.viewer.entities.remove(this.zeroPoint),this.zeroPoint=null),this.htmlLabelId&&this.htmlLabelPool&&(this.htmlLabelPool.removeByIds([this.htmlLabelId]),this.htmlLabelId=null)}rehydrate(t,e){const i=this.Cesium,r=this.viewer,s=t.options||{},o=(t.positions||[]).map(w=>new i.Cartesian3(w[0],w[1],w[2]));if(o.length<1){const y=(t.data||{}).position;y&&(Array.isArray(y)&&y.length===3?o.push(new i.Cartesian3(y[0],y[1],y[2])):typeof y=="object"&&y&&"x"in y&&"y"in y&&"z"in y&&o.push(new i.Cartesian3(y.x,y.y,y.z)))}if(o.length<1)return;if(!this.htmlLabelPool){const w=s.overlayContainerId||"html-label-container";this.htmlLabelPool=e||new W(i,r,w),this.htmlLabelPool.registerTheme("measure-terrainHeight",{createElement:(y,C)=>{var v;y.innerHTML=String(((v=C==null?void 0:C.data)==null?void 0:v.text)||""),y.style.background="rgba(0,0,0,0.6)",y.style.color="#fff",y.style.font="14px sans-serif",y.style.padding="4px 6px",y.style.borderRadius="4px",y.style.whiteSpace="pre"},options:{offset:{x:0,y:-10}}})}const n=o[0],h=i.Cartographic.fromCartesian(n),l=r.scene.globe.getHeight(new i.Cartographic(h.longitude,h.latitude,0))||0,c=i.Math.toDegrees(h.longitude),u=i.Math.toDegrees(h.latitude),m=i.Cartesian3.fromDegrees(c,u,l);this.topPoint=r.entities.add({position:n,point:{pixelSize:8,color:s.color||i.Color.YELLOW,disableDepthTestDistance:Number.POSITIVE_INFINITY}}),this.zeroPoint=r.entities.add({position:m,point:{pixelSize:8,color:i.Color.YELLOW,disableDepthTestDistance:Number.POSITIVE_INFINITY}}),this.lineEntity=r.entities.add({polyline:{positions:[m,n],width:s.width||3,material:s.color||i.Color.YELLOW,depthFailMaterial:new i.PolylineDashMaterialProperty({color:i.Color.RED,dashLength:12,dashPattern:255})}});const g=s.labelText||{height:"高差"},p=(h.height||0)-l,f=t.id+"_terrain";this.htmlLabelId=f,this.htmlLabelPool.add({text:`${g.height}:${p.toFixed(2)} m`},{id:f,lon:c,lat:u,height:h.height||0,theme:"measure-terrainHeight",show:!0})}}class Qe{constructor(t,e){d(this,"Cesium");d(this,"viewer");d(this,"handler",null);d(this,"entity",null);d(this,"labelEntity",null);d(this,"htmlLabelPool",null);d(this,"htmlLabelId",null);this.Cesium=t,this.viewer=e}start(t){this.clear();const e=this.Cesium,i=this.viewer;if(!this.htmlLabelPool){const r=t.overlayContainerId||"html-label-container";this.htmlLabelPool=new W(e,i,r),this.htmlLabelPool.registerTheme("measure-coordinate",{createElement:(s,o)=>{var n;s.innerHTML=String(((n=o==null?void 0:o.data)==null?void 0:n.text)||""),s.style.background="rgba(0,0,0,0.6)",s.style.color="#fff",s.style.font="14px sans-serif",s.style.padding="4px 6px",s.style.borderRadius="4px",s.style.whiteSpace="pre"},options:{offset:{x:0,y:-10}}})}this.handler=new e.ScreenSpaceEventHandler(i.canvas),this.handler.setInputAction(r=>{var g;const s=i.scene.pickPosition(r.position);if(!s)return;const o=e.Cartographic.fromCartesian(s),n=e.Math.toDegrees(o.longitude),h=e.Math.toDegrees(o.latitude),l=o.height||0;this.entity=i.entities.add({position:s,point:{pixelSize:10,color:t.color||e.Color.YELLOW,disableDepthTestDistance:Number.POSITIVE_INFINITY}});const c=this.htmlLabelId||`measure_coordinate_${Date.now()}`;this.htmlLabelId=c;const u=t.labelText||{lng:"经",lat:"纬",height:"高"};this.htmlLabelPool.add({text:`${u.lng}:${n.toFixed(6)}
|
|
58
|
-
${u.lat}:${h.toFixed(6)}
|
|
59
|
-
${u.height}:${l.toFixed(2)} m`},{id:c,lon:n,lat:h,height:l,theme:"measure-coordinate",show:!0}),this.labelEntity=this.htmlLabelId;const m={entity:this.entity,label:this.labelEntity,lnglat:{lng:n,lat:h,height:l},clear:()=>this.clear()};(g=t.onComplete)==null||g.call(t,m),this.stop()},e.ScreenSpaceEventType.LEFT_CLICK)}stop(){this.handler&&(this.handler.destroy(),this.handler=null)}clear(){this.stop(),this.entity&&(this.viewer.entities.remove(this.entity),this.entity=null),this.htmlLabelId&&this.htmlLabelPool&&(this.htmlLabelPool.removeByIds([this.htmlLabelId]),this.htmlLabelId=null)}rehydrate(t,e){var p;const i=this.Cesium,r=this.viewer,s=t.options||{},o=(t.positions||[]).map(f=>new i.Cartesian3(f[0],f[1],f[2]));if(!o.length){const f=(p=t.data)==null?void 0:p.lnglat;if(f&&typeof f.lng=="number"&&typeof f.lat=="number"){const w=i.Cartesian3.fromDegrees(f.lng,f.lat,f.height||0);o.push(w)}}if(!o.length)return;if(!this.htmlLabelPool){const f=s.overlayContainerId||"html-label-container";this.htmlLabelPool=e||new W(i,r,f),this.htmlLabelPool.registerTheme("measure-coordinate",{createElement:(w,y)=>{var C;w.innerHTML=String(((C=y==null?void 0:y.data)==null?void 0:C.text)||""),w.style.background="rgba(0,0,0,0.6)",w.style.color="#fff",w.style.font="14px sans-serif",w.style.padding="4px 6px",w.style.borderRadius="4px",w.style.whiteSpace="pre"},options:{offset:{x:0,y:-10}}})}const n=o[0],h=i.Cartographic.fromCartesian(n),l=i.Math.toDegrees(h.longitude),c=i.Math.toDegrees(h.latitude),u=h.height||0;this.entity=r.entities.add({position:n,point:{pixelSize:10,color:s.color||i.Color.YELLOW,disableDepthTestDistance:Number.POSITIVE_INFINITY}});const m=t.id+"_coord";this.htmlLabelId=m;const g=s.labelText||{lng:"经",lat:"纬",height:"高"};this.htmlLabelPool.add({text:`${g.lng}:${l.toFixed(6)}
|
|
60
|
-
${g.lat}:${c.toFixed(6)}
|
|
61
|
-
${g.height}:${u.toFixed(2)} m`},{id:m,lon:l,lat:c,height:u,theme:"measure-coordinate",show:!0})}}class Ze{constructor(t,e){d(this,"Cesium");d(this,"viewer");d(this,"handler",null);d(this,"startPoint",null);d(this,"endPoint",null);d(this,"entity",null);d(this,"labelEntity",null);d(this,"primitive",null);d(this,"previewPrimitive",null);d(this,"htmlLabelPool",null);d(this,"htmlLabelId",null);d(this,"segmentLabelIds",[]);d(this,"previewLabelId",null);this.Cesium=t,this.viewer=e}start(t){this.clear();const e=this.Cesium,i=this.viewer;if(!this.htmlLabelPool){const r=t.overlayContainerId||"html-label-container";this.htmlLabelPool=new W(e,i,r),this.htmlLabelPool.registerTheme("measure-rectangle",{createElement:(s,o)=>{var n;s.innerHTML=String(((n=o==null?void 0:o.data)==null?void 0:n.text)||""),s.style.background="rgba(0,0,0,0.6)",s.style.color="#fff",s.style.font="14px sans-serif",s.style.padding="4px 6px",s.style.borderRadius="4px",s.style.whiteSpace="pre"},options:{offset:{x:0,y:-10}}}),this.htmlLabelPool.registerTheme("measure-rectangle-seg",{createElement:(s,o)=>{var n;s.innerHTML=String(((n=o==null?void 0:o.data)==null?void 0:n.text)||""),s.style.background="rgba(0,0,0,0.6)",s.style.color="#fff",s.style.font="14px sans-serif",s.style.padding="4px 6px",s.style.borderRadius="4px",s.style.whiteSpace="pre"},options:{offset:{x:0,y:-10}}})}this.handler=new e.ScreenSpaceEventHandler(i.canvas),this.handler.setInputAction(r=>{var o;const s=i.scene.pickPosition(r.position);if(s)if(!this.startPoint)this.startPoint=s;else{this.endPoint=s,this.stop();const n=e.Cartographic.fromCartesian(this.startPoint),h=e.Cartographic.fromCartesian(this.endPoint),l=Math.min(n.longitude,h.longitude),c=Math.max(n.longitude,h.longitude),u=Math.min(n.latitude,h.latitude),m=Math.max(n.latitude,h.latitude),g=new e.Cartographic(l,u,0),p=new e.Cartographic(c,u,0),f=new e.Cartographic(l,m,0),w=new e.EllipsoidGeodesic(g,p).surfaceDistance,y=new e.EllipsoidGeodesic(g,f).surfaceDistance,C=w*y,v=new e.Cartesian3((this.startPoint.x+this.endPoint.x)/2,(this.startPoint.y+this.endPoint.y)/2,(this.startPoint.z+this.endPoint.z)/2),b=e.Cartographic.fromCartesian(v),E=b.height||0,M=this.htmlLabelId||`measure_rectangle_${Date.now()}`;this.htmlLabelId=M;const P=t.labelText||{width:"宽",heightLabel:"高",area:"面积",side:"边长"};this.previewLabelId&&this.htmlLabelPool&&(this.htmlLabelPool.removeByIds([this.previewLabelId]),this.previewLabelId=null),this.htmlLabelPool.add({text:`${P.width}:${w.toFixed(2)} m
|
|
62
|
-
${P.heightLabel}:${y.toFixed(2)} m
|
|
63
|
-
${P.area}:${C.toFixed(2)} m²`},{id:M,lon:e.Math.toDegrees(b.longitude),lat:e.Math.toDegrees(b.latitude),height:b.height||0,theme:"measure-rectangle",show:!0});const L=new e.Cartographic(l,u,E),I=new e.Cartographic(c,u,E),x=new e.Cartographic(l,m,E),A=new e.Cartographic(c,m,E),$=e.Ellipsoid.WGS84.cartographicToCartesian(L),R=e.Ellipsoid.WGS84.cartographicToCartesian(I),S=e.Ellipsoid.WGS84.cartographicToCartesian(x),_=e.Ellipsoid.WGS84.cartographicToCartesian(A),F=[[$,R,w],[R,_,y],[_,S,w],[S,$,y]];for(let k=0;k<F.length;k++){const[Q,V,z]=F[k],U=new e.Cartesian3((Q.x+V.x)/2,(Q.y+V.y)/2,(Q.z+V.z)/2),H=e.Cartographic.fromCartesian(U),ae=`measure_rectangle_seg_${Date.now()}_${k}`;this.segmentLabelIds.push(ae),this.htmlLabelPool.add({text:`${P.side}:${Number(z).toFixed(2)} m`},{id:ae,lon:e.Math.toDegrees(H.longitude),lat:e.Math.toDegrees(H.latitude),height:H.height||0,theme:"measure-rectangle-seg",show:!0})}this.previewPrimitive&&(i.scene.primitives.remove(this.previewPrimitive),this.previewPrimitive=null),this.primitive&&(i.scene.primitives.remove(this.primitive),this.primitive=null),this.entity&&(i.entities.remove(this.entity),this.entity=null);const N=new e.PolygonHierarchy([$,R,_,S]),D=new e.PolygonGeometry({polygonHierarchy:N,vertexFormat:e.MaterialAppearance.VERTEX_FORMAT,perPositionHeight:!0}),Y=new e.GeometryInstance({geometry:D}),G=t.color||e.Color.YELLOW.withAlpha(.4),X=t.color&&t.color.withAlpha?t.color.withAlpha(.25):e.Color.RED.withAlpha(.4);this.primitive=new e.Primitive({geometryInstances:Y,appearance:new e.MaterialAppearance({material:e.Material.fromType("Color",{color:G}),translucent:!0,closed:!0}),depthFailAppearance:new e.MaterialAppearance({material:e.Material.fromType("Color",{color:X}),translucent:!0,closed:!0})}),i.scene.primitives.add(this.primitive);const J={entity:this.primitive,label:this.labelEntity,positions:[this.startPoint,this.endPoint],width:w,height:y,area:C,clear:()=>this.clear()};(o=t.onComplete)==null||o.call(t,J)}},e.ScreenSpaceEventType.LEFT_CLICK),this.handler.setInputAction(r=>{if(!this.startPoint)return;const s=i.scene.pickPosition(r.endPosition);if(!s)return;this.endPoint=s;const o=e.Cartographic.fromCartesian(this.startPoint),n=e.Cartographic.fromCartesian(this.endPoint),h=Math.min(o.longitude,n.longitude),l=Math.max(o.longitude,n.longitude),c=Math.min(o.latitude,n.latitude),u=Math.max(o.latitude,n.latitude),m=new e.Cartographic(h,c,0),g=new e.Cartographic(l,c,0),p=new e.Cartographic(h,u,0),f=new e.EllipsoidGeodesic(m,g).surfaceDistance,w=new e.EllipsoidGeodesic(m,p).surfaceDistance,y=f*w,C=new e.Cartesian3((this.startPoint.x+this.endPoint.x)/2,(this.startPoint.y+this.endPoint.y)/2,(this.startPoint.z+this.endPoint.z)/2),v=e.Cartographic.fromCartesian(C),b=v.height||0,E=this.previewLabelId||"measure_rectangle_preview";this.previewLabelId=E;const M=t.labelText||{width:"宽",heightLabel:"高",area:"面积"};this.htmlLabelPool.add({text:`${M.width}:${f.toFixed(2)} m
|
|
64
|
-
${M.heightLabel}:${w.toFixed(2)} m
|
|
65
|
-
${M.area}:${y.toFixed(2)} m²`},{id:E,lon:e.Math.toDegrees(v.longitude),lat:e.Math.toDegrees(v.latitude),height:v.height||0,theme:"measure-rectangle",show:!0});const P=new e.Cartographic(h,c,b),L=new e.Cartographic(l,c,b),I=new e.Cartographic(h,u,b),x=new e.Cartographic(l,u,b),A=e.Ellipsoid.WGS84.cartographicToCartesian(P),$=e.Ellipsoid.WGS84.cartographicToCartesian(L),R=e.Ellipsoid.WGS84.cartographicToCartesian(I),S=e.Ellipsoid.WGS84.cartographicToCartesian(x);this.previewPrimitive&&(i.scene.primitives.remove(this.previewPrimitive),this.previewPrimitive=null);const _=new e.PolygonHierarchy([A,$,S,R]),F=new e.PolygonGeometry({polygonHierarchy:_,vertexFormat:e.MaterialAppearance.VERTEX_FORMAT,perPositionHeight:!0}),N=new e.GeometryInstance({geometry:F}),D=t.color||e.Color.YELLOW.withAlpha(.4),Y=t.color&&t.color.withAlpha?t.color.withAlpha(.25):e.Color.RED.withAlpha(.4);this.previewPrimitive=new e.Primitive({geometryInstances:N,appearance:new e.MaterialAppearance({material:e.Material.fromType("Color",{color:D}),translucent:!0,closed:!0}),depthFailAppearance:new e.MaterialAppearance({material:e.Material.fromType("Color",{color:Y}),translucent:!0,closed:!0})}),i.scene.primitives.add(this.previewPrimitive)},e.ScreenSpaceEventType.MOUSE_MOVE)}stop(){this.handler&&(this.handler.destroy(),this.handler=null)}clear(){this.stop(),this.entity&&(this.viewer.entities.remove(this.entity),this.entity=null),this.previewPrimitive&&(this.viewer.scene.primitives.remove(this.previewPrimitive),this.previewPrimitive=null),this.primitive&&(this.viewer.scene.primitives.remove(this.primitive),this.primitive=null),this.htmlLabelId&&this.htmlLabelPool&&(this.htmlLabelPool.removeByIds([this.htmlLabelId]),this.htmlLabelId=null),this.previewLabelId&&this.htmlLabelPool&&(this.htmlLabelPool.removeByIds([this.previewLabelId]),this.previewLabelId=null),this.segmentLabelIds.length&&this.htmlLabelPool&&this.htmlLabelPool.removeByIds(this.segmentLabelIds.slice()),this.segmentLabelIds=[],this.startPoint=null,this.endPoint=null}rehydrate(t,e){const i=this.Cesium,r=this.viewer,s=t.options||{},o=(t.positions||[]).map(V=>new i.Cartesian3(V[0],V[1],V[2]));if(o.length<2)return;if(!this.htmlLabelPool){const V=s.overlayContainerId||"html-label-container";this.htmlLabelPool=e||new W(i,r,V),this.htmlLabelPool.registerTheme("measure-rectangle",{createElement:(z,U)=>{var H;z.innerHTML=String(((H=U==null?void 0:U.data)==null?void 0:H.text)||""),z.style.background="rgba(0,0,0,0.6)",z.style.color="#fff",z.style.font="14px sans-serif",z.style.padding="4px 6px",z.style.borderRadius="4px",z.style.whiteSpace="pre"},options:{offset:{x:0,y:-10}}}),this.htmlLabelPool.registerTheme("measure-rectangle-seg",{createElement:(z,U)=>{var H;z.innerHTML=String(((H=U==null?void 0:U.data)==null?void 0:H.text)||""),z.style.background="rgba(0,0,0,0.6)",z.style.color="#fff",z.style.font="14px sans-serif",z.style.padding="4px 6px",z.style.borderRadius="4px",z.style.whiteSpace="pre"},options:{offset:{x:0,y:-10}}})}const n=o[0],h=o[1],l=i.Cartographic.fromCartesian(n),c=i.Cartographic.fromCartesian(h),u=Math.min(l.longitude,c.longitude),m=Math.max(l.longitude,c.longitude),g=Math.min(l.latitude,c.latitude),p=Math.max(l.latitude,c.latitude),f=new i.Cartographic(u,g,0),w=new i.Cartographic(m,g,0),y=new i.Cartographic(u,p,0),C=new i.EllipsoidGeodesic(f,w).surfaceDistance,v=new i.EllipsoidGeodesic(f,y).surfaceDistance,b=C*v,E=new i.Cartesian3((n.x+h.x)/2,(n.y+h.y)/2,(n.z+h.z)/2),M=i.Cartographic.fromCartesian(E),P=t.id+"_rectangle",L=s.labelText||{width:"宽",heightLabel:"高",area:"面积",side:"边长"};this.htmlLabelId=P,this.htmlLabelPool.add({text:`${L.width}:${C.toFixed(2)} m
|
|
66
|
-
${L.heightLabel}:${v.toFixed(2)} m
|
|
67
|
-
${L.area}:${b.toFixed(2)} m²`},{id:P,lon:i.Math.toDegrees(M.longitude),lat:i.Math.toDegrees(M.latitude),height:M.height||0,theme:"measure-rectangle",show:!0});const I=M.height||0,x=new i.Cartographic(u,g,I),A=new i.Cartographic(m,g,I),$=new i.Cartographic(u,p,I),R=new i.Cartographic(m,p,I),S=i.Ellipsoid.WGS84.cartographicToCartesian(x),_=i.Ellipsoid.WGS84.cartographicToCartesian(A),F=i.Ellipsoid.WGS84.cartographicToCartesian($),N=i.Ellipsoid.WGS84.cartographicToCartesian(R),D=[[S,_,C],[_,N,v],[N,F,C],[F,S,v]];for(let V=0;V<D.length;V++){const[z,U,H]=D[V],ae=new i.Cartesian3((z.x+U.x)/2,(z.y+U.y)/2,(z.z+U.z)/2),se=i.Cartographic.fromCartesian(ae),K=t.id+`_rectangle_seg_${V}`;this.segmentLabelIds.push(K),this.htmlLabelPool.add({text:`${L.side}:${Number(H).toFixed(2)} m`},{id:K,lon:i.Math.toDegrees(se.longitude),lat:i.Math.toDegrees(se.latitude),height:se.height||0,theme:"measure-rectangle-seg",show:!0})}const Y=new i.PolygonHierarchy([S,_,N,F]),G=new i.PolygonGeometry({polygonHierarchy:Y,vertexFormat:i.MaterialAppearance.VERTEX_FORMAT,perPositionHeight:!0}),X=new i.GeometryInstance({geometry:G}),J=s.color||i.Color.YELLOW.withAlpha(.4),k=s.color&&s.color.withAlpha?s.color.withAlpha(.25):i.Color.RED.withAlpha(.4),Q=new i.Primitive({geometryInstances:X,appearance:new i.MaterialAppearance({material:i.Material.fromType("Color",{color:J}),translucent:!0,closed:!0}),depthFailAppearance:new i.MaterialAppearance({material:i.Material.fromType("Color",{color:k}),translucent:!0,closed:!0})});this.primitive=Q,r.scene.primitives.add(this.primitive)}}class et{constructor(t,e){d(this,"Cesium");d(this,"viewer");d(this,"handler",null);d(this,"entity",null);d(this,"positions",[]);d(this,"labelEntity",null);d(this,"currentPoints",[]);d(this,"primitive",null);d(this,"htmlLabelPool",null);d(this,"htmlLabelId",null);d(this,"segmentLabelIds",[]);d(this,"previewLabelId",null);this.Cesium=t,this.viewer=e}start(t){this.clear();const e=this.Cesium,i=this.viewer,r=Math.max(t.sides||6,6);if(!this.htmlLabelPool){const s=t.overlayContainerId||"html-label-container";this.htmlLabelPool=new W(e,i,s),this.htmlLabelPool.registerTheme("measure-regular",{createElement:(o,n)=>{var h;o.innerHTML=String(((h=n==null?void 0:n.data)==null?void 0:h.text)||""),o.style.background="rgba(0,0,0,0.6)",o.style.color="#fff",o.style.font="14px sans-serif",o.style.padding="4px 6px",o.style.borderRadius="4px",o.style.whiteSpace="pre"},options:{offset:{x:0,y:-10}}}),this.htmlLabelPool.registerTheme("measure-regular-seg",{createElement:(o,n)=>{var h;o.innerHTML=String(((h=n==null?void 0:n.data)==null?void 0:h.text)||""),o.style.background="rgba(0,0,0,0.6)",o.style.color="#fff",o.style.font="14px sans-serif",o.style.padding="4px 6px",o.style.borderRadius="4px",o.style.whiteSpace="pre"},options:{offset:{x:0,y:-10}}})}this.handler=new e.ScreenSpaceEventHandler(i.canvas),this.handler.setInputAction(s=>{var n;const o=i.scene.pickPosition(s.position);if(o&&(this.positions.push(o),this.positions.length===2)){this.stop();const h=this.positions[0],l=this.positions[1],c=e.Cartesian3.distance(h,l),u=this.buildRegularPolygonPoints(h,c,r);this.primitive&&(i.scene.primitives.remove(this.primitive),this.primitive=null);const m=new e.PolygonHierarchy(u),g=new e.PolygonGeometry({polygonHierarchy:m,vertexFormat:e.MaterialAppearance.VERTEX_FORMAT,perPositionHeight:!0}),p=new e.GeometryInstance({geometry:g}),f=t.color||e.Color.YELLOW.withAlpha(.4),w=t.color&&t.color.withAlpha?t.color.withAlpha(.25):e.Color.RED.withAlpha(.4);this.primitive=new e.Primitive({geometryInstances:p,appearance:new e.MaterialAppearance({material:e.Material.fromType("Color",{color:f}),translucent:!0,closed:!0}),depthFailAppearance:new e.MaterialAppearance({material:e.Material.fromType("Color",{color:w}),translucent:!0,closed:!0})}),i.scene.primitives.add(this.primitive);let y=0;for(let P=1;P<u.length;P++)y+=e.Cartesian3.distance(u[P-1],u[P]);const C=this.computeAreaByPlane(u),v=e.Cartographic.fromCartesian(h),b=this.htmlLabelId||`measure_regular_${Date.now()}`;this.htmlLabelId=b;const E=t.labelText||{sides:"边数",radius:"半径",circumference:"周长",area:"面积",side:"边长"};this.previewLabelId&&this.htmlLabelPool&&(this.htmlLabelPool.removeByIds([this.previewLabelId]),this.previewLabelId=null),this.htmlLabelPool.add({text:`${E.sides}:${r}
|
|
68
|
-
${E.radius}:${c.toFixed(2)} m
|
|
69
|
-
${E.circumference}:${y.toFixed(2)} m
|
|
70
|
-
${E.area}:${C.toFixed(2)} m²`},{id:b,lon:e.Math.toDegrees(v.longitude),lat:e.Math.toDegrees(v.latitude),height:v.height||0,theme:"measure-regular",show:!0});for(let P=1;P<u.length;P++){const L=u[P-1],I=u[P],x=e.Cartographic.fromCartesian(L),A=e.Cartographic.fromCartesian(I),R=new e.EllipsoidGeodesic(x,A).surfaceDistance,S=new e.Cartesian3((L.x+I.x)/2,(L.y+I.y)/2,(L.z+I.z)/2),_=e.Cartographic.fromCartesian(S),F=`measure_regular_seg_${Date.now()}_${P-1}`;this.segmentLabelIds.push(F),this.htmlLabelPool.add({text:`${E.side}:${R.toFixed(2)} m`},{id:F,lon:e.Math.toDegrees(_.longitude),lat:e.Math.toDegrees(_.latitude),height:_.height||0,theme:"measure-regular-seg",show:!0})}const M={entity:this.primitive,label:this.labelEntity,positions:u,radius:c,sides:r,perimeter:y,area:C,clear:()=>this.clear()};(n=t.onComplete)==null||n.call(t,M)}},e.ScreenSpaceEventType.LEFT_CLICK),this.handler.setInputAction(s=>{if(this.positions.length!==1)return;const o=this.positions[0],n=i.camera.getPickRay(s.endPosition),h=i.scene.globe.pick(n,i.scene);if(!h)return;const l=e.Cartesian3.distance(o,h);this.currentPoints=this.buildRegularPolygonPoints(o,l,r),this.primitive&&(i.scene.primitives.remove(this.primitive),this.primitive=null);const c=new e.PolygonHierarchy(this.currentPoints),u=new e.PolygonGeometry({polygonHierarchy:c,vertexFormat:e.MaterialAppearance.VERTEX_FORMAT,perPositionHeight:!0}),m=new e.GeometryInstance({geometry:u}),g=t.color||e.Color.YELLOW.withAlpha(.4),p=t.color&&t.color.withAlpha?t.color.withAlpha(.25):e.Color.RED.withAlpha(.4);this.primitive=new e.Primitive({geometryInstances:m,appearance:new e.MaterialAppearance({material:e.Material.fromType("Color",{color:g}),translucent:!0,closed:!0}),depthFailAppearance:new e.MaterialAppearance({material:e.Material.fromType("Color",{color:p}),translucent:!0,closed:!0})}),i.scene.primitives.add(this.primitive);let f=0;for(let b=1;b<this.currentPoints.length;b++)f+=e.Cartesian3.distance(this.currentPoints[b-1],this.currentPoints[b]);const w=this.computeAreaByPlane(this.currentPoints),y=e.Cartographic.fromCartesian(o),C=this.previewLabelId||"measure_regular_preview";this.previewLabelId=C;const v=t.labelText||{sides:"边数",radius:"半径",circumference:"周长",area:"面积"};this.htmlLabelPool.add({text:`${v.sides}:${r}
|
|
71
|
-
${v.radius}:${l.toFixed(2)} m
|
|
72
|
-
${v.circumference}:${f.toFixed(2)} m
|
|
73
|
-
${v.area}:${w.toFixed(2)} m²`},{id:C,lon:e.Math.toDegrees(y.longitude),lat:e.Math.toDegrees(y.latitude),height:y.height||0,theme:"measure-regular",show:!0})},e.ScreenSpaceEventType.MOUSE_MOVE)}stop(){this.handler&&(this.handler.destroy(),this.handler=null)}clear(){this.stop(),this.entity&&(this.viewer.entities.remove(this.entity),this.entity=null),this.primitive&&(this.viewer.scene.primitives.remove(this.primitive),this.primitive=null),this.labelEntity&&(this.viewer.entities.remove(this.labelEntity),this.labelEntity=null),this.htmlLabelPool&&this.htmlLabelId&&(this.htmlLabelPool.removeByIds([this.htmlLabelId]),this.htmlLabelId=null),this.previewLabelId&&this.htmlLabelPool&&(this.htmlLabelPool.removeByIds([this.previewLabelId]),this.previewLabelId=null),this.segmentLabelIds.length&&this.htmlLabelPool&&this.htmlLabelPool.removeByIds(this.segmentLabelIds.slice()),this.segmentLabelIds=[],this.positions=[],this.currentPoints=[]}rehydrate(t,e){var M;const i=this.Cesium,r=this.viewer,s=t.options||{},o=((M=t.data)==null?void 0:M.sides)||s.sides||3,n=(t.positions||[]).map(P=>new i.Cartesian3(P[0],P[1],P[2]));if(n.length<2)return;if(!this.htmlLabelPool){const P=s.overlayContainerId||"html-label-container";this.htmlLabelPool=e||new W(i,r,P),this.htmlLabelPool.registerTheme("measure-regular",{createElement:(L,I)=>{var x;L.innerHTML=String(((x=I==null?void 0:I.data)==null?void 0:x.text)||""),L.style.background="rgba(0,0,0,0.6)",L.style.color="#fff",L.style.font="14px sans-serif",L.style.padding="4px 6px",L.style.borderRadius="4px",L.style.whiteSpace="pre"},options:{offset:{x:0,y:-10}}}),this.htmlLabelPool.registerTheme("measure-regular-seg",{createElement:(L,I)=>{var x;L.innerHTML=String(((x=I==null?void 0:I.data)==null?void 0:x.text)||""),L.style.background="rgba(0,0,0,0.6)",L.style.color="#fff",L.style.font="14px sans-serif",L.style.padding="4px 6px",L.style.borderRadius="4px",L.style.whiteSpace="pre"},options:{offset:{x:0,y:-10}}})}let h=[],l=n[0],c=0;if(n.length>=3){h=n.slice(),l=new i.Cartesian3(h.reduce((L,I)=>L+I.x,0)/h.length,h.reduce((L,I)=>L+I.y,0)/h.length,h.reduce((L,I)=>L+I.z,0)/h.length);const P=h[0];h[Math.floor(h.length/2)]||h[1],c=i.Cartesian3.distance(l,P)}else{const P=n[1];c=i.Cartesian3.distance(l,P),h=this.buildRegularPolygonPoints(l,c,Math.max(o,3))}const u=new i.PolygonHierarchy(h),m=new i.PolygonGeometry({polygonHierarchy:u,vertexFormat:i.MaterialAppearance.VERTEX_FORMAT,perPositionHeight:!0}),g=new i.GeometryInstance({geometry:m}),p=s.color||i.Color.YELLOW.withAlpha(.4),f=s.color&&s.color.withAlpha?s.color.withAlpha(.25):i.Color.RED.withAlpha(.4),w=new i.Primitive({geometryInstances:g,appearance:new i.MaterialAppearance({material:i.Material.fromType("Color",{color:p}),translucent:!0,closed:!0}),depthFailAppearance:new i.MaterialAppearance({material:i.Material.fromType("Color",{color:f}),translucent:!0,closed:!0})});r.scene.primitives.add(w),this.primitive=w;let y=0;for(let P=1;P<h.length;P++)y+=i.Cartesian3.distance(h[P-1],h[P]);const C=this.computeAreaByPlane(h),v=i.Cartographic.fromCartesian(l),b=t.id+"_regular";this.htmlLabelId=b;const E=s.labelText||{sides:"边数",radius:"半径",circumference:"周长",area:"面积",side:"边长"};this.htmlLabelPool.add({text:`${E.sides}:${Math.max(o,3)}
|
|
74
|
-
${E.radius}:${c.toFixed(2)} m
|
|
75
|
-
${E.circumference}:${y.toFixed(2)} m
|
|
76
|
-
${E.area}:${C.toFixed(2)} m²`},{id:b,lon:i.Math.toDegrees(v.longitude),lat:i.Math.toDegrees(v.latitude),height:v.height||0,theme:"measure-regular",show:!0});for(let P=1;P<h.length;P++){const L=h[P-1],I=h[P],x=i.Cartographic.fromCartesian(L),A=i.Cartographic.fromCartesian(I),R=new i.EllipsoidGeodesic(x,A).surfaceDistance,S=new i.Cartesian3((L.x+I.x)/2,(L.y+I.y)/2,(L.z+I.z)/2),_=i.Cartographic.fromCartesian(S),F=t.id+`_regular_seg_${P-1}`;this.segmentLabelIds.push(F),this.htmlLabelPool.add({text:`${E.side}:${R.toFixed(2)} m`},{id:F,lon:i.Math.toDegrees(_.longitude),lat:i.Math.toDegrees(_.latitude),height:_.height||0,theme:"measure-regular-seg",show:!0})}}buildRegularPolygonPoints(t,e,i){const r=this.Cesium,s=r.Cartographic.fromCartesian(t),o=360/i,n=[],h=s.height||0,l=.1;for(let c=0;c<360;c+=o){const u=r.Math.toRadians(c),m=new r.Cartographic(s.longitude+l*Math.cos(u),s.latitude+l*Math.sin(u),h),p=new r.EllipsoidGeodesic(s,m).interpolateUsingSurfaceDistance(e);p.height=h;const f=r.Ellipsoid.WGS84.cartographicToCartesian(p);n.push(f)}return n.push(n[0]),n}computeAreaByPlane(t){const e=this.Cesium,i=new e.Cartesian3(t.reduce((n,h)=>n+h.x,0)/t.length,t.reduce((n,h)=>n+h.y,0)/t.length,t.reduce((n,h)=>n+h.z,0)/t.length),s=new e.EllipsoidTangentPlane(i,e.Ellipsoid.WGS84).projectPointsOntoPlane(t);let o=0;for(let n=0;n<s.length;n++){const h=(n+1)%s.length;o+=s[n].x*s[h].y-s[h].x*s[n].y}return Math.abs(o)/2}}class _r{constructor({Cesium:t,viewer:e}){d(this,"Cesium");d(this,"viewer");d(this,"actives",[]);d(this,"measurements",[]);d(this,"htmlLabelPool",null);d(this,"recordHandlers",new Map);d(this,"specifiedClear",!1);d(this,"deleteLabelPool",null);d(this,"deleteLabelIds",new Map);this.Cesium=t,this.viewer=e,e.screenSpaceEventHandler.removeInputAction(t.ScreenSpaceEventType.LEFT_DOUBLE_CLICK)}measure(t,e){let i=null;switch(t){case"horizontal":i=new We(this.Cesium,this.viewer);break;case"vertical":i=new Ve(this.Cesium,this.viewer);break;case"triangle":i=new Ye(this.Cesium,this.viewer);break;case"space":i=new Ue(this.Cesium,this.viewer);break;case"area":i=new Ke(this.Cesium,this.viewer);break;case"circle":i=new qe(this.Cesium,this.viewer);break;case"polyline":i=new Xe(this.Cesium,this.viewer);break;case"terrainHeight":i=new Je(this.Cesium,this.viewer);break;case"coordinate":i=new Qe(this.Cesium,this.viewer);break;case"rectangle":i=new Ze(this.Cesium,this.viewer);break;case"regularPolygon":i=new et(this.Cesium,this.viewer);break;default:throw new Error(`Unsupported measurement type: ${t}`)}if(!i)return;this.actives.push(i);const r=i,s={...e,onComplete:o=>{var l;const n={id:`m_${Date.now()}_${this.measurements.length}`,type:t,options:(()=>{const c={...e};return"onComplete"in c&&delete c.onComplete,c})(),positions:(()=>{if(Array.isArray(o==null?void 0:o.positions))return o.positions.map(c=>[c.x,c.y,c.z]);switch(t){case"terrainHeight":{const c=o==null?void 0:o.position;return c?[[c.x,c.y,c.z]]:void 0}case"coordinate":{const c=o==null?void 0:o.lnglat;if(c&&typeof c.lng=="number"&&typeof c.lat=="number"){const u=this.Cesium.Cartesian3.fromDegrees(c.lng,c.lat,c.height||0);return[[u.x,u.y,u.z]]}return}default:return}})(),data:this._serializeMetrics(t,o)};this.measurements.push(n),r&&this.recordHandlers.set(n.id,r),this.specifiedClear&&this._showDeleteLabels("html-label-container"),(l=e.onComplete)==null||l.call(e,o);const h=this.actives.indexOf(r);h>=0&&this.actives.splice(h,1)}};i.start(s)}clear(){const t=this.actives.pop();t&&t.clear(),this._removeAllDeleteLabels(),this.specifiedClear=!1}cancel(){const t=this.actives.pop();t&&t.stop()}disableDefaultSelection({disableLeftClick:t=!1,disableDoubleClick:e=!0}={}){var r,s;const i=(s=(r=this.viewer)==null?void 0:r.cesiumWidget)==null?void 0:s.screenSpaceEventHandler;i&&(e&&i.removeInputAction(this.Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK),t&&i.removeInputAction(this.Cesium.ScreenSpaceEventType.LEFT_CLICK))}clearAll(){for(;this.actives.length;){const t=this.actives.pop();try{t==null||t.clear()}catch{}}for(const[,t]of this.recordHandlers)try{t.clear()}catch{}this.recordHandlers.clear(),this.measurements=[],this._removeAllDeleteLabels(),this.specifiedClear=!1}getMeasurementsConfig(){return{measurements:this.measurements.map(t=>({...t,options:t.options?{...t.options}:t.options,positions:t.positions?t.positions.map(e=>[e[0],e[1],e[2]]):t.positions,data:t.data?{...t.data}:t.data}))}}setMeasurementsConfig(t){var e,i;if((e=t==null?void 0:t.measurements)!=null&&e.length){for(const r of t.measurements){let s=null;switch(r.type){case"horizontal":s=new We(this.Cesium,this.viewer);break;case"vertical":s=new Ve(this.Cesium,this.viewer);break;case"triangle":s=new Ye(this.Cesium,this.viewer);break;case"space":s=new Ue(this.Cesium,this.viewer);break;case"area":s=new Ke(this.Cesium,this.viewer);break;case"circle":s=new qe(this.Cesium,this.viewer);break;case"polyline":s=new Xe(this.Cesium,this.viewer);break;case"terrainHeight":s=new Je(this.Cesium,this.viewer);break;case"coordinate":s=new Qe(this.Cesium,this.viewer);break;case"rectangle":s=new Ze(this.Cesium,this.viewer);break;case"regularPolygon":s=new et(this.Cesium,this.viewer);break;default:s=null}(i=s==null?void 0:s.rehydrate)==null||i.call(s,r,void 0),s&&r.id&&this.recordHandlers.set(r.id,s),this.measurements.find(n=>n.id===r.id)||this.measurements.push(r)}this.specifiedClear&&this._showDeleteLabels("html-label-container")}}_serializeMetrics(t,e){switch(t){case"space":return{distance:e==null?void 0:e.distance};case"horizontal":return{distance:e==null?void 0:e.distance};case"vertical":return{vertical:e==null?void 0:e.vertical};case"polyline":return{distance:e==null?void 0:e.distance};case"area":return{area:e==null?void 0:e.area};case"circle":return{radius:e==null?void 0:e.radius,area:e==null?void 0:e.area,perimeter:e==null?void 0:e.perimeter};case"rectangle":return{width:e==null?void 0:e.width,height:e==null?void 0:e.height,area:e==null?void 0:e.area};case"regularPolygon":return{sides:e==null?void 0:e.sides,radius:e==null?void 0:e.radius,perimeter:e==null?void 0:e.perimeter,area:e==null?void 0:e.area};case"triangle":return{lengths:e==null?void 0:e.lengths,angles:e==null?void 0:e.angles};case"terrainHeight":return{terrainHeight:e==null?void 0:e.terrainHeight,difference:e==null?void 0:e.difference,position:e==null?void 0:e.position,zeroPosition:e==null?void 0:e.zeroPosition};case"coordinate":return{lnglat:e==null?void 0:e.lnglat};default:return{}}}_toCartesian(t){const e=this.Cesium;return new e.Cartesian3(t[0],t[1],t[2])}_removeRecordVisual(t){const e=this.viewer;this.Cesium;const i=e.entities.values;for(let o=i.length-1;o>=0;o--){const n=i[o];try{e.entities.remove(n)}catch{}}const r=e.scene.primitives,s=[];r._primitives&&r._primitives.forEach(o=>s.push(o));for(const o of s)try{e.scene.primitives.remove(o)}catch{}this.htmlLabelPool&&this.htmlLabelPool.removeAll()}toggleSpecifiedClear(t){if(this.specifiedClear)this._removeAllDeleteLabels(),this.specifiedClear=!1;else{if(this.specifiedClear=!0,!this.deleteLabelPool){const e=t||"html-label-container";this.deleteLabelPool=new W(this.Cesium,this.viewer,e),this.deleteLabelPool.registerTheme("measure-delete-label",{createElement:(i,r)=>{i.innerHTML="删除",i.style.background="rgba(255,0,0,0.7)",i.style.color="#fff",i.style.font="12px sans-serif",i.style.padding="2px 6px",i.style.borderRadius="4px",i.style.whiteSpace="nowrap"},options:{offset:{x:0,y:-10}}}),this.deleteLabelPool.eventBus.addListener(Z.Click,{name:"measurement_delete_label_click",fn:i=>{var s;if(!i||i.theme!=="measure-delete-label")return;const r=(s=i==null?void 0:i.data)==null?void 0:s.recordId;r&&this.deleteMeasurement(r)}},!0)}this._showDeleteLabels(t||"html-label-container")}}deleteMeasurement(t){const e=this.recordHandlers.get(t);if(e)try{e.clear()}catch{}this.recordHandlers.delete(t),this.measurements=this.measurements.filter(r=>r.id!==t);const i=this.deleteLabelIds.get(t);i&&this.deleteLabelPool&&this.deleteLabelPool.removeByIds([i]),this.deleteLabelIds.delete(t)}_showDeleteLabels(t){if(!this.deleteLabelPool)return;const e=this.Cesium;for(const i of this.measurements){const r="m_del_"+i.id;if(this.deleteLabelIds.has(i.id))continue;const s=this._computeRecordCenter(i);if(!s)continue;const o=e.Cartographic.fromCartesian(s),n=e.Math.toDegrees(o.longitude),h=e.Math.toDegrees(o.latitude),l=o.height||0;this.deleteLabelPool.add({recordId:i.id},{id:r,lon:n,lat:h,height:l,theme:"measure-delete-label",show:!0,style:{zIndex:"1000"}}),this.deleteLabelIds.set(i.id,r)}}_removeAllDeleteLabels(){if(this.deleteLabelPool){const t=Array.from(this.deleteLabelIds.values());t.length&&this.deleteLabelPool.removeByIds(t)}this.deleteLabelIds.clear()}_computeRecordCenter(t){var r,s;const e=this.Cesium,i=(t.positions||[]).map(o=>this._toCartesian(o));if(i.length>0){const o=i.reduce((l,c)=>l+c.x,0)/i.length,n=i.reduce((l,c)=>l+c.y,0)/i.length,h=i.reduce((l,c)=>l+c.z,0)/i.length;return new e.Cartesian3(o,n,h)}if(t.type==="coordinate"&&((r=t.data)!=null&&r.lnglat)){const o=t.data.lnglat.lng,n=t.data.lnglat.lat,h=t.data.lnglat.height||0;return e.Cartesian3.fromDegrees(o,n,h)}if(t.type==="terrainHeight"&&((s=t.data)!=null&&s.position)){const o=t.data.position;return new e.Cartesian3(o.x,o.y,o.z)}return null}}class Dr{constructor({Cesium:t,viewer:e}){d(this,"Cesium");d(this,"viewer");d(this,"options",null);d(this,"entity",null);d(this,"viewEntities",[]);d(this,"startTime",null);d(this,"stopTime",null);d(this,"isPaused",!1);d(this,"lastTime",null);d(this,"onTick",t=>{if(!this.options||!this.entity)return;const e=t.currentTime;if(this.Cesium.JulianDate.lessThan(e,this.startTime)||this.Cesium.JulianDate.greaterThan(e,this.stopTime)){!this.options.loop&&this.Cesium.JulianDate.greaterThan(e,this.stopTime)&&this.viewer.clock.shouldAnimate&&(this.viewer.clock.shouldAnimate=!1,this.options.onComplete&&this.options.onComplete());return}const i=this.entity.position.getValue(e),r=this.entity.orientation.getValue(e);if(i&&r){const s=this.Cesium.Matrix4.fromTranslationQuaternionRotationScale(i,r,new this.Cesium.Cartesian3(1,1,1),new this.Cesium.Matrix4),o=this.Cesium.Transforms.fixedFrameToHeadingPitchRoll(s,this.viewer.scene.globe.ellipsoid,this.Cesium.Transforms.eastNorthUpToFixedFrame,new this.Cesium.HeadingPitchRoll);this.viewer.camera.setView({destination:i,orientation:{heading:o.heading,pitch:o.pitch,roll:o.roll}}),this.options.onTick&&this.options.onTick(e,i,o)}});this.Cesium=t,this.viewer=e}get Viewer(){return this.viewer}get CesiumInstance(){return this.Cesium}start(t){this.clear(),this.options=t,!((t.waypoints||[]).length<2)&&(this._setupEntities(t),this.viewer.clock.startTime=this.startTime.clone(),this.viewer.clock.stopTime=this.stopTime.clone(),this.viewer.clock.currentTime=this.startTime.clone(),this.viewer.clock.clockRange=t.loop?this.Cesium.ClockRange.LOOP_STOP:this.Cesium.ClockRange.CLAMPED,this.viewer.clock.multiplier=1,this.viewer.clock.shouldAnimate=!0,this.viewer.clock.onTick.addEventListener(this.onTick))}preview(t){this.clear(),this.options=t,!((t.waypoints||[]).length<2)&&this._setupEntities(t)}_setupEntities(t){const e=t.waypoints||[],i=new this.Cesium.SampledPositionProperty,r=new this.Cesium.SampledProperty(this.Cesium.Quaternion),s=[];for(const u of e){let m;u.destination?u.destination.x!==void 0?m=new this.Cesium.Cartesian3(u.destination.x,u.destination.y,u.destination.z):m=u.destination:u.lon!==void 0&&u.lat!==void 0&&(m=this.Cesium.Cartesian3.fromDegrees(u.lon,u.lat,u.height??0));let g;u.orientation?g=new this.Cesium.HeadingPitchRoll(u.orientation.heading,u.orientation.pitch,u.orientation.roll):g=this.Cesium.HeadingPitchRoll.fromDegrees(u.heading??0,u.pitch??-30,u.roll??0);const p=this.Cesium.Transforms.headingPitchRollQuaternion(m,g);s.push({position:m,orientation:p})}const o=this.Cesium.JulianDate.now(),n=t.speed||100;let h=0;const l=[];for(let u=0;u<s.length;u++){if(u===0)l.push(o.clone());else{const g=this.Cesium.Cartesian3.distance(s[u-1].position,s[u].position)/Math.max(n,.1);h+=g,l.push(this.Cesium.JulianDate.addSeconds(o,h,new this.Cesium.JulianDate))}i.addSample(l[u],s[u].position),r.addSample(l[u],s[u].orientation)}this.startTime=l[0],this.stopTime=l[l.length-1];const c={availability:new this.Cesium.TimeIntervalCollection([new this.Cesium.TimeInterval({start:this.startTime,stop:this.stopTime})]),position:i,orientation:r};t.modelUrl?c.model={uri:t.modelUrl,scale:t.modelScale??1,minimumPixelSize:64,runAnimations:t.modelAnimate??!0}:c.point={pixelSize:1,color:this.Cesium.Color.TRANSPARENT},t.showPath&&this.viewEntities.push(this.viewer.entities.add({polyline:{positions:s.map(u=>u.position),width:3,material:this.Cesium.Color.GREEN}})),this.entity=this.viewer.entities.add(c),t.showStops&&s.forEach((u,m)=>{const g=this.Cesium.Cartographic.fromCartesian(u.position),p=this.Cesium.Cartesian3.fromRadians(g.longitude,g.latitude,0);this.viewEntities.push(this.viewer.entities.add({position:u.position,point:{pixelSize:8,color:this.Cesium.Color.YELLOW,outlineColor:this.Cesium.Color.BLACK,outlineWidth:1},label:{text:""+(m+1),font:"12px sans-serif",pixelOffset:new this.Cesium.Cartesian2(0,-15),fillColor:this.Cesium.Color.WHITE,outlineColor:this.Cesium.Color.BLACK,outlineWidth:2,style:this.Cesium.LabelStyle.FILL_AND_OUTLINE},polyline:{positions:[u.position,p],width:2,material:new this.Cesium.PolylineDashMaterialProperty({color:this.Cesium.Color.RED,dashLength:16})}}))})}stop(){this.viewer.clock.shouldAnimate=!1,this.viewer.clock.onTick.removeEventListener(this.onTick)}pause(){this.viewer.clock.shouldAnimate=!1,this.isPaused=!0}resume(){this.viewer.clock.shouldAnimate=!0,this.isPaused=!1}clear(){this.stop(),this.entity&&(this.viewer.entities.remove(this.entity),this.entity=null);for(const t of this.viewEntities)this.viewer.entities.remove(t);this.viewEntities=[],this.options=null}captureCurrentView(){const t=this.viewer.camera.position.clone(),e=this.viewer.camera.heading,i=this.viewer.camera.pitch,r=this.viewer.camera.roll;return{destination:{x:t.x,y:t.y,z:t.z},orientation:{heading:e,pitch:i,roll:r}}}}class Sr{constructor({Cesium:t,viewer:e}){d(this,"Cesium");d(this,"viewer");d(this,"entity",null);d(this,"positionProperty",null);d(this,"startTime",null);d(this,"stopTime",null);d(this,"options",null);d(this,"cameraOffset",null);d(this,"onTick",t=>{if(!this.options||!this.positionProperty)return;const e=t.currentTime,i=this.positionProperty.getValue(e);if(this.options.followCamera&&this.options.initialView&&i){this.cameraOffset||(this.cameraOffset=this.Cesium.Cartesian3.subtract(this.options.initialView.destination,i,new this.Cesium.Cartesian3));const r=this.Cesium.Cartesian3.add(i,this.cameraOffset,new this.Cesium.Cartesian3);this.viewer.camera.setView({destination:r,orientation:this.options.initialView.orientation})}i&&this.options.onTick&&this.options.onTick(e,i),this.Cesium.JulianDate.greaterThanOrEquals(e,this.stopTime)&&(this.options.loop||(this.options.onComplete&&this.options.onComplete(),this.stop()))});this.Cesium=t,this.viewer=e}get Viewer(){return this.viewer}get CesiumInstance(){return this.Cesium}start(t){this.clear(),this.options=t;const e=this.normalizePositions(t.positions||[]);if(!e.length)return;const i=t.speed??30,r=this.buildTimes(e,i),s=new this.Cesium.SampledPositionProperty;for(let g=0;g<e.length;g++)s.addSample(r[g],e[g]);this.positionProperty=s;const o=new this.Cesium.VelocityOrientationProperty(s),n=t.showPath??!0,h=t.pathColor??this.Cesium.Color.YELLOW,l=t.pathWidth??3,c=t.pointColor??this.Cesium.Color.RED,u=t.pointPixelSize??8,m={availability:new this.Cesium.TimeIntervalCollection([new this.Cesium.TimeInterval({start:this.startTime,stop:this.stopTime})]),position:s,orientation:o,path:n?{material:h,width:l,leadTime:0}:void 0};t.modelUrl?m.model={uri:t.modelUrl,scale:t.modelScale??1,minimumPixelSize:64,runAnimations:t.modelAnimate??!0}:m.point={color:c,pixelSize:u},this.entity=this.viewer.entities.add(m),this.viewer.clock.startTime=this.startTime.clone(),this.viewer.clock.stopTime=this.stopTime.clone(),this.viewer.clock.currentTime=this.startTime.clone(),this.viewer.clock.clockRange=t.loop?this.Cesium.ClockRange.LOOP_STOP:this.Cesium.ClockRange.CLAMPED,this.viewer.clock.multiplier=1,this.viewer.clock.shouldAnimate=!0,t.initialView?(this.viewer.camera.setView({destination:t.initialView.destination,orientation:t.initialView.orientation}),this.cameraOffset=null):t.followCamera?this.viewer.trackedEntity=this.entity:t.lookAtOffset&&this.viewer.camera.lookAt(this.entity.position,t.lookAtOffset),this.viewer.clock.onTick.addEventListener(this.onTick)}stop(){this.viewer.clock.shouldAnimate=!1,this.viewer.clock.onTick.removeEventListener(this.onTick),this.viewer.trackedEntity===this.entity&&(this.viewer.trackedEntity=void 0)}clear(){this.stop(),this.entity&&(this.viewer.entities.remove(this.entity),this.entity=null),this.positionProperty=null,this.startTime=null,this.stopTime=null,this.options=null;try{this.viewer.camera.lookAtTransform(this.Cesium.Matrix4.IDENTITY)}catch{}}normalizePositions(t){const e=[];for(const i of t)if(Array.isArray(i)){const[r,s,o]=i;e.push(this.Cesium.Cartesian3.fromDegrees(r,s,o??0))}else(i==null?void 0:i.x)!==void 0&&(i==null?void 0:i.y)!==void 0&&(i==null?void 0:i.z)!==void 0&&e.push(i);return e}buildTimes(t,e){const i=[],r=this.Cesium.JulianDate.now();let s=0;for(let o=0;o<t.length;o++)if(o===0)i.push(r.clone());else{const n=this.Cesium.Cartesian3.distance(t[o-1],t[o]);s+=n/Math.max(e,.1),i.push(this.Cesium.JulianDate.addSeconds(r,s,new this.Cesium.JulianDate))}return this.startTime=i[0],this.stopTime=i[i.length-1],i}}T.AreaMeasure=Ke,T.BufferedHierarchicalAggregator=ne,T.CameraRoamTool=Dr,T.CircleMeasure=qe,T.CoordinateMeasure=Qe,T.DOM_EVENT_MAP=it,T.DrawTool=Yt,T.EditMode=zt,T.EntityLayerManager=Ir,T.GLTFManage=Cr,T.GLTFManageEventKey=Gt,T.HorizontalMeasure=We,T.HtmlOverlayLabelPool=W,T.MarkerEventBus=tt,T.MarkerEventKey=Z,T.MaterialManager=Lr,T.MeasurementTool=_r,T.PathRoamTool=Sr,T.PolylineDistanceMeasure=Xe,T.PrimitiveManager=xr,T.RectangleMeasure=Ze,T.RegularPolygonMeasure=et,T.SpaceMeasure=Ue,T.TerrainHeightMeasure=Je,T.TooltipManager=xe,T.TriangleMeasure=Ye,T.VerticalMeasure=Ve,T.convertGeoJsonToEntityData=Tr,T.getDynamicImgMaterial=vr,T.getPolylineFlowMaterialProperty=Pr,T.getWallMaterial=br,Object.defineProperty(T,Symbol.toStringTag,{value:"Module"})}));
|
|
77
|
-
//# sourceMappingURL=cesium-core.umd.js.map
|