mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +00:00
Fly layer focus flights through the camera port
flyToBounds takes an easing, as flyTo does: in the contract, the Cesium port and the reference recorder, pinned by a new conformance trace. The flights of radio, awareness, CCTV, submarine cables, cyclones, the launch preview, installations, ALPR, street-level framing, recent imagery, weather and world focus now go through the renderer's camera port. Street-level framing cancels its own flight handle rather than whatever flight is current. worldFocus.js no longer reaches Cesium and leaves the allow-list. Layer pose reads stay for each layer's own slice. The local GeoJSON flight stays on Cesium: gods-eye-view/infrastructure is used with plain Cesium viewers that have no renderer bound.
This commit is contained in:
1 parent
46a53bb49c
commit
c5b716b107
31 files changed
+2349
-871
No files matched your search
@@ -3,6 +3,7 @@
|
||||
import { test } from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import * as Cesium from 'cesium';
|
||||
import { bindFakeCesiumCamera } from '../testSupport/fakeCameraPort.mjs';
|
||||
import alprCamerasLayer, {
|
||||
createAlprCamerasLayer,
|
||||
configureAlprSource,
|
||||
@@ -342,6 +343,9 @@ function cameraHarness(layer = alprCamerasLayer) {
|
||||
remove() {},
|
||||
},
|
||||
};
|
||||
bindFakeCesiumCamera(viewer);
|
||||
// The renderer's camera port relays moveEnd; the layer's own come on top.
|
||||
const portMoveEndListeners = viewer.camera.moveEnd.numberOfListeners;
|
||||
const setInput = Cesium.ScreenSpaceEventHandler.prototype.setInputAction;
|
||||
Cesium.ScreenSpaceEventHandler.prototype.setInputAction = function (
|
||||
fn,
|
||||
@@ -364,6 +368,7 @@ function cameraHarness(layer = alprCamerasLayer) {
|
||||
layer.enable();
|
||||
return {
|
||||
viewer,
|
||||
portMoveEndListeners,
|
||||
requests,
|
||||
credits,
|
||||
get source() {
|
||||
@@ -932,7 +937,10 @@ test('two factories keep their requests, records and destruction independent', a
|
||||
b.source.entities.values[0],
|
||||
)?.labelModel.details.includes('Source: Test directory'),
|
||||
);
|
||||
assert.equal(a.viewer.camera.moveEnd.numberOfListeners, 0);
|
||||
assert.equal(
|
||||
a.viewer.camera.moveEnd.numberOfListeners,
|
||||
a.portMoveEndListeners,
|
||||
);
|
||||
assert.equal(a.viewer.scene.postRender.numberOfListeners, 0);
|
||||
} finally {
|
||||
b.restore();
|
||||
|
||||
+14
-13
@@ -13,6 +13,7 @@
|
||||
//
|
||||
// computeFrustumGeometry is PURE (no viewer, no scene queries) so it runs under
|
||||
// plain node:test.
|
||||
import { bindFakeCesiumCamera } from '../testSupport/fakeCameraPort.mjs';
|
||||
import { test } from 'node:test';
|
||||
// Preserve structural pins across component qualification and formatter wrapping.
|
||||
function componentFunctionSource(fn) {
|
||||
@@ -868,6 +869,7 @@ test('CCTV focus distinguishes tracking ownership from a missing active camera',
|
||||
},
|
||||
},
|
||||
};
|
||||
bindFakeCesiumCamera(viewer);
|
||||
const record = {
|
||||
camera: { rangeM: 210, headingDeg: 41 },
|
||||
position: { x: 1, y: 2, z: 3 },
|
||||
@@ -899,6 +901,7 @@ test('CCTV focus reports when the camera flight starts', () => {
|
||||
},
|
||||
},
|
||||
};
|
||||
bindFakeCesiumCamera(viewer);
|
||||
const record = {
|
||||
camera: { rangeM: 210, headingDeg: 41 },
|
||||
position: { x: 1, y: 2, z: 3 },
|
||||
@@ -919,6 +922,7 @@ test('CCTV focus refuses camera flights while cockpit owns the view', () => {
|
||||
},
|
||||
},
|
||||
};
|
||||
bindFakeCesiumCamera(viewer);
|
||||
const record = {
|
||||
camera: { rangeM: 210, headingDeg: 41 },
|
||||
position: { x: 1, y: 2, z: 3 },
|
||||
@@ -1397,19 +1401,16 @@ test('CCTV drag-then-release over a camera is inert, while a clean tap activates
|
||||
target.addEventListener(CCTV_FOCUS_REQUEST_EVENT, (event) =>
|
||||
requests.push(event.detail),
|
||||
);
|
||||
bindCctvWorldClickGesture(
|
||||
input,
|
||||
() => {
|
||||
activateCctvCameraFromWorldClick(
|
||||
'atx-cam-3',
|
||||
() => {
|
||||
activationCalls += 1;
|
||||
return CCTV_ACTIVATION_RESULT.ACTIVATED;
|
||||
},
|
||||
target,
|
||||
);
|
||||
},
|
||||
);
|
||||
bindCctvWorldClickGesture(input, () => {
|
||||
activateCctvCameraFromWorldClick(
|
||||
'atx-cam-3',
|
||||
() => {
|
||||
activationCalls += 1;
|
||||
return CCTV_ACTIVATION_RESULT.ACTIVATED;
|
||||
},
|
||||
target,
|
||||
);
|
||||
});
|
||||
|
||||
handler.fire(GESTURE_TYPES.LEFT_DOWN, { position: { x: 10, y: 10 } });
|
||||
timeMs = 20;
|
||||
|
||||
@@ -48,6 +48,7 @@ import {
|
||||
import { NAVIGATION_AUTHORITY_EVENT } from '../navigationPolicy.js';
|
||||
import { withEntityRecord } from './entityRecords.js';
|
||||
import { framePortFor } from '../testSupport/fakeFramePort.mjs';
|
||||
import { bindFakeCesiumCamera } from '../testSupport/fakeCameraPort.mjs';
|
||||
|
||||
const militaryAwarenessSource = readLayerSource(
|
||||
new URL('./militaryAwareness.js', import.meta.url),
|
||||
@@ -183,6 +184,7 @@ function installAwarenessRuntime({
|
||||
},
|
||||
container: new FakeElement(),
|
||||
};
|
||||
bindFakeCesiumCamera(viewer);
|
||||
const layers = new Map(
|
||||
AWARENESS_DEPENDENCIES.map((layerId) => [
|
||||
layerId,
|
||||
@@ -825,7 +827,10 @@ for (const fixture of [
|
||||
let retrackCalls = 0;
|
||||
|
||||
try {
|
||||
const trackedEntity = withEntityRecord({}, { trackedId: `${subject.layerId}:${subject.id}` });
|
||||
const trackedEntity = withEntityRecord(
|
||||
{},
|
||||
{ trackedId: `${subject.layerId}:${subject.id}` },
|
||||
);
|
||||
runtime.viewer.trackedEntity = trackedEntity;
|
||||
replaceMethod(
|
||||
fixture.layer,
|
||||
@@ -927,7 +932,10 @@ test('Contacts activation adopts the production military tracked-subject descrip
|
||||
),
|
||||
'mutating one accessor result must not alter the tracked source position',
|
||||
);
|
||||
runtime.viewer.trackedEntity = withEntityRecord({}, { trackedId: `military:${id}` });
|
||||
runtime.viewer.trackedEntity = withEntityRecord(
|
||||
{},
|
||||
{ trackedId: `military:${id}` },
|
||||
);
|
||||
replaceMethod(flightsLayer, 'getTrackedSubject', () => null, restores);
|
||||
replaceMethod(
|
||||
flightsLayer,
|
||||
@@ -1032,7 +1040,10 @@ test('production military tracked-subject label falls back to registration befor
|
||||
'getAllPositions id stays the identity hex',
|
||||
);
|
||||
|
||||
runtime.viewer.trackedEntity = withEntityRecord({}, { trackedId: `military:${id}` });
|
||||
runtime.viewer.trackedEntity = withEntityRecord(
|
||||
{},
|
||||
{ trackedId: `military:${id}` },
|
||||
);
|
||||
replaceMethod(flightsLayer, 'getTrackedSubject', () => null, restores);
|
||||
replaceMethod(flightsLayer, 'trackById', () => true, restores);
|
||||
replaceMethod(militaryFlightsLayer, 'trackById', () => true, restores);
|
||||
@@ -1104,7 +1115,10 @@ test('a cached Context subject re-reads its label when enrichment lands after se
|
||||
meta,
|
||||
});
|
||||
|
||||
runtime.viewer.trackedEntity = withEntityRecord({}, { trackedId: `flights:${id}` });
|
||||
runtime.viewer.trackedEntity = withEntityRecord(
|
||||
{},
|
||||
{ trackedId: `flights:${id}` },
|
||||
);
|
||||
replaceMethod(
|
||||
militaryFlightsLayer,
|
||||
'getTrackedSubject',
|
||||
@@ -1247,7 +1261,10 @@ test('Contacts activation adopts the production civilian tracked-subject descrip
|
||||
),
|
||||
'mutating one accessor result must not alter the tracked source position',
|
||||
);
|
||||
runtime.viewer.trackedEntity = withEntityRecord({}, { trackedId: `flights:${id}` });
|
||||
runtime.viewer.trackedEntity = withEntityRecord(
|
||||
{},
|
||||
{ trackedId: `flights:${id}` },
|
||||
);
|
||||
replaceMethod(
|
||||
militaryFlightsLayer,
|
||||
'getTrackedSubject',
|
||||
@@ -1334,7 +1351,10 @@ test('Contacts activation reconciles to a newer cross-layer tracked flight after
|
||||
const restores = [];
|
||||
|
||||
try {
|
||||
runtime.viewer.trackedEntity = withEntityRecord({}, { trackedId: 'flights:first' });
|
||||
runtime.viewer.trackedEntity = withEntityRecord(
|
||||
{},
|
||||
{ trackedId: 'flights:first' },
|
||||
);
|
||||
replaceMethod(
|
||||
flightsLayer,
|
||||
'getTrackedSubject',
|
||||
@@ -1357,7 +1377,10 @@ test('Contacts activation reconciles to a newer cross-layer tracked flight after
|
||||
|
||||
civilianTracked = null;
|
||||
militaryTracked = awarenessSubject('military', 'latest', positions.latest);
|
||||
runtime.viewer.trackedEntity = withEntityRecord({}, { trackedId: 'military:latest' });
|
||||
runtime.viewer.trackedEntity = withEntityRecord(
|
||||
{},
|
||||
{ trackedId: 'military:latest' },
|
||||
);
|
||||
releaseDependencies();
|
||||
await nextTurn();
|
||||
await nextTurn();
|
||||
@@ -1401,7 +1424,10 @@ test('tracked flight cleared during Contacts activation suppresses fallback auto
|
||||
const focused = [];
|
||||
|
||||
try {
|
||||
runtime.viewer.trackedEntity = withEntityRecord({}, { trackedId: 'flights:selected' });
|
||||
runtime.viewer.trackedEntity = withEntityRecord(
|
||||
{},
|
||||
{ trackedId: 'flights:selected' },
|
||||
);
|
||||
replaceMethod(flightsLayer, 'getTrackedSubject', () => tracked, restores);
|
||||
replaceMethod(
|
||||
militaryFlightsLayer,
|
||||
@@ -1999,7 +2025,7 @@ test('vessel entry and selection framing both use the 3 km focus radius', () =>
|
||||
);
|
||||
const focusRadiusUses =
|
||||
militaryAwarenessSource.match(
|
||||
/new\s*Cesium\.BoundingSphere\(\s*vessel\.position,\s*VESSEL_FOCUS_RADIUS_M,?\s*\)/g,
|
||||
/\{\s*center:\s*vessel\.position,\s*radius:\s*VESSEL_FOCUS_RADIUS_M\s*\}/g,
|
||||
) || [];
|
||||
assert.equal(focusRadiusUses.length, 2);
|
||||
});
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
+1179
-476
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user