From 9b53d22a31eb2d37d7f30ec035893efe7cc65ed0 Mon Sep 17 00:00:00 2001 From: euzuro Date: Tue, 27 Jun 2006 23:31:47 +0000 Subject: [PATCH] allow for accessing of default map values even if baseLayer has still not been set git-svn-id: http://svn.openlayers.org/trunk/openlayers@807 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf --- lib/OpenLayers/Map.js | 38 +++++++++++++++++++++++++++++++------- 1 file changed, 31 insertions(+), 7 deletions(-) diff --git a/lib/OpenLayers/Map.js b/lib/OpenLayers/Map.js index 3ce70f9b03..8273ca3407 100644 --- a/lib/OpenLayers/Map.js +++ b/lib/OpenLayers/Map.js @@ -531,8 +531,12 @@ OpenLayers.Map.prototype = { * @type String */ getProjection: function() { - var projection = this.baseLayer.getProjection(); - + var projection = null; + + if (this.baseLayer != null) { + projection = this.baseLayer.getProjection(); + } + if (projection == null) { projection = this.projection; } @@ -545,7 +549,11 @@ OpenLayers.Map.prototype = { * @type String */ getMaxResolution: function() { - var maxResolution = this.baseLayer.getMaxResolution(); + var maxResolution = null + + if (this.baseLayer != null) { + maxResolution = this.baseLayer.getMaxResolution(); + } if (maxResolution == null) { maxResolution = this.maxResolution; @@ -558,12 +566,16 @@ OpenLayers.Map.prototype = { * @type OpenLayers.Bounds */ getMaxExtent: function () { - var maxExtent = this.baseLayer.getMaxExtent(); + var maxExtent = null; + + if (this.baseLayer != null) { + maxExtent = this.baseLayer.getMaxExtent(); + } if (maxExtent == null) { maxExtent = this.maxExtent; } - + return maxExtent; }, @@ -572,10 +584,16 @@ OpenLayers.Map.prototype = { * @type int */ getMaxZoomLevel: function() { - var maxZoomLevel = this.baseLayer.getMaxZoomLevel(); + var maxZoomLevel = null; + + if (this.baseLayer != null) { + maxZoomLevel = this.baseLayer.getMaxZoomLevel(); + } + if (maxZoomLevel == null) { maxZoomLevel = this.maxZoomLevel; } + return maxZoomLevel; }, @@ -584,10 +602,16 @@ OpenLayers.Map.prototype = { * @type int */ getMinZoomLevel: function() { - var minZoomLevel = this.baseLayer.getMinZoomLevel(); + var minZoomLevel = null; + + if (this.baseLayer != null) { + minZoomLevel = this.baseLayer.getMinZoomLevel(); + } + if (minZoomLevel == null) { minZoomLevel = this.minZoomLevel; } + return minZoomLevel; },