mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 16:22:20 +00:00
Cut duplicated and dead code across the engines, the layers and the QA scripts
- src/geo drops the ported debug argument checks and the tests that bitExact already covers; package boundaries accept a directory entry, so src/geo/ is listed once per group. - Cesium no longer carries movers and lines nobody draws with: they are optional engine capabilities. The fake engine and the Cesium camera use the shared cameraMath; unused contract tables, clock.ticked, the 'finest' surface detail and Navara click statistics are gone. - ALPR keeps one overlay core and one presentation model for both engines, bikeshare one station bookkeeping, the Navara ground effects one definition helper; image atlases, view centres, mover banks and colours are shared. - The legacy switch route, the clock offset and rate controls and other unused exports are removed. - The acceptance runs the Navara draw, geo import and scope checks; scenarios use the harness switch and page helpers; the main chunk check keeps the size budget only and runs once in CI.
This commit is contained in:
1 parent
c502404e1d
commit
7abf74518f
272 files changed
+4828
-10213
No files matched your search
@@ -68,14 +68,3 @@ export function catalogControlServices(catalog) {
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Layer roles for controls on a page without data layers: one empty object
|
||||
* per role, so the shell's optional calls
|
||||
* (`layer.method?.()`) do nothing.
|
||||
*/
|
||||
export function absentLayerControlServices() {
|
||||
return Object.fromEntries(
|
||||
Object.keys(CONTROL_LAYER_IDS).map((role) => [role, {}]),
|
||||
);
|
||||
}
|
||||
@@ -1,10 +1,6 @@
|
||||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import {
|
||||
absentLayerControlServices,
|
||||
createLayerCatalog,
|
||||
catalogControlServices,
|
||||
} from './catalog.js';
|
||||
import { createLayerCatalog, catalogControlServices } from './catalog.js';
|
||||
import { createApplicationData } from './data.js';
|
||||
|
||||
const metadata = (layers) =>
|
||||
@@ -158,40 +154,6 @@ test('controls bind catalog instances rather than similarly named defaults', ()
|
||||
);
|
||||
});
|
||||
|
||||
test('without data layers the controls get one empty stand-in per layer role', () => {
|
||||
const ids = [
|
||||
'traffic',
|
||||
'flights',
|
||||
'military',
|
||||
'satellites',
|
||||
'cctv',
|
||||
'street-level',
|
||||
'radio',
|
||||
'bikeshare',
|
||||
'transit',
|
||||
'ais-live-vessels',
|
||||
'military-awareness',
|
||||
'military-installations',
|
||||
'rocket-launches',
|
||||
'local-adsb',
|
||||
];
|
||||
const layers = ids.map((id) => ({ id }));
|
||||
const roles = Object.keys(
|
||||
catalogControlServices(createLayerCatalog(layers, metadata(layers))),
|
||||
);
|
||||
const absent = absentLayerControlServices();
|
||||
assert.deepEqual(Object.keys(absent), roles);
|
||||
for (const role of roles) {
|
||||
assert.deepEqual(Object.keys(absent[role]), [], role);
|
||||
assert.equal(absent[role].subscribe, undefined);
|
||||
}
|
||||
assert.notEqual(absent.flightsLayer, absent.trafficLayer);
|
||||
assert.notEqual(
|
||||
absentLayerControlServices().flightsLayer,
|
||||
absent.flightsLayer,
|
||||
);
|
||||
});
|
||||
|
||||
test('data setup without a viewer registers an empty catalog and no sonar scene', async (t) => {
|
||||
const previous = globalThis.document;
|
||||
globalThis.document = { getElementById: () => null };
|
||||
|
||||
@@ -6,17 +6,17 @@ import { createAirQualityCesiumRenderer } from '../../layers/airQuality/render/c
|
||||
import { createFirmsCesiumRenderer } from '../../layers/firms/render/cesium.js';
|
||||
import { createEarthquakesCesiumRenderer } from '../../layers/earthquakes/render/cesium.js';
|
||||
import { createLaunchesCesiumRenderer } from '../../layers/launches/render/cesium.js';
|
||||
// Which engine draws which layer: the layer renderer registry (plan, "layer
|
||||
// renderer interface") and the layer availability API built on it.
|
||||
// Which engine draws which layer: the layer renderer registry and the layer
|
||||
// availability API built on it.
|
||||
//
|
||||
// A renderer factory `(engine, options) => renderer` draws one layer on one
|
||||
// engine kind (`render/cesium.js`, `render/navara.js` of a layer). Cesium
|
||||
// layers still draw themselves until their render/cesium.js is extracted
|
||||
// (the *a tasks): they are registered as CESIUM_BUILTIN. Cesium entries are
|
||||
// registered here, statically (main chunk); Navara factories are registered
|
||||
// by the Navara mode after its import() (src/app/navaraMode.js).
|
||||
// layers without a render/cesium.js draw themselves: they are registered as
|
||||
// CESIUM_BUILTIN. Cesium entries are registered here, statically (main
|
||||
// chunk); Navara factories are registered by the Navara mode after its
|
||||
// import() (src/app/navaraMode.js).
|
||||
//
|
||||
// ## Layer availability (stable API, used by phase 4's layer list)
|
||||
// ## Layer availability (stable API, used by the layer list)
|
||||
//
|
||||
// import { createLayerAvailability } from './app/layers/renderers.js';
|
||||
// const availability = createLayerAvailability(engine.kind);
|
||||
@@ -28,8 +28,8 @@ import { createLaunchesCesiumRenderer } from '../../layers/launches/render/cesiu
|
||||
// The object is frozen; available() and unavailable() return fresh arrays.
|
||||
// It reads the registry when called, so a Navara factory registered later
|
||||
// (after the Navara mode loads) shows up. `name` is the layer's display name
|
||||
// (src/app/layers/directory.js). Phase 4 injects it as its `availability`
|
||||
// provider (`{ engine, unavailable() }` is the part it reads).
|
||||
// (src/app/layers/directory.js). The layer list takes it as its
|
||||
// `availability` provider (`{ engine, unavailable() }` is the part it reads).
|
||||
|
||||
import { APPLICATION_LAYER_DIRECTORY } from './directory.js';
|
||||
import { createFlightsCesiumRenderer } from '../../layers/flights/render/cesium.js';
|
||||
|
||||
+2
-2
@@ -14,7 +14,7 @@
|
||||
// drawn(id) what the layer draws per object (glyph, model),
|
||||
// as plain data, or null (layers with qaDrawn)
|
||||
// following() { label, native } of engine.camera.following()
|
||||
// movers() engine.movers.list()
|
||||
// movers() engine.movers.list() ([] without movers: Cesium)
|
||||
// framesDrawn() frames drawn since the probe started
|
||||
|
||||
const plain = (position) =>
|
||||
@@ -83,7 +83,7 @@ export function createQaProbe({ engine, dataManager, availability }) {
|
||||
native: handle.native?.id ?? null,
|
||||
};
|
||||
},
|
||||
movers: () => engine.movers.list(),
|
||||
movers: () => engine.movers?.list() ?? [],
|
||||
framesDrawn: () => frames,
|
||||
destroy: () => removeFrames(),
|
||||
};
|
||||
|
||||
+5
-5
@@ -217,11 +217,11 @@ async function createRenderer({
|
||||
googleTileset: tileset,
|
||||
cesiumToken,
|
||||
initialStack: tileset ? 'photoreal' : 'esri-imagery',
|
||||
// Task 5 (height-datum fix): rebroadcast stack changes as a window
|
||||
// CustomEvent so data layers (CCTV per-regime ground resolution) can
|
||||
// react without coupling MapStackController to layer modules. Fires on
|
||||
// 'switching'/'ready'/'error'; listeners derive the surface regime from
|
||||
// live scene state, so intermediate emissions are harmless.
|
||||
// Rebroadcast stack changes as a window CustomEvent so data layers (CCTV
|
||||
// per-regime ground resolution) can react without coupling
|
||||
// MapStackController to layer modules. Fires on 'switching'/'ready'/
|
||||
// 'error'; listeners derive the surface regime from live scene state, so
|
||||
// intermediate emissions are harmless.
|
||||
onChange: (state) => {
|
||||
window.dispatchEvent(
|
||||
new CustomEvent('gev:map-stack-changed', { detail: state }),
|
||||
|
||||
@@ -9,13 +9,6 @@
|
||||
// a release that runs, in reverse, when the part detaches (before its
|
||||
// detachScene).
|
||||
|
||||
const STATES = Object.freeze([
|
||||
'detached',
|
||||
'attaching',
|
||||
'attached',
|
||||
'detaching',
|
||||
]);
|
||||
|
||||
export class SceneSwitchingError extends Error {
|
||||
constructor(message = 'The globe is switching engines') {
|
||||
super(message);
|
||||
@@ -208,5 +201,3 @@ export function createSceneHost({ onError = null } = {}) {
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
export const SCENE_HOST_STATES = STATES;
|
||||
+1
-1
@@ -327,7 +327,7 @@ function attachViewerTools(
|
||||
);
|
||||
|
||||
// Install the explicit scope mask used by the DISPLAY controls.
|
||||
installScopeMask(viewer);
|
||||
installScopeMask(engine);
|
||||
defer(() => destroyScopeMask());
|
||||
|
||||
// The follow camera recomputes the tracked target's dead-reckon position
|
||||
|
||||
@@ -9,7 +9,7 @@ export const PITCH_CLAMP_MIN_HEIGHT_M = 300_000;
|
||||
// with the first Cesium globe, after this module (src/app/loadCesium.js).
|
||||
const RADIANS_PER_DEGREE = Math.PI / 180;
|
||||
/** Look this far below the Earth's limb, so the globe stays on screen. */
|
||||
export const LIMB_MARGIN_RAD = 8 * RADIANS_PER_DEGREE;
|
||||
const LIMB_MARGIN_RAD = 8 * RADIANS_PER_DEGREE;
|
||||
const PITCH_EASE = 0.35;
|
||||
const PITCH_SNAP_RAD = 0.1 * RADIANS_PER_DEGREE;
|
||||
const HEIGHT_EPSILON_M = 0.0001;
|
||||
|
||||
Reference in new issue
Block a user