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

+3 -6
View File
@@ -162,15 +162,12 @@ export function createVoiceAreas({
findRegion = findNaturalRegion,
findAdminCandidates = findBundledAdminCandidates,
aroundOutlineMs = AROUND_OUTLINE_MS,
} = {}) {
// An area an outline on the map still refers to is never evicted: its
// counting geometry must outlive the display copy drawn from it.
const store = createAreaStore({
store = createAreaStore({
isPinned: (areaId) =>
typeof annotations?.list === 'function' &&
annotations.list().some((anno) => anno?.areaId === areaId),
});
}),
} = {}) {
/** The ground at the centre of the view, else the camera's position. */
function viewCenter() {
const picked = annotationResolver?.pickWorldFromScreen?.(engine, 0.5, 0.5);
+5 -3
View File
@@ -374,7 +374,7 @@ export function createGevActionRunner({
cameraHandoffs += 1;
}) ?? null;
let analystEngine;
// Area handles live for this runner (the page): resolve_area, the
// Area handles live for the page session: resolve_area, the
// analyst's region/area/drawn scopes, find_imagery and osm_query all read
// the same store.
const voiceAreas = createVoiceAreas({
@@ -3314,12 +3314,14 @@ export async function getBasemapLabelContext(
const latitude = Number(geo.math.toDegrees(viewTarget.latitude).toFixed(6));
const longitude = Number(geo.math.toDegrees(viewTarget.longitude).toFixed(6));
const pose = engine.camera.pose();
const view = placeLookupView({
latitude,
longitude,
rangeM: viewTargetRangeM(engine, viewTarget, cameraHeightM),
fovRad: engine.camera.pose().fovy,
aspectRatio: engine.camera.pose().aspectRatio,
fovRad:
2 * Math.atan(Math.tan(pose.fovy / 2) * Math.max(1, pose.aspectRatio)),
aspectRatio: pose.aspectRatio,
tier: basemapLookupTier(cameraHeightM),
});
if (
+11
View File
@@ -6,6 +6,7 @@ import { cameraPoseKey, createPointerTracker } from './pointerContext.js';
import { createPointerPicker } from './pointerPick.js';
import { createReferentRegistry } from './referents.js';
import { createSceneRunner } from './sceneRunner.js';
import { createAreaStore } from '../data/areaStore.js';
export * from './realtimeController.js';
const ACTION_NAMES = new Set(GEV_ACTION_SCHEMAS.map((schema) => schema.name));
@@ -45,6 +46,14 @@ export function withToolCatalog(runner, loadCatalog) {
*/
export function createSceneVoice(options) {
const scene = { engine: null };
let areaAnnotations = null;
const areaStore =
options.areaOptions?.store ??
createAreaStore({
isPinned: (areaId) =>
areaAnnotations?.list?.().some((anno) => anno?.areaId === areaId) ??
false,
});
const cameraKey = () => cameraPoseKey(scene.engine);
let pick = null;
// Point-and-ask: the tracker and referents are shared by the runner (which
@@ -74,6 +83,7 @@ export function createSceneVoice(options) {
deixis,
analystMemory,
layerEnabledAt,
areaOptions: { ...options.areaOptions, store: areaStore },
readVoicePanelOperation: () =>
commands?.captureVoicePanelOperation?.(),
}),
@@ -141,6 +151,7 @@ export function createSceneVoice(options) {
if (lifetime?.aborted) return;
detachScene();
const engine = attached.engine ?? null;
areaAnnotations = attached.annotations ?? null;
scene.engine = engine;
shell = attached.styleManager ?? null;
pick = createPointerPicker({
+14
View File
@@ -368,3 +368,17 @@ test('cached-only lookups read every cached viewport sample and never request',
assert.ok(b.placeLabels.includes(cachedLabel));
assert.deepEqual(service.calls, before);
});
test('basemap lookup measures the horizontal camera span', async () => {
const { viewer } = createViewer({
latitude: 30,
longitude: -97,
heightM: 1000,
});
const result = await getBasemapLabelContext(viewer, createService(), {
cachedOnly: true,
});
assert.ok(
Math.abs(result.view.spanM - 2 * 1000 * Math.tan(Math.PI / 6) * 1.5) < 1,
);
});
+30
View File
@@ -115,3 +115,33 @@ test('annotation outline events reach the session from the attached engine only'
f.restore();
}
});
test('area handles outlive an engine attachment', () => {
const f = fixture();
try {
f.voice.attachScene({ engine: fakeEngine('cesium') });
const store = f.built[0].areaOptions?.store;
assert.ok(store);
const area = store.put({
name: 'Area',
source: 'drawn',
geometry: {
type: 'Polygon',
coordinates: [
[
[0, 0],
[1, 0],
[1, 1],
[0, 0],
],
],
},
});
f.voice.detachScene();
f.voice.attachScene({ engine: fakeEngine('navara') });
assert.equal(f.built[1].areaOptions.store.get(area.areaId), area);
} finally {
f.lifetime.abort();
f.restore();
}
});