Seadragon.DziTileSource class

Version - Back to Seadragon Ajax Library

Overview

A subclass of Seadragon.TileSource that handles Deep Zoom Images. This class supports sparse images.

Constructors

Signature Description
Seadragon.DziTileSource(width, height, tileSize, tileOverlap, tilesUrl, tileFormat, displayRects?) Creates a DziTileSource for a Deep Zoom Image having tiles of the given format at the given URL. If the image is sparse, the image's display rectangles should be given as a list of Seadragon.DisplayRect instances.

Additional Properties

Name Type Description
tileFormat String The image format of the tiles in this Deep Zoom Image, e.g. "jpg" or "png".
displayRects Array If this image is sparse, the Seadragon.DisplayRect instances given to the constructor, otherwise null.

Overriden Methods

Name and Signature Return Type Description
getTileUrl(level, x, y) String Returns the URL for the given tile.
tileExists(level, x, y) Boolean Returns true if the given tile exists and is part of the sparse image.

Static Methods

Name and Signature Return Type Description
createFromJson(jsonObj, callback?) Seadragon.DziTileSource Creates a new Seadragon.DziTileSource from the given JSON object of the form:
{
    url: "http://example.com/foo.dzi",
    width: 5000,
    height: 4000,
    tileSize: 254,
    tileOverlap: 1,
    tileFormat: "png"
}
This is the same JSON format that's returned by the Zoom.it API.

The JSON object may optionally have a displayRects property if the DZI is a sparse image. This property should be an array of DisplayRect arrays, where a DisplayRect array is of the form [x, y, width, height, minLevel, maxLevel].

With this method, the XML of the DZI is never downloaded. (The location of the XML, given by the url property, is still needed in order to determine the location of the tiles.)

If a callback function is given, the Seadragon.DziTileSource is passed as the sole parameter to the callback upon completion. Otherwise, the Seadragon.DziTileSource is returned by this method.

If there was an error with the JSON and a callback function was given, null is passed to the callback along with an optional error message as a second parameter. If there was an error with the JSON and no callback function was given, an error is thrown.
createFromXml(xmlUrl, xmlString?, callback?) Seadragon.DziTileSource Creates a new Seadragon.DziTileSource from the XML file at the given URL. If the contents of the XML are given, the XML is not actually downloaded; otherwise, it is. (The location of the XML is needed in either case to determine the location of the tiles.)

If a callback function is given, the XML is loaded/parsed asynchronously, and the Seadragon.DziTileSource is passed as the sole parameter to the callback upon completion. Otherwise, the XML is loaded/parsed synchronously and the Seadragon.DziTileSource is returned by this method.

If the XML fails to load/parse and a callback function was given, null is passed to the callback along with an optional error message as a second parameter. If the XML fails to load/parse and no callback function was given, an error is thrown.
getTilesUrl(xmlUrl) String Given the XML URL of a DZI (e.g. "http://example.com/foo.dzi"), returns the URL of the DZI's tiles (e.g. "http://example.com/foo_files/").