leiting-bim 2.1.36 → 2.1.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/leiting-bim.es.js +1 -1
- package/leiting-bim.umd.js +11 -11
- package/leitingbim.css +1 -1
- package/package.json +1 -1
- package/plugins/.gitmodules +4 -0
- package/plugins/README.md +2 -0
- package/plugins/build.cjs +63 -0
- package/plugins/cesium-core/dist/cesium-core.mjs +6217 -0
- package/plugins/cesium-core/dist/cesium-core.umd.js +76 -0
- package/plugins/cesium-core/dist/components/BufferedHierarchicalAggregator.d.ts +73 -0
- package/plugins/cesium-core/dist/components/HtmlOverlayLabelPool.d.ts +152 -0
- package/plugins/cesium-core/dist/components/MarkerEvent.d.ts +38 -0
- package/plugins/cesium-core/dist/components/Material/MaterialManager.d.ts +49 -0
- package/plugins/cesium-core/dist/components/Material/help/PolylineFlowMaterialProperty.d.ts +10 -0
- package/plugins/cesium-core/dist/components/Material/help/dynamicImgMaterial.d.ts +16 -0
- package/plugins/cesium-core/dist/components/Material/index.d.ts +3 -0
- package/plugins/cesium-core/dist/components/TooltipManager.d.ts +11 -0
- package/plugins/cesium-core/dist/components/draw/DrawTool.d.ts +10 -0
- package/plugins/cesium-core/dist/components/draw/handlers/CircleDrawer.d.ts +16 -0
- package/plugins/cesium-core/dist/components/draw/handlers/LineDrawer.d.ts +14 -0
- package/plugins/cesium-core/dist/components/draw/handlers/PointDrawer.d.ts +12 -0
- package/plugins/cesium-core/dist/components/draw/handlers/PolygonDrawer.d.ts +14 -0
- package/plugins/cesium-core/dist/components/draw/handlers/RectangleDrawer.d.ts +13 -0
- package/plugins/cesium-core/dist/components/draw/types.d.ts +29 -0
- package/plugins/cesium-core/dist/components/entity/EntityLayer.d.ts +65 -0
- package/plugins/cesium-core/dist/components/gltf/GLTFManage.d.ts +141 -0
- package/plugins/cesium-core/dist/components/gltf/index.d.ts +1 -0
- package/plugins/cesium-core/dist/components/measurement/MeasurementTool.d.ts +34 -0
- package/plugins/cesium-core/dist/components/measurement/handlers/AreaMeasure.d.ts +28 -0
- package/plugins/cesium-core/dist/components/measurement/handlers/CircleMeasure.d.ts +22 -0
- package/plugins/cesium-core/dist/components/measurement/handlers/CoordinateMeasure.d.ts +16 -0
- package/plugins/cesium-core/dist/components/measurement/handlers/HorizontalMeasure.d.ts +27 -0
- package/plugins/cesium-core/dist/components/measurement/handlers/PolylineDistanceMeasure.d.ts +25 -0
- package/plugins/cesium-core/dist/components/measurement/handlers/RectangleMeasure.d.ts +30 -0
- package/plugins/cesium-core/dist/components/measurement/handlers/RegularPolygonMeasure.d.ts +28 -0
- package/plugins/cesium-core/dist/components/measurement/handlers/SpaceMeasure.d.ts +21 -0
- package/plugins/cesium-core/dist/components/measurement/handlers/TerrainHeightMeasure.d.ts +18 -0
- package/plugins/cesium-core/dist/components/measurement/handlers/TriangleMeasure.d.ts +30 -0
- package/plugins/cesium-core/dist/components/measurement/handlers/VerticalMeasure.d.ts +23 -0
- package/plugins/cesium-core/dist/components/measurement/index.d.ts +13 -0
- package/plugins/cesium-core/dist/components/measurement/types.d.ts +42 -0
- package/plugins/cesium-core/dist/components/primitive/PrimitiveManager.d.ts +50 -0
- package/plugins/cesium-core/dist/components/roaming/CameraRoamTool.d.ts +27 -0
- package/plugins/cesium-core/dist/components/roaming/PathRoamTool.d.ts +23 -0
- package/plugins/cesium-core/dist/components/roaming/index.d.ts +3 -0
- package/plugins/cesium-core/dist/components/roaming/types.d.ts +66 -0
- package/plugins/cesium-core/dist/components/utils/convertGeoJsonToEntityData.d.ts +1 -0
- package/plugins/cesium-core/dist/components/utils/uuid.d.ts +1 -0
- package/plugins/cesium-core/dist/index.d.ts +12 -0
- package/plugins/cesium-core/package.json +27 -0
- package/plugins/cesium-core/pnpm-lock.yaml +872 -0
- package/plugins/cesium-core/src/components/BufferedHierarchicalAggregator.ts +546 -0
- package/plugins/cesium-core/src/components/HtmlOverlayLabelPool.ts +489 -0
- package/plugins/cesium-core/src/components/MarkerEvent.ts +92 -0
- package/plugins/cesium-core/src/components/Material/MaterialManager.ts +129 -0
- package/plugins/cesium-core/src/components/Material/help/PolylineFlowMaterialProperty.ts +116 -0
- package/plugins/cesium-core/src/components/Material/help/dynamicImgMaterial.ts +236 -0
- package/plugins/cesium-core/src/components/Material/index.ts +3 -0
- package/plugins/cesium-core/src/components/TooltipManager.ts +52 -0
- package/plugins/cesium-core/src/components/draw/DrawTool.ts +55 -0
- package/plugins/cesium-core/src/components/draw/handlers/CircleDrawer.ts +159 -0
- package/plugins/cesium-core/src/components/draw/handlers/LineDrawer.ts +113 -0
- package/plugins/cesium-core/src/components/draw/handlers/PointDrawer.ts +70 -0
- package/plugins/cesium-core/src/components/draw/handlers/PolygonDrawer.ts +112 -0
- package/plugins/cesium-core/src/components/draw/handlers/RectangleDrawer.ts +115 -0
- package/plugins/cesium-core/src/components/draw/types.ts +28 -0
- package/plugins/cesium-core/src/components/entity/EntityLayer.ts +453 -0
- package/plugins/cesium-core/src/components/gltf/GLTFManage.ts +799 -0
- package/plugins/cesium-core/src/components/gltf/index.ts +1 -0
- package/plugins/cesium-core/src/components/measurement/MeasurementTool.ts +416 -0
- package/plugins/cesium-core/src/components/measurement/handlers/AreaMeasure.ts +552 -0
- package/plugins/cesium-core/src/components/measurement/handlers/CircleMeasure.ts +289 -0
- package/plugins/cesium-core/src/components/measurement/handlers/CoordinateMeasure.ts +139 -0
- package/plugins/cesium-core/src/components/measurement/handlers/HorizontalMeasure.ts +427 -0
- package/plugins/cesium-core/src/components/measurement/handlers/PolylineDistanceMeasure.ts +356 -0
- package/plugins/cesium-core/src/components/measurement/handlers/RectangleMeasure.ts +516 -0
- package/plugins/cesium-core/src/components/measurement/handlers/RegularPolygonMeasure.ts +472 -0
- package/plugins/cesium-core/src/components/measurement/handlers/SpaceMeasure.ts +250 -0
- package/plugins/cesium-core/src/components/measurement/handlers/TerrainHeightMeasure.ts +185 -0
- package/plugins/cesium-core/src/components/measurement/handlers/TriangleMeasure.ts +561 -0
- package/plugins/cesium-core/src/components/measurement/handlers/VerticalMeasure.ts +361 -0
- package/plugins/cesium-core/src/components/measurement/index.ts +13 -0
- package/plugins/cesium-core/src/components/measurement/types.ts +57 -0
- package/plugins/cesium-core/src/components/primitive/PrimitiveManager.ts +556 -0
- package/plugins/cesium-core/src/components/roaming/CameraRoamTool.ts +286 -0
- package/plugins/cesium-core/src/components/roaming/PathRoamTool.ts +174 -0
- package/plugins/cesium-core/src/components/roaming/index.ts +3 -0
- package/plugins/cesium-core/src/components/roaming/types.ts +71 -0
- package/plugins/cesium-core/src/components/utils/convertGeoJsonToEntityData.ts +98 -0
- package/plugins/cesium-core/src/components/utils/uuid.ts +7 -0
- package/plugins/cesium-core/src/index.ts +17 -0
- package/plugins/cesium-core/src/test/measurement/index.html +166 -0
- package/plugins/cesium-core/src/test/roaming/c.gltf +1 -0
- package/plugins/cesium-core/src/test/roaming/f87cc3ea918a4b76bff2c88a3655eb1f.bin +0 -0
- package/plugins/cesium-core/src/test/roaming/index.html +51 -0
- package/plugins/cesium-core/src/test/roaming/path.html +448 -0
- package/plugins/cesium-core/src/test/roaming/view.html +520 -0
- package/plugins/cesium-core/stats.html +4949 -0
- package/plugins/cesium-core/tsconfig.json +14 -0
- package/plugins/cesium-core/vite.config.ts +35 -0
- package/plugins/cesium-vue/dist/_commonjsHelpers-DaMA6jEr.js +8 -0
- package/plugins/cesium-vue/dist/components/basic-audio/index.d.ts +13 -0
- package/plugins/cesium-vue/dist/components/basic-audio.d.ts +6 -0
- package/plugins/cesium-vue/dist/components/basic-audio.js +1295 -0
- package/plugins/cesium-vue/dist/components/basic-video/index.d.ts +98 -0
- package/plugins/cesium-vue/dist/components/basic-video.d.ts +6 -0
- package/plugins/cesium-vue/dist/components/basic-video.js +67 -0
- package/plugins/cesium-vue/dist/components/card-carousel/index.d.ts +147 -0
- package/plugins/cesium-vue/dist/components/card-carousel.d.ts +6 -0
- package/plugins/cesium-vue/dist/components/card-carousel.js +143 -0
- package/plugins/cesium-vue/dist/components/card-content/index.d.ts +16 -0
- package/plugins/cesium-vue/dist/components/card-content.d.ts +6 -0
- package/plugins/cesium-vue/dist/components/card-content.js +74 -0
- package/plugins/cesium-vue/dist/components/card-page/index.d.ts +64 -0
- package/plugins/cesium-vue/dist/components/card-page.d.ts +6 -0
- package/plugins/cesium-vue/dist/components/card-page.js +111 -0
- package/plugins/cesium-vue/dist/components/carousel-img/index.d.ts +34 -0
- package/plugins/cesium-vue/dist/components/carousel-img.d.ts +6 -0
- package/plugins/cesium-vue/dist/components/carousel-img.js +72 -0
- package/plugins/cesium-vue/dist/components/echarts-pro/index.d.ts +63 -0
- package/plugins/cesium-vue/dist/components/echarts-pro.d.ts +6 -0
- package/plugins/cesium-vue/dist/components/echarts-pro.js +7 -0
- package/plugins/cesium-vue/dist/components/marker-bubble/index.d.ts +73 -0
- package/plugins/cesium-vue/dist/components/marker-bubble.d.ts +6 -0
- package/plugins/cesium-vue/dist/components/marker-bubble.js +123 -0
- package/plugins/cesium-vue/dist/components/marker-default/index.d.ts +43 -0
- package/plugins/cesium-vue/dist/components/marker-default.d.ts +6 -0
- package/plugins/cesium-vue/dist/components/marker-default.js +39 -0
- package/plugins/cesium-vue/dist/components/marker-html/index.d.ts +43 -0
- package/plugins/cesium-vue/dist/components/marker-html.d.ts +6 -0
- package/plugins/cesium-vue/dist/components/marker-html.js +40 -0
- package/plugins/cesium-vue/dist/components/marker-manage/index.d.ts +159 -0
- package/plugins/cesium-vue/dist/components/marker-manage.d.ts +6 -0
- package/plugins/cesium-vue/dist/components/marker-manage.js +896 -0
- package/plugins/cesium-vue/dist/components/marker-text/index.d.ts +25 -0
- package/plugins/cesium-vue/dist/components/marker-text.d.ts +6 -0
- package/plugins/cesium-vue/dist/components/marker-text.js +30 -0
- package/plugins/cesium-vue/dist/components/measurement/index.d.ts +73 -0
- package/plugins/cesium-vue/dist/components/measurement.d.ts +6 -0
- package/plugins/cesium-vue/dist/components/measurement.js +170 -0
- package/plugins/cesium-vue/dist/create-DynflqE1.js +31 -0
- package/plugins/cesium-vue/dist/index-B03tSn8_.js +45855 -0
- package/plugins/cesium-vue/dist/index-CUs_hd1V.js +403 -0
- package/plugins/cesium-vue/dist/index.d.ts +44 -0
- package/plugins/cesium-vue/dist/index.js +82 -0
- package/plugins/cesium-vue/package.json +106 -0
- 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 +6 -0
- package/plugins/cesium-vue/src/components/basic-audio/src/BasicAudio.vue +119 -0
- package/plugins/cesium-vue/src/components/basic-audio/src/basicAudio.ts +6 -0
- package/plugins/cesium-vue/src/components/basic-video/index.ts +7 -0
- package/plugins/cesium-vue/src/components/basic-video/src/BasicVideo.vue +58 -0
- package/plugins/cesium-vue/src/components/basic-video/src/basicVideo.ts +14 -0
- package/plugins/cesium-vue/src/components/card-carousel/index.ts +7 -0
- package/plugins/cesium-vue/src/components/card-carousel/src/CardCarousel.vue +124 -0
- package/plugins/cesium-vue/src/components/card-carousel/src/cardCarousel.ts +60 -0
- package/plugins/cesium-vue/src/components/card-content/index.ts +7 -0
- package/plugins/cesium-vue/src/components/card-content/src/CardContent.vue +41 -0
- package/plugins/cesium-vue/src/components/card-content/src/cardContent.ts +22 -0
- package/plugins/cesium-vue/src/components/card-page/index.ts +7 -0
- package/plugins/cesium-vue/src/components/card-page/src/CardPage.vue +102 -0
- package/plugins/cesium-vue/src/components/card-page/src/cardPage.ts +37 -0
- package/plugins/cesium-vue/src/components/carousel-img/index.ts +7 -0
- package/plugins/cesium-vue/src/components/carousel-img/src/CarouselImg.vue +84 -0
- package/plugins/cesium-vue/src/components/carousel-img/src/carouselImg.ts +8 -0
- package/plugins/cesium-vue/src/components/echarts-pro/index.ts +7 -0
- package/plugins/cesium-vue/src/components/echarts-pro/src/EchartsPro.vue +107 -0
- package/plugins/cesium-vue/src/components/echarts-pro/src/echartsPro.ts +12 -0
- package/plugins/cesium-vue/src/components/echarts-pro/src/hook/useECharts.ts +55 -0
- package/plugins/cesium-vue/src/components/marker-bubble/index.ts +7 -0
- package/plugins/cesium-vue/src/components/marker-bubble/src/MarkerBubble.vue +235 -0
- package/plugins/cesium-vue/src/components/marker-bubble/src/markerBubble.ts +35 -0
- package/plugins/cesium-vue/src/components/marker-default/index.ts +7 -0
- package/plugins/cesium-vue/src/components/marker-default/src/MarkerDefault.vue +19 -0
- package/plugins/cesium-vue/src/components/marker-default/src/markerDefault.ts +12 -0
- package/plugins/cesium-vue/src/components/marker-html/index.ts +7 -0
- package/plugins/cesium-vue/src/components/marker-html/src/MarkerHtml.vue +21 -0
- package/plugins/cesium-vue/src/components/marker-html/src/markerHtml.ts +12 -0
- package/plugins/cesium-vue/src/components/marker-manage/index.ts +9 -0
- package/plugins/cesium-vue/src/components/marker-manage/src/components/MarkerManage.vue +106 -0
- package/plugins/cesium-vue/src/components/marker-manage/src/config/theme.ts +8 -0
- package/plugins/cesium-vue/src/components/marker-manage/src/core/MarkerManage.ts +466 -0
- package/plugins/cesium-vue/src/components/marker-manage/src/core/MarkerManagerCore.ts +148 -0
- package/plugins/cesium-vue/src/components/marker-manage/src/hook/useMarkerManage.ts +45 -0
- package/plugins/cesium-vue/src/components/marker-manage/src/type/markerManage.ts +75 -0
- package/plugins/cesium-vue/src/components/marker-manage/src/utils/themeTool.ts +154 -0
- package/plugins/cesium-vue/src/components/marker-text/index.ts +7 -0
- package/plugins/cesium-vue/src/components/marker-text/src/MarkerText.vue +14 -0
- package/plugins/cesium-vue/src/components/marker-text/src/markerText.ts +10 -0
- package/plugins/cesium-vue/src/components/measurement/index.ts +7 -0
- package/plugins/cesium-vue/src/components/measurement/src/Measurement.vue +183 -0
- package/plugins/cesium-vue/src/components/measurement/src/measurement.ts +20 -0
- package/plugins/cesium-vue/src/index.ts +89 -0
- package/plugins/cesium-vue/stats.html +4949 -0
- package/plugins/cesium-vue/tsconfig.json +18 -0
- package/plugins/cesium-vue/vite.config.ts +62 -0
- package/plugins/plugins/README.md +2 -0
- package/plugins/plugins/build.cjs +63 -0
- package/plugins/plugins/cesium-core/dist/cesium-core.mjs +5881 -0
- package/plugins/plugins/cesium-core/dist/cesium-core.mjs.map +1 -0
- package/plugins/plugins/cesium-core/dist/cesium-core.umd.js +77 -0
- package/plugins/plugins/cesium-core/dist/cesium-core.umd.js.map +1 -0
- package/plugins/plugins/cesium-core/dist/components/BufferedHierarchicalAggregator.d.ts +73 -0
- package/plugins/plugins/cesium-core/dist/components/HtmlOverlayLabelPool.d.ts +152 -0
- package/plugins/plugins/cesium-core/dist/components/MarkerEvent.d.ts +38 -0
- package/plugins/plugins/cesium-core/dist/components/Material/MaterialManager.d.ts +49 -0
- package/plugins/plugins/cesium-core/dist/components/Material/help/PolylineFlowMaterialProperty.d.ts +10 -0
- package/plugins/plugins/cesium-core/dist/components/Material/help/dynamicImgMaterial.d.ts +16 -0
- package/plugins/plugins/cesium-core/dist/components/Material/index.d.ts +3 -0
- package/plugins/plugins/cesium-core/dist/components/TooltipManager.d.ts +11 -0
- package/plugins/plugins/cesium-core/dist/components/draw/DrawTool.d.ts +10 -0
- package/plugins/plugins/cesium-core/dist/components/draw/handlers/CircleDrawer.d.ts +16 -0
- package/plugins/plugins/cesium-core/dist/components/draw/handlers/LineDrawer.d.ts +14 -0
- package/plugins/plugins/cesium-core/dist/components/draw/handlers/PointDrawer.d.ts +12 -0
- package/plugins/plugins/cesium-core/dist/components/draw/handlers/PolygonDrawer.d.ts +14 -0
- package/plugins/plugins/cesium-core/dist/components/draw/handlers/RectangleDrawer.d.ts +13 -0
- package/plugins/plugins/cesium-core/dist/components/draw/types.d.ts +29 -0
- package/plugins/plugins/cesium-core/dist/components/entity/EntityLayer.d.ts +65 -0
- package/plugins/plugins/cesium-core/dist/components/gltf/GLTFManage.d.ts +141 -0
- package/plugins/plugins/cesium-core/dist/components/gltf/index.d.ts +1 -0
- package/plugins/plugins/cesium-core/dist/components/measurement/MeasurementTool.d.ts +34 -0
- package/plugins/plugins/cesium-core/dist/components/measurement/handlers/AreaMeasure.d.ts +23 -0
- package/plugins/plugins/cesium-core/dist/components/measurement/handlers/CircleMeasure.d.ts +21 -0
- package/plugins/plugins/cesium-core/dist/components/measurement/handlers/CoordinateMeasure.d.ts +16 -0
- package/plugins/plugins/cesium-core/dist/components/measurement/handlers/HorizontalMeasure.d.ts +25 -0
- package/plugins/plugins/cesium-core/dist/components/measurement/handlers/PolylineDistanceMeasure.d.ts +24 -0
- package/plugins/plugins/cesium-core/dist/components/measurement/handlers/RectangleMeasure.d.ts +22 -0
- package/plugins/plugins/cesium-core/dist/components/measurement/handlers/RegularPolygonMeasure.d.ts +23 -0
- package/plugins/plugins/cesium-core/dist/components/measurement/handlers/SpaceMeasure.d.ts +20 -0
- package/plugins/plugins/cesium-core/dist/components/measurement/handlers/TerrainHeightMeasure.d.ts +18 -0
- package/plugins/plugins/cesium-core/dist/components/measurement/handlers/TriangleMeasure.d.ts +24 -0
- package/plugins/plugins/cesium-core/dist/components/measurement/handlers/VerticalMeasure.d.ts +23 -0
- package/plugins/plugins/cesium-core/dist/components/measurement/index.d.ts +13 -0
- package/plugins/plugins/cesium-core/dist/components/measurement/types.d.ts +42 -0
- package/plugins/plugins/cesium-core/dist/components/primitive/PrimitiveManager.d.ts +50 -0
- package/plugins/plugins/cesium-core/dist/components/roaming/CameraRoamTool.d.ts +27 -0
- package/plugins/plugins/cesium-core/dist/components/roaming/PathRoamTool.d.ts +23 -0
- package/plugins/plugins/cesium-core/dist/components/roaming/index.d.ts +3 -0
- package/plugins/plugins/cesium-core/dist/components/roaming/types.d.ts +66 -0
- package/plugins/plugins/cesium-core/dist/components/utils/convertGeoJsonToEntityData.d.ts +1 -0
- package/plugins/plugins/cesium-core/dist/components/utils/uuid.d.ts +1 -0
- package/plugins/plugins/cesium-core/dist/index.d.ts +12 -0
- package/plugins/plugins/cesium-core/package.json +26 -0
- package/plugins/plugins/cesium-core/pnpm-lock.yaml +872 -0
- package/plugins/plugins/cesium-core/src/components/BufferedHierarchicalAggregator.ts +546 -0
- package/plugins/plugins/cesium-core/src/components/HtmlOverlayLabelPool.ts +489 -0
- package/plugins/plugins/cesium-core/src/components/MarkerEvent.ts +92 -0
- package/plugins/plugins/cesium-core/src/components/Material/MaterialManager.ts +129 -0
- package/plugins/plugins/cesium-core/src/components/Material/help/PolylineFlowMaterialProperty.ts +116 -0
- package/plugins/plugins/cesium-core/src/components/Material/help/dynamicImgMaterial.ts +236 -0
- package/plugins/plugins/cesium-core/src/components/Material/index.ts +3 -0
- package/plugins/plugins/cesium-core/src/components/TooltipManager.ts +52 -0
- package/plugins/plugins/cesium-core/src/components/draw/DrawTool.ts +55 -0
- package/plugins/plugins/cesium-core/src/components/draw/handlers/CircleDrawer.ts +159 -0
- package/plugins/plugins/cesium-core/src/components/draw/handlers/LineDrawer.ts +113 -0
- package/plugins/plugins/cesium-core/src/components/draw/handlers/PointDrawer.ts +70 -0
- package/plugins/plugins/cesium-core/src/components/draw/handlers/PolygonDrawer.ts +112 -0
- package/plugins/plugins/cesium-core/src/components/draw/handlers/RectangleDrawer.ts +115 -0
- package/plugins/plugins/cesium-core/src/components/draw/types.ts +28 -0
- package/plugins/plugins/cesium-core/src/components/entity/EntityLayer.ts +453 -0
- package/plugins/plugins/cesium-core/src/components/gltf/GLTFManage.ts +799 -0
- package/plugins/plugins/cesium-core/src/components/gltf/index.ts +1 -0
- package/plugins/plugins/cesium-core/src/components/measurement/MeasurementTool.ts +416 -0
- package/plugins/plugins/cesium-core/src/components/measurement/handlers/AreaMeasure.ts +451 -0
- package/plugins/plugins/cesium-core/src/components/measurement/handlers/CircleMeasure.ts +267 -0
- package/plugins/plugins/cesium-core/src/components/measurement/handlers/CoordinateMeasure.ts +139 -0
- package/plugins/plugins/cesium-core/src/components/measurement/handlers/HorizontalMeasure.ts +418 -0
- package/plugins/plugins/cesium-core/src/components/measurement/handlers/PolylineDistanceMeasure.ts +352 -0
- package/plugins/plugins/cesium-core/src/components/measurement/handlers/RectangleMeasure.ts +388 -0
- package/plugins/plugins/cesium-core/src/components/measurement/handlers/RegularPolygonMeasure.ts +379 -0
- package/plugins/plugins/cesium-core/src/components/measurement/handlers/SpaceMeasure.ts +246 -0
- package/plugins/plugins/cesium-core/src/components/measurement/handlers/TerrainHeightMeasure.ts +185 -0
- package/plugins/plugins/cesium-core/src/components/measurement/handlers/TriangleMeasure.ts +541 -0
- package/plugins/plugins/cesium-core/src/components/measurement/handlers/VerticalMeasure.ts +360 -0
- package/plugins/plugins/cesium-core/src/components/measurement/index.ts +13 -0
- package/plugins/plugins/cesium-core/src/components/measurement/types.ts +57 -0
- package/plugins/plugins/cesium-core/src/components/primitive/PrimitiveManager.ts +556 -0
- package/plugins/plugins/cesium-core/src/components/roaming/CameraRoamTool.ts +286 -0
- package/plugins/plugins/cesium-core/src/components/roaming/PathRoamTool.ts +174 -0
- package/plugins/plugins/cesium-core/src/components/roaming/index.ts +3 -0
- package/plugins/plugins/cesium-core/src/components/roaming/types.ts +71 -0
- package/plugins/plugins/cesium-core/src/components/utils/convertGeoJsonToEntityData.ts +98 -0
- package/plugins/plugins/cesium-core/src/components/utils/uuid.ts +7 -0
- package/plugins/plugins/cesium-core/src/index.ts +17 -0
- package/plugins/plugins/cesium-core/src/test/measurement/index.html +166 -0
- package/plugins/plugins/cesium-core/src/test/roaming/c.gltf +1 -0
- package/plugins/plugins/cesium-core/src/test/roaming/f87cc3ea918a4b76bff2c88a3655eb1f.bin +0 -0
- package/plugins/plugins/cesium-core/src/test/roaming/index.html +51 -0
- package/plugins/plugins/cesium-core/src/test/roaming/path.html +448 -0
- package/plugins/plugins/cesium-core/src/test/roaming/view.html +520 -0
- package/plugins/plugins/cesium-core/stats.html +4949 -0
- package/plugins/plugins/cesium-core/tsconfig.json +14 -0
- package/plugins/plugins/cesium-core/vite.config.ts +35 -0
- package/plugins/plugins/cesium-vue/dist/components/basic-audio/index.d.ts +18 -0
- package/plugins/plugins/cesium-vue/dist/components/basic-audio/index.d.ts.map +1 -0
- package/plugins/plugins/cesium-vue/dist/components/basic-video/index.d.ts +92 -0
- package/plugins/plugins/cesium-vue/dist/components/basic-video/index.d.ts.map +1 -0
- package/plugins/plugins/cesium-vue/dist/components/camera-roam/index.d.ts +82 -0
- package/plugins/plugins/cesium-vue/dist/components/camera-roam/index.d.ts.map +1 -0
- package/plugins/plugins/cesium-vue/dist/components/card-carousel/index.d.ts +152 -0
- package/plugins/plugins/cesium-vue/dist/components/card-carousel/index.d.ts.map +1 -0
- package/plugins/plugins/cesium-vue/dist/components/card-content/index.d.ts +21 -0
- package/plugins/plugins/cesium-vue/dist/components/card-content/index.d.ts.map +1 -0
- package/plugins/plugins/cesium-vue/dist/components/card-page/index.d.ts +69 -0
- package/plugins/plugins/cesium-vue/dist/components/card-page/index.d.ts.map +1 -0
- package/plugins/plugins/cesium-vue/dist/components/carousel-img/index.d.ts +21 -0
- package/plugins/plugins/cesium-vue/dist/components/carousel-img/index.d.ts.map +1 -0
- package/plugins/plugins/cesium-vue/dist/components/echarts-pro/index.d.ts +68 -0
- package/plugins/plugins/cesium-vue/dist/components/echarts-pro/index.d.ts.map +1 -0
- package/plugins/plugins/cesium-vue/dist/components/marker-bubble/index.d.ts +78 -0
- package/plugins/plugins/cesium-vue/dist/components/marker-bubble/index.d.ts.map +1 -0
- package/plugins/plugins/cesium-vue/dist/components/marker-default/index.d.ts +48 -0
- package/plugins/plugins/cesium-vue/dist/components/marker-default/index.d.ts.map +1 -0
- package/plugins/plugins/cesium-vue/dist/components/marker-html/index.d.ts +48 -0
- package/plugins/plugins/cesium-vue/dist/components/marker-html/index.d.ts.map +1 -0
- package/plugins/plugins/cesium-vue/dist/components/marker-manage/index.d.ts +164 -0
- package/plugins/plugins/cesium-vue/dist/components/marker-manage/index.d.ts.map +1 -0
- package/plugins/plugins/cesium-vue/dist/components/marker-text/index.d.ts +30 -0
- package/plugins/plugins/cesium-vue/dist/components/marker-text/index.d.ts.map +1 -0
- package/plugins/plugins/cesium-vue/dist/components/measurement/index.d.ts +78 -0
- package/plugins/plugins/cesium-vue/dist/components/measurement/index.d.ts.map +1 -0
- package/plugins/plugins/cesium-vue/dist/components/path-roam/index.d.ts +82 -0
- package/plugins/plugins/cesium-vue/dist/components/path-roam/index.d.ts.map +1 -0
- package/plugins/plugins/cesium-vue/dist/components/test/index.d.ts +67 -0
- package/plugins/plugins/cesium-vue/dist/components/test/index.d.ts.map +1 -0
- package/plugins/plugins/cesium-vue/dist/index.css +1 -0
- package/plugins/plugins/cesium-vue/dist/index.d.ts +30 -0
- package/plugins/plugins/cesium-vue/dist/index.d.ts.map +1 -0
- package/plugins/plugins/cesium-vue/dist/index.js +10087 -0
- package/plugins/plugins/cesium-vue/dist/index.js.map +1 -0
- package/plugins/plugins/cesium-vue/dist/index.umd.cjs +46 -0
- package/plugins/plugins/cesium-vue/dist/index.umd.cjs.map +1 -0
- package/plugins/plugins/cesium-vue/package.json +48 -0
- 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 +11 -0
- package/plugins/plugins/cesium-vue/src/components/basic-audio/src/BasicAudio.vue +110 -0
- package/plugins/plugins/cesium-vue/src/components/basic-audio/src/basicAudio.ts +6 -0
- package/plugins/plugins/cesium-vue/src/components/basic-video/index.ts +12 -0
- package/plugins/plugins/cesium-vue/src/components/basic-video/src/BasicVideo.vue +99 -0
- package/plugins/plugins/cesium-vue/src/components/basic-video/src/basicVideo.ts +13 -0
- package/plugins/plugins/cesium-vue/src/components/camera-roam/index.ts +4 -0
- package/plugins/plugins/cesium-vue/src/components/camera-roam/src/CameraRoam.vue +434 -0
- package/plugins/plugins/cesium-vue/src/components/camera-roam/src/cameraRoam.ts +28 -0
- package/plugins/plugins/cesium-vue/src/components/card-carousel/index.ts +12 -0
- package/plugins/plugins/cesium-vue/src/components/card-carousel/src/CardCarousel.vue +124 -0
- package/plugins/plugins/cesium-vue/src/components/card-carousel/src/cardCarousel.ts +60 -0
- package/plugins/plugins/cesium-vue/src/components/card-content/index.ts +12 -0
- package/plugins/plugins/cesium-vue/src/components/card-content/src/CardContent.vue +41 -0
- package/plugins/plugins/cesium-vue/src/components/card-content/src/cardContent.ts +22 -0
- package/plugins/plugins/cesium-vue/src/components/card-page/index.ts +12 -0
- package/plugins/plugins/cesium-vue/src/components/card-page/src/CardPage.vue +102 -0
- package/plugins/plugins/cesium-vue/src/components/card-page/src/cardPage.ts +37 -0
- package/plugins/plugins/cesium-vue/src/components/carousel-img/index.ts +12 -0
- package/plugins/plugins/cesium-vue/src/components/carousel-img/src/CarouselImg.vue +15 -0
- package/plugins/plugins/cesium-vue/src/components/carousel-img/src/carouselImg.ts +6 -0
- package/plugins/plugins/cesium-vue/src/components/echarts-pro/index.ts +12 -0
- package/plugins/plugins/cesium-vue/src/components/echarts-pro/src/EchartsPro.vue +107 -0
- package/plugins/plugins/cesium-vue/src/components/echarts-pro/src/echartsPro.ts +12 -0
- package/plugins/plugins/cesium-vue/src/components/echarts-pro/src/hook/useECharts.ts +55 -0
- package/plugins/plugins/cesium-vue/src/components/marker-bubble/index.ts +12 -0
- package/plugins/plugins/cesium-vue/src/components/marker-bubble/src/MarkerBubble.vue +235 -0
- package/plugins/plugins/cesium-vue/src/components/marker-bubble/src/markerBubble.ts +35 -0
- package/plugins/plugins/cesium-vue/src/components/marker-default/index.ts +12 -0
- package/plugins/plugins/cesium-vue/src/components/marker-default/src/MarkerDefault.vue +19 -0
- package/plugins/plugins/cesium-vue/src/components/marker-default/src/markerDefault.ts +12 -0
- package/plugins/plugins/cesium-vue/src/components/marker-html/index.ts +12 -0
- package/plugins/plugins/cesium-vue/src/components/marker-html/src/MarkerHtml.vue +21 -0
- package/plugins/plugins/cesium-vue/src/components/marker-html/src/markerHtml.ts +12 -0
- package/plugins/plugins/cesium-vue/src/components/marker-manage/index.ts +14 -0
- package/plugins/plugins/cesium-vue/src/components/marker-manage/src/components/MarkerManage.vue +106 -0
- package/plugins/plugins/cesium-vue/src/components/marker-manage/src/config/theme.ts +8 -0
- package/plugins/plugins/cesium-vue/src/components/marker-manage/src/core/MarkerManage.ts +466 -0
- package/plugins/plugins/cesium-vue/src/components/marker-manage/src/core/MarkerManagerCore.ts +148 -0
- package/plugins/plugins/cesium-vue/src/components/marker-manage/src/hook/useMarkerManage.ts +45 -0
- package/plugins/plugins/cesium-vue/src/components/marker-manage/src/type/markerManage.ts +75 -0
- package/plugins/plugins/cesium-vue/src/components/marker-manage/src/utils/themeTool.ts +154 -0
- package/plugins/plugins/cesium-vue/src/components/marker-text/index.ts +12 -0
- package/plugins/plugins/cesium-vue/src/components/marker-text/src/MarkerText.vue +14 -0
- package/plugins/plugins/cesium-vue/src/components/marker-text/src/markerText.ts +10 -0
- package/plugins/plugins/cesium-vue/src/components/measurement/index.ts +12 -0
- package/plugins/plugins/cesium-vue/src/components/measurement/src/Measurement.vue +183 -0
- package/plugins/plugins/cesium-vue/src/components/measurement/src/measurement.ts +20 -0
- package/plugins/plugins/cesium-vue/src/components/path-roam/index.ts +4 -0
- package/plugins/plugins/cesium-vue/src/components/path-roam/src/PathRoam.vue +429 -0
- package/plugins/plugins/cesium-vue/src/components/path-roam/src/pathRoam.ts +28 -0
- package/plugins/plugins/cesium-vue/src/components/test/CardMarker.vue +150 -0
- package/plugins/plugins/cesium-vue/src/components/test/CesiumMarker.vue +34 -0
- package/plugins/plugins/cesium-vue/src/components/test/CesiumViewer.vue +77 -0
- package/plugins/plugins/cesium-vue/src/components/test/MyLabel.vue +25 -0
- package/plugins/plugins/cesium-vue/src/components/test/index.ts +28 -0
- package/plugins/plugins/cesium-vue/src/index.ts +83 -0
- package/plugins/plugins/cesium-vue/stats.html +4949 -0
- package/plugins/plugins/cesium-vue/tsconfig.json +18 -0
- package/plugins/plugins/cesium-vue/vite.config.ts +56 -0
- package/plugins/plugins/theme-chalk/dist/theme-chalk.css +819 -0
- package/plugins/plugins/theme-chalk/index.less +11 -0
- package/plugins/plugins/theme-chalk/package.json +27 -0
- package/plugins/plugins/theme-chalk/src/basicAudio.less +41 -0
- package/plugins/plugins/theme-chalk/src/basicVideo.less +17 -0
- package/plugins/plugins/theme-chalk/src/cameraRoam.less +239 -0
- package/plugins/plugins/theme-chalk/src/cardCarousel.less +71 -0
- package/plugins/plugins/theme-chalk/src/cardContent.less +73 -0
- package/plugins/plugins/theme-chalk/src/cardPage.less +61 -0
- package/plugins/plugins/theme-chalk/src/carouselImg.less +34 -0
- package/plugins/plugins/theme-chalk/src/marker.less +107 -0
- package/plugins/plugins/theme-chalk/src/markerManage.less +25 -0
- package/plugins/plugins/theme-chalk/src/measurement.less +106 -0
- package/plugins/plugins/theme-chalk/src/mixins/config.less +4 -0
- package/plugins/plugins/theme-chalk/src/mixins/mixins.less +64 -0
- package/plugins/plugins/theme-chalk/src/pathRoam.less +198 -0
- package/plugins/plugins/utils/create.ts +45 -0
- package/plugins/plugins/utils/package.json +12 -0
- package/plugins/plugins/utils/uuid.ts +43 -0
- package/plugins/plugins/utils/with-install.ts +10 -0
- package/plugins/theme-chalk/dist/theme-chalk.css +852 -0
- package/plugins/theme-chalk/index.less +11 -0
- package/plugins/theme-chalk/package.json +27 -0
- package/plugins/theme-chalk/src/basicAudio.less +44 -0
- package/plugins/theme-chalk/src/basicVideo.less +17 -0
- package/plugins/theme-chalk/src/cameraRoam.less +239 -0
- package/plugins/theme-chalk/src/cardCarousel.less +71 -0
- package/plugins/theme-chalk/src/cardContent.less +73 -0
- package/plugins/theme-chalk/src/cardPage.less +61 -0
- package/plugins/theme-chalk/src/carouselImg.less +66 -0
- package/plugins/theme-chalk/src/marker.less +107 -0
- package/plugins/theme-chalk/src/markerManage.less +25 -0
- package/plugins/theme-chalk/src/measurement.less +106 -0
- package/plugins/theme-chalk/src/mixins/config.less +4 -0
- package/plugins/theme-chalk/src/mixins/mixins.less +64 -0
- package/plugins/theme-chalk/src/pathRoam.less +198 -0
- package/plugins/utils/create.ts +45 -0
- package/plugins/utils/package.json +12 -0
- package/plugins/utils/uuid.ts +43 -0
- package/plugins/utils/with-install.ts +10 -0
|
@@ -0,0 +1,799 @@
|
|
|
1
|
+
import { isArray } from 'lodash-es';
|
|
2
|
+
|
|
3
|
+
export enum EditMode {
|
|
4
|
+
Rotate = 'rotate',
|
|
5
|
+
Move = 'move',
|
|
6
|
+
Scale = 'scale',
|
|
7
|
+
MoveHeight = 'moveHeight',
|
|
8
|
+
Empty = '',
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export enum GLTFManageEventKey {
|
|
12
|
+
Scale = 'addScale',
|
|
13
|
+
Rotate = 'rotate',
|
|
14
|
+
Translation = 'translation',
|
|
15
|
+
Remove = 'removeById',
|
|
16
|
+
Add = 'add',
|
|
17
|
+
}
|
|
18
|
+
export class GLTFManage {
|
|
19
|
+
primitives = new Map<string, any>();
|
|
20
|
+
eventListener = new Map<string, Array<Object>>();
|
|
21
|
+
Cesium: any;
|
|
22
|
+
viewer: any;
|
|
23
|
+
handler: any;
|
|
24
|
+
rotationRing: any;
|
|
25
|
+
translationSquare: any;
|
|
26
|
+
heightArrow: any;
|
|
27
|
+
editMode: EditMode = EditMode.Empty; // 默认是移动模式
|
|
28
|
+
dragEndCallbackMap = new Map<string, any>();
|
|
29
|
+
|
|
30
|
+
constructor(options: { Cesium: any; viewer: any }) {
|
|
31
|
+
this.Cesium = options.Cesium;
|
|
32
|
+
this.viewer = options.viewer;
|
|
33
|
+
this.handler = new this.Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* @description: 初始化模型
|
|
38
|
+
* @param {Array<any>} models 模型数据列表
|
|
39
|
+
* @return {*}
|
|
40
|
+
*/
|
|
41
|
+
init(models: Array<any>, show = false) {
|
|
42
|
+
const viewer = this.viewer;
|
|
43
|
+
// 移除现有的所有模型
|
|
44
|
+
this.primitives.forEach((gltf) => {
|
|
45
|
+
viewer.scene.primitives.remove(gltf);
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
// 遍历传入的模型数据并添加到场景中
|
|
49
|
+
models.forEach((model: any) => {
|
|
50
|
+
if (!this.primitives.has(model.id)) {
|
|
51
|
+
this.add(model, show); // 调用 add 方法添加模型
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
get(id: string) {
|
|
56
|
+
return this.primitives.get(id);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* @description: 添加模型
|
|
61
|
+
* @param {*} info 模型信息
|
|
62
|
+
* @return {*}
|
|
63
|
+
*/
|
|
64
|
+
add(info: any, show = true) {
|
|
65
|
+
const viewer = this.viewer;
|
|
66
|
+
const Cesium = this.Cesium;
|
|
67
|
+
// 转换 Heading, Pitch, Roll 为弧度
|
|
68
|
+
const newHeading = Cesium.Math.toRadians(info.headingPitchRoll?.heading || 0);
|
|
69
|
+
const newPitch = Cesium.Math.toRadians(info.headingPitchRoll?.pitch || 0);
|
|
70
|
+
const newRoll = Cesium.Math.toRadians(info.headingPitchRoll?.roll || 0);
|
|
71
|
+
const headingPitchRoll = new Cesium.HeadingPitchRoll(newHeading, newPitch, newRoll);
|
|
72
|
+
|
|
73
|
+
// 计算模型的模型矩阵
|
|
74
|
+
const modelMatrix = Cesium.Transforms.headingPitchRollToFixedFrame(
|
|
75
|
+
info.position,
|
|
76
|
+
headingPitchRoll,
|
|
77
|
+
viewer.scene.globe.ellipsoid,
|
|
78
|
+
Cesium.Transforms.eastNorthUpToFixedFrame,
|
|
79
|
+
new Cesium.Matrix4(),
|
|
80
|
+
);
|
|
81
|
+
|
|
82
|
+
// 创建模型并添加到场景
|
|
83
|
+
let gltf = viewer.scene.primitives.add(
|
|
84
|
+
Cesium.Model.fromGltf({
|
|
85
|
+
id: info.id,
|
|
86
|
+
...info.model, // 模型的地址
|
|
87
|
+
modelMatrix,
|
|
88
|
+
}),
|
|
89
|
+
);
|
|
90
|
+
gltf.scale = info.scale || 1; // 设置缩放
|
|
91
|
+
this.primitives.set(info.id, gltf); // 存储在 primitives 中
|
|
92
|
+
gltf.show = show;
|
|
93
|
+
// 触发 add 事件监听
|
|
94
|
+
this.runEventListener(GLTFManageEventKey.Add, { info: info, gltf: gltf });
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
flyTo(id: string) {
|
|
98
|
+
const viewer = this.viewer;
|
|
99
|
+
const Cesium = this.Cesium;
|
|
100
|
+
let model = this.primitives.get(id);
|
|
101
|
+
const boundingSphere = model.boundingSphere;
|
|
102
|
+
|
|
103
|
+
// 如果模型有模型矩阵,转换到世界坐标
|
|
104
|
+
const center = Cesium.Matrix4.multiplyByPoint(
|
|
105
|
+
model.modelMatrix,
|
|
106
|
+
boundingSphere.center,
|
|
107
|
+
new Cesium.Cartesian3(),
|
|
108
|
+
);
|
|
109
|
+
|
|
110
|
+
// 创建世界坐标下的包围球
|
|
111
|
+
const worldBoundingSphere = new Cesium.BoundingSphere(center, boundingSphere.radius);
|
|
112
|
+
|
|
113
|
+
// 摄像机飞到模型位置
|
|
114
|
+
viewer.camera.flyToBoundingSphere(worldBoundingSphere, {
|
|
115
|
+
duration: 1.5, // 飞行时间
|
|
116
|
+
offset: new Cesium.HeadingPitchRange(0, -0.5, boundingSphere.radius * 2.0), // 调整视角
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* @description: 根据模型的 ID 移除模型
|
|
122
|
+
* @param {string} id 模型的 ID
|
|
123
|
+
* @return {*}
|
|
124
|
+
*/
|
|
125
|
+
removeById(id: string) {
|
|
126
|
+
const viewer = this.viewer;
|
|
127
|
+
let g = this.primitives.get(id); // 获取对应 ID 的模型
|
|
128
|
+
|
|
129
|
+
if (!g) {
|
|
130
|
+
console.error(`No model found with id: ${id}`);
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// 从场景中移除模型
|
|
135
|
+
viewer.scene.primitives.remove(g);
|
|
136
|
+
this.primitives.delete(id); // 从 primitives 中删除模型
|
|
137
|
+
if (!this.rotationRing?._instanceIds.includes(`rotationRing_${id}`) || !this.rotationRing) {
|
|
138
|
+
this.removeTool();
|
|
139
|
+
}
|
|
140
|
+
// 触发 removeById 事件监听
|
|
141
|
+
this.runEventListener(GLTFManageEventKey.Remove, { id: id, gltf: g });
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
// 显示模型
|
|
145
|
+
show(id: string) {
|
|
146
|
+
let g = this.primitives.get(id); // 获取对应 ID 的模型
|
|
147
|
+
if (g) g.show = true;
|
|
148
|
+
}
|
|
149
|
+
// 隐藏模型
|
|
150
|
+
hide(id: string) {
|
|
151
|
+
let g = this.primitives.get(id); // 获取对应 ID 的模型
|
|
152
|
+
if (g) g.show = false;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* @description: 修改模型的缩放因子
|
|
157
|
+
* @param {*} info 模型信息
|
|
158
|
+
* @param {number} num 缩放因子
|
|
159
|
+
* @return {*}
|
|
160
|
+
*/
|
|
161
|
+
addScale(info: any, num = 0.1) {
|
|
162
|
+
let curModel = this.primitives.get(info.id); // 获取对应 ID 的模型
|
|
163
|
+
|
|
164
|
+
if (curModel) {
|
|
165
|
+
curModel.scale = curModel.scale + num; // 增加或减少模型的缩放因子
|
|
166
|
+
this.updatedTool(curModel.modelMatrix);
|
|
167
|
+
this.runEventListener(GLTFManageEventKey.Scale, { id: info.id, scale: curModel.scale }); // 触发 addScale 事件监听
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* @description: 修改模型的缩放因子
|
|
172
|
+
* @param {*} info 模型信息
|
|
173
|
+
* @param {number} num 缩放因子
|
|
174
|
+
* @return {*}
|
|
175
|
+
*/
|
|
176
|
+
setScale(id: any, scale = 0.1) {
|
|
177
|
+
let curModel = this.primitives.get(id); // 获取对应 ID 的模型
|
|
178
|
+
if (curModel) {
|
|
179
|
+
curModel.scale = scale; // 增加或减少模型的缩放因子
|
|
180
|
+
this.updatedTool(curModel.modelMatrix);
|
|
181
|
+
this.runEventListener(GLTFManageEventKey.Scale, { id: id, scale: curModel.scale }); // 触发 addScale 事件监听
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
setEditMode(mode: EditMode) {
|
|
186
|
+
this.editMode = mode;
|
|
187
|
+
}
|
|
188
|
+
// 公共锁定/解锁视角函数
|
|
189
|
+
lockCamera() {
|
|
190
|
+
const cameraController = this.viewer.scene.screenSpaceCameraController;
|
|
191
|
+
cameraController.enableRotate = false;
|
|
192
|
+
cameraController.enableTranslate = false;
|
|
193
|
+
cameraController.enableZoom = false;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
unlockCamera() {
|
|
197
|
+
const cameraController = this.viewer.scene.screenSpaceCameraController;
|
|
198
|
+
cameraController.enableRotate = true;
|
|
199
|
+
cameraController.enableTranslate = true;
|
|
200
|
+
cameraController.enableZoom = true;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
// 公共函数:将世界坐标转换为经纬度(忽略高度)
|
|
204
|
+
toCartographic(cartesian: any) {
|
|
205
|
+
const cartographic = this.Cesium.Cartographic.fromCartesian(cartesian);
|
|
206
|
+
return { longitude: cartographic.longitude, latitude: cartographic.latitude };
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
// 公共函数:计算两点之间的方向角
|
|
210
|
+
calculateHeading(from: any, to: any): number {
|
|
211
|
+
const deltaLongitude = to.longitude - from.longitude;
|
|
212
|
+
const deltaLatitude = to.latitude - from.latitude;
|
|
213
|
+
return Math.atan2(deltaLatitude, deltaLongitude);
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* @description: 获取模型的 Heading, Pitch, Roll
|
|
218
|
+
* @param {any} modelMatrix 模型的变换矩阵
|
|
219
|
+
* @return {*}
|
|
220
|
+
*/
|
|
221
|
+
getModelHeadingPitchRoll(modelMatrix: any) {
|
|
222
|
+
const Cesium = this.Cesium;
|
|
223
|
+
const viewer = this.viewer;
|
|
224
|
+
|
|
225
|
+
const m1 = Cesium.Transforms.eastNorthUpToFixedFrame(
|
|
226
|
+
Cesium.Matrix4.getTranslation(modelMatrix, new Cesium.Cartesian3()),
|
|
227
|
+
viewer.scene.globe.ellipsoid,
|
|
228
|
+
new Cesium.Matrix4(),
|
|
229
|
+
);
|
|
230
|
+
|
|
231
|
+
const m2 = Cesium.Matrix4.multiply(
|
|
232
|
+
Cesium.Matrix4.inverse(m1, new Cesium.Matrix4()),
|
|
233
|
+
modelMatrix,
|
|
234
|
+
new Cesium.Matrix4(),
|
|
235
|
+
);
|
|
236
|
+
|
|
237
|
+
const mat3 = Cesium.Matrix4.getRotation(m2, new Cesium.Matrix3());
|
|
238
|
+
const q = Cesium.Quaternion.fromRotationMatrix(mat3);
|
|
239
|
+
return Cesium.HeadingPitchRoll.fromQuaternion(q); // 返回 HeadingPitchRoll
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* @description: 添加事件监听
|
|
244
|
+
* @param {string} key
|
|
245
|
+
* @param {Function} f
|
|
246
|
+
* @param {any} options
|
|
247
|
+
* @return {*}
|
|
248
|
+
*/
|
|
249
|
+
addEventListener(key: string, f: Function, options?: any): { f: Function; options: any } {
|
|
250
|
+
let instantiation = { f: f, options: options };
|
|
251
|
+
if (this.eventListener.get(key)) {
|
|
252
|
+
(this.eventListener.get(key) || []).push(instantiation);
|
|
253
|
+
} else {
|
|
254
|
+
this.eventListener.set(key, [instantiation]);
|
|
255
|
+
}
|
|
256
|
+
return instantiation;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
/**
|
|
260
|
+
* @description: 移除事件监听
|
|
261
|
+
* @param {string} key
|
|
262
|
+
* @param {any} instantiation
|
|
263
|
+
* @return {*}
|
|
264
|
+
*/
|
|
265
|
+
removeEventListener(key: string, instantiation: any) {
|
|
266
|
+
let list = this.eventListener.get(key);
|
|
267
|
+
if (!list) return console.error('key不存在');
|
|
268
|
+
let index = list.findIndex((n) => n == instantiation);
|
|
269
|
+
if (index >= 0) {
|
|
270
|
+
list.splice(index, 1);
|
|
271
|
+
} else {
|
|
272
|
+
console.error('instantiation不存在');
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* @description: 执行监听
|
|
278
|
+
* @param {*} key
|
|
279
|
+
* @param {any} parameter
|
|
280
|
+
* @return {*}
|
|
281
|
+
*/
|
|
282
|
+
runEventListener(key: string, parameter: any): boolean {
|
|
283
|
+
let list = this.eventListener.get(key);
|
|
284
|
+
if (!list) return false;
|
|
285
|
+
list.forEach((item: any) => {
|
|
286
|
+
if (typeof item.f === 'function') {
|
|
287
|
+
item.f(parameter);
|
|
288
|
+
}
|
|
289
|
+
});
|
|
290
|
+
return true; // 返回事件是否成功执行
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
// ... (Add, remove, scale functions here remain the same)
|
|
294
|
+
|
|
295
|
+
/**
|
|
296
|
+
* @description: 初始化拖拽模型编辑功能(平移)
|
|
297
|
+
* @return {*}
|
|
298
|
+
*/
|
|
299
|
+
initEditBox(getEditState: Function) {
|
|
300
|
+
const Cesium = this.Cesium;
|
|
301
|
+
const viewer = this.viewer;
|
|
302
|
+
const scene = viewer.scene;
|
|
303
|
+
|
|
304
|
+
let draggedModel: any = null;
|
|
305
|
+
let startModelMatrix: any = null;
|
|
306
|
+
let startModelCartographic: any = null;
|
|
307
|
+
let startMouseCartographic: any = null;
|
|
308
|
+
let startMousePosition: any = null;
|
|
309
|
+
|
|
310
|
+
// 清除拖拽状态
|
|
311
|
+
const clearStatus = () => {
|
|
312
|
+
draggedModel = null;
|
|
313
|
+
startModelMatrix = null;
|
|
314
|
+
startModelCartographic = null;
|
|
315
|
+
startMousePosition = null;
|
|
316
|
+
startMouseCartographic = null;
|
|
317
|
+
this.setEditMode(EditMode.Empty);
|
|
318
|
+
this.unlockCamera();
|
|
319
|
+
};
|
|
320
|
+
|
|
321
|
+
//初始化拖拽状态
|
|
322
|
+
const initDragged = (modelId: any, movement: any) => {
|
|
323
|
+
draggedModel = this.primitives.get(modelId);
|
|
324
|
+
if (draggedModel) {
|
|
325
|
+
startModelMatrix = Cesium.Matrix4.clone(draggedModel.modelMatrix);
|
|
326
|
+
const modelPosition = Cesium.Matrix4.getTranslation(
|
|
327
|
+
startModelMatrix,
|
|
328
|
+
new Cesium.Cartesian3(),
|
|
329
|
+
);
|
|
330
|
+
startModelCartographic = this.toCartographic(modelPosition);
|
|
331
|
+
startMousePosition = movement.position;
|
|
332
|
+
const rayHit: any = scene.globe.pick(viewer.camera.getPickRay(movement.position), scene);
|
|
333
|
+
startMouseCartographic = this.toCartographic(rayHit);
|
|
334
|
+
|
|
335
|
+
this.lockCamera();
|
|
336
|
+
}
|
|
337
|
+
};
|
|
338
|
+
|
|
339
|
+
// 点击事件处理,获取被点击的模型对象
|
|
340
|
+
this.handler.setInputAction((movement: any) => {
|
|
341
|
+
let isEdit = getEditState();
|
|
342
|
+
if (!isEdit) return;
|
|
343
|
+
const hit: any = scene.pick(movement.position);
|
|
344
|
+
if (hit && hit.id && hit.id?.includes('rotationRing')) {
|
|
345
|
+
let modelId = hit.id.split('rotationRing_')[1];
|
|
346
|
+
this.setEditMode(EditMode.Rotate);
|
|
347
|
+
initDragged(modelId, movement);
|
|
348
|
+
} else if (hit && hit.id && hit.id?.includes('translationSquare_')) {
|
|
349
|
+
let modelId = hit.id.split('translationSquare_')[1];
|
|
350
|
+
this.setEditMode(EditMode.Move);
|
|
351
|
+
initDragged(modelId, movement);
|
|
352
|
+
} else if (hit && hit.id && hit.id?.includes('heightArrow-line_')) {
|
|
353
|
+
let modelId = hit.id.split('heightArrow-line_')[1];
|
|
354
|
+
this.setEditMode(EditMode.MoveHeight);
|
|
355
|
+
initDragged(modelId, movement);
|
|
356
|
+
} else if (hit && hit.id && hit.id?.includes('heightArrow-arrow_')) {
|
|
357
|
+
let modelId = hit.id.split('heightArrow-arrow_')[1];
|
|
358
|
+
this.setEditMode(EditMode.MoveHeight);
|
|
359
|
+
initDragged(modelId, movement);
|
|
360
|
+
} else if (hit && hit.id) {
|
|
361
|
+
draggedModel = this.primitives.get(hit.id);
|
|
362
|
+
if (!draggedModel) return;
|
|
363
|
+
// 创建旋转环
|
|
364
|
+
if (
|
|
365
|
+
!this.rotationRing ||
|
|
366
|
+
!this.rotationRing?._instanceIds?.includes(`rotationRing_${draggedModel.id}`)
|
|
367
|
+
) {
|
|
368
|
+
this.createRotationRing(draggedModel);
|
|
369
|
+
}
|
|
370
|
+
//创建平移方块
|
|
371
|
+
if (
|
|
372
|
+
!this.translationSquare ||
|
|
373
|
+
!this.translationSquare?._instanceIds?.includes(`translationSquare_${draggedModel.id}`)
|
|
374
|
+
) {
|
|
375
|
+
this.createTranslationSquare(draggedModel);
|
|
376
|
+
}
|
|
377
|
+
//创建平移方块
|
|
378
|
+
if (
|
|
379
|
+
!this.heightArrow ||
|
|
380
|
+
!this.heightArrow?._instanceIds?.includes(`heightArrow_${draggedModel.id}`)
|
|
381
|
+
) {
|
|
382
|
+
this.createHeightArrow(draggedModel);
|
|
383
|
+
}
|
|
384
|
+
} else {
|
|
385
|
+
clearStatus();
|
|
386
|
+
}
|
|
387
|
+
}, Cesium.ScreenSpaceEventType.LEFT_DOWN);
|
|
388
|
+
|
|
389
|
+
// 拖拽过程中更新模型位置或旋转
|
|
390
|
+
this.handler.setInputAction((movement: any) => {
|
|
391
|
+
let isEdit = getEditState();
|
|
392
|
+
if (!isEdit) return;
|
|
393
|
+
if (this.editMode != EditMode.Empty && draggedModel) {
|
|
394
|
+
const rayHit: any = scene.globe.pick(viewer.camera.getPickRay(movement.endPosition), scene);
|
|
395
|
+
const currentMouseCartographic = this.toCartographic(rayHit);
|
|
396
|
+
let angleDelta = 0;
|
|
397
|
+
|
|
398
|
+
// 更新模型的位置或者旋转
|
|
399
|
+
if (this.editMode === EditMode.Rotate) {
|
|
400
|
+
let currAngle = this.calculateHeading(startModelCartographic, currentMouseCartographic);
|
|
401
|
+
let startAngle = this.calculateHeading(startModelCartographic, startMouseCartographic);
|
|
402
|
+
angleDelta = startAngle - currAngle;
|
|
403
|
+
this.rotateModel(draggedModel, startModelMatrix, angleDelta);
|
|
404
|
+
} else if (this.editMode === EditMode.Move) {
|
|
405
|
+
this.moveModel(draggedModel, startModelMatrix, movement);
|
|
406
|
+
} else if (this.editMode === EditMode.MoveHeight) {
|
|
407
|
+
this.moveModelHeight(draggedModel, startModelMatrix, movement, startMousePosition);
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
}, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
|
|
411
|
+
|
|
412
|
+
// 拖拽结束
|
|
413
|
+
this.handler.setInputAction(() => {
|
|
414
|
+
let isEdit = getEditState();
|
|
415
|
+
if (!isEdit) return;
|
|
416
|
+
let map = this.dragEndCallbackMap.get(draggedModel?.id);
|
|
417
|
+
if (map && (this.editMode === EditMode.Move || this.editMode === EditMode.MoveHeight)) {
|
|
418
|
+
let callbackInfo = map.get(GLTFManageEventKey.Translation);
|
|
419
|
+
if (callbackInfo) {
|
|
420
|
+
this.runEventListener(GLTFManageEventKey.Translation, callbackInfo);
|
|
421
|
+
map.delete(GLTFManageEventKey.Translation);
|
|
422
|
+
}
|
|
423
|
+
} else if (map && this.editMode === EditMode.Rotate) {
|
|
424
|
+
let callbackInfo = map.get(GLTFManageEventKey.Rotate);
|
|
425
|
+
if (callbackInfo) {
|
|
426
|
+
this.runEventListener(GLTFManageEventKey.Rotate, callbackInfo);
|
|
427
|
+
map.delete(GLTFManageEventKey.Rotate);
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
clearStatus();
|
|
431
|
+
}, Cesium.ScreenSpaceEventType.LEFT_UP);
|
|
432
|
+
this.handler.setInputAction(() => {
|
|
433
|
+
this.removeTool();
|
|
434
|
+
}, Cesium.ScreenSpaceEventType.RIGHT_UP);
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
// 创建圆环表示旋转区域
|
|
438
|
+
createRotationRing(model: any) {
|
|
439
|
+
const Cesium = this.Cesium;
|
|
440
|
+
const viewer = this.viewer;
|
|
441
|
+
if (this.rotationRing) {
|
|
442
|
+
viewer.scene.primitives.remove(this.rotationRing); // 如果已存在,先移除
|
|
443
|
+
}
|
|
444
|
+
//创建圆
|
|
445
|
+
const position = [] as any;
|
|
446
|
+
for (let i = 0; i <= 360; i += 3) {
|
|
447
|
+
const sin = Math.sin(Cesium.Math.toRadians(i));
|
|
448
|
+
const cos = Math.cos(Cesium.Math.toRadians(i));
|
|
449
|
+
const x = model.boundingSphere.radius * cos;
|
|
450
|
+
const y = model.boundingSphere.radius * sin;
|
|
451
|
+
position.push(new Cesium.Cartesian3(x, y, 0));
|
|
452
|
+
}
|
|
453
|
+
const geometry = new Cesium.PolylineGeometry({
|
|
454
|
+
positions: position,
|
|
455
|
+
width: Math.max(model.boundingSphere.radius * 0.05, 1),
|
|
456
|
+
});
|
|
457
|
+
const instnce = new Cesium.GeometryInstance({
|
|
458
|
+
id: `rotationRing_${model.id}`,
|
|
459
|
+
geometry: geometry,
|
|
460
|
+
attributes: {
|
|
461
|
+
color: Cesium.ColorGeometryInstanceAttribute.fromColor(Cesium.Color.RED),
|
|
462
|
+
},
|
|
463
|
+
});
|
|
464
|
+
this.rotationRing = new Cesium.Primitive({
|
|
465
|
+
geometryInstances: instnce,
|
|
466
|
+
appearance: new Cesium.PolylineColorAppearance({
|
|
467
|
+
translucent: true,
|
|
468
|
+
}),
|
|
469
|
+
depthFailAppearance: new Cesium.PolylineMaterialAppearance({
|
|
470
|
+
material: Cesium.Material.fromType('Color', {
|
|
471
|
+
color: Cesium.Color.RED.withAlpha(0.3),
|
|
472
|
+
}),
|
|
473
|
+
translucent: true,
|
|
474
|
+
}),
|
|
475
|
+
modelMatrix: model.modelMatrix,
|
|
476
|
+
cull: false,
|
|
477
|
+
});
|
|
478
|
+
viewer.scene.primitives.add(this.rotationRing);
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
// 创建平移方块
|
|
482
|
+
createTranslationSquare(model: any) {
|
|
483
|
+
const Cesium = this.Cesium;
|
|
484
|
+
const viewer = this.viewer;
|
|
485
|
+
if (this.translationSquare) {
|
|
486
|
+
viewer.scene.primitives.remove(this.translationSquare); // 如果已存在,先移除
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
// 创建正方形
|
|
490
|
+
const sideLength = Math.max(model.boundingSphere.radius * 0.2, 1); // 正方形的边长,根据模型的半径确定
|
|
491
|
+
const halfSide = sideLength / 2;
|
|
492
|
+
// 创建正方体的几何体
|
|
493
|
+
const boxGeometry = new Cesium.BoxGeometry({
|
|
494
|
+
maximum: new Cesium.Cartesian3(halfSide, halfSide, halfSide),
|
|
495
|
+
minimum: new Cesium.Cartesian3(-halfSide, -halfSide, -halfSide),
|
|
496
|
+
});
|
|
497
|
+
|
|
498
|
+
const instnce = new Cesium.GeometryInstance({
|
|
499
|
+
id: `translationSquare_${model.id}`,
|
|
500
|
+
geometry: boxGeometry,
|
|
501
|
+
attributes: {
|
|
502
|
+
color: Cesium.ColorGeometryInstanceAttribute.fromColor(Cesium.Color.BLUE),
|
|
503
|
+
},
|
|
504
|
+
});
|
|
505
|
+
|
|
506
|
+
this.translationSquare = new Cesium.Primitive({
|
|
507
|
+
geometryInstances: instnce,
|
|
508
|
+
appearance: new Cesium.PolylineColorAppearance({
|
|
509
|
+
translucent: true,
|
|
510
|
+
}),
|
|
511
|
+
depthFailAppearance: new Cesium.PolylineMaterialAppearance({
|
|
512
|
+
material: Cesium.Material.fromType('Color', {
|
|
513
|
+
color: Cesium.Color.BLUE.withAlpha(0.3),
|
|
514
|
+
}),
|
|
515
|
+
translucent: true,
|
|
516
|
+
}),
|
|
517
|
+
cull: false,
|
|
518
|
+
modelMatrix: model.modelMatrix,
|
|
519
|
+
});
|
|
520
|
+
|
|
521
|
+
viewer.scene.primitives.add(this.translationSquare);
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
// 创建高度调整箭头
|
|
525
|
+
createHeightArrow(model: any) {
|
|
526
|
+
const Cesium = this.Cesium;
|
|
527
|
+
const viewer = this.viewer;
|
|
528
|
+
|
|
529
|
+
if (this.heightArrow) {
|
|
530
|
+
viewer.scene.primitives.remove(this.heightArrow); // 如果已存在,先移除
|
|
531
|
+
}
|
|
532
|
+
let color = Cesium.Color.GREEN;
|
|
533
|
+
let width = Math.max(model.boundingSphere.radius * 0.025, 1);
|
|
534
|
+
let headWidth = 2 * width;
|
|
535
|
+
let length = model.boundingSphere.radius + 50;
|
|
536
|
+
let headLength = length * 0.1;
|
|
537
|
+
const sideLength = Math.max(model.boundingSphere.radius * 0.2, 1);
|
|
538
|
+
let inverse = false;
|
|
539
|
+
|
|
540
|
+
//这里用的是圆锥几何对象,当topRadius和bottomRadius相同时,它就是一个圆柱
|
|
541
|
+
const line = Cesium.CylinderGeometry.createGeometry(
|
|
542
|
+
new Cesium.CylinderGeometry({
|
|
543
|
+
length: length,
|
|
544
|
+
topRadius: width,
|
|
545
|
+
bottomRadius: width,
|
|
546
|
+
}),
|
|
547
|
+
);
|
|
548
|
+
const arrow = Cesium.CylinderGeometry.createGeometry(
|
|
549
|
+
new Cesium.CylinderGeometry({
|
|
550
|
+
length: headLength,
|
|
551
|
+
topRadius: 0,
|
|
552
|
+
bottomRadius: headWidth,
|
|
553
|
+
}),
|
|
554
|
+
);
|
|
555
|
+
let arrowOffset = length + sideLength;
|
|
556
|
+
let lineOffset = (length + sideLength) / 2;
|
|
557
|
+
if (inverse) {
|
|
558
|
+
lineOffset = -lineOffset;
|
|
559
|
+
arrowOffset = -arrowOffset;
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
this.translate(line, [0, 0, lineOffset]);
|
|
563
|
+
this.translate(arrow, [0, 0, arrowOffset]);
|
|
564
|
+
|
|
565
|
+
// 创建箭头的组合(圆柱 + 圆锥)
|
|
566
|
+
this.heightArrow = new Cesium.Primitive({
|
|
567
|
+
modelMatrix: model.modelMatrix,
|
|
568
|
+
geometryInstances: [
|
|
569
|
+
new Cesium.GeometryInstance({
|
|
570
|
+
id: `heightArrow-line_${model.id}`,
|
|
571
|
+
geometry: line,
|
|
572
|
+
}),
|
|
573
|
+
new Cesium.GeometryInstance({
|
|
574
|
+
id: `heightArrow-arrow_${model.id}`,
|
|
575
|
+
geometry: arrow,
|
|
576
|
+
}),
|
|
577
|
+
],
|
|
578
|
+
appearance: new Cesium.PolylineMaterialAppearance({
|
|
579
|
+
material: Cesium.Material.fromType('Color', { color: color }),
|
|
580
|
+
translucent: true,
|
|
581
|
+
}),
|
|
582
|
+
depthFailAppearance: new Cesium.PolylineMaterialAppearance({
|
|
583
|
+
material: Cesium.Material.fromType('Color', {
|
|
584
|
+
color: color.withAlpha(0.3),
|
|
585
|
+
}),
|
|
586
|
+
translucent: true,
|
|
587
|
+
}),
|
|
588
|
+
cull: false,
|
|
589
|
+
});
|
|
590
|
+
|
|
591
|
+
viewer.scene.primitives.add(this.heightArrow);
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
translate(geometry: any, offset: any) {
|
|
595
|
+
let Cesium = this.Cesium;
|
|
596
|
+
const scratchOffset = new Cesium.Cartesian3();
|
|
597
|
+
if (isArray(offset)) {
|
|
598
|
+
scratchOffset.x = offset[0];
|
|
599
|
+
scratchOffset.y = offset[1];
|
|
600
|
+
scratchOffset.z = offset[2];
|
|
601
|
+
} else {
|
|
602
|
+
Cesium.Cartesian3.clone(offset, scratchOffset);
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
for (let i = 0; i < geometry.attributes.position.values.length; i += 3) {
|
|
606
|
+
geometry.attributes.position.values[i] += scratchOffset.x;
|
|
607
|
+
geometry.attributes.position.values[i + 1] += scratchOffset.y;
|
|
608
|
+
geometry.attributes.position.values[i + 2] += scratchOffset.z;
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
//移除工具
|
|
613
|
+
removeTool() {
|
|
614
|
+
if (this.rotationRing) {
|
|
615
|
+
this.viewer.scene.primitives.remove(this.rotationRing);
|
|
616
|
+
}
|
|
617
|
+
if (this.translationSquare) {
|
|
618
|
+
this.viewer.scene.primitives.remove(this.translationSquare);
|
|
619
|
+
}
|
|
620
|
+
if (this.heightArrow) {
|
|
621
|
+
this.viewer.scene.primitives.remove(this.heightArrow);
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
//更新工具矩阵
|
|
626
|
+
updatedTool(newModelMatrix: any) {
|
|
627
|
+
if (this.rotationRing) {
|
|
628
|
+
this.rotationRing.modelMatrix = newModelMatrix;
|
|
629
|
+
}
|
|
630
|
+
if (this.translationSquare) {
|
|
631
|
+
this.translationSquare.modelMatrix = newModelMatrix;
|
|
632
|
+
}
|
|
633
|
+
if (this.heightArrow) {
|
|
634
|
+
this.heightArrow.modelMatrix = newModelMatrix;
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
/**
|
|
638
|
+
* @description: 平移模型
|
|
639
|
+
* @param {*} draggedModel
|
|
640
|
+
* @param {*} startModelMatrix
|
|
641
|
+
* @param {*} movement
|
|
642
|
+
* @return {*}
|
|
643
|
+
*/
|
|
644
|
+
moveModel(draggedModel: any, startModelMatrix: any, movement: any) {
|
|
645
|
+
const Cesium = this.Cesium;
|
|
646
|
+
const viewer = this.viewer;
|
|
647
|
+
const scene = viewer.scene;
|
|
648
|
+
const rayHit: any = scene.globe.pick(viewer.camera.getPickRay(movement.endPosition), scene);
|
|
649
|
+
|
|
650
|
+
if (rayHit) {
|
|
651
|
+
const startPosition: any = Cesium.Matrix4.getTranslation(
|
|
652
|
+
startModelMatrix,
|
|
653
|
+
new Cesium.Cartesian3(),
|
|
654
|
+
);
|
|
655
|
+
const startCartographic = Cesium.Cartographic.fromCartesian(startPosition);
|
|
656
|
+
const cartographic = Cesium.Cartographic.fromCartesian(rayHit);
|
|
657
|
+
|
|
658
|
+
const newCartographic = new Cesium.Cartographic(
|
|
659
|
+
cartographic.longitude,
|
|
660
|
+
cartographic.latitude,
|
|
661
|
+
startCartographic.height,
|
|
662
|
+
);
|
|
663
|
+
|
|
664
|
+
const newPosition = Cesium.Cartographic.toCartesian(newCartographic);
|
|
665
|
+
const rotationMatrix = Cesium.Matrix4.getRotation(startModelMatrix, new Cesium.Matrix3());
|
|
666
|
+
const newModelMatrix = Cesium.Matrix4.fromRotationTranslation(rotationMatrix, newPosition);
|
|
667
|
+
|
|
668
|
+
draggedModel.modelMatrix = newModelMatrix;
|
|
669
|
+
|
|
670
|
+
this.updatedTool(newModelMatrix);
|
|
671
|
+
let position = new Cesium.Cartesian3(
|
|
672
|
+
newModelMatrix[12],
|
|
673
|
+
newModelMatrix[13],
|
|
674
|
+
newModelMatrix[14],
|
|
675
|
+
);
|
|
676
|
+
let dragEndCallback = this.dragEndCallbackMap.get(draggedModel.id);
|
|
677
|
+
if (!dragEndCallback) {
|
|
678
|
+
dragEndCallback = new Map();
|
|
679
|
+
this.dragEndCallbackMap.set(draggedModel.id, dragEndCallback);
|
|
680
|
+
}
|
|
681
|
+
dragEndCallback.set(GLTFManageEventKey.Translation, {
|
|
682
|
+
id: draggedModel.id,
|
|
683
|
+
position: position,
|
|
684
|
+
});
|
|
685
|
+
}
|
|
686
|
+
}
|
|
687
|
+
|
|
688
|
+
/**
|
|
689
|
+
* @description: 平移模型高度
|
|
690
|
+
* @param {*} draggedModel
|
|
691
|
+
* @param {*} startModelMatrix
|
|
692
|
+
* @param {*} movement
|
|
693
|
+
* @return {*}
|
|
694
|
+
*/
|
|
695
|
+
moveModelHeight(
|
|
696
|
+
draggedModel: any,
|
|
697
|
+
startModelMatrix: any,
|
|
698
|
+
movement: any,
|
|
699
|
+
startMousePosition: any,
|
|
700
|
+
) {
|
|
701
|
+
const Cesium = this.Cesium;
|
|
702
|
+
const viewer = this.viewer;
|
|
703
|
+
const scene = viewer.scene;
|
|
704
|
+
const deltaY = startMousePosition.y - movement.endPosition.y; // 竖直方向的移动量
|
|
705
|
+
|
|
706
|
+
const rayHit: any = scene.globe.pick(viewer.camera.getPickRay(movement.endPosition), scene);
|
|
707
|
+
|
|
708
|
+
if (rayHit) {
|
|
709
|
+
const startPosition: any = Cesium.Matrix4.getTranslation(
|
|
710
|
+
startModelMatrix,
|
|
711
|
+
new Cesium.Cartesian3(),
|
|
712
|
+
);
|
|
713
|
+
const startCartographic = Cesium.Cartographic.fromCartesian(startPosition);
|
|
714
|
+
|
|
715
|
+
const newCartographic = new Cesium.Cartographic(
|
|
716
|
+
startCartographic.longitude,
|
|
717
|
+
startCartographic.latitude,
|
|
718
|
+
startCartographic.height +
|
|
719
|
+
deltaY * 0.001 * Math.max(viewer.camera.positionCartographic.height, 1),
|
|
720
|
+
);
|
|
721
|
+
|
|
722
|
+
const newPosition = Cesium.Cartographic.toCartesian(newCartographic);
|
|
723
|
+
const rotationMatrix = Cesium.Matrix4.getRotation(startModelMatrix, new Cesium.Matrix3());
|
|
724
|
+
const newModelMatrix = Cesium.Matrix4.fromRotationTranslation(rotationMatrix, newPosition);
|
|
725
|
+
|
|
726
|
+
draggedModel.modelMatrix = newModelMatrix;
|
|
727
|
+
|
|
728
|
+
this.updatedTool(newModelMatrix);
|
|
729
|
+
let position = new Cesium.Cartesian3(
|
|
730
|
+
newModelMatrix[12],
|
|
731
|
+
newModelMatrix[13],
|
|
732
|
+
newModelMatrix[14],
|
|
733
|
+
);
|
|
734
|
+
let dragEndCallback = this.dragEndCallbackMap.get(draggedModel.id);
|
|
735
|
+
if (!dragEndCallback) {
|
|
736
|
+
dragEndCallback = new Map();
|
|
737
|
+
this.dragEndCallbackMap.set(draggedModel.id, dragEndCallback);
|
|
738
|
+
}
|
|
739
|
+
dragEndCallback.set(GLTFManageEventKey.Translation, {
|
|
740
|
+
id: draggedModel.id,
|
|
741
|
+
position: position,
|
|
742
|
+
});
|
|
743
|
+
// this.runEventListener(GLTFManageEventKey.Translation, {
|
|
744
|
+
// id: draggedModel.id,
|
|
745
|
+
// position: position,
|
|
746
|
+
// });
|
|
747
|
+
}
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
/**
|
|
751
|
+
* @description: 旋转模型
|
|
752
|
+
* @param {*} draggedModel
|
|
753
|
+
* @param {*} startModelMatrix
|
|
754
|
+
* @param {*} angleDelta
|
|
755
|
+
* @return {*}
|
|
756
|
+
*/
|
|
757
|
+
rotateModel(draggedModel: any, startModelMatrix: any, angleDelta: number) {
|
|
758
|
+
const Cesium = this.Cesium;
|
|
759
|
+
const viewer = this.viewer;
|
|
760
|
+
const modelHeadingPitchRoll = this.getModelHeadingPitchRoll(startModelMatrix);
|
|
761
|
+
const newHeading = modelHeadingPitchRoll.heading + angleDelta;
|
|
762
|
+
|
|
763
|
+
const headingPitchRoll = new Cesium.HeadingPitchRoll(
|
|
764
|
+
newHeading,
|
|
765
|
+
modelHeadingPitchRoll.pitch,
|
|
766
|
+
modelHeadingPitchRoll.roll,
|
|
767
|
+
);
|
|
768
|
+
|
|
769
|
+
const modelMatrix = Cesium.Transforms.headingPitchRollToFixedFrame(
|
|
770
|
+
Cesium.Matrix4.getTranslation(draggedModel.modelMatrix, new Cesium.Cartesian3()),
|
|
771
|
+
headingPitchRoll,
|
|
772
|
+
viewer.scene.globe.ellipsoid,
|
|
773
|
+
Cesium.Transforms.eastNorthUpToFixedFrame,
|
|
774
|
+
new Cesium.Matrix4(),
|
|
775
|
+
);
|
|
776
|
+
|
|
777
|
+
draggedModel.modelMatrix = modelMatrix;
|
|
778
|
+
let dragEndCallback = this.dragEndCallbackMap.get(draggedModel.id);
|
|
779
|
+
if (!dragEndCallback) {
|
|
780
|
+
dragEndCallback = new Map();
|
|
781
|
+
this.dragEndCallbackMap.set(draggedModel.id, dragEndCallback);
|
|
782
|
+
}
|
|
783
|
+
dragEndCallback.set(GLTFManageEventKey.Rotate, {
|
|
784
|
+
id: draggedModel.id,
|
|
785
|
+
headingPitchRoll: {
|
|
786
|
+
heading: Cesium.Math.toDegrees(newHeading),
|
|
787
|
+
pitch: Cesium.Math.toDegrees(modelHeadingPitchRoll.pitch),
|
|
788
|
+
roll: Cesium.Math.toDegrees(modelHeadingPitchRoll.roll),
|
|
789
|
+
},
|
|
790
|
+
});
|
|
791
|
+
}
|
|
792
|
+
|
|
793
|
+
cleanup() {
|
|
794
|
+
if (this.handler) {
|
|
795
|
+
this.handler.destroy();
|
|
796
|
+
this.handler = null;
|
|
797
|
+
}
|
|
798
|
+
}
|
|
799
|
+
}
|