diff --git a/.env.example b/.env.example index 2caf21d29..a9819f100 100644 --- a/.env.example +++ b/.env.example @@ -176,7 +176,7 @@ VITE_AIS_LIVE_LABEL_MAX_ROWS=900 AISSTREAM_API_KEY= # Optional AISStream subscription filters. # AISSTREAM_BOUNDING_BOXES=[[[-90,-180],[90,180]]] -# AISSTREAM_MESSAGE_TYPES=PositionReport,StandardClassBPositionReport,ExtendedClassBPositionReport,ShipStaticData,StaticDataReport +# AISSTREAM_MESSAGE_TYPES=PositionReport,StandardClassBPositionReport,ExtendedClassBPositionReport,ShipStaticData,StaticDataReport,AidsToNavigationReport # Feed watchdog: silence (ms) after which the feed is REPORTED stale; the socket # is recycled at 2.5x that. Default 120000. The watchdog self-arms only for the # default worldwide subscription — a narrow filter above can be legitimately diff --git a/changelog.d/1733-buoy-models.md b/changelog.d/1733-buoy-models.md new file mode 100644 index 000000000..a2de9e612 --- /dev/null +++ b/changelog.d/1733-buoy-models.md @@ -0,0 +1,11 @@ +- Draw aids to navigation as buoys instead of ships: a buoy, beacon, RACON, + light or mark from the vessel feed (or any AIS station numbered 99MIDxxxx) + is now the fleet set's buoy of its IALA mark (cardinal, port or starboard + hand, safe water, isolated danger or special mark), standing still with no + heading, and its icon is a disc rather than a chevron. Its card and readout + show its kind of mark with no speed or heading. AISStream now subscribes to + aid-to-navigation reports and names each by its kind of mark and its full + name; the feed lists every ship ahead of any aid, and `vessels_in_area` + counts ships only. A virtual aid (a mark broadcast where nothing physical + stands) keeps its disc, is never drawn as a buoy, and its card says it is + virtual; vessel sources may mark any record `virtual` (samehkhamis, #1733). diff --git a/changelog.d/1734-transit-route-type-models.md b/changelog.d/1734-transit-route-type-models.md new file mode 100644 index 000000000..f451376e3 --- /dev/null +++ b/changelog.d/1734-transit-route-type-models.md @@ -0,0 +1,10 @@ +- Draw transit vehicles as their kind, not one of five: trolleybuses, cable + cars, funiculars, gondolas and monorails are modes of their own, with their + own icon, colour, card word and fleet model. A vehicle record may carry its + route's GTFS `route_type` (`routeType`), which settles its mode before the + feed's route hints and picks the finer model (a coach for 200, a high-speed + set for 101). Prague's trolleybuses and Petřín funicular, and Bucharest, + Cluj and Turin's trams, trolleybuses and metro lines, now read as such from + the route ids in each operator's routes.txt. Le Havre's funicular, which its + routes.txt types as a bus, is a named correction that outranks the route + type (samehkhamis, #1734). diff --git a/changelog.d/1735-side-rails-edge.md b/changelog.d/1735-side-rails-edge.md new file mode 100644 index 000000000..1ecee150c --- /dev/null +++ b/changelog.d/1735-side-rails-edge.md @@ -0,0 +1,5 @@ +- Move Visual to the left rail, after Data Layers, Utilities and Authoring, and + lead the right column with Context; an open Context or CCTV panel takes the + column's full height. A switch in each panel header moves that side's panels + over their rail to the screen edge, and the scroll wheel at a screen edge + steps through that side's panels (manjunath22466, samehkhamis, #1735). diff --git a/changelog.d/1736-timeline-scrub-ages-cloud-gaps.md b/changelog.d/1736-timeline-scrub-ages-cloud-gaps.md new file mode 100644 index 000000000..4c8deafe8 --- /dev/null +++ b/changelog.d/1736-timeline-scrub-ages-cloud-gaps.md @@ -0,0 +1,9 @@ +- Fix three time readings on the world timeline. A scrub near now goes live + only within two minutes of now, however long the track: with a layer whose + source covers years, any time in the last few weeks used to snap to live. + Fire cards and fire details count a detection's age from the end of the + 24 hours shown, and from now only when live, so a window that ended months + ago reads "new 3h" rather than "new 105d". Weather and satellite cloud + frames stay shown, and the latest reads late, for at least one and a half + of the feed's own frame spacings, so a feed whose frames come an hour apart + no longer goes blank for half of every hour (samehkhamis, #1736). diff --git a/changelog.d/1737-placement-provider.md b/changelog.d/1737-placement-provider.md new file mode 100644 index 000000000..5d461a6dd --- /dev/null +++ b/changelog.d/1737-placement-provider.md @@ -0,0 +1,7 @@ +- Let a host application decide where live contacts are drawn. + `createApplicationCatalog({ placement })` takes a placement provider whose + `layer(kind)` hands Flights, Military Flights, AIS Vessels, Transit and Rail + a `place(id, wallMs)` (and optionally `observe(id, fix)`, `forget(id)`): + each layer tells it every live fix it accepts and draws a contact where it + places it. Without one, or for a contact it does not place, every layer + moves as before (samehkhamis, #1737). diff --git a/docs/CURRENT-STATE.md b/docs/CURRENT-STATE.md index 239da85b2..2ba25becc 100644 --- a/docs/CURRENT-STATE.md +++ b/docs/CURRENT-STATE.md @@ -370,6 +370,25 @@ The source factories are exported at `layers/directions/source` and `layers/recent-imagery/source`. Configuration is applied at construction time; this does not introduce live source replacement. +Application catalog composition also accepts an optional `placement`, a +host-supplied placement provider (`src/data/placementProvider.js`): an object +whose `layer(kind)` returns, for `aircraft`, `military`, `vessels`, `transit` +or `rail`, either null or `{ place(id, wallMs), observe?(id, fix), +forget?(id) }`. While live, each of those layers tells it every fix it accepts +(time, position, the height it draws the fix at, reported speed, course and +ground state) and draws a contact where `place` puts it: position, height +(the layer's own when none is given), course and speed. A null answer, a +provider that throws, a kind it leaves out, or no provider at all keeps the +layer's own motion, unchanged; following the world clock, the layers never +ask it. Transit and rail vehicles a provider places are advanced every frame +in view while their placed position changes; one it holds still lets the +render loop idle and is asked again each second, moving on once its placement +does. A placed transit vehicle is drawn at its placed point, and a placed +train where it is placed rather than on its bound railway line. Live vessels +a provider places move on between refreshes: redrawn in place at most every +250 ms, with a frame asked for each second while the provider places any +drawn vessel, and none once the layer is off. + Application catalog composition accepts an optional `streetLevelProviders` list. An explicit list replaces the default Mapillary provider; an empty list removes all imagery providers. Without that option, Mapillary is registered only when @@ -632,6 +651,36 @@ panel that holds its row, and `set_panel_open` reaches it as `utilities-panel` or by "utilities", "draw", "drawing" or "import". On a phone it sits collapsed in the Layers sheet under Data Layers. +## Side rails and the screen edge — November 14, 2026 + +Visual (`#pp-toggles`, the display settings, rail item `palette`) is the last +panel of the left column, after Data Layers, Utilities and Authoring, and +opens from the left rail like them (`PanelLayoutController`, falling back to +the right column in a host without a left stack). Context leads the right +column, followed by CCTV, Street Level and the other right panels. An open +Context or CCTV panel takes the column's full height; the other right panels +keep the content-sized layout and its hysteresis band. With nothing open, a +rail's icons and their names show as two glass pieces side by side; once a +panel opens, the icons stay in place and a highlight slides to the open one. + +Each collapsible panel header has an edge switch (`UiPanelEdge.vue`, +`src/ui/panelEdge.js`): it moves that side's panels over their rail to the +screen edge, with the rail as a row of icons above the open panel, and back. +The choice is per side, kept in `localStorage` (`gev.panelEdge`), and applies +on the desktop shell only: phones and Cockpit keep their own layouts and do +not show the switch. + +Scrolling the wheel at a screen edge (`src/ui/railEdgeScroll.js`, from the +edge to just past the rail, at most 84 px) steps that side's rail to its next +or previous panel instead of zooming the globe, wrapping round at either end. +One gesture is one step, trackpad coasting included, with at least half a +second between steps; a step that comes too soon is held until then and is +dropped if the pointer leaves the strip. Panels, controls, dialogs and the +world timeline in the strip keep their own wheel. The strip is off on phones +and touch screens, while the rails are hidden (clean view, recording), and it +follows the rails' sides in a right-to-left language. On a phone, Visual is in +the More sheet with the dock's Visual Presets, as before. + ## God's Eye View in conversations — October 2, 2026 Tool answers that can be shown in God's Eye View include a view: camera, layers, @@ -3495,7 +3544,8 @@ reads `NASA FIRMS · LIVE · updated …`. A source may instead answer the 24 ho to a set time, naming its end as `at` (epoch ms): the row then reads `NASA FIRMS · 24 h to MM-DD HH:MM UTC`, `getStats()` reports `at`, and `get_active_fires` says "in the 24 hours to" that time and reports it as -`window_end`. The dev proxy never sets `at`. +`window_end`, and card and detail ages count back from that time instead of +now. The dev proxy never sets `at`. The FIRMS CSV parser rejects impossible acquisition calendar dates before the proxy filters records to the trailing 24 hours, while retaining valid UTC acquisition times. FIRMS ages round to whole hours before choosing a unit, so a 47.6-hour age reads "2d", not "48h"; with detections filtered to 24 hours, this shows mostly in the `STALE · cached {age}` stats line. @@ -5958,7 +6008,26 @@ Helsinki, the Netherlands, Norway, South East Queensland, Rio de Janeiro Ontario — Toronto (TTC surface vehicles; the subway publishes no positions), MiWay, Hamilton HSR, Durham Region, YRT/Viva, Guelph, Burlington, Barrie and Kingston. Mode silhouettes -identify buses, trams, subways, trains, ferries and unclassified vehicles. +identify buses, trolleybuses, trams, cable cars, subways, monorails, trains, +funiculars, gondolas (aerial lifts), ferries and unclassified vehicles. + +A vehicle's mode comes from, in order: the feed's fleet-number hint +(`vehicleMode`, which knows a bus standing in on a streetcar route); the feed's +correction for a route its own routes.txt mistypes (`routeCorrections`: Le +Havre's funicular `8-FUNI`, which LiA's routes.txt types as a bus); the GTFS +`route_type` of its route, when its record carries one as `routeType` (basic +0–12 or extended 100–1799, each extended type taken as the basic mode it is a +kind of: 200 coach is a bus, 101 high-speed is rail, 405 is a monorail); the +feed's route-id hint (`routeMode`); and the feed's default (`transitModeFor`, +`src/data/transitFeeds.js`). The GTFS-Realtime decoder carries no route type, so +a record from the bundled proxy is classified by the hints alone. Route hints +read from each operator's routes.txt cover Prague's trolleybus lines and Petřín +funicular, and Bucharest, Cluj-Napoca and Turin's trams, trolleybuses and metro +lines (and Turin's Sassi–Superga rack tramway, typed a funicular in its +routes.txt). Le Havre's funicular is a correction, not read from routes.txt: its +route hint and its correction both say funicular. Vilnius publishes no route ids in its positions, so +its trolleybuses read as buses. Retained history classifies its epochs the same +way, so a trail joins the live vehicle. Retained transit history uses the same outlier quarantine as live observations and preserves the active live bracket. Rejected reports do not publish route or mode @@ -6024,9 +6093,10 @@ External halos are 1/1.5 px in normal, 1.25/1.25 px in CRT and 2/2 px in sensors final unpadded display size. Each mode has an outline with a front (a nose, a bow or a chamfered cab) for a vehicle with a known course and a symmetric outline for one without, which would otherwise sit at rotation 0 and point -north; a vehicle switches to the pointed glyph when a course arrives. Six modes, two sizes, three -profiles and the two outlines cap the raster cache at 72 variants. Normal mode colours are bus `#5EF08A`, tram -`#FFC24A`, subway `#FF4538`, rail `#D9A6FF`, ferry `#5FD6FF`, and unknown +north; a vehicle switches to the pointed glyph when a course arrives. Eleven modes, two sizes, three +profiles and the two outlines cap the raster cache at 132 variants. Normal mode colours are bus `#5EF08A`, +trolleybus `#B6F04A`, tram `#FFC24A`, cable car `#FF8F4A`, subway `#FF4538`, monorail `#FF6FB8`, rail +`#D9A6FF`, funicular `#E8C98A`, gondola `#7FA8FF`, ferry `#5FD6FF`, and unknown `#D8DDE5`. Selection keeps the mode colour. Sensors reuse each normal silhouette's exact outer path, filled opaque white without interior panel lines, with an opaque `#05080C` halo. Only the external padding grows; the unpadded silhouette remains @@ -7539,7 +7609,7 @@ pins and share links already supply complete boxes. 30-second backoff ahead of the current clock are ignored. A smaller rollback can retain a bounded retry delay of up to 30 seconds. - Commercial and military aircraft use the same high-level FLEET model regime: 2D billboards when zoomed out, optional glTF models when closer, controlled by the DISPLAY rail `3D` toggle and `Proximity` / `All` modes. Every model is one of the project's procedural fleet models (`public/models/fleet/`, MIT, 122 GLBs, about 2 MB in all; `public/models/README.md`), chosen per aircraft by `aircraftModelSpec` (`src/data/fleetModels.js`): the first of its ICAO type's callsign rules in `types.json` (`aircraft_callsign`) its callsign matches, else its type's entry, else the model of its `classifyAircraft` class for a type the map lacks, else its ADS-B emitter category's, else the default airliner. It is drawn LIFE SIZE: the type's published length over the model's built length (`src/layers/flights/modelSpec.js`, shared by Flights, Military Flights and Local ADS-B), and a grounded aircraft stands the model's scaled clearance above the ground. An airport ground vehicle (feed type `ZVEH`) is a fire truck (`FIRE…`), pushback tug (`PUSH…`, `TUG…`), van (`DEICER…`, `SQUID…`, `SQB…`) or else a car by its callsign, and a ground station (`GRND`) is an 11.8 m radio mast; these models (catalog category `other`) are drawn at their built size, and such a contact with no altitude stands on the ground instead of at the airborne default (`src/layers/flights/records.js`). `classifyAircraft` still picks the 2D icons. The whole set loads once, up front, when a layer that draws it starts (`loadFleetModelSet`, which logs `[Fleet] N/122 models (X MB) loaded in N ms`); models are built from those bytes, never fetched mid-session, and an aircraft stays its billboard until the set has loaded. Every aircraft model draws its mesh's own colours (`aircraftModelBlend`, `src/data/aircraftModelLighting.js`): Cesium's `ColorBlendMode.HIGHLIGHT` with white, in Flights, Military Flights and Local ADS-B alike; the tracked colour (cyan, or amber in Military Flights) and the emergency red multiply into the mesh, so its paint still shows. IR boost draws them flat white (`MIX` at `1.0`). Under NVG/FLIR (map preset or Cockpit vision) models render unlit flat-white at full alpha and scene fog is disabled (fog otherwise blacks out distant models with the globe hidden); state restores on exit. -- Vessels, Transit and Rail draw fleet models under the same DISPLAY rail `3D` toggle, at the same altitude ceiling, caps and add/keep radii as the aircraft (`FLEET_MODEL_POLICY`, `src/layers/flights/policy.js`; `createFleetModelLayer`, `src/data/fleetModelInstances.js`). A vessel's model follows its AIS ship type and is drawn at its reported length and beam (AIS static dimensions A+B and C+D, now carried on vessel rows as `length` and `beam`), standing at the sea surface, heading by true heading then course. A transit vehicle's model follows its layer mode (bus, tram, subway, rail or ferry; a vehicle of `unknown` mode keeps its icon), a train's its rail category and mode (rail, metro or tram). Neither the transit nor the rail sources carry a GTFS `route_type` or a finer mode (monorail, gondola, funicular, cable car), so the set's models for those and their `transit.elevation` lifts are not reached by any live source today. Both stand on the road or rail top they are drawn on, without the 1.5 m `GROUND_FLOOR_LIFT_M` their icons carry, and are painted in their mode or category colour where the model's `_TINT` attribute marks it. A vessel model is clipped at its waterline (one clipping plane per model, at the model origin's horizontal plane), so its hull below the water never shows through a plain globe, which Cesium does not depth-test models against. Under the NVG/FLIR styles (the Flights `irBoost` parameter) these models render unlit flat white, as aircraft models do. Each vehicle's icon stays the visual until its model is loaded, ready and placed; a model is picked as its icon is, and a vehicle drawn as its model keeps its selection card and its place in the detection overlay. +- Vessels, Transit and Rail draw fleet models under the same DISPLAY rail `3D` toggle, at the same altitude ceiling, caps and add/keep radii as the aircraft (`FLEET_MODEL_POLICY`, `src/layers/flights/policy.js`; `createFleetModelLayer`, `src/data/fleetModelInstances.js`). A vessel's model follows its AIS ship type and is drawn at its reported length and beam (AIS static dimensions A+B and C+D, now carried on vessel rows as `length` and `beam`), standing at the sea surface, heading by true heading then course. An aid to navigation is not a hull: a vessel record whose type names a buoy, beacon, mark, RACON or light, or whose MMSI is an aid-to-navigation station's (`99MIDxxxx`), is `isAidToNavigation` (`src/data/vesselTypes.js`) and is drawn as the set's `buoys` model of the IALA mark its type names (`aidToNavigationModel`, `src/data/fleetModels.js`: cardinal N/E/S/W, port or starboard hand, preferred channel by its side, safe water, isolated danger, special mark; a beacon, light, light vessel, RACON or reference point with no mark of its own is the special mark), else a red can (`DEFAULT_AID_MODEL`), at its built size and facing north whatever heading it reports. A type is an aid's when it is one of the 32 kinds an aid report names or uses a word for one (buoy, beacon, cardinal, safe water, RACON, lighthouse and so on); a vessel that works on aids (`Buoy Tender`, `Buoy Layer`) is not one. Its icon is a bone-white ringed disc (`AID_TO_NAVIGATION_STYLE`, `src/data/vesselLabels.js`) instead of a chevron, never rotated, and its card, selected card and HUD readout (`src/layers/vessels/cards.js`) show its kind alone, whole, in that colour: no speed or heading, since a fixed mark has neither. AISStream subscribes to `AidsToNavigationReport` (message 21) by default, and the server names each report's aid type code (0 to 31) as its kind (`aidToNavigationTypeName`: `20` is `Cardinal Mark N`) rather than reading it as a ship type, and its name runs on into the report's `NameExtension`. A virtual aid (the report's `VirtualAtoN` flag: a mark broadcast where nothing physical stands) carries `virtual: true` on its row, and on its vessel source record (the live-source contract's `virtual`, `src/sources/live/contract.js`, false unless a source says true; any source may set it). It keeps its disc but never gets a model (`vesselModelSpec` returns null for it, and the vessel layer gathers no model item for it), and its card and readout add `VIRTUAL` after its kind. `aisStreamRows` (`server/providers/vessels/ais-store.js`) puts every vessel ahead of every aid, so a capped request (the layer asks for 12,000 rows) never gives up a ship for a buoy. The `vessels_in_area` tool (and the brief built on it) counts ships only: it leaves aids out of its rows, counts, breakdowns and speed stats. A transit vehicle's model follows its route's GTFS `route_type` when its record carries one and that type is a kind of the vehicle's mode (`types.json` `transit.route_types`: 200 a coach, 101 a high-speed set, 106 a regional DMU, 710 a double-decker), else its layer mode (`transit.modes`: bus, trolleybus, tram, cable car, subway, monorail, rail, funicular, gondola or ferry; a vehicle of `unknown` mode keeps its icon); a fleet hint that overrules the route (a bus on a tram route) leaves the type unused. A monorail and a gondola are raised by their `transit.elevation` lifts. A train's model follows its rail category and mode (rail, metro or tram). The bundled GTFS-Realtime proxy carries no route type, so its vehicles draw their mode's model; a source that adds `routeType` reaches the finer ones. Both stand on the road or rail top they are drawn on, without the 1.5 m `GROUND_FLOOR_LIFT_M` their icons carry, and are painted in their mode or category colour where the model's `_TINT` attribute marks it. A vessel model is clipped at its waterline (one clipping plane per model, at the model origin's horizontal plane), so its hull below the water never shows through a plain globe, which Cesium does not depth-test models against. Under the NVG/FLIR styles (the Flights `irBoost` parameter) these models render unlit flat white, as aircraft models do. Each vehicle's icon stays the visual until its model is loaded, ready and placed; a model is picked as its icon is, and a vehicle drawn as its model keeps its selection card and its place in the detection overlay. - **Aircraft models skip Cesium's dynamic environment map (2026-10-24).** Flights, Military Flights and Local ADS-B pass `environmentMapOptions: AIRCRAFT_ENVIRONMENT_MAP_OPTIONS` (`{ enabled: false }`, `src/data/aircraftModelLighting.js`) to every drawn model. Otherwise each `Model` renders the sky around it and reads it back from the GPU (`readPixels`) when it is first placed, and again whenever it moves more than 1 km, the scene's atmosphere settings change, or (under sunlight dynamic lighting) an hour of scene time passes (`DynamicEnvironmentMapManager`, Cesium 1.138). The models are lit from Cesium's default spherical harmonics instead, with no specular environment map, so the sky's model-lighting cube map no longer reaches aircraft. `src/data/aircraftModelLighting.test.mjs` pins the option at every drawn model call; every model is built from the fleet set loaded up front, so there is no separate preload. - The DISPLAY-rail `3D` toggle is the user-facing activation path for both aircraft layers. Their small approved GLBs build their render resources without Cesium's frame-spread job queue, preventing continuous Photorealistic 3D Tiles streaming from starving model readiness; model caps, tracking, camera, and fallback billboards are unchanged. - **The `3D` toggle DEFAULTS ON in `proximity` on a first run.** Proximity is itself the budget — models appear only below `MODEL_ALT_CEIL_M` and only for the nearest `MODEL_MAX` in view — so the default costs nothing at globe scale, and `all` remains a deliberate opt-in. A fresh boot runs NO layer-state restoration (`LayerStateCoordinator.start()` returns early with neither a share payload nor stored state), so four independent initializers decide what a first-run operator sees and must agree: `booleanOption('models3d', 'e', true)` in `src/data/layerState.js`, `_models3dEnabled = true` in BOTH flight layers, `this._models3dEnabled = true` in `src/ui/aircraftDisplay.js`, and the `active` / `visible` classes on `#models3d-toggle` / `#models3d-mode-row` in `index.html`. All four are pinned together in `src/data/layerState.test.mjs`. Explicit state still wins: because the codec omits default-valued options, `models3d: false` is now what travels in a link (`lo=…f.e.0`) and restores OFF at both aircraft layers. **Consequence for returning users:** a stored `gev:layer-state:v2` blob is a FULL options snapshot, so a session that wrote one before this change carries `models3d:false` and keeps 3D off until the operator flips it (or clears the key) — the durable snapshot is treated as the recipient's own state, by design. @@ -8557,7 +8627,11 @@ clock drives all enabled observation rows. Earlier/Later use the sorted union of non-suspended products' advertised times; each product selects its nearest frame at or before the requested UTC time, never a future frame or an interpolation. The maximum gap is 30 minutes for radar, regional infrared and lightning, and -3 hours for hourly global infrared. A missing eligible frame hides that product +3 hours for hourly global infrared, but never less than one and a half of the +feed's median frame spacing over its latest frames, so a regional feed whose +frames come an hour apart holds each for 90 minutes; the latest frame reads late +after the same floor (20 minutes for radar and regional infrared, 45 for +lightning, 4 hours for global infrared). A missing eligible frame hides that product and reports the gap; rows show actual displayed UTC time with synced/nearest labels. Manifest rollover preserves the requested history time, even when frames expire. diff --git a/index.html b/index.html index f3057f742..806a8b41b 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/public/models/README.md b/public/models/README.md index 49d22b4c9..3f97820d3 100644 --- a/public/models/README.md +++ b/public/models/README.md @@ -19,6 +19,12 @@ How the layers use them: type's published length (a vessel to its reported AIS length and beam), so every model is drawn life size. Ground objects, balloons and obstacles in the `other` category are drawn at the size they are built. +- An aid to navigation (a vessel record whose type names a buoy, beacon, IALA + mark, RACON or light, or whose MMSI is an aid station's `99MIDxxxx`) is + drawn as the `buoys` model of its mark (cardinal north, east, south or west, + port or starboard hand, safe water, isolated danger, special mark), a red + can when its type names no mark, at its built size and with no heading + (`vesselModelSpec`, `aidToNavigationModel`). - An aircraft model's origin is its axis; it stands that model's scaled clearance above the ground. A ship's origin is its waterline, and a transit or rail vehicle's the road or rail top (a monorail or gondola is raised by diff --git a/scripts/format-scope.json b/scripts/format-scope.json index d35cc3cf0..03492b28e 100644 --- a/scripts/format-scope.json +++ b/scripts/format-scope.json @@ -1531,5 +1531,15 @@ "src/data/fleetModelInstances.test.mjs", "src/testSupport/fleetGlb.mjs", "src/testSupport/fleetModelFakes.mjs", - "scripts/measure-fleet-trail-anchors.mjs" + "scripts/measure-fleet-trail-anchors.mjs", + "src/ui/panelEdge.js", + "src/ui/railEdgeScroll.js", + "src/ui/railEdgeScroll.test.mjs", + "src/ui/kit/UiPanelEdge.vue", + "src/ui/styles/rail-edge.css", + "src/ui/styles/rail-split.css", + "src/ui/styles/left-tools.css", + "src/ui/styles/panel-edge.css", + "src/data/placementProvider.test.mjs", + "src/layers/vessels/placement.test.mjs" ] diff --git a/scripts/package-boundaries.json b/scripts/package-boundaries.json index f9c9de3bc..a4f835e63 100644 --- a/scripts/package-boundaries.json +++ b/scripts/package-boundaries.json @@ -209,6 +209,8 @@ "src/ui/kit/UiSegmented.vue", "src/ui/rail/RailPanel.vue", "src/ui/kit/UiPanel.vue", + "src/ui/kit/UiPanelEdge.vue", + "src/ui/panelEdge.js", "src/ui/kit/UiPanelToggle.vue", "src/ui/stores/panelChrome.js", "src/ui/rail/PanelCollapseButton.vue", @@ -310,6 +312,7 @@ "src/data/adsbLolFallback.js", "src/data/aisStreamAdapter.js", "src/data/aisWatchdog.js", + "src/data/vesselTypes.js", "src/sources/httpBody.js", "src/i18n/marker.js", "server/providers/acartia.js", @@ -1292,6 +1295,7 @@ "src/render/camera/followTransition.js", "src/render/cesium/internals.js", "src/render/cesium/common.js", + "src/ui/railEdgeScroll.js", "src/ui/localePicker.js", "src/ui/cyberSonarControls.js", "src/ui/locationNavigation.js", @@ -1769,6 +1773,7 @@ "exports": ["./layers/flights"], "modules": [ "src/data/fleetModels.js", + "src/data/vesselTypes.js", "src/data/fleetTrailAnchors.js", "src/data/fleetModelInstances.js", "src/data/headingDegrees.js", @@ -1901,7 +1906,8 @@ "src/render/cesium/zoomOutGuard.js", "src/render/cesium/sceneOcclusionProbe.js", "src/render/occlusion/depthProbe.js", - "src/data/detectionOcclusion.js" + "src/data/detectionOcclusion.js", + "src/layers/flights/placed.js" ], "external": ["cesium", "kdbush"] }, @@ -1911,6 +1917,7 @@ "src/layers/flights/modelSpec.js", "src/layers/flights/policy.js", "src/data/fleetModels.js", + "src/data/vesselTypes.js", "src/data/fleetTrailAnchors.js", "src/data/fleetModelInstances.js", "src/data/headingDegrees.js", @@ -2035,7 +2042,8 @@ "src/render/cesium/zoomOutGuard.js", "src/render/cesium/sceneOcclusionProbe.js", "src/render/occlusion/depthProbe.js", - "src/data/detectionOcclusion.js" + "src/data/detectionOcclusion.js", + "src/layers/flights/placed.js" ], "external": ["cesium", "kdbush"] }, @@ -4503,6 +4511,7 @@ "src/styles/surveillance.js", "src/styles/thermal.js", "src/ui/applicationShell.js", + "src/ui/railEdgeScroll.js", "src/ui/mobileShell.js", "src/ui/localePicker.js", "src/ui/cyberSonarControls.js", @@ -5288,7 +5297,9 @@ "src/layers/vessels/photos.js", "src/viewSky.js", "src/viewWeather.js", - "src/render/weather.js" + "src/render/weather.js", + "src/layers/flights/placed.js", + "src/data/placementProvider.js" ], "external": [ "hls.js", @@ -6106,7 +6117,9 @@ "src/render/vectorBase/paint.js", "src/render/vectorBase/expressions.js", "src/layers/vessels/photos.js", - "src/data/openVesselPhoto.js" + "src/data/openVesselPhoto.js", + "src/layers/flights/placed.js", + "src/data/placementProvider.js" ], "external": [ "hls.js", @@ -6519,6 +6532,7 @@ "src/data/aircraftClass.js", "src/data/aircraftEmergency.js", "src/data/fleetModels.js", + "src/data/vesselTypes.js", "src/data/fleetTrailAnchors.js" ], "external": [] @@ -6931,6 +6945,7 @@ "exports": ["./layers/transit/standalone"], "modules": [ "src/data/fleetModels.js", + "src/data/vesselTypes.js", "src/data/aircraftClass.js", "src/i18n/marker.js", "src/data/fleetModelInstances.js", @@ -7082,6 +7097,7 @@ "modules": [ "src/i18n/marker.js", "src/data/fleetModels.js", + "src/data/vesselTypes.js", "src/data/fleetModelInstances.js", "src/data/aircraftClass.js", "src/data/aircraftModelLighting.js", diff --git a/server/providers/transitHistory.test.mjs b/server/providers/transitHistory.test.mjs index 551fee7a7..aeed8308a 100644 --- a/server/providers/transitHistory.test.mjs +++ b/server/providers/transitHistory.test.mjs @@ -202,3 +202,25 @@ test('a feed fleet-number mode outranks its route mode in the epoch context', (t assert.equal(h.get('ttc', '4507', 100000).epochs[0].mode, 'tram'); assert.equal(h.get('ttc', 'x1', 100000).epochs[0].mode, 'tram'); }); +test('the epoch mode is the live mode: a route type, else hints, else the default', (t) => { + const h = history(t); + const pid = { + id: 'pid', + historyRetention: true, + defaultMode: 'bus', + routeMode: (route) => (route === 'L22' ? 'tram' : 'unknown'), + }; + h.ingest( + pid, + [ + row(100000, 'a', { routeId: 'L58', routeType: 11 }), + row(100000, 'b', { routeId: 'L22' }), + row(100000, 'c', { routeId: 'L9999' }), + ], + 100000, + ); + assert.equal(h.get('pid', 'a', 100000).epochs[0].mode, 'trolleybus'); + assert.equal(h.get('pid', 'b', 100000).epochs[0].mode, 'tram'); + // A hint that knows nothing leaves the default, as the live layer does. + assert.equal(h.get('pid', 'c', 100000).epochs[0].mode, 'bus'); +}); diff --git a/server/providers/vessels/ais-live.js b/server/providers/vessels/ais-live.js index cb1dd36b0..e525763ef 100644 --- a/server/providers/vessels/ais-live.js +++ b/server/providers/vessels/ais-live.js @@ -27,6 +27,8 @@ const AISSTREAM_DEFAULT_MESSAGE_TYPES = [ 'ExtendedClassBPositionReport', 'ShipStaticData', 'StaticDataReport', + // Buoys, beacons and other aids to navigation (AIS message 21). + 'AidsToNavigationReport', ]; // Watchdog budgets (policy lives in src/data/aisWatchdog.js). Silence is // REPORTED quickly and ACTED ON slowly: a dead feed must read as dead within diff --git a/server/providers/vessels/ais-store.js b/server/providers/vessels/ais-store.js index c18a43d85..6c4d8a57a 100644 --- a/server/providers/vessels/ais-store.js +++ b/server/providers/vessels/ais-store.js @@ -1,4 +1,8 @@ import { isRecognizedAisEnvelope } from '../../../src/data/aisStreamAdapter.js'; +import { + aidToNavigationTypeName, + isAidToNavigation, +} from '../../../src/data/vesselTypes.js'; export const AISSTREAM_CACHE_MAX = 50000; export const AISSTREAM_STALE_MS = 30 * 60 * 1000; // Per-MMSI recent-path ring buffers (PRD WS-F F3). Float32 lat/lon (~1m @@ -112,13 +116,21 @@ export function ingestAisStreamEnvelope(envelope) { if (!Number.isFinite(lat) || !Number.isFinite(lon)) return true; const staticData = _aisStreamStatic.get(mmsi) || {}; + const aidReport = messageType === 'AidsToNavigationReport'; _aisStreamVessels.set(mmsi, { lat, lon, - name: vesselNameFromAis(metadata, message, staticData) || `MMSI ${mmsi}`, + name: + (aidReport && aidNameFromAis(message)) || + vesselNameFromAis(metadata, message, staticData) || + `MMSI ${mmsi}`, mmsi, imo: stringValue(message.ImoNumber ?? message.IMO ?? staticData.imo), - type: vesselTypeFromAis(message, staticData), + // An aid-to-navigation report's type is the kind of aid (0 to 31), not + // a ship type: it is carried as the aid's name ("Cardinal Mark N"). + type: aidReport + ? aidToNavigationTypeName(message.Type) + : vesselTypeFromAis(message, staticData), destination: stringValue(message.Destination ?? staticData.destination), length: staticData.length ?? null, beam: staticData.beam ?? null, @@ -131,6 +143,9 @@ export function ingestAisStreamEnvelope(envelope) { // Use the AIS message's own report time, not server ingest wall-clock — // trail spacing and dead reckoning depend on true fix epochs. last_position_epoch: aisEpochSeconds(metadata.time_utc ?? metadata.TimeUtc), + // A virtual aid is broadcast where nothing physical stands. Only such a + // row carries the field, so ship rows stay their size. + ...(aidReport && message.VirtualAtoN === true && { virtual: true }), _updatedAt: Date.now(), }); @@ -276,6 +291,15 @@ function vesselNameFromAis(metadata, message, staticData = {}) { ); } +/** + * An aid's whole name: an aid-to-navigation report carries the first 20 + * characters in `Name` and the rest, up to 14 more, in `NameExtension`. + */ +function aidNameFromAis(message) { + const name = stringValue(message.Name); + return name ? stringValue(name + stringValue(message.NameExtension)) : ''; +} + function vesselTypeFromAis(message, staticData = {}) { return stringValue( message.Type ?? @@ -285,14 +309,25 @@ function vesselTypeFromAis(message, staticData = {}) { ); } +/** + * The current rows, newest first, with every vessel ahead of every aid to + * navigation: a capped request never gives up a ship for a buoy. + */ export function aisStreamRows(maxRows) { const cutoff = Date.now() - AISSTREAM_STALE_MS; - const rows = []; + const vessels = []; + const aids = []; for (const row of _aisStreamVessels.values()) { - if (row._updatedAt >= cutoff) rows.push(row); + if (row._updatedAt >= cutoff) + (isAidToNavigation(row) ? aids : vessels).push(row); } - rows.sort((a, b) => b._updatedAt - a._updatedAt); - return rows.slice(0, maxRows).map(({ _updatedAt, ...row }) => row); + const newestFirst = (a, b) => b._updatedAt - a._updatedAt; + vessels.sort(newestFirst); + if (vessels.length < maxRows) aids.sort(newestFirst); + return vessels + .concat(aids) + .slice(0, maxRows) + .map(({ _updatedAt, ...row }) => row); } function pruneAisStreamCache() { diff --git a/src/app/constructCatalog.js b/src/app/constructCatalog.js index d89d60e67..ed6821edd 100644 --- a/src/app/constructCatalog.js +++ b/src/app/constructCatalog.js @@ -6,6 +6,7 @@ import { createWeatherLayer } from '../layers/weather/index.js'; import { createApplicationCyclones } from './layers/cyclones.js'; import { createWindLayer } from '../layers/wind/index.js'; import { createLayerCatalog } from './catalog.js'; +import { layerPlacement } from '../data/placementProvider.js'; import { LAYER_STATE_REGISTRY } from '../data/layerState.js'; import { createMilitaryRegistry } from '../layers/aircraft/classification.js'; import { createApplicationFlights } from './layers/flights.js'; @@ -63,6 +64,9 @@ export const APPLICATION_LAYER_METADATA = Object.freeze([ /** Construct the current catalog without choosing any source provider. * Scene engines remain page-owned; layers and classification have this app's lifetime. * The manager owns layer destruction, while abort releases classification even if startup fails. + * `placement`, a host-supplied placement provider (../data/placementProvider.js), + * places live aircraft, vessels, transit and trains; without one each layer + * uses its own motion. */ export function createApplicationCatalog({ surface, @@ -74,6 +78,7 @@ export function createApplicationCatalog({ resolveAsset, nepalBoundaryResolver, streetLevelProviders, + placement = null, }) { if (!signal?.addEventListener) throw new TypeError('An application lifetime signal is required'); @@ -97,17 +102,20 @@ export function createApplicationCatalog({ const flights = createApplicationFlights({ surface, source: sources.flights, + placement: layerPlacement(placement, 'aircraft'), militaryRegistry, resolveAsset, }); const military = createApplicationMilitary({ surface, source: sources.military, + placement: layerPlacement(placement, 'military'), militaryRegistry, resolveAsset, }); const vessels = createApplicationVessels({ source: sources.vessels, + placement: layerPlacement(placement, 'vessels'), options: vesselOptions, displayParams: () => flights.getParams(), ...(resolveAsset ? { resolveAsset } : {}), @@ -172,6 +180,7 @@ export function createApplicationCatalog({ createApplicationTransit({ surface, source: sources.transit, + placement: layerPlacement(placement, 'transit'), displayParams: () => flights.getParams(), ...(resolveAsset ? { resolveAsset } : {}), }), @@ -210,6 +219,7 @@ export function createApplicationCatalog({ createApplicationRail({ surface, source: sources.rail, + placement: layerPlacement(placement, 'rail'), displayParams: () => flights.getParams(), ...(resolveAsset ? { resolveAsset } : {}), }), diff --git a/src/app/layers/aisLiveVessels.js b/src/app/layers/aisLiveVessels.js index 65edc5d63..1f2a0ed85 100644 --- a/src/app/layers/aisLiveVessels.js +++ b/src/app/layers/aisLiveVessels.js @@ -16,9 +16,11 @@ import { fleetModelServices } from './fleetModels.js'; * Construct one layer using the application scene owners and a supplied * source. `displayParams` reads the Flights layer's DISPLAY-rail 3D * preference, under which nearby vessels are drawn as fleet models. + * `placement`: a host-supplied placement for its live vessels, or null. */ export function createApplicationVessels({ source, + placement = null, options = {}, displayParams = null, resolveAsset, @@ -38,6 +40,7 @@ export function createApplicationVessels({ worldFocus, render, readouts, + placement, fleet: fleetModelServices({ display: displayParams, ...(resolveAsset ? { resolveAsset } : {}), diff --git a/src/app/layers/flights.js b/src/app/layers/flights.js index 38f880a05..94fae26ee 100644 --- a/src/app/layers/flights.js +++ b/src/app/layers/flights.js @@ -12,11 +12,13 @@ import * as context from '../../data/contextStore.js'; import * as render from '../../renderGovernor.js'; import * as recession from '../../data/aircraftRecession.js'; -/** Construct one layer using the application scene owners and a supplied source. */ +/** Construct one layer using the application scene owners and a supplied source. + * `placement`: a host-supplied placement for its live aircraft, or null. */ export function createApplicationFlights({ surface, source, militaryRegistry, + placement = null, resolveAsset = (url) => `${import.meta.env?.BASE_URL || '/'}${url.replace(/^\//, '')}`, }) { @@ -41,6 +43,7 @@ export function createApplicationFlights({ render, groundSnap, recession, + placement, }, }); } diff --git a/src/app/layers/militaryFlights.js b/src/app/layers/militaryFlights.js index 839220c54..fbedd20aa 100644 --- a/src/app/layers/militaryFlights.js +++ b/src/app/layers/militaryFlights.js @@ -12,11 +12,13 @@ import * as context from '../../data/contextStore.js'; import * as render from '../../renderGovernor.js'; import * as recession from '../../data/aircraftRecession.js'; -/** Construct one layer using the application scene owners and a supplied source. */ +/** Construct one layer using the application scene owners and a supplied source. + * `placement`: a host-supplied placement for its live aircraft, or null. */ export function createApplicationMilitary({ surface, source, militaryRegistry, + placement = null, resolveAsset = (url) => `${import.meta.env?.BASE_URL || '/'}${url.replace(/^\//, '')}`, }) { @@ -41,6 +43,7 @@ export function createApplicationMilitary({ render, groundSnap, recession, + placement, }, }); } diff --git a/src/app/layers/rail.js b/src/app/layers/rail.js index 0da037ceb..883b5f877 100644 --- a/src/app/layers/rail.js +++ b/src/app/layers/rail.js @@ -15,13 +15,15 @@ import { * ground floor, the same floor Transit and the aircraft stand on. * `displayParams` reads the Flights layer's DISPLAY-rail 3D preference, under * which nearby trains are drawn as fleet models. - * @param {{surface: object, source?: object, + * `placement` is a host-supplied placement for its live trains, or null. + * @param {{surface: object, source?: object, placement?: object|null, * displayParams?: () => object|null, resolveAsset?: (url: string) => string}} options * @returns {object} */ export function createApplicationRail({ surface, source, + placement = null, displayParams = null, resolveAsset, }) { @@ -35,6 +37,7 @@ export function createApplicationRail({ sprites, picking, overlays, + placement, credits: { registerDynamicCredit, railFeedCredit }, ground: { GROUND_FLOOR_LIFT_M: groundFloor.GROUND_FLOOR_LIFT_M, diff --git a/src/app/layers/transit.js b/src/app/layers/transit.js index 1b430a957..5e89a1f47 100644 --- a/src/app/layers/transit.js +++ b/src/app/layers/transit.js @@ -23,13 +23,15 @@ import { * `displayParams` reads the Flights layer's DISPLAY-rail 3D preference, under * which nearby vehicles are drawn as fleet models. * - * @param {{surface: object, source?: object, + * `placement` is a host-supplied placement for its live vehicles, or null. + * @param {{surface: object, source?: object, placement?: object|null, * displayParams?: () => object|null, resolveAsset?: (url: string) => string}} options * @returns {object} */ export function createApplicationTransit({ surface, source, + placement = null, displayParams = null, resolveAsset, }) { @@ -43,6 +45,7 @@ export function createApplicationTransit({ sprites, picking, overlays, + placement, credits: { registerDynamicCredit, transitFeedCredit }, ground: { GROUND_FLOOR_LIFT_M: groundFloor.GROUND_FLOOR_LIFT_M, diff --git a/src/contextTabKeyboard.test.mjs b/src/contextTabKeyboard.test.mjs index f50b30469..9ebd0e384 100644 --- a/src/contextTabKeyboard.test.mjs +++ b/src/contextTabKeyboard.test.mjs @@ -4,18 +4,31 @@ import { _selectContextMode } from './ui/contextTransactions.js'; import { _initGlobalContextPanel } from './ui/contextBindings.js'; import { clearSelectedLayers } from './ui/contextActions.js'; import { readFileSync as readRadioSource } from 'node:fs'; -const radioBindings = readRadioSource(new URL('./ui/radioBindings.js', import.meta.url), 'utf8'); -const contextView = readRadioSource(new URL('./ui/views/ContextView.vue', import.meta.url), 'utf8'); +const radioBindings = readRadioSource( + new URL('./ui/radioBindings.js', import.meta.url), + 'utf8', +); +const contextView = readRadioSource( + new URL('./ui/views/ContextView.vue', import.meta.url), + 'utf8', +); import { readFileSync } from 'node:fs'; import { test } from 'node:test'; import assert from 'node:assert/strict'; -const html = await renderApplicationHtml(readFileSync(new URL('../index.html', import.meta.url), 'utf8')); +const html = await renderApplicationHtml( + readFileSync(new URL('../index.html', import.meta.url), 'utf8'), +); const css = readStylesheet(new URL('../style.css', import.meta.url)); test('Contacts and Space Missions both participate in the ordinary Tab sequence', () => { - for (const id of ['global-context-flights-btn', 'global-context-missions-btn']) { - const button = html.match(new RegExp(`