00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef GEOS_OP_BUFFER_BUFFERBUILDER_H
00022 #define GEOS_OP_BUFFER_BUFFERBUILDER_H
00023
00024 #include <geos/export.h>
00025
00026 #include <vector>
00027
00028 #include <geos/operation/buffer/BufferOp.h>
00029 #include <geos/operation/buffer/OffsetCurveBuilder.h>
00030 #include <geos/geomgraph/EdgeList.h>
00031
00032
00033 namespace geos {
00034 namespace geom {
00035 class PrecisionModel;
00036 class Geometry;
00037 class GeometryFactory;
00038 }
00039 namespace algorithm {
00040 class CGAlgorithms;
00041 class LineIntersector;
00042 }
00043 namespace noding {
00044 class Noder;
00045 class SegmentString;
00046 class IntersectionAdder;
00047 }
00048 namespace geomgraph {
00049 class Edge;
00050 class Label;
00051 class PlanarGraph;
00052 }
00053 namespace operation {
00054 namespace buffer {
00055 class BufferSubgraph;
00056 }
00057 namespace overlay {
00058 class PolygonBuilder;
00059 }
00060 }
00061 }
00062
00063 namespace geos {
00064 namespace operation {
00065 namespace buffer {
00066
00084 class GEOS_DLL BufferBuilder {
00085
00086 public:
00096 BufferBuilder(const BufferParameters& nBufParams)
00097 :
00098 bufParams(nBufParams),
00099 workingPrecisionModel(NULL),
00100 li(NULL),
00101 intersectionAdder(NULL),
00102 workingNoder(NULL),
00103 geomFact(NULL),
00104 edgeList()
00105 {}
00106
00107 ~BufferBuilder();
00108
00109
00120 void setWorkingPrecisionModel(const geom::PrecisionModel *pm) {
00121 workingPrecisionModel=pm;
00122 }
00123
00131 void setNoder(noding::Noder* newNoder) { workingNoder = newNoder; }
00132
00133 geom::Geometry* buffer(const geom::Geometry *g, double distance);
00134
00135
00137 geom::Geometry* bufferLineSingleSided( const geom::Geometry* g,
00138 double distance, bool leftSide ) ;
00139
00140
00141 private:
00145 static int depthDelta(geomgraph::Label *label);
00146
00147 const BufferParameters& bufParams;
00148
00149 const geom::PrecisionModel* workingPrecisionModel;
00150
00151 algorithm::LineIntersector* li;
00152
00153 noding::IntersectionAdder* intersectionAdder;
00154
00155 noding::Noder* workingNoder;
00156
00157 const geom::GeometryFactory* geomFact;
00158
00159 geomgraph::EdgeList edgeList;
00160
00161 std::vector<geomgraph::Label *> newLabels;
00162
00163 void computeNodedEdges(std::vector<noding::SegmentString*>& bufSegStr,
00164 const geom::PrecisionModel *precisionModel);
00165
00166
00176 void insertUniqueEdge(geomgraph::Edge *e);
00177
00178 void createSubgraphs(geomgraph::PlanarGraph *graph,
00179 std::vector<BufferSubgraph*>& list);
00180
00191 void buildSubgraphs(const std::vector<BufferSubgraph*>& subgraphList,
00192 overlay::PolygonBuilder& polyBuilder);
00193
00197
00202 noding::Noder* getNoder(const geom::PrecisionModel* precisionModel);
00203
00204
00212 geom::Geometry* createEmptyResultGeometry() const;
00213
00214
00215 BufferBuilder(const BufferBuilder& other);
00216 BufferBuilder& operator=(const BufferBuilder& rhs);
00217 };
00218
00219 }
00220 }
00221 }
00222
00223 #endif // ndef GEOS_OP_BUFFER_BUFFERBUILDER_H
00224
00225
00226
00227
00228
00229
00230
00231
00232
00233
00234