00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef GEOS_OP_BUFFER_BUFFERBUILDER_H
00017 #define GEOS_OP_BUFFER_BUFFERBUILDER_H
00018
00019 #include <vector>
00020
00021 #include <geos/operation/buffer/BufferOp.h>
00022 #include <geos/operation/buffer/OffsetCurveBuilder.h>
00023 #include <geos/geomgraph/EdgeList.h>
00024
00025
00026 namespace geos {
00027 namespace geom {
00028 class PrecisionModel;
00029 class Geometry;
00030 class GeometryFactory;
00031 }
00032 namespace algorithm {
00033 class CGAlgorithms;
00034 class LineIntersector;
00035 }
00036 namespace noding {
00037 class Noder;
00038 class SegmentString;
00039 class IntersectionAdder;
00040 }
00041 namespace geomgraph {
00042 class Edge;
00043 class Label;
00044 class PlanarGraph;
00045 }
00046 namespace operation {
00047 namespace buffer {
00048 class BufferSubgraph;
00049 }
00050 namespace overlay {
00051 class PolygonBuilder;
00052 }
00053 }
00054 }
00055
00056 namespace geos {
00057 namespace operation {
00058 namespace buffer {
00059
00079 class BufferBuilder {
00080
00081 private:
00085 static int depthDelta(geomgraph::Label *label);
00086
00087 int quadrantSegments;
00088
00089 int endCapStyle;
00090
00091 const geom::PrecisionModel* workingPrecisionModel;
00092
00093 algorithm::LineIntersector* li;
00094
00095 noding::IntersectionAdder* intersectionAdder;
00096
00097 noding::Noder* workingNoder;
00098
00099 const geom::GeometryFactory* geomFact;
00100
00101 geomgraph::EdgeList edgeList;
00102
00103 std::vector<geomgraph::Label *> newLabels;
00104
00105 void computeNodedEdges(std::vector<noding::SegmentString*>& bufferSegStrList,
00106 const geom::PrecisionModel *precisionModel);
00107
00108
00118 void insertEdge(geomgraph::Edge *e);
00119
00120 void createSubgraphs(geomgraph::PlanarGraph *graph,
00121 std::vector<BufferSubgraph*>& list);
00122
00133 void buildSubgraphs(const std::vector<BufferSubgraph*>& subgraphList,
00134 overlay::PolygonBuilder& polyBuilder);
00135
00139
00144 noding::Noder* getNoder(const geom::PrecisionModel* precisionModel);
00145
00146
00154 geom::Geometry* createEmptyResultGeometry() const;
00155
00156 public:
00160 BufferBuilder()
00161 :
00162 quadrantSegments(OffsetCurveBuilder::DEFAULT_QUADRANT_SEGMENTS),
00163 endCapStyle(BufferOp::CAP_ROUND),
00164 workingPrecisionModel(NULL),
00165 li(NULL),
00166 intersectionAdder(NULL),
00167 workingNoder(NULL),
00168 geomFact(NULL),
00169 edgeList()
00170 {}
00171
00172 ~BufferBuilder();
00173
00180 void setQuadrantSegments(int nQuadrantSegments) {
00181 quadrantSegments=nQuadrantSegments;
00182 }
00183
00184
00195 void setWorkingPrecisionModel(const geom::PrecisionModel *pm) {
00196 workingPrecisionModel=pm;
00197 }
00198
00206 void setNoder(noding::Noder* newNoder) { workingNoder = newNoder; }
00207
00208 void setEndCapStyle(int nEndCapStyle) {
00209 endCapStyle=nEndCapStyle;
00210 }
00211
00212 geom::Geometry* buffer(const geom::Geometry *g, double distance);
00213
00214
00215 };
00216
00217 }
00218 }
00219 }
00220
00221 #endif // ndef GEOS_OP_BUFFER_BUFFERBUILDER_H
00222
00223
00224
00225
00226
00227
00228
00229
00230
00231
00232