SUMO - Simulation of Urban MObility
NGRandomNetBuilder Class Reference

A class that builds random network using an algorithm by Markus Hartinger. More...

#include <NGRandomNetBuilder.h>

Collaboration diagram for NGRandomNetBuilder:
Collaboration graph

Public Member Functions

void createNet (int numNodes)
 Builds a NGNet using the set values. More...
 
 NGRandomNetBuilder (NGNet &net, double minAngle, double minDistance, double maxDistance, double connectivity, int numTries, const RandomDistributor< int > &neighborDist)
 Constructor. More...
 

Private Member Functions

bool canConnect (NGNode *baseNode, NGNode *newNode)
 Checks whether connecting the given two nodes complies with the set restrictions. More...
 
bool checkAngles (NGNode *node)
 Checks whether the angle of this node's connections are valid. More...
 
bool createNewNode (NGNode *baseNode)
 Creates new random node. More...
 
void findPossibleOuterNodes (NGNode *node)
 finds possible connections between Node and OuterNodes complying with restrictions More...
 
 NGRandomNetBuilder (const NGRandomNetBuilder &)
 Invalidated copy constructor. More...
 
NGRandomNetBuilder & operator= (const NGRandomNetBuilder &)
 Invalidated assignment operator. More...
 
void removeOuterNode (NGNode *node)
 Removes the given node from the list of outer nodes. More...
 

Private Attributes

NGNodeList myConNodes
 
RandomDistributor< int > myNeighbourDistribution
 The distribution of number of neighbours. More...
 
NGNet & myNet
 The network to fill. More...
 
int myNumNodes
 Number of nodes to be created. More...
 
int myNumTries
 Number of tries to create a new node. More...
 
NGEdgeList myOuterLinks
 The list of outer links. More...
 
NGNodeList myOuterNodes
 The list of outer nodes. More...
 
restrictions
double myMinLinkAngle
 Minimum angle allowed between two links. More...
 
double myMinDistance
 Minimum distance allowed between two nodes. More...
 
double myMaxDistance
 Maximum distance allowed between two nodes. More...
 
double myConnectivity
 Probability of connecting to a existing node if possible. More...
 

Detailed Description

A class that builds random network using an algorithm by Markus Hartinger.

Todo:
Describe the algorithm

Definition at line 48 of file NGRandomNetBuilder.h.

Constructor & Destructor Documentation

NGRandomNetBuilder::NGRandomNetBuilder ( NGNet &  net,
double  minAngle,
double  minDistance,
double  maxDistance,
double  connectivity,
int  numTries,
const RandomDistributor< int > &  neighborDist 
)

Constructor.

Parameters
[in]netThe network to fill with generated structures
[in]minAngleThe minimum allowed angle between two streets
[in]minDistanceThe minimum allowed distance between two nodes
[in]maxDistanceThe maximum allowed distance between two nodes
[in]connectivityThe connectivity factor
[in]numTries?
Todo:
check meanings of connectivity/numTries

Definition at line 46 of file NGRandomNetBuilder.cpp.

NGRandomNetBuilder::NGRandomNetBuilder ( const NGRandomNetBuilder &  )
private

Invalidated copy constructor.

Member Function Documentation

bool NGRandomNetBuilder::canConnect ( NGNode *  baseNode,
NGNode *  newNode 
)
private

Checks whether connecting the given two nodes complies with the set restrictions.

Checks whether the distance, the angle, and the connectivity is within the defined range when both nodes would be connected

Parameters
[in]baseNodeThe first node of the combination to check
[in]newNodeThe second node of the combination to check
Returns
Whether the settings allow to connect both nodes

Definition at line 108 of file NGRandomNetBuilder.cpp.

References checkAngles(), Position::distanceTo2D(), NGNode::getPosition(), GeomHelper::INVALID_OFFSET, PositionVector::length(), myMaxDistance, myMinDistance, myOuterLinks, GeomHelper::nearest_offset_on_line_to_point2D(), and PositionVector::positionAtOffset2D().

Referenced by createNet(), createNewNode(), and findPossibleOuterNodes().

bool NGRandomNetBuilder::checkAngles ( NGNode *  node)
private

Checks whether the angle of this node's connections are valid.

Checks whether the connections of the nodes are in common with the value of myMinLinkAngle.

Parameters
[in]nodeThe node to check connections of
Returns
Whether the settings allow to connect both nodes

Definition at line 67 of file NGRandomNetBuilder.cpp.

References GeomHelper::angle2D(), NGNode::getPosition(), NGNode::LinkList, myMinLinkAngle, Position::x(), and Position::y().

Referenced by canConnect().

void NGRandomNetBuilder::createNet ( int  numNodes)
bool NGRandomNetBuilder::createNewNode ( NGNode *  baseNode)
private
void NGRandomNetBuilder::findPossibleOuterNodes ( NGNode *  node)
private

finds possible connections between Node and OuterNodes complying with restrictions

Parameters
[in]node?
Todo:
Describe better

Definition at line 160 of file NGRandomNetBuilder.cpp.

References canConnect(), NGNode::connected(), NGNode::getMaxNeighbours(), NGNode::LinkList, myConNodes, and myOuterNodes.

Referenced by createNet().

NGRandomNetBuilder& NGRandomNetBuilder::operator= ( const NGRandomNetBuilder &  )
private

Invalidated assignment operator.

void NGRandomNetBuilder::removeOuterNode ( NGNode *  node)
private

Removes the given node from the list of outer nodes.

Parameters
[in]nodeThe node to remove

Definition at line 56 of file NGRandomNetBuilder.cpp.

References myOuterNodes.

Referenced by createNet(), and createNewNode().

Field Documentation

double NGRandomNetBuilder::myConnectivity
private

Probability of connecting to a existing node if possible.

Definition at line 148 of file NGRandomNetBuilder.h.

Referenced by createNet().

NGNodeList NGRandomNetBuilder::myConNodes
private

Definition at line 132 of file NGRandomNetBuilder.h.

Referenced by createNet(), and findPossibleOuterNodes().

double NGRandomNetBuilder::myMaxDistance
private

Maximum distance allowed between two nodes.

Definition at line 145 of file NGRandomNetBuilder.h.

Referenced by canConnect(), and createNewNode().

double NGRandomNetBuilder::myMinDistance
private

Minimum distance allowed between two nodes.

Definition at line 142 of file NGRandomNetBuilder.h.

Referenced by canConnect(), and createNewNode().

double NGRandomNetBuilder::myMinLinkAngle
private

Minimum angle allowed between two links.

Definition at line 139 of file NGRandomNetBuilder.h.

Referenced by checkAngles().

RandomDistributor<int> NGRandomNetBuilder::myNeighbourDistribution
private

The distribution of number of neighbours.

Definition at line 159 of file NGRandomNetBuilder.h.

Referenced by createNewNode().

NGNet& NGRandomNetBuilder::myNet
private

The network to fill.

Definition at line 123 of file NGRandomNetBuilder.h.

Referenced by createNet(), and createNewNode().

int NGRandomNetBuilder::myNumNodes
private

Number of nodes to be created.

Definition at line 156 of file NGRandomNetBuilder.h.

Referenced by createNet().

int NGRandomNetBuilder::myNumTries
private

Number of tries to create a new node.

Definition at line 153 of file NGRandomNetBuilder.h.

Referenced by createNet().

NGEdgeList NGRandomNetBuilder::myOuterLinks
private

The list of outer links.

Definition at line 129 of file NGRandomNetBuilder.h.

Referenced by canConnect(), createNet(), and createNewNode().

NGNodeList NGRandomNetBuilder::myOuterNodes
private

The list of outer nodes.

Definition at line 126 of file NGRandomNetBuilder.h.

Referenced by createNet(), createNewNode(), findPossibleOuterNodes(), and removeOuterNode().


The documentation for this class was generated from the following files: