Class OffsetCurve
java.lang.Object
org.locationtech.jts.operation.buffer.OffsetCurve
Computes an offset curve from a geometry.
The offset curve is a linear geometry which is offset a specified distance
from the input.
If the offset distance is positive the curve lies on the left side of the input;
if it is negative the curve is on the right side.
- For a
LineString
the offset curve is a line. - For a
Point
the offset curve is an emptyLineString
. - For a
Polygon
the offset curve is the boundary of the polygon buffer (which may be aMultiLineString
. - For a collection the output is a
MultiLineString
containing the element offset curves.
- For self-intersecting lines, the buffer boundary includes offset lines for both left and right sides of the input line. Only a single contiguous portion on the specified side is returned.
- If the offset corresponds to buffer holes, only the largest hole is used.
BufferParameters
.- Author:
- Martin Davis
-
Constructor Summary
ConstructorsConstructorDescriptionOffsetCurve
(Geometry geom, double distance) Creates a new instance for computing an offset curve for a geometryat a given distance.OffsetCurve
(Geometry geom, double distance, BufferParameters bufParams) Creates a new instance for computing an offset curve for a geometry at a given distance. -
Method Summary
Modifier and TypeMethodDescriptiongetCurve()
Gets the computed offset curve.static Geometry
Computes the offset curve of a geometry at a given distance.static Geometry
Computes the offset curve of a geometry at a given distance, and for a specified quadrant segments, join style and mitre limit.static Coordinate[]
rawOffset
(LineString geom, double distance) Gets the raw offset line, with default buffer parameters.static Coordinate[]
rawOffset
(LineString geom, double distance, BufferParameters bufParams) Gets the raw offset line.
-
Constructor Details
-
OffsetCurve
Creates a new instance for computing an offset curve for a geometryat a given distance. with default quadrant segments (BufferParameters.DEFAULT_QUADRANT_SEGMENTS
) and join style (BufferParameters#JOIN_STYLE
).- Parameters:
geom
- the geometry to offsetdistance
- the offset distance (positive = left, negative = right)- See Also:
-
OffsetCurve
Creates a new instance for computing an offset curve for a geometry at a given distance. allowing the quadrant segments and join style and mitre limit to be set viaBufferParameters
.- Parameters:
geom
-distance
-bufParams
-
-
-
Method Details
-
getCurve
Computes the offset curve of a geometry at a given distance.- Parameters:
geom
- a geometrydistance
- the offset distance (positive = left, negative = right)- Returns:
- the offset curve
-
getCurve
public static Geometry getCurve(Geometry geom, double distance, int quadSegs, int joinStyle, double mitreLimit) Computes the offset curve of a geometry at a given distance, and for a specified quadrant segments, join style and mitre limit.- Parameters:
geom
- a geometrydistance
- the offset distance (positive = left, negative = right)quadSegs
- the quadrant segments (-1 for default)joinStyle
- the join style (-1 for default)mitreLimit
- the mitre limit (-1 for default)- Returns:
- the offset curve
-
getCurve
Gets the computed offset curve.- Returns:
- the offset curve geometry
-
rawOffset
Gets the raw offset line. The quadrant segments and join style and mitre limit to be set viaBufferParameters
.The raw offset line may contain loops and other artifacts which are not present in the true offset curve. The raw offset line is matched to the buffer ring (which is clean) to extract the offset curve.
- Parameters:
geom
- the linestring to offsetdistance
- the offset distancebufParams
- the buffer parameters to use- Returns:
- the raw offset line
-
rawOffset
Gets the raw offset line, with default buffer parameters.- Parameters:
geom
- the linestring to offsetdistance
- the offset distance- Returns:
- the raw offset line
-