Seadragon.TileSource class

Version - Back to Seadragon Ajax Library

Overview

An abstract class that describes tiled content. This class handles common tiling math, but all of its properties and methods can be overridden by subclasses.

Constructors

Signature Description
Seadragon.TileSource(width, height, tileSize, tileOverlap, minLevel?, maxLevel?) Creates a TileSource for content of the given width and height, using tiles having the given size and overlap. The minimum and maximum levels for tiles can be supplied, otherwise default values of based on the width and height are used.

Properties

Name Type Description
width Number The width of the content.
height Number The height of the content.
aspectRatio Number The aspect ratio of the content (width/height).
dimensions Seadragon.Point The natural dimensions of the content (width, height).
minLevel Number The minimum level for which tiles exist. The default value is 0.
maxLevel Number The maximum level for which tiles exist. The default value is that required to display the content at its natural dimensions.
tileSize Number The size of the tiles, in pixels.
tileOverlap Number The overlap of the tiles on each edge, in pixels.

Methods

Name and Signature Return Type Description
getLevelScale(level) Number Returns the scale by which all dimensions should be multiplied for the given level. This value increases with the level and is 1 at the default maximum level.
getNumTiles(level) Seadragon.Point Returns the number of tiles at the given level in each dimension.
getPixelRatio(level) Seadragon.Point Returns the ratio of one pixel to the size of the content at the given level, in both dimensions. For example, at level 0, the ratio is at least 1 in both dimensions, and at the default maximum level, the ratio is exactly the inverse of the content's natural size.
getTileAtPoint(level, point) Seadragon.Point Returns the tile at the given level containing the given normalized point. If there is more than one such tile due to tile overlap, returns the most top-left tile.
getTileBounds(level, x, y) Seadragon.Rect Returns the bounds (position and size) of the given tile in normalized coordinates.
getTileUrl(level, x, y) String Returns the URL for the given tile, or null if the URL is not known. Subclasses must override this method.
tileExists(level, x, y) Boolean Returns true if the given tile exists. The default behavior of this method is to simply check that the given tile is within the minimum and maximum levels and the bounds of the given level. Subclasses can override this method for more specific behavior.