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.
This commit is contained in:
ahocevar
2013-12-09 18:33:34 +01:00
parent d53ad07279
commit 211e288f33
3 changed files with 1 additions and 37 deletions

View File

@@ -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.<ol.style.Symbolizer>} 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.

View File

@@ -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)) {

View File

@@ -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);
}
}