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 @@