Drape the open-data map overlays through the renderer's globe port

The sea-mark and ski-piste overlays add an XYZ imagery layer through the
globe port instead of building Cesium layers into a host collection. The
port drapes it on the globe on globe stacks and on the Google 3D tiles,
which the map stack now marks as its base tilesets. The row's hidden
reason reads the map stack's new getDrapeSurface, or the viewer's globe
when there is no map stack, and an overlay enabled before its viewer has
a globe port adds its layer once there is one. The overlays no longer
reach Cesium, so they leave the allow-list.
This commit is contained in:
Sameh Khamis committed 2026-11-06 18:29:40 -08:00
1 parent c67cda5f84
commit b3dfcddcde
6 files changed
+152 -126

No files matched your search

+17
View File
@@ -4,6 +4,7 @@ import { createMapCredits } from './credits.js';
// A viewer of a caller's own gets its credits port (and camera) from the
// factories this loads.
import '../render/cesium/camera.js';
import { markBaseTileset } from '../render/cesium/globe.js';
import { acquireImageryComparison } from './imageryComparison.js';
/**
@@ -75,6 +76,9 @@ export class MapSourceController {
this._replacedTerrain = null;
this._subscribers = new Set();
this._destroyed = false;
// The renderer's imagery drapes on these while they are shown.
for (const source of this._sources.values())
if (source.tileset) markBaseTileset(source.tileset);
}
getStack(id) {
@@ -112,6 +116,18 @@ export class MapSourceController {
if (tileset.show === true) return tileset;
return null;
}
/**
* What draped imagery lands on now: `'globe'` while the globe is shown
* (a globe stack), `'tileset'` for a shown 3D stack, `'none'` when
* neither is drawn; null once destroyed, when it knows nothing.
* @returns {'globe' | 'tileset' | 'none' | null}
*/
getDrapeSurface() {
if (this._destroyed) return null;
if (this.viewer?.scene?.globe?.show === true) return 'globe';
const tileset = this.getImageryHostTileset();
return tileset && !tileset.isDestroyed?.() ? 'tileset' : 'none';
}
getActiveId() {
return this._activeId;
}
@@ -270,6 +286,7 @@ export class MapSourceController {
if (gen !== this._switchGen) return;
if (!source.tileset && !this._ownedTilesets.has(tileset)) {
tileset.show = false;
markBaseTileset(tileset);
this.viewer.scene.primitives.add(tileset);
this._ownedTilesets.add(tileset);
}