GEOS 3.3.4

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List

BufferBuilder.h
1 /**********************************************************************
2 * $Id: BufferBuilder.h 3301 2011-04-27 09:42:31Z strk $
3 *
4 * GEOS - Geometry Engine Open Source
5 * http://geos.refractions.net
6 *
7 * Copyright (C) 2009-2011 Sandro Santilli <strk@keybit.net>
8 * Copyright (C) 2008-2010 Safe Software Inc.
9 * Copyright (C) 2006-2007 Refractions Research Inc.
10 *
11 * This is free software; you can redistribute and/or modify it under
12 * the terms of the GNU Lesser General Public Licence as published
13 * by the Free Software Foundation.
14 * See the COPYING file for more information.
15 *
16 **********************************************************************
17 *
18 * Last port: operation/buffer/BufferBuilder.java r378 (JTS-1.12)
19 *
20 **********************************************************************/
21
22 #ifndef GEOS_OP_BUFFER_BUFFERBUILDER_H
23 #define GEOS_OP_BUFFER_BUFFERBUILDER_H
24
25 #include <geos/export.h>
26
27 #include <vector>
28
29 #include <geos/operation/buffer/BufferOp.h> // for inlines (BufferOp enums)
30 #include <geos/operation/buffer/OffsetCurveBuilder.h> // for inline (OffsetCurveBuilder enums)
31 #include <geos/geomgraph/EdgeList.h> // for composition
32
33 #ifdef _MSC_VER
34 #pragma warning(push)
35 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
36 #endif
37
38 // Forward declarations
39 namespace geos {
40 namespace geom {
41 class PrecisionModel;
42 class Geometry;
43 class GeometryFactory;
44 }
45 namespace algorithm {
46 class CGAlgorithms;
47 class LineIntersector;
48 }
49 namespace noding {
50 class Noder;
51 class SegmentString;
52 class IntersectionAdder;
53 }
54 namespace geomgraph {
55 class Edge;
56 class Label;
57 class PlanarGraph;
58 }
59 namespace operation {
60 namespace buffer {
61 class BufferSubgraph;
62 }
63 namespace overlay {
64 class PolygonBuilder;
65 }
66 }
67 }
68
69 namespace geos {
70 namespace operation { // geos.operation
71 namespace buffer { // geos.operation.buffer
72
90 class GEOS_DLL BufferBuilder {
91
92 public:
102 BufferBuilder(const BufferParameters& nBufParams)
103 :
104 bufParams(nBufParams),
105 workingPrecisionModel(NULL),
106 li(NULL),
107 intersectionAdder(NULL),
108 workingNoder(NULL),
109 geomFact(NULL),
110 edgeList()
111 {}
112
113 ~BufferBuilder();
114
115
126 void setWorkingPrecisionModel(const geom::PrecisionModel *pm) {
127 workingPrecisionModel=pm;
128 }
129
137 void setNoder(noding::Noder* newNoder) { workingNoder = newNoder; }
138
139 geom::Geometry* buffer(const geom::Geometry *g, double distance);
140 // throw (GEOSException);
141
143 geom::Geometry* bufferLineSingleSided( const geom::Geometry* g,
144 double distance, bool leftSide ) ;
145 // throw (GEOSException);
146
147 private:
151 static int depthDelta(geomgraph::Label *label);
152
153 const BufferParameters& bufParams;
154
155 const geom::PrecisionModel* workingPrecisionModel;
156
157 algorithm::LineIntersector* li;
158
159 noding::IntersectionAdder* intersectionAdder;
160
161 noding::Noder* workingNoder;
162
163 const geom::GeometryFactory* geomFact;
164
165 geomgraph::EdgeList edgeList;
166
167 std::vector<geomgraph::Label *> newLabels;
168
169 void computeNodedEdges(std::vector<noding::SegmentString*>& bufSegStr,
170 const geom::PrecisionModel *precisionModel);
171 // throw(GEOSException);
172
182 void insertUniqueEdge(geomgraph::Edge *e);
183
184 void createSubgraphs(geomgraph::PlanarGraph *graph,
185 std::vector<BufferSubgraph*>& list);
186
197 void buildSubgraphs(const std::vector<BufferSubgraph*>& subgraphList,
198 overlay::PolygonBuilder& polyBuilder);
199
203 //
208 noding::Noder* getNoder(const geom::PrecisionModel* precisionModel);
209
210
218 geom::Geometry* createEmptyResultGeometry() const;
219
220 // Declare type as noncopyable
221 BufferBuilder(const BufferBuilder& other);
222 BufferBuilder& operator=(const BufferBuilder& rhs);
223 };
224
225 } // namespace geos::operation::buffer
226 } // namespace geos::operation
227 } // namespace geos
228
229 #ifdef _MSC_VER
230 #pragma warning(pop)
231 #endif
232
233 #endif // ndef GEOS_OP_BUFFER_BUFFERBUILDER_H
234
235 /**********************************************************************
236 * $Log$
237 * Revision 1.2 2006/03/14 16:08:21 strk
238 * changed buildSubgraphs signature to use refs rather then pointers, made it const-correct. Reduced heap allocations in createSubgraphs()
239 *
240 * Revision 1.1 2006/03/14 00:19:40 strk
241 * opBuffer.h split, streamlined headers in some (not all) files in operation/buffer/
242 *
243 **********************************************************************/
244