WMS GetFeatureInfo control should use integers for X and Y, r=ahocevar (closes #3019)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@11046 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
bartvde
2011-01-20 13:20:03 +00:00
parent c8982cb99a
commit 3913ef1787
2 changed files with 19 additions and 7 deletions
+4 -4
View File
@@ -370,13 +370,13 @@ OpenLayers.Control.WMSGetFeatureInfo = OpenLayers.Class(OpenLayers.Control, {
}, (parseFloat(firstLayer.params.VERSION) >= 1.3) ? }, (parseFloat(firstLayer.params.VERSION) >= 1.3) ?
{ {
crs: projection, crs: projection,
i: clickPosition.x, i: parseInt(clickPosition.x),
j: clickPosition.y j: parseInt(clickPosition.y)
} : } :
{ {
srs: projection, srs: projection,
x: clickPosition.x, x: parseInt(clickPosition.x),
y: clickPosition.y y: parseInt(clickPosition.y)
} }
); );
OpenLayers.Util.applyDefaults(params, this.vendorParams); OpenLayers.Util.applyDefaults(params, this.vendorParams);
+15 -3
View File
@@ -233,7 +233,7 @@
// Verify that things work all right when we combine different types for the STYLES and LAYERS // Verify that things work all right when we combine different types for the STYLES and LAYERS
// params in the WMS Layers involved // params in the WMS Layers involved
function test_mixedParams(t) { function test_mixedParams(t) {
t.plan(3); t.plan(5);
var map = new OpenLayers.Map("map", { var map = new OpenLayers.Map("map", {
getExtent: function() {return(new OpenLayers.Bounds(-180,-90,180,90));} getExtent: function() {return(new OpenLayers.Bounds(-180,-90,180,90));}
} }
@@ -271,9 +271,21 @@
log.options = options; log.options = options;
}; };
click.activate(); click.activate();
click.getInfoForClick({xy: {x: 50, y: 50}}); click.getInfoForClick({xy: {x: 50.2, y: 50.1}});
OpenLayers.Request.GET = _request; 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( t.eq(
log.options && log.options.url, log.options && log.options.url,
"http://localhost/wms", "http://localhost/wms",
@@ -506,7 +518,7 @@
log.options = options; log.options = options;
}; };
click.activate(); click.activate();
click.getInfoForClick({xy: {x: 50, y: 60}}); click.getInfoForClick({xy: {x: 50.1, y: 60.2}});
OpenLayers.Request.GET = _request; OpenLayers.Request.GET = _request;
t.eq( t.eq(
log.options && log.options.params.CRS, log.options && log.options.params.CRS,