import DrawingFeature from './drawingFeature.js';
import MapComponent from '../../components/map/component.js';
import { Feature } from 'ol';
import { Geometry } from 'ol/geom.js';
import VectorSource from 'ol/source/Vector.js';
import VectorLayer from 'ol/layer/Vector.js';
import IGirafeContext from '../context/icontext.js';
import { StyleFunction } from 'ol/style/Style.js';
export default class OlDrawing {
    private readonly map;
    private readonly stateLocation;
    private readonly context;
    private readonly deleteHandler;
    private readonly modifiableFeatures;
    private draw;
    private modify;
    private snap;
    private editContextMenu;
    private currentShape;
    private fixedLineLength;
    private fixedSquareSide;
    private fixedRectangleWidth;
    private fixedRectangleHeight;
    private drawingText;
    readonly drawingSource: VectorSource;
    readonly drawingLayer: VectorLayer;
    private lastClosestFeature;
    private translate;
    private transform;
    private readonly modifyFeatureChangeListeners;
    private hoverListener;
    private selectListener;
    private hoveredTextFeatureId;
    defaultStyle: StyleFunction | undefined;
    private readonly updateGeometryInState;
    private get state();
    private get drawingState();
    private get config();
    constructor(mapComponent: MapComponent, stateLocation: string, context: IGirafeContext, deleteHandler: (featureId: string) => void);
    private addModifyInteraction;
    private addSnapInteraction;
    private addTranslateInteraction;
    private removeTranslateInteraction;
    private addTransformInteraction;
    private removeTransformInteraction;
    /**
     * Adds a context menu to the map with a single entry 'remove vertex'. The menu is configured to open
     * when the user does an alternate click ( = context event) on or near a vertex of a modifiable feature.
     */
    private addEditContextMenu;
    private addEditInteractions;
    private removeEditInteractions;
    private addHoverListener;
    private removeHoverListener;
    private addSelectListener;
    private removeSelectListener;
    /**
     * Lets the user select the shapes to edit directly in the map, as an alternative to the drawing list:
     * a click selects the shape under the cursor exclusively, a click with the platform modifier key (ctrl / meta)
     * adds the shape to the current selection or removes it from it. A click outside of any shape clears the selection.
     */
    private selectClickedFeature;
    /**
     * Only writes to the state if the selection of the shape really changed, so that the map and the drawing
     * panel are not refreshed for the shapes that are not concerned by the click.
     */
    private setFeatureSelected;
    private findFeatureIdAtPixel;
    private readonly prepareMenuEntriesForVertex;
    private readonly prepareMenuEntriesForShape;
    /**
     Check if there is a vertex of a selected (=editable) feature within the pixel tolerance of the clicked coordinates.
     */
    private hasEditableVertexAtCoordinate;
    private hasEditableShapeAtCoordinate;
    /**
     Returns the closest vertex and feature to a coordinate from the drawing source.
     The feature source can be pre-filtered via an optional filter function.
     */
    private getClosestVertexAndFeature;
    /**
     Deletes the vertex the user interacted with last via the modify interaction. Handled events are defined by the
     modify option properties 'condition' and 'insertVertexCondition'.
     */
    private removeLastInteractedVertex;
    private removeLastInteractedShape;
    /**
     * Adds features to the drawing source if they are missing and updates their style each time a property changes.
     * Adding them to the source is only necessary if the feature originates from a deserialized state and not
     * from a drawing action in the map.
     *
     * @param {DrawingFeature[]} dFeatures - An array of `DrawingFeature` objects to be added.
     */
    addFeatures(dFeatures: DrawingFeature[]): void;
    /**
     * Deletes the provided features from the drawing source.
     *
     * @param {DrawingFeature[]} dFeatures - The list of features to be deleted.
     */
    deleteFeatures(dFeatures: DrawingFeature[]): void;
    /**
     * Restrict modify interaction to the currently selected features via updating the features collection
     */
    private updateModifiableFeatures;
    /**
     * Handles the addition of a feature to the vector source. This method is triggered when a new feature is drawn
     * and added to the vector source at end of the draw interaction.
     * It creates a `DrawingFeature` to save in the state, containing a unique id and the feature geometry as a geojson.
     * To identify the ol feature in the map, it receives the same id as the `DrawingFeature`.
     *
     * @param {VectorSourceEvent} e - The add-feature event.
     */
    private onFeatureAdded;
    private getOlFeatureFromDrawingSource;
    private isOlFeatureInState;
    createOlFeature(dFeature: DrawingFeature): Feature<Geometry>;
    setFixedLineLength(length: number): void;
    setFixedSquareSide(length: number): void;
    setFixedRectangleWidth(width: number): void;
    setFixedRectangleHeight(height: number): void;
    setDrawingText(text: string): void;
    /**
     * A text shape displays the text entered in the tool parameters instead of its generated default name.
     * If no text has been entered, the default name is kept so that the shape stays visible on the map.
     */
    private applyDrawingText;
    private createLineStringFixedLength;
    private createSquareFixedLength;
    private createPolygonFixedLength;
    private createDiskFixedLength;
    private createRectangleFixedSides;
    private addDrawInteraction;
    centerViewOnFeature(drawingFeature: DrawingFeature): void;
    private getStyle;
    /**
     * Vertices are rendered on the shapes selected for editing. A text shape is an exception: as its geometry is
     * a single anchor point hidden behind the text, its vertex is only revealed while the cursor hovers the text.
     */
    private shouldRenderVertices;
    private removeDrawInteraction;
    private removeModifyInteraction;
    private getDrawingShapeType;
    private isSquareOrRectangle;
    private isSquareRectangleOrText;
    private shouldAllowVertexInsertionAtEvent;
    /**
     * A text shape is only made of its text: its anchor point is hidden behind it. To let the user know where to
     * grab the shape, the anchor vertex is revealed as long as the cursor hovers the text.
     */
    private updateHoveredTextFeature;
    private setHoveredTextFeature;
    private findHoveredTextFeatureIdAtPixel;
    private getHoveredModifiableFeatureAtPixel;
    private applyScaleRotateOnModifyStyle;
    private clearModifyFeatureChangeListeners;
    private removeSnapInteraction;
    private removeEditContextMenu;
    registerInteractions(): void;
    unregisterInteractions(): void;
    private canExecute;
    private disableContextMenu;
    private enableContextMenu;
    private fixLastLength;
}
