Class BufferBuilder
java.lang.Object
org.locationtech.jts.operation.buffer.BufferBuilder
Builds the buffer geometry for a given input geometry and precision model.
Allows setting the level of approximation for circular arcs,
and the precision model in which to carry out the computation.
When computing buffers in floating point double-precision
it can happen that the process of iterated noding can fail to converge (terminate).
In this case a TopologyException
will be thrown.
Retrying the computation in a fixed precision
can produce more robust results.
- Version:
- 1.7
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate BufferParameters
private EdgeList
private GeometryFactory
private PlanarGraph
private Noder
private PrecisionModel
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate void
buildSubgraphs
(List subgraphList, PolygonBuilder polyBuilder) Completes the building of the input subgraphs by depth-labelling them, and adds them to the PolygonBuilder.private void
computeNodedEdges
(List bufferSegStrList, PrecisionModel precisionModel) private static Geometry
private Geometry
Gets the standard result for an empty buffer.private List
createSubgraphs
(PlanarGraph graph) private static int
depthDelta
(Label label) Compute the change in depth as an edge is crossed from R to Lprivate Noder
getNoder
(PrecisionModel precisionModel) protected void
Inserted edges are checked to see if an identical edge already exists.void
Sets theNoder
to use during noding.void
Sets the precision model to use during the curve computation and noding, if it is different to the precision model of the Geometry.
-
Field Details
-
bufParams
-
workingPrecisionModel
-
workingNoder
-
geomFact
-
graph
-
edgeList
-
-
Constructor Details
-
BufferBuilder
Creates a new BufferBuilder
-
-
Method Details
-
depthDelta
Compute the change in depth as an edge is crossed from R to L -
setWorkingPrecisionModel
Sets the precision model to use during the curve computation and noding, if it is different to the precision model of the Geometry. If the precision model is less than the precision of the Geometry precision model, the Geometry must have previously been rounded to that precision.- Parameters:
pm
- the precision model to use
-
setNoder
Sets theNoder
to use during noding. This allows choosing fast but non-robust noding, or slower but robust noding.- Parameters:
noder
- the noder to use
-
buffer
-
getNoder
-
computeNodedEdges
-
insertUniqueEdge
Inserted edges are checked to see if an identical edge already exists. If so, the edge is not inserted, but its label is merged with the existing edge. -
createSubgraphs
-
buildSubgraphs
Completes the building of the input subgraphs by depth-labelling them, and adds them to the PolygonBuilder. The subgraph list must be sorted in rightmost-coordinate order.- Parameters:
subgraphList
- the subgraphs to buildpolyBuilder
- the PolygonBuilder which will build the final polygons
-
convertSegStrings
-
createEmptyResultGeometry
Gets the standard result for an empty buffer. Since buffer always returns a polygonal result, this is chosen to be an empty polygon.- Returns:
- the empty result geometry
-