@allmaps/render
Version:
Render functions for WebGL and image buffers
256 lines (254 loc) • 9.88 kB
TypeScript
import { RTree } from './RTree.js';
import { WarpedMap } from './WarpedMap.js';
import { ProjectionOptions, SelectionOptions, WarpedMapFactory, WarpedMapListOptions } from '../shared/types.js';
import { DistortionMeasure, TransformationType } from '@allmaps/transform';
import { Projection } from '@allmaps/project';
import { Ring, Bbox, Gcp, Point, ImageInformations } from '@allmaps/types';
/**
* 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<W extends WarpedMap> extends EventTarget {
warpedMapFactory: WarpedMapFactory<W>;
/**
* Maps in this list, indexed by their ID
*/
warpedMapsById: Map<string, W>;
zIndices: Map<string, number>;
rtree?: RTree;
partialWarpedMapListOptions: Partial<WarpedMapListOptions>;
/**
* Creates an instance of a WarpedMapList
*
* @constructor
* @param warpedMapFactory - Factory function for creating WarpedMap objects
* @param partialWarpedMapListOptions - Options
*/
constructor(warpedMapFactory: WarpedMapFactory<W>, partialWarpedMapListOptions?: Partial<WarpedMapListOptions>);
/**
* Get mapIds for selected maps
*
* Also allows to only select maps whose geoBbox overlaps with the specified geoBbox
*
* @param partialSelectionOptions - Selection options (e.g. mapIds), defaults to all visible maps
* @returns mapIds
*/
getMapIds(partialSelectionOptions?: Partial<SelectionOptions>): Iterable<string>;
/**
* Get the WarpedMap instances for selected maps
*
* Also allows to only select maps whose geoBbox overlaps with the specified geoBbox
*
* @param partialSelectionOptions - Selection options (e.g. mapIds), defaults to all visible maps
* @returns WarpedMap instances
*/
getWarpedMaps(partialSelectionOptions?: Partial<SelectionOptions>): Iterable<W>;
/**
* Get the WarpedMap instance for a specific map
*
* @param mapId - Map ID of the requested WarpedMap instance
* @returns WarpedMap instance, or undefined
*/
getWarpedMap(mapId: string): W | undefined;
/**
* Get the z-index for a specific map
*
* @param mapId
* @returns
*/
getMapZIndex(mapId: string): number | undefined;
/**
* Get the center of the bounding box of the maps in this list
*
* Use {projection: 'EPSG:4326'} to request the result in lon-lat `EPSG:4326`
*
* @param partialSelectionAndProjectionOptions - Selection (e.g. mapIds) and projection options, defaults to all visible maps 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(partialSelectionAndProjectionOptions?: Partial<SelectionOptions & ProjectionOptions>): Point | undefined;
/**
* Get the bounding box of the maps in this list
*
* Use {projection: 'EPSG:4326'} to request the result in lon-lat `EPSG:4326`
*
* @param partialSelectionAndProjectionOptions - Selection (e.g. mapIds) and projection options, defaults to all visible maps 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(partialSelectionAndProjectionOptions?: Partial<SelectionOptions & ProjectionOptions>): Bbox | undefined;
/**
* Get the convex hull of the maps in this list
*
* Use {projection: 'EPSG:4326'} to request the result in lon-lat `EPSG:4326`
*
* @param partialSelectionAndProjectionOptions - Selection (e.g. mapIds) and projection options, defaults to all visible maps 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(partialSelectionAndProjectionOptions?: Partial<SelectionOptions & ProjectionOptions>): Ring | undefined;
/**
* Set the Warped Map List options
*
* @param partialWarpedMapListOptions - Options
*/
setOptions(partialWarpedMapListOptions?: Partial<WarpedMapListOptions>): void;
/**
* Sets the object that caches image information
*
* @param imageInformations - object that caches image information
*/
setImageInformations(imageInformations: ImageInformations): void;
/**
* Sets the GCPs for a specific map
*
* @param gcps - new GCPs
* @param mapId - ID of the map
*/
setMapGcps(gcps: Gcp[], mapId: string): void;
/**
* Sets the resource mask for a specific map
*
* @param resourceMask - the new resource mask
* @param mapId - ID of the map
*/
setMapResourceMask(resourceMask: Ring, mapId: string): void;
/**
* Sets the transformation type for a specific map
*
* @param transformationType - the new transformation type
* @param mapId - the ID of the map
*/
setMapTransformationType(transformationType: TransformationType, mapId: string): void;
/**
* Sets the transformation type for selected maps
*
* @param transformationType - the new transformation type
* @param partialSelectionOptions - Selection options (e.g. mapIds), defaults to all visible maps
*/
setMapsTransformationType(transformationType: TransformationType, partialSelectionOptions?: Partial<SelectionOptions>): void;
/**
* Sets the distortionMeasure for a specific map
*
* @param distortionMeasure - the distortion measure
* @param mapId - the ID of the map
*/
setMapDistortionMeasure(distortionMeasure: DistortionMeasure | undefined, mapId: string): void;
/**
* Sets the distortion measure for selected maps
*
* @param distortionMeasure - the distortion measure
* @param partialSelectionOptions - Selection options (e.g. mapIds), defaults to all visible maps
*/
setMapsDistortionMeasure(distortionMeasure?: DistortionMeasure, partialSelectionOptions?: Partial<SelectionOptions>): void;
/**
* Sets the internal projection for a specific map
*
* @param projection - the internal projection
* @param mapId - the ID of the map
*/
setMapInternalProjection(projection: Projection, mapId: string): void;
/**
* Sets the internal projection for selected maps
*
* @param projection - the internal projection
* @param partialSelectionOptions - Selection options (e.g. mapIds), defaults to all visible maps
*/
setMapsInternalProjection(projection: Projection | undefined, partialSelectionOptions?: Partial<SelectionOptions>): void;
/**
* Sets the projection for a specific map
*
* @param projection - the projection
* @param mapId - the ID of the map
*/
setMapProjection(projection: Projection, mapId: string): void;
/**
* Sets the projection for selected maps
*
* @param projection - the projection
* @param partialSelectionOptions - Selection options (e.g. mapIds), defaults to all visible maps
*/
setMapsProjection(projection: Projection | undefined, partialSelectionOptions?: Partial<SelectionOptions>): void;
/**
* Removes a warped map by its ID
*
* @param mapId - the ID of the map
*
* @param mapIds - Map IDs
*/
removeGeoreferencedMapById(mapId: string): void;
/**
* Changes the z-index of the specified maps to bring them to front
*
* @param mapIds - Map IDs
*/
bringMapsToFront(mapIds: Iterable<string>): void;
/**
* Changes the z-index of the specified maps to send them to back
*
* @param mapIds - Map IDs
*/
sendMapsToBack(mapIds: Iterable<string>): void;
/**
* Changes the z-index of the specified maps to bring them forward
*
* @param mapIds - Map IDs
*/
bringMapsForward(mapIds: Iterable<string>): void;
/**
* Changes the zIndex of the specified maps to send them backward
*
* @param mapIds - Map IDs
*/
sendMapsBackward(mapIds: Iterable<string>): void;
/**
* Changes the visibility of the specified maps to `true`
*
* @param mapIds - Map IDs
*/
showMaps(mapIds: Iterable<string>): void;
/**
* Changes the visibility of the specified maps to `false`
*
* @param mapIds - Map IDs
*/
hideMaps(mapIds: Iterable<string>): void;
/**
* Adds a georeferenced map to this list
*
* @param georeferencedMap
* @returns
*/
addGeoreferencedMap(georeferencedMap: unknown): Promise<string | Error>;
/**
* Removes a georeferenced map from this list
*
* @param georeferencedMap
* @returns
*/
removeGeoreferencedMap(georeferencedMap: unknown): Promise<string | Error>;
/**
* Parses an annotation and adds its georeferenced map to this list
*
* @param annotation
* @returns
*/
addGeoreferenceAnnotation(annotation: unknown): Promise<(string | Error)[]>;
/**
* Parses an annotation and removes its georeferenced map from this list
*
* @param annotation
* @returns
*/
removeGeoreferenceAnnotation(annotation: unknown): Promise<(string | Error)[]>;
clear(): void;
destroy(): void;
private addGeoreferencedMapInternal;
private removeGeoreferencedMapInternal;
private getOrComputeMapId;
private getProjectedGeoMaskPoints;
private addToOrUpdateRtree;
private removeFromRtree;
private removeZIndexHoles;
private imageInfoLoaded;
private addEventListenersToWarpedMap;
private removeEventListenersFromWarpedMap;
}