GEOS 3.3.4

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List

GeometryGraph.h
1 /**********************************************************************
2 * $Id: GeometryGraph.h 3329 2011-05-06 18:51:19Z strk $
3 *
4 * GEOS - Geometry Engine Open Source
5 * http://geos.refractions.net
6 *
7 * Copyright (C) 2005-2006 Refractions Research Inc.
8 * Copyright (C) 2001-2002 Vivid Solutions 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: geomgraph/GeometryGraph.java rev. 1.9 (JTS-1.10)
18 *
19 **********************************************************************/
20
21
22 #ifndef GEOS_GEOMGRAPH_GEOMETRYGRAPH_H
23 #define GEOS_GEOMGRAPH_GEOMETRYGRAPH_H
24
25 #include <geos/export.h>
26 #include <map>
27 #include <vector>
28 #include <memory>
29
30 #include <geos/geom/Coordinate.h>
31 #include <geos/geom/CoordinateSequence.h> // for auto_ptr<CoordinateSequence>
32 #include <geos/geomgraph/PlanarGraph.h>
33 #include <geos/geom/LineString.h> // for LineStringLT
34
35 #include <geos/inline.h>
36
37 #ifdef _MSC_VER
38 #pragma warning(push)
39 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
40 #endif
41
42 // Forward declarations
43 namespace geos {
44 namespace geom {
45 class LineString;
46 class LinearRing;
47 class Polygon;
48 class Geometry;
49 class GeometryCollection;
50 class Point;
51 }
52 namespace algorithm {
53 class LineIntersector;
54 class BoundaryNodeRule;
55 }
56 namespace geomgraph {
57 class Edge;
58 class Node;
59 namespace index {
60 class SegmentIntersector;
61 class EdgeSetIntersector;
62 }
63 }
64 }
65
66 namespace geos {
67 namespace geomgraph { // geos.geomgraph
68
69 class GEOS_DLL GeometryGraph: public PlanarGraph
70 {
71 using PlanarGraph::add;
72 using PlanarGraph::findEdge;
73
74 private:
75
76 const geom::Geometry* parentGeom;
77
86 //std::map<const geom::LineString*,Edge*,geom::LineStringLT> lineEdgeMap;
87 std::map<const geom::LineString*, Edge*> lineEdgeMap;
88
93 bool useBoundaryDeterminationRule;
94
95 const algorithm::BoundaryNodeRule& boundaryNodeRule;
96
101 int argIndex;
102
104 std::auto_ptr< geom::CoordinateSequence > boundaryPoints;
105
106 std::auto_ptr< std::vector<Node*> > boundaryNodes;
107
108 bool hasTooFewPointsVar;
109
110 geom::Coordinate invalidPoint;
111
113 index::EdgeSetIntersector* createEdgeSetIntersector();
114
115 void add(const geom::Geometry *g);
116 // throw(UnsupportedOperationException);
117
118 void addCollection(const geom::GeometryCollection *gc);
119
120 void addPoint(const geom::Point *p);
121
122 void addPolygonRing(const geom::LinearRing *lr,
123 int cwLeft, int cwRight);
124
125 void addPolygon(const geom::Polygon *p);
126
127 void addLineString(const geom::LineString *line);
128
129 void insertPoint(int argIndex, const geom::Coordinate& coord,
130 int onLocation);
131
139 void insertBoundaryPoint(int argIndex, const geom::Coordinate& coord);
140
141 void addSelfIntersectionNodes(int argIndex);
142
150 void addSelfIntersectionNode(int argIndex,
151 const geom::Coordinate& coord, int loc);
152
153 // Declare type as noncopyable
154 GeometryGraph(const GeometryGraph& other);
155 GeometryGraph& operator=(const GeometryGraph& rhs);
156
157 public:
158
159 static bool isInBoundary(int boundaryCount);
160
161 static int determineBoundary(int boundaryCount);
162
163 static int determineBoundary(
164 const algorithm::BoundaryNodeRule& boundaryNodeRule,
165 int boundaryCount);
166
167 GeometryGraph();
168
169 GeometryGraph(int newArgIndex, const geom::Geometry *newParentGeom);
170
171 GeometryGraph(int newArgIndex, const geom::Geometry *newParentGeom,
172 const algorithm::BoundaryNodeRule& boundaryNodeRule);
173
174 virtual ~GeometryGraph();
175
176
177 const geom::Geometry* getGeometry();
178
180 std::vector<Node*>* getBoundaryNodes();
181
182 void getBoundaryNodes(std::vector<Node*>&bdyNodes);
183
185 geom::CoordinateSequence* getBoundaryPoints();
186
187 Edge* findEdge(const geom::LineString *line);
188
189 void computeSplitEdges(std::vector<Edge*> *edgelist);
190
191 void addEdge(Edge *e);
192
193 void addPoint(geom::Coordinate& pt);
194
210 index::SegmentIntersector* computeSelfNodes(
211 algorithm::LineIntersector *li,
212 bool computeRingSelfNodes);
213
214 // Quick inline calling the function above, the above should probably
215 // be deprecated.
216 index::SegmentIntersector* computeSelfNodes(
217 algorithm::LineIntersector& li,
218 bool computeRingSelfNodes);
219
220 index::SegmentIntersector* computeEdgeIntersections(GeometryGraph *g,
221 algorithm::LineIntersector *li, bool includeProper);
222
223 std::vector<Edge*> *getEdges();
224
225 bool hasTooFewPoints();
226
227 const geom::Coordinate& getInvalidPoint();
228
229 const algorithm::BoundaryNodeRule& getBoundaryNodeRule() const
230 { return boundaryNodeRule; }
231
232 };
233
234
235 } // namespace geos.geomgraph
236 } // namespace geos
237
238 #ifdef _MSC_VER
239 #pragma warning(pop)
240 #endif
241
242 #ifdef GEOS_INLINE
243 # include "geos/geomgraph/GeometryGraph.inl"
244 #endif
245
246 #endif // ifndef GEOS_GEOMGRAPH_GEOMETRYGRAPH_H
247
248 /**********************************************************************
249 * $Log$
250 * Revision 1.4 2006/06/13 22:00:26 strk
251 * Changed GeometryGraph::lineEdgeMap set comparison function to be pointer-based. Should be safe and much faster. Available tests all succeed.
252 *
253 * Revision 1.3 2006/03/29 15:23:49 strk
254 * Moved GeometryGraph inlines from .h to .inl file
255 *
256 * Revision 1.2 2006/03/24 09:52:41 strk
257 * USE_INLINE => GEOS_INLINE
258 *
259 * Revision 1.1 2006/03/09 16:46:49 strk
260 * geos::geom namespace definition, first pass at headers split
261 *
262 **********************************************************************/
263