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 /****************************************************************************/
16 // The class storing the generated network
17 /****************************************************************************/
18 #ifndef NGNet_h
19 #define NGNet_h
20 
21 
22 // ===========================================================================
23 // included modules
24 // ===========================================================================
25 #include <config.h>
26 
28 #include "NGEdge.h"
29 #include "NGNode.h"
30 
31 
32 // ===========================================================================
33 // class declarations
34 // ===========================================================================
35 class NBNetBuilder;
36 
37 
38 // ===========================================================================
39 // class definitions
40 // ===========================================================================
49 class NGNet {
50 public:
52  NGNet(NBNetBuilder& nb);
53 
54 
56  ~NGNet();
57 
58 
68  NGNode* findNode(int xPos, int yPos);
69 
70 
78  std::string getNextFreeID();
79 
80 
87  double radialToX(double radius, double phi);
88 
89 
96  double radialToY(double radius, double phi);
97 
98 
115  void createChequerBoard(int numX, int numY, double spaceX, double spaceY, double attachLength);
116 
117 
135  void createSpiderWeb(int numRadDiv, int numCircles, double spaceRad, bool hasCenter);
136 
137 
155  void toNB() const;
156 
157 
164  void add(NGNode* node);
165 
166 
173  void add(NGEdge* edge);
174 
175 
180  int nodeNo() const;
181 
182 
183 private:
192  void connect(NGNode* node1, NGNode* node2);
193 
195  std::string alphabeticalCode(int i, int iMax);
196 
198  static Distribution_Parameterized getDistribution(const std::string& option);
199 
200 private:
202  int myLastID;
203 
205  const bool myAlphaIDs;
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 
NGNet::createChequerBoard
void createChequerBoard(int numX, int numY, double spaceX, double spaceY, double attachLength)
Creates a grid network.
Definition: NGNet.cpp:94
Distribution_Parameterized
Definition: Distribution_Parameterized.h:42
NGNet::toNB
void toNB() const
Converts the stored network into its netbuilder-representation.
Definition: NGNet.cpp:230
NBNetBuilder
Instance responsible for building networks.
Definition: NBNetBuilder.h:109
NGNet::operator=
NGNet & operator=(const NGNet &)
Invalidated assignment operator.
NGNodeList
std::list< NGNode * > NGNodeList
A list of nodes (node pointers)
Definition: NGNode.h:207
NGNet::getNextFreeID
std::string getNextFreeID()
Returns the next free id.
Definition: NGNet.cpp:65
NGNet::myNodeList
NGNodeList myNodeList
The list of nodes.
Definition: NGNet.h:211
NGEdge
A netgen-representation of an edge.
Definition: NGEdge.h:54
NGNet::radialToX
double radialToX(double radius, double phi)
Returns the x-position resulting from the given radius and angle.
Definition: NGNet.cpp:147
NGNet::alphabeticalCode
std::string alphabeticalCode(int i, int iMax)
return a letter code for the given integer index
Definition: NGNet.cpp:81
NGNet::myAlphaIDs
const bool myAlphaIDs
Whether to use alphanumericalIDs.
Definition: NGNet.h:205
NGNet::createSpiderWeb
void createSpiderWeb(int numRadDiv, int numCircles, double spaceRad, bool hasCenter)
Creates a spider network.
Definition: NGNet.cpp:159
NGNet::findNode
NGNode * findNode(int xPos, int yPos)
Returns the node at the given position.
Definition: NGNet.cpp:71
NGNet::myLastID
int myLastID
The last ID given to node or link.
Definition: NGNet.h:202
NGNet
The class storing the generated network.
Definition: NGNet.h:49
NGNet::myEdgeList
NGEdgeList myEdgeList
The list of links.
Definition: NGNet.h:214
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:218
NGNet::radialToY
double radialToY(double radius, double phi)
Returns the y-position resulting from the given radius and angle.
Definition: NGNet.cpp:153
NGNet::~NGNet
~NGNet()
Destructor.
Definition: NGNet.cpp:54
NGEdgeList
std::list< NGEdge * > NGEdgeList
A list of edges (edge pointers)
Definition: NGEdge.h:118
config.h
NGNet::connect
void connect(NGNode *node1, NGNode *node2)
Connects both nodes with two edges, one for each direction.
Definition: NGNet.cpp:208
NGNet::myNetBuilder
NBNetBuilder & myNetBuilder
The builder used to build NB*-structures.
Definition: NGNet.h:208
NGNet::NGNet
NGNet(NBNetBuilder &nb)
Constructor.
Definition: NGNet.cpp:47
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:50
NGEdge.h