SUMO - Simulation of Urban MObility
NGNet.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2017 German Aerospace Center (DLR) and others.
4 /****************************************************************************/
5 //
6 // This program and the accompanying materials
7 // are made available under the terms of the Eclipse Public License v2.0
8 // which accompanies this distribution, and is available at
9 // http://www.eclipse.org/legal/epl-v20.html
10 //
11 /****************************************************************************/
19 // The class storing the generated network
20 /****************************************************************************/
21 #ifndef NGNet_h
22 #define NGNet_h
23 
24 
25 // ===========================================================================
26 // included modules
27 // ===========================================================================
28 #ifdef _MSC_VER
29 #include <windows_config.h>
30 #else
31 #include <config.h>
32 #endif
33 
34 #include "NGEdge.h"
35 #include "NGNode.h"
36 
37 
38 // ===========================================================================
39 // class declarations
40 // ===========================================================================
41 class NBNetBuilder;
42 
43 
44 // ===========================================================================
45 // class definitions
46 // ===========================================================================
55 class NGNet {
56 public:
58  NGNet(NBNetBuilder& nb);
59 
60 
62  ~NGNet();
63 
64 
74  NGNode* findNode(int xPos, int yPos);
75 
76 
84  std::string getNextFreeID();
85 
86 
93  double radialToX(double radius, double phi);
94 
95 
102  double radialToY(double radius, double phi);
103 
104 
122  void createChequerBoard(int numX, int numY, double spaceX, double spaceY, double attachLength, bool alphaIDs);
123 
124 
142  void createSpiderWeb(int numRadDiv, int numCircles, double spaceRad, bool hasCenter);
143 
144 
162  void toNB() const;
163 
164 
171  void add(NGNode* node);
172 
173 
180  void add(NGEdge* edge);
181 
182 
187  int nodeNo() const;
188 
189 
190 private:
199  void connect(NGNode* node1, NGNode* node2);
200 
201 
202 private:
204  int myLastID;
205 
208 
211 
214 
215 private:
217  NGNet(const NGNet&);
218 
220  NGNet& operator=(const NGNet&);
221 
222 };
223 
224 
225 #endif
226 
227 /****************************************************************************/
228 
NBNetBuilder & myNetBuilder
The builder used to build NB*-structures.
Definition: NGNet.h:207
NGNet(NBNetBuilder &nb)
Constructor.
Definition: NGNet.cpp:52
A netgen-representation of an edge.
Definition: NGEdge.h:61
double radialToX(double radius, double phi)
Returns the x-position resulting from the given radius and angle.
Definition: NGNet.cpp:141
void connect(NGNode *node1, NGNode *node2)
Connects both nodes with two edges, one for each direction.
Definition: NGNet.cpp:199
void toNB() const
Converts the stored network into its netbuilder-representation.
Definition: NGNet.cpp:210
NGNode * findNode(int xPos, int yPos)
Returns the node at the given position.
Definition: NGNet.cpp:75
double radialToY(double radius, double phi)
Returns the y-position resulting from the given radius and angle.
Definition: NGNet.cpp:147
int nodeNo() const
Returns the number of stored nodes.
Definition: NGNet.cpp:252
std::list< NGEdge * > NGEdgeList
A list of edges (edge pointers)
Definition: NGEdge.h:125
NGEdgeList myEdgeList
The list of links.
Definition: NGNet.h:213
NGNet & operator=(const NGNet &)
Invalidated assignment operator.
std::list< NGNode * > NGNodeList
A list of nodes (node pointers)
Definition: NGNode.h:214
std::string getNextFreeID()
Returns the next free id.
Definition: NGNet.cpp:69
NGNodeList myNodeList
The list of nodes.
Definition: NGNet.h:210
The class storing the generated network.
Definition: NGNet.h:55
int myLastID
The last ID given to node or link.
Definition: NGNet.h:204
Instance responsible for building networks.
Definition: NBNetBuilder.h:115
void createSpiderWeb(int numRadDiv, int numCircles, double spaceRad, bool hasCenter)
Creates a spider network.
Definition: NGNet.cpp:153
void createChequerBoard(int numX, int numY, double spaceX, double spaceY, double attachLength, bool alphaIDs)
Creates a grid network.
Definition: NGNet.cpp:86
A netgen-representation of a node.
Definition: NGNode.h:57
~NGNet()
Destructor.
Definition: NGNet.cpp:58
void add(NGNode *node)
Adds the given node to the network.
Definition: NGNet.cpp:240