public class BufferParameters extends Object
The parameters allow control over:
Modifier and Type | Field and Description |
---|---|
static int |
CAP_FLAT
Specifies a 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.
|
static double |
DEFAULT_MITRE_LIMIT
The default mitre limit
Allows fairly pointy mitres.
|
static int |
DEFAULT_QUADRANT_SEGMENTS
The default number of facets into which to divide a fillet of 90 degrees.
|
static double |
DEFAULT_SIMPLIFY_FACTOR
The default simplify factor
Provides an accuracy of about 1%, which matches the accuracy of the default Quadrant Segments parameter.
|
static int |
JOIN_BEVEL
Specifies a bevel join style.
|
static int |
JOIN_MITRE
Specifies a mitre join style.
|
static int |
JOIN_ROUND
Specifies a round join style.
|
Constructor and Description |
---|
BufferParameters()
Creates a default set of parameters
|
BufferParameters(int quadrantSegments)
Creates a set of parameters with the
given quadrantSegments value.
|
BufferParameters(int quadrantSegments,
int endCapStyle)
Creates a set of parameters with the
given quadrantSegments and endCapStyle values.
|
BufferParameters(int quadrantSegments,
int endCapStyle,
int joinStyle,
double mitreLimit)
Creates a set of parameters with the
given parameter values.
|
Modifier and Type | Method and Description |
---|---|
static double |
bufferDistanceError(int quadSegs)
Computes the maximum distance error due to a given level
of approximation to a true arc.
|
BufferParameters |
copy() |
int |
getEndCapStyle()
Gets the end cap style.
|
int |
getJoinStyle()
Gets the join style.
|
double |
getMitreLimit()
Gets the mitre ratio limit.
|
int |
getQuadrantSegments()
Gets the number of quadrant segments which will be used
to approximate angle fillets in round endcaps and joins.
|
double |
getSimplifyFactor()
Gets the simplify factor.
|
boolean |
isSingleSided()
Tests whether the buffer is to be generated on a single side only.
|
void |
setEndCapStyle(int endCapStyle)
Specifies the end cap style of the generated buffer.
|
void |
setJoinStyle(int joinStyle)
Sets the join style for outside (reflex) corners between line segments.
|
void |
setMitreLimit(double mitreLimit)
Sets the limit on the mitre ratio used for very sharp corners.
|
void |
setQuadrantSegments(int quadSegs)
Sets the number of line segments in a quarter-circle
used to approximate angle fillets in round endcaps and joins.
|
void |
setSimplifyFactor(double simplifyFactor)
Sets the factor used to determine the simplify distance tolerance
for input simplification.
|
void |
setSingleSided(boolean isSingleSided)
Sets whether the computed buffer should be single-sided.
|
public static final int CAP_ROUND
public static final int CAP_FLAT
public static final int CAP_SQUARE
public static final int JOIN_ROUND
public static final int JOIN_MITRE
public static final int JOIN_BEVEL
public static final int DEFAULT_QUADRANT_SEGMENTS
public static final double DEFAULT_MITRE_LIMIT
public static final double DEFAULT_SIMPLIFY_FACTOR
public BufferParameters()
public BufferParameters(int quadrantSegments)
quadrantSegments
- the number of quadrant segments to usepublic BufferParameters(int quadrantSegments, int endCapStyle)
quadrantSegments
- the number of quadrant segments to useendCapStyle
- the end cap style to usepublic BufferParameters(int quadrantSegments, int endCapStyle, int joinStyle, double mitreLimit)
quadrantSegments
- the number of quadrant segments to useendCapStyle
- the end cap style to usejoinStyle
- the join style to usemitreLimit
- the mitre limit to usepublic int getQuadrantSegments()
public void setQuadrantSegments(int quadSegs)
This determines the error in the approximation to the true buffer curve. The default value of 8 gives less than 2% error in the buffer distance. For a error of < 1%, use QS = 12. For a error of < 0.1%, use QS = 18. The error is always less than the buffer distance (in other words, the computed buffer curve is always inside the true curve).
quadSegs
- the number of segments in a fillet for a circle quadrantpublic static double bufferDistanceError(int quadSegs)
quadSegs
- the number of segments used to approximate a quarter-circlepublic int getEndCapStyle()
public void setEndCapStyle(int endCapStyle)
CAP_ROUND
, CAP_FLAT
, and CAP_SQUARE
.
The default is CAP_ROUND
.endCapStyle
- the code for the end cap stylepublic int getJoinStyle()
public void setJoinStyle(int joinStyle)
JOIN_ROUND
,
JOIN_MITRE
and {link JOIN_BEVEL}.
The default is JOIN_ROUND
.joinStyle
- the code for the join stylepublic double getMitreLimit()
public void setMitreLimit(double mitreLimit)
mitreLimit
- the mitre ratio limitpublic void setSingleSided(boolean isSingleSided)
The side used is determined by the sign of the buffer distance:
The End Cap Style for single-sided buffers is always ignored, and forced to the equivalent of CAP_FLAT.
isSingleSided
- true if a single-sided buffer should be constructedpublic boolean isSingleSided()
public double getSimplifyFactor()
public void setSimplifyFactor(double simplifyFactor)
simplifyFactor
- a value greater than or equal to zero.public BufferParameters copy()
Copyright © 2022. All rights reserved.