mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 16:22:20 +00:00
feat(cctv): seven camera packs, semantic labels, terrain-clear monitor planes (#433)
Seven contributed CCTV camera packs (Ontario 511, Fintraffic Finland, DriveBC, TxDOT Texas, Estonia Tallinn + Tarktee, Warendorf, Live Traffic NSW) on a fair per-pack catalog cap; semantic camera labels; monitor planes lifted clear of the terrain from a precomputed, bundled ground-height dataset. Default catalog 800 → 3,446 cameras. Full context in PR #433. Co-authored-by: sendmebits <[email protected]> Co-authored-by: avocadoAgent <[email protected]> Co-authored-by: Alex Harvey <[email protected]> Co-authored-by: Jason Meredith <[email protected]> Co-authored-by: Daniel Smith <[email protected]> Co-authored-by: Vladimir Sobolev <[email protected]> Co-authored-by: Matthias Schneider <[email protected]> Co-authored-by: Cyber Knight <[email protected]> Co-authored-by: NovaSoft Australia <[email protected]>
This commit is contained in:
51 files changed
+78682
-939
No files matched your search
@@ -2,6 +2,8 @@ import { createCalibrationGizmo } from '../../data/cctvGizmo.js';
|
||||
import {
|
||||
DEFAULT_CAMERA_CALIBRATION,
|
||||
CCTV_CALIBRATION_STORAGE_KEY_V2,
|
||||
CALIBRATION_RANGE_FLOOR_M,
|
||||
LEGACY_CALIBRATION_RANGE_FLOOR_M,
|
||||
} from './policy.js';
|
||||
|
||||
export function createCalibration({
|
||||
@@ -75,6 +77,35 @@ export function createCalibration({
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Re-expresses a saved `rangeScale` after the catalog's range floor moved.
|
||||
* Entries were authored as a multiplier on the OLD client base range
|
||||
* (`max(220, packRange)`); the base is now `max(120, packRange)`, so a camera
|
||||
* whose pack range sits below 220 m would silently shrink. Scaling by the
|
||||
* ratio of the two bases keeps the user's effective range; the 3× ceiling
|
||||
* still applies (an extreme entry loses a little rather than exploding).
|
||||
* @param {Object} values - Normalized 7-field calibration.
|
||||
* @param {number} packRangeM - The camera's served (pack) range.
|
||||
* @returns {Object} A new values object.
|
||||
*/
|
||||
function migrateRangeScaleForFloor(values, packRangeM) {
|
||||
const oldBase = parts.model.clamp(
|
||||
parts.model.safeNumber(packRangeM, 700),
|
||||
LEGACY_CALIBRATION_RANGE_FLOOR_M,
|
||||
2200,
|
||||
);
|
||||
const newBase = parts.model.clamp(
|
||||
parts.model.safeNumber(packRangeM, 700),
|
||||
CALIBRATION_RANGE_FLOOR_M,
|
||||
2200,
|
||||
);
|
||||
if (oldBase === newBase) return values;
|
||||
return normalizeCalibration({
|
||||
...values,
|
||||
rangeScale: values.rangeScale * (oldBase / newBase),
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the given calibration is effectively the default (all offsets near zero).
|
||||
* @param {Object} calibration
|
||||
@@ -120,6 +151,9 @@ export function createCalibration({
|
||||
values: normalizeCalibration(entry.values),
|
||||
source: 'manual',
|
||||
savedAt: parts.model.safeNumber(entry.savedAt, 0),
|
||||
// Range floor the entry's rangeScale was authored against; absent
|
||||
// on entries saved before the floor dropped from 220 m to 120 m.
|
||||
rangeFloorM: parts.model.safeNumber(entry.rangeFloorM, NaN),
|
||||
});
|
||||
}
|
||||
return map;
|
||||
@@ -147,6 +181,12 @@ export function createCalibration({
|
||||
values: normalizeCalibration(entry.values),
|
||||
source: 'manual',
|
||||
savedAt: parts.model.safeNumber(entry.savedAt, Date.now()),
|
||||
// Only entries that were migrated or saved against the current
|
||||
// floor carry the marker; an entry for a camera absent from this
|
||||
// catalog keeps its eligibility to migrate when it returns.
|
||||
...(Number.isFinite(entry.rangeFloorM)
|
||||
? { rangeFloorM: entry.rangeFloorM }
|
||||
: {}),
|
||||
};
|
||||
}
|
||||
storage.setItem(CCTV_CALIBRATION_STORAGE_KEY_V2, JSON.stringify(payload));
|
||||
@@ -243,6 +283,8 @@ export function createCalibration({
|
||||
parts.ground.groundAltFor(record),
|
||||
);
|
||||
}
|
||||
// The edited pose has a new footprint; resolve the ground under it once.
|
||||
void parts.ground.resolveFootprintGround(record);
|
||||
parts.frames.refreshProjectionImage(record, true);
|
||||
return true;
|
||||
}
|
||||
@@ -279,6 +321,9 @@ export function createCalibration({
|
||||
endPatch: (draggedRecord) => {
|
||||
const record = liveRecord(draggedRecord);
|
||||
if (!record) return;
|
||||
// The drag changed the plane's footprint; resolve the ground under
|
||||
// the released pose once (revision-guarded, cached proxy).
|
||||
void parts.ground.resolveFootprintGround(record);
|
||||
if (record.calibrationAnchorDirty) {
|
||||
record.calibrationAnchorDirty = false;
|
||||
parts.ground.resolveCommittedGroundAnchor(record);
|
||||
@@ -298,6 +343,7 @@ export function createCalibration({
|
||||
calibrationPatchMovesAnchor,
|
||||
normalizeCalibration,
|
||||
isDefaultCalibration,
|
||||
migrateRangeScaleForFloor,
|
||||
readCalibrationStoreV2,
|
||||
writeCalibrationStoreV2,
|
||||
loadCalibrationStore,
|
||||
|
||||
Reference in new issue
Block a user