GEOS 3.10.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 isInvertOrientation(false)
110 {}
111
113
114
125 void
127 {
128 workingPrecisionModel = pm;
129 }
130
138 void
140 {
141 workingNoder = newNoder;
142 }
143
152 void
153 setInvertOrientation(bool p_isInvertOrientation)
154 {
155 isInvertOrientation = p_isInvertOrientation;
156 }
157
158
159 std::unique_ptr<geom::Geometry> buffer(const geom::Geometry* g, double distance);
160
179 std::unique_ptr<geom::Geometry> bufferLineSingleSided(
180 const geom::Geometry* g,
181 double distance, bool leftSide);
182
183private:
184
188 static int depthDelta(const geomgraph::Label& label);
189
190 const BufferParameters& bufParams;
191
192 const geom::PrecisionModel* workingPrecisionModel;
193
195
196 noding::IntersectionAdder* intersectionAdder;
197
198 noding::Noder* workingNoder;
199
200 const geom::GeometryFactory* geomFact;
201
202 geomgraph::EdgeList edgeList;
203
204 std::vector<geomgraph::Label*> newLabels;
205
206 bool isInvertOrientation;
207
208 void computeNodedEdges(std::vector<noding::SegmentString*>& bufSegStr,
209 const geom::PrecisionModel* precisionModel);
210 // throw(GEOSException);
211
221 void insertUniqueEdge(geomgraph::Edge* e);
222
223 void createSubgraphs(geomgraph::PlanarGraph* graph,
224 std::vector<BufferSubgraph*>& list);
225
236 void buildSubgraphs(const std::vector<BufferSubgraph*>& subgraphList,
237 overlay::PolygonBuilder& polyBuilder);
238
247 noding::Noder* getNoder(const geom::PrecisionModel* precisionModel);
248
249
257 std::unique_ptr<geom::Geometry> createEmptyResultGeometry() const;
258
259 // Declare type as noncopyable
260 BufferBuilder(const BufferBuilder& other) = delete;
261 BufferBuilder& operator=(const BufferBuilder& rhs) = delete;
262};
263
264} // namespace geos::operation::buffer
265} // namespace geos::operation
266} // namespace geos
267
268#ifdef _MSC_VER
269#pragma warning(pop)
270#endif
271
272#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:50
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 setInvertOrientation(bool p_isInvertOrientation)
Definition: BufferBuilder.h:153
void setNoder(noding::Noder *newNoder)
Definition: BufferBuilder.h:139
void setWorkingPrecisionModel(const geom::PrecisionModel *pm)
Definition: BufferBuilder.h:126
std::unique_ptr< 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: geos.h:40