mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +00:00
Keep the radio layer's data source in its rendering part, and take the radio lifecycle off the Cesium list
The radio lifecycle no longer makes, shows, hides or removes the stations' Cesium data source or the selected station's entity itself: the rendering part does, through installDataSource, setStationsShown, removeSelectionEntity and removeDataSource, in the same order as before. The camera factory import moves to the rendering part too, which stays on the list. The lifecycle no longer imports Cesium or drives the viewer, so it leaves the allow-list.
This commit is contained in:
1 parent
436b110547
commit
35021d9f10
5 files changed
+135
-21
No files matched your search
@@ -1,7 +1,3 @@
|
||||
import * as Cesium from 'cesium';
|
||||
// The Cesium camera factory: given a viewer of a caller's own, with no
|
||||
// renderer bound, the layer's flights and camera reads find a camera port.
|
||||
import '../../render/cesium/camera.js';
|
||||
import {
|
||||
RADIO_OVERLAY_SOURCE_ID,
|
||||
DEFAULT_RADIO_VOLUME,
|
||||
@@ -18,18 +14,14 @@ export function createLifecycle({
|
||||
const { clearOverlaySource, setOverlaySourceVisible } = services.overlays;
|
||||
|
||||
const methods = {
|
||||
/** Initialize the Cesium data source and the single audio element. */
|
||||
/** Initialize the stations' rendering and the single audio element. */
|
||||
init(viewer) {
|
||||
layerState._sessionGeneration += 1;
|
||||
layerState._viewer = viewer;
|
||||
parts.clustering.resetRadioClusterOverlayIdentities();
|
||||
parts.playback.installAudio();
|
||||
if (!layerState._dataSource) {
|
||||
layerState._dataSource = new Cesium.CustomDataSource('Radio stations');
|
||||
viewer.dataSources.add(layerState._dataSource);
|
||||
parts.rendering.installClusterStyling();
|
||||
}
|
||||
layerState._dataSource.show = false;
|
||||
parts.rendering.installDataSource(viewer);
|
||||
parts.rendering.setStationsShown(false);
|
||||
clearOverlaySource(RADIO_OVERLAY_SOURCE_ID);
|
||||
setOverlaySourceVisible(RADIO_OVERLAY_SOURCE_ID, false);
|
||||
},
|
||||
@@ -58,10 +50,8 @@ export function createLifecycle({
|
||||
layerState._cancelledTuningPresentationStation = null;
|
||||
layerState._tuningUnavailableStationId = null;
|
||||
parts.playback.stopRadioPlayback({ origin: 'layer-disable' });
|
||||
if (layerState._dataSource) layerState._dataSource.show = false;
|
||||
if (layerState._selectedEntity && layerState._viewer)
|
||||
layerState._viewer.entities.remove(layerState._selectedEntity);
|
||||
layerState._selectedEntity = null;
|
||||
parts.rendering.setStationsShown(false);
|
||||
parts.rendering.removeSelectionEntity();
|
||||
if (layerState._overlayPublishTimer)
|
||||
clearTimeout(layerState._overlayPublishTimer);
|
||||
layerState._overlayPublishTimer = null;
|
||||
@@ -86,11 +76,7 @@ export function createLifecycle({
|
||||
if (layerState._audio) layerState._audio.volume = DEFAULT_RADIO_VOLUME;
|
||||
layerState._audio = null;
|
||||
layerState._userVolume = DEFAULT_RADIO_VOLUME;
|
||||
layerState._removeClusterListener?.();
|
||||
layerState._removeClusterListener = null;
|
||||
if (layerState._dataSource && layerState._viewer)
|
||||
layerState._viewer.dataSources.remove(layerState._dataSource, true);
|
||||
layerState._dataSource = null;
|
||||
parts.rendering.removeDataSource();
|
||||
clearOverlaySource(RADIO_OVERLAY_SOURCE_ID);
|
||||
layerState._stations = [];
|
||||
layerState._acceptedCatalogSnapshot = EMPTY_ACCEPTED_CATALOG_SNAPSHOT;
|
||||
|
||||
Reference in new issue
Block a user