add support for wfs:Native, r=tschaub (closes #3349)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@12123 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
bartvde
2011-06-22 07:14:15 +00:00
parent 1951eb3815
commit 39d9715853
3 changed files with 59 additions and 4 deletions

View File

@@ -173,12 +173,16 @@ OpenLayers.Format.WFST.v1 = OpenLayers.Class(OpenLayers.Format.XML, {
*
* Parameters:
* features - {Array(<OpenLayers.Feature.Vector>)} A list of features.
* options - {Object}
*
* Returns:
* {String} A serialized WFS transaction.
*/
write: function(features) {
var node = this.writeNode("wfs:Transaction", features);
write: function(features, options) {
var node = this.writeNode("wfs:Transaction", {
features:features,
options: options
});
var value = this.schemaLocationAttr();
if(value) {
this.setAttributeNS(
@@ -216,16 +220,19 @@ OpenLayers.Format.WFST.v1 = OpenLayers.Class(OpenLayers.Format.XML, {
}
return node;
},
"Transaction": function(features) {
"Transaction": function(obj) {
var node = this.createElementNSPlus("wfs:Transaction", {
attributes: {
service: "WFS",
version: this.version
}
});
var i, len;
var features = obj && obj.features;
var options = obj && obj.options;
if(features) {
var name, feature;
for(var i=0, len=features.length; i<len; ++i) {
for(i=0, len=features.length; i<len; ++i) {
feature = features[i];
name = this.stateName[feature.state];
if(name) {
@@ -233,6 +240,22 @@ OpenLayers.Format.WFST.v1 = OpenLayers.Class(OpenLayers.Format.XML, {
}
}
}
if (options && options.nativeElements) {
for (i=0, len=options.nativeElements.length; i<len; ++i) {
this.writeNode("wfs:Native",
options.nativeElements[i], node);
}
}
return node;
},
"Native": function(nativeElement) {
var node = this.createElementNSPlus("wfs:Native", {
attributes: {
vendorId: nativeElement.vendorId,
safeToIgnore: nativeElement.safeToIgnore
},
value: nativeElement.value
});
return node;
},
"Insert": function(feature) {