Class OffsetCurve
The offset curve is based on the boundary of the buffer for the geometry
at the offset distance (see BufferOp
.
The normal mode of operation is to return the sections of the buffer boundary
which lie on the raw offset curve
(obtained via rawOffset(LineString, double)
.
The offset curve will contain multiple sections
if the input self-intersects or has close approaches.
The computed sections are ordered along the raw offset curve.
Sections are disjoint. They never self-intersect, but may be rings.
- For a
LineString
the offset curve is a linear geometry (LineString
orMultiLineString
). - For a
Point
orMultiPoint
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 offset curves of the elements.
setJoined(boolean)
the sections computed for each input line are joined into a single offset curve line.
The joined curve may self-intersect.
At larger offset distances the curve may contain "flat-line" artifacts
in places where the input self-intersects.
Offset curves support setting the number of quadrant segments,
the join style, and the mitre limit (if applicable) via
the BufferParameters
.
- Author:
- Martin Davis
-
Constructor Summary
ConstructorsConstructorDescriptionOffsetCurve
(Geometry geom, double distance) Creates a new instance for computing an offset curve for a geometry at 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 lines.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, with specified quadrant segments, join style and mitre limit.static Geometry
getCurveJoined
(Geometry geom, double distance) Computes the offset curve of a geometry at a given distance, joining curve sections into a single line for each input line.static Coordinate[]
rawOffset
(LineString line, double distance) Gets the raw offset curve for a line at a given distance, with default buffer parameters.static Coordinate[]
rawOffset
(LineString line, double distance, BufferParameters bufParams) Gets the raw offset curve for a line at a given distance.void
setJoined
(boolean isJoined) Computes a single curve line for each input linear component, by joining curve sections in order along the raw offset curve.
-
Constructor Details
-
OffsetCurve
Creates a new instance for computing an offset curve for a geometry at a given distance. with default quadrant segments (BufferParameters.DEFAULT_QUADRANT_SEGMENTS
) and join style (invalid reference
BufferParameters#JOIN_STYLE
- Parameters:
geom
- the geometry to offsetdistance
- the offset distance (positive for left, negative for right)- See Also:
-
OffsetCurve
Creates a new instance for computing an offset curve for a geometry at a given distance. setting the quadrant segments and join style and mitre limit viaBufferParameters
.- Parameters:
geom
- the geometry to offsetdistance
- the offset distance (positive for left, negative for right)bufParams
- the buffer parameters to use
-
-
Method Details
-
getCurve
Computes the offset curve of a geometry at a given distance.- Parameters:
geom
- a geometrydistance
- the offset distance (positive for left, negative for 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, with specified quadrant segments, join style and mitre limit.- Parameters:
geom
- a geometrydistance
- the offset distance (positive for left, negative for 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
-
getCurveJoined
Computes the offset curve of a geometry at a given distance, joining curve sections into a single line for each input line.- Parameters:
geom
- a geometrydistance
- the offset distance (positive for left, negative for right)- Returns:
- the joined offset curve
-
setJoined
public void setJoined(boolean isJoined) Computes a single curve line for each input linear component, by joining curve sections in order along the raw offset curve. The default mode is to compute separate curve sections.- Parameters:
isJoined
- true if joined mode should be used.
-
getCurve
Gets the computed offset curve lines.- Returns:
- the offset curve geometry
-
rawOffset
Gets the raw offset curve for a line at a given distance. The quadrant segments, join style and mitre limit can be specified viaBufferParameters
.The raw offset line may contain loops and other artifacts which are not present in the true offset curve.
- Parameters:
line
- the line to offsetdistance
- the offset distance (positive for left, negative for right)bufParams
- the buffer parameters to use- Returns:
- the raw offset curve points
-
rawOffset
Gets the raw offset curve for a line at a given distance, with default buffer parameters.- Parameters:
line
- the line to offsetdistance
- the offset distance (positive for left, negative for right)- Returns:
- the raw offset curve points
-