fix: use globe terrain when framing an ALPR camera

This commit is contained in:
Sameh Khamis committed 2026-09-13 20:42:48 -07:00
1 parent fe1aa3b6f6
commit bcba7c5c01
4 files changed
+12 -2

No files matched your search

+2 -1
View File
@@ -3,7 +3,8 @@
## ALPR camera locations ## ALPR camera locations
- Label the loaded camera count as nearby, show a purple-dot legend, and add - Label the loaded camera count as nearby, show a purple-dot legend, and add
SHOW NEAREST to frame and select a loaded camera when none are on screen. SHOW NEAREST to frame and select a loaded camera when none are on screen,
using the available 3D-tile or globe terrain height.
- Keep nearby camera markers and selection stable during rotation, use bounded - Keep nearby camera markers and selection stable during rotation, use bounded
ground-centered coverage instead of the horizon rectangle, and reuse in-flight queries. ground-centered coverage instead of the horizon rectangle, and reuse in-flight queries.
+2 -1
View File
@@ -13,7 +13,8 @@ The row count explicitly says **nearby**: loaded records can be outside the
screen. A purple-dot legend identifies the fixed 8-pixel markers (12 pixels when screen. A purple-dot legend identifies the fixed 8-pixel markers (12 pixels when
selected). **SHOW NEAREST** frames and selects the nearest loaded camera; it is selected). **SHOW NEAREST** frames and selects the nearest loaded camera; it is
disabled with no loaded cameras or while following a tracked entity. This action disabled with no loaded cameras or while following a tracked entity. This action
chooses from the current source snapshot. chooses from the current source snapshot and uses rendered surface height from
3D tiles or globe terrain when available.
Coverage follows a bounded neighborhood around the screen-center ground point, Coverage follows a bounded neighborhood around the screen-center ground point,
with a radius of twice the camera-to-ground range (at least 1 km), rather than with a radius of twice the camera-to-ground range (at least 1 km), rather than
extending to the horizon. Sky, dateline-crossing and wider-than-city views do not extending to the horizon. Sky, dateline-crossing and wider-than-city views do not
+6
View File
@@ -1093,6 +1093,8 @@ test('nearby count and discovery control frame a real loaded camera without fetc
); );
h.viewer.camera.flyToBoundingSphere = (sphere, options) => h.viewer.camera.flyToBoundingSphere = (sphere, options) =>
flights.push({ sphere, options }); flights.push({ sphere, options });
h.viewer.scene.globe.show = true;
h.viewer.scene.globe.getHeight = () => 312;
try { try {
assert.equal(alprCamerasLayer.getRowControls().chips[0].disabled, true); assert.equal(alprCamerasLayer.getRowControls().chips[0].disabled, true);
await alprCamerasLayer.update(); await alprCamerasLayer.update();
@@ -1106,6 +1108,10 @@ test('nearby count and discovery control frame a real loaded camera without fetc
assert.ok( assert.ok(
Math.abs(Cesium.Math.toDegrees(center.latitude) - 30.2672) < 1e-9, Math.abs(Cesium.Math.toDegrees(center.latitude) - 30.2672) < 1e-9,
); );
assert.ok(
Math.abs(center.height - 312) < 1e-6,
'use the rendered globe floor on keyless basemaps',
);
assert.equal(flights[0].options.offset.range, 800); assert.equal(flights[0].options.offset.range, 800);
assert.equal(h.requests.length, 1); assert.equal(h.requests.length, 1);
h.viewer.trackedEntity = {}; h.viewer.trackedEntity = {};
+2
View File
@@ -276,6 +276,8 @@ export function createAlprPresentation({ state, services, source }) {
/* tiles may still be streaming */ /* tiles may still be streaming */
} }
} }
if (!Number.isFinite(height) && state.viewer.scene.globe.show)
height = state.viewer.scene.globe.getHeight?.(location);
if (!Number.isFinite(height) || height < -500 || height > 10000) if (!Number.isFinite(height) || height < -500 || height > 10000)
height = cachedGroundFloor(record.latitude, record.longitude); height = cachedGroundFloor(record.latitude, record.longitude);
const center = Cesium.Cartesian3.fromDegrees( const center = Cesium.Cartesian3.fromDegrees(