GEOS 3.9.2
OffsetCurveSetBuilder.h
1/**********************************************************************
2 *
3 * GEOS - Geometry Engine Open Source
4 * http://geos.osgeo.org
5 *
6 * Copyright (C) 2011 Sandro Santilli <strk@kbt.io>
7 * Copyright (C) 2006 Refractions Research Inc.
8 *
9 * This is free software; you can redistribute and/or modify it under
10 * the terms of the GNU Lesser General Public Licence as published
11 * by the Free Software Foundation.
12 * See the COPYING file for more information.
13 *
14 **********************************************************************
15 *
16 * Last port: operation/buffer/OffsetCurveSetBuilder.java r378 (JTS-1.12)
17 *
18 **********************************************************************/
19
20#ifndef GEOS_OP_BUFFER_OFFSETCURVESETBUILDER_H
21#define GEOS_OP_BUFFER_OFFSETCURVESETBUILDER_H
22
23#include <geos/export.h>
24#include <geos/geom/Location.h>
25
26#include <vector>
27
28#ifdef _MSC_VER
29#pragma warning(push)
30#pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
31#endif
32
33// Forward declarations
34namespace geos {
35namespace geom {
36class Geometry;
37class CoordinateSequence;
38class GeometryCollection;
39class Point;
40class LineString;
41class LinearRing;
42class Polygon;
43}
44namespace geomgraph {
45class Label;
46}
47namespace noding {
48class SegmentString;
49}
50namespace operation {
51namespace buffer {
52class OffsetCurveBuilder;
53}
54}
55}
56
57namespace geos {
58namespace operation { // geos.operation
59namespace buffer { // geos.operation.buffer
60
71class GEOS_DLL OffsetCurveSetBuilder {
72
73private:
74
75 // To keep track of newly-created Labels.
76 // Labels will be relesed by object dtor
77 std::vector<geomgraph::Label*> newLabels;
78
79 const geom::Geometry& inputGeom;
80
81 double distance;
82
83 OffsetCurveBuilder& curveBuilder;
84
88 std::vector<noding::SegmentString*> curveList;
89
102 void addCurve(geom::CoordinateSequence* coord, geom::Location leftLoc,
103 geom::Location rightLoc);
104
105 void add(const geom::Geometry& g);
106
107 void addCollection(const geom::GeometryCollection* gc);
108
112 void addPoint(const geom::Point* p);
113
114 void addLineString(const geom::LineString* line);
115
116 void addPolygon(const geom::Polygon* p);
117
118 void addRingBothSides(const geom::CoordinateSequence* coord, double p_distance);
119
138 void addRingSide(const geom::CoordinateSequence* coord,
139 double offsetDistance, int side, geom::Location cwLeftLoc,
140 geom::Location cwRightLoc);
141
164 static bool isRingCurveInverted(
165 const geom::CoordinateSequence* inputPts, double dist,
166 const geom::CoordinateSequence* curvePts);
167
175 static double maxDistance(
176 const geom::CoordinateSequence* pts, const geom::CoordinateSequence* line);
177
187 bool isErodedCompletely(const geom::LinearRing* ringCoord,
188 double bufferDistance);
189
208 bool isTriangleErodedCompletely(const geom::CoordinateSequence* triCoords,
209 double bufferDistance);
210
211 // Declare type as noncopyable
212 OffsetCurveSetBuilder(const OffsetCurveSetBuilder& other) = delete;
213 OffsetCurveSetBuilder& operator=(const OffsetCurveSetBuilder& rhs) = delete;
214
215public:
216
219 double newDistance, OffsetCurveBuilder& newCurveBuilder);
220
223
232 std::vector<noding::SegmentString*>& getCurves();
233
241 void addCurves(const std::vector<geom::CoordinateSequence*>& lineList,
242 geom::Location leftLoc, geom::Location rightLoc);
243
244};
245
246} // namespace geos::operation::buffer
247} // namespace geos::operation
248} // namespace geos
249
250#ifdef _MSC_VER
251#pragma warning(pop)
252#endif
253
254#endif // ndef GEOS_OP_BUFFER_OFFSETCURVESETBUILDER_H
The internal representation of a list of coordinates inside a Geometry.
Definition: CoordinateSequence.h:58
Represents a collection of heterogeneous Geometry objects.
Definition: GeometryCollection.h:55
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition: Geometry.h:188
Definition: LineString.h:68
Models an OGC SFS LinearRing. A LinearRing is a LineString which is both closed and simple.
Definition: LinearRing.h:54
Definition: Point.h:66
Represents a linear polygon, which may include holes.
Definition: Polygon.h:64
Computes the raw offset curve for a single Geometry component (ring, line or point).
Definition: OffsetCurveBuilder.h:62
Creates all the raw offset curves for a buffer of a Geometry.
Definition: OffsetCurveSetBuilder.h:71
OffsetCurveSetBuilder(const geom::Geometry &newInputGeom, double newDistance, OffsetCurveBuilder &newCurveBuilder)
Constructor.
void addCurves(const std::vector< geom::CoordinateSequence * > &lineList, geom::Location leftLoc, geom::Location rightLoc)
Add raw curves for a set of CoordinateSequences.
std::vector< noding::SegmentString * > & getCurves()
Computes the set of raw offset curves for the buffer.
Location
Constants representing the location of a point relative to a geometry.
Definition: Location.h:34
Basic namespace for all GEOS functionalities.
Definition: IndexedNestedRingTester.h:26