new LayoutTiles(url, type [, options])
Creates a new LayoutTiles instance.
Parameters:
Name | Type | Argument | Description | |||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
url |
string | URL to the image or tile configuration |
||||||||||||||||||||||||||||||||||||
type |
Layout#Type | The type of image layout |
||||||||||||||||||||||||||||||||||||
options |
Object |
<optional> |
Configuration options Properties
|
- Source:
Fires:
- Layout#event:ready - When layout initialization is complete
- Layout#event:updateSize - When layout dimensions change
Example
```javascript // DeepZoom layout const dzLayout = new LayoutTiles('image.dzi', 'deepzoom', { cachelevels: 8 }); // Google Maps layout const googleLayout = new LayoutTiles('tiles/', 'google', { width: 4096, height: 3072, suffix: 'png' }); // IIIF layout const iiifLayout = new LayoutTiles('https://server/image', 'iiif'); ```
Extends
Methods
-
available(viewport, transform, layerTransform, border, bias, tiles)
-
Gets tiles currently available for rendering.
Parameters:
Name Type Description viewport
Viewport Current viewport
transform
Transform Current transform
layerTransform
Transform Layer-specific transform
border
number Border size in tile units
bias
number Resolution bias
tiles
Map.<number, Tile> Available tiles
- Overrides:
- Source:
Returns:
Map of tile index to tile object with additional 'complete' property
- Type
- Object.<number, Tile>
-
boundingBox()
-
Gets layout bounds
- Inherited From:
- Overrides:
- Source:
Returns:
Layout boundaries
- Type
- BoundingBox
-
getTileSize()
-
Gets the tile size for the layout.
- Overrides:
- Source:
Returns:
Array containing [width, height] of tiles
- Type
- Array.<number>
-
getTileURL(id, tile)
-
Gets URL for a specific tile.
Parameters:
Name Type Description id
number Channel/raster ID
tile
TileObj Tile to get URL for
- Overrides:
- Source:
Throws:
-
If layout not defined or ready
- Type
- Error
Returns:
URL to fetch tile data
- Type
- string
-
getViewportBox(viewport, transform, layerT)
-
Calculates viewport bounding box
Parameters:
Name Type Description viewport
Object Viewport parameters
transform
Transform Current transform
layerT
Transform Layer transform
- Inherited From:
- Overrides:
- Source:
Returns:
Viewport bounds in image space
- Type
- BoundingBox
-
index(level, x, y)
-
Generates unique index for a tile based on its position and level.
Parameters:
Name Type Description level
number Zoom level
x
number X coordinate
y
number Y coordinate
- Source:
Returns:
Unique tile index
- Type
- number
-
needed(viewport, transform, layerTransform, border, bias, tiles [, maxtiles])
-
Determines which tiles are needed for the current view.
Parameters:
Name Type Argument Default Description viewport
Viewport Current viewport
transform
Transform Current transform
layerTransform
Transform Layer-specific transform
border
number Border size in tile units for prefetching
bias
number Resolution bias (0-1, affects mipmap level selection)
tiles
Map.<number, Tile> Currently available tiles
maxtiles
number <optional>
8 Maximum number of tiles to return
- Overrides:
- Source:
Returns:
Array of needed tiles sorted by priority
- Type
- Array.<TileObj>
-
neededBox(viewport, transform, layerTransform, border, bias)
-
Computes required tiles at each pyramid level for the current view.
Parameters:
Name Type Description viewport
Viewport Current viewport
transform
Transform Current transform
layerTransform
Transform Layer-specific transform
border
number Border size in tile units for prefetching
bias
number Resolution bias (0-1)
- Source:
Returns:
-
Tile requirements
- Type
- Object
-
.level - Optimal pyramid level
- Type
- number
-
.pyramid - Array of tile bounding boxes per level
- Type
- Array.<BoundingBox>
-
newTile(index)
-
Creates a new tile instance with computed properties.
Parameters:
Name Type Description index
number Unique tile identifier
- Overrides:
- Layout#newTile
- Source:
Returns:
New tile instance
- Type
- TileObj
-
reverseIndex(index)
-
Converts tile index back to level, x, y coordinates.
Parameters:
Name Type Description index
number Tile index
- Source:
Returns:
Position object containing level, x, y
- Type
- Object
-
tileCoords(tile)
-
Gets coordinates for a tile in both image space and texture space.
Parameters:
Name Type Description tile
TileObj The tile to get coordinates for
- Overrides:
- Source:
Returns:
-
Coordinate data
- Type
- Object
-
.coords - Image space coordinates [x,y,z, x,y,z, x,y,z, x,y,z]
- Type
- Float32Array
-
.tcoords - Texture coordinates [u,v, u,v, u,v, u,v]
- Type
- Float32Array
Type Definitions
-
Type
-
Supported image layout types including both single-resolution and multi-resolution formats.
- image: Standard web image formats (jpg, png, gif, etc.)
- deepzoom: Microsoft Deep Zoom format with root tile > 1px
- deepzoom1px: Microsoft Deep Zoom format with 1px root tile
- google: Google Maps tiling scheme
- zoomify: Zoomify tiling format
- iiif: International Image Interoperability Framework
- iip: Internet Imaging Protocol
- tarzoom: OpenLIME custom format (single TAR of DeepZoom pyramid)
- itarzoom: OpenLIME custom interleaved TAR format
Type:
- 'image' | 'deepzoom' | 'deepzoom1px' | 'google' | 'zoomify' | 'iiif' | 'iip' | 'tarzoom' | 'itarzoom'
- Inherited From:
- Overrides:
- Source:
Events
-
ready
-
The event is fired when a layout is ready to be drawn(the single-resolution image is downloaded or the multi-resolution structure has been initialized).
- Inherited From:
- Overrides:
- Source:
-
updateSize
-
The event is fired when a layout size is modified (and the scene extension must be recomputed at canvas level).
- Inherited From:
- Overrides:
- Source: