no way to pass read options from protocol to format, r=ahocevar,elemoine (closes #2656)
git-svn-id: http://svn.openlayers.org/trunk/openlayers@10703 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -74,6 +74,12 @@ OpenLayers.Protocol.WFS.v1 = OpenLayers.Class(OpenLayers.Protocol, {
|
||||
*/
|
||||
readFormat: null,
|
||||
|
||||
/**
|
||||
* Property: readOptions
|
||||
* {Object} Optional object to pass to format's read.
|
||||
*/
|
||||
readOptions: null,
|
||||
|
||||
/**
|
||||
* Constructor: OpenLayers.Protocol.WFS
|
||||
* A class for giving layers WFS protocol.
|
||||
@@ -173,7 +179,12 @@ OpenLayers.Protocol.WFS.v1 = OpenLayers.Class(OpenLayers.Protocol, {
|
||||
var request = response.priv;
|
||||
if(request.status >= 200 && request.status < 300) {
|
||||
// success
|
||||
response.features = this.parseFeatures(request);
|
||||
if (this.readOptions && this.readOptions.output == "object") {
|
||||
OpenLayers.Util.extend(response,
|
||||
this.parseResponse(request, this.readOptions));
|
||||
} else {
|
||||
response.features = this.parseResponse(request);
|
||||
}
|
||||
response.code = OpenLayers.Protocol.Response.SUCCESS;
|
||||
} else {
|
||||
// failure
|
||||
@@ -184,17 +195,20 @@ OpenLayers.Protocol.WFS.v1 = OpenLayers.Class(OpenLayers.Protocol, {
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: parseFeatures
|
||||
* Method: parseResponse
|
||||
* Read HTTP response body and return features
|
||||
*
|
||||
* Parameters:
|
||||
* request - {XMLHttpRequest} The request object
|
||||
* options - {Object} Optional object to pass to format's read
|
||||
*
|
||||
* Returns:
|
||||
* {Array({<OpenLayers.Feature.Vector>})} or
|
||||
* {<OpenLayers.Feature.Vector>} Array of features or a single feature.
|
||||
* {Object} or {Array({<OpenLayers.Feature.Vector>})} or
|
||||
* {<OpenLayers.Feature.Vector>}
|
||||
* An object with a features property, an array of features or a single
|
||||
* feature.
|
||||
*/
|
||||
parseFeatures: function(request) {
|
||||
parseResponse: function(request, options) {
|
||||
var doc = request.responseXML;
|
||||
if(!doc || !doc.documentElement) {
|
||||
doc = request.responseText;
|
||||
@@ -203,7 +217,7 @@ OpenLayers.Protocol.WFS.v1 = OpenLayers.Class(OpenLayers.Protocol, {
|
||||
return null;
|
||||
}
|
||||
return (this.readFormat !== null) ? this.readFormat.read(doc) :
|
||||
this.format.read(doc);
|
||||
this.format.read(doc, options);
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user