GEOS  3.3.3
planargraph/DirectedEdge.h
1 /**********************************************************************
2  * $Id: DirectedEdge.h 2556 2009-06-06 22:22:28Z strk $
3  *
4  * GEOS - Geometry Engine Open Source
5  * http://geos.refractions.net
6  *
7  * Copyright (C) 2001-2002 Vivid Solutions Inc.
8  * Copyright (C) 2005-2006 Refractions Research 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 #ifndef GEOS_PLANARGRAPH_DIRECTEDEDGE_H
18 #define GEOS_PLANARGRAPH_DIRECTEDEDGE_H
19 
20 #include <geos/export.h>
21 #include <geos/planargraph/GraphComponent.h> // for inheritance
22 #include <geos/geom/Coordinate.h> // for composition
23 
24 #include <vector> // for typedefs
25 #include <list> // for typedefs
26 
27 // Forward declarations
28 namespace geos {
29  namespace planargraph {
30  class Edge;
31  class Node;
32  }
33 }
34 
35 namespace geos {
36 namespace planargraph { // geos.planargraph
37 
47 class GEOS_DLL DirectedEdge: public GraphComponent {
48 
49 public:
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 
104  DirectedEdge(Node *newFrom, Node *newTo,
105  const geom::Coordinate &directionPt,
106  bool newEdgeDirection);
107 
112  Edge* getEdge() const;
113 
118  void setEdge(Edge* newParentEdge);
119 
124  int getQuadrant() const;
125 
130  const geom::Coordinate& getDirectionPt() const;
131 
136  bool getEdgeDirection() const;
137 
141  Node* getFromNode() const;
142 
146  Node* getToNode() const;
147 
152  geom::Coordinate& getCoordinate() const;
153 
159  double getAngle() const;
160 
166  DirectedEdge* getSym() const;
167 
173  void setSym(DirectedEdge *newSym);
174 
194  int compareTo(const DirectedEdge* obj) const;
195 
215  int compareDirection(const DirectedEdge *e) const;
216 
222  std::string print() const;
223 
224 };
225 
227 bool pdeLessThan(DirectedEdge *first, DirectedEdge * second);
228 
229 
230 
231 } // namespace geos::planargraph
232 } // namespace geos
233 
234 #endif // GEOS_PLANARGRAPH_DIRECTEDEDGE_H
235 
236 /**********************************************************************
237  * $Log$
238  * Revision 1.2 2006/06/12 15:46:08 strk
239  * provided a memory friendly version of toEdges() method.
240  *
241  * Revision 1.1 2006/03/21 21:42:54 strk
242  * planargraph.h header split, planargraph:: classes renamed to match JTS symbols
243  *
244  **********************************************************************/
245