[OpenLayers-Commits] r11867 - in trunk/openlayers: lib/OpenLayers/Layer tests/Layer

commits-20090109 at openlayers.org commits-20090109 at openlayers.org
Mon Apr 4 06:25:38 EDT 2011


Author: bartvde
Date: 2011-04-04 03:25:34 -0700 (Mon, 04 Apr 2011)
New Revision: 11867

Modified:
   trunk/openlayers/lib/OpenLayers/Layer/WMS.js
   trunk/openlayers/tests/Layer/WMS.html
Log:
getFullRequestString fails when layer has no projection, r=ahocevar (closes #3244)

Modified: trunk/openlayers/lib/OpenLayers/Layer/WMS.js
===================================================================
--- trunk/openlayers/lib/OpenLayers/Layer/WMS.js	2011-04-04 07:58:13 UTC (rev 11866)
+++ trunk/openlayers/lib/OpenLayers/Layer/WMS.js	2011-04-04 10:25:34 UTC (rev 11867)
@@ -237,7 +237,7 @@
      */
     getFullRequestString:function(newParams, altUrl) {
         var mapProjection = this.map.getProjectionObject();
-        var projectionCode = this.projection.equals(mapProjection) ?
+        var projectionCode = this.projection && this.projection.equals(mapProjection) ?
             this.projection.getCode() :
             mapProjection.getCode();
         var value = (projectionCode == "none") ? null : projectionCode;

Modified: trunk/openlayers/tests/Layer/WMS.html
===================================================================
--- trunk/openlayers/tests/Layer/WMS.html	2011-04-04 07:58:13 UTC (rev 11866)
+++ trunk/openlayers/tests/Layer/WMS.html	2011-04-04 10:25:34 UTC (rev 11867)
@@ -229,7 +229,7 @@
     function test_Layer_WMS_getFullRequestString (t) {
 
 
-        t.plan( 3 );
+        t.plan( 4 );
         var map = new OpenLayers.Map('map');
         map.projection = "xx";
         var tUrl = "http://octo.metacarta.com/cgi-bin/mapserv";
@@ -271,8 +271,22 @@
              "getFullRequestString() uses the layer projection if it equals the map projection");
         map.destroy();
 
+        map = new OpenLayers.Map("map", {projection: "EPSG:4326"});
+        map.addLayer(new OpenLayers.Layer(null, {isBaseLayer: true}));
+        tLayer = new OpenLayers.Layer.WMS(name, tUrl);
+        tLayer.map = map;
+        var error;
+        try {
+            tLayer.getFullRequestString();
+            error = false;
+        } catch(err) {
+            error = true;
     }
+        t.ok(!error, "no error on getFullRequestString if layer has no projection");
+        map.destroy();
 
+    }
+
     function test_Layer_WMS_setOpacity (t) {
         t.plan( 5 );
 



More information about the Commits mailing list