From 211e288f3335803b2b88583e74b8cc09fea768c3 Mon Sep 17 00:00:00 2001 From: ahocevar Date: Mon, 9 Dec 2013 18:33:34 +0100 Subject: [PATCH] Remove original handling on ol.Feature This is another attempt to bring master closer to the vector-api branch. In anticipation of the ability to keep track of modifications on ol.Object through a beforechange event (d7e4be0), we will be able to manage originals on the application level or in a separate component outside of ol.Feature. --- src/ol/feature.js | 25 ------------------------- src/ol/interaction/modifyinteraction.js | 6 ------ src/ol/parser/ogc/wfsparser_v1.js | 7 +------ 3 files changed, 1 insertion(+), 37 deletions(-) diff --git a/src/ol/feature.js b/src/ol/feature.js index cb9a478d63..59da4fe656 100644 --- a/src/ol/feature.js +++ b/src/ol/feature.js @@ -42,13 +42,6 @@ ol.Feature = function(opt_values) { */ this.geometryName_; - /** - * Original of this feature when it was modified. - * @type {ol.Feature} - * @private - */ - this.original_ = null; - /** * The render intent for this feature. * @type {ol.FeatureRenderIntent|string} @@ -114,15 +107,6 @@ ol.Feature.prototype.getGeometry = function() { }; -/** - * Get the original of this feature when it was modified. - * @return {ol.Feature} Original. - */ -ol.Feature.prototype.getOriginal = function() { - return this.original_; -}; - - /** * Get any symbolizers set directly on the feature. * @return {Array.} Symbolizers (or null if none). @@ -198,15 +182,6 @@ ol.Feature.prototype.setGeometry = function(geometry) { }; -/** - * Set the original of this feature when it was modified. - * @param {ol.Feature} original Original. - */ -ol.Feature.prototype.setOriginal = function(original) { - this.original_ = original; -}; - - /** * Gets the renderIntent for this feature. * @return {string} Render intent. diff --git a/src/ol/interaction/modifyinteraction.js b/src/ol/interaction/modifyinteraction.js index f5c4eef831..fdef1b88e7 100644 --- a/src/ol/interaction/modifyinteraction.js +++ b/src/ol/interaction/modifyinteraction.js @@ -368,12 +368,6 @@ ol.interaction.Modify.prototype.handleDragStart = function(evt) { if (!(goog.getUid(node.feature) in distinctFeatures)) { var feature = node.feature; distinctFeatures[goog.getUid(feature)] = true; - var original = new ol.Feature(feature.getAttributes()); - original.setGeometry(feature.getGeometry().clone()); - original.setId(feature.getId()); - original.setOriginal(feature.getOriginal()); - original.setSymbolizers(feature.getSymbolizers()); - feature.setOriginal(original); } if (renderIntent == ol.FeatureRenderIntent.TEMPORARY) { if (ol.coordinate.equals(segment[0], vertex)) { diff --git a/src/ol/parser/ogc/wfsparser_v1.js b/src/ol/parser/ogc/wfsparser_v1.js index 002fc9a9ab..acc0449c8b 100644 --- a/src/ol/parser/ogc/wfsparser_v1.js +++ b/src/ol/parser/ogc/wfsparser_v1.js @@ -157,17 +157,12 @@ ol.parser.ogc.WFS_v1 = function(opt_options) { } // add in fields - var original = feature.getOriginal(); - var originalAttributes = goog.isNull(original) ? - undefined : original.getAttributes(); var attributes = feature.getAttributes(); var attribute; for (var key in attributes) { attribute = attributes[key]; // TODO Only add geometries whose values have changed - if (goog.isDef(attribute) && (attribute instanceof ol.geom.Geometry || - (!goog.isDef(originalAttributes) || - attribute != originalAttributes[key]))) { + if (goog.isDef(attribute)) { this.writeNode('Property', {name: key, value: attribute}, null, node); } }