same-case these functions for if there is no baselayer. in theory,
these should never be called if no baselayer is set... but one never knows what a user will do. So instead of crashing, we will just return null. git-svn-id: http://svn.openlayers.org/trunk/openlayers@857 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -641,27 +641,47 @@ OpenLayers.Map.prototype = {
|
||||
|
||||
/**
|
||||
* @returns A Bounds object which represents the lon/lat bounds of the
|
||||
* current viewPort.
|
||||
* current viewPort.
|
||||
* If no baselayer is set, returns null.
|
||||
* @type OpenLayers.Bounds
|
||||
*/
|
||||
getExtent: function () {
|
||||
return this.baseLayer.getExtent();
|
||||
var extent = null;
|
||||
|
||||
if (this.baseLayer != null) {
|
||||
extent = this.baseLayer.getExtent();
|
||||
}
|
||||
return extent;
|
||||
},
|
||||
|
||||
/**
|
||||
* @type float
|
||||
*/
|
||||
* @returns The current resolution of the map.
|
||||
* If no baselayer is set, returns null.
|
||||
* @type float
|
||||
*/
|
||||
getResolution: function () {
|
||||
return this.baseLayer.getResolution();
|
||||
var resolution = null;
|
||||
|
||||
if (this.baseLayer != null) {
|
||||
resolution = this.baseLayer.getResolution();
|
||||
}
|
||||
return resolution;
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {OpenLayers.Bounds} bounds
|
||||
*
|
||||
* @returns A suitable zoom level for the specified bounds.
|
||||
* If no baselayer is set, returns null.
|
||||
* @type int
|
||||
*/
|
||||
getZoomForExtent: function (bounds) {
|
||||
return this.baseLayer.getZoomForExtent(bounds);
|
||||
zoom = null;
|
||||
|
||||
if (this.baseLayer != null) {
|
||||
zoom = this.baseLayer.getZoomForExtent(bounds);
|
||||
}
|
||||
return zoom;
|
||||
},
|
||||
|
||||
/********************************************************/
|
||||
|
||||
Reference in New Issue
Block a user