GEOS  3.3.3
BufferParameters.h
1 /**********************************************************************
2  * $Id: BufferParameters.h 3300 2011-04-27 09:42:13Z strk $
3  *
4  * GEOS - Geometry Engine Open Source
5  * http://geos.refractions.net
6  *
7  * Copyright (C) 2009 Sandro Santilli <strk@keybit.net>
8  *
9  * This is free software; you can redistribute and/or modify it under
10  * the terms of the GNU Lesser General Public Licence as published
11  * by the Free Software Foundation.
12  * See the COPYING file for more information.
13  *
14  **********************************************************************
15  *
16  * Last port: operation/buffer/BufferParameters.java r378 (JTS-1.12)
17  *
18  **********************************************************************/
19 
20 #ifndef GEOS_OP_BUFFER_BUFFERPARAMETERS_H
21 #define GEOS_OP_BUFFER_BUFFERPARAMETERS_H
22 
23 #include <geos/export.h>
24 
25 //#include <vector>
26 
27 //#include <geos/algorithm/LineIntersector.h> // for composition
28 //#include <geos/geom/Coordinate.h> // for composition
29 //#include <geos/geom/LineSegment.h> // for composition
30 
31 #ifdef _MSC_VER
32 #pragma warning(push)
33 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
34 #endif
35 
36 // Forward declarations
37 namespace geos {
38  namespace geom {
39  class CoordinateSequence;
40  class PrecisionModel;
41  }
42  namespace operation {
43  namespace buffer {
44  class OffsetCurveVertexList;
45  }
46  }
47 }
48 
49 namespace geos {
50 namespace operation { // geos.operation
51 namespace buffer { // geos.operation.buffer
52 
58 class GEOS_DLL BufferParameters
59 {
60 
61 public:
62 
64  enum EndCapStyle {
65 
67  CAP_ROUND=1,
68 
70  CAP_FLAT=2,
71 
73  CAP_SQUARE=3
74  };
75 
77  enum JoinStyle {
78 
80  JOIN_ROUND=1,
81 
83  JOIN_MITRE=2,
84 
86  JOIN_BEVEL=3
87  };
88 
92  //
97  static const int DEFAULT_QUADRANT_SEGMENTS = 8;
98 
100  //
103  static const double DEFAULT_MITRE_LIMIT; // 5.0 (in .cpp file)
104 
107 
109  //
112  BufferParameters(int quadrantSegments);
113 
117  //
121  BufferParameters(int quadrantSegments, EndCapStyle endCapStyle);
122 
126  //
132  BufferParameters(int quadrantSegments, EndCapStyle endCapStyle,
133  JoinStyle joinStyle, double mitreLimit);
134 
136  //
139  int getQuadrantSegments() const { return quadrantSegments; }
140 
144  //
170  void setQuadrantSegments(int quadSegs);
171 
175  //
180  static double bufferDistanceError(int quadSegs);
181 
183  //
186  EndCapStyle getEndCapStyle() const { return endCapStyle; }
187 
189  //
197  void setEndCapStyle(EndCapStyle style)
198  {
199  endCapStyle = style;
200  }
201 
203  //
206  JoinStyle getJoinStyle() const { return joinStyle; }
207 
211  //
214  //
217  void setJoinStyle(JoinStyle style)
218  {
219  joinStyle = style;
220  }
221 
223  //
226  double getMitreLimit() const { return mitreLimit; }
227 
229  //
241  void setMitreLimit(double limit)
242  {
243  mitreLimit = limit;
244  }
245 
263  void setSingleSided(bool isSingleSided)
264  {
265  _isSingleSided = isSingleSided;
266  }
267 
273  bool isSingleSided() const {
274  return _isSingleSided;
275  }
276 
277 
278 private:
279 
281  int quadrantSegments;
282 
284  EndCapStyle endCapStyle;
285 
287  JoinStyle joinStyle;
288 
290  double mitreLimit;
291 
292  bool _isSingleSided;
293 };
294 
295 } // namespace geos::operation::buffer
296 } // namespace geos::operation
297 } // namespace geos
298 
299 #ifdef _MSC_VER
300 #pragma warning(pop)
301 #endif
302 
303 #endif // ndef GEOS_OP_BUFFER_BUFFERPARAMETERS_H
304