Let a host application place live contacts

createApplicationCatalog takes an optional placement provider. Its
layer(kind) hands Flights, Military Flights, AIS Vessels, Transit and Rail
a place(id, wallMs), and optionally observe(id, fix) and forget(id). While
live, each layer tells it every fix it accepts and draws a contact where it
places it: position, height (the layer's own when none is given), course
and speed. A null answer, a provider that throws, a kind it leaves out, or
no provider at all keeps the layer's own motion unchanged, and following
the world clock the layers never ask it. A transit vehicle or train it
holds still lets the render loop idle and is asked again each second;
vessels ask for frames only while it places one, and stop when the layer
turns off.

Tests show the layers draw and reconcile exactly as before without a
provider and with one that places nothing, draw where a provider places
them, and idle while it holds them still.
This commit is contained in:
Sameh Khamis committed 2026-11-14 15:07:25 -08:00
1 parent e53cfef1d1
commit 6f830a2e70
46 files changed
+1417 -34

No files matched your search

+7 -2
View File
@@ -4,6 +4,7 @@
// height, layer stats, selected route lines).
import * as Cesium from 'cesium';
import { createRailLayer } from '../layers/rail/index.js';
import { layerPlacement } from '../data/placementProvider.js';
import { CAMERA_DEBOUNCE_MS } from '../layers/rail/policy.js';
import { WORLD_FOCUS_FRAMING } from '../worldFocus.js';
import { publicRailCatalog } from '../data/railFeeds.js';
@@ -82,7 +83,8 @@ const headersOf = (values = {}) => ({
* catalog?: object[]|Promise<object[]>|Function|false,
* ground?: object,
* stops?: object|null, scheduleStops?: boolean,
* paths?: Record<string, object>|null, fleet?: object|null}} [options]
* paths?: Record<string, object>|null, fleet?: object|null,
* placement?: object|null}} [options]
* `ground`: a floor service in place of the always-cold stub; `catalog`:
* the server's feed catalog (it may list fewer feeds than are bundled; a
* promise answers when it settles, a function is called per request and
@@ -94,7 +96,8 @@ const headersOf = (values = {}) => ({
* failure status it answers with (404 for any other feed; without it the
* source has no path route at all); `fleet`: the fleet-model services
* (testSupport/fleetModelFakes.mjs), with a camera that looks straight
* down for them (none by default: trains stay icons).
* down for them (none by default: trains stay icons); `placement`: a
* host-supplied placement provider (../data/placementProvider.js).
*/
export function railLayerHarness(
t,
@@ -107,6 +110,7 @@ export function railLayerHarness(
scheduleStops = false,
paths = null,
fleet = null,
placement = null,
} = {},
) {
const T0 = RAIL_HARNESS_T0;
@@ -332,6 +336,7 @@ export function railLayerHarness(
warmGroundFloor() {},
},
...(fleet ? { fleet } : {}),
...(placement ? { placement: layerPlacement(placement, 'rail') } : {}),
camera: {
framing: WORLD_FOCUS_FRAMING.train,
requestWorldFocus(detail) {