GEOS 3.14.0dev
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 149b38907 (JTS-1.12)
18 *
19 **********************************************************************/
20
21#pragma once
22
23#include <geos/export.h>
24
25#include <vector>
26
27#include <geos/operation/buffer/BufferOp.h> // for inlines (BufferOp enums)
28#include <geos/operation/buffer/OffsetCurveBuilder.h> // for inline (OffsetCurveBuilder enums)
29#include <geos/geomgraph/EdgeList.h> // for composition
30
31#ifdef _MSC_VER
32#pragma warning(push)
33#pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
34#endif
35
36// Forward declarations
37namespace geos {
38namespace geom {
39class PrecisionModel;
40class Geometry;
41class GeometryFactory;
42}
43namespace algorithm {
44class LineIntersector;
45}
46namespace noding {
47class Noder;
48class SegmentString;
49class IntersectionAdder;
50}
51namespace geomgraph {
52class Edge;
53class Label;
54class PlanarGraph;
55}
56namespace operation {
57namespace buffer {
58class BufferSubgraph;
59}
60namespace overlay {
61class PolygonBuilder;
62}
63}
64}
65
66namespace geos {
67namespace operation { // geos.operation
68namespace buffer { // geos.operation.buffer
69
87class GEOS_DLL BufferBuilder {
88
89public:
100 :
101 bufParams(nBufParams),
102 workingPrecisionModel(nullptr),
103 li(nullptr),
104 intersectionAdder(nullptr),
105 workingNoder(nullptr),
106 geomFact(nullptr),
107 edgeList(),
108 isInvertOrientation(false)
109 {}
110
112
113
124 void
126 {
127 workingPrecisionModel = pm;
128 }
129
137 void
139 {
140 workingNoder = newNoder;
141 }
142
151 void
152 setInvertOrientation(bool p_isInvertOrientation)
153 {
154 isInvertOrientation = p_isInvertOrientation;
155 }
156
157
158 std::unique_ptr<geom::Geometry> buffer(const geom::Geometry* g, double distance);
159
178 std::unique_ptr<geom::Geometry> bufferLineSingleSided(
179 const geom::Geometry* g,
180 double distance, bool leftSide);
181
182private:
183
187 static int depthDelta(const geomgraph::Label& label);
188
189 const BufferParameters& bufParams;
190
191 const geom::PrecisionModel* workingPrecisionModel;
192
194
195 noding::IntersectionAdder* intersectionAdder;
196
197 noding::Noder* workingNoder;
198
199 const geom::GeometryFactory* geomFact;
200
201 geomgraph::EdgeList edgeList;
202
203 std::vector<geomgraph::Label*> newLabels;
204
205 bool isInvertOrientation;
206
207 void computeNodedEdges(std::vector<noding::SegmentString*>& bufSegStr,
208 const geom::PrecisionModel* precisionModel);
209 // throw(GEOSException);
210
220 void insertUniqueEdge(geomgraph::Edge* e);
221
222 void createSubgraphs(geomgraph::PlanarGraph* graph,
223 std::vector<BufferSubgraph*>& list);
224
235 void buildSubgraphs(const std::vector<BufferSubgraph*>& subgraphList,
236 overlay::PolygonBuilder& polyBuilder);
237
246 noding::Noder* getNoder(const geom::PrecisionModel* precisionModel);
247
248
256 std::unique_ptr<geom::Geometry> createEmptyResultGeometry() const;
257
258 // Declare type as noncopyable
259 BufferBuilder(const BufferBuilder& other) = delete;
260 BufferBuilder& operator=(const BufferBuilder& rhs) = delete;
261};
262
263} // namespace geos::operation::buffer
264} // namespace geos::operation
265} // namespace geos
266
267#ifdef _MSC_VER
268#pragma warning(pop)
269#endif
270
A LineIntersector is an algorithm that can both test whether two line segments intersect and compute ...
Definition LineIntersector.h:53
Supplies a set of utility methods for building Geometry objects from CoordinateSequence or other Geom...
Definition GeometryFactory.h:70
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition Geometry.h:197
Specifies the precision model of the Coordinate in a Geometry.
Definition PrecisionModel.h:88
A EdgeList is a list of Edges.
Definition EdgeList.h:55
Definition geomgraph/Edge.h:63
A Label indicates the topological relationship of a component of a topology graph to a given Geometry...
Definition Label.h:57
Represents a directed graph which is embeddable in a planar surface.
Definition geomgraph/PlanarGraph.h:72
Computes the intersections between two line segments in SegmentString and adds them to each string.
Definition IntersectionAdder.h:54
Computes all intersections between segments in a set of SegmentString.
Definition Noder.h:46
Builds the buffer geometry for a given input geometry and precision model.
Definition BufferBuilder.h:87
BufferBuilder(const BufferParameters &nBufParams)
Definition BufferBuilder.h:99
void setInvertOrientation(bool p_isInvertOrientation)
Definition BufferBuilder.h:152
void setNoder(noding::Noder *newNoder)
Definition BufferBuilder.h:138
void setWorkingPrecisionModel(const geom::PrecisionModel *pm)
Definition BufferBuilder.h:125
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:56
Forms Polygon out of a graph of geomgraph::DirectedEdge.
Definition overlay/PolygonBuilder.h:61
Basic namespace for all GEOS functionalities.
Definition geos.h:39