mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +00:00
Move the bikeshare layer onto the renderer's draw and camera ports
Station dots and the selected-station highlight are now two point draw sets, picked through the draw hit, and the layer follows the camera through the camera port at its own threshold instead of the shared percentageChanged ledger. Altitude and view centre come from the camera pose and view rectangle. All five bikeshare files leave the Cesium allow-list. The Cesium draw port now keeps a rebuilt host in its place in the scene instead of re-adding it on top, tags hosts with their set id so sprite order can raise a draw set (registerSpriteSet), and restyles unclamped points in place when they have not moved, so a status poll or selection no longer rebuilds every station. Other draw-port layers (cyclone markers, earthquake discs) now also keep their first-build slot rather than jumping above the sprite layers on each rebuild.
This commit is contained in:
1 parent
2b66c46a30
commit
8c6fa6258b
22 files changed
+732
-249
No files matched your search
@@ -1,5 +1,3 @@
|
||||
import * as Cesium from 'cesium';
|
||||
|
||||
export const BIKESHARE_SELECTED_OVERLAY_SOURCE_ID = 'bikeshare-selected';
|
||||
|
||||
export const BIKESHARE_SELECTED_OVERLAY_SOURCE_OPTIONS = Object.freeze({
|
||||
@@ -25,6 +23,13 @@ export const ACTIVATION_EXIT_ALTITUDE_M = ACTIVATION_ALTITUDE_M + 2000;
|
||||
|
||||
export const CAMERA_DEBOUNCE_MS = 340;
|
||||
|
||||
/**
|
||||
* How far the view moves before the camera tells the layer (the camera's
|
||||
* `changed` threshold): fine, so it notices entering a city's range.
|
||||
*/
|
||||
|
||||
export const CAMERA_CHANGED_THRESHOLD = 0.05;
|
||||
|
||||
/** Default radius (km) for determining whether a city is in camera range. */
|
||||
|
||||
export const CITY_RANGE_BASE_KM = 100;
|
||||
@@ -55,31 +60,74 @@ export const POINT_HEIGHT_OFFSET_M = 2.0;
|
||||
export const MAX_TOTAL_POINTS = 8000;
|
||||
|
||||
// --- Availability color palette ---
|
||||
// Renderer colours, `[r, g, b, a]` in 0..1: the CSS colours below at the
|
||||
// alphas the points draw them with.
|
||||
|
||||
/** A CSS `#rrggbb` colour at `alpha`, as a renderer colour. */
|
||||
const hex = (css, alpha) =>
|
||||
Object.freeze([
|
||||
parseInt(css.slice(1, 3), 16) / 255,
|
||||
parseInt(css.slice(3, 5), 16) / 255,
|
||||
parseInt(css.slice(5, 7), 16) / 255,
|
||||
alpha,
|
||||
]);
|
||||
|
||||
/** Station has >60% bikes available. */
|
||||
|
||||
export const COLOR_GREEN =
|
||||
Cesium.Color.fromCssColorString('#00ff88').withAlpha(0.95);
|
||||
export const COLOR_GREEN = hex('#00ff88', 0.95);
|
||||
|
||||
/** Station has 30-60% bikes available. */
|
||||
|
||||
export const COLOR_YELLOW =
|
||||
Cesium.Color.fromCssColorString('#ffaa00').withAlpha(0.94);
|
||||
export const COLOR_YELLOW = hex('#ffaa00', 0.94);
|
||||
|
||||
/** Station has <30% bikes available. */
|
||||
|
||||
export const COLOR_RED =
|
||||
Cesium.Color.fromCssColorString('#ff4444').withAlpha(0.94);
|
||||
export const COLOR_RED = hex('#ff4444', 0.94);
|
||||
|
||||
/** No status data available for station. */
|
||||
|
||||
export const COLOR_NEUTRAL =
|
||||
Cesium.Color.fromCssColorString('#91a4b4').withAlpha(0.62);
|
||||
export const COLOR_NEUTRAL = hex('#91a4b4', 0.62);
|
||||
|
||||
/** Station is offline (not installed, not renting, or not returning). */
|
||||
|
||||
export const COLOR_MUTED =
|
||||
Cesium.Color.fromCssColorString('#687581').withAlpha(0.48);
|
||||
export const COLOR_MUTED = hex('#687581', 0.48);
|
||||
|
||||
/** Outline color for all station points. */
|
||||
|
||||
export const COLOR_OUTLINE = Cesium.Color.BLACK.withAlpha(0.25);
|
||||
export const COLOR_OUTLINE = Object.freeze([0, 0, 0, 0.25]);
|
||||
|
||||
// --- Selected-station highlight ---
|
||||
|
||||
/** The selected station's dot: cyan, outlined black, drawn over everything. */
|
||||
|
||||
export const SELECTED_POINT_STYLE = Object.freeze({
|
||||
pixelSize: 14,
|
||||
color: Object.freeze([0, 1, 1, 1]),
|
||||
outlineColor: Object.freeze([0, 0, 0, 1]),
|
||||
outlineWidth: 2,
|
||||
disableDepthTest: Number.POSITIVE_INFINITY,
|
||||
});
|
||||
|
||||
// --- Station dot distance falloff ---
|
||||
|
||||
/** Station dots grow near the eye and shrink far from it. */
|
||||
|
||||
export const POINT_SCALE_BY_DISTANCE = Object.freeze({
|
||||
near: 200,
|
||||
nearValue: 1.35,
|
||||
far: 130000,
|
||||
farValue: 0.4,
|
||||
});
|
||||
|
||||
/** Station dots fade out with distance. */
|
||||
|
||||
export const POINT_FADE_BY_DISTANCE = Object.freeze({
|
||||
near: 200,
|
||||
nearValue: 1.0,
|
||||
far: 180000,
|
||||
farValue: 0.15,
|
||||
});
|
||||
|
||||
/** Station dots draw over the ground within this many metres of the eye. */
|
||||
|
||||
export const POINT_DISABLE_DEPTH_TEST_M = 2500;
|
||||
Reference in new issue
Block a user