GEOS 3.3.8

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

- File List

planargraph/Node.h
1 /**********************************************************************
2 * $Id: Node.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_NODE_H
18 #define GEOS_PLANARGRAPH_NODE_H
19
20 #include <geos/export.h>
21
22 #include <geos/planargraph/GraphComponent.h> // for inheritance
23 #include <geos/planargraph/DirectedEdgeStar.h> // for inlines
24 #include <geos/geom/Coordinate.h> // for composition
25
26 // Forward declarations
27 namespace geos {
28 namespace planargraph {
29 //class DirectedEdgeStar;
30 class DirectedEdge;
31 }
32 }
33
34 namespace geos {
35 namespace planargraph { // geos.planargraph
36
46 class GEOS_DLL Node: public GraphComponent {
47 protected:
48
50 geom::Coordinate pt;
51
53 DirectedEdgeStar *deStar;
54
55 public:
56
57 friend std::ostream& operator << (std::ostream& os, const Node&);
58
66 static std::vector<Edge*>* getEdgesBetween(Node *node0,
67 Node *node1);
68
70 Node(const geom::Coordinate& newPt)
71 :
72 pt(newPt)
73 { deStar=new DirectedEdgeStar(); }
74
75 virtual ~Node() {
76 delete deStar;
77 }
78
85 Node(geom::Coordinate& newPt, DirectedEdgeStar *newDeStar)
86 :
87 pt(newPt),
88 deStar(newDeStar)
89 {}
90
94 geom::Coordinate& getCoordinate() {
95 return pt;
96 }
97
101 void addOutEdge(DirectedEdge *de) {
102 deStar->add(de);
103 }
104
109 DirectedEdgeStar* getOutEdges() { return deStar; }
110 const DirectedEdgeStar* getOutEdges() const { return deStar; }
111
115 size_t getDegree() const {
116 return deStar->getDegree();
117 }
118
124 int getIndex(Edge *edge) {
125 return deStar->getIndex(edge);
126 }
127
128 };
129
131 std::ostream& operator<<(std::ostream& os, const Node& n);
132
133
135 //typedef Node planarNode;
136
137 } // namespace geos::planargraph
138 } // namespace geos
139
140 #endif // GEOS_PLANARGRAPH_NODE_H
141
142 /**********************************************************************
143 * $Log$
144 * Revision 1.3 2006/06/12 16:57:26 strk
145 * Added note about ownership of return from getEdgesBetween()
146 *
147 * Revision 1.2 2006/06/12 10:49:43 strk
148 * unsigned int => size_t
149 *
150 * Revision 1.1 2006/03/21 21:42:54 strk
151 * planargraph.h header split, planargraph:: classes renamed to match JTS symbols
152 *
153 **********************************************************************/
154