API Docs for: 7.2
Show:

MQA.TileLayer Class

Module: MQA

The standard TileLayer implementation. Provides an attach method to add the tile layer to the Display. Once attached the provided TileLayerPeer is used to manage and detach the TileLayer from the Display.

Constructor

MQA.TileLayer

(
  • options
)

Parameters:

  • options Object

    configuration options for the tile layer

    • key String

      the unique string to represent the layer.

    • [type] String default = ''

      the tile type, used for url generation in OSM style tile urls.

    • display
    • [tileCls] Function default = MQA.MapTile

      provide a Tile constructor to use

    • [zindex] String default = 'tiles'

      provide a zindex level to attach tile (see: MQA.ZIndex).

Methods

attach

() Object

Attach the layer to the Display.

Returns <Object>

the TileLayer instance

clearCache

()

Empties the existing tile cache, and removes all tile img elements from the display div container.

collectTiles

(
  • ulX
  • ulY
  • width
  • height
  • tileCallback
)

Determines which tiles are needed to cover the map viewport, creating a Tile instance for each one, and then passing it to the provided callback.

Parameters:

  • ulX Number

    the upper left x coord of the current viewport

  • ulY Number

    the upper left y coord of the current viewport

  • width Number

    the current width of the viewport

  • height Number

    the current height of the viewport

  • tileCallback Function

    the function to execute on each Tile instance

detach

() Boolean

Detach the layer from the Display. The Display will call the layer's dispose method once the layer is detached.

Returns <Boolean>

true if the layer was detached, false otherwise.

dispose

()

Disposes of the DOM elements contained by the layer.

placeTile

(
  • tileElt
  • tileCoords
  • displayProjection
  • transform
)
private

Given a constructed tile img element, calculates the upper left XY of the tile in local div space, and positions the img element appropriately in the map display viewport.

Parameters:

  • tileElt Element

    the DOM Element representing the tile (usually an img element)

  • tileCoords Array

    an array containing the x/y coords of the tile in tile space.

  • displayProjection MQA.DisplayProjection

    the display projection

  • transform Transform

    the Transform instance for the current resolution level

removeTiles

(
  • l
  • t
  • r
  • b
)

Removes tile images which are out of display

Parameters:

resetTransform

(
  • newTransform
)

Recreates the internal Transform instance, caused by a zoom level change.

Parameters:

  • newTransform Transform

    the new Transform instance with the correct resolution

setViewport

(
  • ulX
  • ulY
  • width
  • height
)

Changes the visible tiles in the viewport.

Parameters: