feat(app): layer catalog per engine

- src/app/layers/renderers.js: the layer renderer registry
  (registerLayerRenderers(engineKind, { [layerId]: factory }),
  rendererFor(layerId, engine), layerAvailableOn(layerId, engineKind)).
  Every application layer is registered for Cesium as CESIUM_BUILTIN (it
  still draws itself until its render/cesium.js); Navara factories come with
  the layer tasks. On it, the stable availability API phase 4 injects into
  its layer list: createLayerAvailability(engineKind) →
  { engine, isAvailable(id), available(), unavailable() } with { id, name }
  rows (src/app/layers/directory.js holds the ids and names in catalog
  order; a test keeps it equal to the constructed catalog).
- createApplicationCatalog({ engineKind, availability }) constructs only the
  layers the engine can show, in the same order (shared instances made
  once, on demand); the catalog carries `availability` and the others'
  metadata (`unavailableMetadata`). Cesium builds the same 30 layers in the
  same order as before; Navara builds none yet (no Navara renderers) - the
  standalone app now asks the catalog for it instead of making an empty one.
- catalogControlServices: a role whose layer the engine leaves out gets an
  empty stand-in (absentLayerControlServices folded in); any other missing
  layer is still a wiring error.
- LayerLifecycle(viewer, { engine }): every module call (init, enable,
  update, disable, destroy) gets { signal, engine } as its second argument;
  viewer is null on Navara.
- Links: a link that turns on layers this engine leaves out keeps them in
  the durable state (re-saved links carry them; back on Cesium they turn
  on) and activates nothing; a notice names them ("NOT ON THIS ENGINE · Kept
  in the link: …"). The Navara notice lists the engine's data layers from
  the registry.
- The dev launcher's CCTV wiring check matches the new catalog form.
This commit is contained in:
German Khokhlov committed 2026-10-16 22:07:55 +04:00
1 parent e1be2eac19
commit b0cbed081b
23 files changed
+826 -146

No files matched your search

+21 -7
View File
@@ -5,6 +5,7 @@
import { DATA_CREDITS, registerDataCredits } from '../data/dataCredits.js';
import { isEmbeddedInline } from './embed.js';
import { createLayerAvailability } from './layers/renderers.js';
import {
getRenderGovernorDiagnostics,
governorRequestRender,
@@ -16,11 +17,21 @@ import {
const loadNavaraGlobeModule = async () =>
(await import('../globe/navara/index.js')).createNavaraGlobe;
/** The shell's notice in the experimental Navara mode (label and detail). */
export const NAVARA_MODE_NOTICE = Object.freeze({
label: 'Experimental Navara engine',
detail: 'Layers, cockpit, director and voice are unavailable',
});
/**
* The shell's notice in the experimental Navara mode (label and detail): the
* data layers this engine shows (its catalog, from the renderer registry)
* and what it does not have.
* @param {import('./layers/renderers.js').LayerAvailability} availability
*/
export function navaraModeNotice(availability) {
const names = availability.available().map(({ name }) => name);
return Object.freeze({
label: 'Experimental Navara engine',
detail: names.length
? `Data layers: ${names.join(', ')}; the other layers, cockpit, director and voice are unavailable`
: 'No data layers on this engine yet; cockpit, director and voice are unavailable',
});
}
/**
* Data credits for what the shell uses without data layers: place search,
@@ -131,9 +142,12 @@ export function createViewerlessTools({
};
document.addEventListener('visibilitychange', syncVisibility);
defer(() => document.removeEventListener('visibilitychange', syncVisibility));
styleManager._showGlobalStatusNotice?.(NAVARA_MODE_NOTICE.label, {
const notice = navaraModeNotice(
data.catalog?.availability ?? createLayerAvailability('navara'),
);
styleManager._showGlobalStatusNotice?.(notice.label, {
state: 'retry',
detail: NAVARA_MODE_NOTICE.detail,
detail: notice.detail,
persistent: true,
});
window.__godsEyeView = {