mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-19 01:32:19 +00:00
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:
1 parent
65942008bf
commit
2e18673df8
9 files changed
+453
-69
No files matched your search
@@ -1,5 +1,6 @@
|
||||
import {
|
||||
cellCenter,
|
||||
cellLonLat,
|
||||
formatCameraCount,
|
||||
mergeCountCells,
|
||||
} from '../../data/cctvCellCounts.js';
|
||||
@@ -201,16 +202,32 @@ export function createCountMarkers(
|
||||
};
|
||||
}
|
||||
|
||||
/** Reuse marker slots in ground-key order, and invalidate only changed frames. */
|
||||
function update(cells, project) {
|
||||
/**
|
||||
* Reuse marker slots in ground-key order, and invalidate only changed frames.
|
||||
* `groundHeight(lon, lat)` answers the drawn terrain height in metres, or
|
||||
* null where it is not loaded; with it a count stands on the ground it
|
||||
* marks whatever heights its cameras hold.
|
||||
*/
|
||||
function update(cells, project, groundHeight = null) {
|
||||
// Lone cameras take part so that one beside a count joins it.
|
||||
let visible = cells.slice().sort((a, b) => a.key.localeCompare(b.key));
|
||||
const footprint = (count) => (count > 1 ? sizeFor(count) : SINGLE_ICON);
|
||||
/** A lone camera keeps its icon's own position; a count goes to ground. */
|
||||
const ground = (list) => {
|
||||
if (!groundHeight) return;
|
||||
for (const cell of list) {
|
||||
if (cell.count === 1 || cell.groundM !== undefined) continue;
|
||||
const { lon, lat } = cellLonLat(cell);
|
||||
const height = groundHeight(lon, lat);
|
||||
cell.groundM = Number.isFinite(height) ? Math.round(height) : null;
|
||||
}
|
||||
};
|
||||
for (
|
||||
let pass = 0;
|
||||
pass < COUNT_MERGE_PASSES && visible.length > 1;
|
||||
pass++
|
||||
) {
|
||||
ground(visible);
|
||||
const merged = mergeCountCells(
|
||||
visible,
|
||||
project,
|
||||
@@ -225,6 +242,7 @@ export function createCountMarkers(
|
||||
for (const cell of cells)
|
||||
if (cell.count === 1) cell.absorbed = !apart.has(cell);
|
||||
visible = visible.filter((cell) => cell.count > 1);
|
||||
ground(visible);
|
||||
let changed = visible.length !== markers.length;
|
||||
for (let i = 0; i < visible.length; i++) {
|
||||
const cell = visible[i];
|
||||
@@ -236,7 +254,8 @@ export function createCountMarkers(
|
||||
last.count !== cell.count ||
|
||||
last.latSum !== cell.latSum ||
|
||||
last.lonSum !== cell.lonSum ||
|
||||
last.heightSum !== cell.heightSum
|
||||
last.heightSum !== cell.heightSum ||
|
||||
last.groundM !== cell.groundM
|
||||
) {
|
||||
marker.pos = cellCenter(cell);
|
||||
changed = true;
|
||||
|
||||
Reference in new issue
Block a user