Keep installation and local GeoJSON pick state off Cesium entities

Installation selection fills and outlines record the installation they
belong to in the layer's installationMarkers store instead of an
installationId expando, and the click handler resolves them from there.
Named-marker points keep their { installationId } pick payload, which is
the app's own object, so sibling layers treat a point click as before; the
marker remembers its record id for visit() instead of reading the point.

The local GeoJSON package tracks the entities each layer loaded in a
per-instance set instead of a __localLayerId tag, and passes the stem
base to registerEntityContext as targetPosition instead of hanging it on
the entity; FIRMS does the same, and voice targeting reads the context
record. QA scripts find a layer's features by their context id.
This commit is contained in:
Sameh Khamis committed 2026-11-03 14:57:31 -08:00
1 parent 0889cd0cb7
commit 08985d5083
13 files changed
+58 -28

No files matched your search

+8 -7
View File
@@ -327,6 +327,8 @@ export function createLocalGeoJsonLayer(
},
) {
let _dataSource = null;
// The entities this layer loaded, so its click and teardown recognise them.
const _ownEntities = new WeakSet();
let _enabled = false;
let _clickHandler = null;
let _count = 0;
@@ -464,7 +466,7 @@ export function createLocalGeoJsonLayer(
releaseDataSource(viewer);
_overlayPublisher.hide();
clearSelectedEntityContextForLayer(id);
if (viewer?.selectedEntity?.__localLayerId === id) {
if (_ownEntities.has(viewer?.selectedEntity)) {
viewer.selectedEntity = undefined;
}
if (_preRenderRemover) {
@@ -641,7 +643,7 @@ export function createLocalGeoJsonLayer(
for (let i = 0; i < entities.length; i++) {
const feature = entities[i];
feature.__localLayerId = id; // Tag it so our click handler knows it belongs to this layer
_ownEntities.add(feature);
let pos = feature.position?.getValue(Cesium.JulianDate.now());
@@ -686,9 +688,6 @@ export function createLocalGeoJsonLayer(
const properties = propertyObject(feature);
const recordId = String(feature.id ?? i);
// Store references for bounded stem scaling and native picking.
feature.__localBaseCarto = carto;
feature.__localBaseCartesian = base;
registerEntityContext(feature, {
id: `${id}:${recordId}`,
layerId: id,
@@ -703,6 +702,9 @@ export function createLocalGeoJsonLayer(
longitude: Number(
Cesium.Math.toDegrees(carto.longitude).toFixed(6),
),
// The surface base voice targeting projects. Ground sampling
// re-grounds it in place, so this stays current.
targetPosition: base,
});
// Constant properties are refreshed on the existing 450 ms source
@@ -792,7 +794,7 @@ export function createLocalGeoJsonLayer(
if (!_enabled) return;
const picked = viewer.scene.pick(click.position);
if (picked && picked.id && picked.id.__localLayerId === id) {
if (picked && _ownEntities.has(picked.id)) {
const entity = picked.id;
viewer.selectedEntity = entity;
selectEntityContext(entity);
@@ -1174,7 +1176,6 @@ function setLocalGroundHeight(record, height) {
Cesium.Ellipsoid.WGS84,
record.base,
);
record.entity.__localBaseCartesian = record.base;
}
function updateLocalStemGeometry(viewer, record, now, knownDistance = null) {