mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-20 18:22:25 +00:00
Upstream's layers and changes are carried onto the ports, with no Cesium outside src/render and no reach into the viewer: - Shipwrecks draw as one icon set, clicked through the input dispatcher. - News draws through draw sets, the camera port and the input dispatcher; its beacons pulse each frame through the frame port. - The scene occlusion probe moves into src/render/cesium and reaches detection through a new application hook, createOcclusionProbe; its private Cesium reads go through internals.js. - Flight and military trails, the stale and SIGNAL LOST cue, coasting and following the world clock run on the draw and frame ports. GPU icons follow the scene clock while the world clock is followed, and fade when stale. A report that holds is not planned again every tick. - Vessels are keyed by their record id. The stub boot now enables military, shipwrecks and news as well.
58 lines
1.9 KiB
JavaScript
58 lines
1.9 KiB
JavaScript
import { findQuery } from '../../render/rendererOf.js';
|
|
import { FOCUS_EVIDENCE_DEV } from './policy.js';
|
|
|
|
export function createEvidence({
|
|
vesselState,
|
|
services,
|
|
parts: components,
|
|
layer,
|
|
options,
|
|
}) {
|
|
const { state } = vesselState;
|
|
|
|
/** Replace live AIS rows through the production reconciliation path (DEV only). */
|
|
|
|
function _setFocusEvidenceVessels(rows = []) {
|
|
if (!FOCUS_EVIDENCE_DEV || !state.viewer || !state.icons) {
|
|
return { ok: false, count: 0 };
|
|
}
|
|
components.selection.clearVesselInspection();
|
|
components.snapshots.reconcileVessels(
|
|
state.viewer,
|
|
Array.isArray(rows) ? rows : [],
|
|
);
|
|
state.feed.count = state.records.all.length;
|
|
state.feed.loaded = true;
|
|
state.feed.error = null;
|
|
state.feed.stale = false;
|
|
state.feed.partial = false;
|
|
state.feed.lastUpdate = Date.now();
|
|
state.feed.transportStatus = 'synthetic';
|
|
state.feed.lastMessageAt = null;
|
|
state.feed.rawRowCount = Array.isArray(rows) ? rows.length : 0;
|
|
state.feed.acceptedRowCount = state.feed.count;
|
|
return { ok: true, count: state.feed.count };
|
|
}
|
|
|
|
/** JSON-safe vessel alpha/position snapshot for the evidence report. */
|
|
|
|
function _focusEvidenceVesselSnapshot() {
|
|
if (!FOCUS_EVIDENCE_DEV || !state.viewer) return [];
|
|
const query = findQuery(state.viewer);
|
|
return state.records.all.map((record) => {
|
|
const visual = components.rendering.getVisual(record);
|
|
const drawn = state.icons?.has(visual.iconId) === true;
|
|
const position = drawn ? visual.position : null;
|
|
const screen = position ? query?.project(position) : null;
|
|
return {
|
|
id: record.id,
|
|
show: drawn && visual.visible === true,
|
|
alpha: drawn ? state.icons.focus(visual.iconId) : null,
|
|
x: screen?.x ?? null,
|
|
y: screen?.y ?? null,
|
|
};
|
|
});
|
|
}
|
|
return { _setFocusEvidenceVessels, _focusEvidenceVesselSnapshot };
|
|
}
|