Class BufferParameters
- Namespace
- NetTopologySuite.Operation.Buffer
- Assembly
- NetTopologySuite.dll
A value class containing the parameters which specify how a buffer should be constructed.
The parameters allow control over:- Quadrant segments (accuracy of approximation for circular arcs)
- End Cap style
- Join style
- Mitre limit
- whether the buffer is single-sided
public class BufferParameters
- Inheritance
-
BufferParameters
- Inherited Members
Constructors
BufferParameters()
Creates a default set of parameters
public BufferParameters()
BufferParameters(int)
Creates a set of parameters with the given quadrantSegments value.
public BufferParameters(int quadrantSegments)
Parameters
quadrantSegments
intThe number of quadrant segments to use
BufferParameters(int, EndCapStyle)
Creates a set of parameters with the given quadrantSegments and endCapStyle values.
public BufferParameters(int quadrantSegments, EndCapStyle endCapStyle)
Parameters
quadrantSegments
intthe number of quadrant segments to use
endCapStyle
EndCapStylethe end cap style to use
BufferParameters(int, EndCapStyle, JoinStyle, double)
Creates a set of parameters with the given parameter values.
public BufferParameters(int quadrantSegments, EndCapStyle endCapStyle, JoinStyle joinStyle, double mitreLimit)
Parameters
quadrantSegments
intthe number of quadrant segments to use
endCapStyle
EndCapStylethe end cap style to use
joinStyle
JoinStylethe join style to use
mitreLimit
doublethe mitre limit to use
Fields
DefaultJoinStyle
The default number of facets into which to divide a fillet of 90 degrees.
A value of 8 gives less than 2% max error in the buffer distance.
public const JoinStyle DefaultJoinStyle = Round
Field Value
DefaultMitreLimit
The default mitre limit Allows fairly pointy mitres.
public const double DefaultMitreLimit = 5
Field Value
DefaultQuadrantSegments
The default number of facets into which to divide a fillet of 90 degrees.
A value of 8 gives less than 2% max error in the buffer distance.
public const int DefaultQuadrantSegments = 8
Field Value
DefaultSimplifyFactor
The default simplify factor. Provides an accuracy of about 1%, which matches the accuracy of the DefaultQuadrantSegments parameter.
public const double DefaultSimplifyFactor = 0.01
Field Value
Properties
EndCapStyle
Gets or sets the end cap style of the generated buffer.
public EndCapStyle EndCapStyle { get; set; }
Property Value
Remarks
IsSingleSided
Gets or sets whether the computed buffer should be single-sided. A single-sided buffer is constructed on only one side of each input line.
The side used is determined by the sign of the buffer distance:
- a positive distance indicates the left-hand side
- a negative distance indicates the right-hand side
The End Cap Style for single-sided buffers is always ignored, and forced to the equivalent of Flat.
public bool IsSingleSided { get; set; }
Property Value
JoinStyle
Gets/Sets the join style for outside (reflex) corners between line segments.
public JoinStyle JoinStyle { get; set; }
Property Value
Remarks
MitreLimit
Sets the limit on the mitre ratio used for very sharp corners.
public double MitreLimit { get; set; }
Property Value
Remarks
The mitre ratio is the ratio of the distance from the corner to the end of the mitred offset corner. When two line segments meet at a sharp angle, a miter join will extend far beyond the original geometry. (and in the extreme case will be infinitely far.) To prevent unreasonable geometry, the mitre limit allows controlling the maximum length of the join corner. Corners with a ratio which exceed the limit will be beveled.
QuadrantSegments
Gets or sets the number of line segments in a quarter-circle used to approximate angle fillets in round endcaps and joins. The value should be at least 1.
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 an error of < 1%, use QS = 12. For an 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).
public int QuadrantSegments { get; set; }
Property Value
SimplifyFactor
Factor used to determine the simplify distance tolerance for input simplification. Simplifying can increase the performance of computing buffers. Generally the simplify factor should be greater than 0. Values between 0.01 and .1 produce relatively good accuracy for the generate buffer. Larger values sacrifice accuracy in return for performance.
public double SimplifyFactor { get; set; }
Property Value
Methods
BufferDistanceError(int)
Computes the maximum distance error due to a given level of approximation to a true arc.
public static double BufferDistanceError(int quadSegs)
Parameters
quadSegs
intThe number of segments used to approximate a quarter-circle
Returns
- double
The error of approximation
Copy()
Creates a copy
public BufferParameters Copy()