fix(cctv): stand cameras and count markers on the drawn terrain

When the terrain height batch loses a chunk to the rate limit, the cameras
in it keep a sea-level fallback height. In the mountains that put them far
under the surface, so the view pass judged them by a point that was not
where they are drawn: a tilted view dropped the count marker, a click on
the marker framed empty ground, and icons drifted on tilt and pan.

- A camera with no real ground height takes the height of the terrain the
  globe draws once it is near the screen (up to 300 reads a pass, through
  the height service), and a later answer from the batch replaces it.
- A count marker is anchored to the drawn terrain under its centre, and a
  click frames that ground.
- Cameras on one mount draw side by side, 30 px apart, each with its own
  callout, instead of as one icon with several callouts.

The photoreal map stack is not covered: terrain is not the surface there.
This commit is contained in:
German Khokhlov committed 2026-11-19 00:03:34 +04:00
1 parent 65942008bf
commit 2e18673df8
9 files changed
+453 -69

No files matched your search

+23 -5
View File
@@ -43,12 +43,28 @@ export function addCellCamera(cell, camera) {
cell.high = Math.max(cell.high, height);
}
/** Geographic mean on the globe surface at the mean mount height. */
/** Mean longitude and latitude of a cell's mounts, in degrees. */
export function cellLonLat(cell) {
return {
lon: cell.lonSum / (1e7 * cell.count),
lat: cell.latSum / (1e7 * cell.count),
};
}
/**
* Geographic mean of the mounts. Its height is the drawn ground under it
* when the cell carries one (`groundM`), since a camera nobody has looked at
* yet may still hold a catalog height far from the terrain; otherwise the
* mean mount height.
*/
export function cellCenter(cell) {
const { lon, lat } = cellLonLat(cell);
return fromDegrees(
cell.lonSum / (1e7 * cell.count),
cell.latSum / (1e7 * cell.count),
cell.heightSum / (100 * cell.count),
lon,
lat,
Number.isFinite(cell.groundM)
? cell.groundM
: cell.heightSum / (100 * cell.count),
);
}
@@ -56,7 +72,9 @@ export function cellCenter(cell) {
export function cellBounds(cell) {
const lat = (cell.north + cell.south) / 2;
const lon = (cell.east + cell.west) / 2;
const height = (cell.high + cell.low) / 2;
const height = Number.isFinite(cell.groundM)
? cell.groundM
: (cell.high + cell.low) / 2;
// The parallel nearest the equator bounds the width of every row.
const parallel = (Math.max(0, cell.south, -cell.north) * Math.PI) / 180;
// Half the diagonal plus 20% padding on every side.