Can't return an extent before center is set.
git-svn-id: http://svn.openlayers.org/trunk/openlayers@106 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
+13
-9
@@ -182,15 +182,19 @@ OpenLayers.Map.prototype = {
|
|||||||
* @return {OpenLayers.Bounds}
|
* @return {OpenLayers.Bounds}
|
||||||
*/
|
*/
|
||||||
getExtent: function () {
|
getExtent: function () {
|
||||||
var res = this.getResolution();
|
if (this.center) {
|
||||||
var size = this.getSize();
|
var res = this.getResolution();
|
||||||
var w_deg = size.w * res;
|
var size = this.getSize();
|
||||||
var h_deg = size.h * res;
|
var w_deg = size.w * res;
|
||||||
return new OpenLayers.Bounds(
|
var h_deg = size.h * res;
|
||||||
this.center.lon - w_deg / 2,
|
return new OpenLayers.Bounds(
|
||||||
this.center.lat - h_deg / 2,
|
this.center.lon - w_deg / 2,
|
||||||
this.center.lon + w_deg / 2,
|
this.center.lat - h_deg / 2,
|
||||||
this.center.lat + h_deg / 2);
|
this.center.lon + w_deg / 2,
|
||||||
|
this.center.lat + h_deg / 2);
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user