Eclipse 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-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
17 // The class storing the generated network
18 /****************************************************************************/
19 #ifndef NGNet_h
20 #define NGNet_h
21 
22 
23 // ===========================================================================
24 // included modules
25 // ===========================================================================
26 #include <config.h>
27 
29 #include "NGEdge.h"
30 #include "NGNode.h"
31 
32 
33 // ===========================================================================
34 // class declarations
35 // ===========================================================================
36 class NBNetBuilder;
37 
38 
39 // ===========================================================================
40 // class definitions
41 // ===========================================================================
50 class NGNet {
51 public:
53  NGNet(NBNetBuilder& nb);
54 
55 
57  ~NGNet();
58 
59 
69  NGNode* findNode(int xPos, int yPos);
70 
71 
79  std::string getNextFreeID();
80 
81 
88  double radialToX(double radius, double phi);
89 
90 
97  double radialToY(double radius, double phi);
98 
99 
116  void createChequerBoard(int numX, int numY, double spaceX, double spaceY, double attachLength);
117 
118 
136  void createSpiderWeb(int numRadDiv, int numCircles, double spaceRad, bool hasCenter);
137 
138 
156  void toNB() const;
157 
158 
165  void add(NGNode* node);
166 
167 
174  void add(NGEdge* edge);
175 
176 
181  int nodeNo() const;
182 
183 
184 private:
193  void connect(NGNode* node1, NGNode* node2);
194 
196  std::string alphabeticalCode(int i, int iMax);
197 
199  static Distribution_Parameterized getDistribution(const std::string& option);
200 
201 private:
203  int myLastID;
204 
206  const bool myAlphaIDs;
207 
210 
213 
216 
217 private:
219  NGNet(const NGNet&);
220 
222  NGNet& operator=(const NGNet&);
223 
224 };
225 
226 
227 #endif
228 
229 /****************************************************************************/
230 
NGNet::createChequerBoard
void createChequerBoard(int numX, int numY, double spaceX, double spaceY, double attachLength)
Creates a grid network.
Definition: NGNet.cpp:95
Distribution_Parameterized
Definition: Distribution_Parameterized.h:43
NGNet::toNB
void toNB() const
Converts the stored network into its netbuilder-representation.
Definition: NGNet.cpp:231
NBNetBuilder
Instance responsible for building networks.
Definition: NBNetBuilder.h:110
NGNet::operator=
NGNet & operator=(const NGNet &)
Invalidated assignment operator.
NGNodeList
std::list< NGNode * > NGNodeList
A list of nodes (node pointers)
Definition: NGNode.h:208
NGNet::getNextFreeID
std::string getNextFreeID()
Returns the next free id.
Definition: NGNet.cpp:66
NGNet::myNodeList
NGNodeList myNodeList
The list of nodes.
Definition: NGNet.h:212
NGEdge
A netgen-representation of an edge.
Definition: NGEdge.h:55
NGNet::radialToX
double radialToX(double radius, double phi)
Returns the x-position resulting from the given radius and angle.
Definition: NGNet.cpp:148
NGNet::alphabeticalCode
std::string alphabeticalCode(int i, int iMax)
return a letter code for the given integer index
Definition: NGNet.cpp:82
NGNet::myAlphaIDs
const bool myAlphaIDs
Whether to use alphanumericalIDs.
Definition: NGNet.h:206
NGNet::createSpiderWeb
void createSpiderWeb(int numRadDiv, int numCircles, double spaceRad, bool hasCenter)
Creates a spider network.
Definition: NGNet.cpp:160
NGNet::findNode
NGNode * findNode(int xPos, int yPos)
Returns the node at the given position.
Definition: NGNet.cpp:72
NGNet::myLastID
int myLastID
The last ID given to node or link.
Definition: NGNet.h:203
NGNet
The class storing the generated network.
Definition: NGNet.h:50
NGNet::myEdgeList
NGEdgeList myEdgeList
The list of links.
Definition: NGNet.h:215
NGNet::nodeNo
int nodeNo() const
Returns the number of stored nodes.
Definition: NGNet.cpp:329
Distribution_Parameterized.h
NGNet::getDistribution
static Distribution_Parameterized getDistribution(const std::string &option)
get distribution from option
Definition: NGNet.cpp:219
NGNet::radialToY
double radialToY(double radius, double phi)
Returns the y-position resulting from the given radius and angle.
Definition: NGNet.cpp:154
NGNet::~NGNet
~NGNet()
Destructor.
Definition: NGNet.cpp:55
NGEdgeList
std::list< NGEdge * > NGEdgeList
A list of edges (edge pointers)
Definition: NGEdge.h:119
config.h
NGNet::connect
void connect(NGNode *node1, NGNode *node2)
Connects both nodes with two edges, one for each direction.
Definition: NGNet.cpp:209
NGNet::myNetBuilder
NBNetBuilder & myNetBuilder
The builder used to build NB*-structures.
Definition: NGNet.h:209
NGNet::NGNet
NGNet(NBNetBuilder &nb)
Constructor.
Definition: NGNet.cpp:48
NGNet::add
void add(NGNode *node)
Adds the given node to the network.
Definition: NGNet.cpp:317
NGNode.h
NGNode
A netgen-representation of a node.
Definition: NGNode.h:51
NGEdge.h