import L from '@edgepdf/core'; import type { TileConfig, ImageInfo } from '@edgepdf/types'; /** * TileLayerManager - Manages Leaflet tile layer for displaying image tiles * * This class handles: * - XYZ tile URL template processing * - Tile layer creation and configuration * - Bounds calculation for seamless tile rendering * - Tile grid sizing and management * * @example * ```typescript * const manager = new TileLayerManager({ * tileUrl: '/tiles/{z}/{x}/{y}.webp', * imageInfo: { * width: 2000, * height: 3000, * tileSize: 256, * maxZoom: 5, * minZoom: 0 * } * }); * * const tileLayer = manager.createTileLayer(); * tileLayer.addTo(map); * ``` */ export declare class TileLayerManager { private config; private tileLayer; /** * Creates a new TileLayerManager instance * * @param config - Tile configuration with URL template and image info * * @throws {Error} If config is invalid or tile URL template is malformed */ constructor(config: TileConfig); /** * Creates and configures a Leaflet tile layer * * @param map - Optional Leaflet map instance (for event handling) * @returns Configured Leaflet tile layer * * @throws {Error} If tile layer creation fails */ createTileLayer(map?: L.Map): L.TileLayer; /** * Calculates tile bounds in CRS coordinate space for the tile layer. * * Must match the map's maxBounds (from CoordinateMapper.calculateMapBounds()). * Using image pixel dimensions here would cause Leaflet to request tiles far * outside the valid grid, generating hundreds of spurious 404 requests. * * - Legacy (minZoom=0): canvasSize = tileSize * 2 (e.g. 512) → [[0,0],[512,512]] * - Standard (minZoom≥1): canvasSize = tileSize (e.g. 256) → [[0,0],[256,256]] * * @returns Leaflet bounds for the tile layer in CRS coordinate space */ calculateTileBounds(): L.LatLngBoundsExpression; /** * Calculates tile grid dimensions for a specific zoom level * * @param zoom - Zoom level to calculate grid for * @returns Object with tileX and tileY counts */ calculateGridSize(zoom: number): { tileX: number; tileY: number; }; /** * Generates a tile URL for specific coordinates * * @param z - Zoom level * @param x - Tile X coordinate * @param y - Tile Y coordinate * @returns Complete tile URL */ getTileUrl(z: number, x: number, y: number): string; /** * Gets the current tile layer instance * * @returns The tile layer, or null if not created */ getTileLayer(): L.TileLayer | null; /** * Removes the tile layer from the map and cleans up * * @param map - Optional map instance to remove layer from */ removeTileLayer(map?: L.Map): void; /** * Sets up event listeners for tile loading events * * @param map - Leaflet map instance */ private setupEventListeners; /** * Gets the image info configuration * * @returns Image info object */ getImageInfo(): ImageInfo; /** * Gets the tile configuration * * @returns Tile configuration object */ getConfig(): TileConfig; } //# sourceMappingURL=tile-layer-manager.d.ts.map