GEOS  3.3.3
OffsetCurveSetBuilder.h
1 /**********************************************************************
2  * $Id: OffsetCurveSetBuilder.h 3306 2011-04-27 14:13:45Z strk $
3  *
4  * GEOS - Geometry Engine Open Source
5  * http://geos.refractions.net
6  *
7  * Copyright (C) 2011 Sandro Santilli <strk@keybit.net>
8  * Copyright (C) 2006 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/OffsetCurveSetBuilder.java r378 (JTS-1.12)
18  *
19  **********************************************************************/
20 
21 #ifndef GEOS_OP_BUFFER_OFFSETCURVESETBUILDER_H
22 #define GEOS_OP_BUFFER_OFFSETCURVESETBUILDER_H
23 
24 #include <geos/export.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, int leftLoc,
103  int 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, int cwLeftLoc,
138  int 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
175  OffsetCurveSetBuilder& operator=(const OffsetCurveSetBuilder& rhs);
176 
177 public:
178 
180  OffsetCurveSetBuilder(const geom::Geometry& newInputGeom,
181  double newDistance, OffsetCurveBuilder& newCurveBuilder);
182 
185 
195  std::vector<noding::SegmentString*>& getCurves();
196 
198  //
202  void addCurves(const std::vector<geom::CoordinateSequence*>& lineList,
203  int leftLoc, int rightLoc);
204 
205 };
206 
207 } // namespace geos::operation::buffer
208 } // namespace geos::operation
209 } // namespace geos
210 
211 #ifdef _MSC_VER
212 #pragma warning(pop)
213 #endif
214 
215 #endif // ndef GEOS_OP_BUFFER_OFFSETCURVESETBUILDER_H
216 
217 /**********************************************************************
218  * $Log$
219  * Revision 1.2 2006/05/04 10:15:20 strk
220  * Doxygen comments
221  *
222  * Revision 1.1 2006/03/14 00:19:40 strk
223  * opBuffer.h split, streamlined headers in some (not all) files in operation/buffer/
224  *
225  **********************************************************************/
226