mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-17 00:32:21 +00:00
Keep the radio layer's Cesium entities and picks in its rendering part
The radio interaction, selection and navigation parts had left the Cesium allow-list but still read pick objects, toggled entity visibility, removed the selection entity, re-ran clustering and read the Cesium camera. Navigation now reads the camera port's pose; the rest moves into the rendering part.
This commit is contained in:
1 parent
a8f41d30fc
commit
045267c841
7 files changed
+76
-52
No files matched your search
@@ -20,31 +20,6 @@ export function createInteraction({
|
||||
} = services.picking;
|
||||
const { setOverlaySourceVisible } = services.overlays;
|
||||
|
||||
/** Resolve a station id from ordinary, selected, or Cesium cluster pick shapes. */
|
||||
|
||||
function radioStationIdFromPick(picked) {
|
||||
const pending = [picked?.id, picked?.primitive?.id];
|
||||
const seen = new Set();
|
||||
while (pending.length) {
|
||||
const value = pending.shift();
|
||||
if (typeof value === 'string' || typeof value === 'number') {
|
||||
const id = String(value);
|
||||
if (id.startsWith(`${RADIO_PREFIX}selected:`))
|
||||
return id.slice(`${RADIO_PREFIX}selected:`.length);
|
||||
if (id.startsWith(RADIO_PREFIX)) return id.slice(RADIO_PREFIX.length);
|
||||
continue;
|
||||
}
|
||||
if (!value || typeof value !== 'object' || seen.has(value)) continue;
|
||||
seen.add(value);
|
||||
if (Array.isArray(value)) pending.push(...value);
|
||||
else {
|
||||
pending.push(value.id);
|
||||
if (value.primitive) pending.push(value.primitive.id);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* The station under a click: the pick itself, then one drill through a
|
||||
* window around it, which also catches a near miss. Both passes are the
|
||||
@@ -56,7 +31,7 @@ export function createInteraction({
|
||||
if (!event) return null;
|
||||
|
||||
const stationFromPick = (picked) => {
|
||||
const stationId = radioStationIdFromPick(picked);
|
||||
const stationId = parts.rendering.radioStationIdFromPick(picked);
|
||||
return stationId && layerState._stationById.has(stationId)
|
||||
? stationId
|
||||
: null;
|
||||
@@ -90,7 +65,7 @@ export function createInteraction({
|
||||
|
||||
function syncRadioLifecyclePresentation() {
|
||||
const visible = radioPresentationAllowed();
|
||||
if (layerState._dataSource) layerState._dataSource.show = visible;
|
||||
parts.rendering.setStationsShown(visible);
|
||||
setOverlaySourceVisible(RADIO_OVERLAY_SOURCE_ID, visible);
|
||||
if (visible) {
|
||||
installInteraction();
|
||||
@@ -99,9 +74,7 @@ export function createInteraction({
|
||||
parts.rendering.scheduleRadioOverlayPublish();
|
||||
} else {
|
||||
removeInteraction();
|
||||
if (layerState._selectedEntity && layerState._viewer)
|
||||
layerState._viewer.entities.remove(layerState._selectedEntity);
|
||||
layerState._selectedEntity = null;
|
||||
parts.rendering.removeSelectionEntity();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -142,7 +115,6 @@ export function createInteraction({
|
||||
layerState._horizonTimer = null;
|
||||
}
|
||||
return {
|
||||
radioStationIdFromPick,
|
||||
pickedRadioStationAt,
|
||||
radioPresentationAllowed,
|
||||
syncRadioLifecyclePresentation,
|
||||
|
||||
Reference in new issue
Block a user