mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 16:22:20 +00:00
Draw weather, wind and Bhote Koshi through engine.imagery, one display each
engine.imagery gains what these rasters need, on every engine: - geographic (EPSG:4326) tile schemes and a transform applied to each decoded tile (the satellite infrared mask); - staged source changes, which keep the drawn source until the new one has loaded (the weather frame swap), and credit-only changes in place; - raised layers that draw on a shell above terrain and 3D tiles, rising with the camera, with a detail image inside a rectangle. On Cesium this is the weather shell primitive, moved into the engine; on Navara the pixel's ray meets the ellipsoid grown by the height. Rain radar, satellite clouds, lightning, the wind field and the Bhote Koshi event and locator each draw through one render/display.js on both engines; their Navara renderers and Navara's weather surface pass go. Cesium's pixels are unchanged in every compared scene. On Navara the Bhote Koshi images are no longer upside down. Two engine-specific parts stay behind one backend option each: the wind's streamlines and the Bhote Koshi story entities. The coupling report now counts defineGroundEffect calls, not its own declaration. Coupling: Navara renderer lines fall from 2304 to 1695, Navara ground passes from 3 to 1 (the Global Context pulses), engine kind checks from 5 to 2. The contract suite passes on both engines (Cesium 71/71, Navara 74/74).
This commit is contained in:
1 parent
b53b6a48a7
commit
c73c5382d4
39 files changed
+4677
-1114
No files matched your search
@@ -386,7 +386,8 @@ export function createApplicationCatalog({
|
||||
createWindLayer({
|
||||
feed: sources.wind,
|
||||
clock: weatherClock,
|
||||
createNativeRendering: (engine) => rendererFor('wind', engine),
|
||||
createNativeRendering: (engine, options) =>
|
||||
rendererFor('wind', engine, options),
|
||||
}),
|
||||
),
|
||||
],
|
||||
|
||||
@@ -31,3 +31,9 @@ export { createTrafficDisplay } from '../../layers/traffic/render/display.js';
|
||||
export { createDirectionsDisplay } from '../../layers/directions/render/display.js';
|
||||
export { createFirmsDisplay } from '../../layers/firms/render/display.js';
|
||||
export { createRecentImageryDisplay } from '../../layers/recentImagery/render/display.js';
|
||||
export { createWeatherDisplay } from '../../layers/weather/render/display.js';
|
||||
export { createWindDisplay } from '../../layers/wind/render/display.js';
|
||||
export {
|
||||
createBhoteKoshiDisplay,
|
||||
createBhoteKoshiLocatorDisplay,
|
||||
} from '../../layers/bhoteKoshi/render/display.js';
|
||||
+34
-33
@@ -20,9 +20,8 @@
|
||||
// contract primitives in `needs` (Wildlife Sightings).
|
||||
// - `perEngine({ [kind]: loader | DRAWS_ITSELF })`: a layer with no display
|
||||
// yet. On each engine kind listed it either draws itself (DRAWS_ITSELF,
|
||||
// the Cesium weather and wind, the open map overlays) or has an
|
||||
// engine-specific renderer, an import() loader of its factory (Navara's
|
||||
// weather, wind and Bhote Koshi). It shows only on the kinds listed.
|
||||
// the open map overlays) or has an engine-specific renderer, an import()
|
||||
// loader of its factory. It shows only on the kinds listed.
|
||||
//
|
||||
// Every import() here is resolved by `loadLayerRenderers(kind)`, which the
|
||||
// page awaits before it builds an engine's catalog (src/standalone/
|
||||
@@ -119,34 +118,39 @@ const perEngine = (engines) =>
|
||||
/** Navara's own view and classes, for the renderers that still use them. */
|
||||
const navaraNative = (engine) => engine.extensions.navara;
|
||||
|
||||
// Navara's renderers of the layers without a display. Each loads only here,
|
||||
// through import(), when a page loads Navara's renderers.
|
||||
const navaraWeather = async () => {
|
||||
const { createWeatherNavaraRenderer } =
|
||||
await import('../../layers/weather/render/navara.js');
|
||||
return (engine, options) =>
|
||||
createWeatherNavaraRenderer(engine, navaraNative(engine), options);
|
||||
// Navara's backends of the Bhote Koshi and wind displays, loaded only
|
||||
// here, through import(), when a page loads Navara's renderers: the story
|
||||
// entities sampled into Navara's view (Cesium draws them itself) and the
|
||||
// wind's flow mesh.
|
||||
const navaraStory = async () => {
|
||||
const { drawStorySource } =
|
||||
await import('../../layers/shared/render/navaraStory.js');
|
||||
return {
|
||||
drawStory: (engine, data) =>
|
||||
drawStorySource(engine, navaraNative(engine), data),
|
||||
};
|
||||
};
|
||||
const navaraWindFlow = async () => {
|
||||
const { createWindNavaraFlow } =
|
||||
await import('../../layers/wind/render/navaraFlow.js');
|
||||
return {
|
||||
flow: (engine) => createWindNavaraFlow(engine, navaraNative(engine)),
|
||||
};
|
||||
};
|
||||
const navaraOnly = (navara, others = DRAWS_ITSELF) =>
|
||||
perEngine({ cesium: others, navara });
|
||||
|
||||
// The layers' displays (./displays.js), one chunk.
|
||||
const displays = () => import('./displays.js');
|
||||
|
||||
/** How every application layer draws, by id, in directory order. */
|
||||
export const LAYER_MANIFEST = Object.freeze({
|
||||
// The Bhote Koshi event and locator draw themselves on Cesium
|
||||
// (src/data/bhoteKoshiEvent.js, bhoteKoshiLocator.js).
|
||||
'bhote-koshi-2026': navaraOnly(async () => {
|
||||
const { createNepalEventDisplay } =
|
||||
await import('../../layers/bhoteKoshi/render/navara.js');
|
||||
return (engine) => createNepalEventDisplay(engine, navaraNative(engine));
|
||||
// The Bhote Koshi event's imagery on engine.imagery; the event's and the
|
||||
// locator's story entities draw on Cesium itself, or through Navara's
|
||||
// story backend.
|
||||
'bhote-koshi-2026': display('createBhoteKoshiDisplay', ['imagery'], {
|
||||
navara: navaraStory,
|
||||
}),
|
||||
'bhote-koshi-locator': navaraOnly(async () => {
|
||||
const { drawStorySource } =
|
||||
await import('../../layers/shared/render/navaraStory.js');
|
||||
return (engine, { data }) =>
|
||||
drawStorySource(engine, navaraNative(engine), data);
|
||||
'bhote-koshi-locator': display('createBhoteKoshiLocatorDisplay', ['movers'], {
|
||||
navara: navaraStory,
|
||||
}),
|
||||
// The aircraft family.
|
||||
flights: display('createFlightsDisplay', ['movers', 'lines']),
|
||||
@@ -196,16 +200,13 @@ export const LAYER_MANIFEST = Object.freeze({
|
||||
).createAwarenessPulseDisc,
|
||||
}),
|
||||
}),
|
||||
// Wind and the weather rasters draw themselves on Cesium
|
||||
// (src/layers/wind, src/layers/weather); on Navara through its renderers.
|
||||
wind: navaraOnly(async () => {
|
||||
const { createWindNavaraRenderer } =
|
||||
await import('../../layers/wind/render/navara.js');
|
||||
return (engine) => createWindNavaraRenderer(engine, navaraNative(engine));
|
||||
}),
|
||||
'weather-radar': navaraOnly(navaraWeather),
|
||||
'weather-satellite': navaraOnly(navaraWeather),
|
||||
'weather-lightning': navaraOnly(navaraWeather),
|
||||
// The wind field and the weather rasters on engine.imagery; the wind's
|
||||
// streamlines are each engine's (Cesium's from the layer, Navara's flow
|
||||
// mesh).
|
||||
wind: display('createWindDisplay', ['imagery'], { navara: navaraWindFlow }),
|
||||
'weather-radar': display('createWeatherDisplay', ['imagery']),
|
||||
'weather-satellite': display('createWeatherDisplay', ['imagery']),
|
||||
'weather-lightning': display('createWeatherDisplay', ['imagery']),
|
||||
'weather-cyclones': display('createCyclonesDisplay', ['movers', 'ground']),
|
||||
// The open map overlays drape themselves: Cesium imagery on the viewer,
|
||||
// engine.maps.addOverlay on Navara (src/data/osmOverlays.js).
|
||||
|
||||
@@ -51,6 +51,8 @@ test('the layers drawn through one display, and the ones that draw without one',
|
||||
assert.deepEqual(
|
||||
kinds((entry) => entry.display),
|
||||
[
|
||||
'bhote-koshi-2026',
|
||||
'bhote-koshi-locator',
|
||||
'flights',
|
||||
'military',
|
||||
'local-adsb',
|
||||
@@ -75,6 +77,10 @@ test('the layers drawn through one display, and the ones that draw without one',
|
||||
'ais-live-vessels',
|
||||
'military-installations',
|
||||
'military-awareness',
|
||||
'wind',
|
||||
'weather-radar',
|
||||
'weather-satellite',
|
||||
'weather-lightning',
|
||||
'weather-cyclones',
|
||||
'local-datacenters',
|
||||
'local-dams',
|
||||
@@ -85,7 +91,13 @@ test('the layers drawn through one display, and the ones that draw without one',
|
||||
// Engine-specific options of a display: the Navara backends.
|
||||
assert.deepEqual(
|
||||
kinds((entry) => Object.keys(entry.backends ?? {}).length),
|
||||
['cctv', 'military-awareness'],
|
||||
[
|
||||
'bhote-koshi-2026',
|
||||
'bhote-koshi-locator',
|
||||
'cctv',
|
||||
'military-awareness',
|
||||
'wind',
|
||||
],
|
||||
);
|
||||
assert.deepEqual(Object.keys(LAYER_MANIFEST.cctv.backends), ['navara']);
|
||||
// The layer that draws itself through the contract.
|
||||
@@ -106,14 +118,7 @@ test('the layers drawn through one display, and the ones that draw without one',
|
||||
),
|
||||
]),
|
||||
);
|
||||
const navaraRenderer = { cesium: 'itself', navara: 'renderer' };
|
||||
assert.deepEqual(engines, {
|
||||
'bhote-koshi-2026': navaraRenderer,
|
||||
'bhote-koshi-locator': navaraRenderer,
|
||||
wind: navaraRenderer,
|
||||
'weather-radar': navaraRenderer,
|
||||
'weather-satellite': navaraRenderer,
|
||||
'weather-lightning': navaraRenderer,
|
||||
'sea-marks': { cesium: 'itself', navara: 'itself' },
|
||||
'ski-pistes': { cesium: 'itself', navara: 'itself' },
|
||||
});
|
||||
@@ -138,6 +143,8 @@ test('a display or an engine-specific renderer answers only after its engine loa
|
||||
|
||||
test('the layers drawn through one display get the same factory on every engine', async () => {
|
||||
const displays = {
|
||||
'bhote-koshi-2026': ['bhoteKoshi', 'createBhoteKoshiDisplay'],
|
||||
'bhote-koshi-locator': ['bhoteKoshi', 'createBhoteKoshiLocatorDisplay'],
|
||||
flights: ['flights', 'createFlightsDisplay'],
|
||||
military: ['military', 'createMilitaryDisplay'],
|
||||
'local-adsb': ['localAdsb', 'createLocalAdsbDisplay'],
|
||||
@@ -166,6 +173,10 @@ test('the layers drawn through one display get the same factory on every engine'
|
||||
directions: ['directions', 'createDirectionsDisplay'],
|
||||
'local-firms': ['firms', 'createFirmsDisplay'],
|
||||
'recent-imagery': ['recentImagery', 'createRecentImageryDisplay'],
|
||||
wind: ['wind', 'createWindDisplay'],
|
||||
'weather-radar': ['weather', 'createWeatherDisplay'],
|
||||
'weather-satellite': ['weather', 'createWeatherDisplay'],
|
||||
'weather-lightning': ['weather', 'createWeatherDisplay'],
|
||||
'telegeography-submarine-cables': [
|
||||
'submarineCables',
|
||||
'createCablesDisplay',
|
||||
@@ -199,14 +210,7 @@ test('the layers drawn through one display get the same factory on every engine'
|
||||
|
||||
test('a layer that draws itself has no renderer; an unknown engine none either', () => {
|
||||
const engine = createFakeEngine();
|
||||
for (const id of [
|
||||
'wildlife-sightings',
|
||||
'sea-marks',
|
||||
'ski-pistes',
|
||||
'wind',
|
||||
'weather-radar',
|
||||
'bhote-koshi-2026',
|
||||
])
|
||||
for (const id of ['wildlife-sightings', 'sea-marks', 'ski-pistes'])
|
||||
assert.equal(rendererFor(id, engine), null, id);
|
||||
assert.equal(rendererFor('flights', null), null);
|
||||
assert.equal(rendererFor('flights', { kind: 'vulkan' }), null);
|
||||
|
||||
@@ -33,7 +33,7 @@ test('Navara loads its renderers once and shows every layer', async () => {
|
||||
for (const id of ['wildlife-sightings', 'sea-marks', 'ski-pistes'])
|
||||
assert.equal(rendererFor(id, engine), null, id);
|
||||
assert.throws(() => loadLayerRenderers('vulkan'), TypeError);
|
||||
// Cesium has nothing to load.
|
||||
// Cesium loads the same displays: wind draws through one there too.
|
||||
await loadLayerRenderers('cesium');
|
||||
assert.equal(rendererFor('wind', createFakeEngine()), null);
|
||||
assert.equal(typeof rendererFor('wind', createFakeEngine()), 'object');
|
||||
});
|
||||
Reference in new issue
Block a user