Draw the installations layer through the renderer ports

The site dots, outlines and selected footprint fill are now draw-port sets
(points, draped lines, clamped shapes) instead of Cesium entities. The
selected site's dot is drawn by a set of its own, so selecting a site
redraws no other dot. Selection is registered through plain carrier
objects in the context store, as the local GeoJSON layer does, and the
tracked card reads the site's label and position from the carrier's entity
record.

A double-click on a site dot now follows it through camera.follow (gated on
the stock double-click follow), centred on the surface under the dot when
its height is loaded; one on an outline or fill zooms to it. Hiding the
layer stops a follow it started. The layer no longer lowers the shared
camera change sensitivity: its own camera-port listener carries its
threshold.

The follow offset fitting moves to src/geo/frames.js and is shared with
the local GeoJSON layer. rendering.js leaves the Cesium allow-list
(33 -> 32); the layer's entry joins DRAW_FROM_CALLER.
This commit is contained in:
Sameh Khamis committed 2026-11-08 12:13:29 -08:00
1 parent a59f9b10b2
commit 1bff078097
21 files changed
+864 -337

No files matched your search

+38 -30
View File
@@ -177,18 +177,13 @@ export async function checkInstallationSelection(
await import('/src/data/contextStore.js');
const { getOverlayPaintRect, getWorldOverlayDiagnostics } =
await import('/src/overlays/worldOverlay.js');
const knownFills = new Set();
const fillEntities = () => {
const list = [];
for (let i = 0; i < g.viewer.dataSources.length; i++)
for (const e of g.viewer.dataSources.get(i).entities.values)
if (e.id.startsWith(`${record.id}:selected-fill:`)) list.push(e);
for (const e of list) knownFills.add(e);
return list;
};
// Geometry-instance ids prove the ground primitive actually built, not just an entity declaration.
const primitives = () => {
let count = 0;
// The selected site's fill parts, as the ground primitives built for
// the layer's fill set hold them: each instance's id is the
// draw port's pick id `{set, id}`. Only built, shown instances count,
// so this proves the ground primitive actually built, not just an
// item declaration.
const fillParts = () => {
const parts = [];
const walk = (collection) => {
if (collection?._collectionsArray) {
for (const child of collection._collectionsArray) walk(child);
@@ -196,31 +191,44 @@ export async function checkInstallationSelection(
}
for (let i = 0; i < (collection?.length || 0); i++) {
const p = collection.get(i);
if (
p.ready &&
typeof p.getGeometryInstanceAttributes === 'function'
) {
for (const e of knownFills) {
const ids = p?._primitive?._primitive?._instanceIds;
if (p?.ready && Array.isArray(ids))
for (const id of ids) {
if (
!/^military-installations:\d+:fills$/.test(id?.set) ||
!String(id.id).startsWith(`${record.id}:selected-fill:`)
)
continue;
try {
const a = p.getGeometryInstanceAttributes(e);
if (a && (!a.show || a.show[0])) count++;
const a = p.getGeometryInstanceAttributes(id);
if (a && (!a.show || a.show[0]))
parts.push({
id: id.id,
classification: p.classificationType,
});
} catch {}
}
}
if (typeof p.get === 'function' || p._collectionsArray) walk(p);
if (typeof p?.get === 'function' || p?._collectionsArray)
walk(p);
}
};
// The draw port adds its ground primitives under the scene's
// primitives, in its set's collection.
walk(g.viewer.scene.groundPrimitives);
return count;
walk(g.viewer.scene.primitives);
return parts;
};
window.__polishFillProbe = () => {
const parts = fillParts();
return {
// Distinct fill parts drawn, and the built instances drawing them
// (a ground swap can draw a part twice while it lasts).
entities: new Set(parts.map((part) => part.id)).size,
primitives: parts.length,
classification: parts.map((part) => part.classification),
selected: getSelectedEntityContext()?.id || null,
};
};
window.__polishFillProbe = () => ({
entities: fillEntities().length,
primitives: primitives(),
classification: fillEntities().map((e) =>
e.polygon.classificationType.getValue(),
),
selected: getSelectedEntityContext()?.id || null,
});
window.__stopPolishSelection =
g.viewer.scene.postRender.addEventListener(() => {
window.__polishSelectionFrames.push({