@allmaps/render v1.0.0-beta.68
@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 WebGL2RenderingContextcontaining the rendering context for the drawing surface of an HTML element.
- A WebGLProgramfor storing the vertex and fragment shader
- A WarpedMapListcontaining the list of WarpedMaps to draw
- A list of WebGL2WarpedMapelements containing the GL information for each warped map
- A TileCachefor storing the image bitmaps of cached tiles
This package also contains two other important classes:
- A Viewportdescribes which view of the map should be rendered (extent, zoom level, ...)
- A WarpedMapdescribes 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 scaleFactorto 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/renderYou can build this package locally by running:
pnpm run buildUsage
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, default- 1)
- viewportSizeSize Size of the viewport in viewport pixels, as [width, height].
- projectedGeoCenterPoint Center point of the viewport, in projected coordinates.
- projectedGeoPerViewportScalenumber Scale of the viewport, in projection coordinates per viewport pixel.
- rotationnumber Rotation of the viewport with respect to the project coordinate system.
- devicePixelRationumber The devicePixelRatio of the viewport. (optional, default- 1)
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, default- 1)
- viewportSizeSize Size of the viewport in viewport pixels, as [width, height].
- warpedMapListWarpedMapList\ A WarpedMapList.
- devicePixelRationumber? The devicePixelRatio of the viewport.
- fitFit 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")
- viewportSizeSize Size of the viewport in viewport pixels, as [width, height].
- projectedGeoBboxWarpedMapList\ A projectedGeoBbox.
- devicePixelRationumber? The devicePixelRatio of the viewport.
- fitFit 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
- mapIdstring ID of the map
- georeferencedMapGeoreferencedMap Georeferenced map used to construct the WarpedMap
- optionsWarpedMapOptions? options
getViewportMask
Get resourceMask in viewport coordinates
Parameters
- e
- viewportViewport the current viewport
Returns Ring
getViewportMaskBbox
Get Bbox of resourceMask in viewport coordinates
Parameters
- e
- viewportViewport the current viewport
Returns Bbox
getViewportMaskRectangle
Get resourceMaskRectangle in viewport coordinates
Parameters
- e
- viewportViewport the current viewport
Returns Rectangle
getViewportFullMask
Get resourceFullMask in viewport coordinates
Parameters
- e
- viewportViewport the current viewport
Returns Ring
getViewportFullMaskBbox
Get bbox of rresourceFullMask in viewport coordinates
Parameters
- e
- viewportViewport the current viewport
Returns Bbox
getViewportFullMaskRectangle
Get resourceFullMaskRectangle in viewport coordinates
Parameters
- e
- viewportViewport the current viewport
Returns Rectangle
getResourceToViewportScale
Get scale of the warped map, in resource pixels per viewport pixels.
Parameters
- e
- viewportViewport the current viewport
Returns number
getResourceToCanvasScale
Get scale of the warped map, in resource pixels per canvas pixels.
Parameters
- e
- viewportViewport 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
- resourceMaskRing
setTransformationType
Update the transformationType loaded from a georeferenced map to a new transformation type.
Parameters
- e
- transformationTypeTransformationType
setDistortionMeasure
Set the distortionMeasure
Parameters
- e
- distortionMeasureDistortionMeasure? the disortion measure
setGcps
Update the Ground Controle Points loaded from a georeferenced map to new Ground Controle Points.
Parameters
- e
- gcpsArray\
setCurrentBestScaleFactor
Set the bestScaleFactor for the current viewport
Parameters
- e
- scaleFactornumber scale factor
Returns boolean
setCurrentTileZoomLevel
Set the tile zoom level for the current viewport
Parameters
- e
- tileZoomLevelnumber? tile zoom level
setCurrentOverviewTileZoomLevel
Set the overview tile zoom level for the current viewport
Parameters
- e
- tileZoomLevelTileZoomLevel? tile zoom level
setCurrentResourceViewportRing
Set resourceViewportRing at current viewport
Parameters
- e
- resourceViewportRingRing?
setCurrentFetchableTiles
Set tiles at current viewport
Parameters
- e
- fetchableTilesArray\
setCurrentOverviewFetchableTiles
Set overview tiles at current viewport
Parameters
- e
- overviewFetchableTilesArray\
resetCurrent
Reset current values
resetPrevious
Reset the previous points and values.
mixPreviousAndNew
Mix the previous and new points and values.
Parameters
- e
- tnumber
hasImageInfo
Check if warpedMap has image info
loadImageInfo
Fetch and parse the image info, and generate the image ID
Returns Promise\
constructor
Creates an instance of a TriangulatedWarpedMap.
Parameters
- t
- e
- i
- mapIdstring ID of the map
- georeferencedMapGeoreferencedMap Georeferenced map used to construct the WarpedMap
- optionsWarpedMapOptions? Options
setResourceMask
Update the resourceMask.
Parameters
- t
- resourceMaskRing
setCurrentBestScaleFactor
Set the bestScaleFactor for the current viewport
Parameters
- t
- scaleFactornumber scale factor
Returns boolean
resetPrevious
Reset the previous points and values.
mixPreviousAndNew
Mix the previous and new points and values.
Parameters
- tnumber
updateTriangulation
Update the triangulation of the resourceMask, at the current bestScaleFactor. Use cache if available.
Parameters
- t(optional, default- !1)
- previousIsNewboolean? 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)
- previousIsNewboolean (optional, default- false)
updateTrianglePointsDistortion
Update the (previous and new) distortion at the points of the triangulated resourceMask. Use cache if available.
Parameters
- t(optional, default- !1)
- previousIsNewboolean (optional, default- false)
constructor
Creates an instance of WebGL2WarpedMap.
Parameters
- e
- r
- n
- l
- T
- i
- o
- mapIdstring ID of the map
- georeferencedMapGeoreferencedMap Georeferenced map used to construct the WarpedMap
- glWebGL2RenderingContext WebGL rendering context
- mapsProgramWebGLProgram WebGL program
- optionsPartial\ WarpedMapOptions
updateVertexBuffers
Update the vertex buffers of this warped map
Parameters
- e
- projectedGeoToClipTransformTransform 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
- cachedTileCachedTile
removeCachedTileAndUpdateTextures
Remove cached tile from the textures of this map and update textures
Parameters
- e
- tileUrlstring
constructor
Creates an instance of a WarpedMapList.
Parameters
- e
- t
- warpedMapFactoryWarpedMapFactory\? Factory function for creating WarpedMap objects
- optionsWarpedMapListOptions? Options
getMapIds
Returns mapIds for the maps in this list.
Returns Iterable[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)
getWarpedMap
Returns the WarpedMap object in this list of map specified by its ID.
Parameters
- e
- mapIdstring
Returns (W | undefined)
getMapZIndex
Returns the z-index of a map.
Parameters
- e
- mapIdstring
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
- geoBboxBbox
Returns Iterable[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)
setImageInformations
Sets the object that caches image information
Parameters
- e
- imageInformationsImageInformations object that caches image information
setMapResourceMask
Sets the resource mask for a specified map
Parameters
- e
- t
- mapIdstring ID of the map
- resourceMaskRing the new resource mask
setMapsTransformationType
Sets the transformation type of specified maps
Parameters
- e
- t
- mapIdsIterable[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String) the IDs of the maps
- transformationTypeTransformationType the new transformation type
setMapsDistortionMeasure
Sets the distortion measure of specified maps
Parameters
- e
- t
- mapIdsIterable[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String) the IDs of the maps
- distortionMeasureDistortionMeasure? the distortion measure
bringMapsToFront
Changes the z-index of the specified maps to bring them to front
Parameters
- e
- mapIdsIterable[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)
sendMapsToBack
Changes the z-index of the specified maps to send them to back
Parameters
- e
- mapIdsIterable[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)
bringMapsForward
Changes the z-index of the specified maps to bring them forward
Parameters
- e
- mapIdsIterable[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)
sendMapsBackward
Changes the zIndex of the specified maps to send them backward
Parameters
- e
- mapIdsIterable[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)
showMaps
Changes the visibility of the specified maps to true
Parameters
- e
- mapIdsIterable[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)
hideMaps
Changes the visibility of the specified maps to false
Parameters
- e
- mapIdsIterable[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)
addGeoreferencedMap
Adds a georeferenced map to this list
Parameters
- e
- georeferencedMapunknown
Returns Promise<(string | Error)>
removeGeoreferencedMap
Removes a georeferenced map from this list
Parameters
- e
- georeferencedMapunknown
Returns Promise<(string | Error)>
addGeoreferenceAnnotation
Parses an annotation and adds its georeferenced map to this list
Parameters
- e
- annotationunknown
Returns Promise<Array<(string | Error)>>
removeGeoreferenceAnnotation
Parses an annotation and removes its georeferenced map from this list
Parameters
- e
- annotationunknown
Returns Promise<Array<(string | Error)>>
constructor
Creates an instance of CacheableTile.
Parameters
- t
- e
- fetchableTileFetchableTile
- fetchFnFetchFn? 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
- tileTile the tile
- warpedMapWarpedMapWithImageInfo A WarpedMap with fetched image information
fetch
Fetch the tile and create its ImageBitMap.
Returns Promise\
fetch
Fetch the tile and create its ImageData object.
Returns Promise\
fetch
Fetch the tile and create its IntArray data using the supplied getImageData function.
Returns Promise\
fetch
Fetch the tile and create its ImageBitmap using a WebWorker.
Returns Promise\
getCacheableTiles
Get the tiles in this cache
Returns IterableIterator\
getCacheableTile
Get a specific tile in this cache
Parameters
- e
- tileUrlstring the URL of the requested tile
Returns (CacheableTile | undefined)
getMapCacheableTiles
Get the tiles in this cache, corresponding to a specific map
Parameters
- e
- mapIdstring ID of the map
Returns Array\
getCachedTiles
Get the tiles in this cache that have been fetched
Returns Array\
getCachedTile
Get a specific cached tile in this cache that has been fetched
Parameters
- e
- tileUrlstring 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
- mapIdstring ID of the map
Returns Array\
getTileUrls
Get the URLs of tiles in this cache
Returns IterableIterator[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)
getMapTileUrls
Get the URLs of tiles in this cache, corresponding to a specific map
Parameters
- e
- mapIdstring ID of the map
Returns IterableIterator[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)
requestFetchableTiles
Process the request for new tiles to be added to this cache
Parameters
- e
- fetchableTilesArray\
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\
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
- annotationunknown
Returns Promise<Array<(string | Error)>>
addGeoreferencedMap
Adds a georeferenced map to this renderer's warped map list
Parameters
- e
- georeferencedMapunknown
Returns Promise<(string | Error)>
constructor
Creates an instance of WebGL2Renderer.
Parameters
- t
- e
- glWebGL2RenderingContext WebGL 2 rendering context
- optionsWebGL2RendererOptions options
getOpacity
Get the opacity of the renderer
setOpacity
Set the opacity of the renderer
Parameters
- t
- opacitynumber opacity to set
resetOpacity
Reset the opacity of the renderer
getMapOpacity
Get the opacity of a map
Parameters
- t
- mapIdstring ID of the map
setMapOpacity
Set the opacity of a map
Parameters
resetMapOpacity
Rreset the opacity of a map
Parameters
- t
- mapIdstring ID of the map
getRemoveColorOptions
Get the remove color options of the renderer
Returns (Partial\ | undefined)
setRemoveColorOptions
Set the remove color options of the renderer
Parameters
- t
- removeColorOptionsRemoveColorOptions
resetRemoveColorOptions
Reset the remove color options of the renderer
getMapRemoveColorOptions
Get the remove color options of a map
Parameters
- t
- mapIdstring ID of the map
Returns (Partial\ | undefined)
setMapRemoveColorOptions
Set the remove color options of a map
Parameters
- t
- e
- mapIdstring ID of the map
- removeColorOptionsRemoveColorOptions the 'remove color options' to set
resetMapRemoveColorOptions
Reset the remove color options of a map
Parameters
- t
- mapIdstring ID of the map
getColorizeOptions
Get the colorize options of the renderer
Returns (Partial\ | undefined)
setColorizeOptions
Set the colorize options of the renderer
Parameters
- t
- colorizeOptionsColorizeOptions the colorize options to set
resetColorizeOptions
Reset the colorize options of the renderer
getMapColorizeOptions
Get the colorize options of a map
Parameters
- t
- mapIdstring ID of the map
Returns (Partial\ | undefined)
setMapColorizeOptions
Set the colorize options of a map
Parameters
- t
- e
- mapIdstring ID of the map
- colorizeOptionsColorizeOptions the colorize options to set
resetMapColorizeOptions
Reset the colorize options of a map
Parameters
- t
- mapIdstring ID of the map
getGridOptions
Get the grid options of the renderer
Returns (Partial\ | undefined)
setGridOptions
Set the grid options of the renderer
Parameters
- t
- gridOptionsGridOptions the grid options to set
resetGridOptions
Reset the grid options of the renderer
getMapGridOptions
Get the grid options of a map
Parameters
- t
- mapIdstring ID of the map
Returns (Partial\ | undefined)
setMapGridOptions
Set the grid options of a map
Parameters
- t
- e
- mapIdstring ID of the map
- gridOptionsGridOptions the grid options to set
resetMapGridOptions
Reset the grid options of a map
Parameters
- t
- mapIdstring 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
- saturationthe satuation to set
resetSaturation
Reset the satuation of the renderer
getMapSaturation
Get the saturation of a map
Parameters
- t
- mapIdstring ID of the map
setMapSaturation
Set the saturation of a map
0 - grayscale, 1 - original colors
Parameters
- t
- e
- mapIdID of the map
- saturationthe saturation to set
resetMapSaturation
Reset the saturation of a map
Parameters
- t
- mapIdstring ID of the map
render
Render the map for a given viewport
Parameters
- t
- viewportViewport 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, default- 1)
- viewportSizeSize Size of the viewport in viewport pixels, as [width, height].
- warpedMapListWarpedMapList\ A WarpedMapList.
- devicePixelRationumber? The devicePixelRatio of the viewport.
- fitFit 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")
- viewportSizeSize Size of the viewport in viewport pixels, as [width, height].
- projectedGeoBboxWarpedMapList\ A projectedGeoBbox.
- devicePixelRationumber? The devicePixelRatio of the viewport.
- fitFit 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
- mapIdstring ID of the map
- georeferencedMapGeoreferencedMap Georeferenced map used to construct the WarpedMap
- optionsWarpedMapOptions? options
getViewportMask
Get resourceMask in viewport coordinates
Parameters
- e
- viewportViewport the current viewport
Returns Ring
getViewportMaskBbox
Get Bbox of resourceMask in viewport coordinates
Parameters
- e
- viewportViewport the current viewport
Returns Bbox
getViewportMaskRectangle
Get resourceMaskRectangle in viewport coordinates
Parameters
- e
- viewportViewport the current viewport
Returns Rectangle
getViewportFullMask
Get resourceFullMask in viewport coordinates
Parameters
- e
- viewportViewport the current viewport
Returns Ring
getViewportFullMaskBbox
Get bbox of rresourceFullMask in viewport coordinates
Parameters
- e
- viewportViewport the current viewport
Returns Bbox
getViewportFullMaskRectangle
Get resourceFullMaskRectangle in viewport coordinates
Parameters
- e
- viewportViewport the current viewport
Returns Rectangle
getResourceToViewportScale
Get scale of the warped map, in resource pixels per viewport pixels.
Parameters
- e
- viewportViewport the current viewport
Returns number
getResourceToCanvasScale
Get scale of the warped map, in resource pixels per canvas pixels.
Parameters
- e
- viewportViewport 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
- resourceViewportRingRing
setCurrentFetchableTiles
Set tiles at current viewport
Parameters
- e
- fetchableTilesArray\
setCurrentOverviewFetchableTiles
Set overview tiles at current viewport
Parameters
- e
- overviewFetchableTilesArray\
setResourceMask
Update the resourceMask loaded from a georeferenced map to a new mask.
Parameters
- e
- resourceMaskRing
setTransformationType
Update the transformationType loaded from a georeferenced map to a new transformation type.
Parameters
- e
- transformationTypeTransformationType
setDistortionMeasure
Set the distortionMeasure
Parameters
- e
- distortionMeasureDistortionMeasure? the disortion measure
setGcps
Update the Ground Controle Points loaded from a georeferenced map to new Ground Controle Points.
Parameters
- e
- gcpsArray\
setCurrentBestScaleFactor
Set the bestScaleFactor for the current viewport
Parameters
- e
- scaleFactornumber scale factor
Returns boolean
setCurrentOverviewTileZoomLevel
Set the overview tile zoom level for the current viewport
Parameters
- e
- tileZoomLevelTileZoomLevel 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\
addGeoreferenceAnnotation
Parses an annotation and adds its georeferenced map to this renderer's warped map list
Parameters
- e
- annotationunknown
Returns Promise<Array<(string | Error)>>
addGeoreferencedMap
Adds a georeferenced map to this renderer's warped map list
Parameters
- e
- georeferencedMapunknown
Returns Promise<(string | Error)>
constructor
Creates an instance of a TriangulatedWarpedMap.
Parameters
- e
- t
- i
- mapIdstring ID of the map
- georeferencedMapGeoreferencedMap Georeferenced map used to construct the WarpedMap
- optionsWarpedMapOptions? Options
setResourceMask
Update the resourceMask.
Parameters
- e
- resourceMaskRing
setCurrentBestScaleFactor
Set the bestScaleFactor for the current viewport
Parameters
- e
- scaleFactornumber scale factor
Returns boolean
updateTriangulation
Update the triangulation of the resourceMask, at the current bestScaleFactor. Use cache if available.
Parameters
- e(optional, default- !1)
- previousIsNewboolean? 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)
- previousIsNewboolean (optional, default- false)
updateTrianglePointsDistortion
Update the (previous and new) distortion at the points of the triangulated resourceMask. Use cache if available.
Parameters
- e(optional, default- !1)
- previousIsNewboolean (optional, default- false)
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
- tnumber
constructor
Creates an instance of WebGL2WarpedMap.
Parameters
- e
- s
- i
- r
- l
- mapIdstring ID of the map
- georeferencedMapGeoreferencedMap Georeferenced map used to construct the WarpedMap
- glWebGL2RenderingContext WebGL rendering context
- programWebGLProgram WebGL program
- optionsPartial\ WarpedMapOptions
updateVertexBuffers
Update the vertex buffers of this warped map
Parameters
- e
- projectedGeoToClipTransformTransform 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
- cachedTileCachedTile
removeCachedTileAndUpdateTextures
Remove cached tile from the textures of this map and update textures
Parameters
- e
- tileUrlstring
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
- warpedMapFactoryWarpedMapFactory\? Factory function for creating WarpedMap objects
- optionsWarpedMapListOptions? 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](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)
getWarpedMap
Returns the WarpedMap object in this list of map specified by its ID.
Parameters
- e
- mapIdstring
Returns (W | undefined)
getMapZIndex
Returns the z-index of a map.
Parameters
- e
- mapIdstring
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
- geoBboxBbox
Returns Iterable[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)
setImageInformations
Sets the object that caches image information
Parameters
- e
- imageInformationsImageInformations object that caches image information
setMapResourceMask
Sets the resource mask for a specified map
Parameters
- e
- t
- mapIdstring ID of the map
- resourceMaskRing the new resource mask
setMapsTransformationType
Sets the transformation type of specified maps
Parameters
- e
- t
- mapIdsIterable[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String) the IDs of the maps
- transformationTypeTransformationType the new transformation type
setMapsDistortionMeasure
Sets the distortion measure of specified maps
Parameters
- e
- t
- mapIdsIterable[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String) the IDs of the maps
- distortionMeasureDistortionMeasure? the distortion measure
bringMapsToFront
Changes the z-index of the specified maps to bring them to front
Parameters
- e
- mapIdsIterable[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)
sendMapsToBack
Changes the z-index of the specified maps to send them to back
Parameters
- e
- mapIdsIterable[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)
bringMapsForward
Changes the z-index of the specified maps to bring them forward
Parameters
- e
- mapIdsIterable[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)
sendMapsBackward
Changes the zIndex of the specified maps to send them backward
Parameters
- e
- mapIdsIterable[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)
showMaps
Changes the visibility of the specified maps to true
Parameters
- e
- mapIdsIterable[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)
hideMaps
Changes the visibility of the specified maps to false
Parameters
- e
- mapIdsIterable[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)
addGeoreferencedMap
Adds a georeferenced map to this list
Parameters
- e
- georeferencedMapunknown
Returns Promise<(string | Error)>
removeGeoreferencedMap
Removes a georeferenced map from this list
Parameters
- e
- georeferencedMapunknown
Returns Promise<(string | Error)>
addGeoreferenceAnnotation
Parses an annotation and adds its georeferenced map to this list
Parameters
- e
- annotationunknown
Returns Promise<Array<(string | Error)>>
removeGeoreferenceAnnotation
Parses an annotation and removes its georeferenced map from this list
Parameters
- e
- annotationunknown
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, default- 1)
- viewportSizeSize Size of the viewport in viewport pixels, as [width, height].
- warpedMapListWarpedMapList\ A WarpedMapList.
- devicePixelRationumber? The devicePixelRatio of the viewport.
- fitFit 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")
- viewportSizeSize Size of the viewport in viewport pixels, as [width, height].
- projectedGeoBboxWarpedMapList\ A projectedGeoBbox.
- devicePixelRationumber? The devicePixelRatio of the viewport.
- fitFit 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
- mapIdstring ID of the map
- georeferencedMapGeoreferencedMap Georeferenced map used to construct the WarpedMap
- optionsWarpedMapOptions? options
getViewportMask
Get resourceMask in viewport coordinates
Parameters
- e
- viewportViewport the current viewport
Returns Ring
getViewportMaskBbox
Get Bbox of resourceMask in viewport coordinates
Parameters
- e
- viewportViewport the current viewport
Returns Bbox
getViewportMaskRectangle
Get resourceMaskRectangle in viewport coordinates
Parameters
- e
- viewportViewport the current viewport
Returns Rectangle
getViewportFullMask
Get resourceFullMask in viewport coordinates
Parameters
- e
- viewportViewport the current viewport
Returns Ring
getViewportFullMaskBbox
Get bbox of rresourceFullMask in viewport coordinates
Parameters
- e
- viewportViewport the current viewport
Returns Bbox
getViewportFullMaskRectangle
Get resourceFullMaskRectangle in viewport coordinates
Parameters
- e
- viewportViewport the current viewport
Returns Rectangle
getResourceToViewportScale
Get scale of the warped map, in resource pixels per viewport pixels.
Parameters
- e
- viewportViewport the current viewport
Returns number
getResourceToCanvasScale
Get scale of the warped map, in resource pixels per canvas pixels.
Parameters
- e
- viewportViewport 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
- resourceViewportRingRing
setCurrentFetchableTiles
Set tiles at current viewport
Parameters
- e
- fetchableTilesArray\
setCurrentOverviewFetchableTiles
Set overview tiles at current viewport
Parameters
- e
- overviewFetchableTilesArray\
setResourceMask
Update the resourceMask loaded from a georeferenced map to a new mask.
Parameters
- e
- resourceMaskRing
setTransformationType
Update the transformationType loaded from a georeferenced map to a new transformation type.
Parameters
- e
- transformationTypeTransformationType
setDistortionMeasure
Set the distortionMeasure
Parameters
- e
- distortionMeasureDistortionMeasure? the disortion measure
setGcps
Update the Ground Controle Points loaded from a georeferenced map to new Ground Controle Points.
Parameters
- e
- gcpsArray\
setCurrentBestScaleFactor
Set the bestScaleFactor for the current viewport
Parameters
- e
- scaleFactornumber scale factor
Returns boolean
setCurrentOverviewTileZoomLevel
Set the overview tile zoom level for the current viewport
Parameters
- e
- tileZoomLevelTileZoomLevel 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.
Parameters
8 months ago
5 months ago
5 months ago
12 months ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
4 years ago
4 years ago
4 years ago