GEOS  3.3.3
EdgeEnd.h
1 /**********************************************************************
2  * $Id: EdgeEnd.h 2557 2009-06-08 09:30:55Z strk $
3  *
4  * GEOS - Geometry Engine Open Source
5  * http://geos.refractions.net
6  *
7  * Copyright (C) 2005-2006 Refractions Research Inc.
8  * Copyright (C) 2001-2002 Vivid Solutions 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  * Last port: geomgraph/EdgeEnd.java rev. 1.6 (JTS-1.10)
18  *
19  **********************************************************************/
20 
21 
22 #ifndef GEOS_GEOMGRAPH_EDGEEND_H
23 #define GEOS_GEOMGRAPH_EDGEEND_H
24 
25 #include <geos/export.h>
26 #include <geos/geom/Coordinate.h> // for p0,p1
27 #include <geos/inline.h>
28 
29 #include <string>
30 
31 // Forward declarations
32 namespace geos {
33  namespace algorithm {
34  class BoundaryNodeRule;
35  }
36  namespace geomgraph {
37  class Label;
38  class Edge;
39  class Node;
40  }
41 }
42 
43 namespace geos {
44 namespace geomgraph { // geos.geomgraph
45 
56 class GEOS_DLL EdgeEnd {
57 
58 public:
59 
60  friend std::ostream& operator<< (std::ostream&, const EdgeEnd&);
61 
62  EdgeEnd();
63 
64  virtual ~EdgeEnd();
65 
73  EdgeEnd(Edge* newEdge, const geom::Coordinate& newP0,
74  const geom::Coordinate& newP1,
75  Label* newLabel=NULL);
76 
77  Edge* getEdge() { return edge; }
78  //virtual Edge* getEdge() { return edge; }
79 
80  virtual Label* getLabel();
81 
82  virtual geom::Coordinate& getCoordinate();
83 
84  virtual geom::Coordinate& getDirectedCoordinate();
85 
86  virtual int getQuadrant();
87 
88  virtual double getDx();
89 
90  virtual double getDy();
91 
92  virtual void setNode(Node* newNode);
93 
94  virtual Node* getNode();
95 
96  virtual int compareTo(const EdgeEnd *e) const;
97 
114  virtual int compareDirection(const EdgeEnd *e) const;
115 
116  virtual void computeLabel(const algorithm::BoundaryNodeRule& bnr);
117 
118  virtual std::string print();
119 
120 protected:
121 
122  Edge* edge;// the parent edge of this edge end
123 
124  Label* label;
125 
126  EdgeEnd(Edge* newEdge);
127 
128  virtual void init(const geom::Coordinate& newP0,
129  const geom::Coordinate& newP1);
130 
131 private:
132 
134  Node* node;
135 
137  geom::Coordinate p0, p1;
138 
140  double dx, dy;
141 
142  int quadrant;
143 };
144 
145 std::ostream& operator<< (std::ostream&, const EdgeEnd&);
146 
147 struct GEOS_DLL EdgeEndLT {
148  bool operator()(const EdgeEnd *s1, const EdgeEnd *s2) const {
149  return s1->compareTo(s2)<0;
150  }
151 };
152 
153 } // namespace geos.geomgraph
154 } // namespace geos
155 
156 //#ifdef GEOS_INLINE
157 //# include "geos/geomgraph/EdgeEnd.inl"
158 //#endif
159 
160 #endif // ifndef GEOS_GEOMGRAPH_EDGEEND_H
161 
162 /**********************************************************************
163  * $Log$
164  * Revision 1.6 2006/06/14 14:32:20 strk
165  * EdgeEnd::getEdge() made non-virtual and inlined.
166  *
167  * Revision 1.5 2006/04/06 09:39:56 strk
168  * Added operator<<
169  *
170  * Revision 1.4 2006/04/03 17:05:22 strk
171  * Assertion checking, port info, cleanups
172  *
173  * Revision 1.3 2006/03/24 09:52:41 strk
174  * USE_INLINE => GEOS_INLINE
175  *
176  * Revision 1.2 2006/03/15 15:27:24 strk
177  * cleanups
178  *
179  * Revision 1.1 2006/03/09 16:46:49 strk
180  * geos::geom namespace definition, first pass at headers split
181  *
182  **********************************************************************/
183