GEOS  3.3.3
EdgeIntersectionList.h
1 /**********************************************************************
2  * $Id: EdgeIntersectionList.h 3340 2011-05-10 09:51:31Z 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/EdgeIntersectionList.java rev. 1.5 (JTS-1.10)
18  *
19  **********************************************************************/
20 
21 
22 #ifndef GEOS_GEOMGRAPH_EDGEINTERSECTIONLIST_H
23 #define GEOS_GEOMGRAPH_EDGEINTERSECTIONLIST_H
24 
25 #include <geos/export.h>
26 #include <vector>
27 #include <set>
28 #include <string>
29 
30 #include <geos/geomgraph/EdgeIntersection.h> // for EdgeIntersectionLessThen
31 #include <geos/geom/Coordinate.h> // for CoordinateLessThen
32 
33 #include <geos/inline.h>
34 
35 #ifdef _MSC_VER
36 #pragma warning(push)
37 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
38 #endif
39 
40 // Forward declarations
41 namespace geos {
42  namespace geom {
43  class Coordinate;
44  }
45  namespace geomgraph {
46  class Edge;
47  }
48 }
49 
50 namespace geos {
51 namespace geomgraph { // geos.geomgraph
52 
53 
59 class GEOS_DLL EdgeIntersectionList{
60 public:
61  typedef std::set<EdgeIntersection *, EdgeIntersectionLessThen> container;
62  typedef container::iterator iterator;
63  typedef container::const_iterator const_iterator;
64 
65 private:
66  container nodeMap;
67 
68 public:
69 
70  Edge *edge;
71  EdgeIntersectionList(Edge *edge);
73 
74  /*
75  * Adds an intersection into the list, if it isn't already there.
76  * The input segmentIndex and dist are expected to be normalized.
77  * @return the EdgeIntersection found or added
78  */
79  EdgeIntersection* add(const geom::Coordinate& coord,
80  int segmentIndex, double dist);
81 
82  iterator begin() { return nodeMap.begin(); }
83  iterator end() { return nodeMap.end(); }
84  const_iterator begin() const { return nodeMap.begin(); }
85  const_iterator end() const { return nodeMap.end(); }
86 
87  bool isEmpty() const;
88  bool isIntersection(const geom::Coordinate& pt) const;
89 
90  /*
91  * Adds entries for the first and last points of the edge to the list
92  */
93  void addEndpoints();
94 
103  void addSplitEdges(std::vector<Edge*> *edgeList);
104 
105  Edge *createSplitEdge(EdgeIntersection *ei0, EdgeIntersection *ei1);
106  std::string print() const;
107 
108 };
109 
110 std::ostream& operator<< (std::ostream&, const EdgeIntersectionList&);
111 
112 } // namespace geos.geomgraph
113 } // namespace geos
114 
115 #ifdef _MSC_VER
116 #pragma warning(pop)
117 #endif
118 
119 //#ifdef GEOS_INLINE
120 //# include "geos/geomgraph/EdgeIntersectionList.inl"
121 //#endif
122 
123 #endif // ifndef GEOS_GEOMGRAPH_EDGEINTERSECTIONLIST_H
124 
125 /**********************************************************************
126  * $Log$
127  * Revision 1.2 2006/03/24 09:52:41 strk
128  * USE_INLINE => GEOS_INLINE
129  *
130  * Revision 1.1 2006/03/09 16:46:49 strk
131  * geos::geom namespace definition, first pass at headers split
132  *
133  **********************************************************************/
134