Draw Street Level's marker and cones through the renderer's draw port

The photo marker and every provider's image cones are icon sets on the
draw port now, not billboard collections of their own. Each keeps its
pick id as the item id, so clicks route as before; each set is drawn
(empty) as soon as it is made, so the cones stay drawn over the marker
whichever is first given something to show. The horizon cull still runs
in the layer, against the ellipsoid lowered 1,000 m, and sends only the
items whose show changed; a quiet first cull of items about to be drawn
replaces the flags that held its callback back.

marker and sequenceCones leave the Cesium allow-list. The Panoramax line
click reads the camera height from the camera port.

A difference the contract does not let us avoid: the icons turn to their
bearing about local north (the contract's `course`), where the
billboards used the Earth's axis. Looking straight down nothing changes;
in a tilted view a cone now points along its true bearing on the ground
instead of leaning toward the pole.
This commit is contained in:
Sameh Khamis committed 2026-11-07 01:40:32 -08:00
1 parent a10f3a16e1
commit 40ad27fb95
14 files changed
+432 -233

No files matched your search

+27 -4
View File
@@ -1,6 +1,8 @@
/** Shared Street Level test stand-ins: provider snapshot and provider, Mapillary source, photo viewer, Cesium viewer, ray-casting camera. */
import * as Cesium from 'cesium';
import { bindFakeCesiumCamera } from './fakeCameraPort.mjs';
import { fakeDrawPort } from './fakeDrawPort.mjs';
import { bindRenderer } from '../render/rendererOf.js';
import { MAPILLARY_CREDIT_HTML } from '../layers/streetLevel/providers/mapillary/policy.js';
import {
latToTileY,
@@ -284,12 +286,16 @@ export function rayCamera({
* through what its `pickEllipsoid` hits), heights from its scene's
* `sampleHeight` (3D tiles: only while its globe is hidden) and its
* globe's `getHeight` (terrain), and pre-render from its scene's
* `preRender`. `draw` adds a draw port. For `bindFakeCesiumCamera`'s
* `ports`.
* `preRender`; drawing goes to `draw` (a fake draw port by default), and
* with `camera` the camera is `liveCamera`'s. For `bindFakeCesiumCamera`'s
* `ports`, or `bindRenderer`.
* @param {object} viewer
* @param {{draw?: object}} [options]
*/
export function streetPorts(viewer, { draw, camera = false } = {}) {
export function streetPorts(
viewer,
{ draw = fakeDrawPort(), camera = false } = {},
) {
const finite = (height) => (Number.isFinite(height) ? height : null);
const cartographic = ({ lon, lat }) => ({
longitude: lon * RAD,
@@ -328,11 +334,28 @@ export function streetPorts(viewer, { draw, camera = false } = {}) {
return event?.addEventListener?.(cb) ?? (() => {});
},
},
...(draw ? { draw } : {}),
draw,
...(camera ? { camera: liveCamera(viewer) } : {}),
};
}
/**
* Bind `viewer` (a Cesium-shaped double) to `streetPorts` with its live
* camera, as the app binds its renderer; `draw` is the draw port it draws
* through (a fake one by default). Returns the viewer.
* @template V
* @param {V} viewer
* @param {{draw?: object}} [options]
* @returns {V}
*/
export function bindStreetViewer(viewer, { draw } = {}) {
bindRenderer(
viewer,
streetPorts(viewer, { camera: true, ...(draw ? { draw } : {}) }),
);
return viewer;
}
/**
* A camera port over whatever camera double `viewer.camera` is when asked
* (tests swap it): its pose from `positionCartographic` and `positionWC`,