Provides queueing of image requests and caching of image elements.
Queueing avoids unnecessary image requests while changing zoom levels quickly, and helps improve dragging performance on mobile devices that show a lag in dragging when loading of new images starts. zoomDelay and moveDelay are the configuration options to control this behavior.
Caching avoids setting the src on image elements for images that have already been used. Several maps can share a TileManager instance, in which case each map gets its own tile queue, but all maps share the same tile cache.
OpenLayers. | Provides queueing of image requests and caching of image elements. |
Properties | |
cacheSize | {Number} Number of image elements to keep referenced in this instance’s cache for fast reuse. |
tilesPerFrame | {Number} Number of queued tiles to load per frame (see frameDelay). |
frameDelay | {Number} Delay between tile loading frames (see tilesPerFrame) in milliseconds. |
moveDelay | {Number} Delay in milliseconds after a map’s move event before loading tiles. |
zoomDelay | {Number} Delay in milliseconds after a map’s zoomend event before loading tiles. |
maps | {Array(OpenLayers.Map)} The maps to manage tiles on. |
tileQueueId | {Object} The ids of the drawTilesFromQueue loop, keyed by map id. |
tileQueue | {Object(Array(OpenLayers.Tile))} Tiles queued for drawing, keyed by map id. |
tileCache | {Object} Cached image elements, keyed by URL. |
tileCacheIndex | {Array(String)} URLs of cached tiles. |
Constructor | |
OpenLayers. | Constructor for a new OpenLayers.TileManager instance. |
Functions | |
addMap | Binds this instance to a map |
removeMap | Unbinds this instance from a map |
move | Handles the map’s move event |
zoomEnd | Handles the map’s zoomEnd event |
changeLayer | Handles the map’s changeLayer event |
addLayer | Handles the map’s addlayer event |
removeLayer | Handles the map’s preremovelayer event |
updateTimeout | Applies the moveDelay or zoomDelay to the drawTilesFromQueue loop, and schedules more queue processing after frameDelay if there are still tiles in the queue. |
addTile | Listener for the layer’s addtile event |
unloadTile | Listener for the tile’s unload event |
queueTileDraw | Adds a tile to the queue that will draw it. |
drawTilesFromQueue | Draws tiles from the tileQueue, and unqueues the tiles |
manageTileCache | Adds, updates, removes and fetches cache entries. |
addToCache | |
clearTileQueue | Clears the tile queue from tiles of a specific layer |
destroy |
{Number} Number of queued tiles to load per frame (see frameDelay). Default is 2.
{Number} Delay between tile loading frames (see tilesPerFrame) in milliseconds. Default is 16.
{Array(OpenLayers.Map)} The maps to manage tiles on.
{Object} The ids of the drawTilesFromQueue loop, keyed by map id.
{Object(Array(OpenLayers.Tile))} Tiles queued for drawing, keyed by map id.
Constructor for a new OpenLayers.TileManager instance.
options | {Object} Configuration for this instance. |
updateTimeout: function( map, delay, nice )
Applies the moveDelay or zoomDelay to the drawTilesFromQueue loop, and schedules more queue processing after frameDelay if there are still tiles in the queue.
map | {OpenLayers.Map} The map to update the timeout for |
delay | {Number} The delay to apply |
nice | {Boolean} If true, the timeout function will only be created if the tilequeue is not empty. This is used by the move handler to avoid impacts on dragging performance. For other events, the tile queue may not be populated yet, so we need to set the timer regardless of the queue size. |
Draws tiles from the tileQueue, and unqueues the tiles
drawTilesFromQueue: function( map )
Binds this instance to a map
addMap: function( map )
Unbinds this instance from a map
removeMap: function( map )
Handles the map’s move event
move: function( evt )
Handles the map’s zoomEnd event
zoomEnd: function( evt )
Handles the map’s changeLayer event
changeLayer: function( evt )
Handles the map’s addlayer event
addLayer: function( evt )
Handles the map’s preremovelayer event
removeLayer: function( evt )
Applies the moveDelay or zoomDelay to the drawTilesFromQueue loop, and schedules more queue processing after frameDelay if there are still tiles in the queue.
updateTimeout: function( map, delay, nice )
Listener for the layer’s addtile event
addTile: function( evt )
Listener for the tile’s unload event
unloadTile: function( evt )
Adds a tile to the queue that will draw it.
queueTileDraw: function( evt )
Adds, updates, removes and fetches cache entries.
manageTileCache: function( evt )
addToCache: function( evt )
Clears the tile queue from tiles of a specific layer
clearTileQueue: function( evt )
destroy: function()