import OlMap from 'ol/Map.js'; import { olcUidKey } from '../uid.js'; import { LayerGroup, type LayerGroupOnSignature, type LayerGroupOptions } from './layer-group.js'; import { type Extent as OlExtent } from 'ol/extent.js'; import OlFeature from 'ol/Feature.js'; import OlLayerVector from 'ol/layer/Vector.js'; import OlSourceVector from 'ol/source/Vector.js'; import { Geometry as OlGeometry } from 'ol/geom.js'; import OlCollection from 'ol/Collection.js'; import type { EventsKey } from 'ol/events.js'; import BaseEvent from 'ol/events/Event.js'; import type { CombinedOnSignature, EventTypes, OnSignature } from 'ol/Observable.js'; import type { Types } from 'ol/ObjectEventType.js'; export declare const DefaultOverlayLayerGroupUid = "olcOverlayLayerGroupUid"; export declare const FeatureAffectedEventType = "olcFeatureAffected"; export declare const FeaturePropertyChangedEventType = "olcFeaturePropertyChanged"; /** * Event definition for "affected" event of a feature in the layerGroup. * To provide changed-like-event, without touching the original features. * With source layer uid, free reason why/by/for it's fired, the affected features * and the not anymore affected features. * Example: fire/listen to selected/deselected (as reason) features without touching * the real features and having to listen to every layer individually. */ export declare class FeatureAffectedEvent extends BaseEvent { static readonly type = "olcFeatureAffected"; readonly [olcUidKey]: string; readonly reason: string; readonly affected: OlFeature[]; readonly noMoreAffected?: OlFeature[]; constructor(layerUid: string, reason: string, affected: OlFeature[], noMoreAffected?: OlFeature[]); } export declare class FeaturePropertyChangedEvent extends BaseEvent { static readonly type = "olcFeaturePropertyChanged"; readonly [olcUidKey]: string; readonly propertyKey: string; readonly features: OlFeature[]; constructor(layerUid: string, propertyKey: string, features: OlFeature[]); } export type OverlayLayerGroupOnSignature = LayerGroupOnSignature & OnSignature & OnSignature & CombinedOnSignature; /** * LayerGroup specialized to manage layers with features (mostly vector layers). * Each instance must have a unique name (the default name will be valid for the first group). * The default position is 20. */ export declare class OverlayLayerGroup extends LayerGroup { on: OverlayLayerGroupOnSignature; once: OverlayLayerGroupOnSignature; un: OverlayLayerGroupOnSignature; constructor(map: OlMap, options?: LayerGroupOptions); /** * Get the vector layer if a vector layer with this layer id exists. * @param layerUid the id of the layer to add features into. */ getVectorLayer(layerUid: string): OlLayerVector | null; /** * @param layerUid the id of the layer to add features into. * @returns the vector source in the corresponding layer or null. For * cluster source, the returned source is the first source (the * effective cluster source, and not the vector source inside the * cluster source). */ getVectorSource(layerUid: string): OlSourceVector | null; /** * @param layerUid the id of the layer to add features into. * @returns the last vector source in the corresponding layer or null. * Meaning the normal source on the vector layer with VectorSource, and the * vector source inside the cluster source for ClusterSource. */ getEndVectorSource(layerUid: string): OlSourceVector | null; /** * Add features in the target overlay layer. Does * nothing with an empty array. * @param layerUid the id of the layer to add features into. * @param features the features to add to the layer. */ addFeatures(layerUid: string, features: OlFeature[]): void; /** * Remove features from the target overlay layer. Does * nothing with an empty array. * @param layerUid the id of the layer to remove features from. * @param features the features to remove to the layer. */ removeFeatures(layerUid: string, features: OlFeature[]): void; /** * Set features in the target overlay layer. * @param layerUid the id of the layer to remove features from. * @param features the features to replace existing ones in the layer. */ setFeatures(layerUid: string, features: OlFeature[]): void; /** * @param layerUid the id of the layer to get the extent from. * @returns The extent (not empty) of all features in the target layer or * null. */ getLayerFeaturesExtent(layerUid: string): OlExtent | null; /** * @returns The extent (not empty) of all features in every overlay in the * map. */ getFeaturesExtent(): OlExtent | null; /** * @param layerUid id of the layer. * @returns The collections of features in the layer or null. Do not use * a collection to add/remove features. It's slow. Use related methods on the * source directly. */ getFeaturesCollection(layerUid: string): OlCollection> | null; /** * Fires an "affected" feature event. */ dispatchFeaturesAffected(layerUid: string, reason: string, affected: OlFeature[], noMoreAffected?: OlFeature[]): void; /** * Set a property of every given feature with the same value. * If you want to set different values, set the feature manually (with silent=true), then call * dispatchFeaturePropertyChanged to redraw the ol layer and fires a featuresPropertyChanged event. * Or call featuresPropertyChange manually if necessary. */ setFeaturesProperty(layerUid: string, features: OlFeature[], propertyKey: string, value: unknown): void; /** * Emits a "featuresPropertyChanged" and call a "changed" event on the matching OL layer. */ dispatchFeaturePropertyChanged(layerUid: string, features: OlFeature[], propertyKey: string): void; /** * @param layerUid id of the layer * @returns The cluster features in the layer or null * Do not modify or save cluster features as they are recreated dynamically * on each map rendering (move, zoom, etc.). It's not possible to rely on * this object. */ getClusterFeatures(layerUid: string): OlFeature[] | null; }