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();
144 bool connectable =
true;
165 NGEdgeList::iterator li;
169 const NGNode*
const start = (*li)->getStartNode();
170 const NGNode*
const end = (*li)->getEndNode();
173 if ((baseNode != start) && (baseNode != end) && (newNode != start) && (newNode != end)) {
174 connectable = !n.intersects(p1, p2);
177 if (connectable && (newNode != start) && (newNode != end)) {
197 NGNodeList::iterator ni;
202 ((on)->getMaxNeighbours() > (on)->LinkList.size())) {
static SUMOReal angle2D(const Position &p1, const Position &p2)
Returns the angle between two vectors on a plane The angle is from vector 1 to vector 2...
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.
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 nodeNo() const
Returns the number of stored nodes.
int num()
Get random number of neighbours.
bool checkAngles(NGNode *node)
Checks whether the angle of this node's connections are valid.
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. ...
SUMOReal distanceTo2D(const Position &p2) const
returns the euclidean distance in the x-y-plane
A point in 2D or 3D with translation and scaling methods.
bool connected(NGNode *node) const
Returns whether the other node is connected.
std::string getNextFreeID()
Returns the next free id.
int myNumNodes
Number of nodes to be created.
SUMOReal x() const
Returns the x-position.
void setMaxNeighbours(SUMOReal value)
Sets this node's maximum neighbour number.
The class storing the generated network.
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.
NGEdgeList myOuterLinks
The list of outer links.
static SUMOReal nearest_offset_on_line_to_point2D(const Position &lineStart, const Position &lineEnd, const Position &p, bool perpendicular=true)
Position positionAtOffset2D(SUMOReal pos, SUMOReal lateralOffset=0) const
Returns the position at the given length.
const Position & getPosition() const
Returns this node's position.
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.
SUMOReal y() const
Returns the y-position.
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.
static const SUMOReal INVALID_OFFSET
a value to signify offsets outside the range of [0, Line.length()]
NGNet & myNet
The network to fill.