Add ol.geom.Polygon#getSimplifiedGeometryInternal
This commit is contained in:
@@ -3,6 +3,7 @@ goog.provide('ol.geom.Polygon');
|
||||
goog.require('ol.geom.Geometry');
|
||||
goog.require('ol.geom.LinearRing');
|
||||
goog.require('ol.geom.flat');
|
||||
goog.require('ol.geom.simplify');
|
||||
|
||||
|
||||
|
||||
@@ -104,6 +105,23 @@ ol.geom.Polygon.prototype.getLinearRings = function() {
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.geom.Polygon.prototype.getSimplifiedGeometryInternal =
|
||||
function(squaredTolerance) {
|
||||
var simplifiedFlatCoordinates = [];
|
||||
var simplifiedEnds = [];
|
||||
simplifiedFlatCoordinates.length = ol.geom.simplify.douglasPeuckers(
|
||||
this.flatCoordinates, 0, this.ends_, this.stride, squaredTolerance,
|
||||
simplifiedFlatCoordinates, 0, simplifiedEnds);
|
||||
var simplifiedPolygon = new ol.geom.Polygon(null);
|
||||
simplifiedPolygon.setFlatCoordinates(
|
||||
ol.geom.GeometryLayout.XY, simplifiedFlatCoordinates, simplifiedEnds);
|
||||
return simplifiedPolygon;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user