Class OffsetCurveBuilder
- java.lang.Object
-
- org.locationtech.jts.operation.buffer.OffsetCurveBuilder
-
public class OffsetCurveBuilder extends java.lang.Object
Computes the raw offset curve for a singleGeometry
component (ring, line or point). A raw offset curve line is not noded - it may contain self-intersections (and usually will). The final buffer polygon is computed by forming a topological graph of all the noded raw curves and tracing outside contours. The points in the raw curve are rounded to a givenPrecisionModel
.- Version:
- 1.7
-
-
Constructor Summary
Constructors Constructor Description OffsetCurveBuilder(PrecisionModel precisionModel, BufferParameters bufParams)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BufferParameters
getBufferParameters()
Gets the buffer parameters being used to generate the curve.Coordinate[]
getLineCurve(Coordinate[] inputPts, double distance)
This method handles single points as well as LineStrings.Coordinate[]
getOffsetCurve(Coordinate[] inputPts, double distance)
Coordinate[]
getRingCurve(Coordinate[] inputPts, int side, double distance)
This method handles the degenerate cases of single points and lines, as well as valid rings.boolean
isLineOffsetEmpty(double distance)
Tests whether the offset curve for line or point geometries at the given offset distance is empty (does not exist).
-
-
-
Constructor Detail
-
OffsetCurveBuilder
public OffsetCurveBuilder(PrecisionModel precisionModel, BufferParameters bufParams)
-
-
Method Detail
-
getBufferParameters
public BufferParameters getBufferParameters()
Gets the buffer parameters being used to generate the curve.- Returns:
- the buffer parameters being used
-
getLineCurve
public Coordinate[] getLineCurve(Coordinate[] inputPts, double distance)
This method handles single points as well as LineStrings. LineStrings are assumed not to be closed (the function will not fail for closed lines, but will generate superfluous line caps).- Parameters:
inputPts
- the vertices of the line to offsetdistance
- the offset distance- Returns:
- a Coordinate array representing the curve or null if the curve is empty
-
isLineOffsetEmpty
public boolean isLineOffsetEmpty(double distance)
Tests whether the offset curve for line or point geometries at the given offset distance is empty (does not exist). This is the case if:- the distance is zero,
- the distance is negative, except for the case of singled-sided buffers
- Parameters:
distance
- the offset curve distance- Returns:
- true if the offset curve is empty
-
getRingCurve
public Coordinate[] getRingCurve(Coordinate[] inputPts, int side, double distance)
This method handles the degenerate cases of single points and lines, as well as valid rings.- Parameters:
inputPts
- the coordinates of the ring (must not contain repeated points)side
- side the sidePosition
of the ring on which to construct the buffer linedistance
- the positive distance at which to create the offset- Returns:
- a Coordinate array representing the curve, or null if the curve is empty
-
getOffsetCurve
public Coordinate[] getOffsetCurve(Coordinate[] inputPts, double distance)
-
-