import { TerraDrawGoogleMapsAdapter } from "./adapters/google-maps.adapter"; import { TerraDrawLeafletAdapter } from "./adapters/leaflet.adapter"; import { TerraDrawMapboxGLAdapter } from "./adapters/mapbox-gl.adapter"; import { TerraDrawMapLibreGLAdapter } from "./adapters/maplibre-gl.adapter"; import { TerraDrawOpenLayersAdapter } from "./adapters/openlayers.adapter"; import { TerraDrawArcGISMapsSDKAdapter } from "./adapters/arcgis-maps-sdk.adapter"; import { TerraDrawAdapter, TerraDrawAdapterStyling, GetLngLatFromEvent, Project, SetCursor, TerraDrawChanges, TerraDrawStylingFunction, Unproject, HexColor, TerraDrawKeyboardEvent, TerraDrawMouseEvent } from "./common"; import { TerraDrawBaseAdapter } from "./adapters/common/base.adapter"; import { TerraDrawBaseDrawMode } from "./modes/base.mode"; import { TerraDrawCircleMode } from "./modes/circle/circle.mode"; import { TerraDrawFreehandMode } from "./modes/freehand/freehand.mode"; import { TerraDrawGreatCircleMode } from "./modes/greatcircle/great-circle.mode"; import { TerraDrawLineStringMode } from "./modes/linestring/linestring.mode"; import { TerraDrawPointMode } from "./modes/point/point.mode"; import { TerraDrawPolygonMode } from "./modes/polygon/polygon.mode"; import { TerraDrawRectangleMode } from "./modes/rectangle/rectangle.mode"; import { TerraDrawRenderMode } from "./modes/render/render.mode"; import { TerraDrawSelectMode } from "./modes/select/select.mode"; import { FeatureId, GeoJSONStoreFeatures, IdStrategy } from "./store/store"; import { BehaviorConfig } from "./modes/base.behavior"; import { ValidateMinSizeSquareMeters } from "./validations/min-size.validation"; import { ValidateMaxSizeSquareMeters } from "./validations/max-size.validation"; type FinishListener = (ids: FeatureId) => void; type ChangeListener = (ids: FeatureId[], type: string) => void; type SelectListener = (id: FeatureId) => void; type DeselectListener = () => void; interface TerraDrawEventListeners { ready: () => void; finish: FinishListener; change: ChangeListener; select: SelectListener; deselect: DeselectListener; } type TerraDrawEvents = keyof TerraDrawEventListeners; declare class TerraDraw { private _modes; private _mode; private _adapter; private _enabled; private _store; private _eventListeners; private _instanceSelectMode; constructor(options: { adapter: TerraDrawAdapter; modes: TerraDrawBaseDrawMode[]; idStrategy?: IdStrategy; tracked?: boolean; }); private checkEnabled; private getModeStyles; private featuresAtLocation; private getSelectMode; /** * Allows the setting of a style for a given mode * * @param mode - The mode you wish to set a style for * @param styles - The styles you wish to set for the mode - this is * the same as the initialisation style schema * * @alpha */ setModeStyles>(mode: string, styles: Styling): void; /** * Allows the user to get a snapshot (copy) of all given features * * @returns An array of all given Feature Geometries in the instances store * * @alpha */ getSnapshot(): GeoJSONStoreFeatures[]; /** * Removes all data from the current store and removes any rendered layers * via the registering the adapter. * * @alpha */ clear(): void; /** * A property used to determine whether the instance is active or not. You * can use the start method to set this to true, and stop method to set this to false. * This is a read only property. * * @return true or false depending on if the instance is stopped or started * @readonly * @alpha */ get enabled(): boolean; /** * enabled is a read only property and will throw and error if you try and set it. * * @alpha */ set enabled(_: boolean); /** * A method for getting the current mode name * * @return the current mode name * * @alpha */ getMode(): string; /** * A method for setting the current mode by name. Under the hood this will stop * the previous mode and start the new one. * @param mode - The mode name you wish to start * * @alpha */ setMode(mode: string): void; /** * A method for removing features to the store * @param ids * @returns * * @alpha */ removeFeatures(ids: FeatureId[]): void; /** * Provides the ability to programmatically select a feature using the instances provided select mode. * If not select mode is provided in the instance, an error will be thrown. If the instance is not currently * in the select mode, it will switch to it. * @param id - the id of the feature to select * @alpha */ selectFeature(id: FeatureId): void; /** * Provides the ability to programmatically deselect a feature using the instances provided select mode. * If not select mode is provided in the instance, an error will be thrown. If the instance is not currently * in the select mode, it will switch to it. * @param id - the id of the feature to deselect * @alpha */ deselectFeature(id: FeatureId): void; /** * Returns the next feature id from the store - defaults to UUID4 unless you have * set a custom idStrategy. This method can be useful if you are needing creating features * outside of the Terra Draw instance but want to add them in to the store. * @returns a id, either number of string based on whatever the configured idStrategy is * * @alpha */ getFeatureId(): FeatureId; /** * Returns true or false depending on if the Terra Draw instance has a feature with a given id * @returns a boolean determining if the instance has a feature with the given id * * @alpha */ hasFeature(id: FeatureId): boolean; /** * A method for adding features to the store. This method will validate the features. * Features must match one of the modes enabled in the instance. * @param mode * @param features * @returns * * @alpha */ addFeatures(features: GeoJSONStoreFeatures[]): void; /** * A method starting Terra Draw. It put the instance into a started state, and * in registers the passed adapter giving it all the callbacks required to operate. * * @alpha */ start(): void; /** * Gets the features at a given longitude and latitude. * Will return point and linestrings that are a given pixel distance * away from the lng/lat and any polygons which contain it. * * @alpha */ getFeaturesAtLngLat(lngLat: { lng: number; lat: number; }, options?: { pointerDistance: number; ignoreSelectFeatures: boolean; }): GeoJSONStoreFeatures[]; /** * Takes a given pointer event and * Will return point and linestrings that are a given pixel distance * away from the lng/lat and any polygons which contain it. * * @alpha */ getFeaturesAtPointerEvent(event: PointerEvent | MouseEvent, options?: { pointerDistance: number; ignoreSelectFeatures: boolean; }): GeoJSONStoreFeatures[]; /** * A method for stopping Terra Draw. Will clear the store, deregister the adapter and * remove any rendered layers in the process. * * @alpha */ stop(): void; /** * Registers a Terra Draw event * * @param event - The name of the event you wish to listen for * @param callback - The callback with you wish to be called when this event occurs * * @alpha */ on(event: T, callback: TerraDrawEventListeners[T]): void; /** * Unregisters a Terra Draw event * * @param event - The name of the event you wish to unregister * @param callback - The callback you originally provided to the 'on' method * * @alpha */ off(event: TerraDrawEvents, callback: TerraDrawEventListeners[T]): void; } declare const TerraDrawExtend: { TerraDrawBaseDrawMode: typeof TerraDrawBaseDrawMode; TerraDrawBaseAdapter: typeof TerraDrawBaseAdapter; }; export { TerraDraw, TerraDrawSelectMode, TerraDrawPointMode, TerraDrawLineStringMode, TerraDrawGreatCircleMode, TerraDrawPolygonMode, TerraDrawCircleMode, TerraDrawFreehandMode, TerraDrawRenderMode, TerraDrawRectangleMode, TerraDrawGoogleMapsAdapter, TerraDrawMapboxGLAdapter, TerraDrawLeafletAdapter, TerraDrawMapLibreGLAdapter, TerraDrawOpenLayersAdapter, TerraDrawArcGISMapsSDKAdapter, TerraDrawExtend, BehaviorConfig, GeoJSONStoreFeatures, HexColor, TerraDrawMouseEvent, TerraDrawAdapterStyling, TerraDrawKeyboardEvent, TerraDrawChanges, TerraDrawStylingFunction, Project, Unproject, SetCursor, GetLngLatFromEvent, ValidateMinSizeSquareMeters, ValidateMaxSizeSquareMeters, };