mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +00:00
The map stacks' imagery, terrain and Google 3D factories move into the Cesium adapter (src/render/cesium/mapImagery.js, mapTerrain.js, google3d.js); the ./maps/imagery, ./maps/terrain and ./maps/3d exports point there. The catalog names its ion stacks by asset number, and the map source controller and default sources are Cesium-free: they build providers and switch imagery layers, terrain, tilesets and the globe's visibility through a map engine (src/maps/engine.js) that the Cesium adapter provides as it loads (mapEngine.js), through the application's renderer or the ./render/cesium/unbound export. The controller and createDefaultMapSources also take it as an `engine` option. src/maps/catalog.js, controller.js, imagery.js, terrain.js and google3d.js leave the allow-list.
34 lines
1.0 KiB
JavaScript
34 lines
1.0 KiB
JavaScript
/**
|
|
* @module maps/engine
|
|
* @description What the map stacks need from the renderer that no contract
|
|
* port gives yet: the providers each stack's imagery and terrain come from,
|
|
* and the scene operations the map source controller (`controller.js`)
|
|
* switches stacks with. Cesium-free: the renderer adapter provides it
|
|
* as it loads (the Cesium one in `src/render/cesium/mapEngine.js`, loaded by
|
|
* the application's renderer and by the package's `./render/cesium/unbound`
|
|
* export), and the map code asks for it when it first needs it.
|
|
*/
|
|
|
|
let provided = null;
|
|
|
|
/**
|
|
* Provide the map engine; a later call replaces it.
|
|
* @param {object} engine
|
|
*/
|
|
export function provideMapEngine(engine) {
|
|
provided = engine;
|
|
}
|
|
|
|
/**
|
|
* The map engine the renderer adapter provided.
|
|
* @returns {object}
|
|
* @throws {Error} When no adapter has provided one yet.
|
|
*/
|
|
export function mapEngine() {
|
|
if (!provided)
|
|
throw new Error(
|
|
'No map engine: load the renderer, or the package export ./render/cesium/unbound, first',
|
|
);
|
|
return provided;
|
|
}
|