SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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-2015 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  SUMOReal radialToX(SUMOReal radius, SUMOReal phi);
95 
96 
103  SUMOReal radialToY(SUMOReal radius, SUMOReal phi);
104 
105 
122  void createChequerBoard(int numX, int numY, SUMOReal spaceX, SUMOReal spaceY, SUMOReal attachLength);
123 
124 
142  void createSpiderWeb(int numRadDiv, int numCircles, SUMOReal 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  size_t 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:57
A netgen-representation of an edge.
Definition: NGEdge.h:62
void connect(NGNode *node1, NGNode *node2)
Connects both nodes with two edges, one for each direction.
Definition: NGNet.cpp:201
NGNode * findNode(int xPos, int yPos)
Returns the node at the given position.
Definition: NGNet.cpp:80
void toNB() const
Converts the stored network into its netbuilder-representation.
Definition: NGNet.cpp:212
void createChequerBoard(int numX, int numY, SUMOReal spaceX, SUMOReal spaceY, SUMOReal attachLength)
Creates a grid network.
Definition: NGNet.cpp:91
std::list< NGEdge * > NGEdgeList
A list of edges (edge pointers)
Definition: NGEdge.h:126
NGEdgeList myEdgeList
The list of links.
Definition: NGNet.h:213
NGNet & operator=(const NGNet &)
Invalidated assignment operator.
void createSpiderWeb(int numRadDiv, int numCircles, SUMOReal spaceRad, bool hasCenter)
Creates a spider network.
Definition: NGNet.cpp:155
SUMOReal radialToX(SUMOReal radius, SUMOReal phi)
Returns the x-position resulting from the given radius and angle.
Definition: NGNet.cpp:143
size_t nodeNo() const
Returns the number of stored nodes.
Definition: NGNet.cpp:254
SUMOReal radialToY(SUMOReal radius, SUMOReal phi)
Returns the y-position resulting from the given radius and angle.
Definition: NGNet.cpp:149
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:74
NGNodeList myNodeList
The list of nodes.
Definition: NGNet.h:210
The class storing the generated network.
Definition: NGNet.h:56
int myLastID
The last ID given to node or link.
Definition: NGNet.h:204
Instance responsible for building networks.
Definition: NBNetBuilder.h:113
#define SUMOReal
Definition: config.h:218
A netgen-representation of a node.
Definition: NGNode.h:58
~NGNet()
Destructor.
Definition: NGNet.cpp:63
void add(NGNode *node)
Adds the given node to the network.
Definition: NGNet.cpp:242