Package com.graphhopper.util
Class RamerDouglasPeucker
java.lang.Object
com.graphhopper.util.RamerDouglasPeucker
Simplifies a list of 2D points which are not too far away.
http://en.wikipedia.org/wiki/Ramer%E2%80%93Douglas%E2%80%93Peucker_algorithm
Calling simplify is thread safe.
- Author:
- Peter Karich
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
setApproximation
(boolean a) setElevationMaxDistance
(double dist) maximum elevation distance of discrepancy (from the normal way) in meterssetMaxDistance
(double dist) maximum distance of discrepancy (from the normal way) in meterint
Simplifies thepoints
, from index 0 to size-1.int
int
Simplifies a part of thepoints
.
-
Constructor Details
-
RamerDouglasPeucker
public RamerDouglasPeucker()
-
-
Method Details
-
setApproximation
public void setApproximation(boolean a) -
setMaxDistance
maximum distance of discrepancy (from the normal way) in meter -
setElevationMaxDistance
maximum elevation distance of discrepancy (from the normal way) in meters -
simplify
Simplifies thepoints
, from index 0 to size-1.It is a wrapper method for
simplify(PointList, int, int)
.- Returns:
- The number removed points
-
simplify
-
simplify
Simplifies a part of thepoints
. ThefromIndex
andlastIndex
are guaranteed to be kept.- Parameters:
points
- The PointList to simplifyfromIndex
- Start index to simplify, should be <=lastIndex
lastIndex
- Simplify up to this indexcompress
- Whether thepoints
shall be compressed or not, if set to false no points are actually removed, but instead their lat/lon/ele is only set to NaN- Returns:
- The number of removed points
-