Do not implement a specific clone method
What we need here is a mix of deep and shallow cloning, and we do not want to do this in a generic ol.Feature#clone() method.
This commit is contained in:
@@ -51,20 +51,6 @@ 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.
|
||||
@@ -130,7 +116,7 @@ ol.Feature.prototype.set = function(key, value) {
|
||||
* Set the feature's commonly used identifier. This identifier is usually the
|
||||
* unique id in the source store.
|
||||
*
|
||||
* @param {string} featureId The feature's identifier.
|
||||
* @param {string|undefined} featureId The feature's identifier.
|
||||
*/
|
||||
ol.Feature.prototype.setFeatureId = function(featureId) {
|
||||
this.featureId_ = featureId;
|
||||
|
||||
Reference in New Issue
Block a user