Fix the review findings across the engines, layers, data and QA

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.
This commit is contained in:
German Khokhlov committed 2026-11-09 21:34:42 +04:00
1 parent 69fbf5b38d
commit 0ef29781e5
276 files changed
+7217 -1517

No files matched your search

+57
View File
@@ -0,0 +1,57 @@
// CCTV icon thinning must use the camera's real vertical FOV. In a 16:9
// window with Cesium's default fov 60deg the vertical FOV is about 36deg;
// main read it from viewer.camera.frustum.fovy. Two cameras 17 m apart seen
// from 2 km: with fovy 36deg the cell is ~48 m (< VIEW_MIN_CELL_M, both shown),
// with the hard-coded pi/3 fallback it is ~86 m and one camera is hidden.
import { test } from 'node:test';
import assert from 'node:assert/strict';
import { createRendering } from './rendering.js';
import { isVideoFeedType } from '../../sources/cctvTypes.js';
const FOVY_16_9 = 2 * Math.atan(Math.tan(Math.PI / 6) / (16 / 9));
test('icon thinning uses the camera vertical FOV, not a pi/3 fallback', () => {
const record = (id, lat, x) => ({
camera: { id, lat, lon: 0, feedType: 'image' },
billboard: { show: true, position: { x, y: 0, z: 0 } },
});
const a = record('cam-a', 10.0005, 0);
const b = record('cam-b', 10.00065, 17);
const pose = { fovy: FOVY_16_9 };
const state = {
_enabled: true,
_records: [a, b],
_viewRecords: [],
_healthById: new Map(),
_activeCameraId: null,
};
const renderer = {
ready: true,
viewport: () => ({ width: 1920, height: 1080 }),
horizonTest: () => () => true,
project: () => ({ x: 960, y: 540 }),
distance: () => 2000,
// Accessor the fix is expected to add (any name works if the stub follows).
cameraPose: () => pose,
fovy: () => pose.fovy,
engine: { camera: { pose: () => pose } },
};
const { refreshHorizonCulling } = createRendering({
state,
services: {
focus: {
focusNowMs: (n) => n,
getFocusTarget: () => null,
focusPassIsNeeded: () => false,
advanceSpriteFocus: () => ({ factor: 1 }),
focusAlphaNeedsWrite: () => false,
},
},
parts: { renderer, model: { isVideoFeedType } },
source: {},
});
refreshHorizonCulling();
assert.equal(a.billboard.show, true, 'cam-a shown');
assert.equal(b.billboard.show, true, 'cam-b shown');
assert.equal(state._viewRecords.length, 2);
});