mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-18 17:22:19 +00:00
Main gained three imagery providers (Google Street View, KartaView,
Panoramax), shared line-coverage, cone and photo-viewer modules, one source
lit at a time and the translated interface. Their shared modules still
carried what this branch removes, so the merge ports them onto it:
- lineCoverage.js is this branch's coverage.js made provider-neutral
(draped lines near the ground only, the selection drawn over them, key
and rate-limit blocking); sequenceCones.js is sequences.js the same way.
Mapillary, KartaView and Panoramax all build on them; Mapillary moves
back to providers/mapillary/ beside the others.
- No ground casting, mesh sampling, surface modes, FOLLOW, legend, prewarm,
orbit overview points (Panoramax's density dots included), stale-tile
swaps or water-filled point budget come back.
- Kept from main because the new providers need them: requiresMapStack and
attachMapStackController (Street View on Google 3D only), ground clicks,
openNearest with an optional provider nearestImage, openImage {frame},
reportError, the view-cone marker (now an SVG glyph), filters /
coverageLabel / sinceBasis, OPEN STREET VIEW, keyAlternatives and i18n.
- photoViewer.js treats the viewer as expanded when its wrap is full screen
or the iPhone popover, as EXPAND now is.
- The fixture browser gate keeps its 8 steps and adds one each for
KartaView and Panoramax; catalogs, docs, boundaries and format scope
follow.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
47 lines
1.8 KiB
JavaScript
47 lines
1.8 KiB
JavaScript
import * as Cesium from 'cesium';
|
|
import { GROUND_CLICK_MAX_HEIGHT_M } from './policy.js';
|
|
import { cameraHeightAboveGround } from './view.js';
|
|
|
|
/** Whether the camera is low enough for a click on the ground to mean a street. */
|
|
export function groundClickHeightOk(viewer) {
|
|
if (!viewer?.camera?.positionCartographic) return false;
|
|
return cameraHeightAboveGround(viewer) <= GROUND_CLICK_MAX_HEIGHT_M;
|
|
}
|
|
|
|
/**
|
|
* A click on the map itself at street zoom opens the nearest image of the
|
|
* active `groundClick` providers, without moving the camera. The height is
|
|
* measured at the click, not read from the cached flag.
|
|
* @param {{state: object, openNearest: Function, isAvailable: (entry: object) => boolean}} options
|
|
* @returns {(screenPosition: {x: number, y: number}, picked?: object) => Promise<boolean>|false}
|
|
*/
|
|
export function createGroundClick({ state, openNearest, isAvailable }) {
|
|
return function openAtGround(screenPosition, picked) {
|
|
const scenePick = state.services.scenePick;
|
|
if (!state.enabled || !state.viewer || !scenePick?.pickGroundPosition)
|
|
return false;
|
|
if (!scenePick.isSurfacePick(picked) || !groundClickHeightOk(state.viewer))
|
|
return false;
|
|
const providerIds = [...state.providers.values()]
|
|
.filter(
|
|
(entry) =>
|
|
entry.on &&
|
|
entry.def.groundClick &&
|
|
entry.status?.configured &&
|
|
isAvailable(entry),
|
|
)
|
|
.map((entry) => entry.def.id);
|
|
if (!providerIds.length) return false;
|
|
const position = scenePick.pickGroundPosition(state.viewer, screenPosition);
|
|
const carto = position && Cesium.Cartographic.fromCartesian(position);
|
|
if (!carto) return false;
|
|
return openNearest(
|
|
{
|
|
lon: Cesium.Math.toDegrees(carto.longitude),
|
|
lat: Cesium.Math.toDegrees(carto.latitude),
|
|
},
|
|
{ providerIds, frame: false },
|
|
);
|
|
};
|
|
}
|