SUMO - Simulation of Urban MObility
NGRandomNetBuilder.h
Go to the documentation of this file.
1 /****************************************************************************/
9 // Additional structures for building random nets
10 /****************************************************************************/
11 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
12 // Copyright (C) 2001-2017 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 NGRandomNetBuilder_h
23 #define NGRandomNetBuilder_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 <map>
37 #include "NGNet.h"
38 
39 
40 // ===========================================================================
41 // class definitions
42 // ===========================================================================
50 public:
61  NGRandomNetBuilder(NGNet& net, double minAngle, double minDistance, double maxDistance, double connectivity,
62  int numTries, const RandomDistributor<int>& neighborDist);
63 
64 
65 
71  void createNet(int numNodes);
72 
73 
74 private:
79  void removeOuterNode(NGNode* node);
80 
81 
89  bool checkAngles(NGNode* node);
90 
91 
101  bool canConnect(NGNode* baseNode, NGNode* newNode);
102 
103 
111  bool createNewNode(NGNode* baseNode);
112 
113 
119  void findPossibleOuterNodes(NGNode* node);
120 
121 
122 private:
125 
128 
131 
132  // list of possible new connections
134 
135 
137 
138 
141 
144 
147 
151 
152 
155 
158 
161 
162 private:
165 
168 
169 };
170 
171 
172 #endif
173 
174 /****************************************************************************/
175 
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:126
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:215
int myNumNodes
Number of nodes to be created.
The class storing the generated network.
Definition: NGNet.h:56
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:58
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.