Add a globe visibility getter to the renderer contract

The globe port could show or hide the globe surface but not say whether it
is shown. It now has an optional isGlobeVisible(), gated by a new
globeVisibility capability, in the Cesium adapter, the stub and a
conformance check. A Cesium scene without a globe does not offer it, so
callers keep their own default for an unknown surface.

The OSM overlays, the CCTV ground regime and the submarine cable drape now
read the getter instead of the scene's globe. cableClassificationTypeForScene
takes the viewer rather than its scene.
This commit is contained in:
Sameh Khamis committed 2026-11-07 19:44:15 -08:00
1 parent 23d56f8393
commit 2e91579f8f
23 files changed
+140 -29

No files matched your search

+8 -1
View File
@@ -438,6 +438,8 @@ export function createCesiumGlobe(
return progressListeners.on(cb);
},
};
if (can('globeVisibility'))
port.isGlobeVisible = () => scene.globe?.show === true;
if (can('splitSwipe')) {
// Cesium's split starts at the canvas's left edge, as the scene was
// made: a `left` layer shows once the split moves.
@@ -469,8 +471,13 @@ export function createCesiumGlobe(
// built over it: imagery and the sky as the renderer's would.
provideUnboundGlobe((viewer) => {
if (!viewer?.scene) return null;
// Visibility reads back only from a globe that keeps it: a scene made
// without one gives no reading, so its callers keep their own default.
const capabilities = new Set(['imageHooks', 'imageryOnTiles', 'splitSwipe']);
if (typeof viewer.scene.globe?.show === 'boolean')
capabilities.add('globeVisibility');
const { port, dispose } = createCesiumGlobe(viewer, {
capabilities: new Set(['imageHooks', 'imageryOnTiles', 'splitSwipe']),
capabilities,
requestRender: () => viewer.scene.requestRender?.(),
});
// A renderer bound later leaves it running: its layers keep following