new geo.imageTile(spec)
This class defines a tile that is part of a standard "image pyramid", such
as an open street map tile set. Every tile is uniquely indexed by a row,
column, and zoom level. The number of rows/columns at zoom level z is
2^z
, the number of pixels per tile is configurable.
By default, this class assumes that images are fetched from the url, but subclasses may define additional rendering steps to produce the images before passing them off to the handlers.
Name | Type | Description |
---|---|---|
spec |
geo.imageTile.spec |
The tile specification. |
Extends
Type Definitions
-
geo.imageTile.specgeo.tile.spec
-
Properties:
Name Type Argument Default Description index
object The global position of the tile.
Properties
Name Type Description x
number The x-coordinate (the column number).
y
number The y-coordinate (the row number).
level
number The zoom level.
size
object <optional>
The size of each tile.
Properties
Name Type Argument Default Description x
number <optional>
256 Width in pixels.
y
number <optional>
256 Height in pixels.
crossDomain
string <optional>
'anonymous' Image CORS attribute. This is used for the
crossorigin
property when loading images.url
object | string A url or jQuery ajax config object.
overlap
object <optional>
The size of overlap with neighboring tiles.
Properties
Name Type Default Description x
number 0 y
number 0
Members
-
inherited bottom
-
Computes the global coordinates of the bottom edge.
Properties:
Name Type Description bottom
number The global coordinates of the bottom edge.
-
image
-
Read only accessor to the Image object used by the tile. Note, this method does not guarantee that the image data is available. Use the promise interface to add asynchronous handlers.
Properties:
Name Type Description image
Image The image object used by the tile.
-
inherited index
-
Return the index coordinates. Read only.
Properties:
Name Type Description index
object The tile index.
Properties
Name Type Argument Description x
number The tile x index.
y
number The tile y index.
level
number <optional>
The tile level index.
reference
number <optional>
The tile reference index.
-
inherited left
-
Computes the global coordinates of the left edge.
Properties:
Name Type Description left
number The global coordinates of the left edge.
-
inherited overlap
-
Return the tile overlap. Read only.
Properties:
Name Type Description overlap
object The tile overlap.
Properties
Name Type Description x
number The tile x overlap.
y
number The tile y overlap.
-
inherited right
-
Computes the global coordinates of the right edge.
Properties:
Name Type Description right
number The global coordinates of the right edge.
-
inherited size
-
Return the tile size. Read only.
Properties:
Name Type Description size
object The tile size.
Properties
Name Type Description x
number The tile width.
y
number The tile height.
-
inherited top
-
Computes the global coordinates of the top edge.
Properties:
Name Type Description top
number The global coordinates of the top edge.
Methods
-
Return the bounds of the tile given an index offset and a translation.
Name Type Description index
object The tile index containing (0, 0).
shift
object The coordinates of (0, 0) inside the tile.
Returns:
Type Description object An object with left
,top
,right
,bottom
. -
Add a method to be called with the data when the ajax fails.
Name Type Description method
function The rejection handler.
Returns:
Type Description this -
fadeIn(duration){this}
-
Set the opacity of the tile to 0 and gradually fade in over the given number of milliseconds. This will also resolve the embedded promise interface.
Name Type Description duration
number The duration of the animation in ms.
Returns:
Type Description this -
fetch(){this}
-
Initiate the image request.
Returns:
Type Description this -
Return whether this tile has been fetched already.
Returns:
Type Description boolean True if the tile has been fetched. -
Add a method to be called with the data when the ajax request is successfully resolved.
Name Type Description onSuccess
function nullable The success handler.
onFailure
function nullable The failure handler.
Returns:
Type Description this -
Return a unique string representation of the given tile usable as a hash key. Possibly extend later to include url information to make caches aware of the tile source.
Returns:
Type Description string