Add ol.geom.LinearRing#getSimplifiedGeometryInternal

This commit is contained in:
Tom Payne
2013-12-07 12:23:09 +01:00
parent 6275d8528e
commit 956bff0fe2

View File

@@ -2,6 +2,7 @@ goog.provide('ol.geom.LinearRing');
goog.require('ol.geom.Geometry');
goog.require('ol.geom.flat');
goog.require('ol.geom.simplify');
@@ -36,6 +37,22 @@ ol.geom.LinearRing.prototype.getCoordinates = function() {
};
/**
* @inheritDoc
*/
ol.geom.LinearRing.prototype.getSimplifiedGeometryInternal =
function(squaredTolerance) {
var simplifiedFlatCoordinates = [];
simplifiedFlatCoordinates.length = ol.geom.simplify.douglasPeucker(
this.flatCoordinates, 0, this.flatCoordinates.length, this.stride,
squaredTolerance, simplifiedFlatCoordinates, 0);
var simplifiedLinearRing = new ol.geom.LinearRing(null);
simplifiedLinearRing.setFlatCoordinates(
ol.geom.GeometryLayout.XY, simplifiedFlatCoordinates);
return simplifiedLinearRing;
};
/**
* @inheritDoc
*/