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< Geometry > | getCurve ()

## Static Public Member Functions

static std::unique_ptr< Geometry > | getCurve (const Geometry &geom, double dist, int quadSegs, BufferParameters::JoinStyle joinStyle, double mitreLimit)
static std::unique_ptr< Geometry > | getCurve (const Geometry &geom, double dist)
static std::unique_ptr< Geometry > | getCurveJoined (const Geometry &geom, double dist)
static std::unique_ptr< CoordinateSequence > | rawOffsetCurve (const LineString &line, double distance, BufferParameters &bufParams)
static std::unique_ptr< CoordinateSequence > | rawOffset (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.

- For a LineString the offset curve is a linear geometry (LineString or MultiLineString).
- For a Point or MultiPoint the offset curve is an empty LineString.
- For a Polygon the offset curve is the boundary of the polygon buffer (which may be a MultiLineString.
- For a collection the output is a MultiLineString containing the offset curves of the elements.

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

  geom | the geometry to offset
  dist | the 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

  geom | the geometry to offset
  dist | the offset distance (positive for left, negative for right)
  bp | the 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(), and MIN_QUADRANT_SEGMENTS.

## 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()

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

  geom | a geometry
  dist | the offset distance (positive for left, negative for right)

Returns
  the joined offset curve

## rawOffset()

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

  line | the line to offset
  distance | the offset distance (positive for left, negative for right)

Returns
  the raw offset curve points

## rawOffsetCurve()

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

  line | the line to offset
  distance | the offset distance (positive for left, negative for right)
  bufParams | the 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

  pIsJoined | true if joined mode should be used.

## Member Data Documentation

## MIN_QUADRANT_SEGMENTS

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

static constexpr

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

Referenced by OffsetCurve().

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

- OffsetCurve.h