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 than the given distance tolerance. Densified polygonal geometries are guaranteed to be topologically correct. The coordinates created during densification respect the input geometry'sPrecisionModel
.Note: At some future point this class will offer a variety of densification strategies.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static class
Densifier.DensifyTransformer
-
Field Summary
Fields Modifier and Type Field Description private double
distanceTolerance
private Geometry
inputGeom
-
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
.private static Coordinate[]
densifyPoints(Coordinate[] pts, double distanceTolerance, PrecisionModel precModel)
Densifies a coordinate sequence.Geometry
getResultGeometry()
Gets the densified geometry.void
setDistanceTolerance(double distanceTolerance)
Sets the distance tolerance for the densification.
-
-
-
Field Detail
-
inputGeom
private Geometry inputGeom
-
distanceTolerance
private double distanceTolerance
-
-
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
-
densifyPoints
private static Coordinate[] densifyPoints(Coordinate[] pts, double distanceTolerance, PrecisionModel precModel)
Densifies a coordinate sequence.- Parameters:
pts
-distanceTolerance
-- Returns:
- the densified coordinate sequence
-
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. simplified geometry will be within this distance of the original geometry. The distance tolerance must be positive.- Parameters:
distanceTolerance
- the densification tolerance to use
-
getResultGeometry
public Geometry getResultGeometry()
Gets the densified geometry.- Returns:
- the densified geometry
-
-