mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-17 16:52:20 +00:00
Merge origin/main: shipwrecks, news, transit fronts, signal-lost trails and uncredited photos on the renderer's ports
Upstream's layers and changes are carried onto the ports, with no Cesium outside src/render and no reach into the viewer: - Shipwrecks draw as one icon set, clicked through the input dispatcher. - News draws through draw sets, the camera port and the input dispatcher; its beacons pulse each frame through the frame port. - The scene occlusion probe moves into src/render/cesium and reaches detection through a new application hook, createOcclusionProbe; its private Cesium reads go through internals.js. - Flight and military trails, the stale and SIGNAL LOST cue, coasting and following the world clock run on the draw and frame ports. GPU icons follow the scene clock while the world clock is followed, and fade when stale. A report that holds is not planned again every tick. - Vessels are keyed by their record id. The stub boot now enables military, shipwrecks and news as well.
This commit is contained in:
commit
a755f63638
331 files changed
+40654
-1666
No files matched your search
@@ -17,8 +17,8 @@ function setup() {
|
||||
add: (record) => events.push(['add', record]),
|
||||
updated: (record) => events.push(['update', record]),
|
||||
remove: (record, evicted) =>
|
||||
events.push(['remove', record, evicted, store.byMmsi.has(record.mmsi)]),
|
||||
removed: (id) => events.push(['removed', id, store.byMmsi.has(id)]),
|
||||
events.push(['remove', record, evicted, store.byId.has(record.id)]),
|
||||
removed: (id) => events.push(['removed', id, store.byId.has(id)]),
|
||||
staleSelected: (record) => events.push(['stale', record]),
|
||||
};
|
||||
return {
|
||||
@@ -39,15 +39,15 @@ test('vessel reconciliation preserves record identity and first duplicate while
|
||||
row('222', { name: 'duplicate' }),
|
||||
row('bad', { lat: NaN }),
|
||||
]);
|
||||
assert.equal(probe.store.byMmsi.size, 2);
|
||||
assert.equal(probe.store.byMmsi.get('222').name, '222');
|
||||
const record = probe.store.byMmsi.get('111');
|
||||
assert.equal(probe.store.byId.size, 2);
|
||||
assert.equal(probe.store.byId.get('222').name, '222');
|
||||
const record = probe.store.byId.get('111');
|
||||
probe.reconcile([row('111', { lat: 51.94, type: 'Tanker' })]);
|
||||
assert.equal(probe.store.byMmsi.get('111'), record);
|
||||
assert.equal(probe.store.byId.get('111'), record);
|
||||
assert.equal(record.lat, 51.94);
|
||||
assert.equal(probe.events.find((event) => event[0] === 'update')[1], record);
|
||||
assert.equal(record.type, 'Tanker');
|
||||
assert.equal(probe.store.byMmsi.has('222'), false);
|
||||
assert.equal(probe.store.byId.has('222'), false);
|
||||
for (const field of [
|
||||
'position',
|
||||
'surfacePosition',
|
||||
@@ -62,14 +62,14 @@ test('vessel reconciliation preserves record identity and first duplicate while
|
||||
test('selected vessel remains pinned for three complete misses and teardown precedes removal', () => {
|
||||
const probe = setup();
|
||||
probe.reconcile([row('111'), row('222')]);
|
||||
const selectedRecord = probe.store.byMmsi.get('111');
|
||||
const selectedRecord = probe.store.byId.get('111');
|
||||
for (let i = 1; i <= 3; i++) {
|
||||
probe.reconcile([row('222')], { selectedRecord });
|
||||
assert.equal(probe.store.byMmsi.get('111'), selectedRecord);
|
||||
assert.equal(probe.store.byId.get('111'), selectedRecord);
|
||||
assert.equal(selectedRecord.missedRefreshes, i);
|
||||
}
|
||||
probe.reconcile([row('222')], { selectedRecord });
|
||||
assert.equal(probe.store.byMmsi.has('111'), false);
|
||||
assert.equal(probe.store.byId.has('111'), false);
|
||||
const removal = probe.events.find(
|
||||
(event) => event[0] === 'remove' && event[1] === selectedRecord,
|
||||
);
|
||||
@@ -83,13 +83,13 @@ test('selected vessel remains pinned for three complete misses and teardown prec
|
||||
test('partial retention respects age and row cap while preserving the selected contact', () => {
|
||||
const probe = setup();
|
||||
probe.reconcile([row('111'), row('222')], { cap: 2 });
|
||||
const selectedRecord = probe.store.byMmsi.get('111');
|
||||
const selectedRecord = probe.store.byId.get('111');
|
||||
probe.reconcile([row('333')], { complete: false, selectedRecord, cap: 2 });
|
||||
assert.deepEqual([...probe.store.byMmsi.keys()], ['111', '333']);
|
||||
assert.deepEqual([...probe.store.byId.keys()], ['111', '333']);
|
||||
assert.equal(selectedRecord.missedRefreshes, 1);
|
||||
probe.advance(5 * 60 * 1000);
|
||||
probe.reconcile([row('333')], { complete: false, selectedRecord, cap: 2 });
|
||||
assert.equal(probe.store.byMmsi.has('111'), false);
|
||||
assert.equal(probe.store.byId.has('111'), false);
|
||||
assert.equal(
|
||||
probe.events.find(
|
||||
(event) => event[0] === 'remove' && event[1] === selectedRecord,
|
||||
@@ -113,7 +113,7 @@ test('unkeyed records rebuild on each refresh and numeric coercion keeps unknown
|
||||
),
|
||||
true,
|
||||
);
|
||||
assert.equal(probe.store.byMmsi.size, 0);
|
||||
assert.equal(probe.store.byId.size, 0);
|
||||
assert.equal(probe.store.all.length, 1);
|
||||
assert.equal(normalizeVessel(row('bad', { lon: Infinity })), null);
|
||||
});
|
||||
@@ -126,14 +126,14 @@ test("each fix keeps when it was first received and its refresh's newest fix", (
|
||||
row('333'),
|
||||
]);
|
||||
for (const mmsi of ['111', '222', '333']) {
|
||||
const record = probe.store.byMmsi.get(mmsi);
|
||||
const record = probe.store.byId.get(mmsi);
|
||||
assert.equal(record.fixFeedEpoch, 1_800_000_030, mmsi);
|
||||
assert.equal(record.fixReceivedAtMs, 1000, mmsi);
|
||||
}
|
||||
// A new fix is stamped afresh.
|
||||
probe.advance(60_000);
|
||||
probe.reconcile([row('111', { last_position_epoch: 1_800_000_050 })]);
|
||||
const record = probe.store.byMmsi.get('111');
|
||||
const record = probe.store.byId.get('111');
|
||||
assert.equal(record.fixFeedEpoch, 1_800_000_050);
|
||||
assert.equal(record.fixReceivedAtMs, 61_000);
|
||||
// The same fix re-served by later polls keeps its first receipt, while
|
||||
@@ -147,3 +147,43 @@ test("each fix keeps when it was first received and its refresh's newest fix", (
|
||||
assert.equal(record.fixFeedEpoch, 1_800_000_050);
|
||||
assert.equal(record.receivedAtMs, 91_000);
|
||||
});
|
||||
|
||||
test('vessels are keyed by their source id; a shared MMSI is only an attribute', () => {
|
||||
const probe = setup();
|
||||
probe.reconcile([
|
||||
row('123456789', { id: 'hull-a', name: 'A' }),
|
||||
row('123456789', { id: 'hull-b', name: 'B' }),
|
||||
row('', { id: 'hull-c', name: 'C' }),
|
||||
]);
|
||||
assert.deepEqual(
|
||||
[...probe.store.byId.keys()],
|
||||
['hull-a', 'hull-b', 'hull-c'],
|
||||
);
|
||||
assert.equal(probe.store.unkeyed.length, 0);
|
||||
const [a, b, c] = probe.store.all;
|
||||
assert.deepEqual([a.mmsi, b.mmsi, c.mmsi], ['123456789', '123456789', '']);
|
||||
assert.equal(a.reference, 'hull-a');
|
||||
// The number moves to another hull: the vessel keeps its id.
|
||||
probe.reconcile([
|
||||
row('', { id: 'hull-a', name: 'A' }),
|
||||
row('123456789', { id: 'hull-b', name: 'B' }),
|
||||
row('123456789', { id: 'hull-c', name: 'C' }),
|
||||
]);
|
||||
assert.equal(probe.store.byId.get('hull-a'), a);
|
||||
assert.equal(a.mmsi, '');
|
||||
assert.equal(probe.store.byId.get('hull-c').mmsi, '123456789');
|
||||
});
|
||||
|
||||
test('an AIS row with no id is keyed by its MMSI; one with neither is unkeyed', () => {
|
||||
assert.deepEqual(
|
||||
[
|
||||
normalizeVessel(row('366999712')).id,
|
||||
normalizeVessel(row('366999712')).mmsi,
|
||||
],
|
||||
['366999712', '366999712'],
|
||||
);
|
||||
const probe = setup();
|
||||
probe.reconcile([row(''), row('', { id: '' })]);
|
||||
assert.equal(probe.store.byId.size, 0);
|
||||
assert.equal(probe.store.unkeyed.length, 2);
|
||||
});
|
||||
Reference in new issue
Block a user