Merge main through #1556 into the renderer seam

Brings in fire intensity and the draped heatmap (#1426), provider labels
(#1521), Rio transit (#1481), chat autocomplete and provider switching
(#1561, #1546) and Cockpit entry by the ridden layer alone (#1556).

What main added that reached Cesium or the viewer:
- The fires heatmap drapes as one image through the globe port's imagery
  (heatImagery.js), above the port's other imagery, and drapes again when
  the map stack's surface changes. The far bands no longer draw heat
  rectangles; the layer's shape set stays as its initialized marker and
  the visibility the context store reads.
- The hand-off between heatmap and markers fades the glow icons' own
  alpha and the icon set's visibility. Markers keep their glows across
  rebuilds; the set culls the horizon itself.
- A double-click on the followed track enters the Cockpit through the
  input dispatcher. The renderer's own double-click follow would let go
  of the track first and cannot be refused from a subscriber, so a press
  on the followed track holds that behaviour off for the press.
- Cockpit entry and the ridden layer read the follow service; the camera
  takes its eye offsets from a profile.
This commit is contained in:
Sameh Khamis committed 2026-11-09 20:52:52 -08:00
commit 823b5dc301
119 files changed
+5782 -577

No files matched your search

+112
View File
@@ -0,0 +1,112 @@
/**
* Drapes the Active Fires heat raster over the globe as one full-extent
* image on the renderer's imagery (`globe.imagery`, the globe port), like
* the wind layer's scalar field. It drapes on whatever the map stack draws
* (the globe's surface, or the 3D tiles). Owns the canvas and the imagery
* layer; nothing else in the fires layer touches imagery.
*
* `show` is only for the layer being on or off. The zoom hand-off fades
* `alpha` instead: a renderer may unmap a hidden imagery layer from the
* surface and re-map it when shown, so a show toggle at the band edge left
* a beat with neither markers nor heat. At alpha 0 the layer stays mapped
* and costs no draw.
*/
const WORLD = Object.freeze({ west: -180, south: -90, east: 180, north: 90 });
/**
* Drawn over the port's other imagery, the weather layers included
* (`WEATHER_IMAGERY_Z` tops out at 4): each drape went to the top of the
* stack.
*/
export const HEAT_IMAGERY_Z = 5;
const defaultCanvas = (width, height) => {
const canvas = document.createElement('canvas');
canvas.width = width;
canvas.height = height;
return canvas;
};
/**
* @param {object} options
* @param {() => {globe: object|null, kind: string}|null} options.getHost
* Where draped imagery goes now: the renderer's globe port, and the kind
* of surface the active map stack drapes on (`'none'`: nothing to drape
* on, so nothing is draped).
* @param {(width: number, height: number) => object} [options.createCanvas]
*/
export function createHeatImagery({ getHost, createCanvas = defaultCanvas }) {
let raster = null;
let layer = null;
/** The host the layer is draped on: its globe port and kind. */
let globe = null;
let kind = 'none';
let show = true;
let opacity = 1;
const hostNow = () => {
const host = getHost?.();
return host?.globe && host.kind !== 'none'
? host
: { globe: null, kind: 'none' };
};
function detach() {
layer?.remove();
layer = null;
globe = null;
kind = 'none';
}
function attach() {
detach();
if (!raster) return;
const host = hostNow();
if (!host.globe) return;
const canvas = createCanvas(raster.width, raster.height);
const ctx = canvas.getContext('2d');
const image = ctx.createImageData(raster.width, raster.height);
image.data.set(raster.rgba);
ctx.putImageData(image, 0, 0);
layer = host.globe.imagery.add({
kind: 'single-image',
url: canvas.toDataURL('image/png'),
rectangle: WORLD,
zOrder: HEAT_IMAGERY_Z,
});
globe = host.globe;
kind = host.kind;
layer.show = show;
layer.alpha = opacity;
}
return {
setRaster(next) {
raster = next;
attach();
},
/** True once a raster was handed over (painted or waiting for a host). */
hasRaster() {
return raster !== null;
},
setShow(value) {
show = Boolean(value);
if (layer) layer.show = show;
},
/** Hand-off fade, 0..1; the layer stays mapped at 0. */
setOpacity(value) {
opacity = Math.min(1, Math.max(0, Number(value) || 0));
if (layer) layer.alpha = opacity;
},
/** Drape again when the map stack's surface has changed. */
rehome() {
const host = hostNow();
if (host.globe !== globe || host.kind !== kind) attach();
},
destroy() {
detach();
raster = null;
},
};
}