Reverse QUERY_LAYERS order in GetFeatureInfo requests. r=bartvde (closes #3253)

This commit is contained in:
Marc Jansen
2011-10-09 15:53:12 +02:00
parent c4c4f97334
commit 760d5a584c
2 changed files with 8 additions and 8 deletions

View File

@@ -287,7 +287,7 @@ OpenLayers.Control.WMSGetFeatureInfo = OpenLayers.Class(OpenLayers.Control, {
var candidates = this.layers || this.map.layers;
var layers = [];
var layer, url;
for(var i=0, len=candidates.length; i<len; ++i) {
for(var i = candidates.length - 1; i >= 0; --i) {
layer = candidates[i];
if(layer instanceof OpenLayers.Layer.WMS &&
(!this.queryVisible || layer.getVisibility())) {

View File

@@ -348,7 +348,7 @@
);
t.eq(
log.options && log.options.params.STYLES.join(","),
"a,b,c,d,a,b,c,d,,,,,,,,",
",,,,,,,,a,b,c,d,a,b,c,d",
"Styles merged correctly"
);
@@ -424,7 +424,7 @@
control.layerUrls = ["http://a.mirror/wms", "http://b.mirror/wms"];
control.getInfoForClick({xy: {x: 50, y: 50}});
t.eq(log.options && log.options.url, "http://host/wms", "some match, request issued");
t.eq(log.options && log.options.params["QUERY_LAYERS"].join(","), "a,b", "selected layers queried");
t.eq(log.options && log.options.params["QUERY_LAYERS"].join(","), "b,a", "selected layers queried");
// show that a layer can be matched if it has a urls array itself (first needs to be matched)
log = {};
@@ -508,13 +508,13 @@
var _request = OpenLayers.Request.GET;
OpenLayers.Request.GET = function(options) {
count++;
if (count == 1) {
if (count == 2) {
t.eq(options.params["INFO_FORMAT"], "application/vnd.ogc.gml", "Default info format of the control is used");
t.eq(options.params["QUERY_LAYERS"].join(","), "a,c", "Layers should be grouped by service url");
t.eq(options.url, "http://localhost/wms", "Correct url used for first request");
} else if (count == 2) {
t.eq(options.params["QUERY_LAYERS"].join(","), "c,a", "Layers should be grouped by service url");
t.eq(options.url, "http://localhost/wms", "Correct url used for second request");
} else if (count == 1) {
t.eq(options.params["INFO_FORMAT"], "text/xml", "Overridden info format is used instead of the control's infoFormat");
t.eq(options.url, "http://myhost/wms", "Correct url used for second request");
t.eq(options.url, "http://myhost/wms", "Correct url used for first request");
}
};
click.activate();