GEOS 3.14.0dev
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#pragma once
20
21#include <geos/export.h>
22
23//#include <vector>
24
25//#include <geos/algorithm/LineIntersector.h> // for composition
26//#include <geos/geom/Coordinate.h> // for composition
27//#include <geos/geom/LineSegment.h> // for composition
28
29#ifdef _MSC_VER
30#pragma warning(push)
31#pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
32#endif
33
34// Forward declarations
35namespace geos {
36namespace geom {
37class CoordinateSequence;
38class PrecisionModel;
39}
40namespace operation {
41namespace buffer {
42class OffsetCurveVertexList;
43}
44}
45}
46
47namespace geos {
48namespace operation { // geos.operation
49namespace buffer { // geos.operation.buffer
50
56class GEOS_DLL BufferParameters {
57
58public:
59
62
64 CAP_ROUND = 1,
65
67 CAP_FLAT = 2,
68
70 CAP_SQUARE = 3
71 };
72
74 enum JoinStyle {
75
77 JOIN_ROUND = 1,
78
80 JOIN_MITRE = 2,
81
83 JOIN_BEVEL = 3
84 };
85
94 static const int DEFAULT_QUADRANT_SEGMENTS = 8;
95
100 static const double DEFAULT_MITRE_LIMIT; // 5.0 (in .cpp file)
101
104
109 BufferParameters(int quadrantSegments);
110
118 BufferParameters(int quadrantSegments, EndCapStyle endCapStyle);
119
129 BufferParameters(int quadrantSegments, EndCapStyle endCapStyle,
130 JoinStyle joinStyle, double mitreLimit);
131
136 int
138 {
139 return quadrantSegments;
140 }
141
157 void setQuadrantSegments(int quadSegs);
158
167 static double bufferDistanceError(int quadSegs);
168
175 {
176 return endCapStyle;
177 }
178
188 void
190 {
191 endCapStyle = style;
192 }
193
198 JoinStyle
200 {
201 return joinStyle;
202 }
203
213 void
215 {
216 joinStyle = style;
217 }
218
223 double
225 {
226 return mitreLimit;
227 }
228
242 void
243 setMitreLimit(double limit)
244 {
245 mitreLimit = limit;
246 }
247
265 void
266 setSingleSided(bool p_isSingleSided)
267 {
268 _isSingleSided = p_isSingleSided;
269 }
270
276 bool
278 {
279 return _isSingleSided;
280 }
281
282
283private:
284
286 int quadrantSegments;
287
289 EndCapStyle endCapStyle;
290
292 JoinStyle joinStyle;
293
295 double mitreLimit;
296
297 bool _isSingleSided;
298};
299
300} // namespace geos::operation::buffer
301} // namespace geos::operation
302} // namespace geos
303
304#ifdef _MSC_VER
305#pragma warning(pop)
306#endif
307
Contains the parameters which describe how a buffer should be constructed.
Definition BufferParameters.h:56
double getMitreLimit() const
Definition BufferParameters.h:224
void setEndCapStyle(EndCapStyle style)
Definition BufferParameters.h:189
void setMitreLimit(double limit)
Definition BufferParameters.h:243
JoinStyle getJoinStyle() const
Definition BufferParameters.h:199
EndCapStyle getEndCapStyle() const
Definition BufferParameters.h:174
EndCapStyle
End cap styles.
Definition BufferParameters.h:61
static const double DEFAULT_MITRE_LIMIT
Definition BufferParameters.h:100
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:214
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:277
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
Definition BufferParameters.h:137
void setQuadrantSegments(int quadSegs)
Sets the number of line segments used to approximate an angle fillet in round joins.
void setSingleSided(bool p_isSingleSided)
Definition BufferParameters.h:266
JoinStyle
Join styles.
Definition BufferParameters.h:74
Basic namespace for all GEOS functionalities.
Definition geos.h:39