SUMO - Simulation of Urban MObility
NGNet.h
Go to the documentation of this file.
1 /****************************************************************************/
9 // The class storing the generated network
10 /****************************************************************************/
11 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
12 // Copyright (C) 2001-2017 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 NGNet_h
23 #define NGNet_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 "NGEdge.h"
36 #include "NGNode.h"
37 
38 
39 // ===========================================================================
40 // class declarations
41 // ===========================================================================
42 class NBNetBuilder;
43 
44 
45 // ===========================================================================
46 // class definitions
47 // ===========================================================================
56 class NGNet {
57 public:
59  NGNet(NBNetBuilder& nb);
60 
61 
63  ~NGNet();
64 
65 
75  NGNode* findNode(int xPos, int yPos);
76 
77 
85  std::string getNextFreeID();
86 
87 
94  double radialToX(double radius, double phi);
95 
96 
103  double radialToY(double radius, double phi);
104 
105 
123  void createChequerBoard(int numX, int numY, double spaceX, double spaceY, double attachLength, bool alphaIDs);
124 
125 
143  void createSpiderWeb(int numRadDiv, int numCircles, double spaceRad, bool hasCenter);
144 
145 
163  void toNB() const;
164 
165 
172  void add(NGNode* node);
173 
174 
181  void add(NGEdge* edge);
182 
183 
188  int nodeNo() const;
189 
190 
191 private:
200  void connect(NGNode* node1, NGNode* node2);
201 
202 
203 private:
205  int myLastID;
206 
209 
212 
215 
216 private:
218  NGNet(const NGNet&);
219 
221  NGNet& operator=(const NGNet&);
222 
223 };
224 
225 
226 #endif
227 
228 /****************************************************************************/
229 
NBNetBuilder & myNetBuilder
The builder used to build NB*-structures.
Definition: NGNet.h:208
NGNet(NBNetBuilder &nb)
Constructor.
Definition: NGNet.cpp:53
A netgen-representation of an edge.
Definition: NGEdge.h:62
double radialToX(double radius, double phi)
Returns the x-position resulting from the given radius and angle.
Definition: NGNet.cpp:142
void connect(NGNode *node1, NGNode *node2)
Connects both nodes with two edges, one for each direction.
Definition: NGNet.cpp:200
void toNB() const
Converts the stored network into its netbuilder-representation.
Definition: NGNet.cpp:211
NGNode * findNode(int xPos, int yPos)
Returns the node at the given position.
Definition: NGNet.cpp:76
double radialToY(double radius, double phi)
Returns the y-position resulting from the given radius and angle.
Definition: NGNet.cpp:148
int nodeNo() const
Returns the number of stored nodes.
Definition: NGNet.cpp:253
std::list< NGEdge * > NGEdgeList
A list of edges (edge pointers)
Definition: NGEdge.h:126
NGEdgeList myEdgeList
The list of links.
Definition: NGNet.h:214
NGNet & operator=(const NGNet &)
Invalidated assignment operator.
std::list< NGNode * > NGNodeList
A list of nodes (node pointers)
Definition: NGNode.h:215
std::string getNextFreeID()
Returns the next free id.
Definition: NGNet.cpp:70
NGNodeList myNodeList
The list of nodes.
Definition: NGNet.h:211
The class storing the generated network.
Definition: NGNet.h:56
int myLastID
The last ID given to node or link.
Definition: NGNet.h:205
Instance responsible for building networks.
Definition: NBNetBuilder.h:114
void createSpiderWeb(int numRadDiv, int numCircles, double spaceRad, bool hasCenter)
Creates a spider network.
Definition: NGNet.cpp:154
void createChequerBoard(int numX, int numY, double spaceX, double spaceY, double attachLength, bool alphaIDs)
Creates a grid network.
Definition: NGNet.cpp:87
A netgen-representation of a node.
Definition: NGNode.h:58
~NGNet()
Destructor.
Definition: NGNet.cpp:59
void add(NGNode *node)
Adds the given node to the network.
Definition: NGNet.cpp:241