Changed OpenLayers.Bounds to use left, bottom, right, top INSTEAD OF minlon, minlat, maxlon, maxlat. Removed OpenLayers.Box which was not getting used. JSDOC/coding standard-ified the OpenLayers.Bounds code and wrote thorough testing for it. Should be all good.
git-svn-id: http://svn.openlayers.org/trunk/openlayers@140 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -43,16 +43,16 @@ OpenLayers.Layer.Grid.prototype = Object.extend( new OpenLayers.Layer(), {
|
||||
this._initTiles();
|
||||
} else {
|
||||
var i = 0;
|
||||
while (this.getGridBounds().minlat > bounds.minlat) {
|
||||
while (this.getGridBounds().bottom > bounds.bottom) {
|
||||
this.insertRow(false);
|
||||
}
|
||||
while (this.getGridBounds().minlon > bounds.minlon) {
|
||||
while (this.getGridBounds().left > bounds.left) {
|
||||
this.insertColumn(true);
|
||||
}
|
||||
while (this.getGridBounds().maxlat < bounds.maxlat) {
|
||||
while (this.getGridBounds().top < bounds.top) {
|
||||
this.insertRow(true);
|
||||
}
|
||||
while (this.getGridBounds().maxlon < bounds.maxlon) {
|
||||
while (this.getGridBounds().right < bounds.right) {
|
||||
this.insertColumn(false);
|
||||
}
|
||||
}
|
||||
@@ -60,10 +60,10 @@ OpenLayers.Layer.Grid.prototype = Object.extend( new OpenLayers.Layer(), {
|
||||
getGridBounds:function() {
|
||||
var topLeftTile = this.grid[0][0];
|
||||
var bottomRightTile = this.grid[this.grid.length-1][this.grid[0].length-1];
|
||||
return new OpenLayers.Bounds(topLeftTile.bounds.minlon,
|
||||
bottomRightTile.bounds.minlat,
|
||||
bottomRightTile.bounds.maxlon,
|
||||
topLeftTile.bounds.maxlat);
|
||||
return new OpenLayers.Bounds(topLeftTile.bounds.left,
|
||||
bottomRightTile.bounds.bottom,
|
||||
bottomRightTile.bounds.right,
|
||||
topLeftTile.bounds.top);
|
||||
},
|
||||
_initTiles:function() {
|
||||
var viewSize = this.map.getSize();
|
||||
@@ -73,17 +73,17 @@ OpenLayers.Layer.Grid.prototype = Object.extend( new OpenLayers.Layer(), {
|
||||
var tilelon = resolution*this.tileSize.w;
|
||||
var tilelat = resolution*this.tileSize.h;
|
||||
|
||||
var offsetlon = bounds.minlon - extent.minlon;
|
||||
var offsetlon = bounds.left - extent.left;
|
||||
var tilecol = Math.floor(offsetlon/tilelon);
|
||||
var tilecolremain = offsetlon/tilelon - tilecol;
|
||||
var tileoffsetx = -tilecolremain * this.tileSize.w;
|
||||
var tileoffsetlon = extent.minlon + tilecol * tilelon;
|
||||
var tileoffsetlon = extent.left + tilecol * tilelon;
|
||||
|
||||
var offsetlat = bounds.maxlat - (extent.minlat + tilelat);
|
||||
var offsetlat = bounds.top - (extent.bottom + tilelat);
|
||||
var tilerow = Math.ceil(offsetlat/tilelat);
|
||||
var tilerowremain = tilerow - offsetlat/tilelat;
|
||||
var tileoffsety = -tilerowremain * this.tileSize.h;
|
||||
var tileoffsetlat = extent.minlat + tilerow * tilelat;
|
||||
var tileoffsetlat = extent.bottom + tilerow * tilelat;
|
||||
|
||||
tileoffsetx = Math.round(tileoffsetx); // heaven help us
|
||||
tileoffsety = Math.round(tileoffsety);
|
||||
@@ -113,11 +113,11 @@ OpenLayers.Layer.Grid.prototype = Object.extend( new OpenLayers.Layer(), {
|
||||
|
||||
tileoffsetlon += tilelon;
|
||||
tileoffsetx += this.tileSize.w;
|
||||
} while (tileoffsetlon < bounds.maxlon)
|
||||
} while (tileoffsetlon < bounds.right)
|
||||
|
||||
tileoffsetlat -= tilelat;
|
||||
tileoffsety += this.tileSize.h;
|
||||
} while(tileoffsetlat > bounds.minlat - tilelat)
|
||||
} while(tileoffsetlat > bounds.bottom - tilelat)
|
||||
|
||||
},
|
||||
|
||||
@@ -139,8 +139,8 @@ OpenLayers.Layer.Grid.prototype = Object.extend( new OpenLayers.Layer(), {
|
||||
var modelTile = modelRow[i];
|
||||
var bounds = modelTile.bounds.copyOf();
|
||||
var position = modelTile.position.copyOf();
|
||||
bounds.minlat = bounds.minlat + deltaLat;
|
||||
bounds.maxlat = bounds.maxlat + deltaLat;
|
||||
bounds.bottom = bounds.bottom + deltaLat;
|
||||
bounds.top = bounds.top + deltaLat;
|
||||
position.y = position.y + deltaY;
|
||||
var newTile = this.addTile(bounds, position);
|
||||
newRow.append(newTile);
|
||||
@@ -172,8 +172,8 @@ OpenLayers.Layer.Grid.prototype = Object.extend( new OpenLayers.Layer(), {
|
||||
|
||||
var bounds = modelTile.bounds.copyOf();
|
||||
var position = modelTile.position.copyOf();
|
||||
bounds.minlon = bounds.minlon + deltaLon;
|
||||
bounds.maxlon = bounds.maxlon + deltaLon;
|
||||
bounds.left = bounds.left + deltaLon;
|
||||
bounds.right = bounds.right + deltaLon;
|
||||
position.x = position.x + deltaX;
|
||||
var newTile = this.addTile(bounds, position);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user