@geogirafe/lib-geoportal
Version:
GeoGirafe is a flexible application to build online geoportals.
25 lines (24 loc) • 867 B
JavaScript
/** The services that can provide the footage displayed by a StreetView Component. */
export const STREETVIEW_PROVIDERS = ['google'];
export function isStreetViewProvider(value) {
return STREETVIEW_PROVIDERS.includes(value);
}
/** Whether a value coming from a shared state is a usable view. */
export function isStreetViewView(value) {
if (typeof value !== 'object' || value === null) {
return false;
}
const view = value;
return (Array.isArray(view.position) &&
view.position.length === 2 &&
view.position.every(Number.isFinite) &&
Number.isFinite(view.heading) &&
Number.isFinite(view.pitch));
}
/**
* The footage displayed by each StreetView provider.
* The providers are independent: each of them follows the clicks on the map on its own.
*/
export default class StreetViewState {
views = {};
}