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

+7
View File
@@ -38,6 +38,7 @@ import * as Cesium from 'cesium';
import { isLeaseCurrent, isPointerFree } from '../data/inputOwnership.js';
import { acquireCameraInput } from '../render/cesium/cameraInput.js';
import { cesiumInputOf, createCesiumInput } from '../render/cesium/input.js';
import { drawHitOf } from '../render/cesium/drawHit.js';
import {
findPickOwner,
pickContact,
@@ -95,6 +96,9 @@ const dispatchers = new WeakMap();
* (corrected for sensor styles; see sensorPick.js).
* @property {ClickGesture} gesture
* @property {object|undefined} pick `scene.pick` at `position`.
* @property {import('../render/contract/query').Hit|null} drawHit `pick` as
* the contract's `Hit`, when it is an item of a renderer draw set; null
* for anything else. What layers on the draw port read a click by.
* @property {object|undefined} hit `pick`, or on a coarse pointer the first
* registered contact under a surface pick (`pickContact`).
* @property {string|null} id The hit's canonical pick id.
@@ -313,6 +317,9 @@ function createClickEvent(viewer, click, gesture) {
get pick() {
return once('pick', () => pickThroughFollowHelper(scene.pick(position)));
},
get drawHit() {
return once('drawHit', () => drawHitOf(this.pick));
},
get hit() {
return once('hit', () =>
pickContact(scene, position, {
+38
View File
@@ -82,6 +82,44 @@ test('a click on nothing is picked once, however its hit is read', (t) => {
assert.equal(h.calls.pick, 1);
});
test('a click on a draw-set item reads as its hit; anything else as none', (t) => {
let picked = {
id: { set: 'quakes:1', id: 'quake:a', meta: { mag: 5 } },
primitive: {},
};
const h = harness({ pick: () => picked });
t.after(() => h.input.destroy());
const seen = [];
h.input.onClick((event) => seen.push([event.drawHit, event.drawHit]));
h.click();
assert.equal(h.calls.pick, 1, 'one pick serves the hit');
assert.deepEqual(seen[0][0], {
set: 'quakes:1',
id: 'quake:a',
meta: { mag: 5 },
surface: false,
});
assert.equal(seen[0][0], seen[0][1], 'read once per click');
picked = { id: { set: 'quakes:1', id: 'quake:b', lodGroup: 'near' } };
h.click();
assert.deepEqual(seen.at(-1)[0], {
set: 'quakes:1',
id: 'quake:b',
lodGroup: 'near',
surface: false,
});
for (picked of [
{ id: 'plane-1' },
{ id: { id: 'entity' } },
{ id: { set: 'quakes:1', id: 7 } },
{ id: { set: null, id: 'quake:c' } },
undefined,
]) {
h.click();
assert.equal(seen.at(-1)[0], null);
}
});
test('a click nobody reads is never picked', (t) => {
const h = harness();
t.after(() => h.input.destroy());