mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-21 18:52:18 +00:00
Navara now matches Cesium where the review found it diverging: a flight holds the camera inputs, camera.changed counts turns as Cesium does, render requests made during a frame survive it, follow pinches zoom, ground widths follow the pixel ratio and Cyber sonar reaches glyph caches and models. On Cesium, a staged imagery swap keeps loading tiles, setView replaces a running flight, and a cleared weather detail goes away. The contract gains MoverSet.failed, maps.terrainRevision, render.maxTextureSize and surface.sampleTerrainMostDetailed on every engine, so layers retry failed models, key road heights by terrain, size weather textures to the GPU and place Bhote Koshi cards on detailed terrain. Engine switches keep the live view, follows, focus, layer options and cards: a pick hands over the exact pose, applies no address options and pans no carried-over card; a history visit still applies its entry. Layers put GhostMaps pins, cable landings, OSM Places and directions on the measured surface without per-frame sampling, draw the Cockpit contact dot, hide disabled CCTV on attach, and keep ALPR running outside secure contexts. KML imports draw raised polygon fills, rotated and coloured ground overlays and north-referenced icon headings, and report files with nothing to draw. QA scripts read the contract instead of Cesium internals (test:track is 109/109 again), wait for the camera to rest before clicking, and give cold switches and parked engines realistic time. Docs follow the code.
63 lines
1.9 KiB
JavaScript
63 lines
1.9 KiB
JavaScript
import test from 'node:test';
|
|
import assert from 'node:assert/strict';
|
|
import { createFakeEngine } from '../globe/testing/fakeEngine.js';
|
|
import { LayerLifecycle } from './lifecycle.js';
|
|
import { cancelCameraArrival, ownCameraArrival } from './cameraArrival.js';
|
|
|
|
test('an arrival owned on the engine yields to a cancel on the engine', () => {
|
|
const engine = createFakeEngine();
|
|
const cancelled = [];
|
|
// A correction releases its ownership when it stops, as the ground guard does.
|
|
const own = (key, name) => {
|
|
let release = () => {};
|
|
release = ownCameraArrival(key, () => {
|
|
cancelled.push(name);
|
|
release();
|
|
});
|
|
};
|
|
own(engine, 'first');
|
|
cancelCameraArrival(engine);
|
|
own(engine, 'second');
|
|
cancelCameraArrival(engine);
|
|
assert.deepEqual(cancelled, ['first', 'second']);
|
|
});
|
|
|
|
test('a newer arrival replaces the older one and release is idempotent', () => {
|
|
const engine = createFakeEngine();
|
|
const seen = [];
|
|
const releaseOld = ownCameraArrival(engine, () => seen.push('old'));
|
|
ownCameraArrival(engine, () => seen.push('new'));
|
|
assert.deepEqual(seen, ['old']);
|
|
releaseOld();
|
|
cancelCameraArrival(engine);
|
|
assert.deepEqual(seen, ['old', 'new']);
|
|
cancelCameraArrival(null);
|
|
assert.deepEqual(seen, ['old', 'new']);
|
|
});
|
|
|
|
test('disabling a layer cancels an engine arrival without a native viewer', async () => {
|
|
const engine = createFakeEngine();
|
|
const manager = new LayerLifecycle(null, { engine });
|
|
manager.register({
|
|
id: 'arrival',
|
|
name: 'Arrival',
|
|
init() {},
|
|
enable() {},
|
|
disable() {},
|
|
update() {},
|
|
updateInterval: -1,
|
|
});
|
|
let cancelled = 0;
|
|
const release = ownCameraArrival(engine, () => {
|
|
cancelled++;
|
|
});
|
|
try {
|
|
await manager.setEnabled('arrival', false);
|
|
assert.equal(cancelled, 1);
|
|
} finally {
|
|
release();
|
|
await manager.destroyLayer('arrival');
|
|
engine.destroy();
|
|
}
|
|
});
|