Keep the satellites layer's Cesium objects in its rendering part

The point collection and its dots, the baked orbit rings, the tracked
entity, the frame number, the focus publish and the pick decoding now
live in rendering.js, behind small helpers that take ECEF positions and
render-contract colours. The catalog, controls, ingestion, lifecycle,
orbits, policy, records, state, testing and tracking parts no longer
import Cesium or touch the viewer, scene or primitives, and leave the
allow-list. Point styles are [r, g, b, a] colours, converted once per
style; geodetic conversions use the geo helpers; the per-frame tick runs
through the frame port. What the layer draws and how it follows is
unchanged.
This commit is contained in:
Sameh Khamis committed 2026-11-07 03:53:05 -08:00
1 parent d928c30337
commit 4fd1a850f1
19 files changed
+646 -281

No files matched your search

+12 -26
View File
@@ -1,6 +1,6 @@
import { twoline2satrec } from 'satellite.js';
import * as Cesium from 'cesium';
import { msg } from '../../i18n/index.js';
import { fromDegrees } from '../../geo/ellipsoid.js';
import { noradIdFromSatnum, tleLineLaunchYear } from '../../sources/tle.js';
import { CATALOG_GROUPS, ISS_NORAD, POINT_STYLES } from './policy.js';
@@ -84,11 +84,8 @@ export function createIngestion({
: null;
// Clear existing
layerState._pointCollection.removeAll();
layerState._points.clear();
for (const path of layerState._orbitPaths.values())
viewer.scene.primitives.remove(path.primitive);
layerState._orbitPaths.clear();
parts.rendering._clearPoints();
parts.rendering._clearOrbitPaths(viewer);
layerState._catalog.clear();
// The detection overlay caches one record per satellite and stamps its
// id/class at creation only. A rebuild can re-tag a satellite (a failed
@@ -139,32 +136,21 @@ export function createIngestion({
const pos = parts.orbits.propagatePosition(satrec, now);
if (!pos) continue;
const cartesian = Cesium.Cartesian3.fromDegrees(
pos.longitude,
pos.latitude,
pos.altitude,
// Add its dot (styling from the shared table, WS-D3)
parts.rendering._addPoint(
noradId,
fromDegrees(pos.longitude, pos.latitude, pos.altitude),
parts.controls._pointStyleFor(noradId, entry.group),
);
// Add point primitive (styling from the shared table, WS-D3)
const style = parts.controls._pointStyleFor(noradId, entry.group);
const point = layerState._pointCollection.add({
position: cartesian,
pixelSize: style.pixelSize,
color: style.color,
outlineColor: style.outlineColor,
outlineWidth: style.outlineWidth,
scaleByDistance: new Cesium.NearFarScalar(1e6, 1.5, 2e7, 0.6),
id: noradId,
});
layerState._points.set(noradId, point);
}
// Show ISS orbital path by default
if (layerState._catalog.has(ISS_NORAD)) {
parts.rendering._showOrbitPath(ISS_NORAD, POINT_STYLES.iss.color);
const issPath = layerState._orbitPaths.get(ISS_NORAD);
if (issPath) issPath.primitive.show = layerState._params.showOrbits;
parts.rendering._setOrbitPathShown(
ISS_NORAD,
layerState._params.showOrbits,
);
parts.labels._syncIssOverlay();
}