mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 16:22:20 +00:00
feat(cockpit): list orbit's sites and satellites in Live Signals
The orbital Context card is gone and the Contact card stays hidden in orbit again. Live Signals page 1 had nothing in orbit but TRACK ACQUIRED, because orbit feeds no Contacts snapshot; it now lists what is around the satellite, built the way the aircraft rows are, five rows with stable keys rebuilt once a second. Rows already shown keep their places while they still qualify, so a site passing under a low orbit is not pulled from under the pointer. Site rows come from the Mapped Installations layer (getNearby, asked only as far as the reach extends) and focus their site, or release it on the focused site's row, which reads as the subject does. A site the layer drops during its frequent reloads stays listed for 10 s, since sites do not move. With the layer off nothing is listed and a SITES STANDBY row says why. Satellite rows come from the satellites layer's bounded nearest query, measured from the satellite itself, and ride the satellite; RETURN goes back to the one before, skipping one that has left the catalogue. While the camera hops to a new satellite only TRACK ACQUIRED and RETURN show, so nothing is measured from the old position. An arrow pressed while a focus eases back takes the arrows' own clock. Site and satellite rows name their own actions.
This commit is contained in:
1 parent
fad62a4ba8
commit
dd02068ce9
32 files changed
+1562
-1056
No files matched your search
+236
-174
@@ -1,37 +1,59 @@
|
||||
/**
|
||||
* Ground focus in the Cockpit's orbital view: a click on a mapped point, or
|
||||
* FOCUS on the reach list, keeps the camera on that point as the satellite
|
||||
* moves; clicking elsewhere, FOCUS again, NADIR or the target leaving the
|
||||
* off-nadir reach eases the view back. Also builds the list of mapped points
|
||||
* in reach. Bound to the Cockpit controller like the orbital view itself
|
||||
* Ground focus in the Cockpit's orbital view: a site's Live Signals row, or
|
||||
* a click on a mapped site's marker, keeps the camera on that site as the
|
||||
* satellite moves; clicking elsewhere, the site's row again, NADIR or the
|
||||
* site leaving the off-nadir reach eases the view back. Sites come
|
||||
* from the Mapped Installations layer's own records and pick ids. Bound to
|
||||
* the Cockpit controller like the orbital view itself
|
||||
* (src/ui/cockpitOrbitalView.js); its state lives on the orbital session, so
|
||||
* it ends with the session.
|
||||
*/
|
||||
import * as Cesium from 'cesium';
|
||||
import { clampOrbitalLook, easeLook } from '../cockpitLook.js';
|
||||
import { offNadirOrientation } from '../cockpitOrbital.js';
|
||||
import {
|
||||
ORBITAL_REACH_LIST_MAX,
|
||||
ORBITAL_REACH_REFRESH_MS,
|
||||
detailRows,
|
||||
ORBITAL_EARTH_RADIUS_M,
|
||||
offNadirOrientation,
|
||||
} from '../cockpitOrbital.js';
|
||||
import {
|
||||
easeFocusRemainder,
|
||||
focusEaseDtMs,
|
||||
focusInReach,
|
||||
focusLook,
|
||||
geodeticToEcef,
|
||||
pointsInReach,
|
||||
} from '../cockpitOrbitalFocus.js';
|
||||
import {
|
||||
getContextStore,
|
||||
isContextRecordActive,
|
||||
} from '../data/contextStore.js';
|
||||
import { isPointerFree } from '../data/inputOwnership.js';
|
||||
import { pickedKindForLayer } from '../data/pickedContext.js';
|
||||
|
||||
const NADIR_LOOK = Object.freeze({ yawDeg: 0, pitchDeg: 0 });
|
||||
|
||||
/** Only fixed points on the ground are focus targets: no aircraft, ships or satellites. */
|
||||
const GROUND_KINDS = new Set(['feature', 'fire']);
|
||||
/** The Mapped Installations layer's id. */
|
||||
const SITES_LAYER_ID = 'military-installations';
|
||||
|
||||
/** The most sites asked of the layer around the sub-satellite point. */
|
||||
const SITE_QUERY_MAX = 500;
|
||||
|
||||
/** How long a site the layer dropped stays listed, ms (it may come back). */
|
||||
const SITE_MEMORY_MS = 10_000;
|
||||
|
||||
/** The farthest from the sub-satellite point a listed site may lie, m. */
|
||||
const SITE_QUERY_MAX_RANGE_M = 3_000_000;
|
||||
|
||||
/** The greatest angle off nadir the reach allows: 45° on both axes. */
|
||||
const REACH_CORNER_RAD = Math.acos(Math.cos(Math.PI / 4) ** 2);
|
||||
|
||||
/**
|
||||
* How far over the ground the reach extends from the sub-satellite point,
|
||||
* m: the central angle at the reach's corner off nadir (or the horizon, if
|
||||
* nearer), with a little margin, capped. Sites farther out are never asked
|
||||
* of the layer.
|
||||
*/
|
||||
function reachGroundRangeM(altitudeM) {
|
||||
const R = ORBITAL_EARTH_RADIUS_M;
|
||||
const h = Math.max(0, Number.isFinite(altitudeM) ? altitudeM : 0);
|
||||
const sine = ((R + h) / R) * Math.sin(REACH_CORNER_RAD);
|
||||
const central =
|
||||
sine >= 1 ? Math.acos(R / (R + h)) : Math.asin(sine) - REACH_CORNER_RAD;
|
||||
return Math.min(SITE_QUERY_MAX_RANGE_M, R * central * 1.05);
|
||||
}
|
||||
|
||||
/** Whether the user asked for reduced motion: focus turns then cut. */
|
||||
function prefersReducedMotion() {
|
||||
@@ -49,80 +71,103 @@ function inOrbit(controller) {
|
||||
);
|
||||
}
|
||||
|
||||
/** The layers' on/off state, as `isContextRecordActive` reads it. */
|
||||
function layerGate(controller) {
|
||||
function sitesLayer(controller) {
|
||||
return controller.services?.militaryInstallationsLayer ?? null;
|
||||
}
|
||||
|
||||
/** Whether the Mapped Installations layer is on (unknown reads as off). */
|
||||
function sitesLayerOn(controller) {
|
||||
const isLayerEnabled = controller.services?.isLayerEnabled;
|
||||
return typeof isLayerEnabled === 'function'
|
||||
? { isEnabled: (layerId) => isLayerEnabled(layerId) !== false }
|
||||
: null;
|
||||
}
|
||||
|
||||
/** A context record that is a fixed ground point of a layer that is on. */
|
||||
function groundRecord(controller, record) {
|
||||
if (!record || !isContextRecordActive(record, layerGate(controller)))
|
||||
return null;
|
||||
if (!GROUND_KINDS.has(pickedKindForLayer(record.layerId))) return null;
|
||||
if (!Number.isFinite(record.latitude) || !Number.isFinite(record.longitude))
|
||||
return null;
|
||||
return record;
|
||||
}
|
||||
|
||||
/** Where a mapped point is drawn: its rendered anchor, else on the ellipsoid. */
|
||||
function recordPosition(record) {
|
||||
const anchor = record.entity?.__localBaseCartesian;
|
||||
if (
|
||||
anchor &&
|
||||
Number.isFinite(anchor.x) &&
|
||||
Number.isFinite(anchor.y) &&
|
||||
Number.isFinite(anchor.z)
|
||||
)
|
||||
return { x: anchor.x, y: anchor.y, z: anchor.z };
|
||||
return geodeticToEcef(record.latitude, record.longitude, 0);
|
||||
}
|
||||
|
||||
/** The context record a scene pick landed on, when it is a ground point. */
|
||||
function pickedGroundRecord(controller, picked) {
|
||||
if (!picked) return null;
|
||||
const store = getContextStore();
|
||||
for (const carrier of [picked.id, picked.primitive?.id, picked.primitive]) {
|
||||
const contextId =
|
||||
carrier && typeof carrier === 'object' ? carrier.__gevContextId : null;
|
||||
if (!contextId) continue;
|
||||
const record = groundRecord(controller, store.entities.get(contextId));
|
||||
if (record) return record;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/** The focus look at a record from the last frame's satellite, or null. */
|
||||
function lookAt(state, record) {
|
||||
const frame = state.focusFrame;
|
||||
if (!frame) return null;
|
||||
return focusLook(frame.nadir, frame.position, recordPosition(record));
|
||||
? isLayerEnabled(SITES_LAYER_ID) !== false
|
||||
: false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Point the view at a mapped point and keep it there: from the view as it is
|
||||
* now, so switching targets turns rather than jumps. A point beyond the
|
||||
* reach is refused.
|
||||
* @returns {boolean} True when the focus is on that point.
|
||||
* A mapped site by id: as the layer has it loaded now, else, while the
|
||||
* layer is on, as the focus or the Live Signals rows last saw it. The layer
|
||||
* reloads its thinned view as the camera moves, so a site in view can leave
|
||||
* its records for a moment; a site does not move, so its last position
|
||||
* stands. Null with the layer off or the site never seen.
|
||||
*/
|
||||
function startFocus(record) {
|
||||
function siteById(controller, id) {
|
||||
let live = null;
|
||||
try {
|
||||
live = sitesLayer(controller)?.getById?.(id) ?? null;
|
||||
} catch {
|
||||
live = null;
|
||||
}
|
||||
if (live) return live;
|
||||
if (!sitesLayerOn(controller)) return null;
|
||||
const state = controller.orbital;
|
||||
const key = String(id);
|
||||
if (state?.focus?.key === key && state.focus.site) return state.focus.site;
|
||||
return state?.listedSites?.get(key)?.site ?? null;
|
||||
}
|
||||
|
||||
/** Where a site is drawn, ECEF, or null. */
|
||||
function sitePosition(site) {
|
||||
const p = site?.position;
|
||||
return p &&
|
||||
Number.isFinite(p.x) &&
|
||||
Number.isFinite(p.y) &&
|
||||
Number.isFinite(p.z)
|
||||
? { x: p.x, y: p.y, z: p.z }
|
||||
: null;
|
||||
}
|
||||
|
||||
/** The mapped site a canvas position shows, through the layer's pick ids. */
|
||||
function siteAt(controller, position) {
|
||||
let picked = null;
|
||||
try {
|
||||
picked = controller.viewer.scene?.pick?.(position) ?? null;
|
||||
} catch {
|
||||
picked = null;
|
||||
}
|
||||
if (!picked) return null;
|
||||
try {
|
||||
return sitesLayer(controller)?.findByPick?.(picked) ?? null;
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/** The focus look at a site from the last frame's satellite, or null. */
|
||||
function lookAt(state, site) {
|
||||
const frame = state.focusFrame;
|
||||
if (!frame) return null;
|
||||
return focusLook(frame.nadir, frame.position, sitePosition(site));
|
||||
}
|
||||
|
||||
/**
|
||||
* Point the view at a mapped site and keep it there: from the view as it is
|
||||
* now, so switching targets turns rather than jumps. A site beyond the
|
||||
* reach is refused.
|
||||
* @returns {boolean} True when the focus is on that site.
|
||||
*/
|
||||
function startFocus(site) {
|
||||
const state = this.orbital;
|
||||
const look = lookAt(state, record);
|
||||
const look = lookAt(state, site);
|
||||
// Before the first frame there is nothing to measure against; the frame
|
||||
// that follows checks the reach.
|
||||
if (state.focusFrame && !focusInReach(look)) return false;
|
||||
state.focus = {
|
||||
key: String(record.id),
|
||||
label: String(record.label || record.layerName || record.id),
|
||||
key: String(site.id),
|
||||
label: String(site.name || site.id),
|
||||
// Where the site is, kept while the layer reloads around it.
|
||||
site: {
|
||||
id: site.id,
|
||||
name: site.name,
|
||||
class: site.class,
|
||||
position: sitePosition(site),
|
||||
},
|
||||
look,
|
||||
// The view minus the target's look, eased away; set on the next frame.
|
||||
remainder: null,
|
||||
};
|
||||
state.focusReleasing = false;
|
||||
if (look) state.lookTarget = clampOrbitalLook(look);
|
||||
publishOrbitalReach.call(this);
|
||||
this.refreshOrbitalSignals?.();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -135,7 +180,11 @@ function startFocus(record) {
|
||||
*/
|
||||
export function releaseOrbitalFocus({ handOver = false } = {}) {
|
||||
const state = this.orbital;
|
||||
if (!state?.focus) return false;
|
||||
if (!state?.focus) {
|
||||
// An arrow during the ease back takes the arrows' own clock again.
|
||||
if (handOver && state) state.focusReleasing = false;
|
||||
return false;
|
||||
}
|
||||
state.focus = null;
|
||||
if (handOver) {
|
||||
state.lookTarget = clampOrbitalLook(state.lookView);
|
||||
@@ -147,36 +196,22 @@ export function releaseOrbitalFocus({ handOver = false } = {}) {
|
||||
state.focusReleasing = false;
|
||||
} else state.focusReleasing = true;
|
||||
}
|
||||
publishOrbitalReach.call(this);
|
||||
this.refreshOrbitalSignals?.();
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* FOCUS on the reach list: focus that point, switch to it from another, or
|
||||
* A site's Live Signals row: focus that site, switch to it from another, or
|
||||
* end the focus when it is the one held.
|
||||
* @param {string} key The point's context id.
|
||||
* @param {string} key The site's id in the Mapped Installations layer.
|
||||
* @returns {boolean} True when the focus changed.
|
||||
*/
|
||||
export function toggleOrbitalFocus(key) {
|
||||
if (!inOrbit(this) || key === null || key === undefined) return false;
|
||||
const state = this.orbital;
|
||||
if (state.focus?.key === String(key)) return releaseOrbitalFocus.call(this);
|
||||
const record = groundRecord(
|
||||
this,
|
||||
getContextStore().entities.get(String(key)),
|
||||
);
|
||||
return record ? startFocus.call(this, record) : false;
|
||||
}
|
||||
|
||||
/** The mapped ground point drawn at a canvas position, or null. */
|
||||
function groundRecordAt(controller, position) {
|
||||
let picked = null;
|
||||
try {
|
||||
picked = controller.viewer.scene?.pick?.(position) ?? null;
|
||||
} catch {
|
||||
picked = null;
|
||||
}
|
||||
return pickedGroundRecord(controller, picked);
|
||||
const site = siteById(this, String(key));
|
||||
return site ? startFocus.call(this, site) : false;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -191,11 +226,10 @@ export function onOrbitalDoubleClick(position) {
|
||||
if (!inOrbit(this) || !isPointerFree()) return false;
|
||||
if (!Number.isFinite(position?.x) || !Number.isFinite(position?.y))
|
||||
return false;
|
||||
const record = groundRecordAt(this, position);
|
||||
if (!record) return false;
|
||||
// A point beyond the reach is not focused, but still never tracked.
|
||||
if (this.orbital.focus?.key !== String(record.id))
|
||||
startFocus.call(this, record);
|
||||
const site = siteAt(this, position);
|
||||
if (!site) return false;
|
||||
// A site beyond the reach is not focused, but still never tracked.
|
||||
if (this.orbital.focus?.key !== String(site.id)) startFocus.call(this, site);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -210,12 +244,12 @@ export function onOrbitalClick(position) {
|
||||
if (!inOrbit(this) || !isPointerFree()) return false;
|
||||
if (!Number.isFinite(position?.x) || !Number.isFinite(position?.y))
|
||||
return false;
|
||||
const record = groundRecordAt(this, position);
|
||||
const site = siteAt(this, position);
|
||||
const state = this.orbital;
|
||||
if (record) {
|
||||
if (state.focus?.key === String(record.id)) return true;
|
||||
if (startFocus.call(this, record)) return true;
|
||||
// A mapped point beyond the reach leaves the view as it is.
|
||||
if (site) {
|
||||
if (state.focus?.key === String(site.id)) return true;
|
||||
if (startFocus.call(this, site)) return true;
|
||||
// A mapped site beyond the reach leaves the view as it is.
|
||||
return false;
|
||||
}
|
||||
releaseOrbitalFocus.call(this);
|
||||
@@ -249,9 +283,9 @@ export function routeSceneClick() {
|
||||
/**
|
||||
* The orbital view's look for one frame, while a focus holds or is ending.
|
||||
* A held focus aims at its target: the live look plus whatever is left of
|
||||
* the turn onto it. The focus ends, easing back, when its point is gone (its
|
||||
* layer off, the record dropped) or beyond the reach. Also rebuilds the
|
||||
* reach list on its own clock.
|
||||
* the turn onto it. The focus ends, easing back, when its site is gone (its
|
||||
* layer off, the site no longer loaded) or beyond the reach. Also rebuilds
|
||||
* the orbital Live Signals rows on their own clock.
|
||||
* @param {object} state The orbital session.
|
||||
* @param {{direction: object, up: object, right: object}} nadir This
|
||||
* frame's nadir frame.
|
||||
@@ -264,16 +298,19 @@ export function updateOrbitalFocus(state, nadir, position, nowMs) {
|
||||
nadir,
|
||||
position: { x: position.x, y: position.y, z: position.z },
|
||||
};
|
||||
// After a satellite switch the first frame on the new satellite (the hop
|
||||
// landed, or none) is the one the rows can be measured from: rebuild now.
|
||||
if (state.awaitingFrame && !state.hop) {
|
||||
state.awaitingFrame = false;
|
||||
state.signalsMs = -Infinity;
|
||||
}
|
||||
const dtMs = nowMs - (state.lookLastMs || nowMs);
|
||||
let aimed = false;
|
||||
const focus = state.focus;
|
||||
if (focus) {
|
||||
const record = groundRecord(
|
||||
this,
|
||||
getContextStore().entities.get(focus.key),
|
||||
);
|
||||
const look = record
|
||||
? focusLook(nadir, state.focusFrame.position, recordPosition(record))
|
||||
const site = siteById(this, focus.key);
|
||||
const look = site
|
||||
? focusLook(nadir, state.focusFrame.position, sitePosition(site))
|
||||
: null;
|
||||
if (!focusInReach(look)) {
|
||||
releaseOrbitalFocus.call(this);
|
||||
@@ -296,8 +333,7 @@ export function updateOrbitalFocus(state, nadir, position, nowMs) {
|
||||
aimed = true;
|
||||
}
|
||||
}
|
||||
if (nowMs - (state.reachMs ?? -Infinity) >= ORBITAL_REACH_REFRESH_MS)
|
||||
publishOrbitalReach.call(this, nowMs);
|
||||
this.updateOrbitalSignals?.(nowMs);
|
||||
return aimed;
|
||||
}
|
||||
|
||||
@@ -345,69 +381,95 @@ export function orbitalFocusReadout() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Rebuild and publish the list of mapped points in reach: ground points of
|
||||
* the layers that are on, facing the satellite and within the off-nadir
|
||||
* reach or in the frame now, nearest to nadir first, at most
|
||||
* ORBITAL_REACH_LIST_MAX.
|
||||
* @param {number} [nowMs]
|
||||
* The mapped sites the orbital view can be turned to, for the Live Signals
|
||||
* rows: the Mapped Installations layer's loaded sites around the
|
||||
* sub-satellite point (`getNearby`), with those seen in the last
|
||||
* SITE_MEMORY_MS and the focused one, facing the satellite and within the
|
||||
* off-nadir reach, nearest to nadir first. Empty before the first frame or
|
||||
* with the layer off.
|
||||
* @param {{latitude: number, longitude: number, altitudeM: number}} info
|
||||
* The ridden satellite.
|
||||
* @returns {{count: number, entries: Array<{site: object,
|
||||
* offNadirDeg: number, focused: boolean}>}} `count` also counts sites in
|
||||
* the frame but beyond the reach.
|
||||
*/
|
||||
export function publishOrbitalReach(nowMs = performance.now()) {
|
||||
export function orbitalSitesInReach(info) {
|
||||
const state = this.orbital;
|
||||
if (!inOrbit(this) || !state) return;
|
||||
state.reachMs = nowMs;
|
||||
const frame = state.focusFrame;
|
||||
const records = new Map();
|
||||
const candidates = [];
|
||||
if (frame) {
|
||||
for (const entry of getContextStore().entities.values()) {
|
||||
const record = groundRecord(this, entry);
|
||||
if (!record) continue;
|
||||
const position = recordPosition(record);
|
||||
if (!position) continue;
|
||||
const key = String(record.id);
|
||||
records.set(key, record);
|
||||
candidates.push({ key, position });
|
||||
}
|
||||
const frame = state?.focusFrame;
|
||||
const layer = sitesLayer(this);
|
||||
// The layer keeps its records when it is turned off: nothing is listed
|
||||
// then, and no row is left to focus from.
|
||||
if (state && !sitesLayerOn(this)) state.listedSites = new Map();
|
||||
if (!frame || typeof layer?.getNearby !== 'function' || !sitesLayerOn(this))
|
||||
return { count: 0, entries: [] };
|
||||
if (!Number.isFinite(info?.latitude) || !Number.isFinite(info?.longitude))
|
||||
return { count: 0, entries: [] };
|
||||
const rangeM = reachGroundRangeM(info.altitudeM);
|
||||
let sites = [];
|
||||
try {
|
||||
sites = layer.getNearby(
|
||||
Cesium.Cartesian3.fromDegrees(info.longitude, info.latitude, 0),
|
||||
rangeM,
|
||||
SITE_QUERY_MAX,
|
||||
);
|
||||
} catch {
|
||||
sites = [];
|
||||
}
|
||||
const byId = new Map();
|
||||
const candidates = [];
|
||||
for (const site of sites || []) {
|
||||
const position = sitePosition(site);
|
||||
if (!position || site.id === null || site.id === undefined) continue;
|
||||
const key = String(site.id);
|
||||
byId.set(key, site);
|
||||
candidates.push({ key, position });
|
||||
}
|
||||
// In orbit the layer reloads its thinned view every second or so, and a
|
||||
// site in view can drop out of its records and come back. Sites do not
|
||||
// move: one seen within SITE_MEMORY_MS stays a candidate, so the rows hold
|
||||
// still and a row's site can be focused from what the rows show.
|
||||
const nowMs = performance.now();
|
||||
const remembered = new Map();
|
||||
for (const [key, entry] of state.listedSites ?? []) {
|
||||
if (nowMs - entry.seenMs > SITE_MEMORY_MS || byId.has(key)) continue;
|
||||
remembered.set(key, entry);
|
||||
byId.set(key, entry.site);
|
||||
candidates.push({ key, position: entry.site.position });
|
||||
}
|
||||
// The focused site stays a candidate while the layer reloads around it.
|
||||
const held = state.focus;
|
||||
if (held?.site?.position && !byId.has(held.key)) {
|
||||
byId.set(held.key, held.site);
|
||||
candidates.push({ key: held.key, position: held.site.position });
|
||||
}
|
||||
for (const [key, site] of byId)
|
||||
if (!remembered.has(key))
|
||||
remembered.set(key, {
|
||||
site: { ...site, position: sitePosition(site) },
|
||||
seenMs: nowMs,
|
||||
});
|
||||
state.listedSites = remembered;
|
||||
const frustum = this.viewer.camera?.frustum;
|
||||
const reach = frame
|
||||
? pointsInReach(candidates, {
|
||||
nadir: frame.nadir,
|
||||
view: offNadirOrientation(frame.nadir, {
|
||||
northDeg: state.lookView.pitchDeg,
|
||||
eastDeg: state.lookView.yawDeg,
|
||||
}),
|
||||
satellite: frame.position,
|
||||
verticalFovRad: state.verticalFov,
|
||||
aspect: Number.isFinite(frustum?.aspectRatio) ? frustum.aspectRatio : 1,
|
||||
max: ORBITAL_REACH_LIST_MAX,
|
||||
})
|
||||
: { count: 0, entries: [] };
|
||||
const focusKey = state.focus?.key ?? null;
|
||||
this.publishOrbitalReach({
|
||||
count: reach.count,
|
||||
focusKey,
|
||||
entries: reach.entries.map(({ key, offNadirDeg, reachable }) => {
|
||||
const record = records.get(key);
|
||||
const source = String(record.source || '');
|
||||
return {
|
||||
key,
|
||||
label: String(record.label || record.layerName || key),
|
||||
layerName: String(record.layerName || ''),
|
||||
source,
|
||||
latitude: record.latitude,
|
||||
longitude: record.longitude,
|
||||
offNadirDeg,
|
||||
reachable,
|
||||
focused: key === focusKey,
|
||||
osm: /openstreetmap|\bosm\b/i.test(source),
|
||||
details: detailRows(record.properties),
|
||||
};
|
||||
const reach = pointsInReach(candidates, {
|
||||
nadir: frame.nadir,
|
||||
view: offNadirOrientation(frame.nadir, {
|
||||
northDeg: state.lookView.pitchDeg,
|
||||
eastDeg: state.lookView.yawDeg,
|
||||
}),
|
||||
satellite: frame.position,
|
||||
verticalFovRad: state.verticalFov,
|
||||
aspect: Number.isFinite(frustum?.aspectRatio) ? frustum.aspectRatio : 1,
|
||||
max: Infinity,
|
||||
});
|
||||
}
|
||||
|
||||
/** Clear the reach list as the orbital session ends. */
|
||||
export function endOrbitalFocus() {
|
||||
this.publishOrbitalReach(null);
|
||||
const focusKey = state.focus?.key ?? null;
|
||||
return {
|
||||
count: reach.count,
|
||||
entries: reach.entries
|
||||
.filter((entry) => entry.reachable)
|
||||
.map(({ key, offNadirDeg }) => ({
|
||||
site: byId.get(key),
|
||||
offNadirDeg,
|
||||
focused: key === focusKey,
|
||||
})),
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user