Making GetFeatureInfo work with SLD defined layers.
Closes http://trac.osgeo.org/openlayers/ticket/3609. p=h0nIg, r=me
This commit is contained in:
@@ -314,9 +314,11 @@ OpenLayers.Control.WMSGetFeatureInfo = OpenLayers.Class(OpenLayers.Control, {
|
||||
*/
|
||||
buildWMSOptions: function(url, layers, clickPosition, format) {
|
||||
var layerNames = [], styleNames = [];
|
||||
for (var i = 0, len = layers.length; i < len; i++) {
|
||||
layerNames = layerNames.concat(layers[i].params.LAYERS);
|
||||
styleNames = styleNames.concat(this.getStyleNames(layers[i]));
|
||||
for (var i = 0, len = layers.length; i < len; i++) {
|
||||
if (layers[i].params.LAYERS != null) {
|
||||
layerNames = layerNames.concat(layers[i].params.LAYERS);
|
||||
styleNames = styleNames.concat(this.getStyleNames(layers[i]));
|
||||
}
|
||||
}
|
||||
var firstLayer = layers[0];
|
||||
// use the firstLayer's projection if it matches the map projection -
|
||||
@@ -330,9 +332,6 @@ OpenLayers.Control.WMSGetFeatureInfo = OpenLayers.Class(OpenLayers.Control, {
|
||||
service: "WMS",
|
||||
version: firstLayer.params.VERSION,
|
||||
request: "GetFeatureInfo",
|
||||
layers: layerNames,
|
||||
query_layers: layerNames,
|
||||
styles: styleNames,
|
||||
bbox: this.map.getExtent().toBBOX(null,
|
||||
firstLayer.reverseAxisOrder()),
|
||||
feature_count: this.maxFeatures,
|
||||
@@ -352,6 +351,13 @@ OpenLayers.Control.WMSGetFeatureInfo = OpenLayers.Class(OpenLayers.Control, {
|
||||
y: parseInt(clickPosition.y)
|
||||
}
|
||||
);
|
||||
if (layerNames.length != 0) {
|
||||
params = OpenLayers.Util.extend({
|
||||
layers: layerNames,
|
||||
query_layers: layerNames,
|
||||
styles: styleNames
|
||||
}, params);
|
||||
}
|
||||
OpenLayers.Util.applyDefaults(params, this.vendorParams);
|
||||
return {
|
||||
url: url,
|
||||
|
||||
Reference in New Issue
Block a user