import * as _angular_helpers_openlayers_core from '@angular-helpers/openlayers/core'; import { Feature, OlFeature } from '@angular-helpers/openlayers/core'; import * as rxjs from 'rxjs'; import * as _angular_helpers_openlayers_interactions from '@angular-helpers/openlayers/interactions'; import * as _angular_core from '@angular/core'; import { Provider } from '@angular/core'; import Interaction from 'ol/interaction/Interaction'; import OLMap from 'ol/Map'; type InteractionType = 'select' | 'draw' | 'modify' | 'dragAndDrop'; interface InteractionConfig { active?: boolean; /** * If true, enabling this interaction will automatically disable other active exclusive interactions. * Useful for mutually exclusive tools like Draw and Modify. * @default true */ exclusive?: boolean; } interface SelectConfig extends InteractionConfig { layers?: string[]; multi?: boolean; hitTolerance?: number; condition?: 'click' | 'pointerMove'; } interface DrawConfig extends InteractionConfig { type: 'Point' | 'LineString' | 'Polygon' | 'Circle' | 'Ellipse' | 'Donut'; source?: string; freehand?: boolean; snapTolerance?: number; } interface ModifyConfig extends InteractionConfig { source?: string; snapTolerance?: number; } interface DragAndDropConfig extends InteractionConfig { format?: 'GeoJSON' | 'KML' | 'GPX'; projection?: string; } interface SelectEvent { interactionId: string; selected: Feature[]; deselected: Feature[]; } interface SelectHoverEvent { interactionId: string; hoveredId: string | null; feature: Feature | null; } interface DrawEndEvent { interactionId: string; feature: Feature; type: string; } interface DrawStartEvent { interactionId: string; feature: Feature; } interface ModifyEvent { interactionId: string; features: Feature[]; type: 'modifystart' | 'modifyend'; } interface InteractionState { id: string; type: InteractionType; active: boolean; } /** * Main service for managing OpenLayers map interactions. * Orchestrates specialized interaction services and exposes unified API. * * @example * ```typescript * const interactionService = inject(OlInteractionService); * * // Enable select interaction * interactionService.enableSelect('select-1', { layers: ['cities'], multi: true }); * * // React to selection changes * effect(() => { * const selected = interactionService.selectedFeatures(); * console.log('Selected:', selected); * }); * ``` */ declare class OlInteractionService { private mapService; private stateService; private zoneHelper; private selectService; private drawService; private modifyService; readonly selectedFeatures: _angular_core.Signal<_angular_helpers_openlayers_core.Feature[]>; readonly hoveredFeature: _angular_core.Signal<_angular_helpers_openlayers_core.Feature | null>; readonly selectionCount: _angular_core.Signal; readonly hasSelection: _angular_core.Signal; readonly activeInteractions: _angular_core.Signal<_angular_helpers_openlayers_interactions.ManagedInteraction[]>; readonly drawStart$: rxjs.Observable<_angular_helpers_openlayers_interactions.DrawStartEvent>; readonly drawEnd$: rxjs.Observable<_angular_helpers_openlayers_interactions.DrawEndEvent>; readonly modify$: rxjs.Observable<_angular_helpers_openlayers_interactions.ModifyEvent>; readonly select$: rxjs.Observable<_angular_helpers_openlayers_interactions.SelectEvent>; readonly hover$: rxjs.Observable; /** * Enable a select interaction on the map. * @param id - Unique identifier for this interaction * @param config - Selection configuration * @returns Object with cleanup method */ enableSelect(id: string, config?: SelectConfig): { cleanup: () => void; }; /** * Enable a draw interaction on the map. * @param id - Unique identifier for this interaction * @param config - Draw configuration * @returns Object with cleanup method and isActive signal */ enableDraw(id: string, config: DrawConfig): { cleanup: () => void; isActive: () => boolean; }; /** * Enable a modify interaction on the map. * @param id - Unique identifier for this interaction * @param config - Modify configuration * @returns Object with cleanup method */ enableModify(id: string, config?: ModifyConfig): { cleanup: () => void; }; /** * Disable and remove an interaction by id. * @param id - The interaction identifier */ disableInteraction(id: string): void; /** * Disable all active interactions. */ disableAll(): void; /** * Clear the current selection. * Also clears the OL Select interaction's internal feature collection so the * visual selection is removed from the map. */ clearSelection(): void; /** * Check if an interaction is currently active. * @param id - The interaction identifier * @returns True if active, false otherwise */ isActive(id: string): boolean; /** * Get current interaction state. * @returns Array of interaction state summaries */ getInteractionState(): _angular_helpers_openlayers_interactions.InteractionState[]; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵprov: _angular_core.ɵɵInjectableDeclaration; } /** * Internal representation of a managed OpenLayers interaction. * Tracks the interaction instance, its configuration, and cleanup function. */ interface ManagedInteraction { /** Unique identifier for this interaction instance */ id: string; /** Type of interaction (select, draw, modify, etc.) */ type: InteractionType; /** The OpenLayers interaction instance */ olInteraction: Interaction; /** Configuration used when creating the interaction */ config: InteractionConfig; /** Function to clean up and remove the interaction from the map */ cleanup: () => void; } /** * Service responsible for managing the reactive state of interactions. * Provides signals for interaction state and observables for events. */ declare class InteractionStateService { private interactions; private selectedFeaturesInternal; private hoveredFeatureInternal; private drawStartSubject; private drawEndSubject; private modifySubject; private selectSubject; private hoverSubject; readonly selectedFeatures: _angular_core.Signal; readonly hoveredFeature: _angular_core.Signal; readonly selectionCount: _angular_core.Signal; readonly hasSelection: _angular_core.Signal; readonly activeInteractions: _angular_core.Signal; readonly drawStart$: rxjs.Observable; readonly drawEnd$: rxjs.Observable; readonly modify$: rxjs.Observable; readonly select$: rxjs.Observable; readonly hover$: rxjs.Observable; /** * Adds a managed interaction to the state. * If the interaction is marked as exclusive, it disables other exclusive interactions. * @param interaction - The interaction to add */ addInteraction(interaction: ManagedInteraction): void; /** * Removes an interaction by id. * @param id - The interaction identifier to remove */ removeInteraction(id: string): void; /** * Gets all managed interactions. * @returns Array of managed interactions */ getInteractions(): ManagedInteraction[]; /** * Finds an interaction by id. * @param id - The interaction identifier * @returns The managed interaction or undefined */ findInteraction(id: string): ManagedInteraction | undefined; /** * Sets the currently selected features. * @param features - Array of selected features */ setSelectedFeatures(features: Feature[]): void; /** * Clears the current selection. */ clearSelection(): void; /** * Sets the currently hovered feature. * @param feature - The hovered feature or null */ setHoveredFeature(feature: Feature | null): void; /** * Emits a draw start event. * @param event - The draw start event data */ emitDrawStart(event: DrawStartEvent): void; /** * Emits a draw end event. * @param event - The draw end event data */ emitDrawEnd(event: DrawEndEvent): void; /** * Emits a modify event. * @param event - The modify event data */ emitModify(event: ModifyEvent): void; /** * Emits a select event. * @param event - The select event data */ emitSelect(event: SelectEvent): void; /** * Emits a hover event. * @param event - The hover event data */ emitHover(event: SelectHoverEvent): void; /** * Gets the current interaction state summary. * @returns Array of interaction state objects */ getInteractionState(): InteractionState[]; /** * Checks if an interaction is currently active. * @param id - The interaction identifier * @returns True if the interaction exists and is active */ isActive(id: string): boolean; /** * Clears all interactions from state. * Note: This only clears the state tracking, not the actual OL interactions. */ clearAll(): void; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵprov: _angular_core.ɵɵInjectableDeclaration; } /** * Service responsible for creating and managing Select interactions. */ declare class SelectInteractionService { private mapService; private stateService; private zoneHelper; /** * Creates and configures a Select interaction. * @param id - Unique identifier for the interaction * @param config - Select interaction configuration * @param map - OpenLayers map instance * @returns Promise that resolves when the interaction is created */ createSelectInteraction(id: string, config: SelectConfig, map: OLMap): void; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵprov: _angular_core.ɵɵInjectableDeclaration; } /** * Service responsible for creating and managing Draw interactions. */ declare class DrawInteractionService { private mapService; private layerService; private stateService; private zoneHelper; /** * Creates and configures a Draw interaction. * @param id - Unique identifier for the interaction * @param config - Draw interaction configuration * @param map - OpenLayers map instance * @returns True if the interaction was created successfully */ createDrawInteraction(id: string, config: DrawConfig, map: OLMap): boolean; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵprov: _angular_core.ɵɵInjectableDeclaration; } /** * Service responsible for creating and managing Modify interactions. */ declare class ModifyInteractionService { private layerService; private stateService; private zoneHelper; /** * Creates and configures a Modify interaction. * @param id - Unique identifier for the interaction * @param config - Modify interaction configuration * @param map - OpenLayers map instance */ createModifyInteraction(id: string, config: ModifyConfig, map: OLMap): void; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵprov: _angular_core.ɵɵInjectableDeclaration; } declare class MeasurementInteractionService { private mapService; private zoneHelper; private draw?; private source; private vectorLayer?; private map?; private sketch; private measureTooltipElement; private measureTooltip; private listener; private isMeasuring; startMeasuring(type: 'LineString' | 'Polygon'): void; stopMeasuring(): void; isActive(): boolean; private createMeasureTooltip; private formatLength; private formatArea; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵprov: _angular_core.ɵɵInjectableDeclaration; } /** * Declarative component to configure an OpenLayers Draw Interaction. */ declare class OlDrawInteractionComponent { private interactionService; private destroyRef; id: _angular_core.InputSignal; type: _angular_core.InputSignal<"Point" | "LineString" | "Polygon" | "Circle">; source: _angular_core.InputSignal; freehand: _angular_core.InputSignal; snapTolerance: _angular_core.InputSignal; active: _angular_core.InputSignal; private drawStartFiltered$; private drawEndFiltered$; drawStart: _angular_core.OutputRef<_angular_helpers_openlayers_interactions.DrawStartEvent>; drawEnd: _angular_core.OutputRef<_angular_helpers_openlayers_interactions.DrawEndEvent>; constructor(); static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵcmp: _angular_core.ɵɵComponentDeclaration; } /** * Declarative component to configure an OpenLayers Modify Interaction. */ declare class OlModifyInteractionComponent { private interactionService; private destroyRef; id: _angular_core.InputSignal; source: _angular_core.InputSignal; snapTolerance: _angular_core.InputSignal; active: _angular_core.InputSignal; private modifyFiltered$; modifyEvent: _angular_core.OutputRef<_angular_helpers_openlayers_interactions.ModifyEvent>; constructor(); static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵcmp: _angular_core.ɵɵComponentDeclaration; } /** * Declarative component to configure an OpenLayers Select Interaction. */ declare class OlSelectInteractionComponent { private interactionService; private destroyRef; id: _angular_core.InputSignal; layers: _angular_core.InputSignal; multi: _angular_core.InputSignal; hitTolerance: _angular_core.InputSignal; condition: _angular_core.InputSignal<"click" | "pointerMove" | undefined>; active: _angular_core.InputSignal; private selectFiltered$; selectEvent: _angular_core.OutputRef<_angular_helpers_openlayers_interactions.SelectEvent>; hoverEvent: _angular_core.OutputEmitterRef; constructor(); static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵcmp: _angular_core.ɵɵComponentDeclaration; } /** * Provide the interactions feature with OlInteractionService and all specialized services. * Note: ZoneHelper is inherited from core's provideOpenLayers. * @returns OlFeature configuration for interactions */ declare function withInteractions(): OlFeature<'interactions'>; /** * Alias for withInteractions(). * @returns OlFeature configuration for interactions */ declare function provideInteractions(): OlFeature<'interactions'>; /** * Enable select interaction when providing the interactions feature. * @param id Unique identifier for this interaction * @param config Select interaction configuration * @returns Provider function that enables select interaction */ declare function withSelectInteraction(id: string, config?: SelectConfig): Provider; /** * Enable draw interaction when providing the interactions feature. * @param id Unique identifier for this interaction * @param config Draw interaction configuration * @returns Provider function that enables draw interaction */ declare function withDrawInteraction(id: string, config: DrawConfig): Provider; /** * Enable modify interaction when providing the interactions feature. * @param id Unique identifier for this interaction * @param config Modify interaction configuration * @returns Provider function that enables modify interaction */ declare function withModifyInteraction(id: string, config?: ModifyConfig): Provider; /** * Enable measurement interaction when providing the interactions feature. * @returns Provider function that enables measurement interaction */ declare function withMeasurementInteraction(): Provider; export { DrawInteractionService, InteractionStateService, MeasurementInteractionService, ModifyInteractionService, OlDrawInteractionComponent, OlInteractionService, OlModifyInteractionComponent, OlSelectInteractionComponent, SelectInteractionService, provideInteractions, withDrawInteraction, withInteractions, withMeasurementInteraction, withModifyInteraction, withSelectInteraction }; export type { DragAndDropConfig, DrawConfig, DrawEndEvent, DrawStartEvent, InteractionConfig, InteractionState, InteractionType, ManagedInteraction, ModifyConfig, ModifyEvent, SelectConfig, SelectEvent };