public class VWSimplifier extends Object
Geometry
using the Visvalingam-Whyatt area-based 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.
The simplification tolerance is specified as a distance. This is converted to an area tolerance by squaring it.
Note that in general this algorithm 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.
Constructor and Description |
---|
VWSimplifier(Geometry inputGeom)
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 geom,
double distanceTolerance)
Simplifies a geometry using a given tolerance.
|
public VWSimplifier(Geometry inputGeom)
inputGeom
- the geometry to simplifypublic static Geometry simplify(Geometry geom, double distanceTolerance)
geom
- geometry to simplifydistanceTolerance
- the tolerance to usepublic void setDistanceTolerance(double distanceTolerance)
distanceTolerance
- the approximation tolerance to usepublic void setEnsureValid(boolean isEnsureValidTopology)
isEnsureValidTopology
- public Geometry getResultGeometry()
Copyright © 2020. All rights reserved.