import Map from 'ol/Map.js'; import StateManager from '../../../tools/state/statemanager.js'; import { Size } from 'ol/size.js'; /** * Independent manager to display a mask layer adapted to the print. * Listen to print events to auto setup. */ declare class PrintMaskManager { private readonly stateManager; private readonly printMaskLayer; private readonly map; private readonly eventsCallbacks; private possibleScales; scaleManuallySelected: boolean; constructor(map: Map, stateManager: StateManager); private get state(); destroy(): void; setManuallySelectedScale(value: boolean): void; /** * Sets the possible scales to fit the mask/view to. */ setPossibleScales(scales: number[]): void; /** * Sets the resolution of the map view to the optimal resolution for a given scale. */ zoomToScale(scale: number): void; /** * Register the events for printing pageSize and mask visibility changes. */ private registerEvents; /** * Sets the print.scale value. * Calculate the optimal scale for printing based on the map's current frame state and the possible scales. * @returns the optimal scale. * @private */ private getScaleFn; /** * Display the mask or hide it. * @private */ private onPrintMaskVisibleChanged; /** * Update the size (width, height), in pixels of the mask. * @private */ private onPrintFormatChanged; /** * Render the mask layer again. * @private */ private renderMask; /** * Calculates the optimal scale for printing a map based on the map size, resolution, desired print size, and available map scales. * @param mapSize - The size of the map in meters. Expressed as an array [width, height]. * @param mapResolution - The resolution of the map in meters per pixel. * @param printMapSize - The desired size of the printed map in inches. Expressed as an array [width, height]. * @param mapScales - The available map scales. * @returns The optimal scale for printing the map or -1 if any. */ static getOptimalScale(mapSize: Size, mapResolution: number, printMapSize: number[], mapScales: number[]): number; /** * Calculates the optimal resolution for printing a map based on the provided parameters. * @param mapSize - The size of the map in meters. * @param printMapSize - The size of the map to be printed in dots. * @param scale - The scale at which the map should be printed. * @returns The optimal resolution for printing the map. */ static getOptimalResolution: (mapSize: Size, printMapSize: number[], scale: number) => number; } export default PrintMaskManager;