Package org.locationtech.jts.densify
Class Densifier
- java.lang.Object
-
- org.locationtech.jts.densify.Densifier
-
public class Densifier extends java.lang.Object
Densifies aGeometry
by inserting extra vertices along the line segments contained in the geometry. All segments in the created densified geometry will be no longer than the given distance tolerance (that is, all segments in the output will have length less than or equal to the distance tolerance). The coordinates created during densification respect the input geometry'sPrecisionModel
.By default polygonal results are processed to ensure they are valid. This processing is costly, and it is very rare for results to be invalid. Validation processing can be disabled by calling the
setValidate(boolean)
method.Note: At some future point this class will offer a variety of densification strategies.
- Author:
- Martin Davis
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Geometry
densify(Geometry geom, double distanceTolerance)
Densifies a geometry using a given distance tolerance, and respecting the input geometry'sPrecisionModel
.Geometry
getResultGeometry()
Gets the densified geometry.void
setDistanceTolerance(double distanceTolerance)
Sets the distance tolerance for the densification.void
setValidate(boolean isValidated)
Sets whether polygonal results are processed to ensure they are valid.
-
-
-
Constructor Detail
-
Densifier
public Densifier(Geometry inputGeom)
Creates a new densifier instance.- Parameters:
inputGeom
-
-
-
Method Detail
-
densify
public static Geometry densify(Geometry geom, double distanceTolerance)
Densifies a geometry using a given distance tolerance, and respecting the input geometry'sPrecisionModel
.- Parameters:
geom
- the geometry to densifydistanceTolerance
- the distance tolerance to densify- Returns:
- the densified geometry
-
setDistanceTolerance
public void setDistanceTolerance(double distanceTolerance)
Sets the distance tolerance for the densification. All line segments in the densified geometry will be no longer than the distance tolerance. The distance tolerance must be positive.- Parameters:
distanceTolerance
- the densification tolerance to use
-
setValidate
public void setValidate(boolean isValidated)
Sets whether polygonal results are processed to ensure they are valid.- Parameters:
isValidated
- true if the results should be validated
-
getResultGeometry
public Geometry getResultGeometry()
Gets the densified geometry.- Returns:
- the densified geometry
-
-