From da6f4cc764001b69989d56c7f7b2f223f2563835 Mon Sep 17 00:00:00 2001 From: Tom Payne Date: Sun, 7 Apr 2013 18:10:19 +0200 Subject: [PATCH] Make maximum number of tiles loading a parameter to loadMoreTiles --- src/ol/map.js | 3 +-- src/ol/tilequeue.js | 16 ++++------------ 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/src/ol/map.js b/src/ol/map.js index eb16d3c95b..598c5dd276 100644 --- a/src/ol/map.js +++ b/src/ol/map.js @@ -304,7 +304,6 @@ ol.Map = function(options) { * @type {ol.TileQueue} */ this.tileQueue_ = new ol.TileQueue( - ol.MAXIMUM_TILES_LOADING, goog.bind(this.getTilePriority, this), goog.bind(this.handleTileChange_, this)); @@ -598,7 +597,7 @@ ol.Map.prototype.handlePostRender = function() { } this.tileQueue_.reprioritize(); // FIXME only call if needed - this.tileQueue_.loadMoreTiles(limit); + this.tileQueue_.loadMoreTiles(limit, ol.MAXIMUM_TILES_LOADING); var postRenderFunctions = this.postRenderFunctions_; var i; diff --git a/src/ol/tilequeue.js b/src/ol/tilequeue.js index 94274ca6d7..672d658e9e 100644 --- a/src/ol/tilequeue.js +++ b/src/ol/tilequeue.js @@ -18,15 +18,12 @@ ol.TilePriorityFunction; /** * @constructor * @extends {ol.structs.PriorityQueue} - * @param {number} maxTilesLoading Maximum number of simultaneously loading - * tiles. * @param {ol.TilePriorityFunction} tilePriorityFunction * Tile priority function. * @param {Function} tileChangeCallback * Function called on each tile change event. */ -ol.TileQueue = - function(maxTilesLoading, tilePriorityFunction, tileChangeCallback) { +ol.TileQueue = function(tilePriorityFunction, tileChangeCallback) { goog.base( this, @@ -51,12 +48,6 @@ ol.TileQueue = */ this.tileChangeCallback_ = tileChangeCallback; - /** - * @private - * @type {number} - */ - this.maxTilesLoading_ = maxTilesLoading; - /** * @private * @type {number} @@ -78,12 +69,13 @@ ol.TileQueue.prototype.handleTileChange = function() { /** * @param {number} limit Maximum number of new tiles to load. + * @param {number} maxTilesLoading Maximum number tiles to load simultaneously. */ -ol.TileQueue.prototype.loadMoreTiles = function(limit) { +ol.TileQueue.prototype.loadMoreTiles = function(limit, maxTilesLoading) { var tile; while (limit > 0 && !this.isEmpty() && - this.tilesLoading_ < this.maxTilesLoading_) { + this.tilesLoading_ < maxTilesLoading) { tile = /** @type {ol.Tile} */ (this.dequeue()[0]); goog.events.listenOnce(tile, goog.events.EventType.CHANGE, this.handleTileChange, false, this);