public class DouglasPeuckerSimplifier extends Object
Geometry using the Douglas-Peucker algorithm. Ensures that any polygonal geometries returned are valid. Simple lines are not guaranteed to remain simple after simplification. All geometry types are handled. Empty and point geometries are returned unchanged. Empty geometry components are deleted.
Note that in general D-P does not preserve topology - e.g. polygons can be split, collapse to lines or disappear holes can be created or disappear, and lines can cross. To simplify geometry while preserving topology use TopologyPreservingSimplifier. (However, using D-P is significantly faster).
TopologyPreservingSimplifier
| Constructor and Description |
|---|
DouglasPeuckerSimplifier(Geometry
Creates a simplifier for a given geometry.
|
| Modifier and Type | Method and Description |
|---|---|
Geometry |
getResultGeometry()
Gets the simplified geometry.
|
void |
setDistanceTolerance(double distanceTolerance)
Sets the distance tolerance for the simplification.
|
void |
setEnsureValid(boolean isEnsureValidTopology)
Controls whether simplified polygons will be "fixed" to have valid topology.
|
static Geometry |
simplify(Geometry
Simplifies a geometry using a given tolerance.
|
public DouglasPeuckerSimplifier(GeometryinputGeom)
inputGeom - the geometry to simplify
public static Geometrysimplify(Geometry geom, double distanceTolerance)
geom - geometry to simplify
distanceTolerance - the tolerance to use
public void setDistanceTolerance(double distanceTolerance)
distanceTolerance - the approximation tolerance to use
public void setEnsureValid(boolean isEnsureValidTopology)
isEnsureValidTopology -
public GeometrygetResultGeometry()