Merge pull request #279 from bartvde/gfi_exceptions

GetFeatureInfo requests should take EXCEPTIONS parameter from the WMS layer (r=@ahocevar)
This commit is contained in:
Bart van den Eijnden
2012-03-05 01:07:17 -08:00
2 changed files with 30 additions and 0 deletions

View File

@@ -341,6 +341,7 @@ OpenLayers.Control.WMSGetFeatureInfo = OpenLayers.Class(OpenLayers.Control, {
service: "WMS",
version: firstLayer.params.VERSION,
request: "GetFeatureInfo",
exceptions: firstLayer.params.EXCEPTIONS,
bbox: this.map.getExtent().toBBOX(null,
firstLayer.reverseAxisOrder()),
feature_count: this.maxFeatures,

View File

@@ -475,6 +475,35 @@
}
function test_exceptions(t) {
t.plan(1);
var map = new OpenLayers.Map("map", {
getExtent: function() {return(new OpenLayers.Bounds(-180,-90,180,90));}
}
);
var a = new OpenLayers.Layer.WMS("dummy","http://myhost/wms", {
layers: "x",
exceptions: "text/xml"
});
map.addLayer(a);
var click = new OpenLayers.Control.WMSGetFeatureInfo({
});
map.addControl(click);
var _request = OpenLayers.Request.GET;
OpenLayers.Request.GET = function(options) {
t.eq(options.params["EXCEPTIONS"], "text/xml", "Exceptions parameter taken from the WMS layer if provided");
};
click.activate();
click.getInfoForClick({xy: {x: 50, y: 50}});
OpenLayers.Request.GET = _request;
map.destroy();
}
function test_drillDown(t) {
t.plan(6);
var map = new OpenLayers.Map("map", {