mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-18 17:22:19 +00:00
Sprites for helicopters, ground vehicles, stations and vessel types; history to live without an empty map; model parts in Cesium
Aircraft icons are one size; helicopters turn a three-frame rotor while airborne or moving; ADS-B ground vehicles share one amber sprite and stations/obstacles one mast; vessels get hull sprites by type and one buoy. Going live keeps contacts until the first live answer and replaces them by id; fast playback holds before the loaded positions end and prefetches ahead. Cesium models move their parts from the optional model part state.
This commit is contained in:
1 parent
624c229bc2
commit
7186f720df
97 files changed
+6586
-343
No files matched your search
@@ -20,6 +20,7 @@ function harness({ placement = null, following = false } = {}) {
|
||||
const visuals = [];
|
||||
const state = { selectedRecord: null, trailId: null };
|
||||
const records = new VesselRecords({ now: () => 5_000_000 });
|
||||
const primitives = [];
|
||||
const rendering = {
|
||||
ensureCollections() {},
|
||||
makeOccluder: () => null,
|
||||
@@ -28,8 +29,12 @@ function harness({ placement = null, following = false } = {}) {
|
||||
visuals.push(record.id);
|
||||
return { billboard: null };
|
||||
},
|
||||
addRecordPrimitives() {},
|
||||
removeRecordPrimitives() {},
|
||||
addRecordPrimitives(record) {
|
||||
primitives.push(['add', record.id]);
|
||||
},
|
||||
removeRecordPrimitives(record) {
|
||||
primitives.push(['remove', record.id]);
|
||||
},
|
||||
shipIcon: () => 'icon',
|
||||
shipScale: () => 1,
|
||||
syncRecordIcon() {},
|
||||
@@ -41,12 +46,15 @@ function harness({ placement = null, following = false } = {}) {
|
||||
records,
|
||||
rendering,
|
||||
tracking: {},
|
||||
selection: {},
|
||||
cards: {},
|
||||
selection: { clearVesselInspection() {} },
|
||||
cards: { updateSelectedVesselHud() {} },
|
||||
followsClock: () => following,
|
||||
});
|
||||
return {
|
||||
visuals,
|
||||
primitives,
|
||||
state,
|
||||
records,
|
||||
reconcile: (rows, options) => renderer.reconcileVessels({}, rows, options),
|
||||
};
|
||||
}
|
||||
@@ -105,3 +113,61 @@ test('following the world clock, or rows at another time, tell the placement not
|
||||
harness({ placement }).reconcile([row('a')], { replace: true });
|
||||
assert.deepEqual(told, []);
|
||||
});
|
||||
|
||||
test('back at live, the first live vessel rows keep the vessels they have, drop the rest, and are told to the placement', () => {
|
||||
const { told, forgotten, placement } = recording();
|
||||
const probe = harness({ placement });
|
||||
probe.reconcile([row('a'), row('b')]);
|
||||
probe.primitives.length = 0;
|
||||
told.length = 0;
|
||||
probe.reconcile(
|
||||
[row('a', { lat: 52, last_position_epoch: 1_060 }), row('c')],
|
||||
{ handover: true },
|
||||
);
|
||||
// The vessel it has keeps its icon; the one it lacks goes; a new one is
|
||||
// added.
|
||||
assert.deepEqual(probe.primitives, [
|
||||
['add', 'c'],
|
||||
['remove', 'b'],
|
||||
]);
|
||||
assert.deepEqual(forgotten, ['b']);
|
||||
assert.deepEqual(
|
||||
told.map(([id]) => id),
|
||||
['a', 'c'],
|
||||
'live fixes, told to the placement',
|
||||
);
|
||||
});
|
||||
|
||||
test('back at live, partial vessel rows keep the vessels they lack whose newest fix is recent; complete rows pin the selected one', () => {
|
||||
const probe = harness();
|
||||
// The records' clock reads 5 000 s: 'recent' was fixed 100 s before it,
|
||||
// 'old' and 'picked' over an hour before.
|
||||
probe.reconcile([
|
||||
row('recent', { last_position_epoch: 4_900 }),
|
||||
row('old'),
|
||||
row('picked'),
|
||||
]);
|
||||
probe.state.selectedRecord = probe.records.byId.get('picked');
|
||||
probe.primitives.length = 0;
|
||||
probe.reconcile([row('c', { last_position_epoch: 4_990 })], {
|
||||
complete: false,
|
||||
handover: true,
|
||||
});
|
||||
// Partial rows prove no absence for a recent fix; an old one is gone.
|
||||
assert.ok(probe.records.byId.has('recent'));
|
||||
assert.equal(probe.records.byId.get('recent').motion, null);
|
||||
assert.equal(probe.records.byId.has('old'), false);
|
||||
|
||||
const complete = harness();
|
||||
complete.reconcile([
|
||||
row('recent', { last_position_epoch: 4_900 }),
|
||||
row('picked'),
|
||||
]);
|
||||
complete.state.selectedRecord = complete.records.byId.get('picked');
|
||||
complete.reconcile([row('c', { last_position_epoch: 4_990 })], {
|
||||
handover: true,
|
||||
});
|
||||
// Complete rows judge as a refresh does: the selected vessel is pinned for
|
||||
// a few refreshes, the rest go.
|
||||
assert.deepEqual([...complete.records.byId.keys()].sort(), ['c', 'picked']);
|
||||
});
|
||||
Reference in new issue
Block a user