mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-21 10:42:22 +00:00
Run the Navara paths without the Cesium SDK, and load it on demand for the features that still build on it
Every Cesium read that a Navara page made was surveyed with the strict acceptance (GEV_QA_CESIUM_TRAP=record). Math on those paths now uses src/geo: screen annotations, weather and wind center readings, cyclone picks, scene data pack polygons and images (new navaraGeometry.js), the awareness subject, the orbit offset of camera verbs, voice frame_overhead, the agent world packet and Directions colours and ground picks. The celestial ring's Sun and Moon come from a bit-identical port of Cesium's Simon1994 model, JulianDate and TEME rotation (src/geo/simon1994.js, julianDate.js, transforms.js); a Cesium globe still applies its ICRF rotation once loaded. Traffic, Street Level, the Nepal event and locator and geo import build on Cesium's math or entity model on either globe; their enable (or the import) now loads the SDK first through src/app/loadCesium.js, synchronously when it is already there. A production page guards the global so a missed read is reported and starts the load. No module reads Cesium while it loads (scripts/check-cesium-load-time.mjs, run by npm test). Cesium.js is still loaded by index.html here.
This commit is contained in:
1 parent
f87da8523e
commit
b8305de14b
58 files changed
+2130
-325
No files matched your search
@@ -1,4 +1,5 @@
|
||||
import * as Cesium from 'cesium';
|
||||
import { cesiumSdkReady, loadCesiumSdk } from '../app/loadCesium.js';
|
||||
import {
|
||||
clearOverlaySource,
|
||||
setOverlayEntries,
|
||||
@@ -144,10 +145,10 @@ const NEARBY_CITIES = Object.freeze([
|
||||
placement: 'right-lower',
|
||||
}),
|
||||
]);
|
||||
const BORDER_COLOR = Cesium.Color.fromCssColorString('#20e7f2');
|
||||
const BORDER_COLOR = () => Cesium.Color.fromCssColorString('#20e7f2');
|
||||
const BORDER_ACCENT = '#20e7f2';
|
||||
const INCIDENT_ACCENT = '#ffad55';
|
||||
const INCIDENT_COLOR = Cesium.Color.fromCssColorString(INCIDENT_ACCENT);
|
||||
const INCIDENT_COLOR = () => Cesium.Color.fromCssColorString(INCIDENT_ACCENT);
|
||||
|
||||
const DEFAULT_OVERLAY_HOST = Object.freeze({
|
||||
setEntries: setOverlayEntries,
|
||||
@@ -521,7 +522,7 @@ export function createBhoteKoshiLocatorLayer({
|
||||
sequenceStartedAt,
|
||||
visibleAfterMs = 0,
|
||||
) {
|
||||
addCallout(dataSource, INCIDENT, INCIDENT_COLOR, {
|
||||
addCallout(dataSource, INCIDENT, INCIDENT_COLOR(), {
|
||||
sequenceStartedAt,
|
||||
visibleAfterMs,
|
||||
});
|
||||
@@ -555,12 +556,12 @@ export function createBhoteKoshiLocatorLayer({
|
||||
false,
|
||||
),
|
||||
color: new Cesium.CallbackProperty((_time, result) => {
|
||||
const color = Cesium.Color.clone(INCIDENT_COLOR, result);
|
||||
const color = Cesium.Color.clone(INCIDENT_COLOR(), result);
|
||||
color.alpha = 0.16 * (1 - pulseProgress());
|
||||
return color;
|
||||
}, false),
|
||||
outlineColor: new Cesium.CallbackProperty((_time, result) => {
|
||||
const color = Cesium.Color.clone(INCIDENT_COLOR, result);
|
||||
const color = Cesium.Color.clone(INCIDENT_COLOR(), result);
|
||||
color.alpha = isVisible() ? 0.08 + 0.78 * (1 - pulseProgress()) : 0;
|
||||
return color;
|
||||
}, false),
|
||||
@@ -705,7 +706,7 @@ export function createBhoteKoshiLocatorLayer({
|
||||
labelPlacement = 'right',
|
||||
{ showAnchor = true } = {},
|
||||
) {
|
||||
addCallout(dataSource, NEPAL, BORDER_COLOR, {
|
||||
addCallout(dataSource, NEPAL, BORDER_COLOR(), {
|
||||
labelPlacement,
|
||||
sequenceStartedAt,
|
||||
showAnchor,
|
||||
@@ -820,12 +821,12 @@ export function createBhoteKoshiLocatorLayer({
|
||||
false,
|
||||
),
|
||||
color: new Cesium.CallbackProperty((_time, result) => {
|
||||
const color = Cesium.Color.clone(INCIDENT_COLOR, result);
|
||||
const color = Cesium.Color.clone(INCIDENT_COLOR(), result);
|
||||
color.alpha = 0.16 * (1 - pulseProgress());
|
||||
return color;
|
||||
}, false),
|
||||
outlineColor: new Cesium.CallbackProperty((_time, result) => {
|
||||
const color = Cesium.Color.clone(INCIDENT_COLOR, result);
|
||||
const color = Cesium.Color.clone(INCIDENT_COLOR(), result);
|
||||
color.alpha = 0.08 + 0.78 * (1 - pulseProgress());
|
||||
return color;
|
||||
}, false),
|
||||
@@ -890,7 +891,7 @@ export function createBhoteKoshiLocatorLayer({
|
||||
positions: animatedPositions,
|
||||
width: 3.5,
|
||||
clampToGround: true,
|
||||
material: BORDER_COLOR.withAlpha(0.96),
|
||||
material: BORDER_COLOR().withAlpha(0.96),
|
||||
classificationType: Cesium.ClassificationType.BOTH,
|
||||
},
|
||||
});
|
||||
@@ -915,7 +916,7 @@ export function createBhoteKoshiLocatorLayer({
|
||||
show: new Cesium.CallbackProperty(() => now() >= drawStartedAt, false),
|
||||
polygon: {
|
||||
hierarchy,
|
||||
material: BORDER_COLOR.withAlpha(0.055),
|
||||
material: BORDER_COLOR().withAlpha(0.055),
|
||||
classificationType: Cesium.ClassificationType.BOTH,
|
||||
},
|
||||
});
|
||||
@@ -925,7 +926,7 @@ export function createBhoteKoshiLocatorLayer({
|
||||
positions: animatedPositions,
|
||||
width: 5,
|
||||
clampToGround: true,
|
||||
material: BORDER_COLOR.withAlpha(0.12),
|
||||
material: BORDER_COLOR().withAlpha(0.12),
|
||||
classificationType: Cesium.ClassificationType.BOTH,
|
||||
},
|
||||
});
|
||||
@@ -935,7 +936,7 @@ export function createBhoteKoshiLocatorLayer({
|
||||
positions: animatedPositions,
|
||||
width: 2.5,
|
||||
clampToGround: true,
|
||||
material: BORDER_COLOR.withAlpha(0.96),
|
||||
material: BORDER_COLOR().withAlpha(0.96),
|
||||
classificationType: Cesium.ClassificationType.BOTH,
|
||||
},
|
||||
});
|
||||
@@ -1084,6 +1085,12 @@ export function createBhoteKoshiLocatorLayer({
|
||||
}
|
||||
|
||||
async function enable(viewer, { signal } = {}) {
|
||||
// The callouts and flood path are Cesium entities on either globe, so a
|
||||
// Navara page loads the Cesium SDK for them first.
|
||||
if (!cesiumSdkReady()) {
|
||||
await loadCesiumSdk();
|
||||
if (signal?.aborted) throw abortError();
|
||||
}
|
||||
_viewer = viewer;
|
||||
_enabled = true;
|
||||
_boundaryReady = false;
|
||||
|
||||
Reference in new issue
Block a user