import * as i0 from '@angular/core'; import { Renderer2 } from '@angular/core'; import ImageWrapper from 'ol/Image'; import RenderFeature from 'ol/render/Feature'; import { Vector, Cluster, Source } from 'ol/source'; import { Extent } from 'ol/extent'; import { Map, Feature, View, ImageTile } from 'ol'; import { Geometry } from 'ol/geom'; import { Vector as Vector$1, Layer } from 'ol/layer'; import { Projection } from 'ol/proj'; import { BoundingBoxObject } from 'hslayers-ng/types'; import { HsConfig } from 'hslayers-ng/config'; import { HsEventBusService } from 'hslayers-ng/services/event-bus'; import { HsLanguageService } from 'hslayers-ng/services/language'; import { HsLayoutService } from 'hslayers-ng/services/layout'; declare enum DuplicateHandling { AddDuplicate = 0, IgnoreNew = 1, RemoveOriginal = 2 } type VectorAndSource = { source: Vector | Cluster; layer: Vector$1>; }; declare class HsMapService { hsConfig: HsConfig; hsLayoutService: HsLayoutService; private hsLog; hsEventBusService: HsEventBusService; hsLanguageService: HsLanguageService; private hsQueuesService; private hsCommonLaymanService; private rendererFactory; private hsProxyService; map: Map; mapElement?: any; renderer?: Renderer2; featureLayerMapping: { [key: string]: VectorAndSource[]; }; placeholderOsm: Layer; defaultDesktopControls: any; visibleLayersInUrl?: string[]; permalink?: string; externalCompositionId?: string; timer: any; puremap: any; /** * Duration of added interactions animation. (400 ms used, default in OpenLayers is 250 ms) * @default 400 */ duration: number; visible: boolean; /** * Copy of the default_view for map resetting purposes */ originalView: { center: number[]; zoom: number; rotation: number; }; /** * Keeps track of zoomWithModifier listener so it's not registered multiple times when using router */ zoomWithModifierListener: any; constructor(); /** * Returns the associated layer for feature. * This is used in query-vector.service to get the layer of clicked * feature when features are listed in info panel. * @param feature - Feature selected * @returns VectorLayer */ getLayerForFeature(feature: Feature): Vector$1>; /** * When multiple layers contain feature with the same ID do a full search by feature instance instead. * @param array - Cached array of layers for a given feature ID * @param feature - Instance of feature * @returns Layer */ refineLayerSearch(array: VectorAndSource[], feature: Feature): Vector$1>; /** * Search for feature in layer by looping through feature list. getFeatureById is more efficient, but is not always available * @param obj - dictionary entry for layer and its vector source (ordinary vector source, source of each Group layers child or underlying source for cluster layer) * @param feature - Feature instance * @returns Feature */ findFeatureByInst(obj: VectorAndSource, feature: Feature): Feature; /** * Get vector layers from the map, mentioned in the layersToLookFor array * @param layersToLookFor - Layers requested */ getVectorLayers(layersToLookFor: VectorAndSource[]): void; /** * Get geometry feature by its ID. * Used in hslayers-cesium. * @param fid - Feature ID * @returns Feature */ getFeatureById(fid: string): Feature | RenderFeature[]; /** * Create default view button inside the map html element * @param defaultDesktopControls - Default controls */ createDefaultViewButton(): Promise; /** * Set map to default view * @param e - Mouse click event */ setDefaultView: (e: any) => void; /** * @param e - Map or view change */ extentChanged(e: any): void; /** * Initialization function for HSLayers map object. * Initialize map with basic interaction, scale line and watcher for map view changes. * When default controller is used, it's called automatically, otherwise it must be called before other modules dependent on map object are loaded. * @param mapElement - Map html element */ init(mapElement: HTMLElement): void; /** * Wait until the OL map is fully loaded * @returns OL map object */ loaded(): Promise; /** * Find layer object by title of layer * @param title - Title of the layer (from layer creation) * @returns OL.layer object */ findLayerByTitle(title: string): any; /** * Two layers are considered equal when they equal in the following properties: * * title * * type of source * * list of sublayers * * URL * * and when there are multiple URLs defined for a layer, there must be at least one matching URL for both the layers. * @param existingLayer - Layer 1. Usually the one which is already added to map * @param newLayer - Layer 2. Usually the one which will be added to map * @returns True if the layers are equal, false otherwise */ layersEqual(existingLayer: any, newLayer: any): boolean; /** * Checks if a layer with the same title already exists in the map * @param lyr - A layer to check * @returns True if layer is already present in the map, false otherwise */ layerAlreadyExists(lyr: Layer): boolean; /** * Remove any duplicate layer inside map layers array * @param lyr - A layer to check */ removeDuplicate(lyr: Layer): void; /** * Get layers array from the OL map object * @returns Layer array */ getLayersArray(): Layer[]; /** * Proxify layer based on its source object type and if it's tiled or not. * Each underlying OL source class has its own way to override imagery loading. * @param lyr - Layer which to proxify if needed */ proxifyLayer(lyr: Layer): void; /** * Checks if layer already exists in map and resolves based on duplicateHandling strategy * @returns True if layer should be processed (added to map etc.) */ resolveDuplicateLayer(lyr: Layer, duplicateHandling?: DuplicateHandling): boolean; /** * Function to add layer to map which also checks if * the layer is not already present and also proxifies the layer if needed. * Generally for non vector layers it would be better to use this function than to add to OL map directly * and rely on layer manager service to do the proxification and also it's shorter than to use HsMapService.getMap().addLayer. * * @param lyr - Layer to add * @param duplicateHandling - How to handle duplicate layers (same class and title) * @param visibleOverride - Override the visibility using an array layer titles, which */ addLayer(lyr: Layer, duplicateHandling?: DuplicateHandling, visibleOverride?: string[]): void; /** * Add all layers from app config (default_layers) to the map. * Only layers specified in visibilityOverrides parameter will get instantly visible. * @param visibilityOverrides - Override the visibility using an array layer titles, which * should be visible. Useful when the layer visibility is stored in a URL parameter */ repopulateLayers(visibilityOverrides: string[]): void; /** * Add layers from app config - default_layers * While adding check if hs-composition URL param or defaultComposition is set, if so, filter config's layers by removable property * If permalink URL param is set, do not add any of config's layers. */ addLayersFromAppConfig(layers: Layer[], visibilityOverrides: string[]): void; /** * Get map projection currently used in the map view * @returns Projection */ getCurrentProj(): Projection; /** * For a vector layer with a vector source, determines if it includes points, lines and/or polygons and stores the information in hasPoint, hasLine, hasPoly properties of the source. * Get vector type from the layer selected * @param layer - Vector layer selected */ getVectorType(layer: any): void; /** * Check vector geometry types as found from vector source provided * @param src - Vector source */ vectorSourceTypeComputer(src: any): void; /** * Reset map to state configured in app config (reload all layers and set default view) */ reset(): void; /** * Reset map view to view configured in app config */ resetView(): void; /** * Create a placeholder view * @returns Map view */ createPlaceholderView(): View; /** * Checks if layer title is present in an array of layer titles. * Used to set visibility by URL parameter which contains visible layer titles * @param lyr - Layer for which to determine visibility * @param array - Layer title to check in. * @returns Detected visibility of layer */ layerTitleInArray(lyr: Layer, array: string[]): boolean; /** * Get ol-layer canvas element from DOM * @returns DOM NodeListOf */ getCanvases(): NodeListOf; /** * Get ol-layer canvas element from DOM * @param type - Scale type (scaleline or scalebar) * @returns DOM element */ getScaleLineElement(type: 'scaleline' | 'scalebar'): Element; /** * Proxify layer loader to work with layers from other sources than app * @param lyr - Layer to proxify * @param tiled - Info if layer is tiled * @returns proxified URL */ proxifyLayerLoader(lyr: Layer, tiled: boolean): string; /** * Proxify loader for any imagery layer, either tiled or not * @param image - Image or ImageTile as required by setImageLoadFunction() in ImageWMS, ImageArcGISRest and WMTS sources * @param src - Original (unproxified) source URL */ simpleImageryProxy(image: ImageWrapper | ImageTile, src: string): Promise; /** * Create a loader function for Layman WMS layers specifically * @param image - ol/Image, the image requested via WMS source * @param src - Original (unproxified) source URL */ laymanWmsLoadingFunction(image: ImageWrapper | ImageTile, src: string): Promise; /** * Move map and zoom to specified coordinate/zoom level * @param x - X coordinate of new center * @param y - Y coordinate of new center * @param zoom - New zoom level */ moveToAndZoom(x: number, y: number, zoom: number): void; /** * Get current map extent * @returns Extent */ getMapExtent(): Extent; /** * Get current map extent in WGS84 (EPSG:4326) projection * @returns Extent */ getMapExtentInEpsg4326(): Extent; /** * Fit extent into map view * @param extent - Extent provided */ fitExtent(extent: number[]): Promise; /** * Get ol.Map object from service * @returns ol.Map */ getMap(): Map; /** * Remove all map layers */ removeAllLayers(): void; /** * Remove all removable layers no matter fromComposition param */ removeCompositionLayers(force?: boolean): void; /** * Remove all map controls */ removeAllControls(): void; /** * Remove all map interactions */ removeAllInteractions(): void; /** * Get current extent of map, transform it into EPSG:4326 and round coordinates to 2 decimals. * This is used mainly in compositions and sharing of map and the coordinates are not very precise. * @returns Extent coordinates. Example: \{east: "0.00", south: "0.00", west: "1.00", north: "1.00"\} */ describeExtent(): BoundingBoxObject; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } /** * Registers HSLayers projection definitions in proj4 and wires them to OpenLayers. * Includes GML URL aliases for interoperability. */ declare function registerHslayersProj4Defs(): void; export { DuplicateHandling, HsMapService, registerHslayersProj4Defs };