Skip to main content

Seadragon.TileSource class

Version 0.8.8 - Back to Seadragon Ajax API Reference

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

SignatureDescription
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

NameTypeDescription
widthNumberThe width of the content.
heightNumberThe height of the content.
aspectRatioNumberThe aspect ratio of the content (width/height).
dimensions Seadragon.PointThe natural dimensions of the content (width, height).
minLevelNumberThe minimum level for which tiles exist. The default value is 0.
maxLevelNumberThe maximum level for which tiles exist. The default value is that required to display the content at its natural dimensions.
tileSizeNumberThe size of the tiles, in pixels.
tileOverlapNumberThe overlap of the tiles on each edge, in pixels.

Methods

Name and SignatureReturn TypeDescription
getLevelScale(level)NumberReturns 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.PointReturns the number of tiles at the given level in each dimension.
getPixelRatio(level) Seadragon.PointReturns 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.PointReturns 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.RectReturns the bounds (position and size) of the given tile in normalized coordinates.
getTileUrl(level, x, y)StringReturns the URL for the given tile, or null if the URL is not known. Subclasses must override this method.
tileExists(level, x, y)BooleanReturns 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.