API method for simplifying geometries

This commit is contained in:
Tim Schaub
2015-09-21 13:59:01 -06:00
parent f65129850d
commit e81b68ce8b
3 changed files with 38 additions and 0 deletions

View File

@@ -169,6 +169,20 @@ ol.geom.Geometry.prototype.getExtent = function(opt_extent) {
};
/**
* Create a simplified version of this geometry using the {@link
* http://en.wikipedia.org/wiki/Ramer%E2%80%93Douglas%E2%80%93Peucker_algorithm
* Douglas Peucker} algorithm.
* @function
* @param {number} tolerance The tolerance distance for simplification.
* @return {ol.geom.Geometry} A new, simplified version of the original
* geometry.
*/
ol.geom.Geometry.prototype.simplify = function(tolerance) {
return this.getSimplifiedGeometry(tolerance * tolerance);
};
/**
* Create a simplified version of this geometry using the Douglas Peucker
* algorithm.

View File

@@ -144,6 +144,7 @@ ol.geom.SimpleGeometry.prototype.getLayout = function() {
/**
* @inheritDoc
* @api
*/
ol.geom.SimpleGeometry.prototype.getSimplifiedGeometry =
function(squaredTolerance) {