mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-17 08:42:21 +00:00
Merge main (d49d3d10) into the renderer branch
This commit is contained in:
commit
489c316556
134 files changed
+4980
-229
No files matched your search
@@ -12,7 +12,9 @@
|
||||
* snapshots. A vessel record's `id` is whatever its source gives, such as a
|
||||
* provider id; its `mmsi` is an optional attribute ('' or absent when
|
||||
* unknown), never its key, since vessels can share an MMSI. A source that
|
||||
* only has MMSIs uses the MMSI as the id.
|
||||
* only has MMSIs uses the MMSI as the id. A vessel record's `virtual` is true
|
||||
* for a virtual aid to navigation, a mark broadcast where nothing physical
|
||||
* stands (AIS message 21's virtual flag), else false; any source may set it.
|
||||
*
|
||||
* A source may also declare a timeline (see readSnapshotTimeline): it can
|
||||
* answer a snapshot at a given time, so the layer follows the world clock.
|
||||
|
||||
@@ -221,6 +221,18 @@ test('vessel identity, opaque reference and heading/course remain distinct, unkn
|
||||
assert.equal(row.altitudeDatum, 'sea-surface');
|
||||
assert.equal(row.observedAtMs, now);
|
||||
assert.equal('extra' in row, false);
|
||||
// Only a source's own true marks a virtual aid to navigation.
|
||||
assert.equal(row.virtual, false);
|
||||
const base = { mmsi: '993672001', lat: 30, lon: -97 };
|
||||
assert.equal(
|
||||
normalizeVesselObservation({ ...base, virtual: true }).virtual,
|
||||
true,
|
||||
);
|
||||
for (const virtual of ['true', 1, false, null])
|
||||
assert.equal(
|
||||
normalizeVesselObservation({ ...base, virtual }).virtual,
|
||||
false,
|
||||
);
|
||||
assert.equal(
|
||||
normalizeVesselObservation({ mmsi: 'x', lat: null, lon: null }),
|
||||
null,
|
||||
|
||||
@@ -55,6 +55,8 @@ export function normalizeVesselObservation(row, reference = null, id = null) {
|
||||
epoch(row.last_position_epoch, 1000) ??
|
||||
epoch(Date.parse(row.last_position_UTC)),
|
||||
altitudeDatum: 'sea-surface',
|
||||
// A virtual aid to navigation: a mark broadcast with nothing there.
|
||||
virtual: row.virtual === true,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { transitModeFor } from '../data/transitFeeds.js';
|
||||
import { validTransitIdentifier } from './transitHistory.js';
|
||||
export { validTransitIdentifier } from './transitHistory.js';
|
||||
/** Bounded, process-local operator position history. No upstream or scene access. */
|
||||
@@ -328,12 +329,12 @@ export function createTransitHistory({
|
||||
t > now + 10000
|
||||
)
|
||||
continue;
|
||||
const byVehicle = feed.vehicleMode?.(record.id);
|
||||
const mode =
|
||||
(byVehicle !== 'unknown' && byVehicle) ||
|
||||
feed.routeMode?.(record.routeId) ||
|
||||
feed.defaultMode ||
|
||||
'unknown';
|
||||
const mode = transitModeFor(
|
||||
feed,
|
||||
record.routeId,
|
||||
record.id,
|
||||
record.routeType,
|
||||
);
|
||||
const context = contextOf(record, mode);
|
||||
if (!context) continue;
|
||||
const key = `${feed.id}\u0000${record.id}`;
|
||||
|
||||
Reference in new issue
Block a user