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:
ahocevar
2013-08-28 19:18:17 +02:00
parent 2394b39f6f
commit 0c1f2328f9
3 changed files with 6 additions and 35 deletions

View File

@@ -162,9 +162,12 @@ ol.interaction.Select.prototype.select =
featuresToRemove.push(clone);
delete featureMap[featureId];
} else if (!(featureId in oldFeatureMap)) {
clone = feature.clone();
featureMap[featureId] = clone;
clone = new ol.Feature(feature.getAttributes());
clone.setGeometry(feature.getGeometry().clone());
clone.setFeatureId(feature.getFeatureId());
clone.setSymbolizers(feature.getSymbolizers());
clone.renderIntent = ol.layer.VectorLayerRenderIntent.SELECTED;
featureMap[featureId] = clone;
selectedFeatures.push(feature);
featuresToAdd.push(clone);
}