import { Image } from '@allmaps/iiif-parser'; import { RTree } from './RTree.js'; import { WarpedMap } from './WarpedMap.js'; import { Ring, Bbox, Point } from '@allmaps/types'; import { Projection } from '@allmaps/project'; import { GetWarpedMapOptions, ProjectionOptions, SelectionOptions, AnimationOptions, WarpedMapListOptions, AnimationInternalOptions, WebGL2WarpedMapOptions } from '../shared/types.js'; export declare const DEFAULT_ANIMATION_OPTIONS: AnimationOptions; export declare const DEFAULT_ANIMATION_INTERNAL_OPTIONS: AnimationInternalOptions; /** * An ordered list of WarpedMaps. This class contains an optional RTree * for quickly looking up maps using their Bbox * @template W - The type of WarpedMap objects in this list */ export declare class WarpedMapList extends EventTarget { #private; /** * Maps in this list, indexed by their ID */ DEFAULT_WARPED_MAP_LIST_OPTIONS: WarpedMapListOptions; warpedMapsById: Map; zIndices: Map; imagesById: Map; geoMaskRTree?: RTree; geoFullMaskRTree?: RTree; projectedGeoMaskRTree?: RTree; projectedGeoFullMaskRTree?: RTree; options: WarpedMapListOptions; /** * Creates an instance of a WarpedMapList * * @constructor * @param warpedMapFactory - Factory function for creating WarpedMap objects * @param options - Options of this list, which will be set on newly added maps as their list options */ constructor(options?: Partial>); /** * Adds a georeferenced map to this list * * @param georeferencedMap - Georeferenced Map * @param mapOptions - Map options * @returns Map ID of the map that was added */ addGeoreferencedMap(georeferencedMap: unknown, mapOptions?: Partial>): string; addGeoreferencedMaps(georeferencedMaps: unknown, mapOptions?: Partial>): (string | Error)[]; /** * Removes a georeferenced map from this list * * @param georeferencedMap * @returns Map ID of the removed map, or an error */ removeGeoreferencedMap(georeferencedMap: unknown): string; removeGeoreferencedMaps(georeferencedMaps: unknown): (string | Error)[]; /** * Removes a georeferenced map from the list by its ID * * @param mapId - Map ID * @returns Map ID of the removed map, or an error */ removeGeoreferencedMapById(mapId: string): string; /** * Parses an annotation and adds its georeferenced map to this list * * @param annotation - Annotation * @param mapOptions - Map options * @returns Map IDs of the maps that were added, or an error per map */ addGeoreferenceAnnotation(annotation: unknown, mapOptions?: Partial>): (string | Error)[]; /** * Parses an annotation and removes its georeferenced map from this list * * @param annotation * @returns Map IDs of the maps that were removed, or an error per map */ removeGeoreferenceAnnotation(annotation: unknown): (string | Error)[]; /** * Update the maps in the list using the warpedMapFactory * * This function is used when creating a WarpedMapList from scratch * and later including it in a specific renderer (e.g. a WebGL2Renderer) * which has a specific warpedMapFactory (e.g. including the WebGL context) * which could not be applied in the initial WarpedMapList. * This function recreates the WarpedMaps using the factory. * * It is import to do this after the event listeners on the warpedmaplist * are added to the renderer, so the WARPEDMAPADDED event is passed. */ updateWarpedMapsUsingFactory(): this; /** * Adds image informations, parses them to images and adds them to the image cache * * @param imageInfos - Image informations * @returns Image IDs of the image informations that were added */ addImageInfos(imageInfos: unknown[]): string[]; /** * Get mapIds for selected maps * * The options allow a.o. to: * - filter for visible maps * - filter for specific mapIds * - filter for maps that overlap with a given point. Use geoPoint or projectedGeoPoint. Optionally specify projection for projectedGeoPoint. Optionally specify whether mask should be applied when computing overlap using applyMask. * - filter for maps whose bbox overlap with the specified bbox. Use geoBbox or projectedGeoBbox. Optionally specify projection for projectedGeoBbox. Optionally specify whether mask should be applied when computing overlap using applyMask. * * @param partialOptions - Selection, mask and projection options, defaults to all visible maps, applied mask and current projection * @returns mapIds */ getMapIds(partialOptions?: Partial): string[]; /** * Get the WarpedMap instances for selected maps * * The options allow a.o. to: * - filter for visible maps * - filter for specific mapIds * - filter for maps that overlap with a given point. Use geoPoint or projectedGeoPoint. Optionally specify projection for projectedGeoPoint. Optionally specify whether mask should be applied when computing overlap using applyMask. * - filter for maps whose bbox overlap with the specified bbox. Use geoBbox or projectedGeoBbox. Optionally specify projection for projectedGeoBbox. Optionally specify whether mask should be applied when computing overlap using applyMask. * * @param partialOptions - Selection, mask and projection options, defaults to all visible maps, applied mask and current projection * @returns WarpedMap instances */ getWarpedMaps(partialOptions?: Partial): Array; /** * Get the WarpedMap instance for a map * * @param mapId - Map ID of the requested WarpedMap instance * @returns WarpedMap instance, or undefined */ getWarpedMap(mapId: string): W | undefined; /** * Get the center of the bounding box of the maps in this list * * The result is returned in lon-lat `EPSG:4326` by default. * * @param options - Selection, mask and projection options, defaults to all visible maps, applied mask and current projection * @returns The center of the bbox of all selected maps, in the chosen projection, or undefined if there were no maps matching the selection. */ getMapsCenter(options?: Partial): Point | undefined; /** * Get the bounding box of the maps in this list * * The result is returned in lon-lat `EPSG:4326` by default. * * @param options - Selection, mask and projection options, defaults to all visible maps, applied mask and current projection * @returns The bbox of all selected maps, in the chosen projection, or undefined if there were no maps matching the selection. */ getMapsBbox(options?: Partial): Bbox | undefined; /** * Get the convex hull of the maps in this list * * The result is returned in lon-lat `EPSG:4326` by default. * * @param options - Selection, mask and projection options, defaults to all visible maps, applied mask and current projection * @returns The convex hull of all selected maps, in the chosen projection, or undefined if there were no maps matching the selection. */ getMapsConvexHull(options?: Partial): Ring | undefined; /** * Get the z-index of a map * * @param mapId - Map ID for which to get the z-index */ getMapZIndex(mapId: string): number | undefined; /** * Get the default options of the list */ getDefaultOptions(): WarpedMapListOptions & 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 options of this list */ getOptions(): Partial>; /** * Get the options of this list */ getListOptions(): 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 * * Note: Map-specific options set here will be passed to newly added maps. * * @param listOptions - List Options */ setOptions(listOptions?: Partial>): void; /** * Set the options of this list * * Note: Map-specific options set here will be passed to newly added maps. * * @param listOptions - List Options * @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; /** * Change the z-index of the specified maps to bring them to front * * @param mapIds - Map IDs */ bringMapsToFront(mapIds: Iterable): void; /** * Change the z-index of the specified maps to send them to back * * @param mapIds - Map IDs */ sendMapsToBack(mapIds: Iterable): void; /** * Change the z-index of the specified maps to bring them forward * * @param mapIds - Map IDs */ bringMapsForward(mapIds: Iterable): void; /** * Change the zIndex of the specified maps to send them backward * * @param mapIds - Map IDs */ sendMapsBackward(mapIds: Iterable): void; /** * Order mapIds * * Use this as anonymous sort function in Array.prototype.sort() */ orderMapIdsByZIndex(mapId0: string, mapId1: string): number; clear(): void; destroy(): void; static projectPointIfNeeded(projectionFrom: Projection, projectionTo: Projection, point: Point): Point; static projectPointsIfNeeded(projectionFrom: Projection, projectionTo: Projection, points: Point[]): Point[]; static projectBboxIfNeeded(projectionFrom: Projection, projectionTo: Projection, bbox: Bbox): Bbox; }