making Protocol.WFS work with just featureType and featurePrefix configured. r=bartvde (closes #3368)
git-svn-id: http://svn.openlayers.org/trunk/openlayers@12129 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -97,14 +97,21 @@ OpenLayers.Protocol.WFS.v1 = OpenLayers.Class(OpenLayers.Protocol, {
|
||||
* url - {String} URL to send requests to (required).
|
||||
* featureType - {String} Local (without prefix) feature typeName (required).
|
||||
* featureNS - {String} Feature namespace (required, but can be autodetected
|
||||
* for reading if featurePrefix is provided and identical to the prefix
|
||||
* in the server response).
|
||||
* during the first query if GML is used as readFormat and
|
||||
* featurePrefix is provided and matches the prefix used by the server
|
||||
* for this featureType).
|
||||
* featurePrefix - {String} Feature namespace alias (optional - only used
|
||||
* for writing if featureNS is provided). Default is 'feature'.
|
||||
* geometryName - {String} Name of geometry attribute. Default is 'the_geom'.
|
||||
* geometryName - {String} Name of geometry attribute. If featureNS is not
|
||||
* configured, the default is null to avoid failing on BBOX filters,
|
||||
* and it will be set on <read>. Otherwise, the default is 'the_geom'.
|
||||
*/
|
||||
initialize: function(options) {
|
||||
OpenLayers.Protocol.prototype.initialize.apply(this, [options]);
|
||||
if (!options.geometryName && !options.featureNS) {
|
||||
// poorly configured protocol - try to not fail on BBOX filters
|
||||
this.geometryName = null;
|
||||
}
|
||||
if(!options.format) {
|
||||
this.format = OpenLayers.Format.WFST(OpenLayers.Util.extend({
|
||||
version: this.version,
|
||||
@@ -281,8 +288,18 @@ OpenLayers.Protocol.WFS.v1 = OpenLayers.Class(OpenLayers.Protocol, {
|
||||
if(!doc || doc.length <= 0) {
|
||||
return null;
|
||||
}
|
||||
return (this.readFormat !== null) ? this.readFormat.read(doc) :
|
||||
var result = (this.readFormat !== null) ? this.readFormat.read(doc) :
|
||||
this.format.read(doc, options);
|
||||
if (!this.featureNS) {
|
||||
var format = this.readFormat || this.format;
|
||||
this.featureNS = format.featureNS;
|
||||
// no need to auto-configure again on subsequent reads
|
||||
format.autoConfig = false;
|
||||
if (!this.geometryName) {
|
||||
this.setGeometryName(format.geometryName);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user