GEOS  3.10.1
planargraph/Edge.h
1 /**********************************************************************
2  *
3  * GEOS - Geometry Engine Open Source
4  * http://geos.osgeo.org
5  *
6  * Copyright (C) 2001-2002 Vivid Solutions Inc.
7  * Copyright (C) 2005-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 #ifndef GEOS_PLANARGRAPH_EDGE_H
17 #define GEOS_PLANARGRAPH_EDGE_H
18 
19 #include <geos/export.h>
20 
21 #include <geos/planargraph/GraphComponent.h> // for inheritance
22 
23 #include <vector> // for typedefs
24 #include <set> // for typedefs
25 #include <iosfwd> // ostream
26 #include <cstdint>
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 planargraph {
36 class DirectedEdgeStar;
37 class DirectedEdge;
38 class Edge;
39 class Node;
40 }
41 }
42 
43 namespace geos {
44 namespace planargraph { // geos.planargraph
45 
55 class GEOS_DLL Edge: public GraphComponent {
56 
57 public:
58 
59  friend std::ostream& operator<< (std::ostream& os, const Node&);
60 
62  typedef std::set<const Edge*> ConstSet;
63 
65  typedef std::set<Edge*> NonConstSet;
66 
68  typedef std::vector<Edge*> NonConstVect;
69 
71  typedef std::vector<const Edge*> ConstVect;
72 
73 protected:
74 
76  std::vector<DirectedEdge*> dirEdge;
77 
78 public:
79 
86  Edge(): dirEdge() {}
87 
95  :
96  dirEdge()
97  {
98  setDirectedEdges(de0, de1);
99  }
100 
108  void setDirectedEdges(DirectedEdge* de0, DirectedEdge* de1);
109 
114  DirectedEdge* getDirEdge(int i);
115 
121  DirectedEdge* getDirEdge(Node* fromNode);
122 
127  Node* getOppositeNode(Node* node);
128 };
129 
131 std::ostream& operator<<(std::ostream& os, const Edge& n);
132 
134 //typedef Edge planarEdge;
135 
136 } // namespace geos::planargraph
137 } // namespace geos
138 
139 #ifdef _MSC_VER
140 #pragma warning(pop)
141 #endif
142 
143 #endif // GEOS_PLANARGRAPH_EDGE_H
Represents a directed edge in a PlanarGraph.
Definition: planargraph/DirectedEdge.h:46
std::set< const Edge * > ConstSet
Set of const Edges pointers.
Definition: planargraph/Edge.h:62
std::vector< const Edge * > ConstVect
Vector of const Edges pointers.
Definition: planargraph/Edge.h:71
std::set< Edge * > NonConstSet
Set of non-const Edges pointers.
Definition: planargraph/Edge.h:65
Edge(DirectedEdge *de0, DirectedEdge *de1)
Constructs an Edge initialized with the given DirectedEdges.
Definition: planargraph/Edge.h:94
std::vector< DirectedEdge * > dirEdge
The two DirectedEdges associated with this Edge.
Definition: planargraph/Edge.h:76
Edge()
Constructs a Edge whose DirectedEdges are not yet set.
Definition: planargraph/Edge.h:86
Basic namespace for all GEOS functionalities.
Definition: Angle.h:26
Represents an undirected edge of a PlanarGraph.
Definition: planargraph/Edge.h:55
The base class for all graph component classes.
Definition: planargraph/GraphComponent.h:46
A node in a PlanarGraph is a location where 0 or more Edge meet.
Definition: planargraph/Node.h:45
std::ostream & operator<<(std::ostream &, const DirectedEdge &)
Output operator.
std::vector< Edge * > NonConstVect
Vector of non-const Edges pointers.
Definition: planargraph/Edge.h:68