mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-19 09:42:21 +00:00
feat(firms): let an application stand in for the fire markers (#1828)
The fire layer takes a stand-in for its markers (setMarkerStandIn({ hitTest })): its glows, heatmap and ambient cards are hidden, and a click the stand-in answers selects and focuses the fire exactly as a marker click does.
This commit is contained in:
1 parent
46e831620e
commit
0421813e26
7 files changed
+234
-13
No files matched your search
@@ -52,10 +52,12 @@ export function createLifecycle({
|
||||
if (layerState._cells) layerState._cells.show = true;
|
||||
// The GPU culls the far side each frame, so retained rows are right
|
||||
// for wherever the camera went while the layer was off.
|
||||
if (layerState._icons) layerState._icons.show = true;
|
||||
if (layerState._icons) layerState._icons.show = !layerState._standIn;
|
||||
overlayHost.setVisible(FIRMS_OVERLAY_SOURCE_ID, true);
|
||||
// A filter can leave an old raster cached while the current set is empty.
|
||||
layerState._heatImagery?.setShow(layerState._fires.length > 0);
|
||||
layerState._heatImagery?.setShow(
|
||||
layerState._fires.length > 0 && !layerState._standIn,
|
||||
);
|
||||
// The camera can have crossed the hand-off while the layer was off.
|
||||
components.rendering.applyHandoffFade(true);
|
||||
components.viewport.installLodWatcher();
|
||||
@@ -68,6 +70,29 @@ export function createLifecycle({
|
||||
await components.ingestion.loadHeatmap();
|
||||
},
|
||||
|
||||
/**
|
||||
* Let an application draw the detections in place of the layer's
|
||||
* markers. While a stand-in is set, the glows, the heatmap and the
|
||||
* ambient cards are hidden and everything else works as before: a click
|
||||
* on a fire the stand-in draws (`standIn.hitTest(screenPosition)`, which
|
||||
* answers a detection record from the same source, or null) selects it
|
||||
* and moves the camera to it as a click on its marker does, the selected
|
||||
* fire's card shows, and a click on empty space clears the selection.
|
||||
* `null` brings the markers back. The selection is kept either way.
|
||||
* @param {?{hitTest: (screenPosition: {x: number, y: number}) => ?Object}} standIn
|
||||
*/
|
||||
setMarkerStandIn(standIn) {
|
||||
layerState._standIn =
|
||||
typeof standIn?.hitTest === 'function' ? standIn : null;
|
||||
layerState._heatImagery?.setShow(
|
||||
layerState._enabled &&
|
||||
layerState._fires.length > 0 &&
|
||||
!layerState._standIn,
|
||||
);
|
||||
components.rendering.applyHandoffFade(true);
|
||||
components.cards.rebuildAmbientLabels();
|
||||
},
|
||||
|
||||
disable() {
|
||||
layerState.request?.abort();
|
||||
layerState.request = null;
|
||||
@@ -129,6 +154,7 @@ export function createLifecycle({
|
||||
layerState._currentLodIndex = -1;
|
||||
layerState._lastViewRect = null;
|
||||
layerState._selectedFire = null;
|
||||
layerState._standIn = null;
|
||||
layerState._labelCandidates = [];
|
||||
layerState._labelLodDistance = 0;
|
||||
layerState._pickIndexById.clear();
|
||||
|
||||
Reference in new issue
Block a user