mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 16:22:20 +00:00
Wind (NOAA GFS and ECMWF IFS: animated particles, colour field, a reading at map centre), observed weather (NOAA MRMS radar, GOES and NESDIS infrared clouds, lightning density) on one shared history timeline, NHC and CPHC cyclone advisories with tracks and cones, and a WEATHER panel in the right rail. On 3D Tiles the observed products render as raised shells with a sharper window around the view. Co-authored-by: Gustavo Beneduzi <[email protected]> Co-authored-by: Daniel Slay <[email protected]> Co-authored-by: Rehaan Delmotra <[email protected]> Co-authored-by: Cursor Agent <[email protected]>
51 lines
1.3 KiB
JavaScript
51 lines
1.3 KiB
JavaScript
/** Tile a bounded decoded canvas without network requests or scene state. */
|
|
export function createRasterTileProvider({
|
|
cesium,
|
|
texture,
|
|
credit,
|
|
createCanvas,
|
|
rectangle = cesium.Rectangle.MAX_VALUE,
|
|
tilingScheme = new cesium.GeographicTilingScheme({ rectangle }),
|
|
maximumLevel = 2,
|
|
tileSize = 256,
|
|
}) {
|
|
return {
|
|
tilingScheme,
|
|
rectangle,
|
|
tileWidth: tileSize,
|
|
tileHeight: tileSize,
|
|
minimumLevel: 0,
|
|
maximumLevel,
|
|
ready: true,
|
|
tileDiscardPolicy: undefined,
|
|
credit,
|
|
errorEvent: new cesium.Event(),
|
|
hasAlphaChannel: true,
|
|
getTileCredits: () => undefined,
|
|
pickFeatures: () => undefined,
|
|
requestImage(x, y, level) {
|
|
const tile = createCanvas();
|
|
tile.width = tile.height = tileSize;
|
|
const ctx = tile.getContext('2d');
|
|
const width =
|
|
texture.width / tilingScheme.getNumberOfXTilesAtLevel(level);
|
|
const height =
|
|
texture.height / tilingScheme.getNumberOfYTilesAtLevel(level);
|
|
ctx.imageSmoothingEnabled = true;
|
|
ctx.drawImage(
|
|
texture,
|
|
x * width,
|
|
y * height,
|
|
width,
|
|
height,
|
|
0,
|
|
0,
|
|
tileSize,
|
|
tileSize,
|
|
);
|
|
// ImageryLayer consumes requestImage results as promises.
|
|
return Promise.resolve(tile);
|
|
},
|
|
};
|
|
}
|