Merge main through #1637 into the renderer seam

Ports the cockpit bridge view, the orbital view riding a satellite with
ground-site focus, satellite classes and draw-mark row actions onto the
renderer contract. The orbital view's imagery look-ahead pre-load is
dropped (no contract member); tiles load as they come on screen.
This commit is contained in:
Sameh Khamis committed 2026-11-10 01:35:00 -08:00
commit e48ed3eb9e
169 files changed
+22415 -681

No files matched your search

+78 -12
View File
@@ -3,7 +3,9 @@ import { nextTick } from 'vue';
import { CockpitViewController, CockpitDisplayPortal } from './cockpit.js';
import {
COCKPIT_AIRCRAFT_LAYER_IDS,
bridgeEntryAllowed,
cockpitEntryAllowed,
orbitEntryAllowed,
} from '../contextModePolicy.js';
import { formatAwarenessLabel } from '../data/militaryAwarenessEngine.js';
import { enterCockpitWithTracking } from '../cockpitTracking.js';
@@ -42,6 +44,9 @@ export class CockpitCoordinator {
const {
flightsLayer,
militaryFlightsLayer,
aisLiveVesselsLayer,
satellitesLayer,
militaryInstallationsLayer,
isTr3b,
toggleTr3b,
militaryAwarenessLayer,
@@ -57,12 +62,16 @@ export class CockpitCoordinator {
fetchRegionalBrief,
regionalDistanceM,
weatherCodeLabel,
acquireOrbitImagery,
} = services;
this._cockpitDisplayPortal = null;
this.cockpitView = new CockpitViewController(viewer, {
services: {
flightsLayer,
militaryFlightsLayer,
aisLiveVesselsLayer,
satellitesLayer,
militaryInstallationsLayer,
isTr3b,
toggleTr3b,
militaryAwarenessLayer,
@@ -79,6 +88,7 @@ export class CockpitCoordinator {
fetchRegionalBrief,
regionalDistanceM,
weatherCodeLabel,
acquireOrbitImagery,
// The Contact card and Live Signals say which feeds are off.
isLayerEnabled: (layerId) => this._isLayerEnabled(layerId),
},
@@ -97,6 +107,19 @@ export class CockpitCoordinator {
contextModeChanging: this._contextModeChanging,
});
},
isBridgeEntryAllowed: () =>
bridgeEntryAllowed({
vesselsEnabled: !!this._dataManager?.isEnabled('ais-live-vessels'),
contextModeChanging: this._contextModeChanging,
}),
isOrbitEntryAllowed: () =>
orbitEntryAllowed({
satellitesEnabled: !!this._dataManager?.isEnabled('satellites'),
contextModeChanging: this._contextModeChanging,
// The layer says whether its class may be ridden.
subjectEnterable:
satellitesLayer?.getCockpitSubject?.()?.enterable !== false,
}),
publish: this.publishCockpit,
isUtilityDisclosureOpen: () => !!this.readUtilityDisclosureOpen?.(),
onEntered: () => this.enterPanels(),
@@ -133,15 +156,21 @@ export class CockpitCoordinator {
return Boolean(layerId) && !!this._dataManager?.isEnabled(layerId);
}
/**
* Make the ridden aircraft's layer the user's own while Contacts is on.
* Contacts may have turned that layer on, and it releases the layers it
* owns when it goes off; the Cockpit must outlive Contacts, so riding an
* aircraft adopts its layer as a direct selection does. Contacts then stops
* owning it and the Context restore keeps it (session `userAdded`).
* @param {string|null} layerId The ridden aircraft's layer.
* Make the ridden layer the user's own while Contacts is on. Contacts may
* have turned that layer on (an aircraft layer, or Live AIS Vessels), and
* it releases the layers it owns when it goes off; the Cockpit must outlive
* Contacts, so riding an aircraft or a vessel adopts its layer as a direct
* selection does. Contacts then stops owning it and the Context restore
* keeps it (session `userAdded`).
* @param {string|null} layerId The ridden aircraft's layer, or
* 'ais-live-vessels' on a bridge.
*/
_adoptRiddenLayer(layerId) {
if (!COCKPIT_AIRCRAFT_LAYER_IDS.includes(layerId)) return;
if (
!COCKPIT_AIRCRAFT_LAYER_IDS.includes(layerId) &&
layerId !== 'ais-live-vessels'
)
return;
if (!this._isLayerEnabled('military-awareness')) return;
this._dataManager?.adoptLayerVisibility?.(layerId, true, {
origin: 'user',
@@ -162,6 +191,16 @@ export class CockpitCoordinator {
_cockpitEntryRefusal() {
if (this._contextModeChanging)
return 'Context is still changing — try Cockpit again in a moment';
// Tracking an aircraft from the bridge ends the bridge and clears the
// vessel selection before the entry can run, leaving neither.
if (this.cockpitView?.active && this.cockpitView.subjectKind === 'vessel')
return 'Cockpit is on a vessel bridge — exit the bridge first, then track an aircraft to enter Cockpit';
// Likewise in orbit: the aircraft's tracking takes the satellite's.
if (
this.cockpitView?.active &&
this.cockpitView.subjectKind === 'satellite'
)
return 'Cockpit is in an orbital view — exit it first, then track an aircraft to enter Cockpit';
if (!this._aircraftLayerEnabled)
return 'No aircraft layer is on — turn on Flights or Military Flights and track an aircraft to enter Cockpit';
return null;
@@ -171,6 +210,16 @@ export class CockpitCoordinator {
const snapshot = militaryAwarenessLayer.getContextSnapshot?.();
const info = this.cockpitView?.readAircraftInfo?.();
const active = Boolean(this.cockpitView?.active);
// Voice enters aircraft only; a bridge in use is still reported as it is.
const vessel =
active && this.cockpitView?.subjectKind === 'vessel'
? this.cockpitView.readVesselInfo?.()
: null;
// Likewise an orbital view in use: its satellite, never an aircraft.
const satellite =
active && this.cockpitView?.subjectKind === 'satellite'
? this.cockpitView.readSatelliteInfo?.()
: null;
const gateOpen = Boolean(this.cockpitView?.isEntryAllowed?.());
// "Could Cockpit be ENTERED right now" — so it is false while already
// inside, unconditionally. Cockpit takes the entity off
@@ -199,13 +248,30 @@ export class CockpitCoordinator {
? 'subject-layer-off'
: 'no-tracked-aircraft',
visionMode: this.cockpitView?.visionMode || null,
subject: info
subject: satellite
? {
id: info.icao24 || info.id || null,
layerId: info.layerId || null,
callsign: info.callsign || null,
kind: 'satellite',
id: satellite.id,
layerId: satellite.layerId,
callsign: null,
name: satellite.name,
}
: null,
: vessel
? {
kind: 'vessel',
id: vessel.mmsi,
layerId: vessel.layerId,
callsign: null,
name: vessel.name,
}
: info
? {
kind: 'aircraft',
id: info.icao24 || info.id || null,
layerId: info.layerId || null,
callsign: info.callsign || null,
}
: null,
navigation: snapshot
? {
canPrevious: Boolean(snapshot.navigation?.canPrevious),