Resolve annotation targets against the renderer's camera and query ports

The annotation resolver no longer imports Cesium. The view proximity
gate reads the camera port's pose and the geocode bias its view
rectangle. Screen-point picks go through the query port (depth pick,
then ellipsoid, then the globe along the pick ray) on the renderer's
canvas, and ground heights through the height gateway. It leaves the
Cesium allow-list.

Its tests bind a camera port over their camera doubles.
This commit is contained in:
Sameh Khamis committed 2026-11-07 04:13:56 -08:00
1 parent 8d586e5ff9
commit 9fe3e7633f
7 files changed
+68 -84

No files matched your search

+6 -4
View File
@@ -8,6 +8,7 @@ import { readFileSync } from 'node:fs';
import * as Cesium from 'cesium';
import { FEATURE_SOURCE_METHODS } from '../sources/featureSource.js';
import { createAnnotationResolver } from '../annotations/resolver.js';
import { bindFakeCesiumCamera } from '../testSupport/fakeCameraPort.mjs';
import { createWorldAnnotationRenderer } from '../annotations/worldAnnotationRenderer.js';
const read = (path) => readFileSync(new URL(path, import.meta.url), 'utf8');
@@ -110,7 +111,8 @@ test('drawing bundled place and neighborhood outlines creates no Cesium label',
});
const primitives = [];
const dataSources = [];
const viewer = {
// The resolver reads the camera through the renderer's camera port.
const viewer = bindFakeCesiumCamera({
camera: {
positionCartographic: Cesium.Cartographic.fromDegrees(
-97.7431,
@@ -123,7 +125,7 @@ test('drawing bundled place and neighborhood outlines creates no Cesium label',
add: (ds) => dataSources.push(ds),
remove() {},
},
};
});
const renderer = createWorldAnnotationRenderer(viewer);
for (const [target, lon, lat] of [
['Austin', -97.7431, 30.2672],
@@ -135,8 +137,8 @@ test('drawing bundled place and neighborhood outlines creates no Cesium label',
3000,
);
const resolved = await resolveAnnotationTarget({
// The resolver reads only the camera (no scene to pick from).
viewer: { camera: viewer.camera },
// The resolver reads only the camera (no query port to pick with).
viewer,
target,
footprint: true,
deferFootprint: true,