Draw tropical cyclones through the renderer's draw port

The cyclone layer no longer imports Cesium. Its advisories are three draw
sets per rendering (points, lines, cones) taken from drawOf(viewer): the
centers and forecast points are clamped dots culled past the horizon, the
tracks and cone outlines are draped lines, and the cones are clamped
polygons that keep their holes. Flights go through cameraOf, and the focus
sphere comes from a port of BoundingSphere.fromPoints in src/geo/sphere.js.

Clicks read the new ClickEvent.drawHit: the dispatcher's pick as the
contract's Hit when it is a draw-set item. The Cesium port's query uses the
same conversion, now in render/cesium/drawHit.js. pickStorm takes that hit
and accepts only current items of the layer's own sets.

Every advisory commit redraws the points, so an empty advisory clears them;
an unchanged selection draws nothing. Far-side tracks and cones are left
to the globe's depth instead of a per-frame occluder. Both cyclone files
leave the Cesium allow-list.
This commit is contained in:
Sameh Khamis committed 2026-11-06 19:15:09 -08:00
1 parent bb3106991e
commit bd5a688144
14 files changed
+818 -783

No files matched your search

+30
View File
@@ -0,0 +1,30 @@
import assert from 'node:assert/strict';
import * as Cesium from 'cesium';
import test from 'node:test';
import { fromDegrees } from './ellipsoid.js';
import { sphereFromPoints } from './sphere.js';
test('a sphere from points is the default renderer’s, to the bit', () => {
let seed = 7;
const random = () => (seed = (seed * 16807) % 2147483647) / 2147483647;
const cases = [
[],
[fromDegrees(10, 20)],
[fromDegrees(-125.8, 15.5), fromDegrees(-130, 18), fromDegrees(-135, 21)],
// Across the antimeridian, and a long track.
Array.from({ length: 40 }, (_, i) => fromDegrees(170 + i, -10 + i / 2)),
Array.from({ length: 200 }, () =>
fromDegrees(random() * 360 - 180, random() * 180 - 90, random() * 1e5),
),
];
for (const points of cases) {
const ours = sphereFromPoints(points);
const theirs = Cesium.BoundingSphere.fromPoints(
points.map((p) => new Cesium.Cartesian3(p.x, p.y, p.z)),
);
assert.deepEqual(
[ours.center.x, ours.center.y, ours.center.z, ours.radius],
[theirs.center.x, theirs.center.y, theirs.center.z, theirs.radius],
);
}
});