Work with clones rather than the original features

This commit is contained in:
ahocevar
2013-08-19 15:35:21 +02:00
parent fdd79a385a
commit f05629b3c3
6 changed files with 93 additions and 12 deletions
+14
View File
@@ -44,6 +44,20 @@ ol.Feature = function(opt_values) {
goog.inherits(ol.Feature, ol.Object);
/**
* Create a clone of this feature. Both the feature and its geometry will be
* cloned.
* @return {ol.Feature} A clone of this feature, with a cloned geometry.
*/
ol.Feature.prototype.clone = function() {
var clone = new ol.Feature(this.getAttributes());
clone.setGeometry(this.getGeometry().clone());
clone.featureId_ = this.featureId_;
clone.symbolizers_ = this.symbolizers_;
return clone;
};
/**
* Gets a copy of the attributes of this feature.
* @return {Object.<string, *>} Attributes object.