Class BufferBuilder
- java.lang.Object
-
- org.locationtech.jts.operation.buffer.BufferBuilder
-
class BufferBuilder extends java.lang.ObjectBuilds 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
TopologyExceptionwill be thrown. Retrying the computation in a fixed precision can produce more robust results.- Version:
- 1.7
-
-
Field Summary
Fields Modifier and Type Field Description private BufferParametersbufParamsprivate EdgeListedgeListprivate GeometryFactorygeomFactprivate PlanarGraphgraphprivate NoderworkingNoderprivate PrecisionModelworkingPrecisionModel
-
Constructor Summary
Constructors Constructor Description BufferBuilder(BufferParameters bufParams)Creates a new BufferBuilder
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Geometrybuffer(Geometry g, double distance)private voidbuildSubgraphs(java.util.List subgraphList, PolygonBuilder polyBuilder)Completes the building of the input subgraphs by depth-labelling them, and adds them to the PolygonBuilder.private voidcomputeNodedEdges(java.util.List bufferSegStrList, PrecisionModel precisionModel)private static GeometryconvertSegStrings(java.util.Iterator it)private GeometrycreateEmptyResultGeometry()Gets the standard result for an empty buffer.private java.util.ListcreateSubgraphs(PlanarGraph graph)private static intdepthDelta(Label label)Compute the change in depth as an edge is crossed from R to Lprivate NodergetNoder(PrecisionModel precisionModel)protected voidinsertUniqueEdge(Edge e)Inserted edges are checked to see if an identical edge already exists.voidsetNoder(Noder noder)Sets theNoderto use during noding.voidsetWorkingPrecisionModel(PrecisionModel pm)Sets the precision model to use during the curve computation and noding, if it is different to the precision model of the Geometry.
-
-
-
Field Detail
-
bufParams
private BufferParameters bufParams
-
workingPrecisionModel
private PrecisionModel workingPrecisionModel
-
workingNoder
private Noder workingNoder
-
geomFact
private GeometryFactory geomFact
-
graph
private PlanarGraph graph
-
edgeList
private EdgeList edgeList
-
-
Constructor Detail
-
BufferBuilder
public BufferBuilder(BufferParameters bufParams)
Creates a new BufferBuilder
-
-
Method Detail
-
depthDelta
private static int depthDelta(Label label)
Compute the change in depth as an edge is crossed from R to L
-
setWorkingPrecisionModel
public void setWorkingPrecisionModel(PrecisionModel pm)
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
public void setNoder(Noder noder)
Sets theNoderto use during noding. This allows choosing fast but non-robust noding, or slower but robust noding.- Parameters:
noder- the noder to use
-
getNoder
private Noder getNoder(PrecisionModel precisionModel)
-
computeNodedEdges
private void computeNodedEdges(java.util.List bufferSegStrList, PrecisionModel precisionModel)
-
insertUniqueEdge
protected void insertUniqueEdge(Edge e)
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
private java.util.List createSubgraphs(PlanarGraph graph)
-
buildSubgraphs
private void buildSubgraphs(java.util.List subgraphList, PolygonBuilder polyBuilder)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
private static Geometry convertSegStrings(java.util.Iterator it)
-
createEmptyResultGeometry
private Geometry 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
-
-