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 /****************************************************************************/
16 // Additional structures for building random nets
17 /****************************************************************************/
18 #ifndef NGRandomNetBuilder_h
19 #define NGRandomNetBuilder_h
20 
21 
22 // ===========================================================================
23 // included modules
24 // ===========================================================================
25 #include <config.h>
26 
27 #include <map>
29 #include "NGNet.h"
30 
31 
32 // ===========================================================================
33 // class definitions
34 // ===========================================================================
42 public:
53  NGRandomNetBuilder(NGNet& net, double minAngle, double minDistance, double maxDistance, double connectivity,
54  int numTries, const RandomDistributor<int>& neighborDist);
55 
56 
57 
63  void createNet(int numNodes, bool gridMode);
64 
65 
66 private:
71  void removeOuterNode(NGNode* node);
72 
73 
81  bool checkAngles(NGNode* node);
82 
83 
93  bool canConnect(NGNode* baseNode, NGNode* newNode);
94 
95 
103  bool createNewNode(NGNode* baseNode, bool gridMode);
104 
105 
111  void findPossibleOuterNodes(NGNode* node);
112 
113 
114 private:
117 
120 
123 
124  // list of possible new connections
126 
127 
129 
130 
133 
136 
139 
143 
144 
147 
150 
153 
154 private:
157 
160 
161 };
162 
163 
164 #endif
165 
166 /****************************************************************************/
167 
NGRandomNetBuilder::myConNodes
NGNodeList myConNodes
Definition: NGRandomNetBuilder.h:125
NGRandomNetBuilder::myNet
NGNet & myNet
The network to fill.
Definition: NGRandomNetBuilder.h:116
NGRandomNetBuilder::myNeighbourDistribution
RandomDistributor< int > myNeighbourDistribution
The distribution of number of neighbours.
Definition: NGRandomNetBuilder.h:152
NGNodeList
std::list< NGNode * > NGNodeList
A list of nodes (node pointers)
Definition: NGNode.h:207
NGRandomNetBuilder::myConnectivity
double myConnectivity
Probability of connecting to a existing node if possible.
Definition: NGRandomNetBuilder.h:141
NGRandomNetBuilder::findPossibleOuterNodes
void findPossibleOuterNodes(NGNode *node)
finds possible connections between Node and OuterNodes complying with restrictions
Definition: NGRandomNetBuilder.cpp:154
NGRandomNetBuilder::canConnect
bool canConnect(NGNode *baseNode, NGNode *newNode)
Checks whether connecting the given two nodes complies with the set restrictions.
Definition: NGRandomNetBuilder.cpp:102
NGRandomNetBuilder::myMinLinkAngle
double myMinLinkAngle
Minimum angle allowed between two links.
Definition: NGRandomNetBuilder.h:132
NGRandomNetBuilder::myMinDistance
double myMinDistance
Minimum distance allowed between two nodes.
Definition: NGRandomNetBuilder.h:135
NGRandomNetBuilder
A class that builds random network using an algorithm by Markus Hartinger.
Definition: NGRandomNetBuilder.h:41
NGRandomNetBuilder::checkAngles
bool checkAngles(NGNode *node)
Checks whether the angle of this node's connections are valid.
Definition: NGRandomNetBuilder.cpp:61
RandomDistributor.h
NGNet
The class storing the generated network.
Definition: NGNet.h:49
NGRandomNetBuilder::removeOuterNode
void removeOuterNode(NGNode *node)
Removes the given node from the list of outer nodes.
Definition: NGRandomNetBuilder.cpp:50
RandomDistributor< int >
NGRandomNetBuilder::myNumNodes
int myNumNodes
Number of nodes to be created.
Definition: NGRandomNetBuilder.h:149
NGRandomNetBuilder::createNewNode
bool createNewNode(NGNode *baseNode, bool gridMode)
Creates new random node.
Definition: NGRandomNetBuilder.cpp:172
NGRandomNetBuilder::myMaxDistance
double myMaxDistance
Maximum distance allowed between two nodes.
Definition: NGRandomNetBuilder.h:138
NGRandomNetBuilder::myOuterLinks
NGEdgeList myOuterLinks
The list of outer links.
Definition: NGRandomNetBuilder.h:122
NGEdgeList
std::list< NGEdge * > NGEdgeList
A list of edges (edge pointers)
Definition: NGEdge.h:118
NGRandomNetBuilder::createNet
void createNet(int numNodes, bool gridMode)
Builds a NGNet using the set values.
Definition: NGRandomNetBuilder.cpp:209
NGRandomNetBuilder::operator=
NGRandomNetBuilder & operator=(const NGRandomNetBuilder &)
Invalidated assignment operator.
NGRandomNetBuilder::myNumTries
int myNumTries
Number of tries to create a new node.
Definition: NGRandomNetBuilder.h:146
config.h
NGRandomNetBuilder::myOuterNodes
NGNodeList myOuterNodes
The list of outer nodes.
Definition: NGRandomNetBuilder.h:119
NGRandomNetBuilder::NGRandomNetBuilder
NGRandomNetBuilder(NGNet &net, double minAngle, double minDistance, double maxDistance, double connectivity, int numTries, const RandomDistributor< int > &neighborDist)
Constructor.
Definition: NGRandomNetBuilder.cpp:40
NGNode
A netgen-representation of a node.
Definition: NGNode.h:50
NGNet.h