mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-19 09:42:21 +00:00
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.
135 lines
4.1 KiB
JavaScript
135 lines
4.1 KiB
JavaScript
import { FIRMS_AMBIENT_COHORT_LIMIT } from '../../data/firmsLabels.js';
|
||
import { FRP_RAMP } from '../../data/firmsIntensity.js';
|
||
import { cssColor } from '../../render/color.js';
|
||
|
||
/** Client poll interval; the proxy's 30 min TTL is what guards upstream quota. */
|
||
|
||
export const REFRESH_INTERVAL_MS = 600_000;
|
||
|
||
/**
|
||
* LOD bands keyed by camera height. `heat` bands (above ~4,500 km) drape a
|
||
* Snap Map–style heatmap over the globe (firmsHeatRaster.js); their
|
||
* `gridDegrees` aggregation only feeds the "N FIRES" cards. `detections`
|
||
* bands render individual fire detections as glow-sprite icons.
|
||
* Labels in every band go through the shared screen-space greedy declutter
|
||
* (hard cap MAX_AMBIENT_LABELS) — there are no per-band label knobs.
|
||
*/
|
||
|
||
export const LOD_LEVELS = [
|
||
{
|
||
id: 'global',
|
||
minHeight: 9000000,
|
||
mode: 'heat',
|
||
gridDegrees: 2.0,
|
||
maxCells: 1800,
|
||
labelDistance: 12000000,
|
||
},
|
||
{
|
||
id: 'regional',
|
||
minHeight: 4500000,
|
||
mode: 'heat',
|
||
gridDegrees: 1.0,
|
||
maxCells: 3600,
|
||
labelDistance: 8500000,
|
||
},
|
||
{
|
||
// Up to 40,000 markers: at the 3,600 km end of the hand-off the padded
|
||
// view over Africa, the densest region, holds ~40,000 detections, and a
|
||
// tighter cap left the heatmap's weak spots dissolving into nothing.
|
||
// A rebuild of that many costs ~60 ms, only there.
|
||
id: 'local',
|
||
minHeight: 750000,
|
||
mode: 'detections',
|
||
maxDetections: 40000,
|
||
labelDistance: 4500000,
|
||
},
|
||
{
|
||
id: 'close',
|
||
minHeight: 0,
|
||
mode: 'detections',
|
||
maxDetections: 3000,
|
||
labelDistance: 1800000,
|
||
},
|
||
];
|
||
|
||
/**
|
||
* Global heat raster for the `heat` bands: ≈0.09° (≈10 km) per pixel and a
|
||
* one-pixel Gaussian σ, so a lone fire is a spot about the size of its
|
||
* marker near the hand-off and the two cross-fade without a jump;
|
||
* neighbours merge only when they nearly touch (σ 3 on a 2048 grid smeared
|
||
* each fire over ~200 km). Built once per data refresh or filter change,
|
||
* never per camera move.
|
||
*/
|
||
|
||
export const HEAT_RASTER = Object.freeze({
|
||
width: 4096,
|
||
height: 2048,
|
||
sigmaPx: 1,
|
||
});
|
||
|
||
/**
|
||
* Camera heights, in metres, over which the heatmap and the markers
|
||
* cross-fade around the 4,500 km band edge: markers alone below `from`,
|
||
* heatmap alone above `to`. Wider than the ±10 % band hysteresis, so
|
||
* whichever band is active inside it, both layers are already built.
|
||
*/
|
||
|
||
export const HANDOFF_FADE = Object.freeze({ from: 3_600_000, to: 5_400_000 });
|
||
|
||
/**
|
||
* Trailing delay before a stale heatmap is rebuilt while one is already on
|
||
* screen: a slider drag fires many filter changes, and a build plus PNG
|
||
* encode costs a few hundred milliseconds. The first paint is immediate.
|
||
*/
|
||
|
||
export const HEAT_REBUILD_MS = 150;
|
||
|
||
export const LOD_CHECK_MS = 650;
|
||
|
||
/** +/-10% hysteresis on LOD band edges so slow zooms don't thrash rebuilds. */
|
||
|
||
export const LOD_HYSTERESIS = 0.1;
|
||
|
||
/** Padding fraction applied to the camera view rectangle before clipping. */
|
||
|
||
export const VIEW_PADDING = 0.3;
|
||
|
||
/** Number of top-FRP detections registered in the shared context store. */
|
||
|
||
export const CONTEXT_TOP_N = 50;
|
||
|
||
/** Hard cap on ambient (non-selected) labels, regardless of zoom/density. */
|
||
|
||
export const MAX_AMBIENT_LABELS = FIRMS_AMBIENT_COHORT_LIMIT;
|
||
|
||
/** Min screen-space separation between accepted labels, in CSS pixels. */
|
||
|
||
export const LABEL_MIN_SEP_PX = 150;
|
||
|
||
/** Candidates projecting outside the canvas by more than this are skipped. */
|
||
|
||
export const LABEL_VIEW_MARGIN_PX = 16;
|
||
|
||
/**
|
||
* Glow sprites are rasterised once per colour at the largest core size
|
||
* (frpPixelSize tops out at 28 px, a 56 px sprite) and drawn smaller per fire:
|
||
* the gradient stops are relative, so the glow keeps its shape at any size.
|
||
*/
|
||
|
||
export const GLOW_SPRITE_PX = 56;
|
||
|
||
/**
|
||
* Color stops for detection glow sprites and card accents: the
|
||
* six-stop ember → white-hot FRP ramp (firmsIntensity.js), weakest first, as
|
||
* renderer colours `[r, g, b, a]`. Stop names key the glow-sprite cache and
|
||
* the card accents.
|
||
*/
|
||
|
||
export const DETECTION_COLOR_STOPS = FRP_RAMP.map((stop) =>
|
||
Object.freeze({
|
||
name: stop.name,
|
||
minFrp: stop.minFrp,
|
||
color: Object.freeze(cssColor(stop.hex)),
|
||
}),
|
||
);
|