SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
NGNode.h
Go to the documentation of this file.
1 /****************************************************************************/
9 // A netgen-representation of a node
10 /****************************************************************************/
11 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
12 // Copyright (C) 2001-2012 DLR (http://www.dlr.de/) and contributors
13 /****************************************************************************/
14 //
15 // This file is part of SUMO.
16 // SUMO is free software: you can redistribute it and/or modify
17 // it under the terms of the GNU General Public License as published by
18 // the Free Software Foundation, either version 3 of the License, or
19 // (at your option) any later version.
20 //
21 /****************************************************************************/
22 #ifndef NGNode_h
23 #define NGNode_h
24 
25 
26 // ===========================================================================
27 // included modules
28 // ===========================================================================
29 #ifdef _MSC_VER
30 #include <windows_config.h>
31 #else
32 #include <config.h>
33 #endif
34 
35 #include <list>
36 #include <utils/geom/Position.h>
37 #include <utils/geom/GeomHelper.h>
39 #include "NGEdge.h"
40 
41 
42 // ===========================================================================
43 // class declarations
44 // ===========================================================================
45 class NBNode;
46 class NBEdge;
47 class NBNetBuilder;
48 
49 
50 // ===========================================================================
51 // class definitions
52 // ===========================================================================
57 class NGNode {
58 public:
60  NGNode();
61 
62 
67  NGNode(const std::string& id);
68 
69 
76  NGNode(const std::string& id, int xPos, int yPos);
77 
78 
86  NGNode(const std::string& id, int xID, int yID, bool amCenter);
87 
88 
90  ~NGNode();
91 
92 
97  const std::string& getID() const {
98  return myID;
99  }
100 
101 
106  const Position& getPosition() const {
107  return myPosition;
108  }
109 
110 
116  return myMaxNeighbours;
117  }
118 
119 
125  myMaxNeighbours = value;
126  }
127 
128 
133  void setX(SUMOReal x) {
134  myPosition.set(x, myPosition.y());
135  }
136 
137 
142  void setY(SUMOReal y) {
143  myPosition.set(myPosition.x(), y);
144  }
145 
146 
162  NBNode* buildNBNode(NBNetBuilder& nb) const;
163 
164 
169  void addLink(NGEdge* link);
170 
171 
179  void removeLink(NGEdge* link);
180 
181 
187  bool connected(NGNode* node) const;
188 
189 
195  bool samePos(int xPos, int yPos) const {
196  return xID == xPos && yID == yPos;
197  }
198 
199  // NGRandomNetBuilder needs access to links
200  friend class NGRandomNetBuilder;
201 
202 private:
204  int xID;
205 
207  int yID;
208 
211 
213  std::string myID;
214 
217 
220 
223 
224 };
225 
230 typedef std::list<NGNode*> NGNodeList;
231 
232 
233 
234 #endif
235 
236 /****************************************************************************/
237