mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +00:00
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:
1 parent
23d56f8393
commit
2e91579f8f
23 files changed
+140
-29
No files matched your search
@@ -15,14 +15,14 @@ export function createLifecycle({ state, parts, source, mapStackEventTarget }) {
|
||||
|
||||
init(viewer) {
|
||||
state._viewer = viewer;
|
||||
state._clampTo = cableClassificationTypeForScene(viewer?.scene);
|
||||
state._clampTo = cableClassificationTypeForScene(viewer);
|
||||
parts.rendering.attach(viewer);
|
||||
if (!state._mapStackListener && mapStackEventTarget?.addEventListener) {
|
||||
state._mapStackListener = (event) => {
|
||||
parts.rendering.applyCableClassification(
|
||||
event?.detail?.activeId
|
||||
? cableClassificationTypeForStack(event.detail.activeId)
|
||||
: cableClassificationTypeForScene(state._viewer?.scene),
|
||||
: cableClassificationTypeForScene(state._viewer),
|
||||
);
|
||||
};
|
||||
mapStackEventTarget.addEventListener(
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { findGlobe } from '../../render/rendererOf.js';
|
||||
import { CABLE_GLOBE_STACK_IDS } from './policy.js';
|
||||
|
||||
/**
|
||||
@@ -20,15 +21,18 @@ export function cableClassificationTypeForStack(activeId) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Derive the active surface from live scene state. The boot-time
|
||||
* Derive the active surface from what the renderer draws. The boot-time
|
||||
* `setStack(..., { silent: true })` fires no 'gev:map-stack-changed' event,
|
||||
* so the initial surface is read the way the height-datum listeners do: the
|
||||
* photoreal regime is exactly "globe hidden".
|
||||
* @param {{globe?: {show?: boolean}}|null|undefined} scene
|
||||
* @param {object|null|undefined} host The scene object the renderer is bound
|
||||
* to (the viewer); `both` when it has none, or one that cannot say whether
|
||||
* the globe is shown.
|
||||
* @returns {'tiles'|'terrain'|'both'}
|
||||
*/
|
||||
|
||||
export function cableClassificationTypeForScene(scene) {
|
||||
if (!scene?.globe) return 'both';
|
||||
return scene.globe.show === false ? 'tiles' : 'terrain';
|
||||
export function cableClassificationTypeForScene(host) {
|
||||
const visible = findGlobe(host)?.isGlobeVisible?.();
|
||||
if (typeof visible !== 'boolean') return 'both';
|
||||
return visible ? 'terrain' : 'tiles';
|
||||
}
|
||||
Reference in new issue
Block a user