public class OffsetCurve extends Object
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.
LineString the offset curve is a linear geometry
(LineString or MultiLineString).
Point or MultiPoint the offset curve is an empty LineString.
Polygon the offset curve is the boundary of the polygon buffer (which
may be a MultiLineString.
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.
| Constructor and Description |
|---|
OffsetCurve(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.
|
| Modifier and Type | Method and Description |
|---|---|
Geometry |
getCurve()
Gets the computed offset curve lines.
|
static Geometry |
getCurve(Geometry geom,
double distance)
Computes the offset curve of a geometry at a given distance.
|
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.
|
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.
|
public OffsetCurve(Geometry geom, double distance)
BufferParameters.DEFAULT_QUADRANT_SEGMENTS)
and join style (BufferParameters#JOIN_STYLE).geom - the geometry to offsetdistance - the offset distance (positive for left, negative for right)BufferParameterspublic OffsetCurve(Geometry geom, double distance, BufferParameters bufParams)
BufferParameters.geom - the geometry to offsetdistance - the offset distance (positive for left, negative for right)bufParams - the buffer parameters to usepublic static Geometry getCurve(Geometry geom, double distance)
geom - a geometrydistance - the offset distance (positive for left, negative for right)public static Geometry getCurve(Geometry geom, double distance, int quadSegs, int joinStyle, double mitreLimit)
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)public static Geometry getCurveJoined(Geometry geom, double distance)
geom - a geometrydistance - the offset distance (positive for left, negative for right)public void setJoined(boolean isJoined)
isJoined - true if joined mode should be used.public Geometry getCurve()
public static Coordinate[] rawOffset(LineString line, double distance, BufferParameters bufParams)
BufferParameters.
The raw offset line may contain loops and other artifacts which are not present in the true offset curve.
line - the line to offsetdistance - the offset distance (positive for left, negative for right)bufParams - the buffer parameters to usepublic static Coordinate[] rawOffset(LineString line, double distance)
line - the line to offsetdistance - the offset distance (positive for left, negative for right)Copyright © 2024. All rights reserved.