import { Coordinate } from 'ol/coordinate'; import { Feature } from 'ol'; import { Geometry } from 'ol/geom'; import { Layer, Vector } from 'ol/layer'; import { Source, Vector as Vector$1 } from 'ol/source'; import { Subject } from 'rxjs'; import { Style } from 'ol/style'; import { StyleFunction } from 'ol/style/Style'; import { SparqlJson } from 'hslayers-ng/common/layers'; import { GeoJSONFeatureCollection } from 'ol/format/GeoJSON'; import { Color } from 'ol/color'; import { ColorLike, PatternDescriptor } from 'ol/colorlike'; import { Type } from '@angular/core'; import { ComparisonFilter, NegationFilter, CombinationFilter } from 'geostyler-style'; import { Feature as Feature$1 } from 'ol/index'; interface AccessRightsModel { 'access_rights.write': string; 'access_rights.read': string; } type BoundingBoxObject = { east: string; south: string; west: string; north: string; }; interface HsButton { fits?: boolean; panel?: any; module?: string; order?: number; title?: any; description?: any; icon?: string; condition?: boolean; content?: any; important?: boolean; click?: any; visible?: boolean; } type ClickedCoordinates = { coordinates: { name: string; mapProjCoordinate: Coordinate; epsg4326Coordinate: Coordinate; projections: { name: string; value: any; }[]; }; }; type DOMFeatureLink = { domSelector: string; feature: string | Feature | ((layer: Layer, domElement: Element) => any); event: string; actions: [ 'zoomToExtent' | 'panToCenter' | 'showPopup', ('hidePopup' | ((feature: Feature, domElement: Element, event: any) => any)) ]; }; declare const STATE_VALUES: readonly ["PENDING", "STARTED", "FAILURE", "NOT_AVAILABLE"]; /** * Status information about GeoServer import and availability of WMS layer. No status object means the source is available. */ type StatusStateType = (typeof STATE_VALUES)[number]; type HsLaymanAccessRights = { read: string[]; write: string[]; }; type HsLaymanGeodataType = 'vector' | 'raster' | 'unknown'; type HsLaymanGetWorkspaceLayerMap = { name: string; workspace: string; }; /** * Properties common to both GET /layers and GET /layers/{id} responses */ interface HsLaymanLayerBase { access_rights?: HsLaymanAccessRights; bounding_box?: number[]; geodata_type?: HsLaymanGeodataType; name?: string; native_bounding_box?: number[]; native_crs?: string; title?: string; uuid?: string; /** Top level service URL */ url?: string; updated_at?: string; /** * List of compositions (maps) in which the layer is used */ used_in_maps?: HsLaymanGetWorkspaceLayerMap[]; } type LaymanGetWorkspaceLayerTime = { units: string; values: string[]; default: string; regex: string; regex_format: string; }; type LaymanGetWorkspaceLayerTypeResponse = { url?: string; status?: StatusStateType; error?: any; name?: string; }; type LaymanGetWorkspaceLayerTypeWfs = LaymanGetWorkspaceLayerTypeResponse; type LaymanGetWorkspaceLayerTypeWms = LaymanGetWorkspaceLayerTypeResponse & { /** * Available only for time-series layers */ time?: LaymanGetWorkspaceLayerTime; }; /** * Layer type for GET /layers/{id} response object * Extends base properties using HsLaymanGetLayer */ interface HsLaymanLayerDescriptor extends HsLaymanLayerBase { layman_metadata?: { publication_status: 'COMPLETE' | 'INCOMPLETE' | 'UPDATING'; }; description?: string; uuid?: string; wms?: LaymanGetWorkspaceLayerTypeWms; wfs?: LaymanGetWorkspaceLayerTypeWfs; thumbnail?: { path?: string; url?: string; status?: StatusStateType; error?: any; }; file?: { /** * If data file was sent in ZIP archive to the server, path includes also path to the main file inside ZIP file. * E.g. layers/b8a6c133-3363-4343-8a25-978d0df52c11/input_file/b8a6c133-3363-4343-8a25-978d0df52c11.zip/layer_main_file.shp */ paths?: string[]; status?: StatusStateType; error?: { code?: number; message?: string; detail?: any; }; }; /** * Available only for vector layers */ db?: { schema?: string; table?: string; geo_column?: string; external_uri?: string; status?: StatusStateType; error?: any; }; style?: { url?: string; type?: 'sld' | 'qml'; status?: StatusStateType; error?: any; }; original_data_source?: 'file' | 'database_table'; metadata?: { identifier?: string; record_url?: string; csw_url?: string; comparison_url?: string; status?: StatusStateType; error?: any; }; /** * True for raster layers using image_mosaic plugin in GeoServer, so far only timeseries layers. */ image_mosaic?: boolean; exists?: boolean; /** * Only when error */ message?: string; /** * Only when error */ detail?: string; /** * Only when error */ code?: number; /** * Only when error */ sub_code?: number; /** * Not part of original response. Added by describeLayer */ workspace?: string; } declare enum HsLaymanGetLayerWfsWmsStatus { AVAILABLE = "AVAILABLE", PREPARING = "PREPARING", NOT_AVAILABLE = "NOT_AVAILABLE" } /** * Layer type for GET /layers response object * Extends base properties using HsLaymanLayerBase */ interface HsLaymanGetLayer extends HsLaymanLayerBase { workspace?: string; publication_type?: string; wfs_wms_status?: HsLaymanGetLayerWfsWmsStatus; } interface HsAddLayerDescriptorCommon { highlighted?: boolean; toRemove?: boolean; editable?: boolean; endpoint?: HsEndpoint; availableTypes?: string[]; bbox?: number[]; wfsWmsStatus?: HsLaymanGetLayerWfsWmsStatus; featureId?: string; id?: string; type?: string[]; } /** * HSLayers Add Data layer descriptor * Consists of uninon of various stages of Layman layer desriptions * - when loaded into add-data catalogue list */ type HsAddDataLaymanLayerDescriptor = HsLaymanLayerDescriptor & HsLaymanGetLayer & HsAddLayerDescriptorCommon; interface HsAddDataMickaLayerDescriptor extends HsAddLayerDescriptorCommon { abstract: string; contacts: any[]; dateStamp: string; dates: { date: string; dateType: string; }[]; degree: any; imgURL: string; keywords: string[]; links: any; scales: string[]; title: string; name: string; trida: string; serviceType: string; formats: string[]; thumbnail: { path: string; url: string; }; mayedit: string; public: string; } type HsAddDataLayerDescriptor = HsAddDataLaymanLayerDescriptor | HsAddDataMickaLayerDescriptor; interface HsMapCompositionDescriptor { abstract?: string; name?: string; title?: string; endpoint?: HsEndpoint; id?: string; uuid?: string; serviceType?: string; thumbnail?: any; workspace?: string; editable?: boolean; link?: string; links?: { url: string; }[]; url?: string; featureId?: string; highlighted?: boolean; access_rights?: { read: string[]; write: string[]; }; date?: string; dateStamp?: string; } interface HsGetMapsComposition { access_rights: { read: string[]; write: string[]; }; bounding_box: number[]; name: string; native_bounding_box: number[]; native_crs: string; publication_type: string; title: string; updated_at: string; url: string; uuid: string; workspace: string; } interface LaymanCompositionDescriptor extends HsGetMapsComposition { description: string; layman_metadata: { publication_status: 'COMPLETE' | 'INCOMPLETE' | 'UPDATING'; }; metadata: { identifier: string; record_url: string; csw_url: string; comparison_url: string; status?: any; error?: any; }; thumbnail: { path: string; url: string; error?: any; }; file: any; } declare enum EndpointErrorHandling { ignore = "ignore", toast = "toast" } interface EndpointErrorHandler { handle(endpoint: HsEndpoint, error: any): any; } interface HsEndpoint { httpCall?: any; type: string; title: string; url: string; download?: boolean; language?: any; listLoading?: any; loading?: boolean; layers?: HsAddDataLayerDescriptor[]; code_list_url?: string; code_lists?: any; version?: string; datasourcePaging?: { start?: number; limit: number; loaded?: boolean; matched?: any; next?: any; }; compositions?: HsMapCompositionDescriptor[]; compositionsPaging?: { start?: number; limit: number; next?: any; matched?: any; loaded?: boolean; }; paging?: { itemsPerPage: number; }; /** * Examples: * onError: \{compositionLoad: \{handle: (e)=\>\{alert(e.message)\}\}\}, * onError: onError: \{compositionLoad: EndpointErrorHandling.ignore\}, * onError: onError: \{compositionLoad: EndpointErrorHandling.toast\}, //Default */ onError?: { compositionLoad?: EndpointErrorHandling | EndpointErrorHandler; addDataCatalogueLoad?: EndpointErrorHandling | EndpointErrorHandler; }; } declare function isErrorHandlerFunction(object: any): object is EndpointErrorHandler; type LayerSwipeSide = 'left' | 'right'; /** * Creates intersection of two types with working unwrapped tooltip */ type IntersectWithTooltip = { [P in keyof T]: T[P]; }; interface HsSublayer { /** * Unique identifier for the layer */ name: string; title: string; /** * Visibility state of this layer */ visible: boolean; /** * Previous visibility state */ previousVisible: boolean; /** * Nested sublayers, if any */ sublayers?: HsSublayer[]; maxResolution?: number; } type HsLayerTimeDescriptor = { default: string; timePoints: Array; }; type HsLayerLoadProgress = { total: number; pending: number; loadError: number; percents: number; loaded: boolean; error?: boolean; /** * Loading progress timer which controls load events executions * and tries to reset progress once the loading finished (no execution in 2000ms) */ timer?: Subject; }; interface HsLayerDescriptor { hasSublayers?: boolean; loadProgress?: HsLayerLoadProgress; layer: Layer; abstract?: string; legends?: string | string[]; active?: boolean; grayed?: boolean; position?: number; settings?: boolean; sublayers?: boolean; /** * Internal representation of sublayers structure used to control visibility */ _sublayers?: HsSublayer[]; showInLayerManager?: boolean; thumbnail?: string; title?: string; trackBy?: string; uid?: string; visible?: boolean; expandFilter?: boolean; expandInfo?: boolean; idString?: any; source?: string; time?: HsLayerTimeDescriptor; /** * OL source class of this layer, in case of 'vector' also with format (e.g. 'vector (KML)'). * Or other short name of layer type if not an OL source ('terrain', 'IDW'). */ type?: string; greyscale?: boolean; } type HsTerrainLayerDescriptor = { title?: string; url: string; active?: boolean; visible?: boolean; /** * https://cesium.com/learn/cesiumjs/ref-doc/CesiumTerrainProvider.html#.ConstructorOptions */ options?: any; type?: 'terrain'; abstract?: string; grayed?: boolean; }; type HsLayermanagerFolder = { layers: HsLayerDescriptor[]; zIndex: number; visible?: boolean; }; type CapabilitiesResponseWrapper = { response: any; error?: boolean; }; declare type NameType = string; declare type TitleType = string; declare type AbstractType = string; declare type KeywordType = string | { vocabulary?: string; }; declare type KeywordListType = KeywordType[]; declare type OnlineResourceType = string; declare type FormatType = string; declare type ContactInformationType = { ContactPersonPrimary?: { ContactPerson: string; ContactOrganization: string; }; ContactPosition?: string; ContactAddress?: { AddressType: string; Address: string; City: string; StateOrProvince: string; PostCode: string; Country: string; }; ContactVoiceTelephone?: string; ContactFacsimileTelephone?: string; ContactElectronicMailAddress?: string; }; declare type DCPTypeType = { HTTP: { Get: OnlineResourceType; Post?: OnlineResourceType; }; }; declare type OperationTypeType = { Format: FormatType | FormatType[]; DCPType: DCPTypeType | DCPTypeType[]; }; declare type CRSType = string; declare type EX_GeographicBoundingBoxType = { westBoundLongitude?: number; eastBoundLongitude?: number; southBoundLatitude?: number; northBoundLatitude?: number; }; declare type BoundingBoxType = { CRS: CRSType; minx: number; miny: number; maxx: number; maxy: number; resx?: number; resy?: number; }; declare type LogoURLType = { Format: FormatType; OnlineResource: OnlineResourceType; width: number; height: number; }; declare type AttributionType = { Title?: TitleType; OnlineResource?: OnlineResourceType; LogoURL?: LogoURLType; }; declare type MetadataURLType = { Format: FormatType; OnlineResource: OnlineResourceType; type: any; }; declare type AuthorityURLType = { OnlineResource: OnlineResourceType; name: any; }; declare type IdentifierType = { authority: string; }; declare type DataURLType = { Format: FormatType; OnlineResource: OnlineResourceType; }; declare type FeatureListURLType = DataURLType; declare type LegendURLType = LogoURLType; declare type StyleSheetURLType = DataURLType; declare type StyleURLType = DataURLType; declare type StyleType = { Name: NameType; Title: TitleType; Abstract?: AbstractType; LegendURL?: LegendURLType | LegendURLType[]; StyleSheetURL?: StyleSheetURLType; StyleURL?: StyleURLType; }; /** * Annex C "Handling multi-dimensional data" * and * https://github.com/openlayers/openlayers/blob/a8b949a802c4d79ce6fbdcbb2fe3828a83e375b3/src/ol/format/WMSCapabilities.js#L502 */ type WmsDimension = { name: string; units: string; unitSymbol?: string; default?: string; multipleValues?: boolean; nearestValue?: boolean; current?: boolean; values: string | string[]; }; /** * HsLayers extension of default WMS Layer object */ type HsWmsLayer = WmsLayer & { maxResolution: number; }; type WmsLayer = { Name?: NameType; Title: TitleType; Abstract?: AbstractType; KeywordList?: KeywordListType; CRS: CRSType | CRSType[]; EX_GeographicBoundingBox?: EX_GeographicBoundingBoxType; BoundingBox?: BoundingBoxType | BoundingBoxType[]; Dimension?: WmsDimension | WmsDimension[]; Attribution?: AttributionType; AuthorityURL?: AuthorityURLType | AuthorityURLType[]; Identifier?: IdentifierType | IdentifierType[]; MetadataURL?: MetadataURLType | MetadataURLType[]; DataURL?: DataURLType | DataURLType[]; FeatureListURL?: FeatureListURLType | FeatureListURLType[]; Style?: StyleType | StyleType[]; MinScaleDenominator?: number; MaxScaleDenominator?: number; Layer?: HsWmsLayer | HsWmsLayer[]; queryable?: boolean; cascaded?: number; opaque?: boolean; noSubsets?: boolean; fixedWidth?: number; fixedHeight?: number; }; /** * Reference: OpenGIS® Web Map Server Implementation Specification. Version: 1.3.0. OGC® 06-042. */ interface WMSGetCapabilitiesResponse { Service: { Name: 'WMS'; Title: TitleType; Abstract?: AbstractType; KeywordList?: KeywordListType; OnlineResource: OnlineResourceType; ContactInformation?: ContactInformationType; Fees?: string; AccessConstraints?: string; LayerLimit?: number; MaxWidth?: number; MaxHeight?: number; }; Capability: { Request: { GetCapabilities: OperationTypeType; GetMap: OperationTypeType; GetFeatureInfo?: OperationTypeType; [_ExtendedOperation: string]: OperationTypeType; }; Exception: { Format: FormatType | FormatType[]; }; [_ExtendedCapabilities: string]: unknown; Layer?: HsWmsLayer; }; /** * capitalized version invalid by definition, but probably used in some services */ Version: string; version: string; updateSequence?: string; } type UpsertLayerObject = { title?: string; name?: string; crs?: string; workspace?: string; access_rights?: AccessRightsModel; style?: string; }; type AboutLayman = { about: { applications: { layman: { version: string; releaseTimestamp: string; }; laymanTestClient: { version: string; }; }; data: { layman: { lastSchemaMigration: string; lastDataMigration: string; }; }; }; }; type StatusData = { success?: boolean; overWriteNeeded?: boolean; resultCode?: string; error?: any; status?: boolean; /** * Whether it is possible for current user to edit composition with * existing name */ canEditExistingComposition?: boolean; }; /** * Object describing endpoint, layer and arrays * for each of the methods: update, del, insert containing the features to be processed */ type WfsSyncParams = { /** Array of features to add */ add: Feature[]; /** Array of features to update */ upd: Feature[]; /** Array of features to delete */ del: Feature[]; /** OpenLayers layer which has to have a title attribute */ layer: Vector>; }; type AsyncUpload = { async?: boolean; filesToAsyncUpload?: File[]; }; type DatasetType = 'url' | 'catalogue' | 'file' | 'OWS'; type UrlDataObject = { add_all?: boolean; add_under?: Layer; base?: boolean; /** * Used with WMS to control whether each checked layer should be added as a separate layer * or only one layer grouping all the checked */ group?: boolean; bbox?: string; caps?: any; description?: string; exceptions?: { Format: string | Array; }; extent?: any; folder_name?: string; get_map_url?: string; image_format?: string; image_formats?: Array; layers?: Array; map_projection?: string; output_format?: string; output_formats?: Array; queryable?: boolean; query_format?: string; query_formats?: Array; resample_warning?: boolean; services?: Array; /** * Control for ArcGIS table UI */ serviceExpanded?: boolean; srs?: string; srss?: Array; tile_size?: number; title?: string; use_resampling?: boolean; useTiles?: boolean; version?: string; visible?: boolean; table: { trackBy: string; nameProperty: string; }; /** * WMTS */ info_format?: string; /** * XYZ Tiles */ apiKey?: string; useApiKey?: boolean; apiKeyParam?: string; minZoom?: number; maxZoom?: number; }; declare const SERVICES_SUPPORTED_BY_URL: readonly ["wms", "wfs", "wmts", "kml", "gpx", "geojson", "arcgis", "geosparql", "xyz"]; type AddDataUrlType = (typeof SERVICES_SUPPORTED_BY_URL)[number]; type LayerOptions = { extent?: string[]; layerName?: string; title?: string; abstract?: string; path?: string; showInLayerManager?: false; removable?: boolean; fromComposition?: boolean; greyscale?: boolean; cluster?: boolean; style?: string; sld?: string; qml?: string; subLayers?: string; crs?: string; opacity?: number; queryable?: boolean; workspace?: string; /** * Normally used to determine if layer is a group of sublayers or single layers. * Set to false when loading layer after an upload to parse correct layer name */ group?: boolean; useTiles?: boolean; base?: boolean; imageFormat?: string; queryFormat?: string; tileSize?: any; info_format?: string; attribution?: string[]; url?: string; projection?: string; ratio?: string; singleTile?: boolean; metadata?: any; legends?: string[]; params?: { LAYERS: string; INFO_FORMAT: string; FORMAT: string; VERSION: string; STYLES: string; }; maxResolution?: number; minResolution?: number; dimensions?: any; className?: string; matrixSet?: string; format?: string; }; type WhatToAddDescriptorBase = { dsType?: string; layer?: any; link?: any; name?: any; title?: string; abstract?: string; projection?: any; extractStyles?: any; editable?: boolean; workspace?: string; style?: string; styleType?: 'sld' | 'qml'; recordType?: string; extent?: number[]; }; /** * Generic type that extends the base type with a type property, where the type of type can be specified as needed * eg. WhatToAddDescriptor or WhatToAddDescriptor. Using just WhatToAddDescriptor both are valid */ type WhatToAddDescriptor = WhatToAddDescriptorBase & { type: TypeType; }; type LayerConnection = { owrCache?: boolean; getOnly?: boolean; layerOptions?: LayerOptions; /** * Specific connection options used when adding layers from Layman or from compositions * Basically to set properties of DATA object of the corresponding type service * NOTE: We can populate this with params that are normally (via catalogue or URL) not used or set by user. */ connectOptions?: Partial & { /*** * Optional parameter which prevents default layer creation via getCapabilities * and uses layman layer descriptor instead */ laymanLayer?: WhatToAddDescriptor; }; }; type OwsType = { type?: AddDataUrlType; uri?: string; layer?: OwsType['type'] extends 'arcgis' ? string | string[] : string; }; type OwsConnection = IntersectWithTooltip & LayerConnection>; type AddLayersRecursivelyOptions = { checkedOnly?: boolean; /** * Whether to go through full depth of layer tree or to stop on first queryable. * For now utilized for WMS only. */ shallow?: boolean; layerOptions?: LayerOptions; }; type Service = { name: string; checked: boolean; type?: string; }; interface HsUrlTypeServiceModel { data: UrlDataObject; setDataToDefault(): void; listLayerFromCapabilities(wrapper: CapabilitiesResponseWrapper, layerOptions?: LayerOptions): Promise[]>; getLayers(checkedOnly?: boolean, shallow?: boolean, layerOptions?: LayerOptions): Layer[] | Promise[]>; addLayers(layers: Layer[]): void; getLayer(layer: any, options: LayerOptions): Layer | Promise>; getLayersRecursively?(layer: any, options: AddLayersRecursivelyOptions, collection: Layer[]): void; expandService?(service: Service): void; addServices?(services: Service[]): any; isImageService?(): boolean; zoomToLayers?(): void; collapseServices?(): void; /** * Side effect to be triggered on a layer being checked */ tableLayerChecked?($event: MouseEvent, layer: any): void; /** * Groups actions that take place after getLayers for WMS and WFS layers * Separate from getLayers to provide for Layman layers */ finalizeLayerRetrieval?(collection: Layer[], layerOptions?: LayerOptions): void; } type ArcGISRestResponseLayer = { defaultVisibility?: boolean; geometryType: string; id: number; maxScale: number; minScale: number; name: string; parentLayerId: number; subLayerIds: number[]; type: string; }; type ArcGISRestResponseLayerExtent = { spatialReference?: any; xmin: number; ymin: number; xmax: number; ymax: number; }; type FileDescriptor = { name: string; type: string; content: ArrayBuffer | string; }; /** * @param allowedStyles - Allowed file formats (SLD, QML or both) */ type FileFormData = { abstract: string; access_rights: AccessRightsModel; files: FileDescriptor[]; name: string; serializedStyle: FileDescriptor; allowedStyles?: 'qml' | 'sld' | 'sldqml'; srs: string; title: string; timeRegex?: string; }; type Optional = { [P in keyof T]?: T[P]; }; type FileFormDataObject = Optional; type FileDataExtension = { addUnder?: Layer; extract_styles?: boolean; folder_name?: string; loadAsType?: 'wms' | 'wfs'; saveAvailable?: boolean; saveToLayman?: boolean; type?: string; }; type FileDataObject = IntersectWithTooltip & FileDataExtension>; declare enum OverwriteResponse { cancel = "cancel", add = "add", overwrite = "overwrite" } type VectorDataObject = { abstract?: string; access_rights?: AccessRightsModel; addUnder?: Layer; base64url?: string; extract_styles?: boolean; featureCount?: number; features?: Array; geomProperty?: string; idProperty?: string; nativeFeatures?: Array; folder_name?: string; name?: string; query?: string; saveAvailable?: boolean; saveToLayman?: boolean; showDetails?: boolean; sourceLayer?: Vector>; srs?: string; nativeSRS?: string; serializedStyle?: string | { content: string; }; title?: string; type?: string; url?: string; vectorLayers?: HsLayerDescriptor[]; allowedStyles?: 'qml' | 'sld' | 'sldqml'; }; type HsVectorLayerOptions = { opacity?: number; visible?: boolean; path?: string; fromComposition?: boolean; geomAttribute?: string; idAttribute?: string; style?: string | Style | Array