Make maximum number of tiles loading a parameter to loadMoreTiles
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user