GEOS 3.9.1
BufferBuilder.h
1/**********************************************************************
2 *
3 * GEOS - Geometry Engine Open Source
4 * http://geos.osgeo.org
5 *
6 * Copyright (C) 2009-2011 Sandro Santilli <strk@kbt.io>
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
38namespace geos {
39namespace geom {
40class PrecisionModel;
41class Geometry;
42class GeometryFactory;
43}
44namespace algorithm {
45class LineIntersector;
46}
47namespace noding {
48class Noder;
49class SegmentString;
50class IntersectionAdder;
51}
52namespace geomgraph {
53class Edge;
54class Label;
55class PlanarGraph;
56}
57namespace operation {
58namespace buffer {
59class BufferSubgraph;
60}
61namespace overlay {
62class PolygonBuilder;
63}
64}
65}
66
67namespace geos {
68namespace operation { // geos.operation
69namespace buffer { // geos.operation.buffer
70
88class GEOS_DLL BufferBuilder {
89
90public:
101 :
102 bufParams(nBufParams),
103 workingPrecisionModel(nullptr),
104 li(nullptr),
105 intersectionAdder(nullptr),
106 workingNoder(nullptr),
107 geomFact(nullptr),
108 edgeList()
109 {}
110
112
113
124 void
126 {
127 workingPrecisionModel = pm;
128 }
129
137 void
139 {
140 workingNoder = newNoder;
141 }
142
143 geom::Geometry* buffer(const geom::Geometry* g, double distance);
144 // throw (GEOSException);
145
165 double distance, bool leftSide) ;
166 // throw (GEOSException);
167
168private:
169
173 static int depthDelta(const geomgraph::Label& label);
174
175 const BufferParameters& bufParams;
176
177 const geom::PrecisionModel* workingPrecisionModel;
178
180
181 noding::IntersectionAdder* intersectionAdder;
182
183 noding::Noder* workingNoder;
184
185 const geom::GeometryFactory* geomFact;
186
187 geomgraph::EdgeList edgeList;
188
189 std::vector<geomgraph::Label*> newLabels;
190
191 void computeNodedEdges(std::vector<noding::SegmentString*>& bufSegStr,
192 const geom::PrecisionModel* precisionModel);
193 // throw(GEOSException);
194
204 void insertUniqueEdge(geomgraph::Edge* e);
205
206 void createSubgraphs(geomgraph::PlanarGraph* graph,
207 std::vector<BufferSubgraph*>& list);
208
219 void buildSubgraphs(const std::vector<BufferSubgraph*>& subgraphList,
220 overlay::PolygonBuilder& polyBuilder);
221
230 noding::Noder* getNoder(const geom::PrecisionModel* precisionModel);
231
232
240 geom::Geometry* createEmptyResultGeometry() const;
241
242 // Declare type as noncopyable
243 BufferBuilder(const BufferBuilder& other) = delete;
244 BufferBuilder& operator=(const BufferBuilder& rhs) = delete;
245};
246
247} // namespace geos::operation::buffer
248} // namespace geos::operation
249} // namespace geos
250
251#ifdef _MSC_VER
252#pragma warning(pop)
253#endif
254
255#endif // ndef GEOS_OP_BUFFER_BUFFERBUILDER_H
A LineIntersector is an algorithm that can both test whether two line segments intersect and compute ...
Definition LineIntersector.h:49
Supplies a set of utility methods for building Geometry objects from CoordinateSequence or other Geom...
Definition GeometryFactory.h:68
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition Geometry.h:188
Specifies the precision model of the Coordinate in a Geometry.
Definition PrecisionModel.h:87
A EdgeList is a list of Edges.
Definition EdgeList.h:58
Definition geomgraph/Edge.h:66
A Label indicates the topological relationship of a component of a topology graph to a given Geometry...
Definition Label.h:59
Represents a directed graph which is embeddable in a planar surface.
Definition geomgraph/PlanarGraph.h:75
Computes the intersections between two line segments in SegmentString and adds them to each string.
Definition IntersectionAdder.h:57
Computes all intersections between segments in a set of SegmentString.
Definition Noder.h:49
Builds the buffer geometry for a given input geometry and precision model.
Definition BufferBuilder.h:88
BufferBuilder(const BufferParameters &nBufParams)
Definition BufferBuilder.h:100
void setNoder(noding::Noder *newNoder)
Definition BufferBuilder.h:138
void setWorkingPrecisionModel(const geom::PrecisionModel *pm)
Definition BufferBuilder.h:125
geom::Geometry * bufferLineSingleSided(const geom::Geometry *g, double distance, bool leftSide)
Contains the parameters which describe how a buffer should be constructed.
Definition BufferParameters.h:57
Forms Polygon out of a graph of geomgraph::DirectedEdge.
Definition overlay/PolygonBuilder.h:62
Basic namespace for all GEOS functionalities.
Definition IndexedNestedRingTester.h:26