[OpenLayers-Commits] r11046 - in trunk/openlayers: lib/OpenLayers/Control tests/Control

commits-20090109 at openlayers.org commits-20090109 at openlayers.org
Thu Jan 20 08:20:03 EST 2011


Author: bartvde
Date: 2011-01-20 05:20:03 -0800 (Thu, 20 Jan 2011)
New Revision: 11046

Modified:
   trunk/openlayers/lib/OpenLayers/Control/WMSGetFeatureInfo.js
   trunk/openlayers/tests/Control/WMSGetFeatureInfo.html
Log:
WMS GetFeatureInfo control should use integers for X and Y, r=ahocevar (closes #3019)

Modified: trunk/openlayers/lib/OpenLayers/Control/WMSGetFeatureInfo.js
===================================================================
--- trunk/openlayers/lib/OpenLayers/Control/WMSGetFeatureInfo.js	2011-01-20 11:37:17 UTC (rev 11045)
+++ trunk/openlayers/lib/OpenLayers/Control/WMSGetFeatureInfo.js	2011-01-20 13:20:03 UTC (rev 11046)
@@ -370,13 +370,13 @@
         }, (parseFloat(firstLayer.params.VERSION) >= 1.3) ?
             {
                 crs: projection,
-                i: clickPosition.x,
-                j: clickPosition.y
+                i: parseInt(clickPosition.x),
+                j: parseInt(clickPosition.y)
             } :
             {
                 srs: projection,
-                x: clickPosition.x,
-                y: clickPosition.y
+                x: parseInt(clickPosition.x),
+                y: parseInt(clickPosition.y)
             }
         );
         OpenLayers.Util.applyDefaults(params, this.vendorParams);

Modified: trunk/openlayers/tests/Control/WMSGetFeatureInfo.html
===================================================================
--- trunk/openlayers/tests/Control/WMSGetFeatureInfo.html	2011-01-20 11:37:17 UTC (rev 11045)
+++ trunk/openlayers/tests/Control/WMSGetFeatureInfo.html	2011-01-20 13:20:03 UTC (rev 11046)
@@ -233,7 +233,7 @@
     // Verify that things work all right when we combine different types for the STYLES and LAYERS
     // params in the WMS Layers involved
     function test_mixedParams(t) {
-        t.plan(3);
+        t.plan(5);
         var map = new OpenLayers.Map("map", {
             getExtent: function() {return(new OpenLayers.Bounds(-180,-90,180,90));}
             }
@@ -271,10 +271,22 @@
             log.options = options;
         };
         click.activate();
-        click.getInfoForClick({xy: {x: 50, y: 50}});
+        click.getInfoForClick({xy: {x: 50.2, y: 50.1}});
         OpenLayers.Request.GET = _request;
 
         t.eq(
+            log.options && log.options.params.X,
+            50,
+            "X should be an integer"
+        );
+
+        t.eq(
+            log.options && log.options.params.Y,
+            50,
+            "Y should be an integer" 
+        );
+
+        t.eq(
             log.options && log.options.url,
             "http://localhost/wms",
             "url from first layer used"
@@ -506,7 +518,7 @@
             log.options = options;
         };
         click.activate();
-        click.getInfoForClick({xy: {x: 50, y: 60}});
+        click.getInfoForClick({xy: {x: 50.1, y: 60.2}});
         OpenLayers.Request.GET = _request;
         t.eq(
             log.options && log.options.params.CRS,



More information about the Commits mailing list