mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-18 01:02:23 +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
@@ -216,3 +216,87 @@ test('back at live, the live poll goes out at once even while a snapshot at a ti
|
||||
assert.equal(Object.hasOwn(queries[1], 'atMs'), false);
|
||||
assert.equal(probe.applied.at(-1).rows.length, 1);
|
||||
});
|
||||
|
||||
test('back at live, only the first live vessel rows applied take over; a poll that fails or brings none says so', async () => {
|
||||
let answer = 'rows';
|
||||
const probe = ingestion({
|
||||
async getSnapshot() {
|
||||
if (answer === 'fail') throw new Error('down');
|
||||
return {
|
||||
records:
|
||||
answer === 'rows'
|
||||
? [{ id: '111', latitude: 1, longitude: 2, observedAtMs: 5 }]
|
||||
: [],
|
||||
observedAtMs: 5,
|
||||
freshness: 'current',
|
||||
complete: true,
|
||||
transportStatus: 'live',
|
||||
};
|
||||
},
|
||||
});
|
||||
assert.equal(await probe.resumeLive({}), true);
|
||||
await probe.methods.update();
|
||||
assert.deepEqual(
|
||||
probe.applied.map(({ options }) => options),
|
||||
[{ complete: true, handover: true }, { complete: true }],
|
||||
);
|
||||
answer = 'none';
|
||||
assert.equal(await probe.resumeLive({}), false);
|
||||
answer = 'fail';
|
||||
const warn = console.warn;
|
||||
console.warn = () => {};
|
||||
try {
|
||||
assert.equal(await probe.resumeLive({}), false);
|
||||
} finally {
|
||||
console.warn = warn;
|
||||
}
|
||||
});
|
||||
|
||||
test('back at live while a live poll is already out, that poll takes over and its answer is awaited', async () => {
|
||||
let answer;
|
||||
const probe = ingestion({
|
||||
getSnapshot: () =>
|
||||
new Promise((resolve) => {
|
||||
answer = () =>
|
||||
resolve({
|
||||
records: [
|
||||
{ id: '111', latitude: 1, longitude: 2, observedAtMs: 5 },
|
||||
],
|
||||
observedAtMs: 5,
|
||||
freshness: 'current',
|
||||
complete: true,
|
||||
transportStatus: 'live',
|
||||
});
|
||||
}),
|
||||
});
|
||||
const poll = probe.methods.update();
|
||||
const resumed = probe.resumeLive({});
|
||||
answer();
|
||||
assert.equal(await resumed, true);
|
||||
await poll;
|
||||
assert.deepEqual(
|
||||
probe.applied.map(({ options }) => options),
|
||||
[{ complete: true, handover: true }],
|
||||
);
|
||||
});
|
||||
|
||||
test('without AbortSignal.any a vessel request still gives up after its timeout', async (t) => {
|
||||
t.mock.timers.enable({ apis: ['setTimeout'] });
|
||||
const any = AbortSignal.any;
|
||||
AbortSignal.any = undefined;
|
||||
try {
|
||||
const probe = ingestion({
|
||||
getSnapshot: (_query, { signal }) =>
|
||||
new Promise((_, reject) =>
|
||||
signal.addEventListener('abort', () => reject(signal.reason)),
|
||||
),
|
||||
});
|
||||
const resumed = probe.resumeLive({});
|
||||
await Promise.resolve();
|
||||
t.mock.timers.tick(10_000);
|
||||
assert.equal(await resumed, false);
|
||||
assert.equal(probe.feed.loading, false);
|
||||
} finally {
|
||||
AbortSignal.any = any;
|
||||
}
|
||||
});
|
||||
Reference in new issue
Block a user