make WMSGetFeatureInfo Control WMS 1.3 compatible, r=ahocevar (closes #2355)
git-svn-id: http://svn.openlayers.org/trunk/openlayers@9879 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -216,13 +216,13 @@
|
||||
"url from first layer used"
|
||||
);
|
||||
t.eq(
|
||||
log.options && log.options.params.styles.join(","),
|
||||
log.options && log.options.params.STYLES.join(","),
|
||||
"a,b,c,d,a,b,c,d,,,,,,,,",
|
||||
"Styles merged correctly"
|
||||
);
|
||||
|
||||
t.eq(
|
||||
log.options && log.options.params.format,
|
||||
log.options && log.options.params.FORMAT,
|
||||
"image/jpeg",
|
||||
"Required 'format' parameter included"
|
||||
);
|
||||
@@ -293,13 +293,13 @@
|
||||
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(","), "a,b", "selected layers queried");
|
||||
|
||||
// show that a layer can be matched if it has a urls array itself (first needs to be matched)
|
||||
log = {};
|
||||
control.layerUrls = ["http://c.mirror/wms"];
|
||||
control.getInfoForClick({xy: {x: 50, y: 50}});
|
||||
t.eq(log.options && log.options.params["query_layers"].join(","), "c", "layer with urls array can be queried");
|
||||
t.eq(log.options && log.options.params["QUERY_LAYERS"].join(","), "c", "layer with urls array can be queried");
|
||||
|
||||
// clean up
|
||||
OpenLayers.Request.GET = _request;
|
||||
@@ -339,7 +339,7 @@
|
||||
OpenLayers.Request.GET = function(options) {
|
||||
count++;
|
||||
if (count == 1) {
|
||||
t.eq(options.params["query_layers"].join(","), "a,c", "Layers should be grouped by service url");
|
||||
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.url, "http://myhost/wms", "Correct url used for second request");
|
||||
@@ -352,6 +352,57 @@
|
||||
map.destroy();
|
||||
}
|
||||
|
||||
function test_GetFeatureInfo_WMS13(t) {
|
||||
t.plan(4);
|
||||
var map = new OpenLayers.Map("map", {
|
||||
getExtent: function() {return(new OpenLayers.Bounds(-180,-90,180,90));}
|
||||
}
|
||||
);
|
||||
|
||||
var a = new OpenLayers.Layer.WMS(null, "http://localhost/wms", {
|
||||
layers: "a",
|
||||
version: "1.3.0"
|
||||
});
|
||||
map.addLayer(a);
|
||||
|
||||
var click = new OpenLayers.Control.WMSGetFeatureInfo({
|
||||
});
|
||||
|
||||
map.addControl(click);
|
||||
var log = {};
|
||||
var _request = OpenLayers.Request.GET;
|
||||
OpenLayers.Request.GET = function(options) {
|
||||
log.options = options;
|
||||
};
|
||||
click.activate();
|
||||
click.getInfoForClick({xy: {x: 50, y: 60}});
|
||||
OpenLayers.Request.GET = _request;
|
||||
t.eq(
|
||||
log.options && log.options.params.CRS,
|
||||
"EPSG:4326",
|
||||
"Since it is WMS 1.3 use CRS parameter instead of SRS in the GetFeatureInfo request"
|
||||
);
|
||||
|
||||
t.eq(
|
||||
log.options && log.options.params.I,
|
||||
50,
|
||||
"Since it is WMS 1.3 use I parameter instead of X in the GetFeatureInfo request"
|
||||
);
|
||||
|
||||
t.eq(
|
||||
log.options && log.options.params.J,
|
||||
60,
|
||||
"Since it is WMS 1.3 use J parameter instead of Y in the GetFeatureInfo request"
|
||||
);
|
||||
|
||||
t.eq(
|
||||
log.options && log.options.params.BBOX,
|
||||
"-90,-180,90,180",
|
||||
"Since it is WMS 1.3 the BBOX should respect axis order"
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
Reference in New Issue
Block a user