replace Pixel argument with simple object (Map.getLonLatFromViewPortPx)

This commit is contained in:
fredj
2012-01-06 13:53:24 +01:00
committed by Frederic Junod
parent 1df5cfa158
commit 8ef0ad8c17
2 changed files with 14 additions and 19 deletions

View File

@@ -213,25 +213,19 @@ OpenLayers.Layer.FixedZoomLevels = OpenLayers.Class({
* bounds of the current viewPort.
*/
getExtent: function () {
var extent = null;
var size = this.map.getSize();
var tl = this.getLonLatFromViewPortPx({
x: 0, y: 0
});
var br = this.getLonLatFromViewPortPx({
x: size.w, y: size.h
});
var tlPx = new OpenLayers.Pixel(0,0);
var tlLL = this.getLonLatFromViewPortPx(tlPx);
var brPx = new OpenLayers.Pixel(size.w, size.h);
var brLL = this.getLonLatFromViewPortPx(brPx);
if ((tlLL != null) && (brLL != null)) {
extent = new OpenLayers.Bounds(tlLL.lon,
brLL.lat,
brLL.lon,
tlLL.lat);
if ((tl != null) && (br != null)) {
return new OpenLayers.Bounds(tl.lon, br.lat, br.lon, tl.lat);
} else {
return null;
}
return extent;
},
/**