import type GroupLayer from '../../../models/layers/grouplayer.js'; import type BaseLayer from '../../../models/layers/baselayer.js'; import type MapManager from '../../../tools/state/mapManager.js'; import type I18nManager from '../../../tools/i18n/i18nmanager.js'; import type State from '../../../tools/state/state.js'; import LayerWms from '../../../models/layers/layerwms.js'; import LayerWmts from '../../../models/layers/layerwmts.js'; /** Represents the options for encoding a legend. */ export interface EncodeLegendOptions { mapManager: MapManager; i18nManager: I18nManager; state: State; scale: number; printResolution: number; dpi: number; pageSize: number[]; extent?: number[]; useExtent?: boolean; label?: Record; params?: Record>; showGroupsTitle?: boolean; } /** Represents a class in the MFP legend. */ export interface MFPLegendClass { name?: string; icons?: string[]; dpi?: number; classes?: MFPLegendClass[]; } /** Represents a LegendURLDPI object. */ export interface LegendURLDPI { url: string; dpi: number; } /** * Class representing an encoder for creating a legend in the MFP (MapFishPrint) format. * Iterates on the layer tree layers to collect layers in the right order and with all metadata. */ export declare class MFPLegendEncoder { protected options?: EncodeLegendOptions; protected defaultOptions: Partial; /** * Sets the options for encoding legend. */ setOptions(options: EncodeLegendOptions): void; /** * Encodes the legend based on the provided options. * @returns The encoded legend or null if no legend classes were found. */ encodeLegend(options: EncodeLegendOptions): MFPLegendClass | null; /** * Encodes the legends of every given base layers (recursively). * @returns The encoded legends as an array of MFPLegendClass objects. */ encodeLayersLegend(layers: BaseLayer[]): MFPLegendClass[]; /** * Encodes the legend classes for a given layer, based on its type or className. * @returns The encoded legend classes for the layer, or null if the layer is not supported. */ encodeLayerLegendClasses(layer: BaseLayer): MFPLegendClass | null; /** * @returns The encoded legend class for the layer group. */ encodeLayerGroupLegendClasses(layerGroup: GroupLayer): MFPLegendClass; /** * @returns The encoded legend classes for a given WMTS * layer, or null if the layer is not visible or inactive. */ encodeLayerWmtsLegendClasses(layerWmts: LayerWmts): MFPLegendClass | null; /** * @returns The encoded legend classes for a WMS * layer, or null if the layer is not visible or inactive. */ encodeLayerWmsLegendClasses(layerWms: LayerWms): MFPLegendClass | null; /** * @returns a MFPLegendClass object representing the legend class for a WMS layer name. */ getLegendClassForWMS(layerName: string, icon_dpi: LegendURLDPI, serverType: string): MFPLegendClass; /** * Retrieves the metadata legend image or hiDPILegendImages for the given layer. * @returns The metadata legend image URL and DPI, or null if not found. */ getMetadataLegendImage(layer: LayerWms | LayerWmts): LegendURLDPI | null; /** * Determines whether the label for a specific server type must be hidden. * @returns True if the label must be hidden, false otherwise. * @protected */ protected mustHideLabel(serverType: string): boolean; /** * Add a classItem to a classes array if the classItem to add is not null. * If the classItem have embedded classes, these classes must have classItem. Otherwise, the given * classItem will be not added. * @protected */ protected addClassItemToArray(classes: MFPLegendClass[], classItem: MFPLegendClass): void; /** * If a Legend item have only one child and the child name is identical to its name, then return * only the children (cut one level). Shrink also if both names are null or undefined. * Otherwise, return the given legend item. * @returns The same legend item or a shrunk one. * @protected */ protected tryToSimplifyLegendGroup(legendGroupItem: MFPLegendClass): MFPLegendClass; }