WMSGetFeatureInfo control: relate features to url, thanks erilem for the extensive amount of reviews you have done for OL 2.11, r=erilem (closes #2883)
git-svn-id: http://svn.openlayers.org/trunk/openlayers@11875 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -55,6 +55,14 @@ OpenLayers.Control.WMSGetFeatureInfo = OpenLayers.Class(OpenLayers.Control, {
|
||||
*/
|
||||
clickCallback: "click",
|
||||
|
||||
/** APIProperty: output
|
||||
* {String} Either "features" or "object". When triggering a
|
||||
* getfeatureinfo request should we pass on an array of features
|
||||
* or an object with with a "features" property and other properties
|
||||
* (such as the url of the WMS). Default is "features".
|
||||
*/
|
||||
output: "features",
|
||||
|
||||
/**
|
||||
* Property: layers
|
||||
* {Array(<OpenLayers.Layer.WMS>)} The layers to query for feature info.
|
||||
@@ -387,7 +395,7 @@ OpenLayers.Control.WMSGetFeatureInfo = OpenLayers.Class(OpenLayers.Control, {
|
||||
url: url,
|
||||
params: OpenLayers.Util.upperCaseObject(params),
|
||||
callback: function(request) {
|
||||
this.handleResponse(clickPosition, request);
|
||||
this.handleResponse(clickPosition, request, url);
|
||||
},
|
||||
scope: this
|
||||
};
|
||||
@@ -487,7 +495,9 @@ OpenLayers.Control.WMSGetFeatureInfo = OpenLayers.Class(OpenLayers.Control, {
|
||||
* request - {XMLHttpRequest} The request object
|
||||
* xy - {<OpenLayers.Pixel>} The position on the map where the
|
||||
* mouse event occurred.
|
||||
* features - {Array(<OpenLayers.Feature.Vector>)}
|
||||
* features - {Array(<OpenLayers.Feature.Vector>)} or
|
||||
* {Array({Object}) when output is "object". The object has a url and a
|
||||
* features property which contains an array of features.
|
||||
*/
|
||||
triggerGetFeatureInfo: function(request, xy, features) {
|
||||
this.events.triggerEvent("getfeatureinfo", {
|
||||
@@ -509,8 +519,9 @@ OpenLayers.Control.WMSGetFeatureInfo = OpenLayers.Class(OpenLayers.Control, {
|
||||
* xy - {<OpenLayers.Pixel>} The position on the map where the
|
||||
* mouse event occurred.
|
||||
* request - {XMLHttpRequest} The request object.
|
||||
* url - {String} The url which was used for this request.
|
||||
*/
|
||||
handleResponse: function(xy, request) {
|
||||
handleResponse: function(xy, request, url) {
|
||||
|
||||
var doc = request.responseXML;
|
||||
if(!doc || !doc.documentElement) {
|
||||
@@ -521,7 +532,13 @@ OpenLayers.Control.WMSGetFeatureInfo = OpenLayers.Class(OpenLayers.Control, {
|
||||
this.triggerGetFeatureInfo(request, xy, features);
|
||||
} else {
|
||||
this._requestCount++;
|
||||
if (this.output === "object") {
|
||||
this._features = (this._features || []).concat(
|
||||
{url: url, features: features}
|
||||
);
|
||||
} else {
|
||||
this._features = (this._features || []).concat(features);
|
||||
}
|
||||
if (this._requestCount === this._numRequests) {
|
||||
this.triggerGetFeatureInfo(request, xy, this._features.concat());
|
||||
delete this._features;
|
||||
|
||||
Reference in New Issue
Block a user