GEOS 3.3.8

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

- File List

BufferOp.h
1 /**********************************************************************
2 * $Id: BufferOp.h 3299 2011-04-27 09:42:02Z strk $
3 *
4 * GEOS - Geometry Engine Open Source
5 * http://geos.refractions.net
6 *
7 * Copyright (C) 2009-2011 Sandro Santilli <strk@keybit.net>
8 * Copyright (C) 2005-2007 Refractions Research Inc.
9 * Copyright (C) 2001-2002 Vivid Solutions Inc.
10 *
11 * This is free software; you can redistribute and/or modify it under
12 * the terms of the GNU Lesser General Public Licence as published
13 * by the Free Software Foundation.
14 * See the COPYING file for more information.
15 *
16 **********************************************************************
17 *
18 * Last port: operation/buffer/BufferOp.java r378 (JTS-1.12)
19 *
20 **********************************************************************/
21
22 #ifndef GEOS_OP_BUFFER_BUFFEROP_H
23 #define GEOS_OP_BUFFER_BUFFEROP_H
24
25 #include <geos/export.h>
26 #include <geos/operation/buffer/BufferParameters.h> // for enum values
27
28 #include <geos/util/TopologyException.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 PrecisionModel;
39 class Geometry;
40 }
41 }
42
43 namespace geos {
44 namespace operation { // geos.operation
45 namespace buffer { // geos.operation.buffer
46
79 class GEOS_DLL BufferOp {
80
81
82 private:
83
90 static const int MAX_PRECISION_DIGITS = 12;
91
108 static double precisionScaleFactor(const geom::Geometry *g,
109 double distance, int maxPrecisionDigits);
110
111 const geom::Geometry *argGeom;
112
113 util::TopologyException saveException;
114
115 double distance;
116
117 //int quadrantSegments;
118 //int endCapStyle;
119 BufferParameters bufParams;
120
121 geom::Geometry* resultGeometry;
122
123 void computeGeometry();
124
125 void bufferOriginalPrecision();
126
127 void bufferReducedPrecision(int precisionDigits);
128
129 void bufferReducedPrecision();
130
131 void bufferFixedPrecision(const geom::PrecisionModel& fixedPM);
132
133 public:
134
135 enum {
138 CAP_ROUND = BufferParameters::CAP_ROUND,
139
142 CAP_BUTT = BufferParameters::CAP_FLAT,
143
146 CAP_SQUARE = BufferParameters::CAP_SQUARE
147 };
148
160 static geom::Geometry* bufferOp(const geom::Geometry *g,
161 double distance,
162 int quadrantSegments=
163 BufferParameters::DEFAULT_QUADRANT_SEGMENTS,
164 int endCapStyle=BufferParameters::CAP_ROUND);
165
171 BufferOp(const geom::Geometry *g)
172 :
173 argGeom(g),
174 bufParams(),
175 resultGeometry(NULL)
176 {
177 }
178
187 BufferOp(const geom::Geometry* g, const BufferParameters& params)
188 :
189 argGeom(g),
190 bufParams(params),
191 resultGeometry(NULL)
192 {
193 }
194
202 inline void setEndCapStyle(int nEndCapStyle);
203
211 inline void setQuadrantSegments(int nQuadrantSegments);
212
221 geom::Geometry* getResultGeometry(double nDistance);
222
223 };
224
225 // BufferOp inlines
226 void
227 BufferOp::setQuadrantSegments(int q)
228 {
229 bufParams.setQuadrantSegments(q);
230 }
231
232 void
233 BufferOp::setEndCapStyle(int s)
234 {
235 bufParams.setEndCapStyle((BufferParameters::EndCapStyle)s);
236 }
237
238 } // namespace geos::operation::buffer
239 } // namespace geos::operation
240 } // namespace geos
241
242 #ifdef _MSC_VER
243 #pragma warning(pop)
244 #endif
245
246 #endif // ndef GEOS_OP_BUFFER_BUFFEROP_H
247
248 /**********************************************************************
249 * $Log$
250 * Revision 1.1 2006/03/14 00:19:40 strk
251 * opBuffer.h split, streamlined headers in some (not all) files in operation/buffer/
252 *
253 **********************************************************************/
254