mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-21 18:52:18 +00:00
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:
1 parent
2fbdca62be
commit
1559bd57f4
78 files changed
+4762
-3719
No files matched your search
+8
-12
@@ -3,21 +3,19 @@ import { createDirectionsSource } from '../layers/directions/source.js';
|
||||
* @module directions
|
||||
* @description Service bundle for the Directions layer.
|
||||
*
|
||||
* The layer itself lives in `src/layers/directions/`, which imports nothing
|
||||
* but Cesium and the pure step formatter. This module is the one place that
|
||||
* names the application's shared services — the render governor, sprite order,
|
||||
* the pick registry, the world overlay, the annotation material, the camera
|
||||
* verbs, the shared ground floor and the pointer arbiter — and it re-exports
|
||||
* the layer's pure helpers for the tests and the share-link code.
|
||||
* The layer itself lives in `src/layers/directions/` and draws through the
|
||||
* globe contract (its render/display.js). This module is the one place that
|
||||
* names the application's shared services — the render governor, the pick
|
||||
* registry, the ground pick, the world overlay, the camera verbs, the shared
|
||||
* ground floor and the pointer arbiter — and it re-exports the layer's pure
|
||||
* helpers for the tests and the share-link code.
|
||||
*/
|
||||
|
||||
import * as credits from './dataCredits.js';
|
||||
import * as render from '../renderGovernor.js';
|
||||
import * as sprites from './spriteOrder.js';
|
||||
import * as picking from './pickRegistry.js';
|
||||
import * as scenePick from './scenePick.js';
|
||||
import * as overlays from '../overlays/worldOverlay.js';
|
||||
import * as annotations from '../annotations/worldAnnotationRenderer.js';
|
||||
import * as camera from '../cameraVerbs.js';
|
||||
import * as ground from './groundFloor.js';
|
||||
import * as input from './inputOwnership.js';
|
||||
@@ -27,11 +25,9 @@ import { createDirectionsLayer } from '../layers/directions/index.js';
|
||||
const directionsServices = Object.freeze({
|
||||
credits,
|
||||
render,
|
||||
sprites,
|
||||
picking,
|
||||
scenePick,
|
||||
overlays,
|
||||
annotations,
|
||||
camera,
|
||||
ground,
|
||||
input,
|
||||
@@ -40,13 +36,13 @@ const directionsServices = Object.freeze({
|
||||
/** Construct one Directions layer over the application scene owners. */
|
||||
export function createApplicationDirectionsLayer({
|
||||
source = createDirectionsSource(),
|
||||
createNativeRenderer,
|
||||
createRenderer,
|
||||
groundFloor = ground,
|
||||
} = {}) {
|
||||
return createDirectionsLayer({
|
||||
services: { ...directionsServices, ground: groundFloor },
|
||||
source,
|
||||
createNativeRenderer,
|
||||
createRenderer,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@ import { showOsmCredit, hideOsmCredit } from './dataCredits.js';
|
||||
import { createInfrastructureLayers } from './infrastructure.js';
|
||||
import { createBhoteKoshiLocatorLayer } from './bhoteKoshiLocator.js';
|
||||
import { createWorldAnnotationRenderer } from '../annotations/worldAnnotationRenderer.js';
|
||||
import * as annotations from '../annotations/worldAnnotationRenderer.js';
|
||||
import { createDirectionsLayer } from '../layers/directions/index.js';
|
||||
import { createDirectionsSource } from '../layers/directions/source.js';
|
||||
import { createLifecycle as createCctvLifecycle } from '../layers/cctv/lifecycle.js';
|
||||
@@ -69,22 +68,23 @@ test('voice route geometry introduces the shared OSM credit', (t) => {
|
||||
});
|
||||
|
||||
test('Directions introduces the shared OSM credit when the requested route draws', async (t) => {
|
||||
const v = viewer(t);
|
||||
t.mock.method(globalThis, 'fetch', async () => Response.json({ ok: true, geometry: [[0, 0], [0.01, 0.01]], steps: [] }));
|
||||
const engine = createFakeEngine();
|
||||
const layer = createDirectionsLayer({ source: createDirectionsSource(), services: {
|
||||
credits: { showOsmCredit, hideOsmCredit }, annotations, input, scenePick: {}, camera: {},
|
||||
credits: { showOsmCredit, hideOsmCredit }, input, scenePick: {}, camera: {},
|
||||
overlays: { setOverlayEntries: noop, setOverlaySourceVisible: noop, clearOverlaySource: noop },
|
||||
render: { governorRequestRender: noop, holdContinuousRender: noop, releaseContinuousRender: noop },
|
||||
sprites: { registerSpriteCollection: noop, unregisterSpriteCollection: noop, restoreSpriteOrder: noop },
|
||||
render: { governorRequestRender: noop },
|
||||
picking: { registerPickOwner: noop, unregisterPickOwner: noop },
|
||||
ground: { warmGroundFloor: noop },
|
||||
} });
|
||||
layer.init(v); layer.enable(v);
|
||||
layer.init(null, { engine }); layer.enable();
|
||||
layer.placeEndpoint('a', { lat: 0, lon: 0 }); layer.placeEndpoint('b', { lat: 0.01, lon: 0.01 });
|
||||
for (let i = 0; i < 30; i++) await Promise.resolve();
|
||||
assert.equal(layer.getStats().error, null);
|
||||
assertCredit(v); await layer.destroy(v);
|
||||
assert.equal(v.credits.filter(c => c.showOnScreen).length, 0);
|
||||
assert.ok(engine.fake.credits.some((credit) => credit.onScreen && credit.html.includes('>© OpenStreetMap<')));
|
||||
layer.destroy();
|
||||
assert.equal(engine.fake.credits.filter((credit) => credit.onScreen).length, 0);
|
||||
engine.destroy();
|
||||
});
|
||||
|
||||
test('Warendorf webcam display introduces the shared OSM credit', (t) => {
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in new issue
Block a user