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 
25 #include <vector>
26 
27 #ifdef _MSC_VER
28 #pragma warning(push)
29 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
30 #endif
31 
32 // Forward declarations
33 namespace geos {
34 namespace geom {
35 class Geometry;
36 class CoordinateSequence;
37 class GeometryCollection;
38 class Point;
39 class LineString;
40 class LinearRing;
41 class Polygon;
42 }
43 namespace geomgraph {
44 class Label;
45 }
46 namespace noding {
47 class SegmentString;
48 }
49 namespace operation {
50 namespace buffer {
51 class OffsetCurveBuilder;
52 }
53 }
54 }
55 
56 namespace geos {
57 namespace operation { // geos.operation
58 namespace buffer { // geos.operation.buffer
59 
70 class GEOS_DLL OffsetCurveSetBuilder {
71 
72 private:
73 
74  // To keep track of newly-created Labels.
75  // Labels will be relesed by object dtor
76  std::vector<geomgraph::Label*> newLabels;
77 
78  const geom::Geometry& inputGeom;
79 
80  double distance;
81 
82  OffsetCurveBuilder& curveBuilder;
83 
87  std::vector<noding::SegmentString*> curveList;
88 
101  void addCurve(geom::CoordinateSequence* coord, int leftLoc,
102  int rightLoc);
103 
104  void add(const geom::Geometry& g);
105 
106  void addCollection(const geom::GeometryCollection* gc);
107 
111  void addPoint(const geom::Point* p);
112 
113  void addLineString(const geom::LineString* line);
114 
115  void addPolygon(const geom::Polygon* p);
116 
135  void addPolygonRing(const geom::CoordinateSequence* coord,
136  double offsetDistance, int side, int cwLeftLoc,
137  int cwRightLoc);
138 
148  bool isErodedCompletely(const geom::LinearRing* ringCoord,
149  double bufferDistance);
150 
169  bool isTriangleErodedCompletely(const geom::CoordinateSequence* triCoords,
170  double bufferDistance);
171 
172  // Declare type as noncopyable
173  OffsetCurveSetBuilder(const OffsetCurveSetBuilder& other) = delete;
174  OffsetCurveSetBuilder& operator=(const OffsetCurveSetBuilder& rhs) = delete;
175 
176 public:
177 
179  OffsetCurveSetBuilder(const geom::Geometry& newInputGeom,
180  double newDistance, OffsetCurveBuilder& newCurveBuilder);
181 
184 
194  std::vector<noding::SegmentString*>& getCurves();
195 
197  //
201  void addCurves(const std::vector<geom::CoordinateSequence*>& lineList,
202  int leftLoc, int rightLoc);
203 
204 };
205 
206 } // namespace geos::operation::buffer
207 } // namespace geos::operation
208 } // namespace geos
209 
210 #ifdef _MSC_VER
211 #pragma warning(pop)
212 #endif
213 
214 #endif // ndef GEOS_OP_BUFFER_OFFSETCURVESETBUILDER_H
215 
Creates all the raw offset curves for a buffer of a Geometry.
Definition: OffsetCurveSetBuilder.h:70
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition: Geometry.h:187
Definition: LineString.h:69
Represents a linear polygon, which may include holes.
Definition: Polygon.h:65
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.
Definition: LinearRing.h:56
The internal representation of a list of coordinates inside a Geometry.
Definition: CoordinateSequence.h:58
Definition: Point.h:66