@geogirafe/lib-geoportal
Version:
GeoGirafe is a flexible application to build online geoportals.
54 lines (53 loc) • 2.83 kB
TypeScript
import type { EventsKey } from 'ol/events.js';
import { Map } from 'ol';
import type BaseLayer from 'ol/layer/Base.js';
import type Feature from 'ol/Feature.js';
import { Coordinate } from 'ol/coordinate.js';
import { ProjectionLike } from 'ol/proj.js';
import { Circle, Geometry, Point, Polygon } from 'ol/geom.js';
import { Pixel } from 'ol/pixel.js';
import { Stroke, Style } from 'ol/style.js';
/**
* Unsubscribe to all OpenLayer listeners.
*/
export declare const unByKeyAll: (eventKeys: EventsKey[]) => void;
/**
* @returns a layer in the map that match the given name (property name).
*/
export declare const getOlayerByName: (map: Map, layerName: string) => BaseLayer | undefined;
/**
* Clone the properties of the given feature and delete ol properties to keep only the feature "app" properties.
* Handle map server values served as object and serve them as "simple" values.
*/
export declare const removeUnwantedOlParams: (feature: Feature, keepGeom?: boolean) => Record<string, unknown>;
/**
* @returns A polygon generated from the circle.
*/
export declare const polygonFromCircle: (geometry: Circle) => Polygon;
/**
* @param coordinates ol Coordinate list
* @param projection Projection identifier
* @returns the length between coordinates, considering the current map projection (projected or geographic)
*/
export declare const getDistance: (coordinates: Coordinate[], projection: ProjectionLike) => number;
/**
* @param polygon ol Polygon
* @param projection Projection identifier
* @returns the area of a polygon, considering the current map projection (projected or geographic)
*/
export declare const getAreaOfPolygon: (polygon: Polygon, projection: ProjectionLike) => number;
export declare const getAreaOfCircle: (circle: Circle, projection: ProjectionLike) => number;
export declare const isCoordinateInDegrees: (coordinate: Coordinate) => boolean;
export declare const getSelectionBoxFromMapClick: (eventCoordinate: Pixel | [number, number], olMap: Map, pixelTolerance: number) => number[];
export declare const reprojectGeometry: (geometry: Geometry, sourceProjection: ProjectionLike, destinationProjection: ProjectionLike) => Geometry;
export declare const ensurePolygonIsProperlyClosed: (polygon: Polygon) => Coordinate[];
export declare const getHalfPoint: (coordinates: Coordinate[]) => Point;
export declare const getLabelStyle: (position: Point, text: string, labelStyle: Style) => Style | undefined;
export declare const getRadiusDataForCircle: (circle: Circle, defaultStyle: Style, stroke: Stroke) => {
style: Style;
radius: number;
radiusLine: Coordinate[];
};
export declare const getLengthAsMetricText: (length?: number) => string;
export declare const getAreaAsMetricText: (area?: number) => string;
export declare const getAzimuthAsText: (azimuth?: number) => string;