SUMO - Simulation of Urban MObility
NGRandomNetBuilder.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 // Additional structures for building random nets
20 /****************************************************************************/
21 #ifndef NGRandomNetBuilder_h
22 #define NGRandomNetBuilder_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 <map>
36 #include "NGNet.h"
37 
38 
39 // ===========================================================================
40 // class definitions
41 // ===========================================================================
49 public:
60  NGRandomNetBuilder(NGNet& net, double minAngle, double minDistance, double maxDistance, double connectivity,
61  int numTries, const RandomDistributor<int>& neighborDist);
62 
63 
64 
70  void createNet(int numNodes);
71 
72 
73 private:
78  void removeOuterNode(NGNode* node);
79 
80 
88  bool checkAngles(NGNode* node);
89 
90 
100  bool canConnect(NGNode* baseNode, NGNode* newNode);
101 
102 
110  bool createNewNode(NGNode* baseNode);
111 
112 
118  void findPossibleOuterNodes(NGNode* node);
119 
120 
121 private:
124 
127 
130 
131  // list of possible new connections
133 
134 
136 
137 
140 
143 
146 
150 
151 
154 
157 
160 
161 private:
164 
167 
168 };
169 
170 
171 #endif
172 
173 /****************************************************************************/
174 
NGNodeList myOuterNodes
The list of outer nodes.
void findPossibleOuterNodes(NGNode *node)
finds possible connections between Node and OuterNodes complying with restrictions ...
void createNet(int numNodes)
Builds a NGNet using the set values.
double myMinLinkAngle
Minimum angle allowed between two links.
double myMinDistance
Minimum distance allowed between two nodes.
double myConnectivity
Probability of connecting to a existing node if possible.
std::list< NGEdge * > NGEdgeList
A list of edges (edge pointers)
Definition: NGEdge.h:125
bool checkAngles(NGNode *node)
Checks whether the angle of this node&#39;s connections are valid.
bool canConnect(NGNode *baseNode, NGNode *newNode)
Checks whether connecting the given two nodes complies with the set restrictions. ...
std::list< NGNode * > NGNodeList
A list of nodes (node pointers)
Definition: NGNode.h:214
int myNumNodes
Number of nodes to be created.
The class storing the generated network.
Definition: NGNet.h:55
NGRandomNetBuilder & operator=(const NGRandomNetBuilder &)
Invalidated assignment operator.
void removeOuterNode(NGNode *node)
Removes the given node from the list of outer nodes.
NGEdgeList myOuterLinks
The list of outer links.
NGRandomNetBuilder(NGNet &net, double minAngle, double minDistance, double maxDistance, double connectivity, int numTries, const RandomDistributor< int > &neighborDist)
Constructor.
double myMaxDistance
Maximum distance allowed between two nodes.
A class that builds random network using an algorithm by Markus Hartinger.
A netgen-representation of a node.
Definition: NGNode.h:57
bool createNewNode(NGNode *baseNode)
Creates new random node.
int myNumTries
Number of tries to create a new node.
RandomDistributor< int > myNeighbourDistribution
The distribution of number of neighbours.
NGNet & myNet
The network to fill.