Add ol.geom.LineString#getSimplifiedGeometryInternal

This commit is contained in:
Tom Payne
2013-12-06 15:01:24 +01:00
parent 9612182f70
commit 6275d8528e
2 changed files with 50 additions and 0 deletions

View File

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