import { GeoreferencedMap } from '@allmaps/annotation'; import { Image } from '@allmaps/iiif-parser'; import { ProjectedGcpTransformer, ProjectedGcpTransformerOptions, Projection } from '@allmaps/project'; import { Gcp, Point, Ring, Rectangle, Bbox, TileZoomLevel, Size } from '@allmaps/types'; import { TransformationType, DistortionMeasure } from '@allmaps/transform'; import { AnimationOptions, AnimationInternalOptions, WarpedMapFactory, WarpedMapListOptions, WarpedMapOptions, ShouldRenderOptions, WarpedMapWithoutGeoreferencedMapOptions } from '../shared/types.js'; import { Viewport } from '../viewport/Viewport.js'; import { FetchableTile } from '../tilecache/FetchableTile.js'; export declare const UNDEFINED_GEOREFERENCED_MAP_OPTIONS: { transformationType: undefined; internalProjection: undefined; }; export declare const DEFAULT_WARPED_MAP_OPTIONS: WarpedMapOptions; export declare function createWarpedMapFactory(): WarpedMapFactory; /** * Class for warped maps. * This class describes how a georeferenced map is warped using a specific transformation. * * @param mapId - ID of the map * @param georeferencedMap - Georeferenced map used to construct the WarpedMap * @param defaultOptions - Default options * @param georeferencedMapOptions - Options from georeferenced map * @param listOptions - Options from warped map list * @param mapOptions - Options specific to this map * @param options - Result of merging default, georeferenced map, list and specific map options * @param fetchingImageInfo - Whether the image information is loading * @param image - Parsed IIIF image * @param tileSize - Size of the tiles * @param mixed - Whether the options were last set by mixing previous and new properties, i.e. when rerendering during an ongoing animation * @param visible - Visibility of the map * @param previousVisible - Previous visible * @param visibilityOpacity - Opacity linked to visibility of the map * @param previousVisibilityOpacity - Opacity linked to previous visibility of the map * @param applyMask - Apply the mask * @param previousApplyMask - Previous applyMask * @param applyMaskOpacity - Opacity for the triangles outside the mask, linked to appling of the mask * @param previousApplyMaskOpacity - Opacity for the triangles outside the mask, linked to previous appling of the mask * @param gcps - Ground control points used for warping this map, from resource coordinates to geospatial coordinates * @param projectedGcps - Projected ground control points, from resource coordinates to projected geospatial coordinates * @param resourcePoints - The resource coordinates of the ground control points * @param geoPoints - The geospatial coordinates of the ground control points * @param projectedGeoPoints - The projected geospatial coordinates of the projected ground control points * @param projectedGeoTransformedResourcePoints - The resource coordinates of the ground control points, transformed to projected geospatial coordinates using the projected transformer * @param projectedGeoPreviousTransformedResourcePoints - The projectedGeoTransformedResourcePoints of the previous transformation type, used during transformation transitions * @param resourceFullMask - Resource full mask (describing the entire extent of the image) * @param resourceFullMaskBbox - Bbox of the resource full mask * @param resourceFullMaskRectangle - Rectangle of the resource full mask bbox * @param resourceAppliedMask - Resource applied mask. In case 'applyMask' is true, this is the resourceMask. In case 'applyMask' is false, this is the resourceFullMask. * @param resourceAppliedMaskBbox - Bbox of the resourceAppliedMask * @param resourceAppliedMaskRectangle - Rectangle of the resourceAppliedMaskBbox * @param resourceMask - Resource mask * @param resourceMaskBbox - Bbox of the resourceMask * @param resourceMaskRectangle - Rectangle of the resourceMaskBbox * @param transformationType - Transformation type used in the transfomer. This is loaded from the georeference annotation. * @param previousTransformationType - Previous transformation type * @param internalProjection - Internal projection used in the projected transformer * @param previousInternalProjection - Previous internal projection * @param projection - Projection of the projected geospatial coordinates space * @param projectedTransformer - Transformer used for warping this map from resource coordinates to projected geospatial coordinates * @param projectedPreviousTransformer - Previous transformer used for warping this map from resource coordinates to projected geospatial coordinates * @param geoFullMask - resourceMask in geospatial coordinates * @param geoFullMaskBbox - Bbox of the geoFullMask * @param geoFullMaskRectangle - resourceFullMaskRectangle in geospatial coordinates * @param geoMask - resourceMask in geospatial coordinates * @param geoMaskBbox - Bbox of the geoMask * @param geoMaskRectangle - resourceMaskRectangle in geospatial coordinates * @param geoAppliedMask - resourceAppliedMask in geospatial coordinates * @param geoAppliedMaskBbox - Bbox of the geoFullMask * @param geoAppliedMaskRectangle - resourceAppliedMaskRectangle in geospatial coordinates * @param projectedGeoFullMask - resourceFullMask in projected geospatial coordinates * @param projectedGeoFullMaskBbox - Bbox of the projectedGeoFullMask * @param projectedGeoFullMaskRectangle - resourceFullMaskRectangle in projected geospatial coordinates * @param projectedGeoMask - resourceMask in projected geospatial coordinates * @param projectedGeoMaskBbox - Bbox of the projectedGeoMask * @param projectedGeoMaskRectangle - resourceMaskRectanglee in projected geospatial coordinates * @param projectedGeoAppliedMask - resourceAppliedMask in projected geospatial coordinates * @param projectedGeoAppliedMaskBbox - Bbox of the projectedGeoAppliedMask * @param projectedGeoAppliedMaskRectangle - resourceAppliedMaskRectangle in projected geospatial coordinates * @param resourceToProjectedGeoScale - Scale of the warped map, in resource pixels per projected geospatial coordinates * @param distortionMeasure - Distortion measure displayed for this map * @param previousDistortionMeasure - Previous distortion measure displayed for this map * @param tileZoomLevelForViewport - The tile zoom level, for the current viewport * @param overviewTileZoomLevelForViewport - The overview tile zoom level, for the current viewport * @param projectedGeoBufferedViewportRectangleForViewport - The (buffered) viewport in projected geospatial coordinates, for the current viewport * @param projectedGeoBufferedViewportRectangleBboxForViewport - Bbox of the projectedGeoBufferedViewportRectangle * @param resourceBufferedViewportRingForViewport - The (buffered) viewport transformed back to resource coordinates, for the current viewport * @param resourceBufferedViewportRingBboxForViewport - Bbox of the resourceViewportRing * @param resourceBufferedViewportRingBboxAndResourceMaskBboxIntersectionForViewport - The intersection of the bbox of the (buffered) viewport transformed back to resource coordinates and the bbox of the resource mask, for the current viewport * @param fetchableTilesForViewport - The fetchable tiles for displaying this map, for the current viewport * @param overviewFetchableTilesForViewport - The overview fetchable tiles, for the current viewport */ export declare class WarpedMap extends EventTarget { mapId: string; georeferencedMap: GeoreferencedMap; defaultOptions: WarpedMapOptions; georeferencedMapOptions: Partial; listOptions: Partial>; mapOptions: Partial; options: WarpedMapOptions; fetchingImageInfo: boolean; image?: Image; tileSize?: Size; protected abortController?: AbortController; mixed: boolean; visible: boolean; previousVisible: boolean; visibilityOpacity: number; previousVisibilityOpacity: number; applyMask: boolean; previousApplyMask: boolean; applyMaskOpacity: number; previousApplyMaskOpacity: number; gcps: Gcp[]; projectedGcps: Gcp[]; resourcePoints: Point[]; geoPoints: Point[]; projectedGeoPoints: Point[]; projectedGeoTransformedResourcePoints: Point[]; projectedGeoPreviousTransformedResourcePoints: Point[]; resourceFullMask: Ring; resourceFullMaskBbox: Bbox; resourceFullMaskRectangle: Rectangle; resourceMask: Ring; resourceMaskBbox: Bbox; resourceMaskRectangle: Rectangle; resourceAppliedMask: Ring; resourceAppliedMaskBbox: Bbox; resourceAppliedMaskRectangle: Rectangle; transformationType: TransformationType; previousTransformationType: TransformationType; internalProjection: Projection; previousInternalProjection: Projection; projection: Projection; projectedTransformer: ProjectedGcpTransformer; projectedPreviousTransformer: ProjectedGcpTransformer; protected projectedTransformerCache: Map; protected projectedTransformerDoubleCache: Map>; geoFullMask: Ring; geoFullMaskBbox: Bbox; geoFullMaskRectangle: Rectangle; geoMask: Ring; geoMaskBbox: Bbox; geoMaskRectangle: Rectangle; geoAppliedMask: Ring; geoAppliedMaskBbox: Bbox; geoAppliedMaskRectangle: Rectangle; projectedGeoFullMask: Ring; projectedGeoFullMaskBbox: Bbox; projectedGeoFullMaskRectangle: Rectangle; projectedGeoMask: Ring; projectedGeoMaskBbox: Bbox; projectedGeoMaskRectangle: Rectangle; projectedGeoAppliedMask: Ring; projectedGeoAppliedMaskBbox: Bbox; projectedGeoAppliedMaskRectangle: Rectangle; resourceToProjectedGeoScale: number; distortionMeasure?: DistortionMeasure; previousDistortionMeasure?: DistortionMeasure; tileZoomLevelForViewport?: TileZoomLevel; overviewTileZoomLevelForViewport?: TileZoomLevel; projectedGeoBufferedViewportRectangleForViewport?: Rectangle; projectedGeoBufferedViewportRectangleBboxForViewport?: Bbox; resourceBufferedViewportRingForViewport?: Ring; resourceBufferedViewportRingBboxForViewport?: Bbox; resourceBufferedViewportRingBboxAndResourceMaskBboxIntersectionForViewport?: Bbox; fetchableTilesForViewport: FetchableTile[]; overviewFetchableTilesForViewport: FetchableTile[]; /** * Creates an instance of WarpedMap. * * @param mapId - ID of the map * @param georeferencedMap - Georeferenced map used to construct the WarpedMap * @param options - options */ constructor(mapId: string, georeferencedMap: GeoreferencedMap, listOptions?: Partial>, mapOptions?: Partial); /** * Get default options */ static getDefaultOptions(): WarpedMapOptions; /** * Get default options without the options overwritten by the georeferenced map */ static getDefaultWithoutGeoreferencedMapOptions(): WarpedMapWithoutGeoreferencedMapOptions; /** * Get the resource applied mask, mask or full mask, based on an input option. */ getResourceAppliedMask(applyMask?: boolean): Ring; /** * Get the geo applied mask, mask or full mask, based on an input option. */ getGeoAppliedMask(applyMask?: boolean): Ring; /** * Get the projected geo applied mask, mask or full mask, based on an input option. */ getProjectedGeoAppliedMask(applyMask?: boolean): Ring; /** * Get default and georeferenced map options */ getDefaultAndGeoreferencedMapOptions(): WarpedMapOptions; /** * Get scale of the warped map, in resource pixels per viewport pixels. * * @param viewport - the current viewport * @returns */ getResourceToViewportScale(viewport: Viewport): number; /** * Get scale of the warped map, in resource pixels per canvas pixels. * * @param viewport - the current viewport * @returns */ getResourceToCanvasScale(viewport: Viewport): number; /** * Get the reference scaling from the forward transformation of the projected Helmert transformer * * @returns */ getReferenceScale(): number; /** * Get a projected transformer of the given transformation type. * * Uses cashed projected transformers by transformation type, * and only computes a new projected transformer if none found. * * Returns a projected transformer in the current projection, * even if the cached transformer was computed in a different projection. * * Default settings apply for the options. * * @params transformationType - the transformation type * @params partialProjectedGcpTransformerOptions - options * @returns A projected transformer */ getProjectedTransformer(transformationType?: TransformationType, partialProjectedGcpTransformerOptions?: Partial): ProjectedGcpTransformer; /** * Set the defaultOptions */ setDefaultOptions(): void; /** * Set the list options * * @param listOptions - list options * @param animationOptions - Animation options */ setListOptions(listOptions?: Partial, animationOptions?: Partial): object; /** * Set the map-specific options * * @param mapOptions - Map-specific options * @param animationOptions - Animation options */ setMapOptions(mapOptions?: Partial, animationOptions?: Partial): object; /** * Set the map-specific options, and the list options * * @param mapOptions - Map-specific options * @param listOptions - list options * @param animationOptions - Animation options */ setMapAndListOptions(mapOptions?: Partial, listOptions?: Partial, animationOptions?: Partial): object; protected applyOptions(animationOptions?: Partial): object; shouldRenderMap(_partialOptions?: Partial): boolean; shouldRenderLines(): boolean; shouldRenderPoints(): boolean; /** * Update the ground control points loaded from a georeferenced map to new ground control points. * * @param gcps */ protected setGcps(gcps: Gcp[]): void; /** * Update the resource mask loaded from a georeferenced map to a new mask. * * @param resourceMask */ protected setResourceMask(): void; /** * Set the transformationType * * @param transformationType */ protected setTransformationType(transformationType: TransformationType): void; /** * Set the distortionMeasure * * @param distortionMeasure - the disortion measure */ protected setDistortionMeasure(distortionMeasure?: DistortionMeasure): void; /** * Set the internal projection * * @param projection - the internal projection */ protected setInternalProjection(projection?: Projection): void; /** * Set the projection * * @param projection - the projection */ protected setProjection(projection?: Projection): void; /** * Set the tile zoom level for the current viewport * * @param tileZoomLevel - tile zoom level for the current viewport */ setTileZoomLevelForViewport(tileZoomLevel?: TileZoomLevel): void; /** * Set the overview tile zoom level for the current viewport * * @param tileZoomLevel - tile zoom level for the current viewport */ setOverviewTileZoomLevelForViewport(tileZoomLevel?: TileZoomLevel): void; /** * Set projectedGeoBufferedViewportRectangle for the current viewport * * @param projectedGeoBufferedViewportRectangle */ setProjectedGeoBufferedViewportRectangleForViewport(projectedGeoBufferedViewportRectangle?: Rectangle): void; /** * Set resourceBufferedViewportRing for the current viewport * * @param resourceBufferedViewportRing */ setResourceBufferedViewportRingForViewport(resourceBufferedViewportRing?: Ring): void; /** * Set resourceBufferedViewportRingBboxAndResourceAppliedMaskBboxIntersection for the current viewport * * @param resourceBufferedViewportRingBboxAndResourceAppliedMaskBboxIntersection */ setResourceBufferedViewportRingBboxAndResourceAppliedMaskBboxIntersectionForViewport(resourceBufferedViewportRingBboxAndResourceAppliedMaskBboxIntersection?: Bbox): void; /** * Set tiles for the current viewport * * @param fetchableTiles */ setFetchableTilesForViewport(fetchableTiles: FetchableTile[]): void; /** * Set overview tiles for the current viewport * * @param overviewFetchableTiles */ setOverviewFetchableTilesForViewport(overviewFetchableTiles: FetchableTile[]): void; /** * Reset the properties for the current values */ resetForViewport(): void; /** * Reset previous transform properties to new ones (when completing an animation). */ resetPrevious(): void; /** * Mix previous transform properties with new ones (when changing an ongoing animation). * * @param t - animation progress */ mixPreviousAndNew(t: number): void; /** * Check if this instance has parsed image * * @returns */ hasImage(): this is WarpedMapWithImage; /** * Load the parsed image from cache, or fetch and parse the image info to create it * * @returns */ loadImage(imagesById?: Map): Promise; private updateResourceMaskProperties; private getResourceFullMask; private updateGeoMaskProperties; private updateProjectedGeoMaskProperties; protected updateProjectedTransformerProperties(): void; private updateProjectedTransformer; private updateFullGeoMask; private updateGeoMask; private updateAppliedGeoMask; private updateProjectedFullGeoMask; private updateProjectedGeoMask; private updateProjectedAppliedGeoMask; private updateResourceToProjectedGeoScale; private updateGcpsProperties; protected clearProjectedTransformerCaches(): void; destroy(): void; } /** * Class for warped maps with image ID and parsed IIIF image. */ export declare class WarpedMapWithImage extends WarpedMap { imageId: string; image: Image; tileSize: Size; constructor(mapId: string, georeferencedMap: GeoreferencedMap, options?: Partial); }