mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-17 00:32:21 +00:00
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:
1 parent
e53cfef1d1
commit
6f830a2e70
46 files changed
+1417
-34
No files matched your search
@@ -4,8 +4,10 @@ import {
|
||||
perspectiveProjectedRotation,
|
||||
} from '../../data/iconOrientation.js';
|
||||
import {
|
||||
PLACED_WAKE_MS,
|
||||
updatePlayback,
|
||||
applyDisplayCourse,
|
||||
playbackMoving,
|
||||
syncPlayback,
|
||||
} from './movement.js';
|
||||
import {
|
||||
@@ -165,7 +167,7 @@ export function createRendering({ state, services, parts }) {
|
||||
migrateMarker(entry, false);
|
||||
return;
|
||||
}
|
||||
const positional = sample.phase === 'playing' && sample.segmentSpeedMps > 0;
|
||||
const positional = playbackMoving(entry);
|
||||
const turning =
|
||||
Number.isFinite(sample.segmentCourseDeg) &&
|
||||
Number.isFinite(entry.courseDeg) &&
|
||||
@@ -178,7 +180,19 @@ export function createRendering({ state, services, parts }) {
|
||||
} else {
|
||||
state._moving.delete(entry);
|
||||
migrateMarker(entry, false);
|
||||
if (Number.isFinite(sample.nextWakeMonoMs)) {
|
||||
// A vehicle a host-supplied placement holds still is asked again every
|
||||
// PLACED_WAKE_MS: it moves on once the placement does.
|
||||
const monoNow = performance.now();
|
||||
const placedWake = entry.placed === true;
|
||||
const boundary = sample.nextWakeMonoMs;
|
||||
const wakeMonoMs = placedWake
|
||||
? Math.min(
|
||||
Number.isFinite(boundary) ? boundary : Infinity,
|
||||
monoNow + PLACED_WAKE_MS,
|
||||
)
|
||||
: boundary;
|
||||
if (Number.isFinite(wakeMonoMs)) {
|
||||
const atBoundary = !placedWake || boundary <= wakeMonoMs;
|
||||
entry.wakeTimer = setTimeout(
|
||||
() => {
|
||||
entry.wakeTimer = null;
|
||||
@@ -187,9 +201,10 @@ export function createRendering({ state, services, parts }) {
|
||||
placeSample(entry);
|
||||
schedulePlayback(entry);
|
||||
syncRenderHold();
|
||||
governorRequestRender('transit-motion-boundary');
|
||||
if (atBoundary || state._moving.has(entry))
|
||||
governorRequestRender('transit-motion-boundary');
|
||||
},
|
||||
Math.max(1, sample.nextWakeMonoMs - performance.now()),
|
||||
Math.max(1, wakeMonoMs - monoNow),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -441,7 +456,8 @@ export function createRendering({ state, services, parts }) {
|
||||
if (
|
||||
!entry.surfaceReady ||
|
||||
entry.sample.phase !== 'playing' ||
|
||||
entry.sample.segmentSpeedMps === 0
|
||||
entry.sample.segmentSpeedMps === 0 ||
|
||||
(entry.placed === true && entry.placedMoving !== true)
|
||||
)
|
||||
schedulePlayback(entry);
|
||||
if (!state._moving.has(entry)) settleSelectedCard(entry);
|
||||
|
||||
Reference in new issue
Block a user