new tile(spec) → {geo.tile}
- Description:
This class defines the raw interface for a "tile" on a map. A tile is defined as a quadrilateral section of a map. The base implementation is independent of the actual content of the tile, but assumes that the content is loaded asynchronously via a url. The tile object has a promise-like interface.
- Source:
Example
tile.then(function (data) {...}).catch(function (data) {...});
Parameters:
Name | Type | Description |
---|---|---|
spec |
geo.tile.spec | The tile specification. |
Returns:
- Type
- geo.tile
Members
bottom
Properties:
Name | Type | Description |
---|---|---|
bottom |
number | The global coordinates of the bottom edge. |
Computes the global coordinates of the bottom edge.
index
Properties:
Name | Type | Description | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
index |
object | The tile index. Properties
|
Return the index coordinates. Read only.
left
Properties:
Name | Type | Description |
---|---|---|
left |
number | The global coordinates of the left edge. |
Computes the global coordinates of the left edge.
overlap
Properties:
Name | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
overlap |
object | The tile overlap. Properties
|
Return the tile overlap. Read only.
right
Properties:
Name | Type | Description |
---|---|---|
right |
number | The global coordinates of the right edge. |
Computes the global coordinates of the right edge.
size
Properties:
Name | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
size |
object | The tile size. Properties
|
Return the tile size. Read only.
top
Properties:
Name | Type | Description |
---|---|---|
top |
number | The global coordinates of the top edge. |
Computes the global coordinates of the top edge.
Methods
bounds(index, shift) → {object}
- Description:
Return the bounds of the tile given an index offset and a translation.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
index |
object | The tile index containing (0, 0). |
shift |
object | The coordinates of (0, 0) inside the tile. |
Returns:
An object with left
, top
, right
, bottom
.
- Type
- object
catch(method) → {this}
Parameters:
Name | Type | Description |
---|---|---|
method |
function | The rejection handler. |
Returns:
- Type
- this
fadeIn(duration) → {this}
- Description:
Set the opacity of the tile to 0 and gradually fade in over the given number of milliseconds. This is just a delay.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
duration |
number | The duration of the animation in ms. |
Returns:
- Type
- this
fetch() → {this}
- Description:
Initiate the ajax request and add a promise interface to the tile object. This method exists to allow derived classes the ability to override how the tile is obtained. For example, imageTile uses an Image element rather than $.get.
- Source:
Returns:
- Type
- this
fetched() → {boolean}
Returns:
True if the tile has been fetched.
- Type
- boolean
then(onSuccessnullable, onFailurenullable) → {this}
- Description:
Add a method to be called with the data when the ajax request is successfully resolved.
- Source:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
onSuccess |
function |
<nullable> |
The success handler. |
onFailure |
function |
<nullable> |
The failure handler. |
Returns:
- Type
- this
toString() → {string}
- Description:
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.
- Source:
Returns:
- Type
- string
Type Definitions
spec
Properties:
Name | Type | Attributes | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
index |
object | The global position of the tile. Properties
|
|||||||||||||
size |
object | The size of each tile. Properties
|
|||||||||||||
url |
object | string | A url or jQuery ajax config object. |
|||||||||||||
overlap |
object |
<optional> |
The size of overlap with neighboring tiles. Properties
|
Type:
- object