GEOS  3.11.1
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 #pragma once
17 
18 #include <geos/export.h>
19 #include <geos/planargraph/GraphComponent.h> // for inheritance
20 #include <geos/geom/Coordinate.h> // for composition
21 
22 #include <vector> // for typedefs
23 #include <list> // for typedefs
24 
25 // Forward declarations
26 namespace geos {
27 namespace planargraph {
28 class Edge;
29 class Node;
30 }
31 }
32 
33 namespace geos {
34 namespace planargraph { // geos.planargraph
35 
45 class GEOS_DLL DirectedEdge: public GraphComponent {
46 
47 public:
48 
49  friend std::ostream& operator << (std::ostream&, const DirectedEdge&);
50 
51  typedef std::list<DirectedEdge*> NonConstList;
52  typedef std::list<const DirectedEdge*> ConstList;
53  typedef std::vector<DirectedEdge*> NonConstVect;
54 
55 protected:
56  Edge* parentEdge;
57  Node* from;
58  Node* to;
59  geom::Coordinate p0, p1;
60  DirectedEdge* sym; // optional
61  bool edgeDirection;
62  int quadrant;
63  double angle;
64 public:
65 
66  typedef std::vector<const DirectedEdge*> ConstVect;
67  typedef std::vector<DirectedEdge*> Vect;
68 
78  static std::vector<Edge*>* toEdges(
79  std::vector<DirectedEdge*>& dirEdges);
80 
89  static void toEdges(std::vector<DirectedEdge*>& dirEdges,
90  std::vector<Edge*>& parentEdges);
91 
106  DirectedEdge(Node* newFrom, Node* newTo,
107  const geom::Coordinate& directionPt,
108  bool newEdgeDirection);
109 
114  Edge* getEdge() const;
115 
120  void setEdge(Edge* newParentEdge);
121 
126  int getQuadrant() const;
127 
132  const geom::Coordinate& getDirectionPt() const;
133 
138  bool getEdgeDirection() const;
139 
143  Node* getFromNode() const;
144 
148  Node* getToNode() const;
149 
154  geom::Coordinate& getCoordinate() const;
155 
161  double getAngle() const;
162 
168  DirectedEdge* getSym() const;
169 
175  void setSym(DirectedEdge* newSym);
176 
196  int compareTo(const DirectedEdge* obj) const;
197 
217  int compareDirection(const DirectedEdge* e) const;
218 
224  std::string print() const;
225 
226 };
227 
229 bool pdeLessThan(DirectedEdge* first, DirectedEdge* second);
230 
232 std::ostream& operator << (std::ostream&, const DirectedEdge&);
233 
234 
235 } // namespace geos::planargraph
236 } // namespace geos
237 
bool pdeLessThan(DirectedEdge *first, DirectedEdge *second)
Strict Weak comparator function for containers.
Coordinate is the lightweight class used to store coordinates.
Definition: Coordinate.h:58
Represents a directed edge in a PlanarGraph.
Definition: planargraph/DirectedEdge.h:45
Basic namespace for all GEOS functionalities.
Definition: Angle.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: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.