GEOS  3.4.2
BufferBuilder.h
1 /**********************************************************************
2  *
3  * GEOS - Geometry Engine Open Source
4  * http://geos.osgeo.org
5  *
6  * Copyright (C) 2009-2011 Sandro Santilli <strk@keybit.net>
7  * Copyright (C) 2008-2010 Safe Software Inc.
8  * Copyright (C) 2006-2007 Refractions Research Inc.
9  *
10  * This is free software; you can redistribute and/or modify it under
11  * the terms of the GNU Lesser General Public Licence as published
12  * by the Free Software Foundation.
13  * See the COPYING file for more information.
14  *
15  **********************************************************************
16  *
17  * Last port: operation/buffer/BufferBuilder.java r378 (JTS-1.12)
18  *
19  **********************************************************************/
20 
21 #ifndef GEOS_OP_BUFFER_BUFFERBUILDER_H
22 #define GEOS_OP_BUFFER_BUFFERBUILDER_H
23 
24 #include <geos/export.h>
25 
26 #include <vector>
27 
28 #include <geos/operation/buffer/BufferOp.h> // for inlines (BufferOp enums)
29 #include <geos/operation/buffer/OffsetCurveBuilder.h> // for inline (OffsetCurveBuilder enums)
30 #include <geos/geomgraph/EdgeList.h> // for composition
31 
32 #ifdef _MSC_VER
33 #pragma warning(push)
34 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
35 #endif
36 
37 // Forward declarations
38 namespace geos {
39  namespace geom {
40  class PrecisionModel;
41  class Geometry;
42  class GeometryFactory;
43  }
44  namespace algorithm {
45  class CGAlgorithms;
46  class LineIntersector;
47  }
48  namespace noding {
49  class Noder;
50  class SegmentString;
51  class IntersectionAdder;
52  }
53  namespace geomgraph {
54  class Edge;
55  class Label;
56  class PlanarGraph;
57  }
58  namespace operation {
59  namespace buffer {
60  class BufferSubgraph;
61  }
62  namespace overlay {
63  class PolygonBuilder;
64  }
65  }
66 }
67 
68 namespace geos {
69 namespace operation { // geos.operation
70 namespace buffer { // geos.operation.buffer
71 
89 class GEOS_DLL BufferBuilder {
90 
91 public:
101  BufferBuilder(const BufferParameters& nBufParams)
102  :
103  bufParams(nBufParams),
104  workingPrecisionModel(NULL),
105  li(NULL),
106  intersectionAdder(NULL),
107  workingNoder(NULL),
108  geomFact(NULL),
109  edgeList()
110  {}
111 
112  ~BufferBuilder();
113 
114 
126  workingPrecisionModel=pm;
127  }
128 
136  void setNoder(noding::Noder* newNoder) { workingNoder = newNoder; }
137 
138  geom::Geometry* buffer(const geom::Geometry *g, double distance);
139  // throw (GEOSException);
140 
159  geom::Geometry* bufferLineSingleSided( const geom::Geometry* g,
160  double distance, bool leftSide ) ;
161  // throw (GEOSException);
162 
163 private:
164 
168  static int depthDelta(const geomgraph::Label& label);
169 
170  const BufferParameters& bufParams;
171 
172  const geom::PrecisionModel* workingPrecisionModel;
173 
175 
176  noding::IntersectionAdder* intersectionAdder;
177 
178  noding::Noder* workingNoder;
179 
180  const geom::GeometryFactory* geomFact;
181 
182  geomgraph::EdgeList edgeList;
183 
184  std::vector<geomgraph::Label *> newLabels;
185 
186  void computeNodedEdges(std::vector<noding::SegmentString*>& bufSegStr,
187  const geom::PrecisionModel *precisionModel);
188  // throw(GEOSException);
189 
199  void insertUniqueEdge(geomgraph::Edge *e);
200 
201  void createSubgraphs(geomgraph::PlanarGraph *graph,
202  std::vector<BufferSubgraph*>& list);
203 
214  void buildSubgraphs(const std::vector<BufferSubgraph*>& subgraphList,
215  overlay::PolygonBuilder& polyBuilder);
216 
220  //
225  noding::Noder* getNoder(const geom::PrecisionModel* precisionModel);
226 
227 
235  geom::Geometry* createEmptyResultGeometry() const;
236 
237  // Declare type as noncopyable
238  BufferBuilder(const BufferBuilder& other);
239  BufferBuilder& operator=(const BufferBuilder& rhs);
240 };
241 
242 } // namespace geos::operation::buffer
243 } // namespace geos::operation
244 } // namespace geos
245 
246 #ifdef _MSC_VER
247 #pragma warning(pop)
248 #endif
249 
250 #endif // ndef GEOS_OP_BUFFER_BUFFERBUILDER_H
Forms Polygon out of a graph of geomgraph::DirectedEdge.
Definition: PolygonBuilder.h:61
BufferBuilder(const BufferParameters &nBufParams)
Definition: BufferBuilder.h:101
Represents a directed graph which is embeddable in a planar surface.
Definition: geomgraph/PlanarGraph.h:75
Definition: EdgeList.h:58
Specifies the precision model of the Coordinate in a Geometry.
Definition: PrecisionModel.h:87
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition: Geometry.h:167
A LineIntersector is an algorithm that can both test whether two line segments intersect and compute ...
Definition: LineIntersector.h:49
Definition: IntersectionAdder.h:58
Supplies a set of utility methods for building Geometry objects from CoordinateSequence or other Geom...
Definition: GeometryFactory.h:67
A Label indicates the topological relationship of a component of a topology graph to a given Geometry...
Definition: Label.h:57
Computes all intersections between segments in a set of SegmentString.
Definition: Noder.h:49
Contains the parameters which describe how a buffer should be constructed.
Definition: BufferParameters.h:57
void setWorkingPrecisionModel(const geom::PrecisionModel *pm)
Definition: BufferBuilder.h:125
Builds the buffer geometry for a given input geometry and precision model.
Definition: BufferBuilder.h:89
void setNoder(noding::Noder *newNoder)
Definition: BufferBuilder.h:136
Definition: geomgraph/Edge.h:66