@geogirafe/lib-geoportal
Version:
GeoGirafe is a flexible application to build online geoportals.
28 lines (27 loc) • 1.32 kB
TypeScript
import type { Coordinate } from 'ol/coordinate.js';
/** The footage displayed by a provider, with the position it was taken from in WGS84 (longitude, latitude). */
export type Footage = {
lonLat: Coordinate;
heading: number;
pitch: number;
};
/** The direction of sight to apply to a displayed footage. */
export type PointOfView = Pick<Footage, 'heading' | 'pitch'>;
/**
* A service providing the footage displayed by a StreetView Component.
* All the coordinates are in WGS84 (longitude, latitude): the Component takes care of the map projection.
*/
export interface StreetViewProviderAdapter {
/**
* Loads the external library, if needed, and creates the viewer in the target element.
* The callback is called each time the displayed footage or the direction of sight changes.
*/
initialize(target: HTMLElement, onFootageChanged: (footage: Footage) => void): Promise<void>;
/**
* Displays the closest footage around the coordinate, within the radius (in meters),
* looking in the given direction or, by default, in the direction the footage was taken.
* Resolves to false when there is no footage within the radius.
*/
showClosestFootage(lonLat: Coordinate, radius: number, pov?: PointOfView): Promise<boolean>;
setVisible(visible: boolean): void;
}