GEOS  3.9.1dev
EdgeEnd.h
Go to the documentation of this file.
1 /**********************************************************************
2  *
3  * GEOS - Geometry Engine Open Source
4  * http://geos.osgeo.org
5  *
6  * Copyright (C) 2011 Sandro Santilli <strk@kbt.io>
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 r428 (JTS-1.12+)
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/geomgraph/Label.h> // for composition
28 #include <geos/inline.h>
29 
30 #include <string>
31 
32 // Forward declarations
33 namespace geos {
34 namespace algorithm {
35 class BoundaryNodeRule;
36 }
37 namespace geomgraph {
38 class Edge;
39 class Node;
40 }
41 }
42 
43 namespace geos {
44 namespace geomgraph { // geos.geomgraph
45 
57 
58 public:
59 
60  friend std::ostream& operator<< (std::ostream&, const EdgeEnd&);
61 
62  EdgeEnd();
63 
64  virtual
65  ~EdgeEnd() {}
66 
74  EdgeEnd(Edge* newEdge, const geom::Coordinate& newP0,
75  const geom::Coordinate& newP1,
76  const Label& newLabel);
77 
84  EdgeEnd(Edge* newEdge, const geom::Coordinate& newP0,
85  const geom::Coordinate& newP1);
86 
87  Edge*
89  {
90  return edge;
91  }
92  //virtual Edge* getEdge() { return edge; }
93 
94  Label&
96  {
97  return label;
98  }
99 
100  const Label&
101  getLabel() const
102  {
103  return label;
104  }
105 
107  return p0;
108  }
109 
110  const geom::Coordinate&
112  {
113  return p0;
114  }
115 
116  virtual geom::Coordinate& getDirectedCoordinate();
117 
118  virtual int getQuadrant();
119 
120  virtual double getDx();
121 
122  virtual double getDy();
123 
124  virtual void setNode(Node* newNode);
125 
126  virtual Node* getNode();
127 
128  virtual int compareTo(const EdgeEnd* e) const;
129 
146  virtual int compareDirection(const EdgeEnd* e) const;
147 
148  virtual void computeLabel(const algorithm::BoundaryNodeRule& bnr);
149 
150  virtual std::string print() const;
151 
152 protected:
153 
154  Edge* edge;// the parent edge of this edge end
155 
157 
158  EdgeEnd(Edge* newEdge);
159 
160  virtual void init(const geom::Coordinate& newP0,
161  const geom::Coordinate& newP1);
162 
163 private:
164 
167 
170 
172  double dx, dy;
173 
174  int quadrant;
175 };
176 
177 std::ostream& operator<< (std::ostream&, const EdgeEnd&);
178 
180  bool
181  operator()(const EdgeEnd* s1, const EdgeEnd* s2) const
182  {
183  return s1->compareTo(s2) < 0;
184  }
185 };
186 
187 } // namespace geos.geomgraph
188 } // namespace geos
189 
190 //#ifdef GEOS_INLINE
191 //# include "geos/geomgraph/EdgeEnd.inl"
192 //#endif
193 
194 #endif // ifndef GEOS_GEOMGRAPH_EDGEEND_H
virtual geom::Coordinate & getCoordinate()
Definition: EdgeEnd.h:106
geom::Coordinate p1
Definition: EdgeEnd.h:169
#define GEOS_DLL
Definition: export.h:28
Coordinate is the lightweight class used to store coordinates.
Definition: Coordinate.h:60
virtual int compareTo(const EdgeEnd *e) const
Models the end of an edge incident on a node.
Definition: EdgeEnd.h:56
An interface for rules which determine whether node points which are in boundaries of lineal geometry...
A Label indicates the topological relationship of a component of a topology graph to a given Geometry...
Definition: Label.h:59
Node * node
the node this edge end originates at
Definition: EdgeEnd.h:166
Basic namespace for all GEOS functionalities.
The node component of a geometry graph.
const Label & getLabel() const
Definition: EdgeEnd.h:101
const geom::Coordinate & getCoordinate() const
Definition: EdgeEnd.h:111
bool operator()(const EdgeEnd *s1, const EdgeEnd *s2) const
Definition: EdgeEnd.h:181
std::ostream & operator<<(std::ostream &o, const HCoordinate &c)