Draw Street Level, traffic and directions through one display each

- Street Level: coverage sequences are ground corridor sets of up to
  120, draped on terrain and tiles as Cesium's ground polylines were;
  the marker and view cones are sprite movers turned to their compass
  bearing on screen and culled 1 km under WGS84. The layer no longer
  loads the Cesium SDK on Navara.
- Traffic: vehicles are two point mover sets (an outline disc under each
  fill) scaled and faded with Cesium's NearFarScalar maths; congestion
  heat lines are ground corridor sets draped on tiles. Heights, depth,
  readiness and the surface key go through the engine, and Navara no
  longer loads the Cesium SDK for traffic.
- Directions: the route is one ground corridor set in the annotation
  route's dash pattern, maneuvers are point movers and the A/B markers a
  disc and a letter sprite; the in-layer Navara branch and the Cesium
  point collection go.

Known gaps against Cesium, to close in the contract: the traffic heat
lines lose their glow and pulse and the route its flowing dashes
(no animated ground fills yet), and dense Street Level coverage on
Navara is costly as ground corridors (about 80 to 190 ms a frame at
6,000 to 14,400 sequences) until corridors are binned set-wide.

Coupling: Navara renderer lines fall from 3349 to 2767, Cesium-importing
files from 51 to 32, `viewer` lines from 1591 to 1373, Cesium SDK loads
on Navara from 6 to 4.
This commit is contained in:
German Khokhlov committed 2026-11-07 08:03:25 +04:00
1 parent 2fbdca62be
commit 1559bd57f4
78 files changed
+4762 -3719

No files matched your search

+47 -13
View File
@@ -141,7 +141,6 @@ test('traffic timing pairs real ordering to the scheduling change and guards re-
let server;
const cacheDir = mkdtempSync(path.join(tmpdir(), 'gev-traffic-timing-vite-'));
let trafficLayer;
let viewer;
const pendingDebounce = () => {
const matches = [...timeouts].filter(([, timer]) => timer.delay === 320);
@@ -206,15 +205,18 @@ test('traffic timing pairs real ordering to the scheduling change and guards re-
const preRender = eventChannel();
const postRender = eventChannel();
const preUpdate = eventChannel();
const moveEnd = eventChannel();
const changed = eventChannel();
let longitude = -97.74;
const cartographic = { latitude: Math.PI / 6, longitude: 0, height: 5000 };
const camera = {
moveEnd,
changed,
percentageChanged: 0.5,
positionCartographic: { latitude: Math.PI / 6, longitude: 0, height: 5000 },
computeViewRectangle() {
livePosition: { x: 0, y: 0, z: 0 },
pose: () => ({ cartographic: { ...cartographic }, heading: 0, pitch: -Math.PI / 2 }),
viewRectangle() {
const west = longitude * Math.PI / 180;
return {
south: 30 * Math.PI / 180,
@@ -223,31 +225,63 @@ test('traffic timing pairs real ordering to the scheduling change and guards re-
east: west + 0.02 * Math.PI / 180,
};
},
pickEllipsoid: () => undefined,
};
const setLongitude = (next) => {
longitude = next;
camera.positionCartographic.longitude = next * Math.PI / 180;
cartographic.longitude = next * Math.PI / 180;
};
setLongitude(longitude);
viewer = {
camera,
scene: {
const noSet = () => ({
set() {},
setCount() {},
commit() {},
replace() {},
show() {},
destroy() {},
});
// An engine on a zero-size canvas: no pick ray (no reticle footprint),
// so the fetch is bounded by the view rectangle.
const engine = {
kind: 'cesium',
host: {
canvas: { clientWidth: 0, clientHeight: 0, width: 0, height: 0 },
preRender,
postRender,
primitives: { add: (primitive) => primitive, remove: () => true },
size: () => ({ width: 0, height: 0 }),
},
camera,
frames: { preUpdate, preRender, postRender },
projector: {
worldToWindow: () => undefined,
viewProjection: (result = new Array(16).fill(0)) => result,
horizonVisible: () => true,
},
picker: { pickPositionSupported: false },
surface: {
supported: false,
terrainHeight: () => 0,
sampleHeight: () => undefined,
tilesLoaded: () => true,
},
maps: {
photorealActive: () => false,
current: () => ({ baseImagery: null, photoreal: null }),
},
render: { request() {} },
credits: { addStatic: () => () => {} },
movers: { createSet: noSet },
ground: { createSet: noSet },
destroy() {},
};
performance.clearMarks();
performance.clearMeasures();
trafficLayer.init(viewer);
trafficLayer.init(null, { engine });
performance.mark('traffic:stale:mark');
performance.measure('traffic:stale:measure', {
start: 'traffic:stale:mark',
end: 'traffic:stale:mark',
});
trafficLayer.enable(viewer);
trafficLayer.enable();
assert.equal(traffic.getTrafficTimingDiagnostics().marksInstalled, 1);
assert.equal(moveEnd.listenerCount(), 2, 'one timing listener plus the production arrival check');
assert.equal(performance.getEntriesByName('traffic:stale:mark').length, 0);
@@ -325,7 +359,7 @@ test('traffic timing pairs real ordering to the scheduling change and guards re-
entry.detail?.interactionId !== anchorB.interactionId
)), 'the canceled/stale B load must never emit a correlated trace');
} finally {
trafficLayer?.disable(viewer);
trafficLayer?.disable();
await server?.close();
globalThis.window = originalWindow;
globalThis.document = originalDocument;