Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
NGRandomNetBuilder.h
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2001-2024 German Aerospace Center (DLR) and others.
4// This program and the accompanying materials are made available under the
5// terms of the Eclipse Public License 2.0 which is available at
6// https://www.eclipse.org/legal/epl-2.0/
7// This Source Code may also be made available under the following Secondary
8// Licenses when the conditions for such availability set forth in the Eclipse
9// Public License 2.0 are satisfied: GNU General Public License, version 2
10// or later which is available at
11// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13/****************************************************************************/
20// Additional structures for building random nets
21/****************************************************************************/
22#pragma once
23#include <config.h>
24
25#include <map>
27#include "NGNet.h"
28
29
30// ===========================================================================
31// class definitions
32// ===========================================================================
40public:
51 NGRandomNetBuilder(NGNet& net, double minAngle, double minDistance, double maxDistance, double connectivity,
52 int numTries, const RandomDistributor<int>& neighborDist);
53
54
55
61 void createNet(int numNodes, bool gridMode);
62
63
64private:
69 void removeOuterNode(NGNode* node);
70
71
79 bool checkAngles(const NGNode* const node);
80
81
91 bool canConnect(NGNode* baseNode, NGNode* newNode);
92
93
101 bool createNewNode(NGNode* baseNode, bool gridMode);
102
103
109 void findPossibleOuterNodes(NGNode* node);
110
111
112private:
115
118
121
122 // list of possible new connections
124
125
127
128
131
134
137
141
142
145
148
151
152private:
155
158
159};
std::list< NGEdge * > NGEdgeList
A list of edges (edge pointers)
Definition NGEdge.h:118
std::list< NGNode * > NGNodeList
A list of nodes (node pointers)
Definition NGNode.h:213
The class storing the generated network.
Definition NGNet.h:47
A netgen-representation of a node.
Definition NGNode.h:48
A class that builds random network using an algorithm by Markus Hartinger.
int myNumTries
Number of tries to create a new node.
double myMaxDistance
Maximum distance allowed between two nodes.
void createNet(int numNodes, bool gridMode)
Builds a NGNet using the set values.
void findPossibleOuterNodes(NGNode *node)
finds possible connections between Node and OuterNodes complying with restrictions
bool createNewNode(NGNode *baseNode, bool gridMode)
Creates new random node.
NGNodeList myOuterNodes
The list of outer nodes.
RandomDistributor< int > myNeighbourDistribution
The distribution of number of neighbours.
bool canConnect(NGNode *baseNode, NGNode *newNode)
Checks whether connecting the given two nodes complies with the set restrictions.
bool checkAngles(const NGNode *const node)
Checks whether the angle of this node's connections are valid.
double myMinLinkAngle
Minimum angle allowed between two links.
NGRandomNetBuilder & operator=(const NGRandomNetBuilder &)
Invalidated assignment operator.
void removeOuterNode(NGNode *node)
Removes the given node from the list of outer nodes.
double myConnectivity
Probability of connecting to a existing node if possible.
double myMinDistance
Minimum distance allowed between two nodes.
NGNet & myNet
The network to fill.
NGEdgeList myOuterLinks
The list of outer links.
NGRandomNetBuilder(const NGRandomNetBuilder &)
Invalidated copy constructor.
int myNumNodes
Number of nodes to be created.
Represents a generic random distribution.