fix: 修复卫星和地面站管理器中的多余括号和注释,优化代码可读性

This commit is contained in:
严浩
2025-04-03 12:47:15 +08:00
parent 8198fefe91
commit 29678d8f61
2 changed files with 3 additions and 10 deletions

View File

@ -5,7 +5,6 @@ import type { MaybeRefOrGetter } from 'vue';
import type { HCesiumManager } from './managers/HCesiumManager'; // 导入新的 Viewer Manager
import type { I卫星 } from './managers/HCesiumManager.types'; // 类型定义保持不变
// ESLint: Add blank line between type and value imports
import { SatelliteCalculator } from './calculators/SatelliteCalculator'; // 导入计算器
import { SatelliteManager } from './managers/HCesiumManager.卫星'; // 导入 Satellite Manager
@ -72,25 +71,20 @@ export function useHCesiumViewerClsSatellite(
if (!currentEntityIds.has(selectedId)) {
const satelliteToAdd = satelliteMap.value.get(selectedId);
if (satelliteToAdd) {
// console.debug(
// `尝试添加卫星 "${satelliteToAdd.id}" 到地图`, // 简化日志
// );
manager.addOrUpdateSatellite(satelliteToAdd); // 使用 manager 的添加/更新方法
} else {
// 如果在 satelliteList 中找不到对应的卫星信息,发出警告
console.warn(`无法找到 ID 为 "${selectedId}" 的卫星信息,无法添加到地图。`);
}
}
} // <--- 移除这个多余的括号
}
// watch 的回调函数不需要 onCleanup
},
{ immediate: true, deep: false }, // 立即执行一次,非深度监听
); // watch 结束
// 组件卸载时确保最终清理
onBeforeUnmount(() => {
// console.log('Unmounting component, ensuring SatelliteManager cleanup');
satelliteManager.value?.destroy();
satelliteManager.value = null; // 明确置空
});

View File

@ -75,18 +75,17 @@ export function useHCesiumViewerClsGroundStation(
}
}
},
{ immediate: true, deep: false }, // 立即执行一次,非深度监听(通常足够)
{ immediate: true, deep: false }, // 立即执行一次,非深度监听
); // watch 结束
// 组件卸载时确保最终清理
onBeforeUnmount(() => {
// console.log('Unmounting component, ensuring GroundStationManager cleanup');
groundStationManager.value?.destroy();
groundStationManager.value = null; // 明确置空
});
// 返回 stationMap 可能在某些场景下有用,例如调试或扩展
return {
stationMap, // 可以考虑是否真的需要返回这个
stationMap,
};
}