GEOS  3.8.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 #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
36 namespace geos {
37 namespace geom {
38 class CoordinateSequence;
39 class PrecisionModel;
40 }
41 namespace operation {
42 namespace buffer {
43 class OffsetCurveVertexList;
44 }
45 }
46 }
47 
48 namespace geos {
49 namespace operation { // geos.operation
50 namespace buffer { // geos.operation.buffer
51 
57 class GEOS_DLL BufferParameters {
58 
59 public:
60 
62  enum EndCapStyle {
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  //
188  EndCapStyle
190  {
191  return endCapStyle;
192  }
193 
195  //
203  void
205  {
206  endCapStyle = style;
207  }
208 
210  //
213  JoinStyle
214  getJoinStyle() const
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 
298 private:
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 
EndCapStyle
End cap styles.
Definition: BufferParameters.h:62
void setSingleSided(bool p_isSingleSided)
Definition: BufferParameters.h:281
EndCapStyle getEndCapStyle() const
Gets the end cap style.
Definition: BufferParameters.h:189
JoinStyle getJoinStyle() const
Gets the join style.
Definition: BufferParameters.h:214
void setJoinStyle(JoinStyle style)
Sets the join style for outside (reflex) corners between line segments.
Definition: BufferParameters.h:229
void setEndCapStyle(EndCapStyle style)
Specifies the end cap style of the generated buffer.
Definition: BufferParameters.h:204
Basic namespace for all GEOS functionalities.
Definition: IndexedNestedRingTester.h:25
void setMitreLimit(double limit)
Sets the limit on the mitre ratio used for very sharp corners.
Definition: BufferParameters.h:258
double getMitreLimit() const
Gets the mitre ratio limit.
Definition: BufferParameters.h:239
Contains the parameters which describe how a buffer should be constructed.
Definition: BufferParameters.h:57
static const double DEFAULT_MITRE_LIMIT
The default mitre limit.
Definition: BufferParameters.h:101
bool isSingleSided() const
Definition: BufferParameters.h:292
int getQuadrantSegments() const
Gets the number of quadrant segments which will be used.
Definition: BufferParameters.h:138
JoinStyle
Join styles.
Definition: BufferParameters.h:75