Build the catalog from one layer manifest and attach one tools tree

src/app/layers/renderers.js now holds LAYER_MANIFEST, one entry per
layer in directory order: a display (the same render/display.js on every
engine, with the contract primitives it needs and, for CCTV and Global
Context, a Navara backend loaded by import()), a layer that draws itself
through the contract, or per-engine renderers for the layers not on a
display yet (weather, wind, Bhote Koshi, sea marks, ski pistes). A layer
is available where the engine has the primitives it needs. The Cesium
renderer table, CESIUM_BUILTIN, the registry and the Navara mode's map of
about 35 loaders go; the application loads a kind's renderers before it
builds the catalog.

The tools attach through one tree over the engine, in Cesium's order.
Each engine kind adds its own tools from one backend that reads its
extension once: the Cesium backend holds the viewer-only tools, the
Navara backend the annotation renderer, draw surface and file import
drawing.

Coupling: engine.extensions reads fall from 12 to 8, engine-name literal
lines from 73 to 66.
This commit is contained in:
German Khokhlov committed 2026-11-07 09:41:02 +04:00
1 parent f1ec9d4a22
commit 48885d9e61
46 files changed
+1057 -899

No files matched your search

+9 -2
View File
@@ -18,6 +18,7 @@ import { createGoogleTokenSource } from '../maps/googleTokens.js';
import { engineOfChoice, resolveEngineKind } from '../app/engineChoice.js';
import { createSceneHost } from '../app/sceneHost.js';
import { attachScenePart } from '../app/sceneParts.js';
import { loadLayerRenderers } from '../app/layers/renderers.js';
// Only one engine may own the page at a time.
let owner = null;
@@ -109,6 +110,10 @@ export function createStandaloneApplication({
throw new AggregateError(errors, 'The globe could not be released');
};
const signal = AbortSignal.any([controller.signal, lifetime]);
// The layers' engine-specific renderers of this engine (the layer
// manifest's import()s, none on Cesium) load beside its globe.
const layerRenderers = loadLayerRenderers(engineOfChoice(kind));
layerRenderers.catch(() => {});
try {
const scene = await createStandaloneScene({
...sessionContext,
@@ -125,8 +130,10 @@ export function createStandaloneApplication({
layerSession,
});
signal.throwIfAborted();
// The catalog of this engine: on Navara only the layers with a Navara
// renderer (src/app/layers/renderers.js), the others' state kept for
await layerRenderers;
signal.throwIfAborted();
// The catalog of this engine: only the layers it can show (the layer
// manifest, src/app/layers/renderers.js), the others' state kept for
// links. The layer models are the session's (layerSession.models).
// Session models keep the catalog's closures past this scene: they
// capture the operations, never the scene (it holds the engine).