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 TypeMethodDescriptionvoidsetApproximation(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 meterintSimplifies thepoints, from index 0 to size-1.intintSimplifies 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. ThefromIndexandlastIndexare guaranteed to be kept.- Parameters:
points- The PointList to simplifyfromIndex- Start index to simplify, should be <=lastIndexlastIndex- Simplify up to this indexcompress- Whether thepointsshall 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
-