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
35 namespace geos {
36 namespace geom {
37 class CoordinateSequence;
38 class PrecisionModel;
39 }
40 namespace operation {
41 namespace buffer {
42 class OffsetCurveVertexList;
43 }
44 }
45 }
46 
47 namespace geos {
48 namespace operation { // geos.operation
49 namespace buffer { // geos.operation.buffer
50 
56 class GEOS_DLL BufferParameters {
57 
58 public:
59 
61  enum EndCapStyle {
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 
169  void setQuadrantSegments(int quadSegs);
170 
179  static double bufferDistanceError(int quadSegs);
180 
187  {
188  return endCapStyle;
189  }
190 
200  void
202  {
203  endCapStyle = style;
204  }
205 
210  JoinStyle
211  getJoinStyle() const
212  {
213  return joinStyle;
214  }
215 
225  void
227  {
228  joinStyle = style;
229  }
230 
235  double
237  {
238  return mitreLimit;
239  }
240 
254  void
255  setMitreLimit(double limit)
256  {
257  mitreLimit = limit;
258  }
259 
277  void
278  setSingleSided(bool p_isSingleSided)
279  {
280  _isSingleSided = p_isSingleSided;
281  }
282 
288  bool
290  {
291  return _isSingleSided;
292  }
293 
294 
295 private:
296 
298  int quadrantSegments;
299 
301  EndCapStyle endCapStyle;
302 
304  JoinStyle joinStyle;
305 
307  double mitreLimit;
308 
309  bool _isSingleSided;
310 };
311 
312 } // namespace geos::operation::buffer
313 } // namespace geos::operation
314 } // namespace geos
315 
316 #ifdef _MSC_VER
317 #pragma warning(pop)
318 #endif
319 
Contains the parameters which describe how a buffer should be constructed.
Definition: BufferParameters.h:56
double getMitreLimit() const
Definition: BufferParameters.h:236
void setEndCapStyle(EndCapStyle style)
Definition: BufferParameters.h:201
void setMitreLimit(double limit)
Definition: BufferParameters.h:255
JoinStyle getJoinStyle() const
Definition: BufferParameters.h:211
EndCapStyle getEndCapStyle() const
Definition: BufferParameters.h:186
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:226
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:289
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.
void setSingleSided(bool p_isSingleSided)
Definition: BufferParameters.h:278
JoinStyle
Join styles.
Definition: BufferParameters.h:74
Basic namespace for all GEOS functionalities.
Definition: Angle.h:25