mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 16:22:20 +00:00
- src/app/qaProbe.js → window.__godsEyeView.layers: list() (with
`available`), unavailable(), available(id), enable/disable(id) (a user
toggle through the layer manager), objects(id) → [{ id, label, position,
screen }], screenOf(id, objectId), selected(id), following(), movers(),
framesDrawn() - all through the engine and the catalog's availability, the
same on Cesium and Navara. Installed after the tools.
- src/app/layers/qaSources.js: `?qaFeed=flights:synthetic:10000,
vessels:fixture` (dev server only, allowQaRegistration) replaces those
sources with seeded synthetic answers served through the live sources'
own parsers (same snapshot shape; loaded with import() only then). The
pure generators moved from src/tooling/w1Feeds.js to src/bench/w1Feeds.js
(the browser graph may not reach src/tooling); the W1 recordings
re-export them.
- scripts/qa-w1-layers.mjs: the parity checklist's frame, --layer
--engine=cesium|navara with the fixture feeds, JSON per run and
--compare (objects on screen per pose, 5 known objects within 2 px).
Filled: 1 view, 8 idle, 9 errors/no leftover mover sets after 10
on/off; 2-7 report TODO for the layer tasks.
- qa-perf, qa-labels, qa-overlay-baseline and qa-label-readability take
--engine= and use the engine (camera, frames, render requests, tiles) and
the probe (layers, following, movers) instead of the viewer; checks whose
layers an engine lacks are SKIPPED with the reason (Navara today), as are
qa-perf's animated-style checks there (Cesium post stages).
Verdicts, Cesium, before → after: qa-perf 24/24 → 24/24, qa-labels 14/14 →
14/14, qa-overlay-baseline (datacenters, firms, detection-50) 2 measured +
1 skipped → the same. Navara: qa-perf 14 passed, 3 skipped; qa-labels 3/3,
1 skipped; qa-overlay-baseline 3 skipped; qa-w1-layers flights: Cesium 5/5
(10 000 synthetic aircraft), Navara skipped (no flights renderer yet).
129 lines
4.4 KiB
JavaScript
129 lines
4.4 KiB
JavaScript
import { createStandaloneCatalog } from './catalog.js';
|
|
import { createStandalonePlaceSearch } from './placeSearch.js';
|
|
import { CITY_POIS } from '../locations.js';
|
|
import { createApplication } from '../app/application.js';
|
|
import { createStandaloneScene } from './scene.js';
|
|
import { createStandaloneControls } from './controls.js';
|
|
import { createStandaloneData } from './data.js';
|
|
import { createStandaloneTools } from './tools.js';
|
|
import { createGoogleTokenSource } from '../maps/googleTokens.js';
|
|
import { resolveEngineKind } from '../app/engineChoice.js';
|
|
import { createQaProbe } from '../app/qaProbe.js';
|
|
|
|
// The existing controls and layer catalog contain page-scoped state.
|
|
let constructed = false;
|
|
|
|
/** The page's engine choice: ?engine=, else the stored gev.engine, else Cesium. */
|
|
function pageEngineKind() {
|
|
let storage = null;
|
|
try {
|
|
storage = globalThis.localStorage ?? null;
|
|
} catch {
|
|
// Blocked storage reads as no stored choice.
|
|
}
|
|
return resolveEngineKind({ search: globalThis.location?.search, storage });
|
|
}
|
|
|
|
/** Compose the standalone application once per page. Reload to start again. */
|
|
export function createStandaloneApplication({
|
|
googleApiKey,
|
|
cesiumToken,
|
|
geospatial = {},
|
|
voice = {},
|
|
sources = {},
|
|
streetLevelProviders,
|
|
allowQaRegistration = false,
|
|
engineKind = pageEngineKind(),
|
|
}) {
|
|
if (constructed)
|
|
throw new Error('The standalone application already owns this page');
|
|
constructed = true;
|
|
const loadingScreen = document.getElementById('loading-screen');
|
|
const loaderStatus = loadingScreen.querySelector('.loader-status');
|
|
let placeSearch;
|
|
let catalog;
|
|
return createApplication({
|
|
createScene: async (context) => {
|
|
placeSearch = createStandalonePlaceSearch({
|
|
// The bundled city and landmark data the offline name provider reads.
|
|
// The search package takes it as plain data rather than importing it,
|
|
// so it stays free of application state.
|
|
presets: CITY_POIS,
|
|
...geospatial,
|
|
resolveApiKey: () => googleApiKey,
|
|
signal: context.signal,
|
|
});
|
|
const scene = await createStandaloneScene({
|
|
...context,
|
|
googleApiKey,
|
|
// Without a key, Google 3D can still load with tokens from the
|
|
// app's server when it offers them.
|
|
googleTokens: googleApiKey ? null : createGoogleTokenSource(),
|
|
cesiumToken,
|
|
loaderStatus,
|
|
engineKind,
|
|
});
|
|
// The catalog of this engine: on Navara only the layers with a Navara
|
|
// renderer (src/app/layers/renderers.js; none yet), the others' state
|
|
// kept for links.
|
|
// QA fixture sources (?qaFeed=…) on the dev server only.
|
|
const search = globalThis.location?.search ?? '';
|
|
const qaSources =
|
|
allowQaRegistration && /[?&]qaFeed=/.test(search)
|
|
? await import('../app/layers/qaSources.js').then(
|
|
({ createQaSources, parseQaFeed }) =>
|
|
createQaSources(parseQaFeed(search)),
|
|
)
|
|
: {};
|
|
catalog = createStandaloneCatalog({
|
|
engineKind,
|
|
sources: { ...sources, ...qaSources },
|
|
streetLevelProviders,
|
|
nepalBoundaryResolver: (signal) =>
|
|
scene.operations.annotationResolver.resolveRegionRingForQuery(
|
|
'Nepal',
|
|
signal,
|
|
placeSearch,
|
|
// The locator draws the border whenever it arrives.
|
|
{ budgetMs: Infinity },
|
|
),
|
|
signal: context.signal,
|
|
surface: scene.operations.surface,
|
|
});
|
|
return scene;
|
|
},
|
|
createControls: (context) =>
|
|
createStandaloneControls({
|
|
...context,
|
|
loaderStatus,
|
|
placeSearch,
|
|
catalog,
|
|
}),
|
|
createData: (context) =>
|
|
createStandaloneData({ ...context, allowQaRegistration, catalog }),
|
|
createTools: async (context) => {
|
|
const tools = await createStandaloneTools({
|
|
...context,
|
|
loadingScreen,
|
|
placeSearch,
|
|
voice,
|
|
});
|
|
// The engine-neutral QA probe on the debug handle (src/app/qaProbe.js).
|
|
const debug = globalThis.window?.__godsEyeView;
|
|
if (debug) {
|
|
const probe = createQaProbe({
|
|
engine: context.scene.engine,
|
|
dataManager: context.data.dataManager,
|
|
availability: catalog.availability,
|
|
});
|
|
debug.layers = probe;
|
|
context.defer(() => {
|
|
probe.destroy();
|
|
if (debug.layers === probe) delete debug.layers;
|
|
});
|
|
}
|
|
return tools;
|
|
},
|
|
});
|
|
}
|