Fly to places, landmarks and imported files through the camera and query ports

The camera ground guard reads the eye from the camera port's pose, the
flight state from the port, and the surface under it from the query port's
heights, and lifts through the port. Place and landmark flights read the
terrain height from the query port and build their targets with geo.
Framing ranges read the field of view from the pose (the frustum's
wider-side angle, as it read before). An imported file's flight frames its
footprint, plain lon/lat/height points, with geo's bounding sphere and the
port's flyToBounds; walking the file's Cesium data source for those points
moves into the file importer, which stays on the Cesium allow-list.

The Cesium query port answers terrain heights without depth textures, as
the height service always has: only the drawn surface needs them.

cameraGroundGuard, locations, cameraFraming and flyToDataSource leave the
allow-list. The annotation resolver, still listed, loads the camera
factory for the application operations entry, which reached it through
locations before.
This commit is contained in:
Sameh Khamis committed 2026-11-07 03:11:51 -08:00
1 parent a2c4d27b5a
commit 7ab969599c
14 files changed
+303 -214

No files matched your search

+23 -4
View File
@@ -1,10 +1,29 @@
import * as Cesium from 'cesium';
import { toRadians } from '../geo/index.js';
import { findCamera } from '../render/rendererOf.js';
/** The camera port's pose, or null when there is none to read. */
function poseOf(viewer) {
try {
return findCamera(viewer)?.pose() ?? null;
} catch {
return null;
}
}
/** Camera range with breathing room in both viewport dimensions. */
export function rangeForBoundingSphere(viewer, radius) {
const frustum = viewer.camera?.frustum;
const verticalFov = Number(frustum?.fov) || Cesium.Math.toRadians(60);
const aspectRatio = Math.max(0.5, Number(frustum?.aspectRatio) || 1);
const pose = poseOf(viewer);
const fovy = Number(pose?.fovy);
const aspect = Number(pose?.aspectRatio);
// The frustum's field of view: along its wider side.
const fov =
fovy > 0 && aspect > 1
? 2 * Math.atan(Math.tan(fovy / 2) * aspect)
: fovy > 0
? fovy
: NaN;
const verticalFov = fov || toRadians(60);
const aspectRatio = Math.max(0.5, aspect || 1);
const horizontalFov = 2 * Math.atan(Math.tan(verticalFov / 2) * aspectRatio);
const limitingFov = Math.min(verticalFov, horizontalFov);
// Target 57% sphere occupancy so perspective still leaves at least 40%