Merge main (663b56f62, #1755) into the renderer branch

This commit is contained in:
Sameh Khamis committed 2026-11-15 16:34:05 -08:00
commit a0d299523d
91 files changed
+1793 -396

No files matched your search

+15 -1
View File
@@ -1,5 +1,6 @@
import { pickRenderAltitudeM } from '../../data/renderAltitude.js';
import { stickyText, stickyNumber } from '../../data/aircraftMeta.js';
import { courseFromFixes } from '../../data/courseFromFixes.js';
import { classifyAircraft } from '../../data/aircraftClass.js';
import { aircraftEmergency } from '../../data/aircraftEmergency.js';
import {
@@ -175,6 +176,12 @@ export class MilitaryFlightRecords {
// last-known-good (bounded by the layer's eviction, which deletes the entry).
const stickyType = stickyText(type, prevMeta?.type);
const fixEpochMs = aircraft.positionTimeMs ?? observedAtMs;
const course = courseFromFixes(prevMeta?.courseAnchor, {
lat,
lon,
ms: fixEpochMs,
speedMps: aircraft.speedMps,
});
const meta = {
sourceReference: aircraft.reference,
observedReceiptMs: this.now(),
@@ -206,7 +213,14 @@ export class MilitaryFlightRecords {
onGround ? 0 : prevMeta?.speedMps,
0,
),
track: stickyNumber(aircraft.courseDeg, prevMeta?.track, 0),
// With no reported track or true heading, a moving contact faces the
// way its fixes went (src/data/courseFromFixes.js); else the last one.
track: stickyNumber(
aircraft.courseDeg,
course.courseDeg ?? prevMeta?.track,
0,
),
courseAnchor: course.anchor,
// Analyst seam (additive): sticky like the other kinematics.
verticalRateMps: stickyNumber(
verticalRateMps,
+23
View File
@@ -269,3 +269,26 @@ test('a repeated military fix time marks the contact as not updated; removal is
records.forget('aaa001');
assert.equal(records.fixRepeated.has('aaa001'), false);
});
test('a military contact reported with no course faces the way its newer fixes went', () => {
const records = store();
const T = 1700000000000;
const taxi = (latitude, seconds) =>
records.receive(
observation({
latitude,
onGround: true,
baroAltitudeM: null,
courseDeg: null,
speedMps: 8,
positionTimeMs: T + seconds * 1000,
}),
context({ observedAtMs: T + seconds * 1000 + 500 }),
);
assert.equal(taxi(39, 0).meta.track, 0);
assert.ok(Math.abs(taxi(38.9995, 5).meta.track - 180) < 0.1);
assert.ok(
Math.abs(taxi(39.002, 3).meta.track - 180) < 0.1,
'an older fix gives no course',
);
});