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:
@@ -42,13 +42,6 @@ ol.Feature = function(opt_values) {
|
|||||||
*/
|
*/
|
||||||
this.geometryName_;
|
this.geometryName_;
|
||||||
|
|
||||||
/**
|
|
||||||
* Original of this feature when it was modified.
|
|
||||||
* @type {ol.Feature}
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
this.original_ = null;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The render intent for this feature.
|
* The render intent for this feature.
|
||||||
* @type {ol.FeatureRenderIntent|string}
|
* @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.
|
* Get any symbolizers set directly on the feature.
|
||||||
* @return {Array.<ol.style.Symbolizer>} Symbolizers (or null if none).
|
* @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.
|
* Gets the renderIntent for this feature.
|
||||||
* @return {string} Render intent.
|
* @return {string} Render intent.
|
||||||
|
|||||||
@@ -368,12 +368,6 @@ ol.interaction.Modify.prototype.handleDragStart = function(evt) {
|
|||||||
if (!(goog.getUid(node.feature) in distinctFeatures)) {
|
if (!(goog.getUid(node.feature) in distinctFeatures)) {
|
||||||
var feature = node.feature;
|
var feature = node.feature;
|
||||||
distinctFeatures[goog.getUid(feature)] = true;
|
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 (renderIntent == ol.FeatureRenderIntent.TEMPORARY) {
|
||||||
if (ol.coordinate.equals(segment[0], vertex)) {
|
if (ol.coordinate.equals(segment[0], vertex)) {
|
||||||
|
|||||||
@@ -157,17 +157,12 @@ ol.parser.ogc.WFS_v1 = function(opt_options) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// add in fields
|
// add in fields
|
||||||
var original = feature.getOriginal();
|
|
||||||
var originalAttributes = goog.isNull(original) ?
|
|
||||||
undefined : original.getAttributes();
|
|
||||||
var attributes = feature.getAttributes();
|
var attributes = feature.getAttributes();
|
||||||
var attribute;
|
var attribute;
|
||||||
for (var key in attributes) {
|
for (var key in attributes) {
|
||||||
attribute = attributes[key];
|
attribute = attributes[key];
|
||||||
// TODO Only add geometries whose values have changed
|
// TODO Only add geometries whose values have changed
|
||||||
if (goog.isDef(attribute) && (attribute instanceof ol.geom.Geometry ||
|
if (goog.isDef(attribute)) {
|
||||||
(!goog.isDef(originalAttributes) ||
|
|
||||||
attribute != originalAttributes[key]))) {
|
|
||||||
this.writeNode('Property', {name: key, value: attribute}, null, node);
|
this.writeNode('Property', {name: key, value: attribute}, null, node);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user