GEOS  3.13.0dev
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 #pragma once
17 
18 #include <geos/export.h>
19 
20 #include <geos/planargraph/GraphComponent.h> // for inheritance
21 
22 #include <vector> // for typedefs
23 #include <set> // for typedefs
24 #include <iosfwd> // ostream
25 #include <cstdint>
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 planargraph {
35 class DirectedEdgeStar;
36 class DirectedEdge;
37 class Edge;
38 class Node;
39 }
40 }
41 
42 namespace geos {
43 namespace planargraph { // geos.planargraph
44 
54 class GEOS_DLL Edge: public GraphComponent {
55 
56 public:
57 
58  friend std::ostream& operator<< (std::ostream& os, const Node&);
59 
61  typedef std::set<const Edge*> ConstSet;
62 
64  typedef std::set<Edge*> NonConstSet;
65 
67  typedef std::vector<Edge*> NonConstVect;
68 
70  typedef std::vector<const Edge*> ConstVect;
71 
72 protected:
73 
75  std::vector<DirectedEdge*> dirEdge;
76 
77 public:
78 
85  Edge(): dirEdge() {}
86 
94  :
95  dirEdge()
96  {
97  setDirectedEdges(de0, de1);
98  }
99 
108 
114 
121 
127 };
128 
130 std::ostream& operator<<(std::ostream& os, const Edge& n);
131 
133 //typedef Edge planarEdge;
134 
135 } // namespace geos::planargraph
136 } // namespace geos
137 
138 #ifdef _MSC_VER
139 #pragma warning(pop)
140 #endif
141 
Represents a directed edge in a PlanarGraph.
Definition: planargraph/DirectedEdge.h:45
Represents an undirected edge of a PlanarGraph.
Definition: planargraph/Edge.h:54
std::vector< const Edge * > ConstVect
Vector of const Edges pointers.
Definition: planargraph/Edge.h:70
Edge()
Constructs a Edge whose DirectedEdges are not yet set.
Definition: planargraph/Edge.h:85
Edge(DirectedEdge *de0, DirectedEdge *de1)
Constructs an Edge initialized with the given DirectedEdges.
Definition: planargraph/Edge.h:93
std::set< const Edge * > ConstSet
Set of const Edges pointers.
Definition: planargraph/Edge.h:61
std::set< Edge * > NonConstSet
Set of non-const Edges pointers.
Definition: planargraph/Edge.h:64
DirectedEdge * getDirEdge(Node *fromNode)
Returns the DirectedEdge that starts from the given node, or null if the node is not one of the two n...
DirectedEdge * getDirEdge(int i)
Returns one of the DirectedEdges associated with this Edge.
Node * getOppositeNode(Node *node)
If node is one of the two nodes associated with this Edge, returns the other node; otherwise returns ...
std::vector< DirectedEdge * > dirEdge
The two DirectedEdges associated with this Edge.
Definition: planargraph/Edge.h:75
void setDirectedEdges(DirectedEdge *de0, DirectedEdge *de1)
Initializes this Edge's two DirectedEdges.
std::vector< Edge * > NonConstVect
Vector of non-const Edges pointers.
Definition: planargraph/Edge.h:67
The base class for all graph component classes.
Definition: planargraph/GraphComponent.h:45
A node in a PlanarGraph is a location where 0 or more Edge meet.
Definition: planargraph/Node.h:44
std::ostream & operator<<(std::ostream &, const DirectedEdge &)
Output operator.
Basic namespace for all GEOS functionalities.
Definition: Angle.h:25