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
00031 namespace geos {
00032 namespace geom {
00033 class PrecisionModel;
00034 class Geometry;
00035 }
00036 }
00037
00038 namespace geos {
00039 namespace operation {
00040 namespace buffer {
00041
00072 class GEOS_DLL BufferOp {
00073
00074
00075 private:
00076
00083 static const int MAX_PRECISION_DIGITS = 12;
00084
00101 static double precisionScaleFactor(const geom::Geometry *g,
00102 double distance, int maxPrecisionDigits);
00103
00104 const geom::Geometry *argGeom;
00105
00106 util::TopologyException saveException;
00107
00108 double distance;
00109
00110
00111
00112 BufferParameters bufParams;
00113
00114 geom::Geometry* resultGeometry;
00115
00116 void computeGeometry();
00117
00118 void bufferOriginalPrecision();
00119
00120 void bufferReducedPrecision(int precisionDigits);
00121
00122 void bufferReducedPrecision();
00123
00124 void bufferFixedPrecision(const geom::PrecisionModel& fixedPM);
00125
00126 public:
00127
00128 enum {
00131 CAP_ROUND = BufferParameters::CAP_ROUND,
00132
00135 CAP_BUTT = BufferParameters::CAP_FLAT,
00136
00139 CAP_SQUARE = BufferParameters::CAP_SQUARE
00140 };
00141
00153 static geom::Geometry* bufferOp(const geom::Geometry *g,
00154 double distance,
00155 int quadrantSegments=
00156 BufferParameters::DEFAULT_QUADRANT_SEGMENTS,
00157 int endCapStyle=BufferParameters::CAP_ROUND);
00158
00164 BufferOp(const geom::Geometry *g)
00165 :
00166 argGeom(g),
00167 bufParams(),
00168 resultGeometry(NULL)
00169 {
00170 }
00171
00180 BufferOp(const geom::Geometry* g, const BufferParameters& params)
00181 :
00182 argGeom(g),
00183 bufParams(params),
00184 resultGeometry(NULL)
00185 {
00186 }
00187
00188
00196 inline void setEndCapStyle(int nEndCapStyle);
00197
00205 inline void setQuadrantSegments(int nQuadrantSegments);
00206
00215 geom::Geometry* getResultGeometry(double nDistance);
00216
00217 };
00218
00219
00220 void
00221 BufferOp::setQuadrantSegments(int q)
00222 {
00223 bufParams.setQuadrantSegments(q);
00224 }
00225
00226 void
00227 BufferOp::setEndCapStyle(int s)
00228 {
00229 bufParams.setEndCapStyle((BufferParameters::EndCapStyle)s);
00230 }
00231
00232
00233 }
00234 }
00235 }
00236
00237 #endif // ndef GEOS_OP_BUFFER_BUFFEROP_H
00238
00239
00240
00241
00242
00243
00244
00245