mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 16:22:20 +00:00
Main's camera, voice, Cockpit and layer work now runs on the globe contract where this branch draws through it: - The voice tilt to an angle, its pivot about the place under the crosshair and the frame limit from orbit run through the camera rig; src/globeInView.js measures a camera pose with src/geo instead of a Cesium camera. The free-look height limit and the globe-in-view recovery stay Cesium-only for now. - Cockpit takes main's own-layer entry rule. Double-clicking the followed track goes through cockpitHost.routeDoubleClick, so it works on both engines. - Space Missions' failed-entry rollback and GhostMaps' age filter run in the engine-neutral layer code. On Cesium an expired report is dropped in place; on Navara its product is redrawn. - Wildlife Sightings joins the catalog Cesium-only: Navara leaves it out, and the shell builds its card only for the real layer, so a Navara page no longer fails to start on its stand-in. - One instruction sentence is shorter, which keeps the Realtime prompt within its 55,500-character budget with the Sentinel-2 basemap.
72 lines
2.4 KiB
JavaScript
72 lines
2.4 KiB
JavaScript
const CONTROL_LAYER_IDS = Object.freeze({
|
|
trafficLayer: 'traffic',
|
|
flightsLayer: 'flights',
|
|
militaryFlightsLayer: 'military',
|
|
satellitesLayer: 'satellites',
|
|
cctvLayer: 'cctv',
|
|
streetLevelLayer: 'street-level',
|
|
wildlifeSightingsLayer: 'wildlife-sightings',
|
|
radioLayer: 'radio',
|
|
bikeshareLayer: 'bikeshare',
|
|
transitLayer: 'transit',
|
|
aisLiveVesselsLayer: 'ais-live-vessels',
|
|
militaryAwarenessLayer: 'military-awareness',
|
|
militaryInstallationsLayer: 'military-installations',
|
|
rocketLaunchesLayer: 'rocket-launches',
|
|
localAdsbLayer: 'local-adsb',
|
|
});
|
|
|
|
/** Capture the ordered application instances and their serialization metadata. */
|
|
export function createLayerCatalog(layers, metadata) {
|
|
if (!Array.isArray(layers) || !Array.isArray(metadata))
|
|
throw new TypeError(
|
|
'Layer instances and serialization metadata are required',
|
|
);
|
|
const byId = new Map();
|
|
for (const layer of layers) {
|
|
if (typeof layer?.id !== 'string' || !layer.id || byId.has(layer.id))
|
|
throw new TypeError(`Invalid or duplicate catalog layer: ${layer?.id}`);
|
|
byId.set(layer.id, layer);
|
|
}
|
|
const ids = new Set();
|
|
for (const entry of metadata) {
|
|
if (!byId.has(entry?.id) || ids.has(entry.id))
|
|
throw new TypeError(
|
|
`Unmatched or duplicate catalog metadata: ${entry?.id}`,
|
|
);
|
|
ids.add(entry.id);
|
|
}
|
|
if (ids.size !== byId.size)
|
|
throw new TypeError('Catalog metadata is incomplete');
|
|
return Object.freeze({
|
|
layers: Object.freeze([...layers]),
|
|
metadata: Object.freeze(
|
|
metadata.map((entry) => Object.freeze({ ...entry })),
|
|
),
|
|
get: (id) => byId.get(id),
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Bind the current control surface to the exact instances registered by the
|
|
* app. A layer the catalog leaves out on purpose (another engine's: in
|
|
* `catalog.unavailableMetadata`) gets an empty stand-in, so the shell's
|
|
* optional calls (`layer.method?.()`) do nothing; any other missing layer is
|
|
* a wiring error.
|
|
*/
|
|
export function catalogControlServices(catalog) {
|
|
if (!catalog?.get)
|
|
throw new TypeError('An application layer catalog is required');
|
|
const omitted = new Set(
|
|
(catalog.unavailableMetadata ?? []).map(({ id }) => id),
|
|
);
|
|
return Object.fromEntries(
|
|
Object.entries(CONTROL_LAYER_IDS).map(([role, id]) => {
|
|
const layer = catalog.get(id);
|
|
if (layer) return [role, layer];
|
|
if (omitted.has(id)) return [role, {}];
|
|
throw new TypeError(`Control layer missing from catalog: ${id}`);
|
|
}),
|
|
);
|
|
}
|