mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-05 19:04:02 +00:00
Format extracted vessel components
This commit is contained in:
1 parent
2f4839e8f2
commit
a0b2d9f6aa
17 files changed
+2693
-2385
No files matched your search
@@ -1,48 +1,58 @@
|
||||
import * as Cesium from 'cesium';
|
||||
import { FOCUS_EVIDENCE_DEV } from './policy.js';
|
||||
|
||||
export function createEvidence({ vesselState, services, parts: components, layer, options }) {
|
||||
const { state } = vesselState;
|
||||
export function createEvidence({
|
||||
vesselState,
|
||||
services,
|
||||
parts: components,
|
||||
layer,
|
||||
options,
|
||||
}) {
|
||||
const { state } = vesselState;
|
||||
|
||||
/** Replace live AIS rows through the production reconciliation path (DEV only). */
|
||||
|
||||
/** Replace live AIS rows through the production reconciliation path (DEV only). */
|
||||
|
||||
function _setFocusEvidenceVessels(rows = []) {
|
||||
if (!FOCUS_EVIDENCE_DEV || !state.viewer || !state.billboardCollection) {
|
||||
return { ok: false, count: 0 };
|
||||
function _setFocusEvidenceVessels(rows = []) {
|
||||
if (!FOCUS_EVIDENCE_DEV || !state.viewer || !state.billboardCollection) {
|
||||
return { ok: false, count: 0 };
|
||||
}
|
||||
components.selection.clearVesselInspection();
|
||||
components.store.reconcileVessels(
|
||||
state.viewer,
|
||||
Array.isArray(rows) ? rows : [],
|
||||
);
|
||||
state.count = state.vesselRecords.length;
|
||||
state.loaded = true;
|
||||
state.error = null;
|
||||
state.stale = false;
|
||||
state.lastUpdate = Date.now();
|
||||
state.transportStatus = 'synthetic';
|
||||
state.lastMessageAt = null;
|
||||
state.rawRowCount = Array.isArray(rows) ? rows.length : 0;
|
||||
state.acceptedRowCount = state.count;
|
||||
return { ok: true, count: state.count };
|
||||
}
|
||||
components.selection.clearVesselInspection();
|
||||
components.store.reconcileVessels(state.viewer, Array.isArray(rows) ? rows : []);
|
||||
state.count = state.vesselRecords.length;
|
||||
state.loaded = true;
|
||||
state.error = null;
|
||||
state.stale = false;
|
||||
state.lastUpdate = Date.now();
|
||||
state.transportStatus = 'synthetic';
|
||||
state.lastMessageAt = null;
|
||||
state.rawRowCount = Array.isArray(rows) ? rows.length : 0;
|
||||
state.acceptedRowCount = state.count;
|
||||
return { ok: true, count: state.count };
|
||||
}
|
||||
|
||||
/** JSON-safe vessel alpha/position snapshot for the evidence report. */
|
||||
|
||||
/** JSON-safe vessel alpha/position snapshot for the evidence report. */
|
||||
|
||||
function _focusEvidenceVesselSnapshot() {
|
||||
if (!FOCUS_EVIDENCE_DEV || !state.viewer) return [];
|
||||
return state.vesselRecords.map((record) => {
|
||||
const bb = record.billboard;
|
||||
const screen = bb?.position
|
||||
? Cesium.SceneTransforms.worldToWindowCoordinates(state.viewer.scene, bb.position)
|
||||
: null;
|
||||
return {
|
||||
id: record.mmsi,
|
||||
show: bb?.show === true,
|
||||
alpha: bb?.color?.alpha ?? null,
|
||||
x: screen?.x ?? null,
|
||||
y: screen?.y ?? null,
|
||||
};
|
||||
});
|
||||
}
|
||||
return { _setFocusEvidenceVessels, _focusEvidenceVesselSnapshot };
|
||||
function _focusEvidenceVesselSnapshot() {
|
||||
if (!FOCUS_EVIDENCE_DEV || !state.viewer) return [];
|
||||
return state.vesselRecords.map((record) => {
|
||||
const bb = record.billboard;
|
||||
const screen = bb?.position
|
||||
? Cesium.SceneTransforms.worldToWindowCoordinates(
|
||||
state.viewer.scene,
|
||||
bb.position,
|
||||
)
|
||||
: null;
|
||||
return {
|
||||
id: record.mmsi,
|
||||
show: bb?.show === true,
|
||||
alpha: bb?.color?.alpha ?? null,
|
||||
x: screen?.x ?? null,
|
||||
y: screen?.y ?? null,
|
||||
};
|
||||
});
|
||||
}
|
||||
return { _setFocusEvidenceVessels, _focusEvidenceVesselSnapshot };
|
||||
}
|
||||
Reference in new issue
Block a user