40 #ifdef CHECK_MEMORY_LEAKS
42 #endif // CHECK_MEMORY_LEAKS
60 std::map<int, SUMOReal>::iterator i;
107 NGEdgeList::iterator li;
111 if ((*li)->getStartNode() == node) {
112 ni = (*li)->getEndNode();
114 ni = (*li)->getStartNode();
120 NGEdgeList::iterator lj;
123 if ((*lj)->getStartNode() == node) {
124 ni = (*lj)->getEndNode();
126 ni = (*lj)->getStartNode();
145 bool connectable =
true;
167 NGEdgeList::iterator li;
169 while ((connectable ==
true) && (li !=
myOuterLinks.end())) {
171 Position p1((*li)->getStartNode()->getPosition());
172 Position p2((*li)->getEndNode()->getPosition());
173 if ((baseNode != (*li)->getStartNode()) && (baseNode != (*li)->getEndNode())
174 && (newNode != (*li)->getStartNode()) && (newNode != (*li)->getEndNode())) {
180 (newNode != (*li)->getStartNode()) && (newNode != (*li)->getEndNode())) {
196 NGNodeList::iterator ni;
201 ((on)->getMaxNeighbours() > (on)->LinkList.size())) {
static SUMOReal Angle2D(SUMOReal x1, SUMOReal y1, SUMOReal x2, SUMOReal y2)
void setX(SUMOReal x)
Sets a new value for x-position.
void add(int numNeighbours, SUMOReal ratio)
adds a neighbour item to list
A netgen-representation of an edge.
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.
bool connected(NGNode *node) const
Returns whether the other node is connected.
TNeighbourDistribution myNeighbourDistribution
The distrubtion of number of neighbours.
SUMOReal myConnectivity
Probability of connecting to a existing node if possible.
SUMOReal myMaxDistance
Maximum distance allowed between two nodes.
static SUMOReal rand()
Returns a random real number in [0, 1)
int num()
Get random number of neighbours.
bool checkAngles(NGNode *node)
Checks whether the angle of this node's connections are valid.
SUMOReal x() const
Returns the x-position.
SUMOReal getMaxNeighbours()
Returns this node's maximum neighbour number.
bool canConnect(NGNode *baseNode, NGNode *newNode)
Checks whether connecting the given two nodes complies with the set restrictions. ...
size_t nodeNo() const
Returns the number of stored nodes.
static bool intersects(const Position &p11, const Position &p12, const Position &p21, const Position &p22)
return whether given lines intersect
A point in 2D or 3D with translation and scaling methods.
std::string getNextFreeID()
Returns the next free id.
static SUMOReal distancePointLine(const Position &point, const Position &lineStart, const Position &lineEnd)
int myNumNodes
Number of nodes to be created.
void setMaxNeighbours(SUMOReal value)
Sets this node's maximum neighbour number.
The class storing the generated network.
const Position & getPosition() const
Returns this node's position.
std::map< int, SUMOReal > myNeighbours
A map from neighbor number to their probabilities.
void removeOuterNode(NGNode *node)
Removes the given node from the list of outer nodes.
SUMOReal y() const
Returns the y-position.
NGEdgeList myOuterLinks
The list of outer links.
SUMOReal myMinDistance
Minimum distance allowed between two nodes.
void setY(SUMOReal y)
Sets a new value for y-position.
SUMOReal myMinLinkAngle
Minimum angle allowed between two links.
A netgen-representation of a node.
bool createNewNode(NGNode *baseNode)
Creates new random node.
NGRandomNetBuilder(NGNet &net, SUMOReal minAngle, SUMOReal minDistance, SUMOReal maxDistance, SUMOReal connectivity, int numTries, const TNeighbourDistribution &neighborDist)
Constructor.
int myNumTries
Number of tries to create a new node.
NGEdgeList LinkList
List of connected links.
void add(NGNode *node)
Adds the given node to the network.
NGNet & myNet
The network to fill.