Constructor
new TileSource(options)
Parameters:
| Name |
Type |
Description |
options |
Object
|
You can either specify a URL, or literally define the TileSource (by specifying
width, height, tileSize, tileOverlap, minLevel, and maxLevel). For the former,
the extending class is expected to implement 'getImageInfo' and 'configure'.
For the latter, the construction is assumed to occur through
the extending classes implementation of 'configure'.
Properties
| Name |
Type |
Attributes |
Description |
url |
String
|
<optional>
|
The URL for the data necessary for this TileSource. |
success |
function
|
<optional>
|
A function to be called upon successful creation. |
ajaxWithCredentials |
Boolean
|
<optional>
|
If this TileSource needs to make an AJAX call, this specifies whether to set
the XHR's withCredentials (for accessing secure data). |
width |
Number
|
<optional>
|
Width of the source image at max resolution in pixels. |
height |
Number
|
<optional>
|
Height of the source image at max resolution in pixels. |
tileSize |
Number
|
<optional>
|
The size of the tiles to assumed to make up each pyramid layer in pixels.
Tile size determines the point at which the image pyramid must be
divided into a matrix of smaller images.
Use options.tileWidth and options.tileHeight to support non-square tiles. |
tileWidth |
Number
|
<optional>
|
The width of the tiles to assumed to make up each pyramid layer in pixels. |
tileHeight |
Number
|
<optional>
|
The height of the tiles to assumed to make up each pyramid layer in pixels. |
tileOverlap |
Number
|
<optional>
|
The number of pixels each tile is expected to overlap touching tiles. |
minLevel |
Number
|
<optional>
|
The minimum level to attempt to load. |
maxLevel |
Number
|
<optional>
|
The maximum level to attempt to load. |
|
- Source:
Extends
Members
aspectRatio :Number
Ratio of width to height
Type:
- Source:
Vector storing x and y dimensions ( width and height respectively ).
Type:
- Source:
maxLevel :Number
The maximum pyramid level this tile source supports or should attempt to load.
Type:
- Source:
minLevel :Number
The minimum pyramid level this tile source supports or should attempt to load.
Type:
- Source:
ready :Boolean
Type:
- Source:
tileOverlap :Number
The overlap in pixels each tile shares with its adjacent neighbors.
Type:
- 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:
Responsible for parsing and configuring the
image metadata pertinent to this TileSources implementation.
This method is not implemented by this class other than to throw an Error
announcing you have to implement it. Because of the variety of tile
server technologies, and various specifications for building image
pyramids, this method is here to allow easy integration.
Parameters:
| Name |
Type |
Description |
data |
String
|
Object
|
Array
|
Document
|
|
url |
String
|
the url the data was loaded
from if any. |
- Source:
Throws:
Error
Returns:
options - A dictionary of keyword arguments sufficient
to configure this tile sources constructor.
-
Type
-
Object
getClosestLevel(level)
Parameters:
| Name |
Type |
Description |
level |
Number
|
|
- Source:
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
|
|
- Source:
Throws:
Error
getLevelScale(level)
Parameters:
| Name |
Type |
Description |
level |
Number
|
|
- Source:
getNumTiles(level)
Parameters:
| Name |
Type |
Description |
level |
Number
|
|
- Source:
getPixelRatio(level)
Parameters:
| Name |
Type |
Description |
level |
Number
|
|
- Source:
getTileAtPoint(level, point)
Parameters:
- Source:
getTileBounds(level, x, y)
Parameters:
| Name |
Type |
Description |
level |
Number
|
|
x |
Number
|
|
y |
Number
|
|
- Source:
getTileHeight(level)
Return the tileHeight for a given level.
Subclasses should override this if tileHeight can be different at different levels
such as in IIIFTileSource. Code should use this function rather than reading
from ._tileHeight directly.
Parameters:
| Name |
Type |
Description |
level |
Number
|
|
- Source:
getTileUrl(level, x, y)
Responsible for retriving the url which will return an image for the
region specified by the given x, y, and level components.
This method is not implemented by this class other than to throw an Error
announcing you have to implement it. Because of the variety of tile
server technologies, and various specifications for building image
pyramids, this method is here to allow easy integration.
Parameters:
| Name |
Type |
Description |
level |
Number
|
|
x |
Number
|
|
y |
Number
|
|
- Source:
Throws:
Error
getTileWidth(level)
Return the tileWidth for a given level.
Subclasses should override this if tileWidth can be different at different levels
such as in IIIFTileSource. Code should use this function rather than reading
from ._tileWidth directly.
Parameters:
| Name |
Type |
Description |
level |
Number
|
|
- Source:
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:
supports(data, url) → {Boolean}
Responsible determining if a the particular TileSource supports the
data format ( and allowed to apply logic against the url the data was
loaded from, if any ). Overriding implementations are expected to do
something smart with data and / or url to determine support. Also
understand that iteration order of TileSources is not guarunteed so
please make sure your data or url is expressive enough to ensure a simple
and sufficient mechanisim for clear determination.
Parameters:
| Name |
Type |
Description |
data |
String
|
Object
|
Array
|
Document
|
|
url |
String
|
the url the data was loaded
from if any. |
- Source:
Returns:
-
Type
-
Boolean
tileExists(level, x, y)
Parameters:
| Name |
Type |
Description |
level |
Number
|
|
x |
Number
|
|
y |
Number
|
|
- Source:
Events
open-failed
Raised when an error occurs loading a TileSource.
Type:
Properties:
| Name |
Type |
Attributes |
Description |
eventSource |
OpenSeadragon.TileSource
|
|
A reference to the TileSource which raised the event. |
message |
String
|
|
|
source |
String
|
|
|
userData |
Object
|
<nullable>
|
Arbitrary subscriber-defined object. |
- Source:
ready
Raised when a TileSource is opened and initialized.
Type:
Properties:
| Name |
Type |
Attributes |
Description |
eventSource |
OpenSeadragon.TileSource
|
|
A reference to the TileSource which raised the event. |
tileSource |
Object
|
|
|
userData |
Object
|
<nullable>
|
Arbitrary subscriber-defined object. |
- Source: