add comments for spiralTileLoad() function
git-svn-id: http://svn.openlayers.org/branches/openlayers/2.0@1285 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -246,8 +246,16 @@ OpenLayers.Layer.Grid.prototype =
|
||||
this.spiralTileLoad();
|
||||
},
|
||||
|
||||
/**
|
||||
/**
|
||||
* @private
|
||||
*
|
||||
* Starts at the top right corner of the grid and proceeds in a spiral
|
||||
* towards the center, adding tiles one at a time to the beginning of a
|
||||
* queue.
|
||||
*
|
||||
* Once all the grid's tiles have been added to the queue, we go back
|
||||
* and iterate through the queue (thus reversing the spiral order from
|
||||
* outside-in to inside-out), calling draw() on each tile.
|
||||
*/
|
||||
spiralTileLoad: function() {
|
||||
var tileQueue = new Array();
|
||||
@@ -279,6 +287,8 @@ OpenLayers.Layer.Grid.prototype =
|
||||
break;
|
||||
}
|
||||
|
||||
// if the test grid coordinates are within the bounds of the
|
||||
// grid, get a reference to the tile.
|
||||
var tile = null;
|
||||
if ((testRow < this.grid.length) &&
|
||||
(testCell < this.grid[0].length)) {
|
||||
@@ -286,12 +296,16 @@ OpenLayers.Layer.Grid.prototype =
|
||||
}
|
||||
|
||||
if ((tile != null) && (!tile.queued)) {
|
||||
//add tile to beginning of queue, mark it as queued.
|
||||
tileQueue.unshift(tile);
|
||||
tile.queued = true;
|
||||
|
||||
//restart the directions counter and take on the new coords
|
||||
directionsTried = 0;
|
||||
iRow = testRow;
|
||||
iCell = testCell;
|
||||
} else {
|
||||
//need to try to load a tile in a different direction
|
||||
direction = (direction + 1) % 4;
|
||||
directionsTried++;
|
||||
}
|
||||
@@ -301,6 +315,7 @@ OpenLayers.Layer.Grid.prototype =
|
||||
for(var i=0; i < tileQueue.length; i++) {
|
||||
var tile = tileQueue[i]
|
||||
tile.draw();
|
||||
//mark tile as unqueued for the next time (since tiles are reused)
|
||||
tile.queued = false;
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user