feat(weather): a host can supply decoded frames to the weather layers

A weather feed may also be a frame source. With an optional
getFrameImage({ product, time, size, bbox, signal }) the layers take
whole-extent images, detail windows and the global mosaic from it; with an
optional getFrameTile({ product, time, z, x, y, size, signal }) regional
tiles and their prefetch come from it, null being a transparent tile. Pixels
may be an ImageBitmap, ImageData, canvas or VideoFrame of exactly the
requested size; the layer draws them once and closes them. Cancellation
reaches the source, and a feed without these methods reads the image and
tile routes as before.
This commit is contained in:
Sameh Khamis committed 2026-11-10 21:54:08 -08:00
1 parent aff5ce7f17
commit e18353f769
12 files changed
+1068 -31

No files matched your search

+3
View File
@@ -1,5 +1,6 @@
import * as Cesium from 'cesium';
import { createWeatherRendering } from './rendering.js';
import { weatherFrameSource } from './source.js';
import { imageryHostStatus } from './imageryHost.js';
import { weatherDisplay, insideExtent } from './display.js';
import {
@@ -66,6 +67,7 @@ export function createWeatherLayer({
} = {}) {
if (typeof feed?.getSnapshot !== 'function')
throw new TypeError('Weather requires a snapshot source');
// A feed may also supply decoded frames; see weatherFrameSource.
const radar = id === 'weather-radar';
const lightning = id === 'weather-lightning';
const satellite = !radar && !lightning;
@@ -288,6 +290,7 @@ export function createWeatherLayer({
cesium,
getHost,
onChange: notify,
frameSource: weatherFrameSource(feed),
});
checkHost(false);
eventTarget?.addEventListener?.(