tile

geo. tile

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

Description:
  • Computes the global coordinates of the bottom edge.

Source:
Properties:
Name Type Description
bottom number

The global coordinates of the bottom edge.

Computes the global coordinates of the bottom edge.

index

Description:
  • Return the index coordinates. Read only.

Source:
Properties:
Name Type Description
index object

The tile index.

Properties
Name Type Attributes 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.

Return the index coordinates. Read only.

left

Description:
  • Computes the global coordinates of the left edge.

Source:
Properties:
Name Type Description
left number

The global coordinates of the left edge.

Computes the global coordinates of the left edge.

overlap

Description:
  • Return the tile overlap. Read only.

Source:
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.

Return the tile overlap. Read only.

Description:
  • Computes the global coordinates of the right edge.

Source:
Properties:
Name Type Description
right number

The global coordinates of the right edge.

Computes the global coordinates of the right edge.

size

Description:
  • Return the tile size. Read only.

Source:
Properties:
Name Type Description
size object

The tile size.

Properties
Name Type Description
x number

The tile width.

y number

The tile height.

Return the tile size. Read only.

top

Description:
  • Computes the global coordinates of the top edge.

Source:
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}

Description:
  • Add a method to be called with the data when the ajax fails.

Source:
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}

Description:
  • Return whether this tile has been fetched already.

Source:
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

Source:
Properties:
Name Type Attributes Description
index object

The global position of the tile.

Properties
Name Type Description
x number

The x-coordinate (usually the column number).

y number

The y-coordinate (usually the row number).

size object

The size of each tile.

Properties
Name Type Description
x number

Width (usually in pixels).

y number

Height (usually in pixels).

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
Type:
  • object