mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-20 10:12:18 +00:00
Find a selected vessel or aircraft again from its card
While a selected vessel, aircraft or military aircraft is off screen, behind the globe or out of its layer's feed, its Context card shows Find it. One still in its feed is flown to (an aircraft followed). One out of its feed is looked up on its own track at the layer's time (the world clock's while the layer follows it), the card moves to that reading and says how old it is, and the camera flies there; once the feed has it again its layer selects it again. With no reading at or before the time the card says so and the camera stays. A vessel its layer announces is named by its own id, as a click names it, not by the context store's.
This commit is contained in:
1 parent
b57d50fe18
commit
22e9c58d84
27 files changed
+833
-22
No files matched your search
@@ -27,6 +27,7 @@ import {
|
||||
followsClock,
|
||||
} from './policy.js';
|
||||
import { VESSEL_OVERLAY_SOURCE_ID } from '../../data/vesselLabels.js';
|
||||
import { locateOnTrack } from '../../data/locate.js';
|
||||
|
||||
const UUID_KEY =
|
||||
/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
||||
@@ -628,6 +629,39 @@ export function createQueries({
|
||||
return components.selection.selectAndFocusVessel(record);
|
||||
},
|
||||
|
||||
/**
|
||||
* The track reference of a loaded vessel, so it can be looked up again
|
||||
* once it has left the feed (see locate).
|
||||
* @param {string} id
|
||||
* @returns {string|null}
|
||||
*/
|
||||
referenceOf(id) {
|
||||
if (id === null || id === undefined) return null;
|
||||
return recordFor(String(id).trim())?.reference ?? null;
|
||||
},
|
||||
|
||||
/**
|
||||
* Where a vessel is at the layer's time (the world clock's while the
|
||||
* layer follows it, else now), from its own track: for a vessel that has
|
||||
* left the feed, so it can be found again.
|
||||
* @param {string} id
|
||||
* @param {{reference?: string, signal?: AbortSignal}} [options]
|
||||
* @returns {Promise<{status: 'found', lat: number, lon: number,
|
||||
* altitudeM: ?number, observedAtMs: number}|{status: 'none'}>}
|
||||
*/
|
||||
locate(id, { reference, signal } = {}) {
|
||||
const atMs = followsClock(vesselState)
|
||||
? vesselState.worldNow()
|
||||
: undefined;
|
||||
return locateOnTrack(
|
||||
vesselState._source,
|
||||
reference ??
|
||||
recordFor(String(id ?? '').trim())?.reference ??
|
||||
String(id ?? ''),
|
||||
{ atMs, signal },
|
||||
);
|
||||
},
|
||||
|
||||
/**
|
||||
* Return a subset of vessels for the universal detection overlay.
|
||||
* Deterministic stride sampling distributes selections evenly across the
|
||||
|
||||
Reference in new issue
Block a user