Read the weather layers' camera and map centre through the renderer's ports

The weather layers listen for the camera's moveEnd through the camera port,
find the map centre through the query port's ellipsoid pick and the app's WGS84
helpers, and fly through the port's cameraOf. The shell rendering part, which
stays Cesium-bound, now defaults the Cesium namespace, provides the fallback
globe imagery host, and loads the adapter factories for a viewer with no
renderer bound.

The weather entry leaves the allow-list. It still reads the viewer's canvas
size for the centre pick.
This commit is contained in:
Sameh Khamis committed 2026-11-07 01:50:52 -08:00
1 parent 2061f5647c
commit b774bd84c8
5 files changed
+52 -39

No files matched your search

+17 -1
View File
@@ -1,8 +1,24 @@
import * as Cesium from 'cesium';
// The weather layers fly through `cameraOf`, drape through `findGlobe` and
// read `findCamera` and `findQuery`; this module is their Cesium side, so it
// brings the factories a viewer with no renderer bound gets those ports from.
import '../../render/cesium/camera.js';
import '../../render/cesium/globe.js';
import { acquireWeatherImage } from './infraredImage.js';
import { imageryHostStatus } from './imageryHost.js';
import { WEATHER_DETAIL_SIZE, WEATHER_IMAGE_SIZES } from './source.js';
import { msg } from '../../i18n/index.js';
/**
* The viewer's own globe imagery, as a weather imagery host: where a layer
* drapes when the application shell names no host of its own.
* @param {object|null|undefined} viewer A Cesium viewer.
* @returns {{collection: object|undefined, kind: 'globe'}}
*/
export function globeImageryHost(viewer) {
return { collection: viewer?.imageryLayers, kind: 'globe' };
}
/** Metres above the ellipsoid. Lower shells draw first, so lightning draws last. */
export const WEATHER_SHELL_HEIGHTS = Object.freeze({
wind: 5_000,
@@ -394,7 +410,7 @@ export function detailWindow(footprint, bounds, previous = null) {
* that area, so the two images share one mesh and never blend. */
export function createWeatherShell({
viewer,
cesium,
cesium = Cesium,
product,
height = WEATHER_SHELL_HEIGHTS[product],
getHost = () => ({ collection: null, kind: 'tileset' }),