GEOS  3.4.2
BufferParameters.h
1 /**********************************************************************
2  *
3  * GEOS - Geometry Engine Open Source
4  * http://geos.osgeo.org
5  *
6  * Copyright (C) 2009 Sandro Santilli <strk@keybit.net>
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 
60 public:
61 
63  enum EndCapStyle {
64 
66  CAP_ROUND=1,
67 
69  CAP_FLAT=2,
70 
72  CAP_SQUARE=3
73  };
74 
76  enum JoinStyle {
77 
79  JOIN_ROUND=1,
80 
82  JOIN_MITRE=2,
83 
85  JOIN_BEVEL=3
86  };
87 
91  //
96  static const int DEFAULT_QUADRANT_SEGMENTS = 8;
97 
99  //
102  static const double DEFAULT_MITRE_LIMIT; // 5.0 (in .cpp file)
103 
106 
108  //
111  BufferParameters(int quadrantSegments);
112 
116  //
120  BufferParameters(int quadrantSegments, EndCapStyle endCapStyle);
121 
125  //
131  BufferParameters(int quadrantSegments, EndCapStyle endCapStyle,
132  JoinStyle joinStyle, double mitreLimit);
133 
135  //
138  int getQuadrantSegments() const { return quadrantSegments; }
139 
143  //
169  void setQuadrantSegments(int quadSegs);
170 
174  //
179  static double bufferDistanceError(int quadSegs);
180 
182  //
185  EndCapStyle getEndCapStyle() const { return endCapStyle; }
186 
188  //
197  {
198  endCapStyle = style;
199  }
200 
202  //
205  JoinStyle getJoinStyle() const { return joinStyle; }
206 
210  //
213  //
217  {
218  joinStyle = style;
219  }
220 
222  //
225  double getMitreLimit() const { return mitreLimit; }
226 
228  //
240  void setMitreLimit(double limit)
241  {
242  mitreLimit = limit;
243  }
244 
262  void setSingleSided(bool isSingleSided)
263  {
264  _isSingleSided = isSingleSided;
265  }
266 
272  bool isSingleSided() const {
273  return _isSingleSided;
274  }
275 
276 
277 private:
278 
280  int quadrantSegments;
281 
283  EndCapStyle endCapStyle;
284 
286  JoinStyle joinStyle;
287 
289  double mitreLimit;
290 
291  bool _isSingleSided;
292 };
293 
294 } // namespace geos::operation::buffer
295 } // namespace geos::operation
296 } // namespace geos
297 
298 #ifdef _MSC_VER
299 #pragma warning(pop)
300 #endif
301 
302 #endif // ndef GEOS_OP_BUFFER_BUFFERPARAMETERS_H
303 
EndCapStyle
End cap styles.
Definition: BufferParameters.h:63
EndCapStyle getEndCapStyle() const
Gets the end cap style.
Definition: BufferParameters.h:185
JoinStyle getJoinStyle() const
Gets the join style.
Definition: BufferParameters.h:205
void setJoinStyle(JoinStyle style)
Sets the join style for outside (reflex) corners between line segments.
Definition: BufferParameters.h:216
void setEndCapStyle(EndCapStyle style)
Specifies the end cap style of the generated buffer.
Definition: BufferParameters.h:196
void setMitreLimit(double limit)
Sets the limit on the mitre ratio used for very sharp corners.
Definition: BufferParameters.h:240
double getMitreLimit() const
Gets the mitre ratio limit.
Definition: BufferParameters.h:225
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:102
void setSingleSided(bool isSingleSided)
Definition: BufferParameters.h:262
bool isSingleSided() const
Definition: BufferParameters.h:272
int getQuadrantSegments() const
Gets the number of quadrant segments which will be used.
Definition: BufferParameters.h:138
JoinStyle
Join styles.
Definition: BufferParameters.h:76