com.vividsolutions.jts.operation.buffer

Class BufferOp


public class BufferOp
extends java.lang.Object

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

In GIS, the positive 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 they are known as erosion and dilation

The negative buffer of lines and points is always empty geometry.

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 used to approximate curves.

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

Version:
1.7

Field Summary

static int
CAP_BUTT
Specifies a butt (or flat) line buffer end cap style.
static int
CAP_ROUND
Specifies a round line buffer end cap style.
static int
CAP_SQUARE
Specifies a square line buffer end cap style.

Constructor Summary

BufferOp(Geometry g)
Initializes a buffer computation for the given geometry

Method Summary

static Geometry
bufferOp(Geometry g, double distance)
Computes the buffer of a geometry for a given buffer distance.
static Geometry
bufferOp(Geometry g, double distance, int quadrantSegments)
Comutes the buffer for a geometry for a given buffer distance and accuracy of approximation.
static Geometry
bufferOp(Geometry g, double distance, int quadrantSegments, int endCapStyle)
Comutes the buffer for a geometry for a given buffer distance and accuracy of approximation.
Geometry
getResultGeometry(double distance)
Returns the buffer computed for a geometry for a given buffer distance.
Geometry
getResultGeometry(double distance, int quadrantSegments)
Deprecated. use setQuadrantSegments instead
void
setEndCapStyle(int endCapStyle)
Specifies the end cap style of the generated buffer.
void
setQuadrantSegments(int quadrantSegments)
Specifies the end cap style of the generated buffer.

Field Details

CAP_BUTT

public static final int CAP_BUTT
Specifies a butt (or flat) line buffer end cap style.
Field Value:
2

CAP_ROUND

public static final int CAP_ROUND
Specifies a round line buffer end cap style.
Field Value:
1

CAP_SQUARE

public static final int CAP_SQUARE
Specifies a square line buffer end cap style.
Field Value:
3

Constructor Details

BufferOp

public BufferOp(Geometry g)
Initializes a buffer computation for the given geometry
Parameters:
g - the geometry to buffer

Method Details

bufferOp

public static Geometry bufferOp(Geometry g,
                                double distance)
Computes the buffer of a geometry for a given buffer distance.
Parameters:
g - the geometry to buffer
distance - the buffer distance
Returns:
the buffer of the input geometry

bufferOp

public static Geometry bufferOp(Geometry g,
                                double distance,
                                int quadrantSegments)
Comutes 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

bufferOp

public static Geometry bufferOp(Geometry g,
                                double distance,
                                int quadrantSegments,
                                int endCapStyle)
Comutes 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
endCapStyle - the end cap style to use
Returns:
the buffer of the input geometry

getResultGeometry

public Geometry getResultGeometry(double distance)
Returns the buffer computed for a geometry for a given buffer distance.
Parameters:
distance - the buffer distance
Returns:
the buffer of the input geometry

getResultGeometry

public Geometry getResultGeometry(double distance,
                                  int quadrantSegments)

Deprecated. use setQuadrantSegments instead

Comutes the buffer for a geometry for a given buffer distance and accuracy of approximation.
Parameters:
distance - the buffer distance
quadrantSegments - the number of segments used to approximate a quarter circle
Returns:
the buffer of the input geometry

setEndCapStyle

public void setEndCapStyle(int endCapStyle)
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

setQuadrantSegments

public void setQuadrantSegments(int quadrantSegments)
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: