mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 16:22:20 +00:00
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:
1 parent
e1be2eac19
commit
b0cbed081b
23 files changed
+826
-146
No files matched your search
@@ -1,4 +1,16 @@
|
||||
import { LayerStateCoordinator } from '../data/layerStateCoordinator.js';
|
||||
import { APPLICATION_LAYER_DIRECTORY } from '../app/layers/directory.js';
|
||||
|
||||
/** Names of the layers a link turned on that this engine does not have. */
|
||||
export function layersNotOnThisEngine(results) {
|
||||
return results
|
||||
.filter(({ phase, targetEnabled }) => phase === 'missing' && targetEnabled)
|
||||
.map(
|
||||
({ layerId }) =>
|
||||
APPLICATION_LAYER_DIRECTORY.find(({ id }) => id === layerId)?.name ??
|
||||
layerId,
|
||||
);
|
||||
}
|
||||
import { stampInitialShareGesture } from '../navigationPolicy.js';
|
||||
import { canPresentDeferredStatusNotice } from '../loadingFeedback.js';
|
||||
import { UiLifetime } from './uiLifetime.js';
|
||||
@@ -159,11 +171,26 @@ export class ShareRestoration {
|
||||
{ clearSelection: true },
|
||||
);
|
||||
}
|
||||
void this._layerStateRestorePromise.then(() => {
|
||||
void this._layerStateRestorePromise.then((results) => {
|
||||
this.syncModels3d(this._layerStateCoordinator?.getDurableState());
|
||||
this._noticeLayersNotOnThisEngine(results);
|
||||
});
|
||||
}
|
||||
}
|
||||
/**
|
||||
* A link that turns on layers this engine's catalog leaves out (Navara):
|
||||
* they stay off here, their state stays in the link, and the notice names
|
||||
* them.
|
||||
*/
|
||||
_noticeLayersNotOnThisEngine(results) {
|
||||
if (this._disposed || !Array.isArray(results)) return;
|
||||
const names = layersNotOnThisEngine(results);
|
||||
if (!names.length) return;
|
||||
this.showStatus('NOT ON THIS ENGINE', {
|
||||
state: 'retry',
|
||||
detail: `Kept in the link: ${names.join(', ')}`,
|
||||
});
|
||||
}
|
||||
cancelSelection() {
|
||||
if (
|
||||
this._hasShareState &&
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import { layersNotOnThisEngine } from './shareRestoration.js';
|
||||
|
||||
test('the notice names the link layers this engine leaves out', () => {
|
||||
assert.deepEqual(
|
||||
layersNotOnThisEngine([
|
||||
{ layerId: 'flights', phase: 'missing', targetEnabled: true },
|
||||
{ layerId: 'ais-live-vessels', phase: 'missing', targetEnabled: true },
|
||||
{ layerId: 'traffic', phase: 'missing', targetEnabled: false },
|
||||
{ layerId: 'satellites', phase: 'settled', targetEnabled: true },
|
||||
]),
|
||||
['Live Flights', 'Live AIS Vessels'],
|
||||
);
|
||||
assert.deepEqual(layersNotOnThisEngine([]), []);
|
||||
});
|
||||
Reference in new issue
Block a user