import BaseLayer from 'ol/layer/Base'; import { Big } from 'big.js'; import { Source, ImageWMS, TileWMS, TileArcGISRest } from 'ol/source'; import { Extent } from 'ol/extent'; import { Feature, View } from 'ol'; import FeatureFormat from 'ol/format/Feature'; import { Geometry, Polygon, LineString } from 'ol/geom'; import { HsWmsLayer, HsLayerDescriptor, Measurement, BoundingBoxObject } from 'hslayers-ng/types'; import { Layer } from 'ol/layer'; import { Projection, ProjectionLike } from 'ol/proj'; import { HsConfig } from 'hslayers-ng/config'; import * as i0 from '@angular/core'; import Feature$1 from 'ol/Feature'; import VectorSource from 'ol/source/Vector'; import VectorLayer from 'ol/layer/Vector'; /** * Determines if layer has properties needed for 'Zoom to layer' function. * @param layer - Selected layer * @returns True for layer with BoundingBox property, for * WMS layer or for layer, which has source with extent */ declare function layerIsZoomable(layer: Layer): boolean; /** * Determines if layer has underlying layers. * @param layer - Selected layer * @returns True for layer with sub layers, for layer type * WMS layer */ declare function hasNestedLayers(layer: HsWmsLayer): boolean; /** * Determines if layer is a Vector layer and therefore stylable * @param layer - Selected layer * @returns True for ol.layer.Vector */ declare function layerIsStyleable(layer: Layer): boolean; /** * Test if layer is queryable (WMS layer with Info format) * @param layer - Selected layer * @returns True for ol.layer.Tile and ol.layer.Image with * INFO_FORMAT in params */ declare function isLayerQueryable(layer: Layer): boolean; /** * Get title of selected layer * @param layer - to get layer title * @returns Layer title or "Void" */ declare function getLayerTitle(layer: Layer): string; declare function getURL(layer: Layer): string; /** * Test if layer is WMS layer * @param layer - Selected layer * @returns True for ol.layer.Tile and ol.layer.Image */ declare function isLayerWMS(layer: Layer): boolean; declare function isLayerWMTS(layer: Layer): boolean; declare function isLayerXYZ(layer: Layer): boolean; declare function isLayerArcgis(layer: Layer): boolean; declare function isLayerIDW(layer: Layer): boolean; declare function getLayerSourceFormat(layer: Layer): FeatureFormat; /** * Test if layer is Vector layer * @param layer - Selected layer * @param includingClusters - Whether to treat clusters as Vectors or not, Defaults to true * @returns True for Vector layer */ declare function isLayerVectorLayer(layer: BaseLayer, includingClusters?: boolean): boolean; /** * Test if the features in the vector layer come from a GeoJSON source * @param layer - an OL vector layer * @returns true only if the GeoJSON format is explicitly specified in the source. False otherwise. */ declare function isLayerGeoJSONSource(layer: Layer): Promise; /** * Test if the features in the vector layer come from a TopoJSON source * @param layer - an OL vector layer * @returns true only if the TopoJSON format is explicitly specified in the source. False otherwise. */ declare function isLayerTopoJSONSource(layer: Layer): Promise; /** * Test if the features in the vector layer come from a KML source * @param layer - an OL vector layer * @returns true only if the KML format is explicitly specified in the source. False otherwise. */ declare function isLayerKMLSource(layer: Layer): Promise; /** * Test if the features in the vector layer come from a GPX source * @param layer - an OL vector layer * @returns true only if the GPX format is explicitly specified in the source. False otherwise. */ declare function isLayerGPXSource(layer: Layer): Promise; /** * Test if layer is shown in layer switcher * (if not some internal hslayers layer like selected feature layer) * @param layer - Layer to check * @returns True if showInLayerManager attribute is set to true */ declare function isLayerInManager(layer: Layer): boolean; declare function getSourceParams(source: ImageWMS | TileWMS | TileArcGISRest): Record; declare function getLayerParams(layer: Layer): Record; declare function updateLayerParams(layer: Layer, params: any): void; /** * Test if layer is has a title * @param layer - Layer to check * @returns True if layer is has a title */ declare function hasLayerTitle(layer: Layer): boolean; /** * Test if layers features are editable * @param layer - Layer to check * @returns True if layer has attribute 'editor' and in it * 'editable' property is set to true or missing */ declare function isLayerEditable(layer: Layer): boolean; /** * Get user friendly name of layer based primary on title * and secondary on name attributes. * Is used in query service and hover popup. * @param layer - Layer to get the name for */ declare function getLayerName(layer: Layer): string; /** * Highlight feature corresponding records inside a list * @param featuresUnder - Features under the cursor * @param layer - Layer to get features from */ declare function highlightFeatures(featuresUnder: Feature[], list: { featureId?: string; highlighted?: boolean; }[]): void; /** * Checks if layer has a VectorSource object, if layer is * not internal for hslayers, if it has title and is shown in layer * switcher * @param layer - Layer to check * @returns True if layer is drawable vector layer */ declare function isLayerDrawable(layer: Layer, options?: { checkVisible?: boolean; }): boolean; /** * Checks if layer's source has its own source * @param layer - Layer to check * @returns True if layer is clustered, false otherwise */ declare function isLayerClustered(layer: Layer): boolean; /** * Test if layers source is loaded * @param layer - Selected layer descriptor * @returns True loaded / False not (fully) loaded */ declare function layerLoaded(layer: HsLayerDescriptor): boolean; /** * Test if layers source is validly loaded (!true for invalid) * @param layer - Selected layer descriptor * @returns True invalid, false valid source */ declare function layerInvalid(layer: HsLayerDescriptor): boolean; declare function calculateResolutionFromScale(denominator: number, view: View): number; /** * List numeric attributes of the feature */ declare function listNumericAttributes(features: Feature[]): string[]; declare const ATTRIBUTES_EXCLUDED_FROM_LIST: string[]; /** * List all attributes of the features apart from the geometry * Samples up to 33% of features with a hard limit of 400 features * to build a comprehensive attribute list */ declare function listAttributes(features: Feature[], numericOnly?: boolean, customExcludedAttributes?: string[]): string[]; declare const COEFFICIENTS: Big[]; /** * Calculates a buffer factor based on polynomial evaluation using Horner's method. * * This function evaluates a 4th-degree polynomial with pre-calculated coefficients * to determine a buffer factor. The function is designed to return a value close to 0.12 * for smaller distances (approximately 0-300 kilometers) and gradually decrease to 0 as the * distance approaches 4000 kilometers. * * Note: This function is intended for use with input values up to 4000 meters. * Using values greater than 4000 kilometers may produce unexpected results */ declare function getPolynomialBufferFactor(x: number): number; /** * Buffer extent by `BUFFER_FACTOR` * NOTE: Not using OL because we want to extend width and height independently */ declare function bufferExtent(extent: Extent, currentMapProj: Projection): Extent; /** * Shared z-index helpers for layer ordering. */ declare function getLayerZIndex(layer: Layer): number; declare function getMaxLayerZIndex(layers: Layer[], fallback?: number): number; declare function getMinLayerZIndex(layers: Layer[]): number | undefined; /** * Add delta to z-index of each layer (e.g. to make room for a new layer below). */ declare function shiftLayersZIndex(layers: Layer[], delta: number): void; /** * Converts SLD Function elements to equivalent PropertyIs elements * For example: becomes * * This transformation is necessary for compatibility between different SLD implementations * such as those used by QGIS, GeoServer, and other OGC-compliant systems. * * @param sld - The SLD XML string to process * @returns The SLD string with Function elements converted to PropertyIs elements */ declare const normalizeSldComparisonOperators: (sld: string) => string; declare class HsProxyService { hsConfig: HsConfig; private laymanUrl; /** * Register Layman endpoints to avoid proxifying them * @param endpoints - Layman endpoints to register */ registerLaymanEndpoints(url: string): void; /** * Proxify URL if enabled. * @param url - URL to proxify * @returns Encoded URL with path to hslayers-server proxy or original URL if proxification not needed */ proxify(url: string): string; /** * Checks if URL should skip proxification based on predefined rules * @param url - URL to check * @returns boolean indicating if proxification should be skipped */ private shouldSkipProxification; /** * Checks if URL is from the same origin as the application * @param url - URL to check * @returns boolean indicating if URL is from the same origin */ private isFromSameOrigin; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } /** * @param url - URL for which to determine port number * @returns Port number */ declare function getPortFromUrl(url: string): string; /** * Parse parameters and their values from URL string * @param str - URL to parse parameters from * @returns Object with parsed parameters as properties */ declare function getParamsFromUrl(str: string): any; /** * Create encoded URL string from object with parameters * @param params - Parameter object with parameter key-value pairs * @returns Joined encoded URL query string */ declare function paramsToURL(params: any): string; /** * Insert every element in the set of matched elements after the target. * @param newNode - Element to insert * @param referenceNode - Element after which to insert */ declare function insertAfter(newNode: any, referenceNode: any): void; /** * Create URL string from object with parameters without encoding * @param params - Parameter object with parameter key-value pairs * @returns Joined URL query string */ declare function paramsToURLWoEncode(params: any): string; /** * Returns a function, that, as long as it continues to be * invoked, will not be triggered. * (https://davidwalsh.name/javascript-debounce-function) * @param func - Function to execute with throttling * @param wait - The function will be called after it stops * being called for N milliseconds. * @param immediate - If `immediate` is passed, trigger the * function on the leading edge, instead of the trailing. * @param context - Context element which stores the timeout handle * @returns Returns function which is debounced */ declare function debounce(func: any, wait: number, immediate: boolean, context: any): (...args: any[]) => void; /** * Creates a deep copy of the input object * @param from - object to deep copy * @param to - optional target for copy * @returns a deep copy of input object */ declare function structuredClone(from: any, to?: any): any; /** * Check if object is a function * @param functionToCheck - object to check, presumably a function * @returns true when input is a function, false otherwise */ declare function isFunction(functionToCheck: any): boolean; /** * Check if object is plain object (not function, not array, not class) * @returns true when input is plain old JavaScript object, false otherwise */ declare function isPOJO(objectToCheck: any): boolean; /** * Check if object is an instance of a specific class * @param obj - any object to check * @param type - class type itself * @returns true when obj is an instance of the provided type, false otherwise */ declare function instOf(obj: any, type: any): boolean; /** * Compute and format polygon area with correct units (m2/km2) * @returns area of polygon with used units */ declare function formatArea(polygon: Polygon, sourceProj: ProjectionLike): Measurement; /** * Compute and format line length with correct units (m/km) * @returns numeric length of line with used units */ declare function formatLength(line: LineString, sourceProj: ProjectionLike): Measurement; /** * Check if element is overflown * @param element - Element to check * @returns true if element is overflown, false otherwise */ declare function isOverflown(element: Element): boolean; /** * Replaces first string letter to UpperCase * @param target - Target string * @returns modified string */ declare function capitalizeFirstLetter(target: string): string; /** * Transforms string from camelCase to kebab-case */ declare function camelToKebab(str: string): string; /** * Returns undefined if string is undefined or empty */ declare function undefineEmptyString(str: string): any; /** * @param record - Record of one dataset from Get Records response * Create extent features for displaying extent of loaded dataset records in map */ declare function addExtentFeature(record: any, mapProjection: any): Feature$1 | undefined; declare function transformExtentValue(pairs: number[][], mapProjection: any, disableTransform?: boolean): number[]; declare function parseExtent(bbox: string | Array): number[][]; /** * Create new extent layer */ declare function createNewExtentLayer(title: string): VectorLayer>; /** * Get bounding box from object \{east: value, south: value, west: value, north: value\} * @param bbox - Bounding box * @returns Returns bounding box as number array */ declare function getBboxFromObject(bbox: number[] | BoundingBoxObject): number[]; /** * Replace Urls in text by anchor html tag with url, useful for attribution to be clickable * * @param url - String to look for Urls * @returns Text with added anchors */ declare function addAnchors(url: string): string; /** * Loop through list of formats returned by GetCapabilities and select first available from the list of available formats * * @param formats - List of formats available for service * @param preferredFormats - List of preferred formats for output * @returns Either one of preferred formats or first available format */ declare function getPreferredFormat(formats: string[], preferredFormats: string[]): string; export { ATTRIBUTES_EXCLUDED_FROM_LIST, COEFFICIENTS, HsProxyService, addAnchors, addExtentFeature, bufferExtent, calculateResolutionFromScale, camelToKebab, capitalizeFirstLetter, createNewExtentLayer, debounce, formatArea, formatLength, getBboxFromObject, getLayerName, getLayerParams, getLayerSourceFormat, getLayerTitle, getLayerZIndex, getMaxLayerZIndex, getMinLayerZIndex, getParamsFromUrl, getPolynomialBufferFactor, getPortFromUrl, getPreferredFormat, getSourceParams, getURL, hasLayerTitle, hasNestedLayers, highlightFeatures, insertAfter, instOf, isFunction, isLayerArcgis, isLayerClustered, isLayerDrawable, isLayerEditable, isLayerGPXSource, isLayerGeoJSONSource, isLayerIDW, isLayerInManager, isLayerKMLSource, isLayerQueryable, isLayerTopoJSONSource, isLayerVectorLayer, isLayerWMS, isLayerWMTS, isLayerXYZ, isOverflown, isPOJO, layerInvalid, layerIsStyleable, layerIsZoomable, layerLoaded, listAttributes, listNumericAttributes, normalizeSldComparisonOperators, paramsToURL, paramsToURLWoEncode, parseExtent, shiftLayersZIndex, structuredClone, transformExtentValue, undefineEmptyString, updateLayerParams };