mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 16:22:20 +00:00
refactor(ui,voice,annotations,scenes): take vector maths from src/geo
Move the Cartesian3/Cartographic/Matrix4/Transforms/Ellipsoid/Math calls of the second batch (cockpit camera, context and controller; camera orientation controls; application shell; location navigation; the annotation resolver and engine; voice actions and pointer pick; the scene director; the embed app) to src/geo. Behaviour is unchanged: same argument order, same `result` semantics. Kept on Cesium: out-of-scope classes (HeadingPitchRange, BoundingSphere, Intersect, EllipsoidalOccluder, EasingFunction, SceneTransforms, JulianDate), WGS84 where it goes into pickEllipsoid or EllipsoidalOccluder, Matrix4.IDENTITY handed to lookAtTransform, and the Cartesian2 window positions that reach scene.pickPosition: Cesium keys its per-frame pick cache on windowPosition.toString(), which a plain object would collapse to one "[object Object]" key. The Contacts-subject harness in gevActions.test stubbed Cesium.Cartographic.fromCartesian to place its subject; it now builds a real subject position at the same coordinates with geo.cartesian3.fromDegrees. The cockpit-controls and scenes package-boundary groups now own the src/geo files.
This commit is contained in:
1 parent
d886be68a8
commit
1a69368ae6
14 files changed
+216
-200
No files matched your search
@@ -30,6 +30,7 @@ import {
|
||||
} from './cyberSonarControls.js';
|
||||
|
||||
import * as Cesium from 'cesium';
|
||||
import * as geo from '../geo/index.js';
|
||||
|
||||
import { aircraftTrackingTarget } from '../cockpitTracking.js';
|
||||
|
||||
@@ -1317,12 +1318,12 @@ export class StyleManager extends ShellFacade {
|
||||
const carto = this.viewer.camera.positionCartographic;
|
||||
if (!carto) return null;
|
||||
return {
|
||||
lat: Cesium.Math.toDegrees(carto.latitude),
|
||||
lon: Cesium.Math.toDegrees(carto.longitude),
|
||||
lat: geo.math.toDegrees(carto.latitude),
|
||||
lon: geo.math.toDegrees(carto.longitude),
|
||||
alt: carto.height,
|
||||
heading: Cesium.Math.toDegrees(this.viewer.camera.heading),
|
||||
pitch: Cesium.Math.toDegrees(this.viewer.camera.pitch),
|
||||
roll: Cesium.Math.toDegrees(this.viewer.camera.roll),
|
||||
heading: geo.math.toDegrees(this.viewer.camera.heading),
|
||||
pitch: geo.math.toDegrees(this.viewer.camera.pitch),
|
||||
roll: geo.math.toDegrees(this.viewer.camera.roll),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1335,15 +1336,15 @@ export class StyleManager extends ShellFacade {
|
||||
applyCameraState(cameraState, duration = 2.8) {
|
||||
if (!cameraState) return;
|
||||
this.viewer.camera.flyTo({
|
||||
destination: Cesium.Cartesian3.fromDegrees(
|
||||
destination: geo.cartesian3.fromDegrees(
|
||||
cameraState.lon,
|
||||
cameraState.lat,
|
||||
cameraState.alt,
|
||||
),
|
||||
orientation: {
|
||||
heading: Cesium.Math.toRadians(cameraState.heading || 0),
|
||||
pitch: Cesium.Math.toRadians(cameraState.pitch || -35),
|
||||
roll: Cesium.Math.toRadians(cameraState.roll || 0),
|
||||
heading: geo.math.toRadians(cameraState.heading || 0),
|
||||
pitch: geo.math.toRadians(cameraState.pitch || -35),
|
||||
roll: geo.math.toRadians(cameraState.roll || 0),
|
||||
},
|
||||
duration: Math.max(0.2, duration || 0),
|
||||
easingFunction: Cesium.EasingFunction.CUBIC_IN_OUT,
|
||||
|
||||
Reference in new issue
Block a user