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

View File

@@ -27,6 +27,19 @@ ol.geom.Geometry = function() {
ol.geom.Geometry.prototype.dimension;
/**
* Create a clone of this geometry. The clone will not be represented in any
* shared structure.
* @return {ol.geom.Geometry} The cloned geometry.
*/
ol.geom.Geometry.prototype.clone = function() {
var clone = new this.constructor(this.getCoordinates());
clone.bounds_ = this.bounds_;
clone.dimension = this.dimension;
return clone;
};
/**
* Get the rectangular 2D envelope for this geoemtry.
* @return {ol.Extent} The bounding rectangular envelope.