BufferOp class
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 {@link 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 {@link BufferParameters#setQuadrantSegments(int)} or {@link #setQuadrantSegments(int)}.
The end cap style of a linear buffer may be {@link BufferParameters#setEndCapStyle(int) specified}. The following end cap styles are supported:
- {@link BufferParameters#CAP_ROUND} - the usual round end caps
- {@link BufferParameters#CAP_FLAT} - end caps are truncated flat at the line ends
- {@link BufferParameters#CAP_SQUARE} - end caps are squared off at the buffer distance beyond the line ends
The join style of the corners in a buffer may be {@link BufferParameters#setJoinStyle(int) specified}. The following join styles are supported:
- {@link BufferParameters#JOIN_ROUND} - the usual round join
- {@link BufferParameters#JOIN_MITRE} - corners are "sharp" (up to a {@link BufferParameters#getMitreLimit() distance limit})
- {@link BufferParameters#JOIN_BEVEL} - corners are beveled (clipped off).
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 {@link BufferParameters#setSimplifyFactor(double) specified}, with a {@link BufferParameters#DEFAULT_SIMPLIFY_FACTOR default} used otherwise. Note that if the buffer distance is zero then so is the computed simplify tolerance, no matter what the simplify factor.
@version 1.7
Constructors
- BufferOp(Geometry argGeom)
- Initializes a buffer computation for the given geometry
- BufferOp.withParams(Geometry argGeom, BufferParameters bufParams)
- Initializes a buffer computation for the given geometry with the given set of parameters
Properties
- argGeom ↔ Geometry
-
getter/setter pair
- bufParams ↔ BufferParameters
-
getter/setter pair
- distance ↔ double
-
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
- isInvertOrientation ↔ bool
-
getter/setter pair
- resultGeometry ↔ Geometry?
-
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
bufferFixedPrecision(
PrecisionModel fixedPM) → void -
bufferOriginalPrecision(
) → void -
bufferReducedPrecision(
) → void -
bufferReducedPrecisionWithDigits(
int precisionDigits) → void -
computeGeometry(
) → void -
createBufferBullder(
) → BufferBuilder -
getResultGeometry(
double distance) → Geometry - Returns the buffer computed for a geometry for a given buffer distance.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
setEndCapStyle(
int endCapStyle) → void - Specifies the end cap style of the generated buffer. The styles supported are {@link BufferParameters#CAP_ROUND}, {@link BufferParameters#CAP_FLAT}, and {@link BufferParameters#CAP_SQUARE}. The default is CAP_ROUND.
-
setQuadrantSegments(
int quadrantSegments) → void - Sets the number of segments used to approximate a angle fillet
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- CAP_BUTT → int
-
Specifies a butt (or flat) line buffer end cap style.
@deprecated use BufferParameters
final
- CAP_FLAT → int
-
Specifies a butt (or flat) line buffer end cap style.
@deprecated use BufferParameters
final
- CAP_ROUND → int
-
Specifies a round line buffer end cap style.
@deprecated use BufferParameters
final
- CAP_SQUARE → int
-
Specifies a square line buffer end cap style.
@deprecated use BufferParameters
final
- MAX_PRECISION_DIGITS ↔ int
-
A number of digits of precision which leaves some computational "headroom"
for floating point operations.
getter/setter pair
Static Methods
-
bufferOp(
Geometry g, double distance) → Geometry - Computes the buffer of a geometry for a given buffer distance.
-
bufferOp3(
Geometry g, double distance, int quadrantSegments) → Geometry - Computes the buffer for a geometry for a given buffer distance and accuracy of approximation.
-
bufferOp4(
Geometry g, double distance, int quadrantSegments, int endCapStyle) → Geometry - Computes the buffer for a geometry for a given buffer distance and accuracy of approximation.
-
bufferOpWithParams(
Geometry g, double distance, BufferParameters params) → Geometry - Computes the buffer for a geometry for a given buffer distance and accuracy of approximation.
-
precisionScaleFactor(
Geometry g, double distance, int maxPrecisionDigits) → double -
Compute a scale factor to limit the precision of
a given combination of Geometry and buffer distance.
The scale factor is determined by
the number of digits of precision in the (geometry + buffer distance),
limited by the supplied
maxPrecisionDigits
value.