GEOS  3.13.0dev
Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
geos::operation::buffer::OffsetCurve Class Reference

#include <OffsetCurve.h>

Public Member Functions

 OffsetCurve (const Geometry &geom, double dist)
 
 OffsetCurve (const Geometry &geom, double dist, BufferParameters &bp)
 
void setJoined (bool pIsJoined)
 
std::unique_ptr< GeometrygetCurve ()
 

Static Public Member Functions

static std::unique_ptr< GeometrygetCurve (const Geometry &geom, double dist, int quadSegs, BufferParameters::JoinStyle joinStyle, double mitreLimit)
 
static std::unique_ptr< GeometrygetCurve (const Geometry &geom, double dist)
 
static std::unique_ptr< GeometrygetCurveJoined (const Geometry &geom, double dist)
 
static std::unique_ptr< CoordinateSequencerawOffsetCurve (const LineString &line, double distance, BufferParameters &bufParams)
 
static std::unique_ptr< CoordinateSequencerawOffset (const LineString &line, double distance)
 

Static Public Attributes

static constexpr int MATCH_DISTANCE_FACTOR = 10000
 
static constexpr int MIN_QUADRANT_SEGMENTS = 8
 

Detailed Description

Computes an offset curve from a geometry. An offset curve is a linear geometry which is offset a given 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. The curve(s) have the same direction as the input line(s).

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.

In "joined" mode (see setJoined(bool)) 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 & Destructor Documentation

◆ OffsetCurve() [1/2]

geos::operation::buffer::OffsetCurve::OffsetCurve ( const Geometry geom,
double  dist 
)
inline

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 (BufferParameters::JOIN_STYLE).

Parameters
geomthe geometry to offset
distthe offset distance (positive for left, negative for right)
See also
BufferParameters

◆ OffsetCurve() [2/2]

geos::operation::buffer::OffsetCurve::OffsetCurve ( const Geometry geom,
double  dist,
BufferParameters bp 
)
inline

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 via BufferParameters.

Parameters
geomthe geometry to offset
distthe offset distance (positive for left, negative for right)
bpthe buffer parameters to use

Prevent using a very small QuadSegs value, to avoid offset curve artifacts near the end caps.

References geos::operation::buffer::BufferParameters::getJoinStyle(), geos::operation::buffer::BufferParameters::getMitreLimit(), geos::operation::buffer::BufferParameters::getQuadrantSegments(), geos::operation::buffer::BufferParameters::setJoinStyle(), geos::operation::buffer::BufferParameters::setMitreLimit(), and geos::operation::buffer::BufferParameters::setQuadrantSegments().

Member Function Documentation

◆ getCurve()

std::unique_ptr<Geometry> geos::operation::buffer::OffsetCurve::getCurve ( )

Gets the computed offset curve lines.

Returns
the offset curve geometry

◆ getCurveJoined()

static std::unique_ptr<Geometry> geos::operation::buffer::OffsetCurve::getCurveJoined ( const Geometry geom,
double  dist 
)
static

Computes the offset curve of a geometry at a given distance, joining curve sections into a single line for each input line.

Parameters
geoma geometry
distthe offset distance (positive for left, negative for right)
Returns
the joined offset curve

◆ rawOffset()

static std::unique_ptr<CoordinateSequence> geos::operation::buffer::OffsetCurve::rawOffset ( const LineString line,
double  distance 
)
static

Gets the raw offset curve for a line at a given distance, with default buffer parameters.

Parameters
linethe line to offset
distancethe offset distance (positive for left, negative for right)
Returns
the raw offset curve points

◆ rawOffsetCurve()

static std::unique_ptr<CoordinateSequence> geos::operation::buffer::OffsetCurve::rawOffsetCurve ( const LineString line,
double  distance,
BufferParameters bufParams 
)
static

Gets the raw offset curve for a line at a given distance. The quadrant segments, join style and mitre limit can be specified via BufferParameters.

The raw offset line may contain loops and other artifacts which are not present in the true offset curve.

Parameters
linethe line to offset
distancethe offset distance (positive for left, negative for right)
bufParamsthe buffer parameters to use
Returns
the raw offset curve points

◆ setJoined()

void geos::operation::buffer::OffsetCurve::setJoined ( bool  pIsJoined)

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
pIsJoinedtrue if joined mode should be used.

Member Data Documentation

◆ MIN_QUADRANT_SEGMENTS

constexpr int geos::operation::buffer::OffsetCurve::MIN_QUADRANT_SEGMENTS = 8
staticconstexpr

A QuadSegs minimum value that will prevent generating unwanted offset curve artifacts near end caps.


The documentation for this class was generated from the following file: