import { TileCache } from '../tilecache/TileCache.js'; import { WarpedMapList } from '../maps/WarpedMapList.js'; import { FetchableTile } from '../tilecache/FetchableTile.js'; import { Size, Tile } from '@allmaps/types'; import { Viewport } from '../viewport/Viewport.js'; import { WarpedMap } from '../maps/WarpedMap.js'; import { CacheableTileFactory, BaseRenderOptions, GetWarpedMapOptions, AnimationOptions, SpecificBaseRenderOptions, Sprite, WarpedMapListOptions, WebGL2WarpedMapOptions } from '../shared/types.js'; /** * Abstract base class for renderers */ export declare abstract class BaseRenderer extends EventTarget { #private; DEFAULT_SPECIFIC_BASE_RENDER_OPTIONS: SpecificBaseRenderOptions; warpedMapList: WarpedMapList; tileCache: TileCache; spritesTileCache: TileCache; mapsInList: Set; mapsInPreviousViewport: Set; mapsInViewport: Set; mapsWithFetchableTilesForPreviousViewport: Set; mapsWithFetchableTilesForViewport: Set; mapsWithRequestedTilesForViewport: Set; protected viewport: Viewport | undefined; options: BaseRenderOptions; constructor(cacheableTileFactory: CacheableTileFactory, options?: Partial>); /** * Parses an annotation and adds its georeferenced map to this renderer's warped map list * * @param annotation - Annotation * @param mapOptions - Map options */ addGeoreferenceAnnotation(annotation: unknown, mapOptions?: Partial>): (string | Error)[]; /** * Adds a georeferenced map to this renderer's warped map list * * @param georeferencedMap - Georeferenced Map * @param mapOptions - Map options */ addGeoreferencedMap(georeferencedMap: unknown, mapOptions?: Partial>): string; addSprites(sprites: Sprite[], imageUrl: string, imageSize: Size): Promise; /** * Get the default options of the renderer and list */ getDefaultOptions(): BaseRenderOptions & GetWarpedMapOptions; /** * Get the default options of a map * * These come from the default option settings for WebGL2WarpedMaps and the map's georeferenced map proporties * * @param mapId - Map ID for which the options apply */ getMapDefaultOptions(mapId: string): GetWarpedMapOptions | undefined; /** * Get the render and list options */ getOptions(): Partial>; /** * Get the map-specific options of a map * * @param mapId - Map ID for which the options apply */ getMapMapOptions(mapId: string): Partial> | undefined; /** * Get the options of a map * * These options are the result of merging the default, georeferenced map, * layer and map-specific options of that map. * * @param mapId - Map ID for which the options apply */ getMapOptions(mapId: string): GetWarpedMapOptions | undefined; /** * Set the options * * @param options - Options to set */ setOptions(options?: Partial>): void; /** * Set the list options * * @param listOptions - List options to set * @param animationOptions - Animation options */ setListOptions(listOptions?: Partial>, animationOptions?: Partial): void; /** * Set the map-specific options of the specified maps * * Useful when map-specific options are changed for multiple maps at once, * but only one animation should be fired. * * @param mapIds - Map IDs of the maps whose options to set * @param mapsOptions - Map-specific options to apply to each of those maps * @param animationOptions - Animation options */ setMapsOptions(mapIds: string[], mapsOptions?: Partial, animationOptions?: Partial): void; /** * Set the map-specific options of all maps using a per-map callback * * Useful when map-specific options are changed for multiple maps at once * (with possibly different options for different maps), but only one animation should be fired. * * The callback receives each map's ID and returns the options to apply, * or `undefined` to leave that map unchanged. * * @param mapsOptionsCallbackFn - Callback returning the options to apply for a given map * @param animationOptions - Animation options */ setMapsOptions(mapsOptionsCallbackFn: (mapId: string) => Partial | undefined, animationOptions?: Partial): void; setMapsOptions(firstArgument: string[] | ((mapId: string) => Partial | undefined), secondArgument?: Partial | Partial, thirdArgument?: Partial): void; /** * Set the map-specific options of the specified maps, and the list options * * Useful when map-specific options are changed for multiple maps at once, * together with the list options, but only one animation should be fired. * * @param mapIds - IDs of the maps whose options to set * @param mapsOptions - Map-specific options to apply to each of those maps * @param listOptions - List options to apply * @param animationOptions - Animation options */ setMapsAndListOptions(mapIds: string[], mapsOptions?: Partial, listOptions?: Partial>, animationOptions?: Partial): void; /** * Set the map-specific options of all maps using a per-map callback, and the list options * * Useful when map-specific options are changed for multiple maps at once (with possibly different options for different maps), * together with the list options, but only one animation should be fired. * * The callback receives each map's ID and returns the options to apply, * or `undefined` to leave that map unchanged. * * @param mapsOptionsCallbackFn - Callback returning the options to apply for a given map * @param listOptions - List options to apply * @param animationOptions - Animation options */ setMapsAndListOptions(mapsOptionsCallbackFn: (mapId: string) => Partial | undefined, listOptions?: Partial>, animationOptions?: Partial): void; setMapsAndListOptions(mapIds: string[], mapsOptions?: Partial, listOptions?: Partial>, animationOptions?: Partial): void; setMapsAndListOptions(mapsOptionsCallbackFn: (mapId: string) => Partial | undefined, listOptions?: Partial>, animationOptions?: Partial): void; setMapsAndListOptions(firstArgument: string[] | ((mapId: string) => Partial | undefined), secondArgument?: Partial | Partial>, thirdArgument?: Partial> | Partial, fourthArgument?: Partial): void; /** * Reset the list options * * Undefined option keys reset all options * * @param listOptionKeys - Keys of the list options to reset * @param animationOptions - Animation options */ resetListOptions(listOptionKeys?: string[], animationOptions?: Partial): void; /** * Reset the map-specific options of the specified maps * * Omitting `mapsOptionKeys` resets all options; passing an empty array resets none. * * @param mapIds - IDs of the maps whose options to reset * @param mapsOptionKeys - Keys of the options to reset * @param animationOptions - Animation options */ resetMapsOptions(mapIds: string[], mapsOptionKeys?: Array, animationOptions?: Partial): void; /** * Reset the map-specific options of all maps using a per-map callback * * The callback receives each map's ID and returns the keys to reset for that map. * Returning `undefined` from the callback resets all options for that map, returning an empty array resets none. * * @param mapsOptionKeysCallbackFn - Callback returning the option keys to reset for a given map * @param animationOptions - Animation options */ resetMapsOptions(mapsOptionKeysCallbackFn: (mapId: string) => Array | undefined, animationOptions?: Partial): void; resetMapsOptions(firstArgument?: string[] | ((mapId: string) => Array | undefined), secondArgument?: Array | Partial, thirdArgument?: Partial): void; /** * Reset the map-specific options of the specified maps, and the list options * * Omitting `mapsOptionKeys` or `listOptionKeys` resets all options for that scope; * passing an empty array resets none. * * @param mapIds - IDs of the maps whose options to reset * @param mapsOptionKeys - Keys of the map-specific options to reset * @param listOptionKeys - Keys of the list options to reset * @param animationOptions - Animation options */ resetMapsAndListOptions(mapIds: string[], mapsOptionKeys?: Array, listOptionKeys?: Array, animationOptions?: Partial): void; /** * Reset the map-specific options of all maps using a per-map callback, and the list options * * The callback receives each map's ID and returns the keys to reset for that map. * Returning `undefined` from the callback resets all options for that map, returning an empty array resets none. * Omitting `listOptionKeys` resets all list options. * * @param mapsOptionKeysCallbackFn - Callback returning the option keys to reset for a given map * @param listOptionKeys - Keys of the list options to reset * @param animationOptions - Animation options */ resetMapsAndListOptions(mapsOptionKeysCallbackFn: (mapId: string) => Array | undefined, listOptionKeys?: Array, animationOptions?: Partial): void; resetMapsAndListOptions(firstArgument?: string[] | ((mapId: string) => Array | undefined), secondArgument?: Array, thirdArgument?: Array | Partial, fourthArgument?: Partial): void; protected loadMissingImagesInViewport(): Promise[]; protected someImagesInViewport(): boolean; protected shouldRequestFetchableTiles(): boolean; protected assureProjection(): void; protected requestFetchableTiles(): void; protected findMapsInViewport(viewportBufferRatio?: number): Set; protected findMapsToAnticipate(): Set; protected getMapFetchableTilesForViewport(mapId: string, mapsInViewportForRequest: Set): FetchableTile[]; protected getMapOverviewFetchableTilesForViewport(mapId: string, totalFetchableTilesForViewportResolution: number, mapsInViewportForOverviewRequest: Set, spriteFetchabelTiles: FetchableTile[]): FetchableTile[]; protected updateMapsForViewport(allFechableTilesForViewport: FetchableTile[]): { mapsWithFetchableTilesForViewportEntering: string[]; mapsWithFetchableTilesForViewportLeaving: string[]; mapsInViewportEntering: string[]; mapsInViewportLeaving: string[]; }; protected mapsInViewportsToEnteringAndLeaving(mapsForPreviousViewport: string[], mapsForViewport: string[]): { mapsForViewportEntering: string[]; mapsForViewportLeaving: string[]; }; protected pruneTileCache(mapsInViewportForOverviewPrune: Set): void; protected filterOutTilesCloseToSpriteTiles(tiles: Tile[], warpedMap: WarpedMap): Tile[]; destroy(): void; protected clearMap(mapId: string): void; protected mapTileLoaded(event: Event): void; protected mapTileDeleted(event: Event): void; protected imageLoaded(event: Event): void; protected warpedMapAdded(event: Event): void; protected warpedMapRemoved(event: Event): void; protected prepareChange(event: Event): void; protected immediateChange(event: Event): void; protected animatedChange(event: Event): void; protected addEventListeners(): void; protected removeEventListeners(): void; }