import type { Map as _ol_Map_ } from 'ol' import type Feature from 'ol/Feature' import type { Layer } from 'ol/layer' import type { StyleLike } from 'ol/style/Style' import type { Options as DrawOptions } from 'ol/interaction/Draw' import Draw from 'ol/interaction/Draw' import type Collection from 'ol/Collection' import type { EventsKey } from 'ol/events' import type { ModifyEvent } from 'ol/interaction/Modify' import type { ObjectEvent } from 'ol/Object' import type { CombinedOnSignature, EventTypes, OnSignature } from 'ol/Observable' import type { Types } from 'ol/ObjectEventType' import type VectorLayer from 'ol/layer/Vector' import type VectorSource from 'ol/source/Vector' import type { Geometry, Polygon } from 'ol/geom' import type { DrawEvent } from './DrawRegular' type DrawHoleOnSignature = OnSignature & OnSignature & OnSignature & OnSignature & CombinedOnSignature; export interface Options extends DrawOptions { layers?: VectorLayer>>[] | ((l: Layer) => boolean); featureFilter?: Feature[] | Collection | ((feature: Feature, layer: Layer) => boolean); style?: StyleLike; } /** Interaction to draw holes in a polygon. * It fires a drawstart, drawend event when drawing the hole * and a modifystart, modifyend event before and after inserting the hole in the feature geometry. * @constructor * @extends {ol_interaction_Interaction} * @fires drawstart * @fires drawend * @fires modifystart * @fires modifyend */ export default class DrawHole extends Draw { /** * @param {Options} options extend olx.interaction.DrawOptions * @param {Array | function | undefined} options.layers A list of layers from which polygons should be selected. Alternatively, a filter function can be provided. default: all visible layers * @param {Array | Collection | function | undefined} options.featureFilter An array or a collection of features the interaction applies on or a function that takes a feature and a layer and returns true if the feature is a candidate * @param { Style | Array