mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +00:00
Map stacks off the Cesium allow-list: providers move into the Cesium adapter
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.
This commit is contained in:
1 parent
aea5c3acc6
commit
a8a9cc73a4
31 files changed
+364
-140
No files matched your search
+16
-13
@@ -2,28 +2,31 @@ import { MAP_STACKS } from './catalog.js';
|
||||
import { photorealUnavailableReason } from './availability.js';
|
||||
import { keySetupRequirementEnvVars } from '../keySetupCore.mjs';
|
||||
import { t } from '../i18n/index.js';
|
||||
import {
|
||||
createOsmImagery,
|
||||
createEsriImagery,
|
||||
createIonImagery,
|
||||
ESRI_ATTRIBUTION_HTML,
|
||||
} from './imagery.js';
|
||||
import { createWorldTerrain, createKeylessTerrain } from './terrain.js';
|
||||
import { mapEngine } from './engine.js';
|
||||
import { ESRI_ATTRIBUTION_HTML } from './attribution.js';
|
||||
|
||||
/** Select sources and setup guidance without putting provider branches in the controller. */
|
||||
/**
|
||||
* Select sources and setup guidance without putting provider branches in the
|
||||
* controller. Each source builds its imagery and terrain through the
|
||||
* renderer's map engine (`engine.js`), or the `engine` given, when it is
|
||||
* first shown.
|
||||
*/
|
||||
export function createDefaultMapSources({
|
||||
googleTileset = null,
|
||||
cesiumToken = '',
|
||||
googleApiKey = '',
|
||||
engine = null,
|
||||
} = {}) {
|
||||
// The engine given, else the one the renderer provided, read when used.
|
||||
const engineOf = () => engine ?? mapEngine();
|
||||
const ionToken = String(cesiumToken || '').trim();
|
||||
const hasIon = Boolean(ionToken);
|
||||
const hasGoogle = Boolean(String(googleApiKey || '').trim());
|
||||
const terrain = {
|
||||
id: hasIon ? 'world' : 'keyless',
|
||||
create: hasIon
|
||||
? (request) => createWorldTerrain(ionToken, request)
|
||||
: createKeylessTerrain,
|
||||
? (request) => engineOf().terrain.world(ionToken, request)
|
||||
: () => engineOf().terrain.keyless(),
|
||||
};
|
||||
return {
|
||||
defaultId: googleTileset ? 'photoreal' : 'esri-imagery',
|
||||
@@ -52,10 +55,10 @@ export function createDefaultMapSources({
|
||||
};
|
||||
const imagery =
|
||||
descriptor.kind === 'ion'
|
||||
? () => createIonImagery(descriptor.style, ionToken)
|
||||
? () => engineOf().imagery.ion(descriptor.style, ionToken)
|
||||
: descriptor.id === 'osm'
|
||||
? createOsmImagery
|
||||
: createEsriImagery;
|
||||
? () => engineOf().imagery.osm()
|
||||
: () => engineOf().imagery.esri();
|
||||
return {
|
||||
...common,
|
||||
imagery,
|
||||
|
||||
Reference in new issue
Block a user