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-sim.org/
12 // Copyright (C) 2001-2014 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/common/Named.h>
37 #include <utils/geom/Position.h>
38 #include <utils/geom/GeomHelper.h>
40 #include "NGEdge.h"
41 
42 
43 // ===========================================================================
44 // class declarations
45 // ===========================================================================
46 class NBNode;
47 class NBEdge;
48 class NBNetBuilder;
49 
50 
51 // ===========================================================================
52 // class definitions
53 // ===========================================================================
58 class NGNode : public Named {
59 public:
64  NGNode(const std::string& id);
65 
66 
73  NGNode(const std::string& id, int xPos, int yPos);
74 
75 
83  NGNode(const std::string& id, int xID, int yID, bool amCenter);
84 
85 
87  ~NGNode();
88 
89 
94  const Position& getPosition() const {
95  return myPosition;
96  }
97 
98 
104  return myMaxNeighbours;
105  }
106 
107 
113  myMaxNeighbours = value;
114  }
115 
116 
121  void setX(SUMOReal x) {
122  myPosition.set(x, myPosition.y());
123  }
124 
125 
130  void setY(SUMOReal y) {
131  myPosition.set(myPosition.x(), y);
132  }
133 
134 
150  NBNode* buildNBNode(NBNetBuilder& nb) const;
151 
152 
157  void addLink(NGEdge* link);
158 
159 
167  void removeLink(NGEdge* link);
168 
169 
175  bool connected(NGNode* node) const;
176 
177 
183  bool samePos(int xPos, int yPos) const {
184  return xID == xPos && yID == yPos;
185  }
186 
187  // NGRandomNetBuilder needs access to links
188  friend class NGRandomNetBuilder;
189 
190 private:
192  int xID;
193 
195  int yID;
196 
199 
202 
205 
208 
209 };
210 
215 typedef std::list<NGNode*> NGNodeList;
216 
217 
218 
219 #endif
220 
221 /****************************************************************************/
222