00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef GEOS_OP_BUFFER_BUFFEROP_H
00023 #define GEOS_OP_BUFFER_BUFFEROP_H
00024
00025 #include <geos/export.h>
00026 #include <geos/operation/buffer/BufferParameters.h>
00027
00028 #include <geos/util/TopologyException.h>
00029
00030 #ifdef _MSC_VER
00031 #pragma warning(push)
00032 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
00033 #endif
00034
00035
00036 namespace geos {
00037 namespace geom {
00038 class PrecisionModel;
00039 class Geometry;
00040 }
00041 }
00042
00043 namespace geos {
00044 namespace operation {
00045 namespace buffer {
00046
00079 class GEOS_DLL BufferOp {
00080
00081
00082 private:
00083
00090 static const int MAX_PRECISION_DIGITS = 12;
00091
00108 static double precisionScaleFactor(const geom::Geometry *g,
00109 double distance, int maxPrecisionDigits);
00110
00111 const geom::Geometry *argGeom;
00112
00113 util::TopologyException saveException;
00114
00115 double distance;
00116
00117
00118
00119 BufferParameters bufParams;
00120
00121 geom::Geometry* resultGeometry;
00122
00123 void computeGeometry();
00124
00125 void bufferOriginalPrecision();
00126
00127 void bufferReducedPrecision(int precisionDigits);
00128
00129 void bufferReducedPrecision();
00130
00131 void bufferFixedPrecision(const geom::PrecisionModel& fixedPM);
00132
00133 public:
00134
00135 enum {
00138 CAP_ROUND = BufferParameters::CAP_ROUND,
00139
00142 CAP_BUTT = BufferParameters::CAP_FLAT,
00143
00146 CAP_SQUARE = BufferParameters::CAP_SQUARE
00147 };
00148
00160 static geom::Geometry* bufferOp(const geom::Geometry *g,
00161 double distance,
00162 int quadrantSegments=
00163 BufferParameters::DEFAULT_QUADRANT_SEGMENTS,
00164 int endCapStyle=BufferParameters::CAP_ROUND);
00165
00171 BufferOp(const geom::Geometry *g)
00172 :
00173 argGeom(g),
00174 bufParams(),
00175 resultGeometry(NULL)
00176 {
00177 }
00178
00187 BufferOp(const geom::Geometry* g, const BufferParameters& params)
00188 :
00189 argGeom(g),
00190 bufParams(params),
00191 resultGeometry(NULL)
00192 {
00193 }
00194
00202 inline void setEndCapStyle(int nEndCapStyle);
00203
00211 inline void setQuadrantSegments(int nQuadrantSegments);
00212
00221 geom::Geometry* getResultGeometry(double nDistance);
00222
00223 };
00224
00225
00226 void
00227 BufferOp::setQuadrantSegments(int q)
00228 {
00229 bufParams.setQuadrantSegments(q);
00230 }
00231
00232 void
00233 BufferOp::setEndCapStyle(int s)
00234 {
00235 bufParams.setEndCapStyle((BufferParameters::EndCapStyle)s);
00236 }
00237
00238 }
00239 }
00240 }
00241
00242 #ifdef _MSC_VER
00243 #pragma warning(pop)
00244 #endif
00245
00246 #endif // ndef GEOS_OP_BUFFER_BUFFEROP_H
00247
00248
00249
00250
00251
00252
00253
00254