Class BufferOp

Hierarchy: Object , BufferOp
public class BufferOp
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 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 BufferParameters.setQuadrantSegments(int) or setQuadrantSegments(int).

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

The join style of the corners in a buffer may be specified . The following join styles are supported:

The buffer algorithm can 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 a default used otherwise. Note that if the buffer distance is zero then so is the computed simplify tolerance, no matter what the simplify factor.

Other

  • version: 1.7
public BufferOp(Geometry g)
Initializes a buffer computation for the given geometry
Parameters:
g - g the geometry to buffer
public BufferOp(Geometry g, BufferParameters bufParams)
Initializes a buffer computation for the given geometry with the given set of parameters
Parameters:
g - g the geometry to buffer
bufParams - bufParams the buffer parameters to use
public static Geometry bufferOp(Geometry g, double distance)
Computes the buffer of a geometry for a given buffer distance.
Parameters:
g - g the geometry to buffer
distance - distance the buffer distance
Returns:
the buffer of the input geometry
public static Geometry bufferOp(Geometry g, double distance, BufferParameters params)
Computes the buffer for a geometry for a given buffer distance and accuracy of approximation.
Parameters:
g - g the geometry to buffer
distance - distance the buffer distance
params - params the buffer parameters to use
Returns:
the buffer of the input geometry
public static Geometry bufferOp(Geometry g, double distance, int quadrantSegments)
Computes the buffer for a geometry for a given buffer distance and accuracy of approximation.
Parameters:
g - g the geometry to buffer
distance - distance the buffer distance
quadrantSegments - quadrantSegments the number of segments used to approximate a quarter circle
Returns:
the buffer of the input geometry
public static Geometry bufferOp(Geometry g, double distance, int quadrantSegments, int endCapStyle)
Computes the buffer for a geometry for a given buffer distance and accuracy of approximation.
Parameters:
g - g the geometry to buffer
distance - distance the buffer distance
quadrantSegments - quadrantSegments the number of segments used to approximate a quarter circle
endCapStyle - endCapStyle the end cap style to use
Returns:
the buffer of the input geometry
public void setEndCapStyle(int endCapStyle)
Specifies the end cap style of the generated buffer. The styles supported are BufferParameters.CAP_ROUND , BufferParameters.CAP_FLAT , and BufferParameters.CAP_SQUARE . The default is CAP_ROUND.
Parameters:
endCapStyle - endCapStyle the end cap style to specify
public void setQuadrantSegments(int quadrantSegments)
Sets the number of segments used to approximate a angle fillet
Parameters:
quadrantSegments - quadrantSegments the number of segments in a fillet for a quadrant
public Geometry getResultGeometry(double distance)
Returns the buffer computed for a geometry for a given buffer distance.
Parameters:
distance - distance the buffer distance
Returns:
the buffer of the input geometry