Keep tracked-entity state in app records instead of on Cesium entities

Flights, military, satellites, installations, local ADS-B and ALPR hung
gevTrackedId, gevDisplayPosition, gevVisualPosition, gevSelectionOrigin and
gevLabelModel on the Cesium entities they draw, and the tracked readout,
follow camera, cockpit, share links and awareness read them back. They now
live in src/data/entityRecords.js, an app-owned record per entity: layers
write entityRecord(entity), readers use readEntityRecord(entity). Nothing
changes on screen. This is the first slice of the renderer plan's state
mirror (P1).

The module is exported as ./data/entity-records so callers can read the
same records, and window.__godsEyeView.entityRecords gives the QA scripts
the same access from the page.
This commit is contained in:
Sameh Khamis committed 2026-11-03 08:09:00 -08:00
1 parent ea69bb4ce2
commit 65587f6c08
53 files changed
+408 -291

No files matched your search

+3 -2
View File
@@ -1,5 +1,6 @@
import * as Cesium from 'cesium';
import { isPointerFree } from '../../data/inputOwnership.js';
import { readEntityRecord } from '../../data/entityRecords.js';
export function createInteraction({
state: layerState,
@@ -36,8 +37,8 @@ export function createInteraction({
) {
parts.tracking._clearTracking(true, {
origin:
layerState._viewer.trackedEntity?.gevSelectionOrigin ||
'programmatic',
readEntityRecord(layerState._viewer.trackedEntity)
?.selectionOrigin || 'programmatic',
});
}
});
+7 -5
View File
@@ -9,6 +9,7 @@ import {
TRACK_VIEW_FROM_HIGH_SCALE,
TRACK_VIEW_FROM_LEO,
} from './policy.js';
import { entityRecord, readEntityRecord } from '../../data/entityRecords.js';
export function createTracking({ state: layerState, services, parts, source }) {
const { clearFocusTarget, publishFocusTargetFromCachedPosition } =
@@ -384,7 +385,7 @@ export function createTracking({ state: layerState, services, parts, source }) {
: t('DOCKED · {name}', { name: companions[0] }),
);
}
const current = layerState._trackedEntity.gevLabelModel;
const current = readEntityRecord(layerState._trackedEntity)?.labelModel;
// Compare the WHOLE detail array: comparing only `details[0]` swallowed any
// change confined to the companions line, so the card would never republish.
const unchanged =
@@ -392,7 +393,7 @@ export function createTracking({ state: layerState, services, parts, source }) {
current?.details?.length === details.length &&
details.every((line, index) => current.details[index] === line);
if (unchanged) return;
layerState._trackedEntity.gevLabelModel = {
entityRecord(layerState._trackedEntity).labelModel = {
title,
details,
accent: '#ffd84d',
@@ -456,9 +457,10 @@ export function createTracking({ state: layerState, services, parts, source }) {
disableDepthTestDistance: Number.POSITIVE_INFINITY,
},
});
layerState._trackedEntity.gevSelectionOrigin = origin;
layerState._trackedEntity.gevTrackedId = `satellites:${noradId}`;
layerState._trackedEntity.gevDisplayPosition = _trackedDisplayCached;
entityRecord(layerState._trackedEntity).selectionOrigin = origin;
entityRecord(layerState._trackedEntity).trackedId = `satellites:${noradId}`;
entityRecord(layerState._trackedEntity).displayPosition =
_trackedDisplayCached;
_updateTrackedSatelliteLabelModel(initialPos?.altitude ?? null);
_emitAwarenessEvent('gev:awareness-subject-selected', {