Class: IIIFTileSource

OpenSeadragon.IIIFTileSource

A client implementation of the International Image Interoperability Framework Format: Image API 1.0 - 2.1

Constructor

new IIIFTileSource()

Parameters:
Name Type Attributes Default Description
options.tileFormat String <optional>
'jpg' The extension that will be used when requiring tiles.
Source:
See:

Extends

Members

aspectRatio :Number

Ratio of width to height
Type:
  • Number
Inherited From:
Source:

dimensions :OpenSeadragon.Point

Vector storing x and y dimensions ( width and height respectively ).
Type:
Inherited From:
Source:

maxLevel :Number

The maximum pyramid level this tile source supports or should attempt to load.
Type:
  • Number
Inherited From:
Source:

minLevel :Number

The minimum pyramid level this tile source supports or should attempt to load.
Type:
  • Number
Inherited From:
Source:

ready :Boolean

Type:
  • Boolean
Inherited From:
Source:

tileOverlap :Number

The overlap in pixels each tile shares with its adjacent neighbors.
Type:
  • Number
Inherited From:
Source:

Methods

addHandler(eventName, handler, userDataopt)

Add an event handler for a given event.
Parameters:
Name Type Attributes Default Description
eventName String Name of event to register.
handler OpenSeadragon.EventHandler Function to call when event is triggered.
userData Object <optional>
null Arbitrary object to be passed unchanged to the handler.
Inherited From:
Source:

addOnceHandler(eventName, handler, userDataopt, timesopt)

Add an event handler to be triggered only once (or a given number of times) for a given event.
Parameters:
Name Type Attributes Default Description
eventName String Name of event to register.
handler OpenSeadragon.EventHandler Function to call when event is triggered.
userData Object <optional>
null Arbitrary object to be passed unchanged to the handler.
times Number <optional>
1 The number of times to handle the event before removing it.
Inherited From:
Source:

configure(data, url, postData)

Parameters:
Name Type Description
data Object the raw configuration
url String the url configuration was retrieved from
postData String HTTP POST data in k=v&k2=v2... form or null
Overrides:
Source:
Example

IIIF 1.1 Info Looks like this

{
  "@context" : "http://library.stanford.edu/iiif/image-api/1.1/context.json",
  "@id" : "http://iiif.example.com/prefix/1E34750D-38DB-4825-A38A-B60A345E591C",
  "width" : 6000,
  "height" : 4000,
  "scale_factors" : [ 1, 2, 4 ],
  "tile_width" : 1024,
  "tile_height" : 1024,
  "formats" : [ "jpg", "png" ],
  "qualities" : [ "native", "grey" ],
  "profile" : "http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level0"
}

getClosestLevel() → {Number}

Inherited From:
Source:
Returns:
The highest level in this tile source that can be contained in a single tile.
Type
Number

getHandler(eventName)

Get a function which iterates the list of all handlers registered for a given event, calling the handler for each.
Parameters:
Name Type Description
eventName String Name of event to get handlers for.
Inherited From:
Source:

getImageInfo(url)

Responsible for retrieving, and caching the image metadata pertinent to this TileSources implementation.
Parameters:
Name Type Description
url String
Inherited From:
Source:
Throws:
Error

getLevelScale(level)

Parameters:
Name Type Description
level Number
Overrides:
Source:

getNumTiles(level)

Parameters:
Name Type Description
level Number
Overrides:
Source:

getPixelRatio(level)

Parameters:
Name Type Description
level Number
Inherited From:
Source:

getTileAjaxHeaders(level, x, y) → {Object}

Responsible for retrieving the headers which will be attached to the image request for the region specified by the given x, y, and level components. This option is only relevant if OpenSeadragon.Options.loadTilesWithAjax is set to true. The headers returned here will override headers specified at the Viewer or TiledImage level. Specifying a falsy value for a header will clear its existing value set at the Viewer or TiledImage level (if any).
Parameters:
Name Type Description
level Number
x Number
y Number
Inherited From:
Source:
Returns:
Type
Object

getTileAtPoint(level, point)

Parameters:
Name Type Description
level Number
point OpenSeadragon.Point
Overrides:
Source:

getTileBounds(level, x, y, isSourceopt) → {OpenSeadragon.Rect}

Parameters:
Name Type Attributes Default Description
level Number
x Number
y Number
isSource Boolean <optional>
false Whether to return the source bounds of the tile.
Inherited From:
Source:
Returns:
Either where this tile fits (in normalized coordinates) or the portion of the tile to use as the source of the drawing operation (in pixels), depending on the isSource parameter.
Type
OpenSeadragon.Rect

getTileHashKey(level, x, y, url, ajaxHeaders, postData)

The tile cache object is uniquely determined by this key and used to lookup the image data in cache: keys should be different if images are different. In case a tile has context2D property defined (TileSource.prototype.getContext2D) or its context2D is set manually; the cache is not used and this function is irrelevant. Note: default behaviour does not take into account post data.
Parameters:
Name Type Description
level Number tile level it was fetched with
x Number x-coordinate in the pyramid level
y Number y-coordinate in the pyramid level
url String the tile was fetched with
ajaxHeaders Object the tile was fetched with
postData * data the tile was fetched with (type depends on getTilePostData(..) return type)
Inherited From:
Source:

getTileHeight(level)

Return the tileHeight for the given level.
Parameters:
Name Type Description
level Number
Overrides:
Source:

getTilePostData(level, x, y) → {*|null}

Must use AJAX in order to work, i.e. loadTilesWithAjax = true is set. If a value is returned, ajax issues POST request to the tile url. If null is returned, ajax issues GET request. The return value must comply to the header 'content type'. Examples (USED HEADER --> getTilePostData CODE): 'Content-type': 'application/x-www-form-urlencoded' --> return "key1=value=1&key2=value2"; 'Content-type': 'application/x-www-form-urlencoded' --> return JSON.stringify({key: "value", number: 5}); 'Content-type': 'multipart/form-data' --> let result = new FormData(); result.append("data", myData); return result; IMPORTANT: in case you move all the logic on image fetching to post data, you must re-define 'getTileHashKey(...)' to stay unique for different tile images.
Parameters:
Name Type Description
level Number
x Number
y Number
Inherited From:
Source:
Returns:
post data to send with tile configuration request
Type
* | null

getTileUrl(level, x, y)

Responsible for retrieving the url which will return an image for the region specified by the given x, y, and level components.
Parameters:
Name Type Description
level Number z index
x Number
y Number
Overrides:
Source:
Throws:
Error

getTileWidth(level)

Return the tileWidth for the given level.
Parameters:
Name Type Description
level Number
Overrides:
Source:

numberOfHandlers(eventName) → {number}

Get the amount of handlers registered for a given event.
Parameters:
Name Type Description
eventName String Name of event to inspect.
Inherited From:
Source:
Returns:
amount of events
Type
number

raiseEvent(eventName, eventArgs)

Trigger an event, optionally passing additional information.
Parameters:
Name Type Description
eventName String Name of event to register.
eventArgs Object Event-specific data.
Inherited From:
Source:

removeAllHandlers(eventName)

Remove all event handlers for a given event type. If no type is given all event handlers for every event type are removed.
Parameters:
Name Type Description
eventName String Name of event for which all handlers are to be removed.
Inherited From:
Source:

removeHandler(eventName, handler)

Remove a specific event handler for a given event.
Parameters:
Name Type Description
eventName String Name of event for which the handler is to be removed.
handler OpenSeadragon.EventHandler Function to be removed.
Inherited From:
Source:

setMaxLevel(level)

Set the maxLevel to the given level, and perform the memoization of getLevelScale with the new maxLevel. This function can be useful if the memoization is required before the first call of getLevelScale, or both memoized getLevelScale and maxLevel should be changed accordingly.
Parameters:
Name Type Description
level Number
Inherited From:
Source:

supports(data, optional)

Determine if the data and/or url imply the image service is supported by this tile source.
Parameters:
Name Type Description
data Object | Array
optional String url
Overrides:
Source:

tileExists(level, x, y)

Parameters:
Name Type Description
level Number
x Number
y Number
Inherited From:
Source: