new Layout(url, type [, options])
Creates a new Layout instance
Parameters:
| Name | Type | Argument | Description |
|---|---|---|---|
url |
string | URL to image or configuration file |
|
type |
LayoutType | Type of image layout |
|
options |
LayoutOptions |
<optional> |
Additional configuration |
Fires:
Throws:
-
If layout type is unknown or module not loaded
- Type
- Error
Example
```javascript
// Single image
const imageLayout = new Layout('image.jpg', 'image');
// Deep Zoom
const dzLayout = new Layout('tiles.dzi', 'deepzoom');
// Google Maps format
const googleLayout = new Layout('tiles/', 'google', {
width: 2000,
height: 1500
});
```
Members
Methods
-
available(viewport, transform, layerTransform, border, bias, tiles)
-
Gets tiles available for rendering
Parameters:
Name Type Description viewportObject Current viewport
transformObject Current transform
layerTransformObject Layer transform
bordernumber Border size
biasnumber Mipmap bias
tilesMap.<number, TileObj> Existing tiles
Returns:
Map of available tiles
- Type
- Object.<number, TileObj>
-
boundingBox()
-
Gets layout bounds
Returns:
Layout boundaries
- Type
- BoundingBox
-
getTileSize()
-
Gets tile dimensions
Returns:
[width, height] of tiles
- Type
- Array.<number>
-
<abstract> getTileURL(id, tile)
-
Gets URL for specific tile
Parameters:
Name Type Description idnumber Channel identifier
tileTileObj Tile object
Returns:
Tile URL
- Type
- string
-
getViewportBox(viewport, transform, layerT)
-
Calculates viewport bounding box
Parameters:
Name Type Description viewportObject Viewport parameters
transformObject Current transform
layerTObject Layer transform
Returns:
Viewport bounds in image space
- Type
- BoundingBox
-
imageUrl(url, plane)
-
Constructs URL for specific image plane
Parameters:
Name Type Description urlstring Base URL
planestring Plane identifier
Returns:
Complete URL
- Type
- string
-
needed(viewport, transform, layerTransform, border, bias, tiles [, maxtiles])
-
Determines required tiles for rendering
Parameters:
Name Type Argument Default Description viewportObject Current viewport
transformObject Current transform
layerTransformObject Layer transform
bordernumber Border size
biasnumber Mipmap bias
tilesMap.<number, TileObj> Existing tiles
maxtilesnumber <optional>
8 Maximum tiles to return
Returns:
Array of needed tiles
- Type
- Array.<TileObj>
-
tileCoords(tile)
-
Calculates tile coordinates
Parameters:
Name Type Description tileTileObj Tile to calculate coordinates for
Returns:
Image and texture coordinates
- Type
- Object
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'
- Source:
Events
-
ready
-
FIXME Fired when a layout is ready to be drawn (the single-resolution image is downloaded or the multi-resolution structure has been initialized)
-
ready
-
Fired when the layout is ready for rendering. This occurs when:
- Tile descriptors are loaded from annotation file
- Tile descriptors are set programmatically
- Source:
-
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).
- Source:
-
ready
-
Fired when the layout is ready for rendering. This occurs when:
- Single-resolution image is fully downloaded
- Multi-resolution structure is initialized and validated
- Tile pyramid information is computed
- Source:
-
updateSize
-
Fired when layout dimensions change
-
updateSize
-
Fired when the layout size changes and scene extension needs updating. This occurs when:
- Tile descriptors are loaded and bounding box is computed
- Source:
-
updateSize
-
The event is fired when a layout size is modified (and the scene extension must be recomputed at canvas level).
- Source:
-
updateSize
-
Fired when the layout size changes and scene extension needs updating. This occurs when:
- Image dimensions are determined
- Pyramid levels are initialized
- Bounding boxes are computed
- Source: