import { SafeHtml, SafeResourceUrl } from '@angular/platform-browser';
import { Layer, Vector } from 'ol/layer';
import { Source, Vector as Vector$1 } from 'ol/source';
import * as i0 from '@angular/core';
import { OnInit } from '@angular/core';
import * as ol_renderer_Layer from 'ol/renderer/Layer';
import { Feature, Map } from 'ol';
import { HsLayerSelectorService } from 'hslayers-ng/services/layer-manager';
import { HsStylerService } from 'hslayers-ng/services/styler';
import BaseLayer from 'ol/layer/Base';
import { HsLanguageService } from 'hslayers-ng/services/language';
import { HsMapService } from 'hslayers-ng/services/map';
import * as i7 from 'hslayers-ng/common/panels';
import { HsPanelBaseComponent } from 'hslayers-ng/common/panels';
import { HsQueuesService } from 'hslayers-ng/services/queues';
import * as i5 from '@angular/common';
import * as i6 from '@angular/forms';
import * as i8 from 'hslayers-ng/common/pipes';
import * as i9 from '@ngx-translate/core';
type HsCustomLegendCategory = {
/**
* Unique category name
*/
name: string;
/**
* rgb(a) or hex encoded color string
* (mutually exclusive with path)
*/
color?: string;
/**
* Path to an icon
* (mutually exclusive with color)
*/
path?: string;
/**
* Optional height of the icon in pixels
*/
height?: number;
};
interface HsLegendDescriptor {
autoLegend?: boolean;
lyr: Layer;
title: string;
type: string;
subLayerLegends?: Array;
visible: boolean;
svg?: SafeHtml;
}
type LayerLegend = {
lastLegendImage?: any;
legendType?: 'image' | 'svg';
svgContent?: SafeHtml;
legendImage?: SafeResourceUrl;
};
declare class HsLegendLayerStaticComponent implements OnInit {
private hsLegendLayerStaticService;
layer: HsLegendDescriptor;
layerLegend: LayerLegend;
ngOnInit(): void;
static ɵfac: i0.ɵɵFactoryDeclaration;
static ɵcmp: i0.ɵɵComponentDeclaration;
}
declare class HsLegendLayerStaticService {
private sanitizer;
fillContent(lyr: Layer): LayerLegend;
static ɵfac: i0.ɵɵFactoryDeclaration;
static ɵprov: i0.ɵɵInjectableDeclaration;
}
declare class HsLegendLayerVectorComponent {
svg: string;
constructor();
static ɵfac: i0.ɵɵFactoryDeclaration;
static ɵcmp: i0.ɵɵComponentDeclaration;
}
declare class HsLegendService {
hsStylerService: HsStylerService;
hsLayerSelectorService: HsLayerSelectorService;
private hsLog;
private sanitizer;
private hsProxyService;
constructor();
/**
* Test if layer is visible and has supported type (conditions for displaying legend)
* @param layer - Layer to test
* @returns Return if legend might exist for layer and layer is visible
*/
legendValid(layer: HsLegendDescriptor): boolean;
/**
* Get legend graphics for a vector layer based on sld attribute. If no SLD exists, try to generate it from OL style.
* @param currentLayer - Layer of interest
* @returns Image as SVG string
*/
getVectorLayerLegendSvg(currentLayer: Vector>): Promise;
private fixOpacity;
/**
* Generate url for GetLegendGraphic request of WMS service for selected layer
* @param source - Source of wms layer
* @param layer_name - Name of layer for which legend is requested
* @param layer - Layer to get legend for
* @returns Url of the legend graphics
*/
getLegendUrl(source: Source, layer_name: string, layer: Layer): string;
setSvg(layer: Layer): Promise;
/**
* Generate SVG linear gradient for layers colormap
*/
generateInterpolatedLayerLegend(layer: Layer): {
autoLegend: boolean;
title: string;
lyr: Layer>;
type: string;
visible: boolean;
svg: SafeHtml;
};
/**
* (PRIVATE) Generate url for GetLegendGraphic request of WMS service for selected layer
* @param layer - OpenLayers layer
* @returns Description of layer to be used for creating the legend. It contains type of layer, sublayer legends, title, visibility etc.
*/
getLayerLegendDescriptor(layer: Layer): Promise;
static ɵfac: i0.ɵɵFactoryDeclaration;
static ɵprov: i0.ɵɵInjectableDeclaration;
}
declare class HsLegendLayerComponent implements OnInit {
hsLegendService: HsLegendService;
hsStylerService: HsStylerService;
layer: HsLegendDescriptor;
legendCategories: HsCustomLegendCategory[];
hasLegendCategories: i0.WritableSignal;
/**
* default icon height in pixels
* @default 32
*/
defaultIconHeight: number;
constructor();
ngOnInit(): void;
static ɵfac: i0.ɵɵFactoryDeclaration;
static ɵcmp: i0.ɵɵComponentDeclaration;
}
declare class HsLegendComponent extends HsPanelBaseComponent implements OnInit {
hsLegendService: HsLegendService;
hsMapService: HsMapService;
hsQueuesService: HsQueuesService;
hsLanguageService: HsLanguageService;
layerDescriptors: any[];
titleSearch: string;
name: string;
ngOnInit(): void;
/**
* Add selected layer to the list of layers in legend (with event listener
* to display/hide legend item when layer visibility change)
* @param layer - Layer to add legend for
*/
addLayerToLegends(layer: Layer): Promise;
rebuildLegends(): void;
legendFilter: (item: any) => boolean;
/**
* Check if there is any visible layer
* @returns Returns true if no layers with legend exist
*/
noLayerExists(): boolean;
/**
* Remove selected layer from legend items
* @param layer - Layer to remove from legend
*/
removeLayerFromLegends(layer: BaseLayer): void;
buildLegendsForLayers(map: Map): void;
/**
* (PRIVATE) Callback function for adding layer to map, add layers legend
* @param e - Event object, should have element property
*/
layerAdded(e: any): void;
/**
* @param e - event description
*/
layerVisibilityChanged(e: any): void;
/**
* @param e - event description
*/
layerSourcePropChanged(e: any): void;
/**
* Finds layer descriptor for OpenLayers layer
* @param layer - OpenLayers layer
* @returns Object describing the legend
*/
findLayerDescriptor(layer: Layer): HsLegendDescriptor;
findLayerDescriptorBySource(source: Source): any;
refreshList(): void;
static ɵfac: i0.ɵɵFactoryDeclaration;
static ɵcmp: i0.ɵɵComponentDeclaration;
}
declare class HsLegendModule {
static ɵfac: i0.ɵɵFactoryDeclaration;
static ɵmod: i0.ɵɵNgModuleDeclaration;
static ɵinj: i0.ɵɵInjectorDeclaration;
}
export { HsLegendComponent, HsLegendLayerComponent, HsLegendLayerStaticComponent, HsLegendLayerStaticService, HsLegendLayerVectorComponent, HsLegendModule, HsLegendService };
export type { HsCustomLegendCategory, HsLegendDescriptor, LayerLegend };