49 #ifdef CHECK_MEMORY_LEAKS
51 #endif // CHECK_MEMORY_LEAKS
82 if ((*ni)->samePos(xID, yID)) {
92 for (
int ix = 0; ix < numX; ix++) {
93 for (
int iy = 0; iy < numY; iy++) {
95 std::string nodeID = toString<int>(ix) +
"/" + toString<int>(iy);
100 node->
setX(ix * spaceX + attachLength);
101 node->
setY(iy * spaceY + attachLength);
112 if (attachLength > 0.0) {
113 for (
int ix = 0; ix < numX; ix++) {
115 NGNode* topNode =
new NGNode(
"top" + toString<int>(ix), ix, numY);
116 NGNode* bottomNode =
new NGNode(
"bottom" + toString<int>(ix), ix, numY + 1);
117 topNode->
setX(ix * spaceX + attachLength);
118 bottomNode->
setX(ix * spaceX + attachLength);
119 topNode->
setY((numY - 1) * spaceY + 2 * attachLength);
127 for (
int iy = 0; iy < numY; iy++) {
129 NGNode* leftNode =
new NGNode(
"left" + toString<int>(iy), numX, iy);
130 NGNode* rightNode =
new NGNode(
"right" + toString<int>(iy), numX + 1, iy);
132 rightNode->
setX((numX - 1) * spaceX + 2 * attachLength);
133 leftNode->
setY(iy * spaceY + attachLength);
134 rightNode->
setY(iy * spaceY + attachLength);
147 return cos(phi) * radius;
153 return sin(phi) * radius;
162 if (numCircles < 1) {
169 for (ir = 1; ir < numRadDiv + 1; ir++) {
170 for (ic = 1; ic < numCircles + 1; ic++) {
173 toString<int>(ir) +
"/" + toString<int>(ic), ir, ic);
184 if (ir == numRadDiv) {
196 for (ir = 1; ir < numRadDiv + 1; ir++) {
205 std::string id1 = node1->
getID() +
"to" + node2->
getID();
206 std::string id2 = node2->
getID() +
"to" + node1->
getID();
216 std::vector<NBNode*> nodes;
219 nodes.push_back(node);
228 for (std::vector<NBNode*>::const_iterator i = nodes.begin(); i != nodes.end(); ++i) {
231 for (EdgeVector::const_iterator j = incoming.begin(); j != incoming.end(); ++j) {
233 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.
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].
void createChequerBoard(int numX, int numY, SUMOReal spaceX, SUMOReal spaceY, SUMOReal attachLength, bool alphaIDs)
Creates a grid network.
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.
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.
std::string toString(const T &t, std::streamsize accuracy=OUTPUT_ACCURACY)
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.
int nodeNo() const
Returns the number of stored nodes.
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.