Merge remote-tracking branch 'origin/main' into german/map-render-error-state

# Conflicts:
#	src/app/scene.js
#	src/app/viewer.js
#	src/i18n/locales/ar.json
#	src/i18n/locales/de.json
#	src/i18n/locales/es.json
#	src/i18n/locales/fr.json
#	src/i18n/locales/it.json
#	src/i18n/locales/ja.json
#	src/i18n/locales/pt.json
#	src/i18n/locales/ru.json
#	src/i18n/locales/uk.json
#	src/i18n/locales/zh-CN.json
#	src/i18n/locales/zh-Hant.json
#	src/ui/views/SceneChromeView.vue
This commit is contained in:
German Khokhlov committed 2026-11-10 14:29:34 +04:00
commit 2448662574
608 files changed
+105160 -2242

No files matched your search

+71 -1
View File
@@ -34,7 +34,13 @@ export const useCockpitStore = defineStore('gev-cockpit', () => {
context.value = next && markRaw(next);
}
/** The presented instruments; null until the first HUD update. */
/**
* The presented instruments; null until the first HUD update. Besides the
* readouts, `look: { offset, yawDeg, readout }` says whether a bridge view
* is turned off the bow, the yaw it is turned to (degrees in -180..180,
* starboard positive; the radar draws its look line there) and the worded
* readout. An aircraft's look always rests (`offset: false`).
*/
const instruments = shallowRef(null);
/** @param {?object} next A fresh presentation of the instruments. */
@@ -66,6 +72,66 @@ export const useCockpitStore = defineStore('gev-cockpit', () => {
signals.value = next && markRaw(next);
}
/**
* The bridge radar: null outside a vessel bridge. Shape:
* `{ rangeNm, rangeLabel, ringsNm: number[], headingDeg,
* ownRelativeCourseDeg|null,
* contacts: [{ id, name, x, y, distanceNm, relativeBearingDeg,
* relativeCourseDeg|null, color, stale }] }` where x/y are heading-up
* screen fractions in [-1, 1] (x right, y up) of the range circle.
*/
const radar = shallowRef(null);
/** @param {?object} next A fresh presentation of the bridge radar. */
function publishRadar(next) {
radar.value = next && markRaw(next);
}
/**
* The orbital view's HUD: null outside a satellite subject. Shape:
* `{ name, classLabel, altitudeM, velocityMps|null, latitude, longitude,
* zoom, zoomSteps: number[], maxZoom, footprintKm|null,
* sensor: { label|null, swathKm, stripFraction|null, zoom|null }|null,
* transition: { active, blurPx, lockTick },
* look: { offset, readout, swathScale, swathKm|null,
* focus: { key, label }|null }, trackUp, northDeg,
* place: { kind: 'country'|'sea'|'ocean', name, countryCode,
* division?|null, near?|null }|null|undefined,
* noradId|null, cosparId|null, tle: { line1, line2, epochMs }|null,
* tleAgeMs|null (now minus the TLE epoch, read on each publish),
* owner: { countryCode|null, label|null }|null, operator|null }` where
* `place` is what the sub-satellite point is over (undefined until the
* first offline lookup lands, null when nothing named holds it; see
* src/data/placeBelow.js), the identity fields come from the satellites
* layer and are null when unknown, `classLabel` is
* already localized (the satellite layer's class label, e.g. "NAV · GPS"),
* `velocityMps` is the orbital (inertial) speed, latitude/longitude are the
* sub-satellite point in degrees, `zoom` is one of `zoomSteps` (1, 2, 4, 8,
* and up to 128 for an imaging satellite with a known sensor: `maxZoom`) or
* the SENSOR step's zoom between them, `sensor` is the imaging sensor's
* narrowest swath with the fraction of the view it spans (kept off nadir)
* and the zoom that frames it (null when outside 1x..maxZoom),
* `footprintKm` is the nadir ground width across the frame at that zoom
* (null while the view is tilted off nadir), `transition` is a zoom step in
* flight: `active` while the field of view moves, `blurPx` the focus-pull
* blur for the picture, `lockTick` true briefly once the step settles (see
* src/cockpitOrbital.js), `look` says whether the view is tilted off
* nadir and words the tilt (`readout`, '' at nadir), with the approximate
* ground width at the tilted view's centre (`swathKm`, null at nadir) and
* its ratio to the nadir footprint (`swathScale`, 1 at nadir) and the
* mapped point a ground focus holds the view on (`focus`; the readout
* then gives the single off-nadir angle to it), `trackUp`
* whether the view is turned to the ground track (false for a satellite with none,
* which stays north-up) and `northDeg` where north sits, in degrees
* clockwise from the top (0 when north-up).
*/
const orbital = shallowRef(null);
/** @param {?object} next A fresh presentation of the orbital view HUD. */
function publishOrbital(next) {
orbital.value = next && markRaw(next);
}
/**
* The utility strip's measured layout: its top and height limits as CSS
* lengths (null leaves the stylesheet's), whether only the expanded control
@@ -101,6 +167,10 @@ export const useCockpitStore = defineStore('gev-cockpit', () => {
publishVision,
signals,
publishSignals,
radar,
publishRadar,
orbital,
publishOrbital,
utilityLayout,
publishUtilityLayout,
};
+166
View File
@@ -0,0 +1,166 @@
import { defineStore } from 'pinia';
import { onScopeDispose, shallowRef } from 'vue';
import { worldClock } from '../../time/worldClock.js';
/** How often a shown timeline moves its readout and its end on with now. */
const LIVE_TICK_MS = 1000;
/** A scrub this close to now, as a share of the track, is a scrub to live. */
const LIVE_EDGE = 0.005;
/** The least that counts as at now, past the readout's own second. */
const LIVE_EDGE_MS = 5000;
/** The speeds play offers, in world ms per real ms. */
export const WORLD_TIME_SPEEDS = Object.freeze({
real: 1,
minute: 60,
hour: 3_600,
day: 86_400,
week: 604_800,
});
/**
* The world clock as the timeline shows it: `{live, playing, stepping,
* buffering, timeMs, supported, span}`, where `supported` says a layer that moves with the clock
* has time to show and `span` is the stretch the timeline runs over: the
* time those layers cover, reaching to now and to the world time, with their
* marks. It follows the page's world clock, which tells it of every move, and
* of the time a few times a second while it plays on its own. While a
* timeline shows, it reads the clock each second itself, so live and the
* track's end keep up with now.
*/
export const useWorldTimeStore = defineStore('gev-world-time', () => {
// The time the layers cover, reaching to now.
const reach = () => {
const coverage = worldClock.coverage();
if (!coverage) return null;
const now = worldClock.wallNow();
return {
start: Math.min(coverage.start, now),
end: Math.max(coverage.end, now),
marks: coverage.marks,
};
};
const spanOf = (state) => {
if (!state.supported) return null;
const covered = reach();
if (!covered) return null;
return Object.freeze({
start: Math.min(covered.start, state.timeMs),
end: Math.max(covered.end, state.timeMs),
marks: covered.marks,
});
};
const nearNow = (ms, length) =>
Math.abs(ms - worldClock.wallNow()) <=
Math.max(LIVE_EDGE_MS, length * LIVE_EDGE);
// Whether the track ends at now (and moves on with it), not past it.
const endsAtNow = (covered) =>
covered.end - worldClock.wallNow() <= LIVE_EDGE_MS;
// Play stops at the end of the track: at now it goes live, past now (a
// satellite's future) it holds there.
let stopping = false;
const stopAtEnd = (state) => {
if (stopping || !state.playing || state.live || !state.supported)
return false;
const covered = reach();
if (!covered || state.timeMs < covered.end) return false;
stopping = true;
try {
if (endsAtNow(covered)) worldClock.goLive();
else {
// Back to the end first, so nothing hears the overshoot as paused.
worldClock.seek(covered.end);
worldClock.pause();
worldClock.seek(covered.end);
}
} finally {
stopping = false;
}
return true;
};
const read = (state = worldClock.getState()) =>
Object.freeze({
live: state.live,
playing: state.playing,
stepping: state.stepping,
buffering: state.buffering,
timeMs: state.timeMs,
supported: state.supported,
span: spanOf(state),
});
const time = shallowRef(read());
const speed = shallowRef('real');
const rate = () => WORLD_TIME_SPEEDS[speed.value];
let ticker = null;
const syncTicker = () => {
// Playing, the clock tells of the time itself.
const ticking = Boolean(time.value.span) && !time.value.playing;
if (ticking && ticker === null)
ticker = setInterval(() => {
time.value = read();
}, LIVE_TICK_MS);
else if (!ticking && ticker !== null) {
clearInterval(ticker);
ticker = null;
}
};
const unsubscribe = worldClock.subscribe((state) => {
if (stopAtEnd(state)) return;
time.value = read(state);
syncTicker();
});
syncTicker();
onScopeDispose(() => {
unsubscribe();
if (ticker !== null) clearInterval(ticker);
ticker = null;
});
return {
time,
/**
* Play runs the track at the speed chosen, from the start when it is at
* its end (at live, say), as a video plays again from the top. It runs
* the clock itself, past weather's own replay: weather follows the time
* frame by frame like every other layer the track covers.
*/
togglePlay() {
const { playing, live, timeMs, span } = time.value;
if (playing) return worldClock.pause();
const covered = reach();
if (span && covered && (live || timeMs >= covered.end))
worldClock.seek(span.start);
worldClock.play({ rate: rate(), continuous: true });
},
speed,
/**
* Choose how fast play runs; playing, it changes at once. Weather's own
* replay steps at its own pace, so a speed chosen while it plays takes
* playback over from where it is.
*/
setSpeed(next) {
if (!Object.hasOwn(WORLD_TIME_SPEEDS, next)) return;
speed.value = next;
const { playing, stepping } = worldClock.getState();
if (!playing) return;
if (!stepping) return worldClock.setRate(rate());
worldClock.pause();
worldClock.play({ rate: rate(), continuous: true });
},
goLive: () => worldClock.goLive(),
/**
* Scrub to `ms`: playback stops where the hand puts it; at now, live.
* How near now counts as now goes by `length`, the stretch the track
* shows, all of the span unless it is zoomed.
*/
scrub(ms, length) {
const span = time.value.span;
length ??= span ? span.end - span.start : 0;
if (nearNow(ms, length)) {
worldClock.goLive();
return;
}
worldClock.pause();
worldClock.seek(ms);
},
};
});