Package org.locationtech.jts.triangulate
Class ConformingDelaunayTriangulationBuilder
- java.lang.Object
-
- org.locationtech.jts.triangulate.ConformingDelaunayTriangulationBuilder
-
public class ConformingDelaunayTriangulationBuilder extends java.lang.Object
A utility class which creates Conforming Delaunay Triangulations from collections of points and linear constraints, and extract the resulting triangulation edges or triangles as geometries.
-
-
Field Summary
Fields Modifier and Type Field Description private Geometry
constraintLines
private java.util.Map
constraintVertexMap
private java.util.Collection
siteCoords
private QuadEdgeSubdivision
subdiv
private double
tolerance
-
Constructor Summary
Constructors Constructor Description ConformingDelaunayTriangulationBuilder()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
create()
private static java.util.List
createConstraintSegments(Geometry geom)
private static void
createConstraintSegments(LineString line, java.util.List constraintSegs)
private java.util.List
createSiteVertices(java.util.Collection coords)
private void
createVertices(Geometry geom)
Geometry
getEdges(GeometryFactory geomFact)
Gets the edges of the computed triangulation as aMultiLineString
.QuadEdgeSubdivision
getSubdivision()
Gets the QuadEdgeSubdivision which models the computed triangulation.Geometry
getTriangles(GeometryFactory geomFact)
Gets the faces of the computed triangulation as aGeometryCollection
ofPolygon
.void
setConstraints(Geometry constraintLines)
Sets the linear constraints to be conformed to.void
setSites(Geometry geom)
Sets the sites (point or vertices) which will be triangulated.void
setTolerance(double tolerance)
Sets the snapping tolerance which will be used to improved the robustness of the triangulation computation.
-
-
-
Field Detail
-
siteCoords
private java.util.Collection siteCoords
-
constraintLines
private Geometry constraintLines
-
tolerance
private double tolerance
-
subdiv
private QuadEdgeSubdivision subdiv
-
constraintVertexMap
private java.util.Map constraintVertexMap
-
-
Method Detail
-
setSites
public void setSites(Geometry geom)
Sets the sites (point or vertices) which will be triangulated. All vertices of the given geometry will be used as sites. The site vertices do not have to contain the constraint vertices as well; any site vertices which are identical to a constraint vertex will be removed from the site vertex set.- Parameters:
geom
- the geometry from which the sites will be extracted.
-
setConstraints
public void setConstraints(Geometry constraintLines)
Sets the linear constraints to be conformed to. All linear components in the input will be used as constraints. The constraint vertices do not have to be disjoint from the site vertices. The constraints must not contain duplicate segments (up to orientation).- Parameters:
constraintLines
- the lines to constraint to
-
setTolerance
public void setTolerance(double tolerance)
Sets the snapping tolerance which will be used to improved the robustness of the triangulation computation. A tolerance of 0.0 specifies that no snapping will take place.- Parameters:
tolerance
- the tolerance distance to use
-
create
private void create()
-
createSiteVertices
private java.util.List createSiteVertices(java.util.Collection coords)
-
createVertices
private void createVertices(Geometry geom)
-
createConstraintSegments
private static java.util.List createConstraintSegments(Geometry geom)
-
createConstraintSegments
private static void createConstraintSegments(LineString line, java.util.List constraintSegs)
-
getSubdivision
public QuadEdgeSubdivision getSubdivision()
Gets the QuadEdgeSubdivision which models the computed triangulation.- Returns:
- the subdivision containing the triangulation
-
getEdges
public Geometry getEdges(GeometryFactory geomFact)
Gets the edges of the computed triangulation as aMultiLineString
.- Parameters:
geomFact
- the geometry factory to use to create the output- Returns:
- the edges of the triangulation
-
getTriangles
public Geometry getTriangles(GeometryFactory geomFact)
Gets the faces of the computed triangulation as aGeometryCollection
ofPolygon
.- Parameters:
geomFact
- the geometry factory to use to create the output- Returns:
- the faces of the triangulation
-
-