Add tests for initSingleTile function, which is where all the important singleTile logic is
This commit is contained in:
@@ -718,19 +718,18 @@ OpenLayers.Layer.Grid = OpenLayers.Class(OpenLayers.Layer.HTTPRequest, {
|
||||
*/
|
||||
initSingleTile: function(bounds) {
|
||||
this.clearTileQueue();
|
||||
//determine if a maxExtent restriction exists
|
||||
var maxExt = this.maxExtent || this.map.getMaxExtent() || this.map.maxExtent;
|
||||
|
||||
|
||||
//determine new tile bounds
|
||||
var tileWidth, tileHeight, tileBounds;
|
||||
var center = bounds.getCenterLonLat();
|
||||
|
||||
//adjust tile bounds to fit in maxExtent restriction
|
||||
//if it is an overlay and there is a maxExtent restriction
|
||||
if(this != this.map.baseLayer && maxExt && bounds.containsBounds(maxExt)) {
|
||||
bounds.bottom = Math.max(maxExt.bottom, bounds.bottom);
|
||||
bounds.top = Math.min(maxExt.top, bounds.top);
|
||||
bounds.left = Math.max(maxExt.left, bounds.left);
|
||||
bounds.right = Math.min(maxExt.right, bounds.right);
|
||||
//if there is a maxExtent restriction
|
||||
if(this.maxExtent && bounds.containsBounds(this.maxExtent, true)) {
|
||||
bounds.bottom = Math.max(this.maxExtent.bottom, bounds.bottom);
|
||||
bounds.top = Math.min(this.maxExtent.top, bounds.top);
|
||||
bounds.left = Math.max(this.maxExtent.left, bounds.left);
|
||||
bounds.right = Math.min(this.maxExtent.right, bounds.right);
|
||||
tileWidth = bounds.getWidth();
|
||||
tileHeight = bounds.getHeight();
|
||||
tileBounds = bounds;
|
||||
@@ -742,10 +741,10 @@ OpenLayers.Layer.Grid = OpenLayers.Class(OpenLayers.Layer.HTTPRequest, {
|
||||
lon : tileBounds.right,
|
||||
lat : tileBounds.top
|
||||
});
|
||||
this.tileSize = {
|
||||
h : Math.abs(trPx.y - blPx.y),
|
||||
w : Math.abs(trPx.x - blPx.x)
|
||||
};
|
||||
this.tileSize = new OpenLayers.Size(
|
||||
Math.abs(trPx.x - blPx.x),
|
||||
Math.abs(trPx.y - blPx.y)
|
||||
);
|
||||
this._resetTileSize = true;
|
||||
}
|
||||
else {
|
||||
@@ -760,6 +759,7 @@ OpenLayers.Layer.Grid = OpenLayers.Class(OpenLayers.Layer.HTTPRequest, {
|
||||
);
|
||||
if(this._resetTileSize === true) {
|
||||
this.setTileSize();
|
||||
delete this._resetTileSize;
|
||||
}
|
||||
}
|
||||
var px = this.map.getLayerPxFromLonLat({
|
||||
|
||||
Reference in New Issue
Block a user