Class BufferOp
- Namespace
- NetTopologySuite.Operation.Buffer
- Assembly
- NetTopologySuite.dll
Computes the buffer of a geometry, for both positive and negative buffer distances.
public class BufferOp
- Inheritance
-
BufferOp
- Inherited Members
Remarks
In GIS, the positive (or negative) buffer of a geometry is defined as the Minkowski sum (or difference) of the geometry with a circle of 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 are only approximations to the true geometry. The user can control the accuracy of the approximation by specifying the number of linear segments used to approximate arcs. This is specified via QuadrantSegments or QuadrantSegments.
The EndCapStyle of a linear buffer may be specified. The following end cap styles are supported:
- Round - the usual round end caps
- Flat - end caps are truncated flat at the line ends
- Square - end caps are squared off at the buffer distance beyond the line ends
The JoinStyle of the corners in a buffer may be specified. The following join styles are supported:
- Round - the usual round join
- Mitre - corners are "sharp" (up to a MitreLimit distance limit})
- Bevel - corners are beveled (clipped off)
The buffer algorithm may perform simplification on the input to increase performance. The simplification is performed a way that always increases the buffer area (so that the simplified input covers the original input). The degree of simplification can be specified with SimplifyFactor, with a DefaultSimplifyFactor used otherwise. Note that if the buffer distance is zero then so is the computed simplify tolerance, no matter what the simplify factor.
Buffer results are always valid geometry. Given this, computing a zero-width buffer of an invalid polygonal geometry is an effective way to "validify" the geometry. Note however that in the case of self-intersecting "bow-tie" geometries, only the largest enclosed area will be retained.
Constructors
BufferOp(Geometry)
Initializes a buffer computation for the given geometry
public BufferOp(Geometry g)
Parameters
g
Geometrythe geometry to buffer
BufferOp(Geometry, BufferParameters)
Initializes a buffer computation for the given geometry with the given set of parameters
public BufferOp(Geometry g, BufferParameters bufParams)
Parameters
g
Geometrythe geometry to buffer
bufParams
BufferParametersthe buffer parameters to use
Properties
QuadrantSegments
Gets or sets the number of line segments in a quarter-circle used to approximate angle fillets for round end caps and joins.
public int QuadrantSegments { get; set; }
Property Value
Methods
Buffer(Geometry, double)
Computes the buffer of a geometry for a given buffer distance.
public static Geometry Buffer(Geometry g, double distance)
Parameters
Returns
- Geometry
the buffer of the input geometry
Buffer(Geometry, double, BufferParameters)
Computes the buffer for a geometry for a given buffer distance and accuracy of approximation.
public static Geometry Buffer(Geometry g, double distance, BufferParameters parameters)
Parameters
g
Geometrythe geometry to buffer
distance
doublethe buffer distance
parameters
BufferParametersthe buffer parameters to use
Returns
- Geometry
the buffer of the input geometry
Buffer(Geometry, double, int)
Computes the buffer for a geometry for a given buffer distance and accuracy of approximation.
public static Geometry Buffer(Geometry g, double distance, int quadrantSegments)
Parameters
g
Geometrythe geometry to buffer
distance
doublethe buffer distance
quadrantSegments
intthe number of segments used to approximate a quarter circle
Returns
- Geometry
the buffer of the input geometry
GetResultGeometry(double)
Returns the buffer computed for a geometry for a given buffer distance.
public Geometry GetResultGeometry(double distance)
Parameters
distance
doublethe buffer distance
Returns
- Geometry
the buffer of the input geometry