New TileManager

This removes all tile queueing/loading specific code from Layer.Grid
and creates a new class that manages tile loading and caching.
This commit is contained in:
ahocevar
2012-11-29 14:52:53 -06:00
parent 2ee362a79b
commit 80fa251649
16 changed files with 499 additions and 311 deletions

View File

@@ -193,22 +193,20 @@ OpenLayers.Tile = OpenLayers.Class({
* is to call <clear> and return the result from <shouldDraw>.
*
* Parameters:
* immediately - {Boolean} When e.g. drawing was aborted by returning false
* from a *beforedraw* listener, the queue manager needs to pass true,
* so the tile will not be cleared and immediately be drawn. Otherwise,
* the tile will be cleared and a *beforedraw* event will be fired.
* force - {Boolean} No beforedraw event will be fired.
*
* Returns:
* {Boolean} Whether or not the tile should actually be drawn.
* {Boolean} Whether or not the tile should actually be drawn. Retruns null
* if a beforedraw listener returned false.
*/
draw: function(immediately) {
if (!immediately) {
draw: function(force) {
if (!force) {
//clear tile's contents and mark as not drawn
this.clear();
}
var draw = this.shouldDraw();
if (draw && !immediately) {
draw = this.events.triggerEvent("beforedraw") !== false;
if (draw && !force && this.events.triggerEvent("beforedraw") === false) {
draw = null;
}
return draw;
},