GEOS  3.9.1dev
Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes | List of all members
geos::operation::buffer::BufferOp Class Reference

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

#include <BufferOp.h>

Collaboration diagram for geos::operation::buffer::BufferOp:
[legend]

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)
 Initializes a buffer computation for the given geometry. More...
 
 BufferOp (const geom::Geometry *g, const BufferParameters &params)
 Initializes a buffer computation for the given geometry with the given set of parameters. More...
 
void setEndCapStyle (int nEndCapStyle)
 Specifies the end cap style of the generated buffer. More...
 
void setQuadrantSegments (int nQuadrantSegments)
 Sets the number of segments used to approximate a angle fillet. More...
 
void setSingleSided (bool isSingleSided)
 Sets whether the computed buffer should be single-sided. More...
 
geom::GeometrygetResultGeometry (double nDistance)
 Returns the buffer computed for a geometry for a given buffer distance. More...
 

Static Public Member Functions

static geom::GeometrybufferOp (const geom::Geometry *g, double distance, int quadrantSegments=BufferParameters::DEFAULT_QUADRANT_SEGMENTS, int endCapStyle=BufferParameters::CAP_ROUND)
 Computes the buffer for a geometry for a given buffer distance and accuracy of approximation. More...
 

Private Member Functions

void computeGeometry ()
 
void bufferOriginalPrecision ()
 
void bufferReducedPrecision (int precisionDigits)
 
void bufferReducedPrecision ()
 
void bufferFixedPrecision (const geom::PrecisionModel &fixedPM)
 

Static Private Member Functions

static double precisionScaleFactor (const geom::Geometry *g, double distance, int maxPrecisionDigits)
 

Private Attributes

const geom::GeometryargGeom
 
util::TopologyException saveException
 
double distance
 
BufferParameters bufParams
 
geom::GeometryresultGeometry
 

Static Private Attributes

static const int MAX_PRECISION_DIGITS = 12
 A number of digits of precision which leaves some computational "headroom" for floating point operations. More...
 

Detailed Description

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

In GIS, the positive (or negative) 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 the operation of positive and negative buffering is referred to 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:

Definition at line 78 of file BufferOp.h.

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

Definition at line 134 of file BufferOp.h.

Constructor & Destructor Documentation

geos::operation::buffer::BufferOp::BufferOp ( const geom::Geometry g)
inline

Initializes a buffer computation for the given geometry.

Parameters
gthe geometry to buffer

Definition at line 171 of file BufferOp.h.

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
gthe geometry to buffer
paramsthe buffer parameters to use. This class will copy it to private memory.

Definition at line 187 of file BufferOp.h.

Member Function Documentation

void geos::operation::buffer::BufferOp::bufferFixedPrecision ( const geom::PrecisionModel fixedPM)
private
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
gthe geometry to buffer
distancethe buffer distance
quadrantSegmentsthe number of segments used to approximate a quarter circle
endCapStyleline buffer end cap style (default: BufferParameters::CAP_ROUND)
Returns
the buffer of the input geometry
void geos::operation::buffer::BufferOp::bufferOriginalPrecision ( )
private
void geos::operation::buffer::BufferOp::bufferReducedPrecision ( int  precisionDigits)
private
void geos::operation::buffer::BufferOp::bufferReducedPrecision ( )
private
void geos::operation::buffer::BufferOp::computeGeometry ( )
private
geom::Geometry* geos::operation::buffer::BufferOp::getResultGeometry ( double  nDistance)

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

Parameters
nDistancethe buffer distance
Returns
the buffer of the input geometry
static double geos::operation::buffer::BufferOp::precisionScaleFactor ( const geom::Geometry g,
double  distance,
int  maxPrecisionDigits 
)
staticprivate

Compute a reasonable scale factor to limit the precision of a given combination of Geometry and buffer distance. The scale factor is based on a heuristic.

Parameters
gthe Geometry being buffered
distancethe buffer distance
maxPrecisionDigitsthe mzx # of digits that should be allowed by the precision determined by the computed scale factor
Returns
a scale factor that allows a reasonable amount of precision for the buffer computation
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
nEndCapStylethe end cap style to specify

Definition at line 253 of file BufferOp.h.

void geos::operation::buffer::BufferOp::setQuadrantSegments ( int  nQuadrantSegments)
inline

Sets the number of segments used to approximate a angle fillet.

Parameters
nQuadrantSegmentsthe number of segments in a fillet for a quadrant

Definition at line 247 of file BufferOp.h.

void geos::operation::buffer::BufferOp::setSingleSided ( bool  isSingleSided)
inline

Sets whether the computed buffer should be single-sided.

A single-sided buffer is constructed on only one side of each input line.

The side used is determined by the sign of the buffer distance:

  • a positive distance indicates the left-hand side
  • a negative distance indicates the right-hand side

The single-sided buffer of point geometries is the same as the regular buffer.

The End Cap Style for single-sided buffers is always ignored, and forced to the equivalent of CAP_FLAT.

Parameters
isSingleSidedtrue if a single-sided buffer should be constructed

Definition at line 259 of file BufferOp.h.

Member Data Documentation

const geom::Geometry* geos::operation::buffer::BufferOp::argGeom
private

Definition at line 110 of file BufferOp.h.

BufferParameters geos::operation::buffer::BufferOp::bufParams
private

Definition at line 118 of file BufferOp.h.

double geos::operation::buffer::BufferOp::distance
private

Definition at line 114 of file BufferOp.h.

const int geos::operation::buffer::BufferOp::MAX_PRECISION_DIGITS = 12
staticprivate

A number of digits of precision which leaves some computational "headroom" for floating point operations.

This value should be less than the decimal precision of double-precision values (16).

Definition at line 89 of file BufferOp.h.

geom::Geometry* geos::operation::buffer::BufferOp::resultGeometry
private

Definition at line 120 of file BufferOp.h.

util::TopologyException geos::operation::buffer::BufferOp::saveException
private

Definition at line 112 of file BufferOp.h.


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