00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef GEOS_OP_BUFFER_BUFFEROP_H
00017 #define GEOS_OP_BUFFER_BUFFEROP_H
00018
00019 #include <geos/operation/buffer/OffsetCurveBuilder.h>
00020 #include <geos/util/TopologyException.h>
00021
00022
00023 namespace geos {
00024 namespace geom {
00025 class PrecisionModel;
00026 class Geometry;
00027 }
00028 }
00029
00030 namespace geos {
00031 namespace operation {
00032 namespace buffer {
00033
00066 class BufferOp {
00067
00068
00069 private:
00070
00077 static const int MAX_PRECISION_DIGITS = 12;
00078
00095 static double precisionScaleFactor(const geom::Geometry *g,
00096 double distance, int maxPrecisionDigits);
00097
00098 const geom::Geometry *argGeom;
00099
00100 util::TopologyException saveException;
00101
00102 double distance;
00103
00104 int quadrantSegments;
00105
00106 int endCapStyle;
00107
00108 geom::Geometry* resultGeometry;
00109
00110 void computeGeometry();
00111
00112 void bufferOriginalPrecision();
00113
00114 void bufferReducedPrecision(int precisionDigits);
00115
00116 void bufferReducedPrecision();
00117
00118 void bufferFixedPrecision(const geom::PrecisionModel& fixedPM);
00119
00120 public:
00121
00122 enum {
00124 CAP_ROUND,
00126 CAP_BUTT,
00128 CAP_SQUARE
00129 };
00130
00142 static geom::Geometry* bufferOp(const geom::Geometry *g,
00143 double distance,
00144 int quadrantSegments=
00145 OffsetCurveBuilder::DEFAULT_QUADRANT_SEGMENTS,
00146 int endCapStyle=BufferOp::CAP_ROUND);
00147
00153 BufferOp(const geom::Geometry *g)
00154 :
00155 argGeom(g),
00156 quadrantSegments(OffsetCurveBuilder::DEFAULT_QUADRANT_SEGMENTS),
00157 endCapStyle(BufferOp::CAP_ROUND),
00158 resultGeometry(NULL)
00159 {}
00160
00168 inline void setEndCapStyle(int nEndCapStyle);
00169
00177 inline void setQuadrantSegments(int nQuadrantSegments);
00178
00187 geom::Geometry* getResultGeometry(double nDistance);
00188
00201 geom::Geometry* getResultGeometry(double nDistance, int nQuadrantSegments);
00202 };
00203
00204
00205 void BufferOp::setQuadrantSegments(int q) { quadrantSegments=q; }
00206 void BufferOp::setEndCapStyle(int s) { endCapStyle=s; }
00207
00208
00209 }
00210 }
00211 }
00212
00213 #endif // ndef GEOS_OP_BUFFER_BUFFEROP_H
00214
00215
00216
00217
00218
00219
00220
00221