GEOS 3.6.2
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
35namespace geos {
36 namespace geom {
37 class PrecisionModel;
38 class Geometry;
39 }
40}
41
42namespace geos {
43namespace operation { // geos.operation
44namespace buffer { // geos.operation.buffer
45
78class GEOS_DLL BufferOp {
79
80
81private:
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
132public:
133
134 enum {
138
142
146 };
147
160 double distance,
161 int quadrantSegments=
163 int endCapStyle=BufferParameters::CAP_ROUND);
164
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
243
244};
245
246// BufferOp inlines
247void
249{
250 bufParams.setQuadrantSegments(q);
251}
252
253void
255{
256 bufParams.setEndCapStyle((BufferParameters::EndCapStyle)s);
257}
258
259void
260BufferOp::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
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition Geometry.h:167
Specifies the precision model of the Coordinate in a Geometry.
Definition PrecisionModel.h:87
void setQuadrantSegments(int nQuadrantSegments)
Definition BufferOp.h:248
static geom::Geometry * bufferOp(const geom::Geometry *g, double distance, int quadrantSegments=BufferParameters::DEFAULT_QUADRANT_SEGMENTS, int endCapStyle=BufferParameters::CAP_ROUND)
void setEndCapStyle(int nEndCapStyle)
Definition BufferOp.h:254
void setSingleSided(bool isSingleSided)
Definition BufferOp.h:260
BufferOp(const geom::Geometry *g, const BufferParameters &params)
Definition BufferOp.h:186
BufferOp(const geom::Geometry *g)
Definition BufferOp.h:170
geom::Geometry * getResultGeometry(double nDistance)
@ CAP_ROUND
Definition BufferOp.h:137
@ CAP_BUTT
Definition BufferOp.h:141
@ CAP_SQUARE
Definition BufferOp.h:145
Contains the parameters which describe how a buffer should be constructed.
Definition BufferParameters.h:58
EndCapStyle
End cap styles.
Definition BufferParameters.h:63
@ CAP_SQUARE
Specifies a square line buffer end cap style.
Definition BufferParameters.h:72
@ CAP_ROUND
Specifies a round line buffer end cap style.
Definition BufferParameters.h:66
@ CAP_FLAT
Specifies a flat line buffer end cap style.
Definition BufferParameters.h:69
static const int DEFAULT_QUADRANT_SEGMENTS
The default number of facets into which to divide a fillet of 90 degrees.
Definition BufferParameters.h:96
Indicates an invalid or inconsistent topological situation encountered during processing.
Definition TopologyException.h:35
Contains the Geometry interface hierarchy and supporting classes.
Definition IndexedNestedRingTester.h:26
Provides classes for computing buffers of geometries.
Definition opBuffer.h:23
Provides classes for implementing operations on geometries.
Definition IndexedNestedRingTester.h:40
Basic namespace for all GEOS functionalities.
Definition IndexedNestedRingTester.h:25