GEOS  3.8.0dev
planargraph/DirectedEdge.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_DIRECTEDEDGE_H
17 #define GEOS_PLANARGRAPH_DIRECTEDEDGE_H
18 
19 #include <geos/export.h>
20 #include <geos/planargraph/GraphComponent.h> // for inheritance
21 #include <geos/geom/Coordinate.h> // for composition
22 
23 #include <vector> // for typedefs
24 #include <list> // for typedefs
25 
26 // Forward declarations
27 namespace geos {
28 namespace planargraph {
29 class Edge;
30 class Node;
31 }
32 }
33 
34 namespace geos {
35 namespace planargraph { // geos.planargraph
36 
46 class GEOS_DLL DirectedEdge: public GraphComponent {
47 
48 public:
49 
50  friend std::ostream& operator << (std::ostream&, const DirectedEdge&);
51 
52  typedef std::list<DirectedEdge*> NonConstList;
53  typedef std::list<const DirectedEdge*> ConstList;
54  typedef std::vector<DirectedEdge*> NonConstVect;
55 
56 protected:
57  Edge* parentEdge;
58  Node* from;
59  Node* to;
60  geom::Coordinate p0, p1;
61  DirectedEdge* sym; // optional
62  bool edgeDirection;
63  int quadrant;
64  double angle;
65 public:
66 
67  typedef std::vector<const DirectedEdge*> ConstVect;
68  typedef std::vector<DirectedEdge*> Vect;
69 
79  static std::vector<Edge*>* toEdges(
80  std::vector<DirectedEdge*>& dirEdges);
81 
90  static void toEdges(std::vector<DirectedEdge*>& dirEdges,
91  std::vector<Edge*>& parentEdges);
92 
105  DirectedEdge(Node* newFrom, Node* newTo,
106  const geom::Coordinate& directionPt,
107  bool newEdgeDirection);
108 
113  Edge* getEdge() const;
114 
119  void setEdge(Edge* newParentEdge);
120 
125  int getQuadrant() const;
126 
131  const geom::Coordinate& getDirectionPt() const;
132 
137  bool getEdgeDirection() const;
138 
142  Node* getFromNode() const;
143 
147  Node* getToNode() const;
148 
153  geom::Coordinate& getCoordinate() const;
154 
160  double getAngle() const;
161 
167  DirectedEdge* getSym() const;
168 
174  void setSym(DirectedEdge* newSym);
175 
195  int compareTo(const DirectedEdge* obj) const;
196 
216  int compareDirection(const DirectedEdge* e) const;
217 
223  std::string print() const;
224 
225 };
226 
228 bool pdeLessThan(DirectedEdge* first, DirectedEdge* second);
229 
231 std::ostream& operator << (std::ostream&, const DirectedEdge&);
232 
233 
234 } // namespace geos::planargraph
235 } // namespace geos
236 
237 #endif // GEOS_PLANARGRAPH_DIRECTEDEDGE_H
bool pdeLessThan(DirectedEdge *first, DirectedEdge *second)
Strict Weak comparator function for containers.
Coordinate is the lightweight class used to store coordinates.
Definition: Coordinate.h:60
Represents a directed edge in a PlanarGraph.
Definition: planargraph/DirectedEdge.h:46
Basic namespace for all GEOS functionalities.
Definition: IndexedNestedRingTester.h:25
Represents an undirected edge of a PlanarGraph.
Definition: planargraph/Edge.h:54
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.