@allmaps/render
v1.0.0-beta.68
Published
Render functions for WebGL and image buffers
Downloads
384
Readme
@allmaps/render
Allmaps render module. Renders georeferenced IIIF maps using Georeference Annotations. Currently, only rendering to a WebGL 2 context is implemented. This module is used by:
How it works
The render module accomplishes this task with the following classes:
- A
WebGL2RenderingContext
containing the rendering context for the drawing surface of an HTML element. - A
WebGLProgram
for storing the vertex and fragment shader - A
WarpedMapList
containing the list of WarpedMaps to draw - A list of
WebGL2WarpedMap
elements containing the GL information for each warped map - A
TileCache
for storing the image bitmaps of cached tiles
This package also contains two other important classes:
- A
Viewport
describes which view of the map should be rendered (extent, zoom level, ...) - A
WarpedMap
describes how a georeferenced map is warped using a specific transformation
The renderer draws in its WebGL2RenderingContext when its render
function is called and passed a Viewport (e.g. by a JavaScript mapping library). Then, for each WarpedMap in the WarpedMapList
, the following happens:
- The ground control points (GPCs) are read from the Georeference Annotation. These GCOs are used to compute a transformation from IIIF resource coordinates to projected geospatial coordinates.
- The resource mask is read from the Georeference Annotation, and the area within is divided into small triangles.
- The best tile zoom level is computed for the current viewport, telling us which IIIF tile
scaleFactor
to use. - The Viewport is transformed backwards from projected geospatial coordinates to resource coordinates of the IIIF image. The IIIF tiles covering this viewport on the resource image are fetched and cached in the TileCache.
- The area inside the resource mask is rendered in the viewport, triangle by triangle, using the cached tiles. The location of the triangles is computed using the forward transformation built from the GPCs.
Installation
This package works in browsers and in Node.js as an ESM module.
Install with pnpm:
pnpm install @allmaps/render
You can build this package locally by running:
pnpm run build
Usage
Import the package and its classes:
import { Viewport, WebGL2Renderer } from '@allmaps/render'
For a complete example, see the source code of the Allmaps plugins for Leaflet, MapLibre and OpenLayers.
API
Table of Contents
- constructor
- computeProjectedGeoRectangle
- fromWarpedMapList
- fromProjectedGeoBbox
- constructor
- getViewportMask
- getViewportMaskBbox
- getViewportMaskRectangle
- getViewportFullMask
- getViewportFullMaskBbox
- getViewportFullMaskRectangle
- getResourceToViewportScale
- getResourceToCanvasScale
- getReferenceScale
- setResourceMask
- setTransformationType
- setDistortionMeasure
- setGcps
- setCurrentBestScaleFactor
- setCurrentTileZoomLevel
- setCurrentOverviewTileZoomLevel
- setCurrentResourceViewportRing
- setCurrentFetchableTiles
- setCurrentOverviewFetchableTiles
- resetCurrent
- resetPrevious
- mixPreviousAndNew
- hasImageInfo
- loadImageInfo
- constructor
- setResourceMask
- setCurrentBestScaleFactor
- resetPrevious
- mixPreviousAndNew
- updateTriangulation
- updateProjectedGeoTrianglePoints
- updateTrianglePointsDistortion
- constructor
- updateVertexBuffers
- clearTextures
- addCachedTileAndUpdateTextures
- removeCachedTileAndUpdateTextures
- constructor
- getMapIds
- getWarpedMap
- getMapZIndex
- getBbox
- getProjectedBbox
- getMapsByGeoBbox
- setImageInformations
- setMapResourceMask
- setMapsTransformationType
- setMapsDistortionMeasure
- bringMapsToFront
- sendMapsToBack
- bringMapsForward
- sendMapsBackward
- showMaps
- hideMaps
- addGeoreferencedMap
- removeGeoreferencedMap
- addGeoreferenceAnnotation
- removeGeoreferenceAnnotation
- constructor
- isCachedTile
- abort
- constructor
- fetch
- fetch
- fetch
- fetch
- getCacheableTiles
- getCacheableTile
- getMapCacheableTiles
- getCachedTiles
- getCachedTile
- getMapCachedTiles
- getTileUrls
- getMapTileUrls
- requestFetchableTiles
- allRequestedTilesLoaded
- prune
- addGeoreferenceAnnotation
- addGeoreferencedMap
- constructor
- getOpacity
- setOpacity
- resetOpacity
- getMapOpacity
- setMapOpacity
- resetMapOpacity
- getRemoveColorOptions
- setRemoveColorOptions
- resetRemoveColorOptions
- getMapRemoveColorOptions
- setMapRemoveColorOptions
- resetMapRemoveColorOptions
- getColorizeOptions
- setColorizeOptions
- resetColorizeOptions
- getMapColorizeOptions
- setMapColorizeOptions
- resetMapColorizeOptions
- getGridOptions
- setGridOptions
- resetGridOptions
- getMapGridOptions
- setMapGridOptions
- resetMapGridOptions
- getSaturation
- setSaturation
- resetSaturation
- getMapSaturation
- setMapSaturation
- resetMapSaturation
- render
constructor
Creates a new Viewport
Parameters
e
t
o
i
s
(optional, default1
)viewportSize
Size Size of the viewport in viewport pixels, as [width, height].projectedGeoCenter
Point Center point of the viewport, in projected coordinates.projectedGeoPerViewportScale
number Scale of the viewport, in projection coordinates per viewport pixel.rotation
number Rotation of the viewport with respect to the project coordinate system.devicePixelRatio
number The devicePixelRatio of the viewport. (optional, default1
)
computeProjectedGeoRectangle
Returns a rotated rectangle in projected geo coordinates
Parameters
e
t
o
i
fromWarpedMapList
Static method creates that creates a Viewport from a WarpedMapList
Parameters
e
t
o
i
(optional, default"contain"
)s
(optional, default1
)viewportSize
Size Size of the viewport in viewport pixels, as [width, height].warpedMapList
WarpedMapList<W> A WarpedMapList.devicePixelRatio
number? The devicePixelRatio of the viewport.fit
Fit Whether the viewport should contain or cover the bbox of the warpedMapList. (optional, default'contain'
)
Returns Viewport A new Viewport object
fromProjectedGeoBbox
Static method creates that creates a Viewport from Bbox in projected geospatial coordinates.
Parameters
e
t
o
i
(optional, default"contain"
)viewportSize
Size Size of the viewport in viewport pixels, as [width, height].projectedGeoBbox
WarpedMapList<W> A projectedGeoBbox.devicePixelRatio
number? The devicePixelRatio of the viewport.fit
Fit Whether the viewport should contain or cover the bbox of the warpedMapList. (optional, default'contain'
)
Returns Viewport A new Viewport object
constructor
Creates an instance of WarpedMap.
Parameters
e
r
o
mapId
string ID of the mapgeoreferencedMap
GeoreferencedMap Georeferenced map used to construct the WarpedMapoptions
WarpedMapOptions? options
getViewportMask
Get resourceMask in viewport coordinates
Parameters
e
viewport
Viewport the current viewport
Returns Ring
getViewportMaskBbox
Get Bbox of resourceMask in viewport coordinates
Parameters
e
viewport
Viewport the current viewport
Returns Bbox
getViewportMaskRectangle
Get resourceMaskRectangle in viewport coordinates
Parameters
e
viewport
Viewport the current viewport
Returns Rectangle
getViewportFullMask
Get resourceFullMask in viewport coordinates
Parameters
e
viewport
Viewport the current viewport
Returns Ring
getViewportFullMaskBbox
Get bbox of rresourceFullMask in viewport coordinates
Parameters
e
viewport
Viewport the current viewport
Returns Bbox
getViewportFullMaskRectangle
Get resourceFullMaskRectangle in viewport coordinates
Parameters
e
viewport
Viewport the current viewport
Returns Rectangle
getResourceToViewportScale
Get scale of the warped map, in resource pixels per viewport pixels.
Parameters
e
viewport
Viewport the current viewport
Returns number
getResourceToCanvasScale
Get scale of the warped map, in resource pixels per canvas pixels.
Parameters
e
viewport
Viewport the current viewport
Returns number
getReferenceScale
Get the reference scaling from the forward transformation of the projected Helmert transformer
Returns number
setResourceMask
Update the resourceMask loaded from a georeferenced map to a new mask.
Parameters
e
resourceMask
Ring
setTransformationType
Update the transformationType loaded from a georeferenced map to a new transformation type.
Parameters
e
transformationType
TransformationType
setDistortionMeasure
Set the distortionMeasure
Parameters
e
distortionMeasure
DistortionMeasure? the disortion measure
setGcps
Update the Ground Controle Points loaded from a georeferenced map to new Ground Controle Points.
Parameters
e
gcps
Array<GCP>
setCurrentBestScaleFactor
Set the bestScaleFactor for the current viewport
Parameters
e
scaleFactor
number scale factor
Returns boolean
setCurrentTileZoomLevel
Set the tile zoom level for the current viewport
Parameters
e
tileZoomLevel
number? tile zoom level
setCurrentOverviewTileZoomLevel
Set the overview tile zoom level for the current viewport
Parameters
e
tileZoomLevel
TileZoomLevel? tile zoom level
setCurrentResourceViewportRing
Set resourceViewportRing at current viewport
Parameters
e
resourceViewportRing
Ring?
setCurrentFetchableTiles
Set tiles at current viewport
Parameters
e
fetchableTiles
Array<FetchableTile>
setCurrentOverviewFetchableTiles
Set overview tiles at current viewport
Parameters
e
overviewFetchableTiles
Array<FetchableTile>
resetCurrent
Reset current values
resetPrevious
Reset the previous points and values.
mixPreviousAndNew
Mix the previous and new points and values.
Parameters
e
t
number
hasImageInfo
Check if warpedMap has image info
loadImageInfo
Fetch and parse the image info, and generate the image ID
Returns Promise<void>
constructor
Creates an instance of a TriangulatedWarpedMap.
Parameters
t
e
i
mapId
string ID of the mapgeoreferencedMap
GeoreferencedMap Georeferenced map used to construct the WarpedMapoptions
WarpedMapOptions? Options
setResourceMask
Update the resourceMask.
Parameters
t
resourceMask
Ring
setCurrentBestScaleFactor
Set the bestScaleFactor for the current viewport
Parameters
t
scaleFactor
number scale factor
Returns boolean
resetPrevious
Reset the previous points and values.
mixPreviousAndNew
Mix the previous and new points and values.
Parameters
t
number
updateTriangulation
Update the triangulation of the resourceMask, at the current bestScaleFactor. Use cache if available.
Parameters
t
(optional, default!1
)previousIsNew
boolean? whether the previous and new triangulation are the same - true by default, false during a transformation transition
updateProjectedGeoTrianglePoints
Update the (previous and new) points of the triangulated resourceMask, at the current bestScaleFactor, in projectedGeo coordinates. Use cache if available.
Parameters
t
(optional, default!1
)previousIsNew
boolean (optional, defaultfalse
)
updateTrianglePointsDistortion
Update the (previous and new) distortion at the points of the triangulated resourceMask. Use cache if available.
Parameters
t
(optional, default!1
)previousIsNew
boolean (optional, defaultfalse
)
constructor
Creates an instance of WebGL2WarpedMap.
Parameters
e
r
n
l
T
i
o
mapId
string ID of the mapgeoreferencedMap
GeoreferencedMap Georeferenced map used to construct the WarpedMapgl
WebGL2RenderingContext WebGL rendering contextmapsProgram
WebGLProgram WebGL programoptions
Partial<WarpedMapOptions> WarpedMapOptions
updateVertexBuffers
Update the vertex buffers of this warped map
Parameters
e
projectedGeoToClipTransform
Transform Transform from projected geo coordinates to webgl2 coordinates in the [-1, 1] range. Equivalent to OpenLayers' projectionTransform.
clearTextures
Clear textures for this map
addCachedTileAndUpdateTextures
Add cached tile to the textures of this map and update textures
Parameters
e
cachedTile
CachedTile
removeCachedTileAndUpdateTextures
Remove cached tile from the textures of this map and update textures
Parameters
e
tileUrl
string
constructor
Creates an instance of a WarpedMapList.
Parameters
e
t
warpedMapFactory
WarpedMapFactory<W>? Factory function for creating WarpedMap objectsoptions
WarpedMapListOptions? Options
getMapIds
Returns mapIds for the maps in this list.
Returns Iterable<string>
getWarpedMap
Returns the WarpedMap object in this list of map specified by its ID.
Parameters
e
mapId
string
Returns (W | undefined)
getMapZIndex
Returns the z-index of a map.
Parameters
e
mapId
string
getBbox
Return the bounding box of all visible maps in this list, in longitude/latitude coordinates
Returns (Bbox | undefined)
getProjectedBbox
Return the bounding box of all visible maps in this list, in projected coordinates
Returns (Bbox | undefined)
getMapsByGeoBbox
Returns mapIds of the maps whose geoBbox overlaps with the specified geoBbox.
Parameters
e
geoBbox
Bbox
Returns Iterable<string>
setImageInformations
Sets the object that caches image information
Parameters
e
imageInformations
ImageInformations object that caches image information
setMapResourceMask
Sets the resource mask for a specified map
Parameters
e
t
mapId
string ID of the mapresourceMask
Ring the new resource mask
setMapsTransformationType
Sets the transformation type of specified maps
Parameters
e
t
mapIds
Iterable<string> the IDs of the mapstransformationType
TransformationType the new transformation type
setMapsDistortionMeasure
Sets the distortion measure of specified maps
Parameters
e
t
mapIds
Iterable<string> the IDs of the mapsdistortionMeasure
DistortionMeasure? the distortion measure
bringMapsToFront
Changes the z-index of the specified maps to bring them to front
Parameters
e
mapIds
Iterable<string>
sendMapsToBack
Changes the z-index of the specified maps to send them to back
Parameters
e
mapIds
Iterable<string>
bringMapsForward
Changes the z-index of the specified maps to bring them forward
Parameters
e
mapIds
Iterable<string>
sendMapsBackward
Changes the zIndex of the specified maps to send them backward
Parameters
e
mapIds
Iterable<string>
showMaps
Changes the visibility of the specified maps to true
Parameters
e
mapIds
Iterable<string>
hideMaps
Changes the visibility of the specified maps to false
Parameters
e
mapIds
Iterable<string>
addGeoreferencedMap
Adds a georeferenced map to this list
Parameters
e
georeferencedMap
unknown
Returns Promise<(string | Error)>
removeGeoreferencedMap
Removes a georeferenced map from this list
Parameters
e
georeferencedMap
unknown
Returns Promise<(string | Error)>
addGeoreferenceAnnotation
Parses an annotation and adds its georeferenced map to this list
Parameters
e
annotation
unknown
Returns Promise<Array<(string | Error)>>
removeGeoreferenceAnnotation
Parses an annotation and removes its georeferenced map from this list
Parameters
e
annotation
unknown
Returns Promise<Array<(string | Error)>>
constructor
Creates an instance of CacheableTile.
Parameters
t
e
fetchableTile
FetchableTilefetchFn
FetchFn? Optional fetch function to use
isCachedTile
Whether a tile has fetched its data
Returns boolean
abort
Abort the fetch
constructor
Creates an instance of FetchableTile.
Parameters
e
t
tile
Tile the tilewarpedMap
WarpedMapWithImageInfo A WarpedMap with fetched image information
fetch
Fetch the tile and create its ImageBitMap.
Returns Promise<void>
fetch
Fetch the tile and create its ImageData object.
Returns Promise<void>
fetch
Fetch the tile and create its IntArray data using the supplied getImageData function.
Returns Promise<void>
fetch
Fetch the tile and create its ImageBitmap using a WebWorker.
Returns Promise<void>
getCacheableTiles
Get the tiles in this cache
Returns IterableIterator<CacheableTile>
getCacheableTile
Get a specific tile in this cache
Parameters
e
tileUrl
string the URL of the requested tile
Returns (CacheableTile | undefined)
getMapCacheableTiles
Get the tiles in this cache, corresponding to a specific map
Parameters
e
mapId
string ID of the map
Returns Array<CacheableTile>
getCachedTiles
Get the tiles in this cache that have been fetched
Returns Array<CacheableTile>
getCachedTile
Get a specific cached tile in this cache that has been fetched
Parameters
e
tileUrl
string the URL of the requested tile
Returns (CachedTile | undefined)
getMapCachedTiles
Get the tiles in this cache, corresponding to a specific map, that have been fetched
Parameters
e
mapId
string ID of the map
Returns Array<CachedTile>
getTileUrls
Get the URLs of tiles in this cache
Returns IterableIterator<string>
getMapTileUrls
Get the URLs of tiles in this cache, corresponding to a specific map
Parameters
e
mapId
string ID of the map
Returns IterableIterator<string>
requestFetchableTiles
Process the request for new tiles to be added to this cache
Parameters
e
fetchableTiles
Array<FetchableTile>
allRequestedTilesLoaded
Returns a promise that resolves when all requested tiles are loaded. This could happen immidiately, in case there are no current requests and the tilesFetchingCount is zero, or in a while, when the count reaches zero and the ALLREQUESTEDTILESLOADED event is fired.
Returns Promise<void>
prune
Prune tiles in this cache using the provided prune info
Parameters
e
addGeoreferenceAnnotation
Parses an annotation and adds its georeferenced map to this renderer's warped map list
Parameters
e
annotation
unknown
Returns Promise<Array<(string | Error)>>
addGeoreferencedMap
Adds a georeferenced map to this renderer's warped map list
Parameters
e
georeferencedMap
unknown
Returns Promise<(string | Error)>
constructor
Creates an instance of WebGL2Renderer.
Parameters
t
e
gl
WebGL2RenderingContext WebGL 2 rendering contextoptions
WebGL2RendererOptions options
getOpacity
Get the opacity of the renderer
setOpacity
Set the opacity of the renderer
Parameters
t
opacity
number opacity to set
resetOpacity
Reset the opacity of the renderer
getMapOpacity
Get the opacity of a map
Parameters
t
mapId
string ID of the map
setMapOpacity
Set the opacity of a map
Parameters
resetMapOpacity
Rreset the opacity of a map
Parameters
t
mapId
string ID of the map
getRemoveColorOptions
Get the remove color options of the renderer
Returns (Partial<RemoveColorOptions> | undefined)
setRemoveColorOptions
Set the remove color options of the renderer
Parameters
t
removeColorOptions
RemoveColorOptions
resetRemoveColorOptions
Reset the remove color options of the renderer
getMapRemoveColorOptions
Get the remove color options of a map
Parameters
t
mapId
string ID of the map
Returns (Partial<RemoveColorOptions> | undefined)
setMapRemoveColorOptions
Set the remove color options of a map
Parameters
t
e
mapId
string ID of the mapremoveColorOptions
RemoveColorOptions the 'remove color options' to set
resetMapRemoveColorOptions
Reset the remove color options of a map
Parameters
t
mapId
string ID of the map
getColorizeOptions
Get the colorize options of the renderer
Returns (Partial<ColorizeOptions> | undefined)
setColorizeOptions
Set the colorize options of the renderer
Parameters
t
colorizeOptions
ColorizeOptions the colorize options to set
resetColorizeOptions
Reset the colorize options of the renderer
getMapColorizeOptions
Get the colorize options of a map
Parameters
t
mapId
string ID of the map
Returns (Partial<ColorizeOptions> | undefined)
setMapColorizeOptions
Set the colorize options of a map
Parameters
t
e
mapId
string ID of the mapcolorizeOptions
ColorizeOptions the colorize options to set
resetMapColorizeOptions
Reset the colorize options of a map
Parameters
t
mapId
string ID of the map
getGridOptions
Get the grid options of the renderer
Returns (Partial<GridOptions> | undefined)
setGridOptions
Set the grid options of the renderer
Parameters
t
gridOptions
GridOptions the grid options to set
resetGridOptions
Reset the grid options of the renderer
getMapGridOptions
Get the grid options of a map
Parameters
t
mapId
string ID of the map
Returns (Partial<GridOptions> | undefined)
setMapGridOptions
Set the grid options of a map
Parameters
t
e
mapId
string ID of the mapgridOptions
GridOptions the grid options to set
resetMapGridOptions
Reset the grid options of a map
Parameters
t
mapId
string ID of the map
getSaturation
Get the saturation of the renderer
Returns number
setSaturation
Set the saturation of the renderer
0 - grayscale, 1 - original colors
Parameters
t
saturation
the satuation to set
resetSaturation
Reset the satuation of the renderer
getMapSaturation
Get the saturation of a map
Parameters
t
mapId
string ID of the map
setMapSaturation
Set the saturation of a map
0 - grayscale, 1 - original colors
Parameters
t
e
mapId
ID of the mapsaturation
the saturation to set
resetMapSaturation
Reset the saturation of a map
Parameters
t
mapId
string ID of the map
render
Render the map for a given viewport
Parameters
t
viewport
Viewport the current viewport
<<<<<<< HEAD
computeProjectedGeoRectangle
Returns a rotated rectangle in projected geo coordinates
Parameters
e
t
o
r
fromWarpedMapList
Static method creates that creates a Viewport from a WarpedMapList
Parameters
e
t
o
r
(optional, default"contain"
)s
(optional, default1
)viewportSize
Size Size of the viewport in viewport pixels, as [width, height].warpedMapList
WarpedMapList<W> A WarpedMapList.devicePixelRatio
number? The devicePixelRatio of the viewport.fit
Fit Whether the viewport should contain or cover the bbox of the warpedMapList. (optional, default'contain'
)
Returns Viewport A new Viewport object
fromProjectedGeoBbox
Static method creates that creates a Viewport from Bbox in projected geospatial coordinates.
Parameters
e
t
o
r
(optional, default"contain"
)viewportSize
Size Size of the viewport in viewport pixels, as [width, height].projectedGeoBbox
WarpedMapList<W> A projectedGeoBbox.devicePixelRatio
number? The devicePixelRatio of the viewport.fit
Fit Whether the viewport should contain or cover the bbox of the warpedMapList. (optional, default'contain'
)
Returns Viewport A new Viewport object
constructor
Creates an instance of WarpedMap.
Parameters
e
r
o
mapId
string ID of the mapgeoreferencedMap
GeoreferencedMap Georeferenced map used to construct the WarpedMapoptions
WarpedMapOptions? options
getViewportMask
Get resourceMask in viewport coordinates
Parameters
e
viewport
Viewport the current viewport
Returns Ring
getViewportMaskBbox
Get Bbox of resourceMask in viewport coordinates
Parameters
e
viewport
Viewport the current viewport
Returns Bbox
getViewportMaskRectangle
Get resourceMaskRectangle in viewport coordinates
Parameters
e
viewport
Viewport the current viewport
Returns Rectangle
getViewportFullMask
Get resourceFullMask in viewport coordinates
Parameters
e
viewport
Viewport the current viewport
Returns Ring
getViewportFullMaskBbox
Get bbox of rresourceFullMask in viewport coordinates
Parameters
e
viewport
Viewport the current viewport
Returns Bbox
getViewportFullMaskRectangle
Get resourceFullMaskRectangle in viewport coordinates
Parameters
e
viewport
Viewport the current viewport
Returns Rectangle
getResourceToViewportScale
Get scale of the warped map, in resource pixels per viewport pixels.
Parameters
e
viewport
Viewport the current viewport
Returns number
getResourceToCanvasScale
Get scale of the warped map, in resource pixels per canvas pixels.
Parameters
e
viewport
Viewport the current viewport
Returns number
getReferenceScale
Get the reference scaling from the forward transformation of the projected Helmert transformer
Returns number
setCurrentResourceViewportRing
Set resourceViewportRing at current viewport
Parameters
e
resourceViewportRing
Ring
setCurrentFetchableTiles
Set tiles at current viewport
Parameters
e
fetchableTiles
Array<FetchableTile>
setCurrentOverviewFetchableTiles
Set overview tiles at current viewport
Parameters
e
overviewFetchableTiles
Array<FetchableTile>
setResourceMask
Update the resourceMask loaded from a georeferenced map to a new mask.
Parameters
e
resourceMask
Ring
setTransformationType
Update the transformationType loaded from a georeferenced map to a new transformation type.
Parameters
e
transformationType
TransformationType
setDistortionMeasure
Set the distortionMeasure
Parameters
e
distortionMeasure
DistortionMeasure? the disortion measure
setGcps
Update the Ground Controle Points loaded from a georeferenced map to new Ground Controle Points.
Parameters
e
gcps
Array<GCP>
setCurrentBestScaleFactor
Set the bestScaleFactor for the current viewport
Parameters
e
scaleFactor
number scale factor
Returns boolean
setCurrentOverviewTileZoomLevel
Set the overview tile zoom level for the current viewport
Parameters
e
tileZoomLevel
TileZoomLevel tile zoom level
Returns boolean
hasImageInfo
Check if warpedMap has image info
loadImageInfo
Fetch and parse the image info, and generate the image ID
Returns Promise<void>
addGeoreferenceAnnotation
Parses an annotation and adds its georeferenced map to this renderer's warped map list
Parameters
e
annotation
unknown
Returns Promise<Array<(string | Error)>>
addGeoreferencedMap
Adds a georeferenced map to this renderer's warped map list
Parameters
e
georeferencedMap
unknown
Returns Promise<(string | Error)>
constructor
Creates an instance of a TriangulatedWarpedMap.
Parameters
e
t
i
mapId
string ID of the mapgeoreferencedMap
GeoreferencedMap Georeferenced map used to construct the WarpedMapoptions
WarpedMapOptions? Options
setResourceMask
Update the resourceMask.
Parameters
e
resourceMask
Ring
setCurrentBestScaleFactor
Set the bestScaleFactor for the current viewport
Parameters
e
scaleFactor
number scale factor
Returns boolean
updateTriangulation
Update the triangulation of the resourceMask, at the current bestScaleFactor. Use cache if available.
Parameters
e
(optional, default!1
)previousIsNew
boolean? whether the previous and new triangulation are the same - true by default, false during a transformation transition
updateProjectedGeoTrianglePoints
Update the (previous and new) points of the triangulated resourceMask, at the current bestScaleFactor, in projectedGeo coordinates. Use cache if available.
Parameters
e
(optional, default!1
)previousIsNew
boolean (optional, defaultfalse
)
updateTrianglePointsDistortion
Update the (previous and new) distortion at the points of the triangulated resourceMask. Use cache if available.
Parameters
e
(optional, default!1
)previousIsNew
boolean (optional, defaultfalse
)
resetTrianglePoints
Reset the previous points of the triangulated resourceMask in projectedGeo coordinates.
mixTrianglePoints
Mix the previous and new points of the triangulated resourceMask in projectedGeo coordinates
Parameters
e
t
number
constructor
Creates an instance of WebGL2WarpedMap.
Parameters
e
s
i
r
l
mapId
string ID of the mapgeoreferencedMap
GeoreferencedMap Georeferenced map used to construct the WarpedMapgl
WebGL2RenderingContext WebGL rendering contextprogram
WebGLProgram WebGL programoptions
Partial<WarpedMapOptions> WarpedMapOptions
updateVertexBuffers
Update the vertex buffers of this warped map
Parameters
e
projectedGeoToClipTransform
Transform Transform from projected geo coordinates to webgl2 coordinates in the [-1, 1] range. Equivalent to OpenLayers' projectionTransform.
clearTextures
Clear textures for this map
addCachedTileAndUpdateTextures
Add cached tile to the textures of this map and update textures
Parameters
e
cachedTile
CachedTile
removeCachedTileAndUpdateTextures
Remove cached tile from the textures of this map and update textures
Parameters
e
tileUrl
string
8f9db659 (WIP: texture buffer depth, improve tileInCachedTiles, webworker, changed @allmaps/openlayers ESM export, and changed viewer's vite settings to allow importing web worker directly from render dir)
constructor
Creates an instance of a WarpedMapList.
Parameters
e
t
warpedMapFactory
WarpedMapFactory<W>? Factory function for creating WarpedMap objectsoptions
WarpedMapListOptions? Options
computeProjectedGeoRectangle
Returns a rotated rectangle in projected geo coordinates
Parameters
e
t
o
r
getMapIds
Returns mapIds for the maps in this list.
Returns Iterable<string>
getWarpedMap
Returns the WarpedMap object in this list of map specified by its ID.
Parameters
e
mapId
string
Returns (W | undefined)
getMapZIndex
Returns the z-index of a map.
Parameters
e
mapId
string
getBbox
Return the bounding box of all visible maps in this list, in longitude/latitude coordinates
Returns (Bbox | undefined)
getProjectedBbox
Return the bounding box of all visible maps in this list, in projected coordinates
Returns (Bbox | undefined)
getMapsByGeoBbox
Returns mapIds of the maps whose geoBbox overlaps with the specified geoBbox.
Parameters
e
geoBbox
Bbox
Returns Iterable<string>
setImageInformations
Sets the object that caches image information
Parameters
e
imageInformations
ImageInformations object that caches image information
setMapResourceMask
Sets the resource mask for a specified map
Parameters
e
t
mapId
string ID of the mapresourceMask
Ring the new resource mask
setMapsTransformationType
Sets the transformation type of specified maps
Parameters
e
t
mapIds
Iterable<string> the IDs of the mapstransformationType
TransformationType the new transformation type
setMapsDistortionMeasure
Sets the distortion measure of specified maps
Parameters
e
t
mapIds
Iterable<string> the IDs of the mapsdistortionMeasure
DistortionMeasure? the distortion measure
bringMapsToFront
Changes the z-index of the specified maps to bring them to front
Parameters
e
mapIds
Iterable<string>
sendMapsToBack
Changes the z-index of the specified maps to send them to back
Parameters
e
mapIds
Iterable<string>
bringMapsForward
Changes the z-index of the specified maps to bring them forward
Parameters
e
mapIds
Iterable<string>
sendMapsBackward
Changes the zIndex of the specified maps to send them backward
Parameters
e
mapIds
Iterable<string>
showMaps
Changes the visibility of the specified maps to true
Parameters
e
mapIds
Iterable<string>
hideMaps
Changes the visibility of the specified maps to false
Parameters
e
mapIds
Iterable<string>
addGeoreferencedMap
Adds a georeferenced map to this list
Parameters
e
georeferencedMap
unknown
Returns Promise<(string | Error)>
removeGeoreferencedMap
Removes a georeferenced map from this list
Parameters
e
georeferencedMap
unknown
Returns Promise<(string | Error)>
addGeoreferenceAnnotation
Parses an annotation and adds its georeferenced map to this list
Parameters
e
annotation
unknown
Returns Promise<Array<(string | Error)>>
removeGeoreferenceAnnotation
Parses an annotation and removes its georeferenced map from this list
Parameters
e
annotation
unknown
Returns Promise<Array<(string | Error)>>
fromWarpedMapList
Static method creates that creates a Viewport from a WarpedMapList
Parameters
e
t
o
r
(optional, default"contain"
)s
(optional, default1
)viewportSize
Size Size of the viewport in viewport pixels, as [width, height].warpedMapList
WarpedMapList<W> A WarpedMapList.devicePixelRatio
number? The devicePixelRatio of the viewport.fit
Fit Whether the viewport should contain or cover the bbox of the warpedMapList. (optional, default'contain'
)
Returns Viewport A new Viewport object
fromProjectedGeoBbox
Static method creates that creates a Viewport from Bbox in projected geospatial coordinates.
Parameters
e
t
o
r
(optional, default"contain"
)viewportSize
Size Size of the viewport in viewport pixels, as [width, height].projectedGeoBbox
WarpedMapList<W> A projectedGeoBbox.devicePixelRatio
number? The devicePixelRatio of the viewport.fit
Fit Whether the viewport should contain or cover the bbox of the warpedMapList. (optional, default'contain'
)
Returns Viewport A new Viewport object
constructor
Creates an instance of WarpedMap.
Parameters
e
r
o
mapId
string ID of the mapgeoreferencedMap
GeoreferencedMap Georeferenced map used to construct the WarpedMapoptions
WarpedMapOptions? options
getViewportMask
Get resourceMask in viewport coordinates
Parameters
e
viewport
Viewport the current viewport
Returns Ring
getViewportMaskBbox
Get Bbox of resourceMask in viewport coordinates
Parameters
e
viewport
Viewport the current viewport
Returns Bbox
getViewportMaskRectangle
Get resourceMaskRectangle in viewport coordinates
Parameters
e
viewport
Viewport the current viewport
Returns Rectangle
getViewportFullMask
Get resourceFullMask in viewport coordinates
Parameters
e
viewport
Viewport the current viewport
Returns Ring
getViewportFullMaskBbox
Get bbox of rresourceFullMask in viewport coordinates
Parameters
e
viewport
Viewport the current viewport
Returns Bbox
getViewportFullMaskRectangle
Get resourceFullMaskRectangle in viewport coordinates
Parameters
e
viewport
Viewport the current viewport
Returns Rectangle
getResourceToViewportScale
Get scale of the warped map, in resource pixels per viewport pixels.
Parameters
e
viewport
Viewport the current viewport
Returns number
getResourceToCanvasScale
Get scale of the warped map, in resource pixels per canvas pixels.
Parameters
e
viewport
Viewport the current viewport
Returns number
getReferenceScale
Get the reference scaling from the forward transformation of the projected Helmert transformer
Returns number
setCurrentResourceViewportRing
Set resourceViewportRing at current viewport
Parameters
e
resourceViewportRing
Ring
setCurrentFetchableTiles
Set tiles at current viewport
Parameters
e
fetchableTiles
Array<FetchableTile>
setCurrentOverviewFetchableTiles
Set overview tiles at current viewport
Parameters
e
overviewFetchableTiles
Array<FetchableTile>
setResourceMask
Update the resourceMask loaded from a georeferenced map to a new mask.
Parameters
e
resourceMask
Ring
setTransformationType
Update the transformationType loaded from a georeferenced map to a new transformation type.
Parameters
e
transformationType
TransformationType
setDistortionMeasure
Set the distortionMeasure
Parameters
e
distortionMeasure
DistortionMeasure? the disortion measure
setGcps
Update the Ground Controle Points loaded from a georeferenced map to new Ground Controle Points.
Parameters
e
gcps
Array<GCP>
setCurrentBestScaleFactor
Set the bestScaleFactor for the current viewport
Parameters
e
scaleFactor
number scale factor
Returns boolean
setCurrentOverviewTileZoomLevel
Set the overview tile zoom level for the current viewport
Parameters
e
tileZoomLevel
TileZoomLevel tile zoom level
Returns boolean
hasImageInfo
Check if warpedMap has image info
resetPrevious
Reset the previous points and values.
mixPreviousAndNew
Mix the previous and new points and values.