Merge pull request #4145 from tschaub/simplified-geom
API method for simplifying geometries.
This commit is contained in:
@@ -169,10 +169,27 @@ ol.geom.Geometry.prototype.getExtent = function(opt_extent) {
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Create a simplified version of this geometry. For linestrings, this uses
|
||||
* the the {@link
|
||||
* https://en.wikipedia.org/wiki/Ramer-Douglas-Peucker_algorithm
|
||||
* Douglas Peucker} algorithm. For polygons, a quantization-based
|
||||
* simplification is used to preserve topology.
|
||||
* @function
|
||||
* @param {number} tolerance The tolerance distance for simplification.
|
||||
* @return {ol.geom.Geometry} A new, simplified version of the original
|
||||
* geometry.
|
||||
* @api
|
||||
*/
|
||||
ol.geom.Geometry.prototype.simplify = function(tolerance) {
|
||||
return this.getSimplifiedGeometry(tolerance * tolerance);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Create a simplified version of this geometry using the Douglas Peucker
|
||||
* algorithm.
|
||||
* @see http://en.wikipedia.org/wiki/Ramer%E2%80%93Douglas%E2%80%93Peucker_algorithm
|
||||
* @see https://en.wikipedia.org/wiki/Ramer-Douglas-Peucker_algorithm
|
||||
* @function
|
||||
* @param {number} squaredTolerance Squared tolerance.
|
||||
* @return {ol.geom.Geometry} Simplified geometry.
|
||||
|
||||
Reference in New Issue
Block a user