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 private:
00090 static int depthDelta(geomgraph::Label *label);
00091
00092 const BufferParameters& bufParams;
00093
00094 const geom::PrecisionModel* workingPrecisionModel;
00095
00096 algorithm::LineIntersector* li;
00097
00098 noding::IntersectionAdder* intersectionAdder;
00099
00100 noding::Noder* workingNoder;
00101
00102 const geom::GeometryFactory* geomFact;
00103
00104 geomgraph::EdgeList edgeList;
00105
00106 std::vector<geomgraph::Label *> newLabels;
00107
00108 void computeNodedEdges(std::vector<noding::SegmentString*>& bufSegStr,
00109 const geom::PrecisionModel *precisionModel);
00110
00111
00121 void insertUniqueEdge(geomgraph::Edge *e);
00122
00123 void createSubgraphs(geomgraph::PlanarGraph *graph,
00124 std::vector<BufferSubgraph*>& list);
00125
00136 void buildSubgraphs(const std::vector<BufferSubgraph*>& subgraphList,
00137 overlay::PolygonBuilder& polyBuilder);
00138
00142
00147 noding::Noder* getNoder(const geom::PrecisionModel* precisionModel);
00148
00149
00157 geom::Geometry* createEmptyResultGeometry() const;
00158
00159 public:
00169 BufferBuilder(const BufferParameters& nBufParams)
00170 :
00171 bufParams(nBufParams),
00172 workingPrecisionModel(NULL),
00173 li(NULL),
00174 intersectionAdder(NULL),
00175 workingNoder(NULL),
00176 geomFact(NULL),
00177 edgeList()
00178 {}
00179
00180 ~BufferBuilder();
00181
00182
00193 void setWorkingPrecisionModel(const geom::PrecisionModel *pm) {
00194 workingPrecisionModel=pm;
00195 }
00196
00204 void setNoder(noding::Noder* newNoder) { workingNoder = newNoder; }
00205
00206 geom::Geometry* buffer(const geom::Geometry *g, double distance);
00207
00208
00210 geom::Geometry* bufferLineSingleSided( const geom::Geometry* g,
00211 double distance, bool leftSide ) ;
00212
00213
00214 };
00215
00216 }
00217 }
00218 }
00219
00220 #endif // ndef GEOS_OP_BUFFER_BUFFERBUILDER_H
00221
00222
00223
00224
00225
00226
00227
00228
00229
00230
00231