GEOS: Node.h Source File

GEOS 3.5.0

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

- File List

planargraph/Node.h
1 /**********************************************************************
2 *
3 * GEOS - Geometry Engine Open Source
4 * http://geos.osgeo.org
5 *
6 * Copyright (C) 2001-2002 Vivid Solutions Inc.
7 * Copyright (C) 2005-2006 Refractions Research Inc.
8 *
9 * This is free software; you can redistribute and/or modify it under
10 * the terms of the GNU Lesser General Public Licence as published
11 * by the Free Software Foundation.
12 * See the COPYING file for more information.
13 *
14 **********************************************************************/
15
16 #ifndef GEOS_PLANARGRAPH_NODE_H
17 #define GEOS_PLANARGRAPH_NODE_H
18
19 #include <geos/export.h>
20
21 #include <geos/planargraph/GraphComponent.h> // for inheritance
22 #include <geos/planargraph/DirectedEdgeStar.h> // for inlines
23 #include <geos/geom/Coordinate.h> // for composition
24
25 // Forward declarations
26 namespace geos {
27 namespace planargraph {
28 //class DirectedEdgeStar;
29 class DirectedEdge;
30 }
31 }
32
33 namespace geos {
34 namespace planargraph { // geos.planargraph
35
45 class GEOS_DLL Node: public GraphComponent {
46 protected:
47
49 geom::Coordinate pt;
50
52 DirectedEdgeStar *deStar;
53
54 public:
55
56 friend std::ostream& operator << (std::ostream& os, const Node&);
57
65 static std::vector<Edge*>* getEdgesBetween(Node *node0,
66 Node *node1);
67
69 Node(const geom::Coordinate& newPt)
70 :
71 pt(newPt)
72 { deStar=new DirectedEdgeStar(); }
73
74 virtual ~Node() {
75 delete deStar;
76 }
77
84 Node(geom::Coordinate& newPt, DirectedEdgeStar *newDeStar)
85 :
86 pt(newPt),
87 deStar(newDeStar)
88 {}
89
93 geom::Coordinate& getCoordinate() {
94 return pt;
95 }
96
100 void addOutEdge(DirectedEdge *de) {
101 deStar->add(de);
102 }
103
108 DirectedEdgeStar* getOutEdges() { return deStar; }
109 const DirectedEdgeStar* getOutEdges() const { return deStar; }
110
114 size_t getDegree() const {
115 return deStar->getDegree();
116 }
117
123 int getIndex(Edge *edge) {
124 return deStar->getIndex(edge);
125 }
126
127 };
128
130 std::ostream& operator<<(std::ostream& os, const Node& n);
131
132
134 //typedef Node planarNode;
135
136 } // namespace geos::planargraph
137 } // namespace geos
138
139 #endif // GEOS_PLANARGRAPH_NODE_H
geos::planargraph::Node::getCoordinate
geom::Coordinate & getCoordinate()
Returns the location of this Node.
Definition: planargraph/Node.h:93
geos::planargraph::Node::getIndex
int getIndex(Edge *edge)
Returns the zero-based index of the given Edge, after sorting in ascending order by angle with the po...
Definition: planargraph/Node.h:123
geos::planargraph::Node::deStar
DirectedEdgeStar * deStar
The collection of DirectedEdges that leave this Node.
Definition: planargraph/Node.h:52
geos::planargraph::DirectedEdgeStar
A sorted collection of DirectedEdge which leave a Node in a PlanarGraph.
Definition: planargraph/DirectedEdgeStar.h:43
geos::planargraph::Node::Node
Node(const geom::Coordinate &newPt)
Constructs a Node with the given location.
Definition: planargraph/Node.h:69
geos::planargraph::DirectedEdgeStar::getIndex
int getIndex(const Edge *edge)
Returns the zero-based index of the given Edge, after sorting in ascending order by angle with the po...
geos::geom::Coordinate
Coordinate is the lightweight class used to store coordinates.
Definition: Coordinate.h:60
geos::planargraph::DirectedEdge
Represents a directed edge in a PlanarGraph.
Definition: planargraph/DirectedEdge.h:46
geos::planargraph::Node::getDegree
size_t getDegree() const
Returns the number of edges around this Node.
Definition: planargraph/Node.h:114
geos::planargraph::Node::Node
Node(geom::Coordinate &newPt, DirectedEdgeStar *newDeStar)
Constructs a Node with the given location and collection of outgoing DirectedEdges. Takes ownership of the given DirectedEdgeStar!!
Definition: planargraph/Node.h:84
geos::planargraph::Node::getOutEdges
DirectedEdgeStar * getOutEdges()
Returns the collection of DirectedEdges that leave this Node.
Definition: planargraph/Node.h:108
geos::planargraph::DirectedEdgeStar::getDegree
std::size_t getDegree() const
Returns the number of edges around the Node associated with this DirectedEdgeStar.
Definition: planargraph/DirectedEdgeStar.h:93
geos::planargraph::DirectedEdgeStar::add
void add(DirectedEdge *de)
Adds a new member to this DirectedEdgeStar.
geos
Basic namespace for all GEOS functionalities.
Definition: IndexedNestedRingTester.h:25
geos::planargraph::Edge
Represents an undirected edge of a PlanarGraph.
Definition: planargraph/Edge.h:54
geos::planargraph::Node::addOutEdge
void addOutEdge(DirectedEdge *de)
Adds an outgoing DirectedEdge to this Node.
Definition: planargraph/Node.h:100
geos::planargraph::Node::pt
geom::Coordinate pt
The location of this Node.
Definition: planargraph/Node.h:49
geos::planargraph::GraphComponent
The base class for all graph component classes.
Definition: planargraph/GraphComponent.h:46
geos::planargraph::Node
A node in a PlanarGraph is a location where 0 or more Edge meet.
Definition: planargraph/Node.h:45
geos::planargraph::operator<<
std::ostream & operator<<(std::ostream &, const DirectedEdge &)
Output operator.