diff --git a/DATA_SOURCES.md b/DATA_SOURCES.md index 613a1d918..3fff9e557 100644 --- a/DATA_SOURCES.md +++ b/DATA_SOURCES.md @@ -31,7 +31,7 @@ How to read this: | **adsb.lol** | Military flights + aircraft traces | ODbL 1.0 | "adsb.lol" (ODbL) | | **adsbdb** (`api.adsbdb.com`) | Aircraft type, model name and registration by ICAO hex for enriched flights; airline and origin/destination airports for the tracked flight's callsign | No licence or rate limit is published for the service. Its own credits: aircraft data from PlaneBase, ICAO-to-N-number conversion by Guillaume Michel, and flight route data that "is the work of David Taylor, Edinburgh and Jim Mason, Glasgow, and may not be copied, published, or incorporated into other databases without the explicit permission of David J Taylor, Edinburgh" | "adsbdb — api.adsbdb.com" (courtesy); route data credited to David Taylor, Edinburgh, and Jim Mason, Glasgow | | **AISStream.io** | Live vessels (AIS) | Free, beta, no formal ToS; AIS is a public broadcast | "AISStream.io" (courtesy) | -| **CelesTrak** | Satellite TLEs (SGP4) | US-government-origin data, no license; citation requested | "CelesTrak (celestrak.org), Dr. T.S. Kelso" | +| **CelesTrak** | Satellite TLEs (SGP4) and SATCAT records (object type, operational status, owner) that file each satellite under a class | US-government-origin data, no license; citation requested | "CelesTrak (celestrak.org), Dr. T.S. Kelso" | | **The Space Devs — Launch Library 2 v2.3** | Recent launch, payload, stage, and recovery metadata for Space Missions (30d) | [The Space Devs terms of use](https://github.com/TheSpaceDevs/Tutorials/blob/main/faqs/faq_TSD.md#terms-of-use): data may be used and shared in any form; avoid forwarding it without added value; attribution is encouraged (not mandatory). [Official API limits](https://ll.thespacedevs.com/docs/): 15 unauthenticated calls/hour; optional token | "Launch Library 2 — The Space Devs" (courtesy attribution) | | **Esri World Imagery** (ArcGIS Online tile service) | The keyless satellite basemap — the default landing when no Google/ion credential is configured, and the "Esri Satellite" map stack | [Esri Master Agreement](https://www.esri.com/en-us/legal/terms/full-master-agreement): the public World Imagery service is usable in public-facing apps with attribution; no key is required for this classic endpoint, but Esri governs and can change access — an app at scale should review current ArcGIS Location Platform terms | "Powered by Esri — Source: Esri, Maxar, Earthstar Geographics, and the GIS User Community" (provider carries the service's own credit line) | | **USGS** | Earthquakes | U.S. public domain | "Data courtesy of the U.S. Geological Survey" | @@ -229,9 +229,12 @@ The [Bhote Koshi event pack](public/events/bhote-koshi-2026/README.md), under `p | **Québec CCTV source catalog** (1,120 locations) | `public/quebec-cameras.json` | Mixed: MTQ locations CC BY 4.0; Montréal camera nodes ODbL 1.0; scenic records retain per-record provenance. No video files are bundled or cached. | Location data is per-record; video remains hosted by Québec 511 and its platform terms apply; scenic source pages may have separate terms | MTQ / Données Québec CC BY 4.0; © OpenStreetMap contributors (ODbL); scenic operator and position source shown in the selected-camera panel | | **World camera image subset** (2,230 locations) | `config/cctv_sources.world-image-cameras.json` | Mixed: ODOT TripCheck public images (ODOT permits use with credit) and MLIT site content under terms compatible with CC BY 4.0. Frames are not bundled or persisted; the server holds a bounded in-memory cache. | Per-source terms apply; NZTA Journey Planner web-cache rows are excluded; Vegagerðin rows are served by the Iceland pack instead | Oregon Department of Transportation (Camera courtesy of ODOT) and Japan Ministry of Land, Infrastructure, Transport and Tourism (出典:国土交通省 川の防災情報) | | **TeleGeography Submarine Cable Map** (712 cables + 1,917 landing points) | `telegeography_submarine_cables/` | **CC BY-NC-SA 3.0** | ❌ **NonCommercial — remove for commercial use** | "© TeleGeography — submarinecablemap.com" | +| **UCS Satellite Database** UCS-Satellite-Database 5-1-2023 (3,564 records; operator, owner country, purpose) | `ucs_satellites/` | **Free, unrestricted use** (UCS database manual, section 3) | ✅ (acknowledgement requested) | "UCS Satellite Database (UCS-Satellite-Database 5-1-2023), https://www.ucsusa.org/satellite_database" | +| **Imaging sensor pack** (46 Earth-observation platforms: swath, resolution) | `imaging_sensors/` | Individual specification facts from operator and agency pages, cited per entry | ✅ (facts only) | "Imaging sensor swaths: operator and agency specifications" | | **Natural Earth physical regions** (1,046 land + 292 marine named polygons) | `natural_earth/` | **Public domain** | ✅ (no restrictions) | "Made with Natural Earth" (courtesy credit — not legally required) | | **DataSF Analysis Neighborhoods** (41 SF neighborhood polygons) | `neighborhoods/` | **PDDL 1.0** (public domain) | ✅ (no restrictions) | "City & County of San Francisco — DataSF" (courtesy — not legally required) | | **Natural Earth countries, states and provinces** (260 admin-0/map units + 4,587 admin-1 polygons) | `natural_earth/` | **Public domain** | ✅ (no restrictions) | "Made with Natural Earth" (courtesy credit — not legally required) | +| **Natural Earth populated places** (7,342 points: name, position, rank) | `natural_earth/` | **Public domain** | ✅ (no restrictions) | "Made with Natural Earth" (courtesy credit — not legally required) | | **US Census Bureau counties** (3,235 county polygons) | `us_census_counties/` | **Public domain** | ✅ (no restrictions) | "U.S. Census Bureau" (courtesy — not legally required) | | **US Census Bureau places** (32,629 city, town and CDP polygons) | `us_census_places/` | **Public domain** | ✅ (no restrictions) | "U.S. Census Bureau" (courtesy — not legally required) | | **Who's On First neighborhoods** (61,441 polygons) | `wof_neighborhoods/` | Per source: CC BY, ODC-By, Open Government licences, CC0, PDDL, public domain (folder `ATTRIBUTION.md`) | ✅ (attribution) | "Neighborhood boundaries: Who's On First and contributors"; per-source credits in the folder | @@ -293,6 +296,14 @@ transaction quota. Requires a free `FIRMS_MAP_KEY` (https://firms.modaps.eosdis.nasa.gov/api/map_key/); the layer is empty without it. The former bundled 2026-05-25 snapshot was removed 2026-07-16. +### UCS Satellite Database (`ucs_satellites/`) + +Operator, owner country and purpose for active satellites, keyed by NORAD number, from the Union of Concerned Scientists Satellite Database release **UCS-Satellite-Database 5-1-2023** (data current through 2023-05-01; https://www.ucsusa.org/satellite_database). The satellites layer joins it to CelesTrak positions and SATCAT records to file each satellite as a station, imaging, telecom, Starlink, probe or debris object, and to name its operator and owner. Section 3 of the UCS database manual: "The Database is free and its use is unrestricted. We request that its use be acknowledged and referenced in written materials. References should include the version of the Database that was used, which is indicated by the name of the Excel file, and a link to or URL for the webpage www.ucsusa.org/satellite_database." The app acknowledges it in the Data attribution popover. UCS has paused updates since this release; Starlink rows are dropped (Starlink is classed by name). Build: `scripts/build-ucs-satellites.py`; curation in the folder README. + +### Imaging sensor pack (`imaging_sensors/`) + +Swath widths and ground resolutions for 46 Earth-observation platforms (Landsat, Sentinel, MODIS, VIIRS, GOES, Himawari, Gaofen, CBERS, RADARSAT, TerraSAR-X, COSMO-SkyMed, ALOS, KOMPSAT, SPOT, Pléiades, WorldView, SkySat, PlanetScope, ICEYE, Capella, Umbra and others), compiled 2026-11-04 from the operator and agency pages cited per entry. The orbital view draws each satellite's sensor swath to scale and caps its zoom at that swath. Facts only; no text or images copied. A swath is confirmed on an operator, agency (ESA's eoPortal included) or academic page; resellers are not cited. The CEOS MIM Database (CC BY 4.0) is not yet used. Sources and unverified values: the folder README. + ### Natural Earth physical regions (`natural_earth/`) Curated from the **Natural Earth 10m physical vectors** (https://www.naturalearthdata.com/ — @@ -312,6 +323,16 @@ https://www.naturalearthdata.com/about/terms-of-use/). We credit anyway: "Made w Earth". Registration in the in-app `dataCredits.js` attribution list ships with the resolver wiring (see below). +### Natural Earth populated places (`natural_earth/populated_places.json`) + +Natural Earth 10m populated places (`ne_10m_populated_places_simple`, the same pinned +`nvkelso/natural-earth-vector` commit and SHA-256 as the admin-1 build reads), reduced to one +row per place: name, latitude and longitude rounded to 3 decimals, `scalerank` and `rank_max` +(7,342 places, 229 KB). From 8x the orbital view names the most prominent place within half +its width ("Sichuan, China · near Chengdu"), offline, with the states and provinces pack giving +the division. Public domain; credited "Made with Natural Earth" with the other packs. Rebuild: +`node scripts/build-admin-packs.mjs --only places`; provenance in the folder README. + ### Sky background (`sky/`) Sources, licences, the changes CC BY asks to state, hashes and build commands diff --git a/README.md b/README.md index 00f65bf3b..d4b53dc24 100644 --- a/README.md +++ b/README.md @@ -340,7 +340,7 @@ Choose a first-run mission, or try these in order. The GIFs show Google Photorea 7. **Talk to it** _(needs an OpenAI key)_: _"Take me to LAX and select the nearest airborne aircraft."_ 8. **Come home.** Hit **Reset Globe** — or just say _"zoom out to a globe view."_ -**Keyboard:** `1`–`6` visual styles · `H` HUD · `D` detection · `C` cockpit · `` ` `` frame rate · `Esc` out. Trackpad pinch zooms the globe. +**Keyboard:** `1`–`6` visual styles · `H` HUD · `D` detection · `C` CCTV · `` ` `` frame rate · `Esc` out. Trackpad pinch zooms the globe. --- @@ -436,7 +436,7 @@ Twenty-two layers and map sources. **Twenty have a keyless path.** Some offer ad | 📡 **GNSS Integrity** | Regional navigation accuracy scores; anomalies do not confirm interference | adsb.lol, GPSJAM aggregation | 🟢 | | 🔥 **Fire Perimeters** | Incident boundaries and reported containment | WFIGS / NIFC | 🟢 | | 🚢 **Live Vessels** | Thousands of ships worldwide | AISStream | 🟡 | -| 🛰️ **Satellites** | 838-object catalog, color-coded by class with a live legend — the **DENSE** chip drops in the whole Starlink shell | CelesTrak | 🟢 | +| 🛰️ **Satellites** | About 1,300 objects in six classes (Stations, Imaging, Telecom, Starlink, Probes, Debris) with a toggle and a live count each; Starlink loads its whole shell | CelesTrak | 🟢 | | 🌍 **Earthquakes** | Global seismic activity, last 24h | USGS | 🟢 | | ◍ **Air quality** | Live AQHI on the published 1–10+ health-risk scale, with a Weather-panel card showing the band legend and the highest readings in view. **Canada only** — ECCC is the first registered provider | ECCC MSC GeoMet | 🟢 | | 🚗 **Traffic** | Simulated vehicles on OSM roads. With TomTom, live flow speeds drive the simulation and congestion colors below ~8 km; individual vehicle positions are not live observations | TomTom + OSM | 🟢 simulation · 🟡 live flow speeds | diff --git a/changelog.d/1557-cockpit-ship-bridge.md b/changelog.d/1557-cockpit-ship-bridge.md new file mode 100644 index 000000000..f07545c84 --- /dev/null +++ b/changelog.d/1557-cockpit-ship-bridge.md @@ -0,0 +1,4 @@ +- Ride the selected AIS vessel from its bridge: an eye height by vessel type, + dead reckoning between fixes, a bridge HUD with a 3–24 NM radar, look-around + with the arrow keys, and a waterline read from the scene so river boats sit on + the river rather than at sea level (Denis Groshev, @ZloyS, #1557). diff --git a/changelog.d/1558-satellite-classes.md b/changelog.d/1558-satellite-classes.md new file mode 100644 index 000000000..baaed9bff --- /dev/null +++ b/changelog.d/1558-satellite-classes.md @@ -0,0 +1,4 @@ +- File satellites under six classes, Stations, Imaging, Telecom, Starlink, + Probes and Debris, each with a toggle; all but Starlink show by default. + Classes come from CelesTrak SATCAT, the UCS Satellite Database and name rules + (Denis Groshev, @ZloyS, #1558). diff --git a/changelog.d/1559-cockpit-orbital-view.md b/changelog.d/1559-cockpit-orbital-view.md new file mode 100644 index 000000000..71c5eebd5 --- /dev/null +++ b/changelog.d/1559-cockpit-orbital-view.md @@ -0,0 +1,4 @@ +- Ride a tracked satellite in an orbital view: a track-up nadir camera, 1–8× + zoom, off-nadir tilt with an approximate swath, a CURRENTLY OVER line, and the + owner's flag, operator and TLE identity. `C` no longer enters or leaves first + person; double-click and the entry buttons do (Denis Groshev, @ZloyS, #1559). diff --git a/changelog.d/1560-orbital-sensor-zoom.md b/changelog.d/1560-orbital-sensor-zoom.md new file mode 100644 index 000000000..4d9a2d0db --- /dev/null +++ b/changelog.d/1560-orbital-sensor-zoom.md @@ -0,0 +1,4 @@ +- Zoom imaging satellites past 8×, up to 128×, as far as their sensor's + confirmed swath allows at the live altitude, with a to-scale swath strip, a + SENSOR step, mouse-wheel zoom, imagery pre-loaded ahead of the ground track and + the TLE's age (Denis Groshev, @ZloyS, #1560). diff --git a/changelog.d/1580-orbital-ground-focus.md b/changelog.d/1580-orbital-ground-focus.md new file mode 100644 index 000000000..0df7cb384 --- /dev/null +++ b/changelog.d/1580-orbital-ground-focus.md @@ -0,0 +1,4 @@ +- Hold the orbital camera on a mapped site as the satellite passes over it, + from a click on its marker or its Live Signals row, and list nearby sites + and satellites in orbit's Live Signals, where a row focuses a site or rides + a satellite (Denis Groshev, @ZloyS, #1580). diff --git a/docs/CODE-BOUNDARIES.md b/docs/CODE-BOUNDARIES.md index f0bb9e979..e5b337a51 100644 --- a/docs/CODE-BOUNDARIES.md +++ b/docs/CODE-BOUNDARIES.md @@ -163,7 +163,8 @@ local composition mounts them in the same order. Importing the entry performs no acquisition; factory calls create independent cache state. `gods-eye-view/sources/space` owns only fixed upstream URL construction: the -CelesTrak group/TLE query and Launch Library's recent 30-day detailed feed. +CelesTrak group/TLE and SATCAT record queries and Launch Library's recent +30-day detailed feed. Callers supply the group or end date and own validation, credentials, transport, response limits and cache policy. The boundary gate checks this portable entry separately from the Node providers. Satellite rendering and launch replay remain diff --git a/docs/CURRENT-STATE.md b/docs/CURRENT-STATE.md index ea4e143a5..34cbdecff 100644 --- a/docs/CURRENT-STATE.md +++ b/docs/CURRENT-STATE.md @@ -1524,6 +1524,291 @@ retained Cockpit actions cannot restart a disposed controller. Input, subscripti and queued panel work stop before asynchronous layer restoration; final camera and portal cleanup follows that restoration. +### Ship bridge view + +With no aircraft tracked, Cockpit can ride the selected AIS vessel instead. +Entry needs only the layer of the vessel it rides, Live AIS Vessels, and a +selected vessel; Contacts and every other layer may be off, before or during +the bridge (`bridgeEntryAllowed` in `src/contextModePolicy.js`). A Context mode +change still in flight blocks entry until it settles. Double-clicking the +selected vessel enters it, and the entry button reads BRIDGE with a ship icon +both in Contacts (`#cockpit-entry`) and under the selected vessel's Intel HUD +readout in the bottom-right corner (`#cockpit-entry-readout`, shown with the +HUD on, in its Tactical and Cyber layouts). Turning Live AIS Vessels off ends +the bridge: the layer then has no subject (`getCockpitSubject` returns null). +The bridge picture uses AIS alone, so no other feed being off makes it partial. +Voice (`control_cockpit`) and the selection entry transaction stay aircraft-only; +voice `enter` on a bridge or in an orbital view is refused before it touches +tracking, with the reason to exit it first. +The vessel layer supplies the subject (`getCockpitSubject`), hides that ship's +sprite, card, detection bracket and trail while it is held +(`setCockpitSubject`), and +ignores scene clicks so open water cannot deselect it. The eye sits on the AIS +position at a representative bridge height for the AIS type family +(`src/layers/vessels/cockpitSubject.js`: cargo and tanker 30 m, passenger 25 m, +tug 7 m, fishing 6 m, ferry and AIS "Other" (codes 90–99, or a feed's text +type "Other") 4 m, sailing and pleasure 3 m; 12 m when the type names no +family, including the reserved and wing-in-ground codes the vessel layer also +files under OTHER), pitched 2° down with 2 m clearance over the shared ground floor +(`src/cockpitSubjects.js`). The camera faces true heading (course over ground +when heading is missing) and moves along course over ground. A ship reporting +neither has no direction: the camera keeps the heading it had on entry, the +heading readout shows `---`, the visor reads NO HEADING · AIS, the entry signal +names the ship without a heading, no bow or stern mark is drawn, and the eye +stays on the fix rather than moving along a made-up course. The vessel layer +redraws a ship only on its 60-second refresh, so the camera's target is the last +fix dead-reckoned along course over ground for up to 180 s, and the existing +inertial anchor absorbs each new fix. The fix's age is read without comparing +the two clocks (`vesselFixAgeSec`): the time since this client first received +the fix, plus how far it trailed that refresh's newest fix, so a client clock +running fast or slow neither projects the ship nor marks it stale, and a fix +the feed keeps re-serving from its cache goes on ageing into STALE FEED. A +stale vessel, or a projection past that limit, holds the camera on the target. +The vessel layer floats ships on the geoid, which on a river or lake can lie +well below the water (the Seine through Paris is ~27 m up), so the bridge also +reads the rendered surface around its ship: the ship's position and a ring of +eight probes 30 m out, the lowest probe taken as the water when it is 2 m to +4,000 m above sea level. The first read starts from the tiles already loaded, then +the full-detail read replaces it; it repeats every 5 s. Only one full-detail +read runs at a time: while one is still running, a refresh reads the loaded +tiles instead, and the slow read applies whenever it lands. Once a +full-detail read has answered, loaded-tile reads no longer change the height; +before then they may find raised water but never take it back to the sea. +A read that sampled nothing, or failed, keeps the height it had and is +tried again on the next refresh. + +The HUD keeps its frame, vision styles, briefing, weather and Display/Radio +utilities. It names the ship, reads `{type} · LIVE AIS · EYE {height}`, shows +speed over ground in knots, true heading and course over ground in place of +altitude, hides the altitude tape, and shows the crew-entered AIS destination as +a Reported Voyage card without an origin or direction arrow. The arrow keys +look around the bridge in 5° steps (Shift for 45°): Left and Right turn the +view all the way round, Up and Down pitch it up to ±90°, and the camera eases +there unless the user prefers reduced motion. Home or `0`, or the LOOK AHEAD +button shown while the view is turned, bring it back over the bow at the rest +pitch. The keys stay with a focused text field, slider, tab, radio group, list +or menu. The heading tape is a straight strip that scrolls continuously with +the camera, so the caret reads the view's exact heading, while the readout +above it keeps the ship's true heading; a ring with a centre dot marks the bow +(prograde) and a ring with a cross the stern (retrograde) at their bearings +from the caret. The bridge radar +shows nearby AIS ships heading-up and opens at 3 NM +(`DEFAULT_RADAR_RANGE_NM` in `src/cockpitRadar.js`); its range button steps +3, 6, 12 and 24 NM and the chosen range is kept across bridges. Own ship +sits where the camera rides (its fix dead-reckoned) and contacts at their +last fixes, where the vessel layer draws them, so the scope matches the view +out of the window. Contact +Previous/Next and Live Signals aircraft handoffs are refused on the bridge and +the Contact card stays hidden. Exit returns the camera to the vessel's map view +through the layer's own focus. Tracking an aircraft or losing the vessel +selection ends the bridge without refocusing the ship. `src/ui/cockpitBridge.test.mjs` +covers entry, readouts, refusal and exit. + +### Orbital view + +With a satellite tracked and no aircraft tracked, Cockpit can ride the +satellite instead. Entry needs only the Satellites layer +(`orbitEntryAllowed` in `src/contextModePolicy.js`); Contacts and every other +layer may be off. A Context mode change in flight blocks entry until it +settles. Debris (rocket bodies, fragments and dead satellites; see the +satellite class toggles) can be tracked but never entered: no ORBIT entry is +offered and double-click refuses it. A tracked aircraft still takes +entry first, and a tracked satellite +takes it before a selected vessel. Double-clicking the tracked satellite +enters it, and the entry button reads +ORBIT with a satellite icon in Contacts (`#cockpit-entry`) and under the Intel +HUD readout (`#cockpit-entry-readout`). Voice (`control_cockpit`) stays +aircraft-only; its state reports an orbital view in use as a `satellite` +subject. `gev:cockpit-mode-changed` carries layer `satellites` and the NORAD +id. + +The camera sits on the satellite's own per-frame SGP4 position +(`getCockpitPosition`, the sample the dot uses) and looks at the Earth's +centre track-up: the ground track points to the top of the frame, so the +picture scrolls along it (`nadirOrientation` in `src/cockpitOrbital.js`). A +satellite with no ground track (a geostationary one) is shown north-up, and +over a pole the previous frame's up is kept. It updates on every rendered +frame, with no ground clamp. Entry opens in the plain optical vision style +(the other styles stay one click away) and leases the map for flat imagery: +with Google 3D tiles shown, which stay coarse from hundreds of kilometres up, +the map switches to Esri imagery, and exit puts it back unless the operator +picked another map meanwhile; another owner already holding the map (an +imagery comparison) keeps it as it is. While orbit holds the lease, Recent +Imagery cannot take it: turned on in orbit, the layer reports the comparison +in use until, after exit, it is turned off and on again or its shown days +are cleared and picked again. The Cockpit cloud pass is off in orbit +(it fades out above 24 km); cloud cover from orbit is the Weather layer's, +and the saved cloud preference stands for the next aircraft or bridge. The layer hides the satellite's dot, docked +companions, its own orbit ring and its detection bracket, and draws every +other orbit ring (the ISS ring included) at 30% of its alpha; other +satellites' points and labels stay. Scene clicks and the layer's Escape are +ignored by the satellites layer while it is ridden (a click on a mapped +site focuses it; see below). The optical zoom steps 1×, 2×, 4× and 8× for +every satellite with `+` (or `=`) and `-` (or `_`), the panel's buttons and +the mouse wheel (one step per notch; trackpad scrolling is summed to a step): +the 1× frame is 60° vertical in low orbit and fits the Earth's disk with +margin from high orbits, each step divides the tangent of the half-angle, and +Cesium's `frustum.fov` is set from it for the canvas aspect. A step animates +over 400 ms with a focus-pull blur and a reticle lock tick, and cuts at once +under `prefers-reduced-motion`. An imaging satellite matched to an entry of +the bundled sensor pack (`src/data/local_data/imaging_sensors/`, by NORAD +number or name in `src/layers/satellites/sensors.js`) whose narrowest swath +is confirmed also gets 16×, 32×, 64× and 128×, each only while the view at +the satellite's live altitude and the window's shape is still at least as +wide as that swath (`orbitalMaxZoom` in `src/cockpitOrbital.js`); when the +cap falls below the zoom shown, the view steps back to it. Unconfirmed +swaths add no steps, but are still drawn, read out and offered to SENSOR. +The sensor's swath is drawn to scale as a strip along the ground track with +a SENSOR SWATH readout, and a SENSOR button zooms to exactly that width when +it lies between 1× and the cap. No strip is drawn for a geostationary view +(no ground track; its sensors image areas, not strips) or a SAR (it images +to one side of nadir, not under it); the readout stays. Tilted off nadir +the strip stays (view and swath widen alike), the readout scales as the swath +readout does (`SENSOR SWATH ≈ 191 KM`), and SENSOR, a nadir framing, is +hidden; tilted past the Earth's limb neither the sensor nor the swath reads. A swath is confirmed only on the operator's, an agency's (ESA's +eoPortal included) or an academic page for its platform. From +16×, with flat imagery on the globe (not Google 3D tiles) and the view at +nadir, every 2 s the view asks the base imagery layer for the tiles it will +need 5 to 20 s ahead along the ground track (`prefetchImageryAhead` in +`src/ui/cockpitOrbitalView.js`), so the browser has them cached when the +view arrives. The level is the one Cesium will draw there +(`imageryLevelForView` in `src/cockpitOrbital.js`, following Cesium's own +choice: the terrain level whose error spans at most the globe's maximum +screen-space error, then the imagery level whose texels are nearest that +error, about one to two screen pixels per texel). It asks for at most 12 +tiles at a time through Cesium's request scheduler, throttled per server and +at the lowest priority, so a request is declined while the imagery server's +slots are taken by the tiles on screen and is the first dropped when the +scheduler is full (a declined or dropped tile is asked for again later, one that failed to load is not); it remembers the last 512 tiles asked for and does not ask +for those again, starts over on another base map (cancelling the old map's +pending requests), and cancels the requests still pending on exit. Across the track it samples the centre line, a third +out and the frame's edges. While tilted off nadir the view looks away from +the track, and with the world clock more than a minute from now (paused or +played back) it will not pass where the look-ahead points, so nothing is +pre-loaded. The arrows tilt the view off nadir in 5° steps +along the frame's axes (Up/Down tilt forward/aft along the ground track, +Left/Right across it, each axis to ±45°; Shift takes no larger step); Home, +`0` or NADIR return to nadir. While tilted the panel shows the total angle +from nadir, acos(cos along · cos across), before each axis +(`OFF-NADIR 18.0° · FWD 10° · RIGHT 15°`; N, S, E and W for a north-up view) +and a NADIR button, and the swath readout turns approximate +(`SWATH ≈ 26 KM`): an estimate of the ground width at the view's centre, the +nadir footprint scaled by 1/cos² of the tilt across the frame and 1/cos of +the tilt along it (`offNadirSwathScale`, flat Earth). At nadir it reads the +footprint without ≈. After a zoom step lands, the focus pull holds until the +imagery under the view has loaded (at most 2.5 s, `zoomSettleHolding`), then +the reticle locks. The look keys and zoom keys keep the bridge's focus +guards. + +In orbit the briefing's Live Signals page (OBSERVED / MAPPED PINGS) lists +what is around the satellite, as the aircraft Cockpit lists the contacts +of its Contacts snapshot (`src/ui/cockpitOrbitalSignals.js`): five rows at +most, rebuilt once a second with stable keys, so a row keeps its place and +time. TRACK ACQUIRED stays first. Then: + +- **Sites**: the Mapped Installations layer's loaded records around the + sub-satellite point (`getNearby`, asked only as far as the reach extends + over the ground, and never past 3,000 km, so from a high orbit only the + sites within 3,000 km of the point below are listed) that face the + satellite and lie within the off-nadir reach, nearest to nadir first, the focused site always among them. A row + reads the site's name over its class and off-nadir angle; its button + (`Keep the camera on …`) focuses the site, and on the focused site's row, + marked as the subject is (`FOCUS · …`, `Release the camera from …`), ends + the focus. With Mapped Installations off the layer keeps its records, so + nothing is listed then: a SITES STANDBY row says to turn the layer on. +- **Satellites**: the nearest shown satellites to the ridden one, debris + left out (the satellites layer's bounded `getNearestPositions`, measured + from the satellite itself), with their bearing from the top of the frame + and distance. A row (`Ride …`) rides that satellite. While there is a + satellite ridden before this one, a RETURN · *name* row goes back to it; if + that satellite has left the catalogue it is dropped and RETURN offers the + one before. Riding stays in orbit: the satellites layer tracks the new + satellite (`trackById`), the Cockpit takes the camera back at once and + marks it as the ridden subject, any ground focus ends with the view easing + back to nadir, and the camera hops to the new satellite along the great + circle over 1.2 s (cut under reduced motion), keeping the zoom. Until the + camera is on the new satellite the page shows only TRACK ACQUIRED and + RETURN (and SITES STANDBY with Mapped Installations off), then rebuilds + at once. The new satellite's TRACK ACQUIRED carries the time it was + ridden. The hop starts from where the camera was, which does not follow + the old satellite on. + +Sites take two rows while satellites fill the rest, more when there are +fewer satellites. The Contact card stays hidden in orbit. + +The focus (`src/ui/cockpitOrbitalFocus.js`, geometry in +`src/cockpitOrbitalFocus.js`) aims the look each frame from the satellite's +position to the site's Earth-fixed position in the same track-up nadir +frame the arrows tilt, so the site stays at the centre as the satellite +moves. The turn onto it (and between sites) eases what is left of the swing +with the arrows' easing on a slower clock (250 ms time constant, about +0.75 s to 95%), then holds the site exactly, and cuts under +`prefers-reduced-motion`. A single click on a site's marker focuses it too: +the pick is resolved through the layer's own pick ids (`findByPick`: a named +marker's `{ installationId }` or a site entity). A click anywhere else +(a site beyond the reach included), the +focused site's row, NADIR, Home or `0` ends the focus and the view eases +back to nadir on the same clock; an arrow ends it (or the ease back) and +tilts on from where the view is. The layer reloads its thinned view as the +camera moves (about once a second in orbit), so a site in view can leave +its records for a moment: while the layer is on, a site seen in the last +10 s stays a candidate (sites do not move), so the rows hold still and a +row's site can be focused, and a focused site keeps its last position. The focus ends by +itself, easing back, when the site leaves the reach (either tilt axis past +±45°, or the site below the satellite's horizon), when the layer is turned +off, when another satellite is ridden, and with the orbital view. A site +beyond the reach cannot be focused. While focused the readout gives the +single off-nadir angle to the site, as image metadata does +(`OFF-NADIR 23.4°`, updated on the HUD's beat and not announced), names it +in a polite live region (`FOCUS · Camp Alpha`), and the swath reads +approximate as for a tilt, scaled by the tilt onto the site. Clicks still +reach Cesium's own handler and never untrack the satellite; a click a tool +owns (drawing) is ignored, and the draw tool still borrows the click while +it draws. A double-click on a site keeps or starts the focus on it and +never reaches Cesium's double-click, which would track the site and end the +view (the Cockpit's double-click routing in `src/ui/cockpitInput.js`); any +other double-click goes on as before. `src/ui/cockpitOrbitalFocus.test.mjs` +covers the rows, the easing in and out, the reach release, switching sites +and satellites, the hop, the layer turned off, click handling and the +readout, against the layers' method shapes. + +The HUD (`#cockpit-hud[data-subject='satellite']`, body class +`cockpit-orbit`) mounts `CockpitOrbital` over the picture: name, class, +altitude, orbital speed, sub-satellite point, TRACK UP (NORTH UP without a +ground track) with a pointer that turns to keep north marked N on the frame, +zoom and swath. Under +the vision selector a "CURRENTLY OVER" band names what the sub-satellite point +is over, looked up offline from the bundled Natural Earth packs +(`src/data/placeBelow.js`: on land the first-level division as Natural Earth +names it and the country in the reader's language through `Intl.DisplayNames`, +"Sichuan, China", and from 8× the most prominent populated place within half +the view's smaller side, so it is in the picture, "Sichuan, China · near +Chengdu", from a bundled pack of Natural Earth populated places loaded on +first use; else the smallest named sea, gulf, strait, channel, sound or bay; +else the ocean; nothing in a coastline gap), at most every 2 s and only after +20 km of ground travel, or at once when a zoom step changes how much ground +the view shows. A division or populated-places pack that fails to load drops +only that part (the country still shows); a lookup that fails outright hides +the band rather than leave the last place up, and the next HUD beat looks +again. The readout card puts +the owner country's flag (an SVG from `flag-icons`, fetched only for the shown +country) or a text badge for an organisation before the name, the operator +under it, and a NORAD · COSPAR · TLE-epoch line, ending with the element +set's age (`<1 H OLD`, then whole hours, then whole days: the gap, either +side, between the epoch and the world-clock time the satellite is shown at), whose TLE button +unfolds the two element lines; each row is left out when the satellites layer does not +know it. The +aircraft and bridge instruments, tapes, compass, radar, look controls, +position readout, route card and Contact card are hidden; the vision-style +switcher, briefing card (Live Signals as above, Local and Regional for the sub-satellite point; the +regional brief refreshes at most once a minute) and the reset and EXIT ORBIT +buttons stay, square-cornered like the bridge. Exit (`Escape`, EXIT +ORBIT) restores the camera's own field of view exactly and returns to the +satellite's follow camera through the layer's `refocusTrackedById`. Losing +the subject (tracking stopped, Satellites off) or tracking another target +ends the view without refocusing. `src/ui/cockpitOrbitalView.test.mjs` +covers entry, camera, zoom, look, HUD and exit. + ## Context coordination Context controls own Contacts/Space Missions state, entry and exit transactions, @@ -3414,7 +3699,7 @@ down | auth-failed` (plus the unchanged `missing-key`/`unsupported`) with > It uses the `radar` symbol; both tabs are reachable with Tab and Left/Right arrows switch between them. Its action row > places the single Cockpit entry before Search Nearby Sites. Cockpit removes > the duplicate floating map entry and topline exit; the bottom-center -> `EXIT COCKPIT` control (offset downward by a `-95px` bottom margin) plus `Escape`/`C` own exit, with entry/exit focus +> `EXIT COCKPIT` control (offset downward by a `-95px` bottom margin) plus `Escape` own exit, with entry/exit focus > transfer and failure-safe shortcut routing. The exit control sits at the > bottom-center compass position. A Cockpit-only control strip sits > directly above Live Signals, anchored 12px under the REC readout it shares @@ -4368,7 +4653,7 @@ its criteria cannot be silently ignored. | Mapped Installations ⌖ | OpenFreeMap military areas; optional configured Overpass names and Google Places search | `src/data/militaryInstallations.js` | OpenFreeMap tiles, `/api/military-installations`, `/api/google/text-search` | viewport-driven; transient errors back off, missing capability switches to tiles | | Earthquakes | USGS | `src/data/earthquakes.js` | — | 60s | | Air quality | ECCC MSC GeoMet OGC API (AQHI, Canada only) | `src/layers/airQuality/` | — | 20 min readings, 12 h station catalog | -| Satellites | CelesTrak | `src/data/satellites.js` | `/api/celestrak` | 120s | +| Satellites | CelesTrak TLE + SATCAT; bundled UCS pack (purpose) | `src/data/satellites.js` | `/api/celestrak` + `/api/celestrak-satcat` | 120s | | Space Missions (30d) | Launch Library 2 + CelesTrak | `src/data/rocketLaunches.js` | `/api/launches` + `/api/celestrak/active` | 5 min | | Traffic | Selectable TomTom / OpenStreetMap / Hybrid roads; optional TomTom flow (BYOK) | `src/data/traffic.js` | browser-direct OpenFreeMap tiles; `/api/tomtom` for flow | viewport-driven; capped tile cache | | CCTV | Austin + Caltrans (CA) + TfL London + Ontario 511 + Fintraffic (FI) + DriveBC (BC) + TxDOT (TX) + Estonia (Tallinn, Tarktee) + Live Traffic NSW + Open Calgary Open Data + Statens vegvesen (NO, stills + live HLS, Kartverket ground heights) + King County (WA) Open Data + WSDOT (WA) Open Data + NYC DOT TMC (opt-in) + City of Toronto RESCU + Catalonia (Servei Català de Trànsit) + Iceland (Vegagerðin / IRCA) + Hong Kong Transport Department + FL511 (FL, opt-in) + Freeway Bureau, MOTC (Taiwan) + Houston TranStar (opt-in) + Autostrada del Brennero (IT, A22 stills) + Street View fallback | `src/data/cctv.js` | `/api/cctv` | 10s (active) | @@ -5373,11 +5658,13 @@ silently demoting every later lookup for the session. - **Flights (commercial + military)** render one poll interval behind real time (30s/15s) and interpolate between two known feed-stamped fixes (OpenSky `time_position`; adsb.lol `receipt − seen_pos`). The display latency is an intentional product decision — do not "fix" it away. The fleet dead-reckons at ~12Hz (1m² write gating); a contact already hidden behind the horizon whose last position still is re-reckons on a staggered one-in-13-ticks rotation (about once a second) instead, so the worldwide feed's ~13k contacts no longer cost a full pass when well under 1% are on screen. Anything that position puts in view, and any contact with a fleet model, takes the full pass immediately, and hidden-inclusive proximity queries read positions at most about a second old; aircraft get a 3-poll grace period (faded icon) before removal. When a position epoch pauses, both layers coast for at least 60 seconds of contact grace with an absolute five-minute ceiling. Source backoff marks each contact and the cockpit `STALE`; the cockpit then holds the exact layer position instead of continuing inertial flight. Repeated-position kinematic changes create a forward-only synthetic fix rather than mutating history, and grounded history is lifted only when no owned 3D model already controls its datum. A nominally successful worldwide OpenSky response whose own snapshot epoch is more than two minutes old prefers the existing 250-nm viewport-scoped adsb.lol fallback and labels the source/coverage accordingly when that upstream is available. If the fallback is also unavailable, the layer's freshness/error fields use the source epoch—never the cache receipt time—so the UI reports an old snapshot rather than “just now.” - **World-space headings at every angle** (`src/data/iconOrientation.js`): aircraft/vessel icon rotation uses the camera right/up basis per tick (alignedAxis always ZERO), which is exact at screen center and for orthographic/nadir views and remains stable through >180° tracked orbits. Perspective rays vary across the viewport, so off-center contacts at oblique pitch can diverge from an exact finite-difference window projection; a regression test pins that known regime, and field evidence decides whether to adopt exact projection with the basis method as fallback. Fleet rotations refresh on camera-pose change; tracked entities per frame. Billboards are horizon-culled via a shared EllipsoidalOccluder. - **Military/OpenSky reconciliation** (`src/data/militaryRegistry.js`): known-military ICAOs render amber in the flights layer (60s self-poll of the cached mil endpoint when the military layer is off) and are suppressed there while the military layer renders them. -- **Satellites**: 838-sat core catalog (stations/visual/GPS/GLONASS/Galileo/GEO), tracking lands ~726km out via `viewFrom` (tracked entity owns a point graphic so the tracking camera engages), rings realign via primitive modelMatrix (no per-second rebuild flicker), optional `setParams({catalog:'dense'})` Starlink mode. -- **Satellite classes** (`src/data/satelliteClass.js`): every satellite is classified from the CelesTrak group it was ingested with — no extra fetch and no heuristics — into STATION (warm white), NAV (cyan; GPS/GLONASS/Galileo deliberately share one color so the GNSS family reads as one thing), GEO (violet), VISUAL (muted blue-gray catch-all), and COMMS (dim slate, dense Starlink shell only). That module is the single source of truth for class, label, and color, so the dot, the card, and the legend swatch cannot disagree. Two deliberate palette rules: no class may sit in the 40–48° amber band, which is the app-wide known-military convention; and COMMS stays far below VISUAL in Rec.601 luminance so the dense shell stays separable when NVG/FLIR collapse the scene to one channel. The ISS keeps its long-standing red hero dot rather than the STATION color — it carries a permanent name label and its card still reads `STATION · ISS`. `satelliteClassOf` is the single owner of that ISS rule, so the card label and the legend tally can never disagree: during a stations-feed outage the ISS is ingested as `visual`, and both surfaces still file it under STATION. -- Class is also a **text field**, not just a color: `NAV · GPS` / `GEO` / `COMMS · STARLINK` / `STATION · ISS` leads the tracked card's detail block and replaces the raw CelesTrak tag on the detection-overlay label. Because that canvas composites above the post-FX chain, the class stays readable in NVG/FLIR after the in-scene dot colors are flattened. -- The satellites row in DATA LAYERS carries per-layer sub-controls (`DataLayerManager._syncRowControls`, the first consumer of the optional `getRowControls()` layer hook): a **DENSE** chip exposing the existing `catalog` param, and a swatch legend with live per-class counts. Default is the sparse core catalog. The chip is stateless — it declares the params to apply and the manager owns the write — so the Space Missions capture/restore path over the same param stays authoritative. Controls stay hidden while the layer is off. An explicit CORE or DENSE choice participates in versioned local and share-link state; temporary Space Missions overrides do not. -- **The DENSE chip reports the dense LOAD, not the catalog param.** The param flips synchronously while the Starlink shell takes seconds to arrive over a chunked load, and CelesTrak 502s that feed regularly. So the chip reads `DENSE ···` (busy, disabled) while loading, ACTIVE only once dense points are actually on screen, and `DENSE ✕` with the reason on hover when the load fails — a failure also reverts `catalog` to `core`, drops any partial chunk, and leaves the chip clickable to retry. A load is judged by points added, not by HTTP status: a 200 carrying an empty body, a passed-through HTML error page, or only TLEs the core catalog already owns fails with the same revert semantics as a 502. Any explicit request for `core` clears a latched error even when the mode does not change, so a Space Missions restore of an already-core snapshot never leaves the user with a failure they did not cause. Because the load settles asynchronously, the layer pushes a re-render through the optional `setRowControlsListener()` hook; nothing else would repaint that row before the 5-minute catalog refresh, so the count and legend would otherwise sit stale. +- **Satellites**: core catalog from CelesTrak's stations, visual, GPS, GLONASS, Galileo, GEO, resource, weather, planet, SAR and science groups, tracking lands ~726km out via `viewFrom` (tracked entity owns a point graphic so the tracking camera engages), rings realign via primitive modelMatrix (no per-second rebuild flicker), optional `setParams({catalog:'dense'})` Starlink mode. +- **Satellite classes** (`src/layers/satellites/classes.js`): every satellite is filed under one of six classes, each with its own point colour, legend swatch and toggle: STATIONS (warm white), IMAGING (cyan), TELECOM (violet; communications and navigation, so GPS, GLONASS, Galileo and BeiDou read as one family), STARLINK (dim slate), PROBES (muted blue-gray) and DEBRIS (receding brown-gray). That module is the single source of truth for class, label and colour, so the dot, the card and the legend swatch cannot disagree. Two deliberate palette rules: no class may sit in the 40–48° amber band, which is the app-wide known-military convention; and STARLINK stays far below PROBES in Rec.601 luminance so the dense shell stays separable when NVG/FLIR collapse the scene to one channel. The ISS keeps its long-standing red hero dot rather than the STATIONS colour — it carries a permanent name label and its card still reads `STATIONS · ISS`; it is a station whichever group ingested it, so a stations-feed outage cannot refile it. `src/data/satelliteClass.js` keeps the group-based labels beneath the classes: the constellation subtype and a group's own label for a satellite with no class. +- Class is also a **text field**, not just a color: `TELECOM · GPS` / `STARLINK` / `STATIONS · ISS` leads the tracked card's detail block and replaces the raw CelesTrak tag on the detection-overlay label. Because that canvas composites above the post-FX chain, the class stays readable in NVG/FLIR after the in-scene dot colors are flattened. +- The satellites row in DATA LAYERS carries per-layer sub-controls (`DataLayerManager._syncRowControls`, the first consumer of the optional `getRowControls()` layer hook): one chip per class (the STARLINK chip exposes the existing `catalog` param), a swatch legend with live per-class counts, and an info line while SATCAT is stale or unavailable (`Classes may lag: SATCAT is a cached copy` / `Classes may lag: SATCAT unavailable`). Default is the sparse core catalog. The chips are stateless — each declares the params to apply and the manager owns the write — so the Space Missions capture/restore path over the same param stays authoritative. Controls stay hidden while the layer is off. An explicit CORE or DENSE choice participates in versioned local and share-link state; temporary Space Missions overrides do not. +- **Class toggles** (`src/layers/satellites/classes.js`): the layer row carries one chip per class — STATIONS, IMAGING, TELECOM (communications and navigation), PROBES (science, technology development and demonstration, unknown purpose) and DEBRIS (rocket bodies, fragments, unknown objects launched before last year and dead payloads) on by default, so the layer shows what it did before classes; STARLINK off, as DENSE was. Points of a hidden class stay built and are only hidden, so a toggle needs no reload; hidden classes are left out of the detection overlay, the voice/framing position lists and analyst answers (the tracked satellite still answers), and the legend keys only the classes on screen. The class comes, strongest evidence first, from CelesTrak SATCAT (object type and operational status, fetched per group through `/api/celestrak-satcat/`, cached a day by the proxy; the layer keeps a current read six hours rather than asking on every five-minute update), the bundled UCS Satellite Database pack (UCS-Satellite-Database 5-1-2023: operator, owner country and purpose; `src/data/local_data/ucs_satellites/`), name patterns for satellites launched after May 2023, and finally the CelesTrak groups the TLE came in (a mission group such as `weather` before the orbit group `geo`; a UCS purpose of "Unknown" counts as none). Only crewed stations and the craft that visit them, by name, are STATIONS: the CubeSats CelesTrak's stations group also carries after their deployment from the ISS are classed like any other satellite. A payload whose SATCAT record gives no status, with no UCS record and no recognisable name, that launched 20 or more years ago (SATCAT's launch date, else the TLE designator's year) is presumed dead and filed as debris; without a SATCAT record (a failed read) nothing is presumed. To cover imaging launched after the UCS snapshot the core catalog also reads CelesTrak's `resource`, `weather`, `planet`, `sar` and `science` groups. Debris can be tracked but is never ridden: the orbital entry gate (`orbitEntryAllowed`) refuses it, so no ORBIT entry is offered and double-click does nothing for it. Retired stations and the shuttles have re-entered and have no orbit to show. An explicit class choice is kept in local and share-link state as the `classes` option, one letter per class shown (`sitpd`: stations, imaging, telecom, probes, debris; `0`: none; `src/data/satelliteClassMask.js`), and the layer takes those letters back through `setParams({classes})`; STARLINK maps to the existing `catalog: 'dense'` param instead. +- The satellite Cockpit subject (`getCockpitSubject()`) also carries `satelliteClass`, `cosparId` (from SATCAT, else TLE line 1), `tle` (`{line1, line2, epochMs}`), `owner` (`{countryCode, label}`: ISO 3166-1 alpha-2 for a single country, `null` code for organisations such as ESA, EUMETSAT or Intelsat and for joint owners) and `operator` (UCS; SpaceX for Starlink). UCS names the operator's country and wins over the SATCAT owner code; CelesTrak's CIS (former USSR) is filed under Russia. +- **The STARLINK chip (formerly DENSE) reports the dense LOAD, not the catalog param.** The param flips synchronously while the Starlink shell takes seconds to arrive over a chunked load, and CelesTrak 502s that feed regularly. So the chip reads `STARLINK ···` (busy, disabled) while loading, ACTIVE only once dense points are actually on screen, and `STARLINK ✕` with the reason on hover when the load fails — a failure also reverts `catalog` to `core`, drops any partial chunk, and leaves the chip clickable to retry. A load is judged by points added, not by HTTP status: a 200 carrying an empty body, a passed-through HTML error page, or only TLEs the core catalog already owns fails with the same revert semantics as a 502. Any explicit request for `core` clears a latched error even when the mode does not change, so a Space Missions restore of an already-core snapshot never leaves the user with a failure they did not cause. Because the load settles asynchronously, the layer pushes a re-render through the optional `setRowControlsListener()` hook; nothing else would repaint that row before the 5-minute catalog refresh, so the count and legend would otherwise sit stale. - **A dependency owner takes the row with it.** Space Missions borrows this layer for TLE lookup with `showPoints:false`; while points are hidden the layer returns empty row controls, so the legend never describes an empty sky and the chip cannot accept a write that the owner's restore would silently revert. - The detection-overlay record cache (`_detectionObjects`) is cleared with the catalog on every rebuild: it stamps id/class at creation only, and a rebuild can re-tag a satellite when a partial CelesTrak outage changes which group wins dedupe. - **Catalog numbers above 99999** can be written in a TLE as Alpha-5: a letter A–Z, skipping I and O, for the first two digits, so `A0000` is 100000 and `Z9999` is 339999. CelesTrak's TLE feed carries no satellite above 99999 (that needs the OMM feed, #1191), so this is compatibility with Alpha-5 TLEs. `src/sources/tle.js` decodes the field through one shared helper: `noradIdFromSatnum()` for the satellites layer, which keys and deduplicates its catalog by that number, and `tleCatalogNumber()` for the satellite tools. Plain digits read as before (`noradIdFromSatnum()` accepts any length, as an OMM satrec carries the number unpadded); a malformed field — a sign, decimal point, hex, exponent, embedded space, stray or lowercase letter, or blank — is rejected rather than partly read, as `NaN` in the layer and `null` in the tools. @@ -6278,19 +6565,22 @@ apply to `public/` assets or built-preview serving. `src/contextModePolicy.js`). Contacts is not required, and the other aircraft layer, Live AIS Vessels and every other layer may be turned on or off before or during a session. A Context mode change still in flight blocks entry until - it settles. Turning off the layer the view rides ends it. Riding an aircraft - while Contacts is on adopts its layer as the user's own, as a direct selection - does (`adoptLayerVisibility`), so Contacts ending, by its own switch or one of - its layers going off, restores the pre-Contacts layers but keeps the ridden - one and the view; Live Signals then drops the rows Contacts built and shows - `CONTEXT STANDBY`. The visible Cockpit actions, the `C` shortcut and voice use - the same gate; voice entry still opens Contacts first, as its layer-targeted - entry navigates through Contacts. -- **Aircraft cockpit view:** selecting a commercial or military aircraft reveals a `COCKPIT` action (`C`) once that aircraft's own layer is on; Contacts is not required. The action shows in Contacts (`#cockpit-entry`) and under the Intel HUD's bottom-right readout (`#cockpit-entry-readout`, with the HUD on, in its Tactical and Cyber layouts), so entry needs no Contacts panel. Turning off the ridden aircraft's layer ends the view (the layer clears its tracking). When an air feed the surrounding picture uses is off, the Cockpit says so instead of blocking: Live Signals leads with `MILITARY FEED OFF · PARTIAL PICTURE` or `FLIGHTS FEED OFF · PARTIAL PICTURE`, and the Contact card shows that line in place of its inputs status, so a partial picture is never presented as complete. `control_cockpit` refuses entry with `entryBlockedReason` `contacts-starting` (a Context change in flight), `subject-layer-off` (the aircraft's layer, or with none tracked any aircraft layer, is off) or `no-tracked-aircraft`. Cockpit mode temporarily releases Cesium's orbit-follow transform and drives a first-person camera from the tracked aircraft's existing smoothed display position and course. Its concave helmet-visor HUD shows callsign, UTC time, coordinates, curved roll/pitch guides, and a seven-division heading tape. Ambient commercial and military AIR contacts use a Cockpit near/far band selected by the shared Display 3D mode: Proximity admits at 150 km and retains to 185 km; All admits at 400 km and retains to 450 km. The shared 3D toggle now applies in Cockpit: Off keeps in-range contacts as rotating 2D aircraft silhouettes, while On lets a ready admitted glTF take over without a drawing gap. The Cockpit model cap remains 60 and can only lower the map budget; in-range contacts that are capped or still loading remain 2D silhouettes instead of degrading to out-of-range dots. Contacts outside the selected band use small rotation-free cyan-white pips for civilian aircraft and amber pips for military. The pilot's own airframe is not drawn in first person, and exiting clears the Cockpit band and restores normal map silhouettes/models. The normal left accordion remains available for Layers and Authoring and keeps the same 26vh HUD-aligned anchor used in map mode, independent of whether the bottom-left Contact card is expanded or collapsed; the right-rail CCTV and Context chooser are hidden to avoid duplicating or overlapping the cockpit presentation. When the intelligence HUD is enabled, its classification, scene summary, collection/orbit metadata, coordinates, and imaging-status text remain visible as reduced peripheral cockpit telemetry; the optical center and flight instruments stay clear, and turning the HUD off still hides it. Ground speed, exact heading, and rendered altitude form one compact lower-center instrument cluster, keeping the horizon and peripheral view open. A second live altitude tape hugs the inside-right visor rim: its rail and nine moving ticks are derived from the same responsive keyhole radius, remain 20 px inside the circular edge even on wide displays, fade deeply at both vertical ends, and move continuously behind a fixed current-altitude pointer; its interval tightens automatically near the surface and it is suppressed on narrow screens. Cockpit mode also has a weather-backed transparent volumetric-cloud pass derived from the supplied FBM/domain-warped R&D shader. It renders at no more than 520×320, uses 24 ray steps/three FBM octaves at 12 FPS, is clipped to the visor, fails clear when Open-Meteo is unavailable, and stops its animation completely on cockpit exit. It does not restore the prior CPU weather canvases, precipitation, scene fog, or any map-mode effect. When Contacts is active for the tracked aircraft, the compact `CONTACT` rail adds the 250 km subject window, four cohort counts, nearest observed/mapped example with relative bearing and distance, freshness, explicit uncertainty, and Previous and Next controls plus its own collapse control. The mirrored right rail is a three-page **cockpit briefing carousel**: source-backed live signals, location-matched regional headlines, and physical-region/current-weather context from bundled Natural Earth polygons and Open-Meteo. It is manual-first: Previous, Next, and direct page controls are always available, and the visible `CYCLE OFF` / `CYCLE ON` control starts or stops the nine-second page cycle. The cycle pauses on hover or keyboard focus and stops while collapsed, hidden, or outside cockpit mode; live signal data continues refreshing either way. Empty news matches and unavailable news use compact text states rather than reserving an empty media frame; partial local data remains explicit. Article links open their original publisher, and no headline is treated as verified risk intelligence. On desktop both cockpit rails use the same width and share a bottom-aligned safe baseline in opposite corners above the peripheral MGRS/GSD/time telemetry, leaving both that text and the lower-center instrument cluster readable. They collapse independently to slim tabs without stopping live data updates. Narrow screens use separated top/bottom fallbacks. Empty-space globe clicks are inert while cockpit owns the camera; `C`, `Escape`, or `EXIT COCKPIT` explicitly exits and restores the same tracked entity and standard follow camera. Unknown feeds remain unknown, selection loss still exits safely without inventing a replacement track, and the cockpit never presents the summary as threat scoring or an all-clear. This is a desktop first-person presentation, not a WebXR session. + it settles. Turning off the layer the view rides ends it. Riding an aircraft, + or a vessel from its bridge, while Contacts is on adopts its layer as the + user's own, as a direct selection does (`adoptLayerVisibility`), so Contacts + ending, by its own switch or one of its layers going off, restores the + pre-Contacts layers but keeps the ridden one and the view; Live Signals then + drops the rows Contacts built and shows `CONTEXT STANDBY`. The visible + Cockpit actions, double-click and voice use the same gate; voice entry still + opens Contacts first, as its layer-targeted entry navigates through Contacts. + The ship bridge and the orbital view have their own own-layer gates + (`bridgeEntryAllowed`, `orbitEntryAllowed`; see + [Ship bridge view](#ship-bridge-view) and [Orbital view](#orbital-view)). +- **Aircraft cockpit view:** selecting a commercial or military aircraft reveals a `COCKPIT` action once that aircraft's own layer is on; Contacts is not required. The action shows in Contacts (`#cockpit-entry`) and under the Intel HUD's bottom-right readout (`#cockpit-entry-readout`, with the HUD on, in its Tactical and Cyber layouts), so entry needs no Contacts panel. Turning off the ridden aircraft's layer ends the view (the layer clears its tracking). When an air feed the surrounding picture uses is off, the Cockpit says so instead of blocking: Live Signals leads with `MILITARY FEED OFF · PARTIAL PICTURE` or `FLIGHTS FEED OFF · PARTIAL PICTURE`, and the Contact card shows that line in place of its inputs status, so a partial picture is never presented as complete. `control_cockpit` refuses entry with `entryBlockedReason` `contacts-starting` (a Context change in flight), `subject-layer-off` (the aircraft's layer, or with none tracked any aircraft layer, is off) or `no-tracked-aircraft`. Cockpit mode temporarily releases Cesium's orbit-follow transform and drives a first-person camera from the tracked aircraft's existing smoothed display position and course. Its concave helmet-visor HUD shows callsign, UTC time, coordinates, curved roll/pitch guides, and a seven-division heading tape. Ambient commercial and military AIR contacts use a Cockpit near/far band selected by the shared Display 3D mode: Proximity admits at 150 km and retains to 185 km; All admits at 400 km and retains to 450 km. The shared 3D toggle now applies in Cockpit: Off keeps in-range contacts as rotating 2D aircraft silhouettes, while On lets a ready admitted glTF take over without a drawing gap. The Cockpit model cap remains 60 and can only lower the map budget; in-range contacts that are capped or still loading remain 2D silhouettes instead of degrading to out-of-range dots. Contacts outside the selected band use small rotation-free cyan-white pips for civilian aircraft and amber pips for military. The pilot's own airframe is not drawn in first person, and exiting clears the Cockpit band and restores normal map silhouettes/models. The normal left accordion remains available for Layers and Authoring and keeps the same 26vh HUD-aligned anchor used in map mode, independent of whether the bottom-left Contact card is expanded or collapsed; the right-rail CCTV and Context chooser are hidden to avoid duplicating or overlapping the cockpit presentation. When the intelligence HUD is enabled, its classification, scene summary, collection/orbit metadata, coordinates, and imaging-status text remain visible as reduced peripheral cockpit telemetry; the optical center and flight instruments stay clear, and turning the HUD off still hides it. Ground speed, exact heading, and rendered altitude form one compact lower-center instrument cluster, keeping the horizon and peripheral view open. A second live altitude tape hugs the inside-right visor rim: its rail and nine moving ticks are derived from the same responsive keyhole radius, remain 20 px inside the circular edge even on wide displays, fade deeply at both vertical ends, and move continuously behind a fixed current-altitude pointer; its interval tightens automatically near the surface and it is suppressed on narrow screens. Cockpit mode also has a weather-backed transparent volumetric-cloud pass derived from the supplied FBM/domain-warped R&D shader. It renders at no more than 520×320, uses 24 ray steps/three FBM octaves at 12 FPS, is clipped to the visor, fails clear when Open-Meteo is unavailable, and stops its animation completely on cockpit exit. It does not restore the prior CPU weather canvases, precipitation, scene fog, or any map-mode effect. When Contacts is active for the tracked aircraft, the compact `CONTACT` rail adds the 250 km subject window, four cohort counts, nearest observed/mapped example with relative bearing and distance, freshness, explicit uncertainty, and Previous and Next controls plus its own collapse control. The mirrored right rail is a three-page **cockpit briefing carousel**: source-backed live signals, location-matched regional headlines, and physical-region/current-weather context from bundled Natural Earth polygons and Open-Meteo. It is manual-first: Previous, Next, and direct page controls are always available, and the visible `CYCLE OFF` / `CYCLE ON` control starts or stops the nine-second page cycle. The cycle pauses on hover or keyboard focus and stops while collapsed, hidden, or outside cockpit mode; live signal data continues refreshing either way. Empty news matches and unavailable news use compact text states rather than reserving an empty media frame; partial local data remains explicit. Article links open their original publisher, and no headline is treated as verified risk intelligence. On desktop both cockpit rails use the same width and share a bottom-aligned safe baseline in opposite corners above the peripheral MGRS/GSD/time telemetry, leaving both that text and the lower-center instrument cluster readable. They collapse independently to slim tabs without stopping live data updates. Narrow screens use separated top/bottom fallbacks. Empty-space globe clicks are inert while cockpit owns the camera; `Escape` or `EXIT COCKPIT` explicitly exits and restores the same tracked entity and standard follow camera. Unknown feeds remain unknown, selection loss still exits safely without inventing a replacement track, and the cockpit never presents the summary as threat scoring or an all-clear. This is a desktop first-person presentation, not a WebXR session. - **Cockpit left-panel clearance:** the Cockpit Contact card and peripheral HUD participate in the adaptive left accordion's live obstacle measurements, including live viewport-height changes. Expanding Layers or Authoring keeps the active panel in the available upper-left corridor with internal scrolling; it does not cover the Contact card, lower Cockpit controls, or Cesium credit line. Outside Cockpit the hidden card does not alter the normal corridor. - **Cockpit Context scope:** the 250 km radius applies to the air/sea proximity cohorts. Installation counts come only from the currently loaded viewport and are labeled `CURRENT VIEWPORT ONLY` in the cockpit as well as the normal Context panel; neither surface presents them as a complete 250 km installation survey. - **Cockpit camera anchor:** first-person mode does not write feed-boundary corrections directly into the camera. A cockpit-only inertial anchor advances from the selected aircraft's displayed course and speed, then converges toward the authoritative delayed track with correction capped below forward motion. The displayed kinematics are derived from the same consecutive fix segment as the rendered position, with raw feed speed/course used only as fallback; a transient zero/missing feed speed therefore cannot freeze a visibly moving aircraft after layer enable or a map/cockpit handoff. Rendered altitude continues to come from that interpolated track position. Late ADS-B fixes and short render stalls can remove drift without accelerating or reversing the view. Camera placement runs before scene update/culling at a bounded 20 Hz so a moving cockpit does not force Photoreal 3D Tiles to retraverse on every display frame; textual instruments update at 10 Hz and context/layout work at 4 Hz. Every far Cockpit contact pip shares one stable Cesium texture-atlas entry and skips unused screen-projected course calculations, while only in-range 2D aircraft silhouettes pay the screen-projected rotation cost; ambient glTF collections are hidden/retained rather than synchronously destroyed at cockpit entry, and context rails lay out only on explicit content/state changes and viewport resize. The deliberate 15/30-second layer interpolation delays and per-Cesium-frame position caches remain unchanged. -- **Cockpit route, vision, and view controls:** visible on-screen `COCKPIT`, `RESET`, and `EXIT COCKPIT` controls replace reliance on the `C` shortcut. RESET uses the same canonical globe route as the map and voice actions, exits Cockpit, and releases its camera ownership rather than exposing the hidden map-style top action. When the tracked commercial flight has a plausible ADSBDB route, the top of the right briefing rail shows a compact `FROM → TO` airport strip and the visor shows a centered estimated-destination chevron with its relative bearing; its destination label rounds to whole degrees in 000–359, wrapping rounded north to 000° while the chevron continues to use the relative bearing independently of label rounding; absent or implausible route data hides the strip and cue rather than guessing. The cockpit-local vision control is an interactive `PREV / CURRENT / NEXT` carousel over `NORMAL`, `CRT`, `NVG`, `FLIR`, `ANIME`, and `NOIR`; its previous/next actions wrap, and activating the current value advances to the next style. Cockpit enters on the active map preset, so a Cyber FLIR map opens Cockpit on FLIR while Normal remains a distinct option instead of producing a second FLIR entry. Cockpit choices temporarily activate the existing Cesium post-process stages, while exiting Cockpit through either EXIT or RESET restores the pre-entry map style. The regional-news page uses a free Google News RSS locality query first, with the existing GDELT query retained only as a fail-soft fallback; linked headlines remain reporting, not verified incidents or risk intelligence. +- **Cockpit route, vision, and view controls:** visible on-screen `COCKPIT`, `RESET`, and `EXIT COCKPIT` controls are the way in and out; Cockpit claims no `C` shortcut, so `C` keeps toggling CCTV, also inside a first-person view. RESET uses the same canonical globe route as the map and voice actions, exits Cockpit, and releases its camera ownership rather than exposing the hidden map-style top action. When the tracked commercial flight has a plausible ADSBDB route, the top of the right briefing rail shows a compact `FROM → TO` airport strip and the visor shows a centered estimated-destination chevron with its relative bearing; its destination label rounds to whole degrees in 000–359, wrapping rounded north to 000° while the chevron continues to use the relative bearing independently of label rounding; absent or implausible route data hides the strip and cue rather than guessing. The cockpit-local vision control is an interactive `PREV / CURRENT / NEXT` carousel over `NORMAL`, `CRT`, `NVG`, `FLIR`, `ANIME`, and `NOIR`; its previous/next actions wrap, and activating the current value advances to the next style. Cockpit enters on the active map preset, so a Cyber FLIR map opens Cockpit on FLIR while Normal remains a distinct option instead of producing a second FLIR entry. Cockpit choices temporarily activate the existing Cesium post-process stages, while exiting Cockpit through either EXIT or RESET restores the pre-entry map style. The regional-news page uses a free Google News RSS locality query first, with the existing GDELT query retained only as a fail-soft fallback; linked headlines remain reporting, not verified incidents or risk intelligence. - Cockpit wind-direction labels wrap after rounding to whole degrees, so a direction of 359.5° displays as `N · 0°` rather than `N · 360°`. - The transit, ALPR, vessel, CCTV, Local ADS-B, flight and military context, awareness, Cockpit and Street Level heading readouts round through `roundHeadingDegrees` in `src/data/headingDegrees.js` (whole degrees 0–359, `null` when not finite, so each caller keeps its own placeholder); `normalizeHeading` lives there too and `cockpitMath.js` re-exports it. The Cockpit's `TRACK ACQUIRED` signal uses `formatHeadingReadout`, so a 359.6° track reads `COURSE 000°`. - **Cockpit missing observations:** missing local weather observations remain unknown rather than being converted to zero or clear skies, in the briefing and in the cloud effects; a missing temperature drops the whole local weather record, including its wind and condition. diff --git a/index.html b/index.html index cc773b4d6..291b99708 100644 --- a/index.html +++ b/index.html @@ -26,7 +26,7 @@ with the sources: src/materialSymbolsSubset.test.mjs fails when a source names a glyph this list is missing, because a missing glyph does not draw a box — the ligature never forms and the element renders the literal word. --> - +
diff --git a/package-lock.json b/package-lock.json index dd60d3383..87c2cb80b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,6 +15,7 @@ "@meri-imperiumi/eccodes-wasm": "^2.48.2", "cesium": "^1.124.0", "egm96-universal": "^1.1.1", + "flag-icons": "7.5.0", "hls.js": "^1.7.3", "mapillary-js": "^4.1.2", "mgrs": "^2.1.0", @@ -2411,6 +2412,12 @@ } } }, + "node_modules/flag-icons": { + "version": "7.5.0", + "resolved": "https://registry.npmjs.org/flag-icons/-/flag-icons-7.5.0.tgz", + "integrity": "sha512-kd+MNXviFIg5hijH766tt+3x76ele1AXlo4zDdCxIvqWZhKt4T83bOtxUOOMlTx/EcFdUMH5yvQgYlFh1EqqFg==", + "license": "MIT" + }, "node_modules/fresh": { "version": "0.5.2", "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", diff --git a/package.json b/package.json index ca9112cd5..3d107667a 100644 --- a/package.json +++ b/package.json @@ -63,6 +63,7 @@ "@meri-imperiumi/eccodes-wasm": "^2.48.2", "cesium": "^1.124.0", "egm96-universal": "^1.1.1", + "flag-icons": "7.5.0", "hls.js": "^1.7.3", "mapillary-js": "^4.1.2", "mgrs": "^2.1.0", diff --git a/scripts/build-admin-packs.mjs b/scripts/build-admin-packs.mjs index d7f647384..9fe319ee0 100644 --- a/scripts/build-admin-packs.mjs +++ b/scripts/build-admin-packs.mjs @@ -7,13 +7,16 @@ * Natural Earth 10m admin-1 states and provinces (public domain). * src/data/local_data/us_census_counties/counties.json * US Census Bureau cartographic boundary counties (public domain). + * src/data/local_data/natural_earth/populated_places.json + * Natural Earth 10m populated places as points, for the orbital view's + * "near " (`src/data/placeBelow.js`; public domain). * * Both sources are pinned by URL and SHA-256, so a rerun reproduces the packs * byte for byte. Downloads are cached outside the repository (default: the * system temp directory) and are never committed. * * Usage: - * node scripts/build-admin-packs.mjs [--cache ] [--only countries|admin1|counties] + * node scripts/build-admin-packs.mjs [--cache ] [--only countries|admin1|counties|places] * * The provenance READMEs beside each pack record these parameters. */ @@ -101,6 +104,9 @@ export const PARAMS = Object.freeze({ elsewhereMinPopulation: 50_000, cityStateMaxKm2: 1_000, }, + // Every populated place, kept as a point: name, position and the two + // prominence ranks the orbital view picks "near " by. + places: { decimals: 3 }, }); const args = process.argv.slice(2); @@ -688,6 +694,47 @@ async function buildAdmin1() { }; } +async function buildPlaces() { + const params = PARAMS.places; + const source = await fetchPinned('places'); + const factor = 10 ** params.decimals; + const round = (value) => Math.round(value * factor) / factor; + const places = JSON.parse(source.bytes.toString('utf8')) + .features.map((f) => f.properties) + .filter( + (p) => + p.name && + Number.isFinite(p.latitude) && + Number.isFinite(p.longitude) && + Number.isFinite(p.scalerank), + ) + .map((p) => [ + p.name, + round(p.latitude), + round(p.longitude), + p.scalerank, + Number.isFinite(p.rank_max) ? p.rank_max : 0, + ]) + .sort((a, b) => a[3] - b[3] || b[4] - a[4] || a[0].localeCompare(b[0])); + return { + meta: { + title: 'Natural Earth populated places', + source: 'ne_10m_populated_places_simple', + url: SOURCES.places.url, + sha256: source.digest, + commit: NE_COMMIT, + license: + 'Public domain (https://www.naturalearthdata.com/about/terms-of-use/)', + schema: + 'places[]: [name, latitude, longitude, scalerank (0 most prominent .. 10), rank_max (population class, 0..14; higher is larger)]', + decimals: params.decimals, + curation: params, + script: 'scripts/build-admin-packs.mjs', + }, + places, + }; +} + async function buildCounties() { const params = PARAMS.counties; const source = await fetchPinned('counties'); @@ -768,4 +815,13 @@ if (isMain) { 'src/data/local_data/us_census_counties/counties.json', await buildCounties(), ); + if (!only || only === 'places') { + const relative = 'src/data/local_data/natural_earth/populated_places.json'; + const pack = await buildPlaces(); + const text = JSON.stringify(pack) + '\n'; + await writeFile(path.join(ROOT, relative), text); + console.log( + `${relative}: ${pack.places.length} places, ${Buffer.byteLength(text)} bytes`, + ); + } } diff --git a/scripts/build-ucs-satellites.py b/scripts/build-ucs-satellites.py new file mode 100644 index 000000000..86fc9063e --- /dev/null +++ b/scripts/build-ucs-satellites.py @@ -0,0 +1,118 @@ +#!/usr/bin/env python3 +'''Maintainer-only UCS Satellite Database pack build (openpyxl). + +Reads the UCS Excel release and writes the compact pack the satellites layer +loads: one row per satellite, keyed by NORAD number, with string-table indexes +for the repeated text columns. Starlink rows are left out: the layer files +every STARLINK object under its own class and operator without them. + +Usage: python scripts/build-ucs-satellites.py "/UCS-Satellite-Database 5-1-2023.xlsx" +''' +import argparse +import json +import logging +from pathlib import Path +import re + +import openpyxl + +LOG = logging.getLogger('build-ucs-satellites') + +ROOT = Path(__file__).resolve().parent.parent +PACK = ROOT / 'src/data/local_data/ucs_satellites' +VERSION = 'UCS-Satellite-Database 5-1-2023' +DATA_CURRENT_TO = '2023-05-01' +URL = 'https://www.ucsusa.org/satellite_database' + +# Output column -> spreadsheet header. +COLUMNS = { + 'operator': 'Operator/Owner', + 'operatorCountry': 'Country of Operator/Owner', + 'purpose': 'Purpose', +} +STARLINK = re.compile(r'\bstarlink\b', re.I) + + +def clean(value: object) -> str: + '''One cell as tidy text; UCS's placeholders for nothing become ''.''' + text = re.sub(r'\s+', ' ', str(value or '')).strip() + return '' if text.lower() in ('', 'none', 'n/a') else text + + +def build(xlsx: Path) -> dict: + '''Read the release's first sheet into the pack the layer loads.''' + sheet = openpyxl.load_workbook(xlsx, read_only=True, data_only=True).worksheets[0] + rows = sheet.iter_rows(values_only=True) + header = {str(h).strip(): i for i, h in enumerate(next(rows)) if h} + names = [header['Current Official Name of Satellite'], header['Name of Satellite, Alternate Names']] + norad_col = header['NORAD Number'] + tables = {key: [''] for key in COLUMNS} + index = {key: {'': 0} for key in COLUMNS} + records = {} + source_rows = skipped_starlink = invalid_norad = 0 + for row in rows: + if not any(row): + continue + source_rows += 1 + if any(STARLINK.search(clean(row[i])) for i in names): + skipped_starlink += 1 + continue + try: + norad = int(float(row[norad_col])) + except (TypeError, ValueError): + invalid_norad += 1 + continue + if norad <= 0: + invalid_norad += 1 + continue + record = [norad] + for key, column in COLUMNS.items(): + text = clean(row[header[column]]) + if text not in index[key]: + index[key][text] = len(tables[key]) + tables[key].append(text) + record.append(index[key][text]) + # A duplicate NORAD number keeps the first row, as UCS lists it. + records.setdefault(norad, record) + ordered = [records[n] for n in sorted(records)] + return { + 'meta': { + 'source': 'Union of Concerned Scientists Satellite Database', + 'version': VERSION, + 'url': URL, + 'dataCurrentTo': DATA_CURRENT_TO, + 'license': 'Free, unrestricted use; acknowledgement requested (UCS database manual, section 3)', + 'curation': { + 'sourceRows': source_rows, + 'starlinkRowsDropped': skipped_starlink, + 'invalidNoradDropped': invalid_norad, + 'duplicateNoradDropped': source_rows - skipped_starlink - invalid_norad - len(ordered), + 'columns': COLUMNS, + }, + 'recordCount': len(ordered), + }, + 'fields': ['noradId', *COLUMNS], + 'strings': tables, + 'records': ordered, + } + + +def main() -> None: + '''Build the pack from the release given on the command line.''' + logging.basicConfig(level=logging.INFO, format='%(message)s') + parser = argparse.ArgumentParser(description='Build the UCS satellite pack from the UCS Excel release.') + parser.add_argument('xlsx', type=Path, help='UCS-Satellite-Database .xlsx') + pack = build(parser.parse_args().xlsx) + PACK.mkdir(parents=True, exist_ok=True) + out = PACK / 'ucs_satellites.json' + # LF on every platform: the repository stores text with LF endings. + out.write_text( + json.dumps(pack, ensure_ascii=False, separators=(',', ':')) + '\n', + encoding='utf-8', + newline='\n', + ) + LOG.info('%s: %d records, %d bytes', out.relative_to(ROOT), pack['meta']['recordCount'], out.stat().st_size) + + +if __name__ == '__main__': + main() diff --git a/scripts/check-package-boundaries.mjs b/scripts/check-package-boundaries.mjs index 700dc9a1a..ad5d2bdb2 100644 --- a/scripts/check-package-boundaries.mjs +++ b/scripts/check-package-boundaries.mjs @@ -109,7 +109,14 @@ export async function checkPackageBoundaries(root) { // template blocks belong to the component file itself. if (info.id.startsWith('\0')) return; const id = info.id.split('?')[0]; - if (!allowed.has(id)) { + // A declared dependency also owns the asset files it ships (a + // flag-icons SVG imported as a URL) that a glob resolves in place. + const dependencyAsset = group.external.some((external) => + id.startsWith( + `${normalizePath(path.join(root, 'node_modules', external))}/`, + ), + ); + if (!allowed.has(id) && !dependencyAsset) { throw new Error( `Package boundary ${name} imports an unowned module: ${path.relative(root, id)}`, ); diff --git a/scripts/format-scope.json b/scripts/format-scope.json index b23ab75b0..0451fb3fa 100644 --- a/scripts/format-scope.json +++ b/scripts/format-scope.json @@ -328,6 +328,12 @@ "src/ui/styles/responsive.css", "src/ui/styles/voice-cost.css", "src/ui/styles/cockpit.css", + "src/ui/styles/cockpitBridge.css", + "src/ui/styles/cockpitRadar.css", + "src/ui/styles/cockpitOrbital.css", + "src/layers/satellites/sensors.js", + "src/layers/satellites/sensors.test.mjs", + "src/data/imagingSensors.js", "src/ui/styles/command-dock-compact.css", "src/app/stateChannel.js", "src/app/stateChannel.test.mjs", diff --git a/scripts/package-boundaries.json b/scripts/package-boundaries.json index 517265ef7..829d0713c 100644 --- a/scripts/package-boundaries.json +++ b/scripts/package-boundaries.json @@ -39,6 +39,9 @@ "src/ui/views/panels/CockpitBriefing.vue", "src/ui/views/panels/CockpitContext.vue", "src/ui/views/panels/CockpitRoute.vue", + "src/ui/views/panels/CockpitRadar.vue", + "src/ui/views/panels/CockpitOrbital.vue", + "src/ui/ownerFlag.js", "src/ui/cockpitPresentation.js", "src/data/headingDegrees.js", "src/data/distanceFormat.js", @@ -161,7 +164,7 @@ "src/ui/views/panels/WorldTimeline.vue", "src/ui/surfaceKeyboard.js" ], - "external": ["vue", "pinia", "vue-i18n"] + "external": ["vue", "pinia", "vue-i18n", "flag-icons"] }, "time": { "exports": ["./time"], @@ -899,6 +902,19 @@ "src/ui/cockpitInstrumentState.js", "src/ui/cockpitRollingValue.js", "src/ui/cockpitCamera.js", + "src/ui/cockpitOrbitalView.js", + "src/ui/cockpitOrbitalFocus.js", + "src/ui/cockpitOrbitalSignals.js", + "src/ui/cockpitOrbitalSatellites.js", + "src/cockpitOrbitalSatellites.js", + "src/layers/installations/classLabel.js", + "src/data/installationNames.js", + "src/i18n/marker.js", + "src/data/placeBelow.js", + "src/layers/satellites/sensors.js", + "src/data/adminBoundaries.js", + "src/data/bundledJson.js", + "src/data/retryableLoad.js", "src/ui/cockpitContext.js", "src/ui/cockpitController.js", "src/ui/cockpitDisplayPortal.js", @@ -913,6 +929,13 @@ "src/cockpitMath.js", "src/cockpitUtilityLayout.js", "src/cockpitVisionPolicy.js", + "src/cockpitSubjects.js", + "src/cockpitRadar.js", + "src/cockpitLook.js", + "src/cockpitOrbital.js", + "src/cockpitOrbitalFocus.js", + "src/geoDistance.js", + "src/data/motionModel.js", "src/ui/panelRailGeometry.js", "src/i18n/index.js", "src/i18n/locale.js", @@ -981,6 +1004,13 @@ "src/cockpitTracking.js", "src/cockpitUtilityLayout.js", "src/cockpitVisionPolicy.js", + "src/cockpitSubjects.js", + "src/cockpitRadar.js", + "src/cockpitLook.js", + "src/cockpitOrbital.js", + "src/cockpitOrbitalFocus.js", + "src/geoDistance.js", + "src/data/motionModel.js", "src/contactsDetectionPolicy.js", "src/contextModePolicy.js", "src/data/detectionPolicy.js", @@ -988,6 +1018,7 @@ "src/data/idSwitches.js", "src/data/firmsIntensity.js", "src/data/layerState.js", + "src/data/satelliteClassMask.js", "src/data/layerStateCoordinator.js", "src/data/layerStateTokenReservations.json", "src/data/militaryAwarenessEngine.js", @@ -1030,6 +1061,17 @@ "src/ui/cockpitInstrumentState.js", "src/ui/cockpitRollingValue.js", "src/ui/cockpitCamera.js", + "src/ui/cockpitOrbitalView.js", + "src/ui/cockpitOrbitalFocus.js", + "src/ui/cockpitOrbitalSignals.js", + "src/ui/cockpitOrbitalSatellites.js", + "src/cockpitOrbitalSatellites.js", + "src/layers/installations/classLabel.js", + "src/data/placeBelow.js", + "src/layers/satellites/sensors.js", + "src/data/adminBoundaries.js", + "src/data/bundledJson.js", + "src/data/retryableLoad.js", "src/ui/cockpitContext.js", "src/ui/cockpitController.js", "src/ui/cockpitDisplayPortal.js", @@ -1210,6 +1252,8 @@ "src/ui/styles/location.css", "src/ui/styles/status.css", "src/ui/styles/cockpit.css", + "src/ui/styles/cockpitBridge.css", + "src/ui/styles/cockpitRadar.css", "src/ui/styles/overlays.css", "src/ui/styles/layers.css", "src/ui/styles/radio.css", @@ -1368,6 +1412,7 @@ "src/data/idSwitches.js", "src/data/firmsIntensity.js", "src/data/layerState.js", + "src/data/satelliteClassMask.js", "src/data/layerStateTokenReservations.json", "src/data/modelVisualAnchor.js", "src/data/aircraftModelLighting.js", @@ -1433,6 +1478,7 @@ "src/data/idSwitches.js", "src/data/firmsIntensity.js", "src/data/layerState.js", + "src/data/satelliteClassMask.js", "src/data/layerStateTokenReservations.json", "src/data/modelVisualAnchor.js", "src/data/aircraftModelLighting.js", @@ -1489,6 +1535,7 @@ "src/data/idSwitches.js", "src/data/firmsIntensity.js", "src/data/layerState.js", + "src/data/satelliteClassMask.js", "src/data/layerStateCoordinator.js", "src/data/layerStateTokenReservations.json", "src/data/modelVisualAnchor.js", @@ -1529,6 +1576,8 @@ "src/layers/vessels/records.js", "src/layers/vessels/recordPolicy.js", "src/layers/vessels/snapshotRenderer.js", + "src/layers/vessels/cockpitSubject.js", + "src/geoDistance.js", "src/data/inputOwnership.js", "src/i18n/index.js", "src/i18n/locale.js", @@ -1628,9 +1677,11 @@ "exports": ["./layers/satellites"], "modules": [ "src/data/satelliteClass.js", + "src/data/satelliteClassMask.js", "src/data/satellitePass.js", "src/sources/tle.js", "src/layers/satellites/catalog.js", + "src/layers/satellites/cockpitSubject.js", "src/layers/satellites/controls.js", "src/layers/satellites/index.js", "src/layers/satellites/ingestion.js", @@ -1660,6 +1711,12 @@ "src/i18n/locales/zh-CN.json", "src/i18n/locales/zh-Hant.json", "src/ui/unitLabels.js", + "src/layers/satellites/classes.js", + "src/layers/satellites/sensors.js", + "src/data/ucsSatellites.js", + "src/data/imagingSensors.js", + "src/data/bundledJson.js", + "src/data/retryableLoad.js", "src/time/worldClock.js" ], "external": ["cesium", "satellite.js"] @@ -2075,6 +2132,7 @@ "src/data/idSwitches.js", "src/data/firmsIntensity.js", "src/data/layerState.js", + "src/data/satelliteClassMask.js", "src/data/layerStateTokenReservations.json", "src/data/radioCountry.js", "src/layers/radio/catalogModel.js", @@ -2400,6 +2458,11 @@ "src/cockpitTracking.js", "src/cockpitUtilityLayout.js", "src/cockpitVisionPolicy.js", + "src/cockpitSubjects.js", + "src/cockpitRadar.js", + "src/cockpitLook.js", + "src/cockpitOrbital.js", + "src/cockpitOrbitalFocus.js", "src/contactsDetectionPolicy.js", "src/contextModePolicy.js", "src/creditKeyboard.js", @@ -2464,6 +2527,7 @@ "src/data/labelArbiter.js", "src/data/idSwitches.js", "src/data/layerState.js", + "src/data/satelliteClassMask.js", "src/data/layerStateCoordinator.js", "src/data/layerStateTokenReservations.json", "src/data/lifecycle.js", @@ -2693,6 +2757,7 @@ "src/layers/radio/tuningNoise.js", "src/layers/radio/volume.js", "src/layers/satellites/catalog.js", + "src/layers/satellites/cockpitSubject.js", "src/layers/satellites/controls.js", "src/layers/satellites/index.js", "src/layers/satellites/ingestion.js", @@ -2842,6 +2907,12 @@ "src/ui/cockpitInstrumentState.js", "src/ui/cockpitRollingValue.js", "src/ui/cockpitCamera.js", + "src/ui/cockpitOrbitalView.js", + "src/ui/cockpitOrbitalFocus.js", + "src/ui/cockpitOrbitalSignals.js", + "src/ui/cockpitOrbitalSatellites.js", + "src/cockpitOrbitalSatellites.js", + "src/data/placeBelow.js", "src/ui/cockpitContext.js", "src/ui/cockpitController.js", "src/ui/cockpitDisplayPortal.js", @@ -2961,6 +3032,7 @@ "src/layers/vessels/records.js", "src/layers/vessels/recordPolicy.js", "src/layers/vessels/snapshotRenderer.js", + "src/layers/vessels/cockpitSubject.js", "src/data/inputOwnership.js", "src/annotations/drawMarks.js", "src/annotations/drawMode.js", @@ -3349,7 +3421,11 @@ "src/ui/wildlifeSightingPlacement.js", "src/overlays/worldOverlayChrome.js", "src/layers/wildlifeSightings/photoText.js", - "src/layers/wildlifeSightings/performance.js" + "src/layers/wildlifeSightings/performance.js", + "src/layers/satellites/classes.js", + "src/layers/satellites/sensors.js", + "src/data/ucsSatellites.js", + "src/data/imagingSensors.js" ], "external": [ "hls.js", @@ -3461,6 +3537,7 @@ "src/data/labelArbiter.js", "src/data/idSwitches.js", "src/data/layerState.js", + "src/data/satelliteClassMask.js", "src/data/layerStateTokenReservations.json", "src/data/localGeojsonCore.js", "src/data/localGeojsonLod.js", @@ -3662,6 +3739,7 @@ "src/layers/radio/tuningNoise.js", "src/layers/radio/volume.js", "src/layers/satellites/catalog.js", + "src/layers/satellites/cockpitSubject.js", "src/layers/satellites/controls.js", "src/layers/satellites/index.js", "src/layers/satellites/ingestion.js", @@ -3749,6 +3827,7 @@ "src/layers/vessels/records.js", "src/layers/vessels/recordPolicy.js", "src/layers/vessels/snapshotRenderer.js", + "src/layers/vessels/cockpitSubject.js", "src/data/inputOwnership.js", "src/annotations/worldAnnotationRenderer.js", "src/cameraGroundGuard.js", @@ -4001,7 +4080,11 @@ "src/layers/wildlifeSightings/sprites.js", "src/overlays/worldOverlayChrome.js", "src/layers/wildlifeSightings/photoText.js", - "src/layers/wildlifeSightings/performance.js" + "src/layers/wildlifeSightings/performance.js", + "src/layers/satellites/classes.js", + "src/layers/satellites/sensors.js", + "src/data/ucsSatellites.js", + "src/data/imagingSensors.js" ], "external": [ "hls.js", @@ -4135,6 +4218,7 @@ "src/data/idSwitches.js", "src/data/firmsIntensity.js", "src/data/layerState.js", + "src/data/satelliteClassMask.js", "src/data/layerStateCoordinator.js", "src/data/layerStateTokenReservations.json", "src/loadingFeedback.js", @@ -4168,6 +4252,14 @@ "src/ui/radioPanelPlacement.js", "src/bloom.js", "src/cockpitVisionPolicy.js", + "src/cockpitSubjects.js", + "src/cockpitRadar.js", + "src/cockpitLook.js", + "src/cockpitOrbital.js", + "src/cockpitOrbitalFocus.js", + "src/cockpitOrbitalSatellites.js", + "src/geoDistance.js", + "src/data/motionModel.js", "src/contactsDetectionPolicy.js", "src/data/detectionPolicy.js", "src/styles/anime.js", @@ -4499,7 +4591,15 @@ }, "satellites-source": { "exports": ["./layers/satellites/source"], - "modules": ["src/layers/satellites/source.js"], + "modules": [ + "src/layers/satellites/source.js", + "src/layers/satellites/classes.js", + "src/layers/satellites/sensors.js", + "src/data/ucsSatellites.js", + "src/data/imagingSensors.js", + "src/data/bundledJson.js", + "src/data/retryableLoad.js" + ], "external": [] }, "traffic-source-factory": { @@ -4870,6 +4970,7 @@ "src/view/index.js", "src/data/firmsIntensity.js", "src/data/layerState.js", + "src/data/satelliteClassMask.js", "src/data/layerStateTokenReservations.json", "src/data/idSwitches.js", "src/data/detectionPolicy.js", @@ -4996,6 +5097,7 @@ "src/data/idSwitches.js", "src/data/vesselTypes.js", "src/data/layerState.js", + "src/data/satelliteClassMask.js", "src/data/layerStateTokenReservations.json", "src/sources/gbfsStations.js", "src/sources/tle.js", @@ -5119,7 +5221,11 @@ "src/layers/alpr/records.js", "src/layers/alpr/tileRecords.js", "src/sources/infrastructureData.js", - "src/sources/eventPacks.js" + "src/sources/eventPacks.js", + "src/layers/satellites/classes.js", + "src/layers/satellites/sensors.js", + "src/data/ucsSatellites.js", + "src/data/imagingSensors.js" ], "external": ["@mapbox/vector-tile", "pbf"] }, @@ -5130,6 +5236,7 @@ "src/data/idSwitches.js", "src/data/firmsIntensity.js", "src/data/layerState.js", + "src/data/satelliteClassMask.js", "src/data/layerStateTokenReservations.json", "src/visualStylePolicy.js" ], diff --git a/scripts/track-regression.mjs b/scripts/track-regression.mjs index e00dadfc3..16c345db5 100644 --- a/scripts/track-regression.mjs +++ b/scripts/track-regression.mjs @@ -409,6 +409,15 @@ async function main() { status: 'ready', })); } + // CelesTrak SATCAT, which the satellite classes read beside the TLEs. + // An empty CSV (header only) keeps the run hermetic: the classes fall + // back to names and groups, as they do when SATCAT is unavailable. + if (isAppRequest && url.pathname.startsWith('/api/celestrak-satcat/')) { + return Promise.resolve(new Response( + 'OBJECT_NAME,OBJECT_ID,NORAD_CAT_ID,OBJECT_TYPE,OPS_STATUS_CODE,LAUNCH_DATE\n', + { status: 200, headers: { 'Content-Type': 'text/csv' } }, + )); + } // CelesTrak TLE groups. Served from a fixed two-satellite catalog so // the satellite assertions are deterministic and the run never depends // on an upstream that rate-limits (it was answering 403 the night this diff --git a/server/providers/space/celestrak.js b/server/providers/space/celestrak.js index 013fce1b1..9845da26e 100644 --- a/server/providers/space/celestrak.js +++ b/server/providers/space/celestrak.js @@ -1,6 +1,9 @@ import path from 'node:path'; import { promises as fsp } from 'node:fs'; -import { celestrakTleUrl } from '../../../src/data/spaceProviderRequests.js'; +import { + celestrakSatcatUrl, + celestrakTleUrl, +} from '../../../src/data/spaceProviderRequests.js'; import { providerCooldownMs } from './cooldown.js'; import { admitSameSiteKeyless } from '../common/same-site.js'; import { readResponseTextCapped } from '../common/http.js'; @@ -22,84 +25,131 @@ import { readResponseTextCapped } from '../common/http.js'; * 6 h; on upstream failure the freshest stale copy is served (a stale TLE * beats an empty satellites layer). Pattern mirrors openSkyProxy's * cache+serve-stale. Adapted from skylight's TleStore (MIT). + * + * The same plugin serves CelesTrak SATCAT records for the satellites layer's + * groups at `/api/celestrak-satcat/` (object type, operational status + * and owner, which file each object under a class). The catalog changes + * slowly, so SATCAT is cached for a day. CelesTrak throttles the client, not + * the endpoint, so a 403 or 429 holds both routes off; any other failure + * holds off only the route that failed, so a bad SATCAT answer never stops + * TLE refreshes. */ export function celestrakProxy() { const TLE_TTL_MS = 6 * 3600_000; + const SATCAT_TTL_MS = 24 * 3600_000; const CACHE_DIR = path.join(process.cwd(), '.gev-cache'); - const groups = new Set([ + /** The satellites layer's core groups (src/layers/satellites/policy.js). */ + const coreGroups = [ 'stations', 'visual', 'gps-ops', 'glo-ops', 'galileo', 'geo', - 'starlink', - // Space Missions (`getActiveTle`) reads the full active catalog. - 'active', - ]); - let cooldownUntil = 0; - const mem = new Map(); // group -> { at: epochMs, body: string } - const inflight = new Map(); // group -> Promise<{at, body}|null> - - const diskPath = (group) => path.join(CACHE_DIR, `celestrak-${group}.json`); - - async function readDisk(group) { - try { - const parsed = JSON.parse(await fsp.readFile(diskPath(group), 'utf8')); - if (typeof parsed?.body === 'string' && Number.isFinite(parsed?.at)) - return parsed; - } catch { - /* no disk cache yet */ - } - return null; - } - - async function writeDisk(group, entry) { - try { - await fsp.mkdir(CACHE_DIR, { recursive: true }); - await fsp.writeFile(diskPath(group), JSON.stringify(entry), 'utf8'); - } catch (err) { - console.warn('[celestrak-proxy] cache write failed'); - } - } + 'resource', + 'weather', + 'planet', + 'sar', + 'science', + ]; + const feeds = [ + { + route: '/api/celestrak', + ttlMs: TLE_TTL_MS, + cacheHeader: 'x-tle-cache', + cachedAtHeader: 'X-TLE-Cached-At', + diskName: (group) => `celestrak-${group}.json`, + upstreamUrl: celestrakTleUrl, + groups: new Set([ + ...coreGroups, + 'starlink', + // Space Missions (`getActiveTle`) reads the full active catalog. + 'active', + ]), + // An upstream error page parses to zero TLEs — treat as failure, keep cache. + validate: (body) => /^1 /m.test(body), + invalid: 'no TLE lines in response', + }, + { + route: '/api/celestrak-satcat', + ttlMs: SATCAT_TTL_MS, + cacheHeader: 'x-satcat-cache', + cachedAtHeader: 'X-SATCAT-Cached-At', + diskName: (group) => `celestrak-satcat-${group}.json`, + upstreamUrl: celestrakSatcatUrl, + groups: new Set(coreGroups), + // A real answer, even for an empty group, starts with the CSV header. + validate: (body) => /^OBJECT_NAME,/.test(body), + invalid: 'no SATCAT header in response', + }, + ]; + // CelesTrak throttling (403/429) is per client, so it holds every feed + // off; any other failure holds off only the feed that failed, so a bad + // SATCAT answer never blocks the TLEs the layer cannot do without. + let hostCooldownUntil = 0; /** The largest group (`active`) measures ~2.7 MB; this bounds a runaway body. */ const CELESTRAK_MAX_RESPONSE_BYTES = 16 * 1024 * 1024; - async function fetchUpstream(group) { - const url = celestrakTleUrl(group); - const signal = AbortSignal.timeout(20000); - const res = await fetch(url.toString(), { - signal, - // CelesTrak 403s bulk groups (e.g. `active`) unless the request carries a - // descriptive User-Agent with a contact point. - headers: { - 'User-Agent': - 'gods-eye-view-celestrak-proxy/1.0 (+https://github.com/bilawalsidhu/gods-eye-view)', - }, - }); - if (!res.ok) { - // Group refreshes run in parallel: a later failure without Retry-After - // must never shorten a longer deadline an earlier one already set. - cooldownUntil = Math.max( - cooldownUntil, - Date.now() + providerCooldownMs(res), - ); - void res.body?.cancel().catch(() => {}); - throw new Error(`HTTP ${res.status}`); - } - const body = await readResponseTextCapped( - res, - CELESTRAK_MAX_RESPONSE_BYTES, - signal, - ); - // An upstream error page parses to zero TLEs — treat as failure, keep cache. - if (!/^1 /m.test(body)) throw new Error('no TLE lines in response'); - return { at: Date.now(), body }; - } + function createFeedHandler(feed) { + let feedCooldownUntil = 0; + const cooldownUntil = () => Math.max(hostCooldownUntil, feedCooldownUntil); + const mem = new Map(); // group -> { at: epochMs, body: string } + const inflight = new Map(); // group -> Promise<{at, body}|null> + const diskPath = (group) => path.join(CACHE_DIR, feed.diskName(group)); - const installMiddleware = (server) => { - server.middlewares.use('/api/celestrak', async (req, res) => { + async function readDisk(group) { + try { + const parsed = JSON.parse(await fsp.readFile(diskPath(group), 'utf8')); + if (typeof parsed?.body === 'string' && Number.isFinite(parsed?.at)) + return parsed; + } catch { + /* no disk cache yet */ + } + return null; + } + + async function writeDisk(group, entry) { + try { + await fsp.mkdir(CACHE_DIR, { recursive: true }); + await fsp.writeFile(diskPath(group), JSON.stringify(entry), 'utf8'); + } catch (err) { + console.warn('[celestrak-proxy] cache write failed'); + } + } + + async function fetchUpstream(group) { + const url = feed.upstreamUrl(group); + const signal = AbortSignal.timeout(20000); + const res = await fetch(url.toString(), { + signal, + // CelesTrak 403s bulk groups (e.g. `active`) unless the request carries a + // descriptive User-Agent with a contact point. + headers: { + 'User-Agent': + 'gods-eye-view-celestrak-proxy/1.0 (+https://github.com/bilawalsidhu/gods-eye-view)', + }, + }); + if (!res.ok) { + // Group refreshes run in parallel: a later failure without Retry-After + // must never shorten a longer deadline an earlier one already set. + const until = Date.now() + providerCooldownMs(res); + if (res.status === 403 || res.status === 429) + hostCooldownUntil = Math.max(hostCooldownUntil, until); + else feedCooldownUntil = Math.max(feedCooldownUntil, until); + void res.body?.cancel().catch(() => {}); + throw new Error(`HTTP ${res.status}`); + } + const body = await readResponseTextCapped( + res, + CELESTRAK_MAX_RESPONSE_BYTES, + signal, + ); + if (!feed.validate(body)) throw new Error(feed.invalid); + return { at: Date.now(), body }; + } + + return async (req, res) => { const group = String(req.url || '') .replace(/^\//, '') .split('?')[0]; @@ -111,7 +161,7 @@ export function celestrakProxy() { res.end(); return; } - if (!groups.has(group)) { + if (!feed.groups.has(group)) { res.writeHead(400, { 'Content-Type': 'text/plain' }); res.end('invalid group'); return; @@ -123,15 +173,15 @@ export function celestrakProxy() { if (res.headersSent) return; res.writeHead(status, { 'Content-Type': 'text/plain', - 'x-tle-cache': cacheStatus, + [feed.cacheHeader]: cacheStatus, 'Cache-Control': 'no-store', ...(entry - ? { 'X-TLE-Cached-At': new Date(entry.at).toISOString() } + ? { [feed.cachedAtHeader]: new Date(entry.at).toISOString() } : {}), - ...(cooldownUntil > 0 && Date.now() < cooldownUntil + ...(cooldownUntil() > 0 && Date.now() < cooldownUntil() ? { 'Retry-After': String( - Math.ceil((cooldownUntil - Date.now()) / 1000), + Math.ceil((cooldownUntil() - Date.now()) / 1000), ), } : {}), @@ -145,11 +195,11 @@ export function celestrakProxy() { entry = await readDisk(group); if (entry) mem.set(group, entry); } - if (entry && now - entry.at < TLE_TTL_MS) { + if (entry && now - entry.at < feed.ttlMs) { send(200, entry.body, 'HIT', entry); return; } - if (Date.now() < cooldownUntil) { + if (Date.now() < cooldownUntil()) { send( entry ? 200 : 502, entry?.body || 'celestrak upstream cooling down', @@ -169,8 +219,8 @@ export function celestrakProxy() { return fresh; }) .catch((err) => { - if (Date.now() >= cooldownUntil) - cooldownUntil = Date.now() + 60000; + if (Date.now() >= feedCooldownUntil) + feedCooldownUntil = Date.now() + 60000; console.warn( '[celestrak-proxy] refresh failed — serving cache if any', ); @@ -191,7 +241,13 @@ export function celestrakProxy() { console.error('[celestrak-proxy] request failed'); send(500, 'celestrak proxy error', 'ERROR'); } - }); + }; + } + + const handlers = feeds.map((feed) => [feed.route, createFeedHandler(feed)]); + const installMiddleware = (server) => { + for (const [route, handler] of handlers) + server.middlewares.use(route, handler); }; return { name: 'celestrak-proxy', diff --git a/src/cameraHandoff.test.mjs b/src/cameraHandoff.test.mjs index 398c51c34..1c41139c8 100644 --- a/src/cameraHandoff.test.mjs +++ b/src/cameraHandoff.test.mjs @@ -42,7 +42,7 @@ function ordered(source, needles, label) { test('Cockpit takeover invalidates deferred work before camera cancellation', () => { const enter = cockpitEnter.toString(); ordered(enter, [ - 'if (!info || !entity?.position) return false;', + 'if (!info || (!vessel && !satellite && !entity?.position)) return false;', 'this.onCameraTakeover?.();', 'this.viewer.camera.cancelFlight();', 'this.viewer.trackedEntity = undefined;', @@ -106,7 +106,8 @@ test('voice Cockpit entry reaches the camera only through stamping seams', () => ); ordered(transaction, [ /if \(\s*!selectedLayer\.trackById\?\.\(selectedTarget\.id, \{\s*origin: selectionOrigin,?\s*\}\)\s*\) \{/, - 'if (!entryError) entered = Boolean(cockpitView.enter());', + // Aircraft-only: a selected vessel must not stand in for a voice target. + "if (!entryError) entered = Boolean(cockpitView.enter({ kind: 'aircraft' }));", ], 'Cockpit entry transaction'); // No direct camera control: every mutation goes through a layer tracker or // the cockpit controller, both of which stamp. diff --git a/src/cockpitCloudEffects.js b/src/cockpitCloudEffects.js index c9117b7d3..c1cc796b4 100644 --- a/src/cockpitCloudEffects.js +++ b/src/cockpitCloudEffects.js @@ -170,6 +170,18 @@ export function cockpitWeatherEnabledFromStoredValue(value) { return value === '1'; } +/** + * Whether the cloud pass runs for a Cockpit subject's layer. Not in orbit: + * the pass fades out above 24 km (weatherAltitudeFactors), so a satellite + * would pay for it and see nothing. The saved preference is left as it is + * for the next aircraft or bridge; cloud cover from orbit is the Weather + * layer's. + * @param {string|null|undefined} layerId + */ +export function cockpitCloudsShowFor(layerId) { + return layerId !== 'satellites'; +} + /** * Weather-backed volumetric cloud pass that exists only while cockpit mode is * active. It owns no Cesium fog/post-process stages and cannot affect map mode. @@ -207,10 +219,12 @@ class CockpitCloudEffectsController { this.enabled = this.readEnabledPreference(); this.onResize = () => this.resize(); + this.orbit = false; this.onCockpitMode = (event) => { const active = event?.detail?.active ?? document.body.classList.contains('cockpit-mode'); + this.orbit = active && !cockpitCloudsShowFor(event?.detail?.layerId); if (active && this.enabled) this.start(); else this.stop(); }; @@ -344,7 +358,8 @@ class CockpitCloudEffectsController { this.destroyed || !this.enabled || this.frame !== null || - this.suspended + this.suspended || + this.orbit ) return; if (!this.gl) { diff --git a/src/cockpitCloudEffects.test.mjs b/src/cockpitCloudEffects.test.mjs index 18a0ed394..651b3fb27 100644 --- a/src/cockpitCloudEffects.test.mjs +++ b/src/cockpitCloudEffects.test.mjs @@ -2,6 +2,7 @@ import test from 'node:test'; import assert from 'node:assert/strict'; import { cockpitCloudRenderSize, + cockpitCloudsShowFor, cockpitWeatherRefreshDue, cockpitWeatherEnabledFromStoredValue, } from './cockpitCloudEffects.js'; @@ -23,6 +24,13 @@ test('cockpit weather defaults off and enables only from an explicit saved opt-i assert.equal(cockpitWeatherEnabledFromStoredValue('1'), true); }); +test('the cloud pass stays off in orbit and runs for aircraft and bridges', () => { + assert.equal(cockpitCloudsShowFor('satellites'), false); + for (const layerId of ['flights', 'military', 'ais-live-vessels', null]) { + assert.equal(cockpitCloudsShowFor(layerId), true, String(layerId)); + } +}); + test('cockpit weather refreshes after time or meaningful movement', () => { const anchor = { latitude: 30, longitude: -97 }; assert.equal(cockpitWeatherRefreshDue({ diff --git a/src/cockpitLook.js b/src/cockpitLook.js new file mode 100644 index 000000000..e0b133b34 --- /dev/null +++ b/src/cockpitLook.js @@ -0,0 +1,244 @@ +/** + * Bridge look-around policy: how the arrow keys turn the bridge camera away + * from the bow and back, and how a turned view is described. Yaw is relative + * to the ship's heading; pitch is the view's absolute pitch. Pure: no DOM, no + * Cesium and no translated text; the Cockpit words the readout. + */ + +/** One arrow press turns the view this far. */ +export const LOOK_STEP_DEG = 5; + +/** One Shift+arrow press turns the view this far: two reach either beam. */ +export const LOOK_COARSE_STEP_DEG = 45; + +/** The view pitches no further than straight up or straight down. */ +export const LOOK_PITCH_LIMIT_DEG = 90; + +/** + * The eased view's time constant. Three of them (about 180 ms) close 95% of + * a step, so a press glides rather than snaps and a held key turns smoothly. + */ +export const LOOK_EASE_TAU_MS = 60; + +/** Closer than this the eased view lands on its target. */ +const LOOK_SETTLE_DEG = 0.05; + +/** Arrow key → the axis it turns and the direction it turns it. */ +const LOOK_ARROWS = Object.freeze({ + ArrowLeft: Object.freeze({ axis: 'yaw', sign: -1 }), + ArrowRight: Object.freeze({ axis: 'yaw', sign: 1 }), + ArrowUp: Object.freeze({ axis: 'pitch', sign: 1 }), + ArrowDown: Object.freeze({ axis: 'pitch', sign: -1 }), +}); + +/** + * Wrap a yaw to (-180, 180]: negative to port, positive to starboard. + * @param {number} deg Yaw in degrees; a non-finite yaw reads as ahead. + * @returns {number} + */ +export function wrapLookYaw(deg) { + if (!Number.isFinite(deg)) return 0; + const wrapped = (((deg % 360) + 360) % 360) - 360; + const yaw = wrapped <= -180 ? wrapped + 360 : wrapped; + return yaw === 0 ? 0 : yaw; +} + +/** + * Clamp a view pitch to [-90, 90]. + * @param {number} deg Pitch in degrees; a non-finite pitch reads as level. + * @returns {number} + */ +export function clampLookPitch(deg) { + if (!Number.isFinite(deg)) return 0; + const pitch = Math.min( + LOOK_PITCH_LIMIT_DEG, + Math.max(-LOOK_PITCH_LIMIT_DEG, deg), + ); + return pitch === 0 ? 0 : pitch; +} + +/** + * The step an arrow key asks for, or null for any other key. + * @param {string} key `KeyboardEvent.key`. + * @param {boolean} [coarse] Shift is held: step 45° instead of 5°. + * @returns {{axis: 'yaw'|'pitch', sign: 1|-1, stepDeg: number}|null} + */ +export function lookKeyStep(key, coarse = false) { + const arrow = LOOK_ARROWS[key]; + if (!arrow) return null; + return { + ...arrow, + stepDeg: coarse ? LOOK_COARSE_STEP_DEG : LOOK_STEP_DEG, + }; +} + +/** + * Move one value to the next multiple of `stepDeg` in the direction `sign`. + * A value off the grid (the bridge's -2° rest pitch) lands on it first, so + * the readout shows round angles. + */ +function nextOnGrid(value, sign, stepDeg) { + const cells = value / stepDeg; + const next = + sign > 0 ? Math.floor(cells + 1e-9) + 1 : Math.ceil(cells - 1e-9) - 1; + return next * stepDeg; +} + +/** + * Apply one key step to a look target. + * @param {{yawDeg: number, pitchDeg: number}} target Current look target. + * @param {{axis: 'yaw'|'pitch', sign: number, stepDeg: number}} step From + * {@link lookKeyStep}. + * @returns {{yawDeg: number, pitchDeg: number}} The new target: yaw wrapped + * to (-180, 180], pitch clamped to [-90, 90]. + */ +export function stepLook(target, step) { + const yawDeg = wrapLookYaw(target?.yawDeg ?? 0); + const pitchDeg = clampLookPitch(target?.pitchDeg ?? 0); + if (!step) return { yawDeg, pitchDeg }; + if (step.axis === 'yaw') + return { + yawDeg: wrapLookYaw(nextOnGrid(yawDeg, step.sign, step.stepDeg)), + pitchDeg, + }; + return { + yawDeg, + pitchDeg: clampLookPitch(nextOnGrid(pitchDeg, step.sign, step.stepDeg)), + }; +} + +/** + * Advance the eased view toward its target. Yaw takes the shorter way + * round; with `immediate` (reduced motion) the view jumps to the target. + * @param {{yawDeg: number, pitchDeg: number}} current Eased view now. + * @param {{yawDeg: number, pitchDeg: number}} target Look target. + * @param {number} dtMs Milliseconds since the previous step. + * @param {{immediate?: boolean}} [options] + * @returns {{yawDeg: number, pitchDeg: number}} + */ +export function easeLook(current, target, dtMs, { immediate = false } = {}) { + const goalYaw = wrapLookYaw(target?.yawDeg ?? 0); + const goalPitch = clampLookPitch(target?.pitchDeg ?? 0); + if (immediate || !current) return { yawDeg: goalYaw, pitchDeg: goalPitch }; + const fraction = + Number.isFinite(dtMs) && dtMs > 0 + ? 1 - Math.exp(-dtMs / LOOK_EASE_TAU_MS) + : 0; + const fromYaw = wrapLookYaw(current.yawDeg); + const yawError = wrapLookYaw(goalYaw - fromYaw); + const pitchError = goalPitch - clampLookPitch(current.pitchDeg); + const yawDeg = + Math.abs(yawError * (1 - fraction)) < LOOK_SETTLE_DEG + ? goalYaw + : wrapLookYaw(fromYaw + yawError * fraction); + const pitchDeg = + Math.abs(pitchError * (1 - fraction)) < LOOK_SETTLE_DEG + ? goalPitch + : clampLookPitch(current.pitchDeg + pitchError * fraction); + return { yawDeg, pitchDeg }; +} + +/** + * Whether a look differs from the rest view (ahead at `restPitchDeg`). + * @param {{yawDeg: number, pitchDeg: number}} look + * @param {number} restPitchDeg The camera profile's pitch. + * @returns {boolean} + */ +export function lookIsOffset(look, restPitchDeg) { + return ( + wrapLookYaw(look?.yawDeg ?? 0) !== 0 || + clampLookPitch(look?.pitchDeg ?? restPitchDeg) !== + clampLookPitch(restPitchDeg) + ); +} + +/** + * The parts of a look readout, for the Cockpit to word. A part is null when + * that axis rests: yaw ahead, or pitch at the rest pitch. + * @param {{yawDeg: number, pitchDeg: number}} look Look target. + * @param {number} restPitchDeg The camera profile's pitch. + * @returns {{side: 'port'|'starboard'|'astern'|null, bearingDeg: number, + * elevation: 'up'|'down'|'level'|null, angleDeg: number}} `bearingDeg` is + * the angle off the bow (0–180) and `angleDeg` the angle off level (0–90), + * both rounded to whole degrees. + */ +export function lookReadoutParts(look, restPitchDeg) { + const yaw = Math.round(wrapLookYaw(look?.yawDeg ?? 0)); + const pitch = Math.round(clampLookPitch(look?.pitchDeg ?? restPitchDeg)); + const pitchOffset = + clampLookPitch(look?.pitchDeg ?? restPitchDeg) !== + clampLookPitch(restPitchDeg); + let side = null; + if (Math.abs(yaw) >= 180) side = 'astern'; + else if (yaw > 0) side = 'starboard'; + else if (yaw < 0) side = 'port'; + let elevation = null; + if (pitchOffset) elevation = pitch > 0 ? 'up' : pitch < 0 ? 'down' : 'level'; + return { + side, + bearingDeg: Math.abs(yaw), + elevation, + angleDeg: Math.abs(pitch), + }; +} + +/** + * The orbital view's off-nadir limit on each axis. The orbital look reuses + * the bridge's `{yawDeg, pitchDeg}` shape over a fixed nadir frame: yaw tilts + * the view east (positive) or west, pitch tilts it north (positive) or + * south. Single 5° steps only; the bridge keeps its own limits. + */ +export const ORBITAL_LOOK_LIMIT_DEG = 45; + +/** Clamp one orbital look axis to ±ORBITAL_LOOK_LIMIT_DEG; NaN rests. */ +function clampOrbitalAxis(deg) { + if (!Number.isFinite(deg)) return 0; + const value = Math.min( + ORBITAL_LOOK_LIMIT_DEG, + Math.max(-ORBITAL_LOOK_LIMIT_DEG, deg), + ); + return value === 0 ? 0 : value; +} + +/** + * Clamp an orbital look to the off-nadir limit on both axes. + * @param {{yawDeg: number, pitchDeg: number}} look East and north tilt. + * @returns {{yawDeg: number, pitchDeg: number}} + */ +export function clampOrbitalLook(look) { + return { + yawDeg: clampOrbitalAxis(look?.yawDeg), + pitchDeg: clampOrbitalAxis(look?.pitchDeg), + }; +} + +/** + * Apply one arrow step to an orbital look: the bridge's stepping on the + * same 5° grid, then the off-nadir clamp. + * @param {{yawDeg: number, pitchDeg: number}} target Current look target. + * @param {{axis: 'yaw'|'pitch', sign: number, stepDeg: number}} step From + * {@link lookKeyStep}. + * @returns {{yawDeg: number, pitchDeg: number}} + */ +export function stepOrbitalLook(target, step) { + return clampOrbitalLook(stepLook(clampOrbitalLook(target), step)); +} + +/** + * The parts of an off-nadir readout, for the Cockpit to word: the north or + * south tilt and the east or west tilt, each null at rest, in whole degrees. + * @param {{yawDeg: number, pitchDeg: number}} look Orbital look target. + * @returns {{northSouth: 'N'|'S'|null, northSouthDeg: number, + * eastWest: 'E'|'W'|null, eastWestDeg: number}} + */ +export function orbitalLookReadoutParts(look) { + const { yawDeg, pitchDeg } = clampOrbitalLook(look); + const north = Math.round(pitchDeg); + const east = Math.round(yawDeg); + return { + northSouth: north > 0 ? 'N' : north < 0 ? 'S' : null, + northSouthDeg: Math.abs(north), + eastWest: east > 0 ? 'E' : east < 0 ? 'W' : null, + eastWestDeg: Math.abs(east), + }; +} diff --git a/src/cockpitLook.test.mjs b/src/cockpitLook.test.mjs new file mode 100644 index 000000000..27f79e319 --- /dev/null +++ b/src/cockpitLook.test.mjs @@ -0,0 +1,195 @@ +// src/cockpitLook.test.mjs — the bridge look-around policy: arrow steps, +// yaw wrapping, pitch limits, easing and the readout's parts. +import test from 'node:test'; +import assert from 'node:assert/strict'; +import { + LOOK_COARSE_STEP_DEG, + LOOK_STEP_DEG, + ORBITAL_LOOK_LIMIT_DEG, + clampLookPitch, + clampOrbitalLook, + easeLook, + lookIsOffset, + lookKeyStep, + lookReadoutParts, + orbitalLookReadoutParts, + stepLook, + stepOrbitalLook, + wrapLookYaw, +} from './cockpitLook.js'; + +const REST = { yawDeg: 0, pitchDeg: -2 }; + +/** Press one key `count` times from `start`. */ +function press(start, key, count = 1, coarse = false) { + let look = start; + for (let index = 0; index < count; index += 1) + look = stepLook(look, lookKeyStep(key, coarse)); + return look; +} + +test('yaw wraps to (-180, 180] and pitch clamps to [-90, 90]', () => { + assert.equal(wrapLookYaw(0), 0); + assert.equal(wrapLookYaw(-0), 0); + assert.equal(wrapLookYaw(180), 180); + assert.equal(wrapLookYaw(-180), 180); + assert.equal(wrapLookYaw(185), -175); + assert.equal(wrapLookYaw(-185), 175); + assert.equal(wrapLookYaw(720 + 45), 45); + assert.equal(wrapLookYaw(NaN), 0); + assert.equal(clampLookPitch(120), 90); + assert.equal(clampLookPitch(-120), -90); + assert.equal(clampLookPitch(-0), 0); + assert.equal(clampLookPitch(Infinity), 0); +}); + +test('only the arrows step, 5° plain and 45° with Shift', () => { + assert.deepEqual(lookKeyStep('ArrowLeft'), { + axis: 'yaw', + sign: -1, + stepDeg: LOOK_STEP_DEG, + }); + assert.deepEqual(lookKeyStep('ArrowUp', true), { + axis: 'pitch', + sign: 1, + stepDeg: LOOK_COARSE_STEP_DEG, + }); + assert.equal(lookKeyStep('ArrowDown').sign, -1); + assert.equal(lookKeyStep('ArrowRight').sign, 1); + for (const key of ['Home', '0', 'a', 'Escape', undefined]) + assert.equal(lookKeyStep(key), null); +}); + +test('arrows turn the yaw in 5° steps and Shift reaches either beam in two', () => { + assert.deepEqual(press(REST, 'ArrowRight'), { yawDeg: 5, pitchDeg: -2 }); + assert.deepEqual(press(REST, 'ArrowLeft', 3), { yawDeg: -15, pitchDeg: -2 }); + assert.equal(press(REST, 'ArrowRight', 2, true).yawDeg, 90); + assert.equal(press(REST, 'ArrowLeft', 2, true).yawDeg, -90); + // A coarse step from off the 45° grid lands on it. + assert.equal(press({ ...REST, yawDeg: 5 }, 'ArrowRight', 1, true).yawDeg, 45); + // Past astern the yaw wraps to the other side. + assert.equal(press(REST, 'ArrowRight', 4, true).yawDeg, 180); + assert.equal(press(REST, 'ArrowRight', 5, true).yawDeg, -135); + assert.equal(press(REST, 'ArrowLeft', 37).yawDeg, 175); +}); + +test('pitch steps onto the 5° grid from the rest pitch and stops at ±90°', () => { + assert.equal(press(REST, 'ArrowUp').pitchDeg, 0); + assert.equal(press(REST, 'ArrowUp', 3).pitchDeg, 10); + assert.equal(press(REST, 'ArrowDown').pitchDeg, -5); + assert.equal(press(REST, 'ArrowUp', 40).pitchDeg, 90); + assert.equal(press(REST, 'ArrowDown', 40).pitchDeg, -90); + assert.equal(press(REST, 'ArrowUp', 3, true).pitchDeg, 90); + assert.equal(press(REST, 'ArrowDown', 2, true).pitchDeg, -90); + assert.equal(press(REST, 'ArrowUp').yawDeg, 0, 'pitch leaves the yaw'); +}); + +test('the eased view closes most of a step in about 180 ms', () => { + const target = { yawDeg: 90, pitchDeg: -2 }; + let view = { ...REST }; + view = easeLook(view, target, 180); + assert.ok(view.yawDeg > 85 && view.yawDeg < 90, `yaw ${view.yawDeg}`); + for (let step = 0; step < 20; step += 1) view = easeLook(view, target, 50); + assert.deepEqual(view, target, 'it lands exactly on the target'); + assert.deepEqual(easeLook(REST, target, 0), REST, 'no time, no motion'); +}); + +test('the eased yaw takes the short way across astern', () => { + const view = easeLook( + { yawDeg: 170, pitchDeg: 0 }, + { yawDeg: -170, pitchDeg: 0 }, + 30, + ); + assert.ok(view.yawDeg > 170 || view.yawDeg < -170, `yaw ${view.yawDeg}`); +}); + +test('reduced motion jumps straight to the target', () => { + const target = { yawDeg: -45, pitchDeg: 30 }; + assert.deepEqual(easeLook(REST, target, 1, { immediate: true }), target); +}); + +test('the readout names the side, the bearing and the elevation', () => { + assert.equal(lookIsOffset(REST, -2), false); + assert.equal(lookIsOffset({ yawDeg: 0, pitchDeg: 0 }, -2), true); + assert.equal(lookIsOffset({ yawDeg: 5, pitchDeg: -2 }, -2), true); + assert.deepEqual(lookReadoutParts({ yawDeg: 45, pitchDeg: 10 }, -2), { + side: 'starboard', + bearingDeg: 45, + elevation: 'up', + angleDeg: 10, + }); + assert.deepEqual(lookReadoutParts({ yawDeg: -90, pitchDeg: -2 }, -2), { + side: 'port', + bearingDeg: 90, + elevation: null, + angleDeg: 2, + }); + assert.deepEqual(lookReadoutParts({ yawDeg: 0, pitchDeg: -30 }, -2), { + side: null, + bearingDeg: 0, + elevation: 'down', + angleDeg: 30, + }); + assert.equal( + lookReadoutParts({ yawDeg: 0, pitchDeg: 0 }, -2).elevation, + 'level', + ); + assert.equal( + lookReadoutParts({ yawDeg: 180, pitchDeg: -2 }, -2).side, + 'astern', + ); +}); + +test('an orbital look steps 5° per arrow and stops at 45° on each axis', () => { + let look = { yawDeg: 0, pitchDeg: 0 }; + for (let index = 0; index < 3; index += 1) + look = stepOrbitalLook(look, lookKeyStep('ArrowUp')); + assert.deepEqual(look, { yawDeg: 0, pitchDeg: 15 }); + look = stepOrbitalLook(look, lookKeyStep('ArrowRight')); + assert.deepEqual(look, { yawDeg: 5, pitchDeg: 15 }); + for (let index = 0; index < 20; index += 1) { + look = stepOrbitalLook(look, lookKeyStep('ArrowDown')); + look = stepOrbitalLook(look, lookKeyStep('ArrowLeft')); + } + assert.deepEqual(look, { + yawDeg: -ORBITAL_LOOK_LIMIT_DEG, + pitchDeg: -ORBITAL_LOOK_LIMIT_DEG, + }); + assert.deepEqual(clampOrbitalLook({ yawDeg: 90, pitchDeg: NaN }), { + yawDeg: 45, + pitchDeg: 0, + }); + assert.deepEqual(clampOrbitalLook({ yawDeg: 180, pitchDeg: -60 }), { + yawDeg: 45, + pitchDeg: -45, + }); +}); + +test('the orbital readout names north or south and east or west', () => { + assert.deepEqual(orbitalLookReadoutParts({ yawDeg: 15, pitchDeg: 10 }), { + northSouth: 'N', + northSouthDeg: 10, + eastWest: 'E', + eastWestDeg: 15, + }); + assert.deepEqual(orbitalLookReadoutParts({ yawDeg: -5, pitchDeg: 0 }), { + northSouth: null, + northSouthDeg: 0, + eastWest: 'W', + eastWestDeg: 5, + }); + assert.equal( + orbitalLookReadoutParts({ yawDeg: 0, pitchDeg: -45 }).northSouth, + 'S', + ); +}); + +test('the bridge look keeps its own limits beside the orbital clamp', () => { + const look = stepLook({ yawDeg: 45, pitchDeg: 45 }, lookKeyStep('ArrowUp')); + assert.deepEqual(look, { yawDeg: 45, pitchDeg: 50 }); + assert.equal( + stepLook({ yawDeg: 45, pitchDeg: 0 }, lookKeyStep('ArrowRight', true)) + .yawDeg, + 90, + ); +}); diff --git a/src/cockpitMarkup.test.mjs b/src/cockpitMarkup.test.mjs index aa06193ba..06db3aeff 100644 --- a/src/cockpitMarkup.test.mjs +++ b/src/cockpitMarkup.test.mjs @@ -79,7 +79,7 @@ test('Cockpit has one reset action beside its bottom exit path', () => { assert.doesNotMatch(html, /id="cockpit-exit"/); assert.match( html, - /id="map-view-switch"[^>]*aria-label="Exit cockpit view"[^>]*aria-keyshortcuts="Escape C"[\s\S]*?close_fullscreen[\s\S]*?EXIT COCKPIT/, + /id="map-view-switch"[^>]*aria-label="Exit cockpit view"[^>]*aria-keyshortcuts="Escape"[\s\S]*?close_fullscreen[\s\S]*?EXIT COCKPIT/, ); const topCenterActions = html.match( /