mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 16:22:20 +00:00
feat(military): render on Navara
Task 11b. src/layers/military/render/navara.js: the shared Navara aircraft renderer with the military's sprite slot (SPRITE_LAYER_ORDER 'military', under flights) and jet.glb's nose offset; registered by registerNavaraLayerRenderers (now a table of lazily imported factories, flights and military), so the Navara catalog offers military and the main chunk stays without three/Navara. - The follow passes between aircraft layers on Navara as on Cesium: the follow-handle → tracked-handle map and the "follow being started" handle are shared by every aircraft renderer of the page, so a layer whose follow another layer took reads the new owner's tracked handle (and its gevSelectionOrigin) — before, it read a bare follow handle and reported 'programmatic'. - trackById on a selected-but-not-followed contact follows it again (as flights since 10b; on Navara any camera command ends a follow). - qaDrawn (the probe's drawn()) for military, shared with flights (src/layers/aircraft/qaDrawn.js). - ?qaFeed=military:synthetic[:count]: seeded readsb rows (1 000 by default, 150 near JFK, 12 on the ground, 8 types), the first 25 hexes shared with the synthetic civil flights. - qa-w1-layers: sections 4–6 read the --layer's module (were 'flights'); section 5 keeps the queries beside the voice answers (the voice block overwrote them, so --compare never compared queries); for military: the follow passes military → flights → military, and flights leaves the 25 shared aircraft to military while it is on (9 975 / 10 000 / 9 975). qa-w1-layers --layer=military: Cesium 25/25, Navara 26/26, --compare parity (queries included; the known 2.3 px camera offset at the global pose only).
This commit is contained in:
1 parent
3a0a3b0551
commit
9dc446bd24
13 files changed
+423
-56
No files matched your search
@@ -5,16 +5,24 @@
|
||||
// shape. Times are relative to now, so the objects stay fresh.
|
||||
//
|
||||
// flights:synthetic[:count] OpenSky states, `count` aircraft (8 000)
|
||||
// military:synthetic[:count] readsb rows, `count` aircraft (1 000); the
|
||||
// first 25 are also synthetic civil flights
|
||||
// vessels:fixture 12 000 AIS rows, or those within an area
|
||||
|
||||
import {
|
||||
createFlightSource,
|
||||
createMilitarySource,
|
||||
createVesselSource,
|
||||
} from '../../sources/live/standalone.js';
|
||||
import { syntheticFlights, syntheticVessels } from '../../bench/w1Feeds.js';
|
||||
import {
|
||||
syntheticFlights,
|
||||
syntheticMilitary,
|
||||
syntheticVessels,
|
||||
} from '../../bench/w1Feeds.js';
|
||||
|
||||
const KINDS = Object.freeze({
|
||||
flights: new Set(['synthetic']),
|
||||
military: new Set(['synthetic']),
|
||||
vessels: new Set(['fixture']),
|
||||
});
|
||||
|
||||
@@ -30,7 +38,7 @@ export function parseQaFeed(search = '') {
|
||||
(count !== null && !(Number.isInteger(count) && count > 0))
|
||||
)
|
||||
throw new TypeError(
|
||||
`qaFeed: unknown entry "${item}" (flights:synthetic[:count], vessels:fixture)`,
|
||||
`qaFeed: unknown entry "${item}" (flights:synthetic[:count], military:synthetic[:count], vessels:fixture)`,
|
||||
);
|
||||
return { layer, kind, count };
|
||||
});
|
||||
@@ -52,6 +60,14 @@ export function createQaSources(entries, { now = () => Date.now() } = {}) {
|
||||
fetchImpl: async () =>
|
||||
json(syntheticFlights({ nowMs: now(), count: count ?? 8000 })),
|
||||
});
|
||||
if (layer === 'military')
|
||||
sources.military = createMilitarySource({
|
||||
now,
|
||||
fetchImpl: async (url) =>
|
||||
String(url).includes('/track')
|
||||
? json({ timestamp: now() / 1000, trace: [] })
|
||||
: json(syntheticMilitary({ nowMs: now(), count: count ?? 1000 })),
|
||||
});
|
||||
if (layer === 'vessels')
|
||||
sources.vessels = createVesselSource({
|
||||
fetchImpl: async (url) => {
|
||||
|
||||
@@ -42,3 +42,24 @@ test('fixture sources answer with the live sources’ snapshot shape', async ()
|
||||
assert.ok(near.records.length > 10 && near.records.length < 12000);
|
||||
assert.deepEqual(createQaSources([]), {});
|
||||
});
|
||||
|
||||
test('military:synthetic answers with the military source’s shape, some shared with flights', async () => {
|
||||
const now = Date.UTC(2026, 9, 16, 12);
|
||||
const sources = createQaSources(
|
||||
parseQaFeed('?qaFeed=military:synthetic:300,flights:synthetic:500'),
|
||||
{ now: () => now },
|
||||
);
|
||||
const military = await sources.military.getSnapshot({});
|
||||
assert.equal(military.records.length, 300);
|
||||
assert.ok(military.records.some((record) => record.onGround));
|
||||
assert.ok(military.records.every((record) => record.typeCode));
|
||||
const identities = await sources.military.getIdentities({});
|
||||
assert.ok(identities.records?.length ?? identities.length);
|
||||
const civil = new Set(
|
||||
(await sources.flights.getSnapshot({})).records.map(({ id }) => id),
|
||||
);
|
||||
const shared = military.records.filter(({ id }) => civil.has(id));
|
||||
assert.equal(shared.length, 25);
|
||||
const track = await sources.military.getTrack('ae1100');
|
||||
assert.deepEqual(track.records, []);
|
||||
});
|
||||
Reference in new issue
Block a user