GEOS 3.8.1
BufferParameters.h
1/**********************************************************************
2 *
3 * GEOS - Geometry Engine Open Source
4 * http://geos.osgeo.org
5 *
6 * Copyright (C) 2009 Sandro Santilli <strk@kbt.io>
7 *
8 * This is free software; you can redistribute and/or modify it under
9 * the terms of the GNU Lesser General Public Licence as published
10 * by the Free Software Foundation.
11 * See the COPYING file for more information.
12 *
13 **********************************************************************
14 *
15 * Last port: operation/buffer/BufferParameters.java r378 (JTS-1.12)
16 *
17 **********************************************************************/
18
19#ifndef GEOS_OP_BUFFER_BUFFERPARAMETERS_H
20#define GEOS_OP_BUFFER_BUFFERPARAMETERS_H
21
22#include <geos/export.h>
23
24//#include <vector>
25
26//#include <geos/algorithm/LineIntersector.h> // for composition
27//#include <geos/geom/Coordinate.h> // for composition
28//#include <geos/geom/LineSegment.h> // for composition
29
30#ifdef _MSC_VER
31#pragma warning(push)
32#pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
33#endif
34
35// Forward declarations
36namespace geos {
37namespace geom {
38class CoordinateSequence;
39class PrecisionModel;
40}
41namespace operation {
42namespace buffer {
43class OffsetCurveVertexList;
44}
45}
46}
47
48namespace geos {
49namespace operation { // geos.operation
50namespace buffer { // geos.operation.buffer
51
57class GEOS_DLL BufferParameters {
58
59public:
60
63
65 CAP_ROUND = 1,
66
68 CAP_FLAT = 2,
69
71 CAP_SQUARE = 3
72 };
73
75 enum JoinStyle {
76
78 JOIN_ROUND = 1,
79
81 JOIN_MITRE = 2,
82
84 JOIN_BEVEL = 3
85 };
86
90 //
95 static const int DEFAULT_QUADRANT_SEGMENTS = 8;
96
98 //
101 static const double DEFAULT_MITRE_LIMIT; // 5.0 (in .cpp file)
102
105
107 //
110 BufferParameters(int quadrantSegments);
111
115 //
119 BufferParameters(int quadrantSegments, EndCapStyle endCapStyle);
120
124 //
130 BufferParameters(int quadrantSegments, EndCapStyle endCapStyle,
131 JoinStyle joinStyle, double mitreLimit);
132
134 //
137 int
139 {
140 return quadrantSegments;
141 }
142
146 //
172 void setQuadrantSegments(int quadSegs);
173
177 //
182 static double bufferDistanceError(int quadSegs);
183
185 //
190 {
191 return endCapStyle;
192 }
193
195 //
203 void
205 {
206 endCapStyle = style;
207 }
208
210 //
213 JoinStyle
215 {
216 return joinStyle;
217 }
218
222 //
225 //
228 void
230 {
231 joinStyle = style;
232 }
233
235 //
238 double
240 {
241 return mitreLimit;
242 }
243
245 //
257 void
258 setMitreLimit(double limit)
259 {
260 mitreLimit = limit;
261 }
262
280 void
281 setSingleSided(bool p_isSingleSided)
282 {
283 _isSingleSided = p_isSingleSided;
284 }
285
291 bool
293 {
294 return _isSingleSided;
295 }
296
297
298private:
299
301 int quadrantSegments;
302
304 EndCapStyle endCapStyle;
305
307 JoinStyle joinStyle;
308
310 double mitreLimit;
311
312 bool _isSingleSided;
313};
314
315} // namespace geos::operation::buffer
316} // namespace geos::operation
317} // namespace geos
318
319#ifdef _MSC_VER
320#pragma warning(pop)
321#endif
322
323#endif // ndef GEOS_OP_BUFFER_BUFFERPARAMETERS_H
324
Contains the parameters which describe how a buffer should be constructed.
Definition: BufferParameters.h:57
double getMitreLimit() const
Gets the mitre ratio limit.
Definition: BufferParameters.h:239
void setEndCapStyle(EndCapStyle style)
Specifies the end cap style of the generated buffer.
Definition: BufferParameters.h:204
void setMitreLimit(double limit)
Sets the limit on the mitre ratio used for very sharp corners.
Definition: BufferParameters.h:258
JoinStyle getJoinStyle() const
Gets the join style.
Definition: BufferParameters.h:214
BufferParameters(int quadrantSegments)
Creates a set of parameters with the given quadrantSegments value.
EndCapStyle getEndCapStyle() const
Gets the end cap style.
Definition: BufferParameters.h:189
EndCapStyle
End cap styles.
Definition: BufferParameters.h:62
static const double DEFAULT_MITRE_LIMIT
The default mitre limit.
Definition: BufferParameters.h:101
BufferParameters(int quadrantSegments, EndCapStyle endCapStyle, JoinStyle joinStyle, double mitreLimit)
Creates a set of parameters with the given parameter values.
void setJoinStyle(JoinStyle style)
Sets the join style for outside (reflex) corners between line segments.
Definition: BufferParameters.h:229
static double bufferDistanceError(int quadSegs)
Computes the maximum distance error due to a given level of approximation to a true arc.
bool isSingleSided() const
Definition: BufferParameters.h:292
BufferParameters()
Creates a default set of parameters.
BufferParameters(int quadrantSegments, EndCapStyle endCapStyle)
Creates a set of parameters with the given quadrantSegments and endCapStyle values.
int getQuadrantSegments() const
Gets the number of quadrant segments which will be used.
Definition: BufferParameters.h:138
void setQuadrantSegments(int quadSegs)
Sets the number of line segments used to approximate an angle fillet.
void setSingleSided(bool p_isSingleSided)
Definition: BufferParameters.h:281
JoinStyle
Join styles.
Definition: BufferParameters.h:75
Basic namespace for all GEOS functionalities.
Definition: IndexedNestedRingTester.h:25