# geos::operation::buffer::BufferOp Class Reference

Computes the buffer of a geometry, for both positive and negative buffer distances. More...

`#include <geos/opBuffer.h>`

List of all members.

## Public Types

enum | { CAP_ROUND = BufferParameters::CAP_ROUND, CAP_BUTT = BufferParameters::CAP_FLAT, CAP_SQUARE = BufferParameters::CAP_SQUARE }

## Public Member Functions

| BufferOp (const geom::Geometry *g)
| BufferOp (const geom::Geometry *g, const BufferParameters &params)
void | setEndCapStyle (int nEndCapStyle)
void | setQuadrantSegments (int nQuadrantSegments)
geom::Geometry * | getResultGeometry (double nDistance)

## Static Public Member Functions

static geom::Geometry * | bufferOp (const geom::Geometry *g, double distance, int quadrantSegments=BufferParameters::DEFAULT_QUADRANT_SEGMENTS, int endCapStyle=BufferParameters::CAP_ROUND)

## Detailed Description

Computes the buffer of a geometry, for both positive and negative buffer distances.

In GIS, the buffer of a geometry is defined as the Minkowski sum or difference of the geometry with a circle with radius equal to the absolute value of the buffer distance. In the CAD/CAM world buffers are known as offset curves. In morphological analysis they are known as erosion and dilation.

The buffer operation always returns a polygonal result. The negative or zero-distance buffer of lines and points is always an empty Polygon.

Since true buffer curves may contain circular arcs, computed buffer polygons can only be approximations to the true geometry. The user can control the accuracy of the curve approximation by specifying the number of linear segments with which to approximate a curve.

The end cap style of a linear buffer may be specified. The following end cap styles are supported:

- CAP_ROUND - the usual round end caps
- CAP_BUTT - end caps are truncated flat at the line ends
- CAP_SQUARE - end caps are squared off at the buffer distance beyond the line ends

## Member Enumeration Documentation

anonymous enum

Enumerator:

  CAP_ROUND

  Specifies a round line buffer end cap style.
  Deprecated:
    use BufferParameters

  CAP_BUTT

  Specifies a butt (or flat) line buffer end cap style.
  Deprecated:
    use BufferParameters

  CAP_SQUARE

  Specifies a square line buffer end cap style.
  Deprecated:
    use BufferParameters

## Constructor & Destructor Documentation

geos::operation::buffer::BufferOp::BufferOp | ( | const geom::Geometry * | g ) | `[inline]`

Initializes a buffer computation for the given geometry

Parameters:

  g | the geometry to buffer

geos::operation::buffer::BufferOp::BufferOp | ( | const geom::Geometry * | g,
|  | const BufferParameters & | params
| ) |  | `[inline]`

Initializes a buffer computation for the given geometry with the given set of parameters

Parameters:

  g | the geometry to buffer
  params | the buffer parameters to use. This class will copy it to private memory.

## Member Function Documentation

static geom::Geometry* geos::operation::buffer::BufferOp::bufferOp | ( | const geom::Geometry * | g,
|  | double | distance,
|  | int | quadrantSegments = `BufferParameters::DEFAULT_QUADRANT_SEGMENTS`,
|  | int | endCapStyle = `BufferParameters::CAP_ROUND`
| ) |  | `[static]`

Computes the buffer for a geometry for a given buffer distance and accuracy of approximation.

Parameters:

  g | the geometry to buffer
  distance | the buffer distance
  quadrantSegments | the number of segments used to approximate a quarter circle

Returns:
  the buffer of the input geometry

geom::Geometry* geos::operation::buffer::BufferOp::getResultGeometry | ( | double | nDistance ) |

Returns the buffer computed for a geometry for a given buffer distance.

Parameters:

  g | the geometry to buffer
  distance | the buffer distance

Returns:
  the buffer of the input geometry

void geos::operation::buffer::BufferOp::setEndCapStyle | ( | int | nEndCapStyle ) | `[inline]`

Specifies the end cap style of the generated buffer. The styles supported are CAP_ROUND, CAP_BUTT, and CAP_SQUARE. The default is CAP_ROUND.

Parameters:

  endCapStyle | the end cap style to specify

References geos::operation::buffer::BufferParameters::setEndCapStyle().

void geos::operation::buffer::BufferOp::setQuadrantSegments | ( | int | nQuadrantSegments ) | `[inline]`

Specifies the end cap style of the generated buffer. The styles supported are CAP_ROUND, CAP_BUTT, and CAP_SQUARE. The default is CAP_ROUND.

Parameters:

  endCapStyle | the end cap style to specify

References geos::operation::buffer::BufferParameters::setQuadrantSegments().

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

- BufferOp.h