import * as geojson from 'geojson'; import * as i0 from '@angular/core'; import { Subscription } from 'rxjs'; import { Feature, Map } from 'ol'; import { GeoJSONFeatureCollection } from 'ol/format/GeoJSON'; import { Geometry } from 'ol/geom'; import { Vector, Layer } from 'ol/layer'; import { Vector as Vector$1, Source } from 'ol/source'; import { MapComposition, CompoData, AccessRightsModel, UpsertLayerObject, AsyncUpload, WfsSyncParams, UserData, CurrentBaseLayer, LayerJSON, SerializedStyle, HslayersLayerJSON } from 'hslayers-ng/types'; import { PostPatchLayerResponse } from 'hslayers-ng/common/layman'; import { Style } from 'ol/style'; interface HsSaverService { save(compositionJson: MapComposition, compoData: CompoData, saveAsNew: boolean): Promise; } declare class HsLaymanService implements HsSaverService { private http; private hsMapService; private hsLogService; private hsToastService; private hsLanguageService; private hsCommonLaymanService; private hsCommonLaymanLayerService; crs: string; totalProgress: number; deleteQuery: Subscription; supportedCRRList: i0.Signal; /** * Update composition's access rights * @param compName - Composition's name * @param endpoint - Endpoint's description * @param access_rights - Composition's new access rights * @returns Promise result of composition's PATCH request */ updateCompositionAccessRights(compName: string, access_rights: AccessRightsModel): Promise; /** * Save composition to Layman's database * @param compositionJson - Json with composition's definition * @param compoData - Additional data for composition * @param saveAsNew - Save as new composition * @returns Promise result of POST */ save(compositionJson: MapComposition, compoData: CompoData, saveAsNew: boolean): Promise; /** * Save composition to Layman's database * @param endpoint - Endpoint's description * @param access_rights - Provided access rights * @returns Access rights object as two strings, one for read access and the other for write access */ parseAccessRightsForLayman(access_rights: AccessRightsModel): { write: string; read: string; }; /** * Save composition to Layman's database * @param endpoint - Endpoint's description * @param workspace - Current Layman's workspace * @param mapName - Map composition's name * @param formdata - FormData object used for sending data over HTTP request * @param saveAsNew - Save as new composition * @param compositionJson - JSON with composition's definition * @returns Promise result of POST/PATCH request */ makeMapPostPatchRequest(workspace: string, mapName: string, formdata: FormData, saveAsNew: boolean, compositionJson?: MapComposition): Promise; /** * Send layer's definition and features to Layman * @param endpoint - Endpoint's description * @param geojson - Geojson's object with features to send to server * @param description - Object containing \{name, title, crs, workspace, access_rights\} of * layer to retrieve * @returns Promise result of POST/PATCH */ makeUpsertLayerRequest(geojson: GeoJSONFeatureCollection, description: UpsertLayerObject): Promise; /** * Try to load layer to Layman's server * @param formData - A set of key/value pairs representing layer fields and values, for HTTP request * @param asyncUpload - Async upload data: Async upload state and files to upload * @param layerName - Existing layer's name * @param overwrite - (Optional) Should overwrite existing layer * @returns Promise result of POST/PATCH */ tryLoadLayer(formData: FormData, asyncUpload: AsyncUpload, layerName: string, overwrite?: boolean): Promise; /** * Prepare files for async upload if needed * @param formData - FormData object for HTTP request * @returns File array for async upload */ prepareAsyncUpload(formData: FormData): AsyncUpload; /** * Saves files for later upload and switches from files to file names in form data * @param formdata - File that will be uploaded * @param files_to_async_upload - File array that will get uploaded asynchronously */ switchFormDataToFileNames(formdata: FormData, files_to_async_upload: File[]): void; /** * Use resumable to chunk upload data larger than PREFER_RESUMABLE_SIZE_LIMIT(2MB) * @param files_to_async_upload - File array that will get uploaded asynchronously * @param data - Layman's response after posting layer */ asyncUpload(files_to_async_upload: File[], data: PostPatchLayerResponse): Promise; /** * Create Layman layer if needed and send all features * @param layer - Layer to get Layman friendly name for * in order to get features * @param withFeatures - Layer state, whether or not it has features */ upsertLayer(layer: Vector>, withFeatures: boolean): Promise; /** * Converts OL Feature objects into a GeoJSON * @param features - Array of OL Features * @param crsSupported - True if current CRS is supported by Layman * @param withFeatures FIXME: What is this good for? * @returns GeoJSON representation of the input features */ getFeatureGeoJSON(features: Feature[], crsSupported: boolean, withFeatures: boolean): geojson.FeatureCollection; /** * Sync WFS features using transaction. Publish layer first if needed * @param param0 - Object describing endpoint, layer and arrays * for each of the methods: update, del, insert containing the features to be processed * @param add - Features being added * @param upd - Features being uploaded * @param del - Features being deleted * @param layer - Layer interacted with * @returns Promise result of POST */ sync({ add, upd, del, layer }: WfsSyncParams): Promise; /** * Get feature type (layer identifiactor) l_ * from changes array (add, upd, or del ) or layer */ private getFeatureType; /** * Make WFS transaction request * @param param0 - Object describing endpoint, layer and arrays * for each of the methods: update, del, insert containing the features to be processed * @param add - Features being added * @param upd - Features being uploaded * @param del - Features being deleted * @param layer - Layer interacted with * @returns Promise result of POST */ private makeWfsRequest; /** * Cache Layman's layer descriptor so it can be used later on * @param layer - Layer interacted with * @param layer - Layman's layer descriptor */ private cacheLaymanDescriptor; /** * Retrieve layer's features from server * @param layer - Layer interacted with * @returns Promise with WFS xml (GML3.1) response * with features for a specified layer */ makeGetLayerRequest(layer: Vector>): Promise; /** * Builds request options for Layman's WFS request */ private buildLayerRequestOptions; /** * Removes selected layer from Layman's database * @param layer - (Optional) Layer to be removed. DELETE all layers when not provided */ removeLayer(layer?: Layer | string): Promise; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } declare class HsSaveMapService { private hsMapService; private hsLogService; private hsShareThumbnailService; private hsCommonLaymanService; private hsProxyService; internalLayers: Layer[]; /** * Create JSON object, which stores information about composition, user, map state and map layers (including layer data) * @param map - Selected OL map object * @param compoData - Composition general metadata * @param userData - Metadata about user, organisation and point of contact * @returns - JSON object with all required map composition's metadata */ map2json(map: Map, compoData: CompoData, userData: UserData): MapComposition; /** * Get currently selected base layer from the OL map * @returns Object with currently selected base layer's title as attribute */ getCurrentBaseLayer(): CurrentBaseLayer; /** * Convert map layers into a JSON object * Uses layer2json(). * @param layers - All map layers * @returns JSON object representing the layers */ layers2json(layers: Layer[]): LayerJSON[]; /** * Convert layer's style object into JSON object, partial function of layer2style * (saves Fill color, Stroke color/width, Image fill, stroke, radius, src and type) * @deprecated Parse style to old custom JSON, should not be used and will be removed. Use SLD or QML instead * @param style - Style to convert * @returns Converted JSON object replacing OL style */ serializeStyle(style: Style | Style[]): SerializedStyle; /** * Convert map layer into a JSON object (only for ol.layer.Layer) * Layer properties covered: (CLASS_NAME), name, url, params, * group, displayInLayerSwitcher, *visibility, *opacity * attribution, transitionEffect, * isBaseLayer, minResolution, * maxResolution, metadata, * abstract, opacity, singleTile, removable, * queryable, legend, projections, * wmsMinScale, wmsMaxScale * * The layer index is not covered, as we assume * that it is corresponding to the layers order. * * @param layer - Map layer that should be converted * @returns JSON object representing the layer */ layer2json(layer: Layer): HslayersLayerJSON; /** * Convert feature array to GeoJSON string * * @param features - Array of features * @returns GeoJSON */ getFeaturesJson(features: Feature[]): GeoJSONFeatureCollection; /** * Create thumbnail of the map view and save it into selected element * @param $element - Selected element * @param newRender - Force new render */ generateThumbnail($element: Element, newRender?: any): void; /** * Save map layers to browsers' local storage */ save2storage(): void; /** * Extract layer ID from FeatureServer URL * @param url - FeatureServer URL (e.g., .../FeatureServer/0/query) * @returns Layer ID number or null if not found */ private extractLayerIdFromUrl; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } declare class HsLayerSynchronizerService { private hsLaymanService; private hsMapService; private hsCommonLaymanService; private hsCommonLaymanLayerService; private hsToastService; private hsLanguageService; private hsLogService; private hsEventBusService; private destroyRef; debounceInterval: number; crs: string; syncedLayers: Vector>[]; constructor(); /** * Reload all the synchronized layers after Layman's authorization change * to true. * Log out should not force the geometry clearnce */ private reloadLayersOnAuthChange; /** * Start synchronizing layer to database * @param layer - Layer to add */ addLayer(layer: Vector>): void; /** * Make 'maxRetryCount' attempts to wait until the layer is available on Layman before returning. * Used for tasks which require layer presence on server */ layerExistsOnLayman(layer: Vector>, maxRetryCount?: number, retryCount?: number, desc?: any): any; /** * Keep track of synchronized vector layers by listening to * VectorSources change events. Initially also get features from server * @param layer - Layer to add */ startMonitoringIfNeeded(layer: Vector>): Promise; /** * Check if the layer is a Layman layer */ isLaymanLayer(layer: Vector>): boolean; /** * Get features from Layman's endpoint service as WFS string, parse them and add * them to OL VectorSource * @param layer - Layer to get Layman friendly name for * @param source - OL VectorSource to store features in */ pull(layer: Vector>, source: Vector$1): Promise; /** * Observe feature changes and execute handler for them * @param f - Feature to observe */ observeFeature(f: Feature): void; /** * Handler for feature change event * @param feature - Feature whose change event was captured */ handleFeatureChange(feature: Feature): void; /** * Handler for feature property change event * @param feature - Feature whose property change event was captured */ handleFeaturePropertyChange(feature: Feature): void; /** * Sync any feature changes inside a layer, that is being stored on Layman's service database * @param add - Features being added * @param upd - Features being uploaded * @param del - Features being deleted * @param layer - Layer interacted with */ sync(add: Feature[], upd: Feature[], del: Feature[], layer: Vector>): void; /** * Display error dialog on synchronization failure * @param error - Error captured */ displaySyncErrorDialog(error: string, layer: Vector>): void; /** * Stop synchronizing layer to database * @param layer - Layer to remove from synched layers list */ removeLayer(layer: Vector>): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } export { HsLayerSynchronizerService, HsLaymanService, HsSaveMapService }; export type { HsSaverService };