adding a feature.modified property, making the ModifyFeature control set it and the WFST format check for it so only modified attributes and a modified geometry need to be included in an Update transaction. r=bartvde (closes #3400)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@12149 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
ahocevar
2011-07-04 08:37:55 +00:00
parent 3f2bd6ddc2
commit 2293987d57
5 changed files with 140 additions and 6 deletions
+21 -3
View File
@@ -172,9 +172,24 @@ OpenLayers.Format.WFST.v1 = OpenLayers.Class(OpenLayers.Format.XML, {
* type - insert, update, or delete.
*
* Parameters:
* features - {Array(<OpenLayers.Feature.Vector>)} A list of features.
* features - {Array(<OpenLayers.Feature.Vector>)} A list of features. See
* below for a more detailed description of the influence of the
* feature's *modified* property.
* options - {Object}
*
* feature.modified rules:
* If a feature has a modified property set, the following checks will be
* made before a feature's geometry or attribute is included in an Update
* transaction:
* - *modified* is not set at all: The geometry and all attributes will be
* included.
* - *modified.geometry* is truthy: The geometry will be
* included. If *modified.attributes* is not set, all attributes will
* be included.
* - *modified.attributes* is set: Only the attributes with a truthy value
* in *modified.attributes* will be included. If *modified.geometry*
* is not set, the geometry will not be included.
*
* Returns:
* {String} A serialized WFS transaction.
*/
@@ -276,7 +291,8 @@ OpenLayers.Format.WFST.v1 = OpenLayers.Class(OpenLayers.Format.XML, {
}
// add in geometry
if (this.geometryName !== null) {
var modified = feature.modified;
if (this.geometryName !== null && (!modified || modified.geometry)) {
this.srsName = this.getSrsName(feature);
this.writeNode(
"Property", {name: this.geometryName, value: feature.geometry}, node
@@ -285,7 +301,9 @@ OpenLayers.Format.WFST.v1 = OpenLayers.Class(OpenLayers.Format.XML, {
// add in attributes
for(var key in feature.attributes) {
if(feature.attributes[key] !== undefined) {
if(feature.attributes[key] !== undefined &&
(!modified || !modified.attributes ||
(modified.attributes && modified.attributes[key]))) {
this.writeNode(
"Property", {name: key, value: feature.attributes[key]}, node
);