mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-19 01:32:19 +00:00
Merge remote-tracking branch 'origin/main' into models/three-km-true-size
# Conflicts: # docs/CURRENT-STATE.md
This commit is contained in:
commit
b9cbc42f20
137 files changed
+8267
-688
No files matched your search
@@ -2,9 +2,10 @@ import assert from 'node:assert/strict';
|
||||
import test from 'node:test';
|
||||
import * as Cesium from 'cesium';
|
||||
|
||||
import { CLASS_SCALE_2D } from '../../data/aircraftClass.js';
|
||||
import { VEHICLE_TINT_CSS } from '../../data/aircraftClass.js';
|
||||
import { layerFeedState } from '../../data/feedState.js';
|
||||
import { aircraftIcon } from '../../data/aircraftIcons.js';
|
||||
import { ROTOR_STILL_FRAME, rotorFrame } from '../../data/rotorFrames.js';
|
||||
import {
|
||||
createLocalAdsbLayer,
|
||||
HEARD_BY_RECEIVER,
|
||||
@@ -239,7 +240,7 @@ test('enabling Local ADS-B asks the shared tuner for 1090 MHz; disabling leaves
|
||||
);
|
||||
});
|
||||
|
||||
test('local aircraft use their class silhouette and scale in magenta', async (t) => {
|
||||
test('local aircraft use their class silhouette at one size in magenta', async (t) => {
|
||||
const receiver = fakeReceiver({ mode: 'adsb', connected: true });
|
||||
const clock = { now: 100_000 };
|
||||
const { layer, draw, calls } = await enabledLayer(receiver, clock);
|
||||
@@ -266,8 +267,17 @@ test('local aircraft use their class silhouette and scale in magenta', async (t)
|
||||
assert.equal(typeof readEntityRecord(carrier)?.displayPosition, 'function');
|
||||
|
||||
const heli = () => iconOf(draw, 'local-adsb:a0b702');
|
||||
assert.equal(heli().image, aircraftIcon('helicopter'));
|
||||
assert.equal(heli().scale, CLASS_SCALE_2D.helicopter);
|
||||
// Airborne, its rotor turns: the frame of its own phase at the layer's time.
|
||||
assert.equal(
|
||||
heli().image,
|
||||
aircraftIcon(
|
||||
'helicopter',
|
||||
undefined,
|
||||
rotorFrame('local-adsb:a0b702', clock.now),
|
||||
),
|
||||
);
|
||||
assert.equal(heli().scale, 1, 'every class draws at one size');
|
||||
assert.equal(icon.scale, heli().scale);
|
||||
assert.deepEqual(
|
||||
heli().color,
|
||||
MAGENTA,
|
||||
@@ -286,18 +296,48 @@ test('local aircraft use their class silhouette and scale in magenta', async (t)
|
||||
icao: 'a0b702',
|
||||
category: 'A7',
|
||||
onGround: true,
|
||||
groundSpeedKt: 0,
|
||||
lastPositionAt: 100_500,
|
||||
}),
|
||||
],
|
||||
});
|
||||
await layer.update();
|
||||
assert.equal(heli().scale, CLASS_SCALE_2D.helicopter * 0.8);
|
||||
assert.equal(heli().scale, 0.8);
|
||||
// Parked on the ground its rotor holds still.
|
||||
assert.equal(
|
||||
heli().image,
|
||||
aircraftIcon('helicopter', undefined, ROTOR_STILL_FRAME),
|
||||
);
|
||||
|
||||
const [detectable] = layer.getDetectableObjects();
|
||||
assert.equal(detectable.sourceId, 'a0b702');
|
||||
assert.equal(detectable.type, 'AIR');
|
||||
});
|
||||
|
||||
test('local airport vehicles draw the amber vehicle sprite, ground stations the upright mast', async (t) => {
|
||||
const receiver = fakeReceiver({ mode: 'adsb', connected: true });
|
||||
const clock = { now: 100_000 };
|
||||
const { layer, draw } = await enabledLayer(receiver, clock);
|
||||
t.after(() => layer.destroy());
|
||||
receiver.set({
|
||||
aircraft: [
|
||||
record({ icao: 'a0c001', category: 'C1', trackDeg: 90 }),
|
||||
record({ icao: 'a0c002', category: 'C2', trackDeg: 90 }),
|
||||
record({ icao: 'a0c003', category: 'C3', trackDeg: 90 }),
|
||||
],
|
||||
});
|
||||
await layer.update();
|
||||
for (const id of ['a0c001', 'a0c002']) {
|
||||
const icon = iconOf(draw, `local-adsb:${id}`);
|
||||
assert.equal(icon.image, aircraftIcon('vehicle'), id);
|
||||
assert.deepEqual(icon.color, hexColor(VEHICLE_TINT_CSS), id);
|
||||
}
|
||||
const mast = iconOf(draw, 'local-adsb:a0c003');
|
||||
assert.equal(mast.image, aircraftIcon('station'));
|
||||
assert.deepEqual(mast.color, MAGENTA);
|
||||
assert.equal(mast.rotation, 0, 'upright whatever its track');
|
||||
});
|
||||
|
||||
test('the heading slews toward a new track instead of snapping', async (t) => {
|
||||
const receiver = fakeReceiver({ mode: 'adsb', connected: true });
|
||||
const clock = { now: 100_000 };
|
||||
|
||||
Reference in new issue
Block a user