48 #ifdef CHECK_MEMORY_LEAKS
50 #endif // CHECK_MEMORY_LEAKS
81 if ((*ni)->samePos(xID, yID)) {
91 for (
int ix = 0; ix < numX; ix++) {
92 for (
int iy = 0; iy < numY; iy++) {
94 std::string nodeID = toString<int>(ix) +
"/" + toString<int>(iy);
96 node->
setX(ix * spaceX + attachLength);
97 node->
setY(iy * spaceY + attachLength);
108 if (attachLength > 0.0) {
109 for (
int ix = 0; ix < numX; ix++) {
111 NGNode* topNode =
new NGNode(
"top" + toString<int>(ix), ix, numY);
112 NGNode* bottomNode =
new NGNode(
"bottom" + toString<int>(ix), ix, numY + 1);
113 topNode->
setX(ix * spaceX + attachLength);
114 bottomNode->
setX(ix * spaceX + attachLength);
115 topNode->
setY((numY - 1) * spaceY + 2 * attachLength);
123 for (
int iy = 0; iy < numY; iy++) {
125 NGNode* leftNode =
new NGNode(
"left" + toString<int>(iy), numX, iy);
126 NGNode* rightNode =
new NGNode(
"right" + toString<int>(iy), numX + 1, iy);
128 rightNode->
setX((numX - 1) * spaceX + 2 * attachLength);
129 leftNode->
setY(iy * spaceY + attachLength);
130 rightNode->
setY(iy * spaceY + attachLength);
143 return cos(phi) * radius;
149 return sin(phi) * radius;
158 if (numCircles < 1) {
165 for (ir = 1; ir < numRadDiv + 1; ir++) {
166 for (ic = 1; ic < numCircles + 1; ic++) {
169 toString<int>(ir) +
"/" + toString<int>(ic), ir, ic);
180 if (ir == numRadDiv) {
192 for (ir = 1; ir < numRadDiv + 1; ir++) {
201 std::string id1 = node1->
getID() +
"to" + node2->
getID();
202 std::string id2 = node2->
getID() +
"to" + node1->
getID();
212 std::vector<NBNode*> nodes;
215 nodes.push_back(node);
224 for (std::vector<NBNode*>::const_iterator i = nodes.begin(); i != nodes.end(); ++i) {
227 for (EdgeVector::const_iterator j = incoming.begin(); j != incoming.end(); ++j) {
229 NBEdge* back =
new NBEdge(
"-" + (*j)->getID(), node, (*j)->getFromNode(),
NBNetBuilder & myNetBuilder
The builder used to build NB*-structures.
NGNet(NBNetBuilder &nb)
Constructor.
const EdgeVector & getIncomingEdges() const
Returns this node's incoming edges.
void setX(SUMOReal x)
Sets a new value for x-position.
NBTypeCont & getTypeCont()
Returns the type container.
A netgen-representation of an edge.
void connect(NGNode *node1, NGNode *node2)
Connects both nodes with two edges, one for each direction.
The representation of a single edge during network building.
NGNode * findNode(int xPos, int yPos)
Returns the node at the given position.
static SUMOReal rand()
Returns a random real number in [0, 1)
void toNB() const
Converts the stored network into its netbuilder-representation.
void createChequerBoard(int numX, int numY, SUMOReal spaceX, SUMOReal spaceY, SUMOReal attachLength)
Creates a grid network.
SUMOReal getFloat(const std::string &name) const
Returns the SUMOReal-value of the named option (only for Option_Float)
static const SUMOReal UNSPECIFIED_OFFSET
unspecified lane offset
SUMOReal getWidth(const std::string &type) const
Returns the lane width for the given type [m/s].
NGEdgeList myEdgeList
The list of links.
static OptionsCont & getOptions()
Retrieves the options.
void createSpiderWeb(int numRadDiv, int numCircles, SUMOReal spaceRad, bool hasCenter)
Creates a spider network.
SUMOReal radialToX(SUMOReal radius, SUMOReal phi)
Returns the x-position resulting from the given radius and angle.
const std::string & getID() const
Returns the id.
size_t nodeNo() const
Returns the number of stored nodes.
SUMOReal getSpeed(const std::string &type) const
Returns the maximal velocity for the given type [m/s].
bool insert(NBEdge *edge, bool ignorePrunning=false)
Adds an edge to the dictionary.
SUMOReal radialToY(SUMOReal radius, SUMOReal phi)
Returns the y-position resulting from the given radius and angle.
int getNumLanes(const std::string &type) const
Returns the number of lanes for the given type.
NBEdgeCont & getEdgeCont()
Returns the edge container.
std::string getNextFreeID()
Returns the next free id.
NGNodeList myNodeList
The list of nodes.
int getPriority(const std::string &type) const
Returns the priority for the given type.
NBEdge * getConnectionTo(NBNode *n) const
NBNodeCont & getNodeCont()
Returns the node container.
int myLastID
The last ID given to node or link.
Instance responsible for building networks.
std::vector< NBEdge * > EdgeVector
bool insert(const std::string &id, const Position &position, NBDistrict *district=0)
Inserts a node into the map.
Represents a single node (junction) during network building.
void setY(SUMOReal y)
Sets a new value for y-position.
A netgen-representation of a node.
void add(NGNode *node)
Adds the given node to the network.