GEOS 3.4.2

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List

EdgeEnd.h
1 /**********************************************************************
2 *
3 * GEOS - Geometry Engine Open Source
4 * http://geos.osgeo.org
5 *
6 * Copyright (C) 2011 Sandro Santilli <strk@keybit.net>
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
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 const Label& newLabel);
76
83 EdgeEnd(Edge* newEdge, const geom::Coordinate& newP0,
84 const geom::Coordinate& newP1);
85
86 Edge* getEdge() { return edge; }
87 //virtual Edge* getEdge() { return edge; }
88
89 Label& getLabel() { return label; }
90
91 const Label& getLabel() const { return label; }
92
93 virtual geom::Coordinate& getCoordinate();
94
95 virtual geom::Coordinate& getDirectedCoordinate();
96
97 virtual int getQuadrant();
98
99 virtual double getDx();
100
101 virtual double getDy();
102
103 virtual void setNode(Node* newNode);
104
105 virtual Node* getNode();
106
107 virtual int compareTo(const EdgeEnd *e) const;
108
125 virtual int compareDirection(const EdgeEnd *e) const;
126
127 virtual void computeLabel(const algorithm::BoundaryNodeRule& bnr);
128
129 virtual std::string print();
130
131 protected:
132
133 Edge* edge;// the parent edge of this edge end
134
135 Label label;
136
137 EdgeEnd(Edge* newEdge);
138
139 virtual void init(const geom::Coordinate& newP0,
140 const geom::Coordinate& newP1);
141
142 private:
143
145 Node* node;
146
148 geom::Coordinate p0, p1;
149
151 double dx, dy;
152
153 int quadrant;
154 };
155
156 std::ostream& operator<< (std::ostream&, const EdgeEnd&);
157
158 struct GEOS_DLL EdgeEndLT {
159 bool operator()(const EdgeEnd *s1, const EdgeEnd *s2) const {
160 return s1->compareTo(s2)<0;
161 }
162 };
163
164 } // namespace geos.geomgraph
165 } // namespace geos
166
167 //#ifdef GEOS_INLINE
168 //# include "geos/geomgraph/EdgeEnd.inl"
169 //#endif
170
171 #endif // ifndef GEOS_GEOMGRAPH_EDGEEND_H