Eclipse 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-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 // Additional structures for building random nets
18 /****************************************************************************/
19 #ifndef NGRandomNetBuilder_h
20 #define NGRandomNetBuilder_h
21 
22 
23 // ===========================================================================
24 // included modules
25 // ===========================================================================
26 #include <config.h>
27 
28 #include <map>
30 #include "NGNet.h"
31 
32 
33 // ===========================================================================
34 // class definitions
35 // ===========================================================================
43 public:
54  NGRandomNetBuilder(NGNet& net, double minAngle, double minDistance, double maxDistance, double connectivity,
55  int numTries, const RandomDistributor<int>& neighborDist);
56 
57 
58 
64  void createNet(int numNodes, bool gridMode);
65 
66 
67 private:
72  void removeOuterNode(NGNode* node);
73 
74 
82  bool checkAngles(NGNode* node);
83 
84 
94  bool canConnect(NGNode* baseNode, NGNode* newNode);
95 
96 
104  bool createNewNode(NGNode* baseNode, bool gridMode);
105 
106 
112  void findPossibleOuterNodes(NGNode* node);
113 
114 
115 private:
118 
121 
124 
125  // list of possible new connections
127 
128 
130 
131 
134 
137 
140 
144 
145 
148 
151 
154 
155 private:
158 
161 
162 };
163 
164 
165 #endif
166 
167 /****************************************************************************/
168 
NGRandomNetBuilder::myConNodes
NGNodeList myConNodes
Definition: NGRandomNetBuilder.h:126
NGRandomNetBuilder::myNet
NGNet & myNet
The network to fill.
Definition: NGRandomNetBuilder.h:117
NGRandomNetBuilder::myNeighbourDistribution
RandomDistributor< int > myNeighbourDistribution
The distribution of number of neighbours.
Definition: NGRandomNetBuilder.h:153
NGNodeList
std::list< NGNode * > NGNodeList
A list of nodes (node pointers)
Definition: NGNode.h:208
NGRandomNetBuilder::myConnectivity
double myConnectivity
Probability of connecting to a existing node if possible.
Definition: NGRandomNetBuilder.h:142
NGRandomNetBuilder::findPossibleOuterNodes
void findPossibleOuterNodes(NGNode *node)
finds possible connections between Node and OuterNodes complying with restrictions
Definition: NGRandomNetBuilder.cpp:155
NGRandomNetBuilder::canConnect
bool canConnect(NGNode *baseNode, NGNode *newNode)
Checks whether connecting the given two nodes complies with the set restrictions.
Definition: NGRandomNetBuilder.cpp:103
NGRandomNetBuilder::myMinLinkAngle
double myMinLinkAngle
Minimum angle allowed between two links.
Definition: NGRandomNetBuilder.h:133
NGRandomNetBuilder::myMinDistance
double myMinDistance
Minimum distance allowed between two nodes.
Definition: NGRandomNetBuilder.h:136
NGRandomNetBuilder
A class that builds random network using an algorithm by Markus Hartinger.
Definition: NGRandomNetBuilder.h:42
NGRandomNetBuilder::checkAngles
bool checkAngles(NGNode *node)
Checks whether the angle of this node's connections are valid.
Definition: NGRandomNetBuilder.cpp:62
RandomDistributor.h
NGNet
The class storing the generated network.
Definition: NGNet.h:50
NGRandomNetBuilder::removeOuterNode
void removeOuterNode(NGNode *node)
Removes the given node from the list of outer nodes.
Definition: NGRandomNetBuilder.cpp:51
RandomDistributor< int >
NGRandomNetBuilder::myNumNodes
int myNumNodes
Number of nodes to be created.
Definition: NGRandomNetBuilder.h:150
NGRandomNetBuilder::createNewNode
bool createNewNode(NGNode *baseNode, bool gridMode)
Creates new random node.
Definition: NGRandomNetBuilder.cpp:173
NGRandomNetBuilder::myMaxDistance
double myMaxDistance
Maximum distance allowed between two nodes.
Definition: NGRandomNetBuilder.h:139
NGRandomNetBuilder::myOuterLinks
NGEdgeList myOuterLinks
The list of outer links.
Definition: NGRandomNetBuilder.h:123
NGEdgeList
std::list< NGEdge * > NGEdgeList
A list of edges (edge pointers)
Definition: NGEdge.h:119
NGRandomNetBuilder::createNet
void createNet(int numNodes, bool gridMode)
Builds a NGNet using the set values.
Definition: NGRandomNetBuilder.cpp:210
NGRandomNetBuilder::operator=
NGRandomNetBuilder & operator=(const NGRandomNetBuilder &)
Invalidated assignment operator.
NGRandomNetBuilder::myNumTries
int myNumTries
Number of tries to create a new node.
Definition: NGRandomNetBuilder.h:147
config.h
NGRandomNetBuilder::myOuterNodes
NGNodeList myOuterNodes
The list of outer nodes.
Definition: NGRandomNetBuilder.h:120
NGRandomNetBuilder::NGRandomNetBuilder
NGRandomNetBuilder(NGNet &net, double minAngle, double minDistance, double maxDistance, double connectivity, int numTries, const RandomDistributor< int > &neighborDist)
Constructor.
Definition: NGRandomNetBuilder.cpp:41
NGNode
A netgen-representation of a node.
Definition: NGNode.h:51
NGNet.h