Removing getBoundsFromBaseLayer method.

This method is only needed when the deprecated reproject option is set to true.
This commit is contained in:
ahocevar
2011-11-18 13:06:28 +01:00
parent f713360c67
commit 4f58ff0352
10 changed files with 105 additions and 156 deletions

View File

@@ -1053,6 +1053,49 @@ if (window.Event) {
var Event = OpenLayers.Event;
}
/**
* Namespace: OpenLayers.Tile
*/
OpenLayers.Util.extend(OpenLayers.Tile.prototype, {
/**
* Method: getBoundsFromBaseLayer
* Take the pixel locations of the corner of the tile, and pass them to
* the base layer and ask for the location of those pixels, so that
* displaying tiles over Google works fine.
*
* Parameters:
* position - {<OpenLayers.Pixel>}
*
* Returns:
* bounds - {<OpenLayers.Bounds>}
*/
getBoundsFromBaseLayer: function(position) {
var msg = OpenLayers.i18n('reprojectDeprecated',
{'layerName':this.layer.name});
OpenLayers.Console.warn(msg);
var topLeft = this.layer.map.getLonLatFromLayerPx(position);
var bottomRightPx = position.clone();
bottomRightPx.x += this.size.w;
bottomRightPx.y += this.size.h;
var bottomRight = this.layer.map.getLonLatFromLayerPx(bottomRightPx);
// Handle the case where the base layer wraps around the date line.
// Google does this, and it breaks WMS servers to request bounds in
// that fashion.
if (topLeft.lon > bottomRight.lon) {
if (topLeft.lon < 0) {
topLeft.lon = -180 - (topLeft.lon+180);
} else {
bottomRight.lon = 180+bottomRight.lon+180;
}
}
var bounds = new OpenLayers.Bounds(topLeft.lon,
bottomRight.lat,
bottomRight.lon,
topLeft.lat);
return bounds;
}
});
/**
* Class: OpenLayers.Control.MouseDefaults
* This class is DEPRECATED in 2.4 and will be removed by 3.0.