From 99b5aeb0427ee78e5489a79623a50c47ee074254 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=A5=E6=B5=A9?= Date: Tue, 1 Apr 2025 16:20:22 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E9=87=8D=E6=9E=84=E5=9C=B0=E9=9D=A2?= =?UTF-8?q?=E7=AB=99=E7=AE=A1=E7=90=86=E9=80=BB=E8=BE=91=EF=BC=8C=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=20GroundStationState=20=E6=8E=A5=E5=8F=A3=EF=BC=8C?= =?UTF-8?q?=E4=BC=98=E5=8C=96=E7=BB=84=E4=BB=B6=E9=97=B4=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E4=BC=A0=E9=80=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../h-cesium-viewer/h-cesium-viewer-class.ts | 8 +- src/components/h-cesium-viewer/index.vue | 74 +++++-------------- src/components/h-cesium-viewer/types.ts | 12 +++ .../h-cesium-viewer/useHCesiumViewerCls.ts | 24 ++++++ .../useHCesiumViewerClsGroundStation.ts | 65 ++++++++++++++++ src/pages/cesium-viewer.page.vue | 58 ++++++++------- 6 files changed, 151 insertions(+), 90 deletions(-) create mode 100644 src/components/h-cesium-viewer/types.ts create mode 100644 src/components/h-cesium-viewer/useHCesiumViewerCls.ts create mode 100644 src/components/h-cesium-viewer/useHCesiumViewerClsGroundStation.ts diff --git a/src/components/h-cesium-viewer/h-cesium-viewer-class.ts b/src/components/h-cesium-viewer/h-cesium-viewer-class.ts index ee48430..2b38d38 100644 --- a/src/components/h-cesium-viewer/h-cesium-viewer-class.ts +++ b/src/components/h-cesium-viewer/h-cesium-viewer-class.ts @@ -33,7 +33,7 @@ export class HCesiumViewerCls { */ addGroundStation(options: GroundStationOptions): Cesium.Entity | null { if (!this.viewer) { - console.error('视图未初始化。无法添加地面站。'); // 使用 console.error 替代抛出错误,以便在 index.vue 中处理 + console.error('视图未初始化。无法添加地面站。'); return null; } @@ -101,13 +101,8 @@ export class HCesiumViewerCls { } } - // 移除 highlightStation 和 unhighlightStation 方法 - clearAllGroundStations() { - // ... (清理逻辑不变) if (!this.viewer) return; - // 优化:直接遍历 Map 清理,避免重复查找 - // 使用 for...of 循环替代 forEach for (const entity of this.currentStationEntities.values()) { this.viewer?.entities.remove(entity); } @@ -115,7 +110,6 @@ export class HCesiumViewerCls { } destroy() { - // ... (销毁逻辑不变) if (this.viewer) { this.clearAllGroundStations(); this.viewer.destroy(); diff --git a/src/components/h-cesium-viewer/index.vue b/src/components/h-cesium-viewer/index.vue index 7527358..59fff2d 100644 --- a/src/components/h-cesium-viewer/index.vue +++ b/src/components/h-cesium-viewer/index.vue @@ -1,62 +1,28 @@