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
@@ -3,6 +3,7 @@ import { createStandalonePlaceSearch } from '../standalone/placeSearch.js';
|
||||
import { test } from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import * as Cesium from 'cesium';
|
||||
import * as geo from '../geo/index.js';
|
||||
import { CCTV_FOCUS_RESULT } from '../data/cctv.js';
|
||||
import { getContextStore, registerEntityContext } from '../data/contextStore.js';
|
||||
import { DataLayerManager } from '../data/manager.js';
|
||||
@@ -2820,7 +2821,8 @@ test('a nested Cockpit rollback result is translated too', async () => {
|
||||
* analyst's 2 000-record last-fix slice). These pin the unified engine.
|
||||
*/
|
||||
function awarenessSubjectHarness({ subject, flights = [], military = [] }) {
|
||||
const position = subject ? { __subject: true } : null;
|
||||
// The Contacts subject sits at 29.9 N, 97.9 W, 9 000 m.
|
||||
const position = subject ? geo.cartesian3.fromDegrees(-97.9, 29.9, 9000) : null;
|
||||
const snapshotFlights = flights.slice(0, 20_000);
|
||||
const snapshotMilitary = military.slice(0, 20_000);
|
||||
return {
|
||||
@@ -2887,7 +2889,6 @@ async function withAwareness(harness, run) {
|
||||
aircraftSnapshot: awareness.getAircraftQuerySnapshot,
|
||||
flightsNearby: flightsLayer.getNearby,
|
||||
militaryNearby: militaryLayer.getNearby,
|
||||
cartoFrom: Cesium.Cartographic.fromCartesian,
|
||||
};
|
||||
awareness.getContextSnapshot = () => harness.snapshot;
|
||||
awareness.getAircraftQuerySnapshot = () => {
|
||||
@@ -2920,11 +2921,6 @@ async function withAwareness(harness, run) {
|
||||
};
|
||||
flightsLayer.getNearby = () => harness.flights.slice();
|
||||
militaryLayer.getNearby = () => harness.military.slice();
|
||||
Cesium.Cartographic.fromCartesian = (value) => (
|
||||
value?.__subject
|
||||
? { latitude: Cesium.Math.toRadians(29.9), longitude: Cesium.Math.toRadians(-97.9), height: 9000 }
|
||||
: originals.cartoFrom(value)
|
||||
);
|
||||
try {
|
||||
return await run(awareness);
|
||||
} finally {
|
||||
@@ -2932,7 +2928,6 @@ async function withAwareness(harness, run) {
|
||||
awareness.getAircraftQuerySnapshot = originals.aircraftSnapshot;
|
||||
flightsLayer.getNearby = originals.flightsNearby;
|
||||
militaryLayer.getNearby = originals.militaryNearby;
|
||||
Cesium.Cartographic.fromCartesian = originals.cartoFrom;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user