rearranging order of some functions, marking some of them private
git-svn-id: http://svn.openlayers.org/trunk/openlayers@891 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -24,6 +24,7 @@ OpenLayers.Layer.Grid.prototype =
|
||||
* @type boolean */
|
||||
alpha: false,
|
||||
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*
|
||||
@@ -196,90 +197,6 @@ OpenLayers.Layer.Grid.prototype =
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {Boolean} prepend if true, prepend to beginning.
|
||||
* if false, then append to end
|
||||
*/
|
||||
insertRow:function(prepend) {
|
||||
var modelRowIndex = (prepend) ? 0 : (this.grid.length - 1);
|
||||
var modelRow = this.grid[modelRowIndex];
|
||||
|
||||
var newRow = new Array();
|
||||
|
||||
var resolution = this.map.getResolution();
|
||||
var deltaY = (prepend) ? -this.tileSize.h : this.tileSize.h;
|
||||
var deltaLat = resolution * -deltaY;
|
||||
|
||||
for (var i=0; i < modelRow.length; i++) {
|
||||
var modelTile = modelRow[i];
|
||||
var bounds = modelTile.bounds.copyOf();
|
||||
var position = modelTile.position.copyOf();
|
||||
bounds.bottom = bounds.bottom + deltaLat;
|
||||
bounds.top = bounds.top + deltaLat;
|
||||
position.y = position.y + deltaY;
|
||||
var newTile = this.addTile(bounds, position);
|
||||
newTile.draw(this.alpha);
|
||||
newRow.append(newTile);
|
||||
}
|
||||
|
||||
if (newRow.length>0){
|
||||
if (prepend) {
|
||||
this.grid.prepend(newRow);
|
||||
} else {
|
||||
this.grid.append(newRow);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {Boolean} prepend if true, prepend to beginning.
|
||||
* if false, then append to end
|
||||
*/
|
||||
insertColumn:function(prepend) {
|
||||
var modelCellIndex;
|
||||
var deltaX = (prepend) ? -this.tileSize.w : this.tileSize.w;
|
||||
var resolution = this.map.getResolution();
|
||||
var deltaLon = resolution * deltaX;
|
||||
|
||||
for (var i=0; i<this.grid.length; i++) {
|
||||
var row = this.grid[i];
|
||||
modelTileIndex = (prepend) ? 0 : (row.length - 1);
|
||||
var modelTile = row[modelTileIndex];
|
||||
|
||||
var bounds = modelTile.bounds.copyOf();
|
||||
var position = modelTile.position.copyOf();
|
||||
bounds.left = bounds.left + deltaLon;
|
||||
bounds.right = bounds.right + deltaLon;
|
||||
position.x = position.x + deltaX;
|
||||
var newTile = this.addTile(bounds, position);
|
||||
newTile.draw(this.alpha);
|
||||
|
||||
if (prepend) {
|
||||
row = row.prepend(newTile);
|
||||
} else {
|
||||
row = row.append(newTile);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/** go through and remove all tiles from the grid, calling
|
||||
* destroy() on each of them to kill circular references
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
clearGrid:function() {
|
||||
if (this.grid) {
|
||||
while(this.grid.length > 0) {
|
||||
var row = this.grid[0];
|
||||
while(row.length > 0) {
|
||||
var tile = row[0];
|
||||
tile.destroy();
|
||||
row.remove(tile);
|
||||
}
|
||||
this.grid.remove(row);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* addTile gives subclasses of Grid the opportunity to create an
|
||||
@@ -296,6 +213,12 @@ OpenLayers.Layer.Grid.prototype =
|
||||
},
|
||||
|
||||
|
||||
/********************************************************/
|
||||
/* */
|
||||
/* Baselayer Functions */
|
||||
/* */
|
||||
/********************************************************/
|
||||
|
||||
/**
|
||||
* @returns Degrees per Pixel
|
||||
* @type float
|
||||
@@ -335,6 +258,95 @@ OpenLayers.Layer.Grid.prototype =
|
||||
return zoom;
|
||||
},
|
||||
|
||||
/** go through and remove all tiles from the grid, calling
|
||||
* destroy() on each of them to kill circular references
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
clearGrid:function() {
|
||||
if (this.grid) {
|
||||
while(this.grid.length > 0) {
|
||||
var row = this.grid[0];
|
||||
while(row.length > 0) {
|
||||
var tile = row[0];
|
||||
tile.destroy();
|
||||
row.remove(tile);
|
||||
}
|
||||
this.grid.remove(row);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* @private
|
||||
*
|
||||
* @param {Boolean} prepend if true, prepend to beginning.
|
||||
* if false, then append to end
|
||||
*/
|
||||
insertRow:function(prepend) {
|
||||
var modelRowIndex = (prepend) ? 0 : (this.grid.length - 1);
|
||||
var modelRow = this.grid[modelRowIndex];
|
||||
|
||||
var newRow = new Array();
|
||||
|
||||
var resolution = this.map.getResolution();
|
||||
var deltaY = (prepend) ? -this.tileSize.h : this.tileSize.h;
|
||||
var deltaLat = resolution * -deltaY;
|
||||
|
||||
for (var i=0; i < modelRow.length; i++) {
|
||||
var modelTile = modelRow[i];
|
||||
var bounds = modelTile.bounds.copyOf();
|
||||
var position = modelTile.position.copyOf();
|
||||
bounds.bottom = bounds.bottom + deltaLat;
|
||||
bounds.top = bounds.top + deltaLat;
|
||||
position.y = position.y + deltaY;
|
||||
var newTile = this.addTile(bounds, position);
|
||||
newTile.draw(this.alpha);
|
||||
newRow.append(newTile);
|
||||
}
|
||||
|
||||
if (newRow.length>0){
|
||||
if (prepend) {
|
||||
this.grid.prepend(newRow);
|
||||
} else {
|
||||
this.grid.append(newRow);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* @private
|
||||
*
|
||||
* @param {Boolean} prepend if true, prepend to beginning.
|
||||
* if false, then append to end
|
||||
*/
|
||||
insertColumn:function(prepend) {
|
||||
var modelCellIndex;
|
||||
var deltaX = (prepend) ? -this.tileSize.w : this.tileSize.w;
|
||||
var resolution = this.map.getResolution();
|
||||
var deltaLon = resolution * deltaX;
|
||||
|
||||
for (var i=0; i<this.grid.length; i++) {
|
||||
var row = this.grid[i];
|
||||
modelTileIndex = (prepend) ? 0 : (row.length - 1);
|
||||
var modelTile = row[modelTileIndex];
|
||||
|
||||
var bounds = modelTile.bounds.copyOf();
|
||||
var position = modelTile.position.copyOf();
|
||||
bounds.left = bounds.left + deltaLon;
|
||||
bounds.right = bounds.right + deltaLon;
|
||||
position.x = position.x + deltaX;
|
||||
var newTile = this.addTile(bounds, position);
|
||||
newTile.draw(this.alpha);
|
||||
|
||||
if (prepend) {
|
||||
row = row.prepend(newTile);
|
||||
} else {
|
||||
row = row.append(newTile);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/** @final @type String */
|
||||
CLASS_NAME: "OpenLayers.Layer.Grid"
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user