GEOS: BufferOp.h Source File

GEOS 3.5.0

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List

BufferOp.h
1 /**********************************************************************
2 *
3 * GEOS - Geometry Engine Open Source
4 * http://geos.osgeo.org
5 *
6 * Copyright (C) 2009-2011 Sandro Santilli <strk@keybit.net>
7 * Copyright (C) 2005-2007 Refractions Research Inc.
8 * Copyright (C) 2001-2002 Vivid Solutions Inc.
9 *
10 * This is free software; you can redistribute and/or modify it under
11 * the terms of the GNU Lesser General Public Licence as published
12 * by the Free Software Foundation.
13 * See the COPYING file for more information.
14 *
15 **********************************************************************
16 *
17 * Last port: operation/buffer/BufferOp.java r378 (JTS-1.12)
18 *
19 **********************************************************************/
20
21 #ifndef GEOS_OP_BUFFER_BUFFEROP_H
22 #define GEOS_OP_BUFFER_BUFFEROP_H
23
24 #include <geos/export.h>
25 #include <geos/operation/buffer/BufferParameters.h> // for enum values
26
27 #include <geos/util/TopologyException.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 PrecisionModel;
38 class Geometry;
39 }
40 }
41
42 namespace geos {
43 namespace operation { // geos.operation
44 namespace buffer { // geos.operation.buffer
45
78 class GEOS_DLL BufferOp {
79
80
81 private:
82
89 static const int MAX_PRECISION_DIGITS = 12;
90
107 static double precisionScaleFactor(const geom::Geometry *g,
108 double distance, int maxPrecisionDigits);
109
110 const geom::Geometry *argGeom;
111
112 util::TopologyException saveException;
113
114 double distance;
115
116 //int quadrantSegments;
117 //int endCapStyle;
118 BufferParameters bufParams;
119
120 geom::Geometry* resultGeometry;
121
122 void computeGeometry();
123
124 void bufferOriginalPrecision();
125
126 void bufferReducedPrecision(int precisionDigits);
127
128 void bufferReducedPrecision();
129
130 void bufferFixedPrecision(const geom::PrecisionModel& fixedPM);
131
132 public:
133
134 enum {
137 CAP_ROUND = BufferParameters::CAP_ROUND,
138
141 CAP_BUTT = BufferParameters::CAP_FLAT,
142
145 CAP_SQUARE = BufferParameters::CAP_SQUARE
146 };
147
159 static geom::Geometry* bufferOp(const geom::Geometry *g,
160 double distance,
161 int quadrantSegments=
162 BufferParameters::DEFAULT_QUADRANT_SEGMENTS,
163 int endCapStyle=BufferParameters::CAP_ROUND);
164
170 BufferOp(const geom::Geometry *g)
171 :
172 argGeom(g),
173 bufParams(),
174 resultGeometry(NULL)
175 {
176 }
177
186 BufferOp(const geom::Geometry* g, const BufferParameters& params)
187 :
188 argGeom(g),
189 bufParams(params),
190 resultGeometry(NULL)
191 {
192 }
193
201 inline void setEndCapStyle(int nEndCapStyle);
202
210 inline void setQuadrantSegments(int nQuadrantSegments);
211
232 inline void setSingleSided(bool isSingleSided);
233
242 geom::Geometry* getResultGeometry(double nDistance);
243
244 };
245
246 // BufferOp inlines
247 void
248 BufferOp::setQuadrantSegments(int q)
249 {
250 bufParams.setQuadrantSegments(q);
251 }
252
253 void
254 BufferOp::setEndCapStyle(int s)
255 {
256 bufParams.setEndCapStyle((BufferParameters::EndCapStyle)s);
257 }
258
259 void
260 BufferOp::setSingleSided(bool isSingleSided)
261 {
262 bufParams.setSingleSided(isSingleSided);
263 }
264
265 } // namespace geos::operation::buffer
266 } // namespace geos::operation
267 } // namespace geos
268
269 #ifdef _MSC_VER
270 #pragma warning(pop)
271 #endif
272
273 #endif // ndef GEOS_OP_BUFFER_BUFFEROP_H
274
geos::operation::buffer::BufferParameters::EndCapStyle
EndCapStyle
End cap styles.
Definition: BufferParameters.h:63
geos::operation::buffer::BufferOp::BufferOp
BufferOp(const geom::Geometry *g)
Definition: BufferOp.h:170
geos::geom::PrecisionModel
Specifies the precision model of the Coordinate in a Geometry.
Definition: PrecisionModel.h:87
geos::geom::Geometry
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition: Geometry.h:167
geos::operation::buffer::BufferOp::BufferOp
BufferOp(const geom::Geometry *g, const BufferParameters &params)
Definition: BufferOp.h:186
geos::operation::buffer::BufferOp
Computes the buffer of a geometry, for both positive and negative buffer distances.
Definition: BufferOp.h:78
geos
Basic namespace for all GEOS functionalities.
Definition: IndexedNestedRingTester.h:25
geos::operation::buffer::BufferParameters
Contains the parameters which describe how a buffer should be constructed.
Definition: BufferParameters.h:57
geos::util::TopologyException
Indicates an invalid or inconsistent topological situation encountered during processing.
Definition: TopologyException.h:35