GEOS  3.8.0dev
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
34 namespace geos {
35 namespace geom {
36 class Geometry;
37 class CoordinateSequence;
38 class GeometryCollection;
39 class Point;
40 class LineString;
41 class LinearRing;
42 class Polygon;
43 }
44 namespace geomgraph {
45 class Label;
46 }
47 namespace noding {
48 class SegmentString;
49 }
50 namespace operation {
51 namespace buffer {
52 class OffsetCurveBuilder;
53 }
54 }
55 }
56 
57 namespace geos {
58 namespace operation { // geos.operation
59 namespace buffer { // geos.operation.buffer
60 
71 class GEOS_DLL OffsetCurveSetBuilder {
72 
73 private:
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 
136  void addPolygonRing(const geom::CoordinateSequence* coord,
137  double offsetDistance, int side, geom::Location cwLeftLoc,
138  geom::Location cwRightLoc);
139 
149  bool isErodedCompletely(const geom::LinearRing* ringCoord,
150  double bufferDistance);
151 
170  bool isTriangleErodedCompletely(const geom::CoordinateSequence* triCoords,
171  double bufferDistance);
172 
173  // Declare type as noncopyable
174  OffsetCurveSetBuilder(const OffsetCurveSetBuilder& other) = delete;
175  OffsetCurveSetBuilder& operator=(const OffsetCurveSetBuilder& rhs) = delete;
176 
177 public:
178 
180  OffsetCurveSetBuilder(const geom::Geometry& newInputGeom,
181  double newDistance, OffsetCurveBuilder& newCurveBuilder);
182 
185 
194  std::vector<noding::SegmentString*>& getCurves();
195 
203  void addCurves(const std::vector<geom::CoordinateSequence*>& lineList,
204  geom::Location leftLoc, geom::Location rightLoc);
205 
206 };
207 
208 } // namespace geos::operation::buffer
209 } // namespace geos::operation
210 } // namespace geos
211 
212 #ifdef _MSC_VER
213 #pragma warning(pop)
214 #endif
215 
216 #endif // ndef GEOS_OP_BUFFER_OFFSETCURVESETBUILDER_H
217 
Creates all the raw offset curves for a buffer of a Geometry.
Definition: OffsetCurveSetBuilder.h:71
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition: Geometry.h:188
Definition: LineString.h:68
Represents a linear polygon, which may include holes.
Definition: Polygon.h:64
Location
Constants representing the location of a point relative to a geometry.
Definition: Location.h:33
Computes the raw offset curve for a single Geometry component (ring, line or point).
Definition: OffsetCurveBuilder.h:62
Represents a collection of heterogeneous Geometry objects.
Definition: GeometryCollection.h:55
Basic namespace for all GEOS functionalities.
Definition: IndexedNestedRingTester.h:25
Models an OGC SFS LinearRing. A LinearRing is a LineString which is both closed and simple...
Definition: LinearRing.h:54
The internal representation of a list of coordinates inside a Geometry.
Definition: CoordinateSequence.h:58
Definition: Point.h:65