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:
@@ -247,7 +247,15 @@ OpenLayers.Layer.Grid.prototype =
|
|||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @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() {
|
spiralTileLoad: function() {
|
||||||
var tileQueue = new Array();
|
var tileQueue = new Array();
|
||||||
@@ -279,6 +287,8 @@ OpenLayers.Layer.Grid.prototype =
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if the test grid coordinates are within the bounds of the
|
||||||
|
// grid, get a reference to the tile.
|
||||||
var tile = null;
|
var tile = null;
|
||||||
if ((testRow < this.grid.length) &&
|
if ((testRow < this.grid.length) &&
|
||||||
(testCell < this.grid[0].length)) {
|
(testCell < this.grid[0].length)) {
|
||||||
@@ -286,12 +296,16 @@ OpenLayers.Layer.Grid.prototype =
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((tile != null) && (!tile.queued)) {
|
if ((tile != null) && (!tile.queued)) {
|
||||||
|
//add tile to beginning of queue, mark it as queued.
|
||||||
tileQueue.unshift(tile);
|
tileQueue.unshift(tile);
|
||||||
tile.queued = true;
|
tile.queued = true;
|
||||||
|
|
||||||
|
//restart the directions counter and take on the new coords
|
||||||
directionsTried = 0;
|
directionsTried = 0;
|
||||||
iRow = testRow;
|
iRow = testRow;
|
||||||
iCell = testCell;
|
iCell = testCell;
|
||||||
} else {
|
} else {
|
||||||
|
//need to try to load a tile in a different direction
|
||||||
direction = (direction + 1) % 4;
|
direction = (direction + 1) % 4;
|
||||||
directionsTried++;
|
directionsTried++;
|
||||||
}
|
}
|
||||||
@@ -301,6 +315,7 @@ OpenLayers.Layer.Grid.prototype =
|
|||||||
for(var i=0; i < tileQueue.length; i++) {
|
for(var i=0; i < tileQueue.length; i++) {
|
||||||
var tile = tileQueue[i]
|
var tile = tileQueue[i]
|
||||||
tile.draw();
|
tile.draw();
|
||||||
|
//mark tile as unqueued for the next time (since tiles are reused)
|
||||||
tile.queued = false;
|
tile.queued = false;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user