diff --git a/package.json b/package.json index aaed119..50f9bdb 100644 --- a/package.json +++ b/package.json @@ -78,7 +78,7 @@ "radash": "^12.1.0", "radix-vue": "^1.9.17", "reka-ui": "^2.2.0", - "satellite.js": "^5.0.0", + "satellite.js": "^6.0.0", "sortablejs": "^1.15.6", "tailwind-merge": "^3.2.0", "tdesign-icons-vue-next": "^0.3.5", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index b6fdbc4..225257e 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -116,8 +116,8 @@ importers: specifier: ^2.2.0 version: 2.2.0(typescript@5.8.3)(vue@3.5.13(typescript@5.8.3)) satellite.js: - specifier: ^5.0.0 - version: 5.0.0 + specifier: ^6.0.0 + version: 6.0.0 sortablejs: specifier: ^1.15.6 version: 1.15.6 @@ -4086,8 +4086,8 @@ packages: engines: {node: '>=16.0.0'} hasBin: true - satellite.js@5.0.0: - resolution: {integrity: sha512-ie3yiJ2LJAJIhVUKdYhgp7V0btXKAMImDjRnuaNfJGl8rjwP2HwVIh4HLFcpiXYEiYwXc5fqh5+yZqCe6KIwWw==} + satellite.js@6.0.0: + resolution: {integrity: sha512-A1OTZpIDgzCj1SYJZYs3aISsBuhE0jAZG3n6Pymxq5FFsScNSLIgabu8a1w0Wu56Mf1eoL+pcK4tXgaPNXtdSw==} sax@1.4.1: resolution: {integrity: sha512-+aWOz7yVScEGoKNd4PA10LZ8sk0A/z5+nXQG5giUO5rprX9jgYsTdov9qCchZiPIZezbZH+jRut8nPodFAX4Jg==} @@ -8816,7 +8816,7 @@ snapshots: sass-embedded-win32-ia32: 1.86.3 sass-embedded-win32-x64: 1.86.3 - satellite.js@5.0.0: {} + satellite.js@6.0.0: {} sax@1.4.1: optional: true diff --git a/src/components/h-cesium-viewer/calculators/SatelliteCalculator.ts b/src/components/h-cesium-viewer/calculators/SatelliteCalculator.ts index f51b831..af1535d 100644 --- a/src/components/h-cesium-viewer/calculators/SatelliteCalculator.ts +++ b/src/components/h-cesium-viewer/calculators/SatelliteCalculator.ts @@ -66,7 +66,7 @@ export class SatelliteCalculator { try { const positionAndVelocity = propagate(satrec, jsDate); - if (typeof positionAndVelocity.position === 'boolean') { + if (positionAndVelocity === null) { console.warn(`卫星 ${satelliteId} 在时间 ${jsDate} 位置计算失败或已衰减。`); continue; // 跳过这个时间点 } diff --git a/src/pages/_cesium-demos/demo_01_OrbitGeneration.ts b/src/pages/_cesium-demos/demo_01_OrbitGeneration.ts index 08ec62c..d66342d 100644 --- a/src/pages/_cesium-demos/demo_01_OrbitGeneration.ts +++ b/src/pages/_cesium-demos/demo_01_OrbitGeneration.ts @@ -35,9 +35,8 @@ export async function demo_01_OrbitGeneration(viewer: Viewer) { // 获取卫星位置 const positionAndVelocity = propagate(satrec, time); - // 有时可能返回false - const position = positionAndVelocity.position; - if (typeof position === 'boolean') { + const position = positionAndVelocity?.position; + if (!position) { console.error('Error calculating satellite position'); return; } @@ -58,9 +57,9 @@ export async function demo_01_OrbitGeneration(viewer: Viewer) { // 获取当前位置用于放置卫星模型 const time = new Date(); const positionAndVelocity = propagate(satrec, time); - const position = positionAndVelocity.position; + const position = positionAndVelocity?.position; const gmst = gstime(time); - if (typeof position === 'boolean') { + if (!position) { console.error('Error calculating satellite position'); return; } diff --git a/src/pages/_cesium-demos/demo_02_Track.ts b/src/pages/_cesium-demos/demo_02_Track.ts index a63a23b..1571ced 100644 --- a/src/pages/_cesium-demos/demo_02_Track.ts +++ b/src/pages/_cesium-demos/demo_02_Track.ts @@ -86,7 +86,7 @@ export async function demo_02_Track( // 计算卫星位置 const positionAndVelocity = propagate(satrec, jsDate); - if (typeof positionAndVelocity.position === 'boolean') { + if (positionAndVelocity === null) { console.error('Error calculating satellite position'); } else { const gmst = gstime(jsDate); diff --git a/src/pages/_cesium-demos/归档/SatelliteEntity.ts b/src/pages/_cesium-demos/归档/SatelliteEntity.ts index 3758427..53d9a5e 100644 --- a/src/pages/_cesium-demos/归档/SatelliteEntity.ts +++ b/src/pages/_cesium-demos/归档/SatelliteEntity.ts @@ -97,8 +97,7 @@ class SatelliteEntity { // 获取地心惯性坐标系坐标 getPositionEci(date: Date) { const result = propagate(this.satrec, date); - // 检查position是否为对象且不是true - if (typeof result.position !== 'object' || result.position === null) { + if (result === null) { return null; } return result.position;