SUMO - Simulation of Urban MObility
NBAlgorithms_Ramps.cpp
Go to the documentation of this file.
1 /****************************************************************************/
9 // Algorithms for highway on-/off-ramps computation
10 /****************************************************************************/
11 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
12 // Copyright (C) 2012-2016 DLR (http://www.dlr.de/) and contributors
13 /****************************************************************************/
14 //
15 // This file is part of SUMO.
16 // SUMO is free software: you can redistribute it and/or modify
17 // it under the terms of the GNU General Public License as published by
18 // the Free Software Foundation, either version 3 of the License, or
19 // (at your option) any later version.
20 //
21 /****************************************************************************/
22 
23 
24 // ===========================================================================
25 // included modules
26 // ===========================================================================
27 #ifdef _MSC_VER
28 #include <windows_config.h>
29 #else
30 #include <config.h>
31 #endif
32 
33 #include <cassert>
36 #include <utils/common/ToString.h>
37 #include "NBNetBuilder.h"
38 #include "NBNodeCont.h"
39 #include "NBNode.h"
40 #include "NBEdge.h"
41 #include "NBAlgorithms_Ramps.h"
42 
43 #ifdef CHECK_MEMORY_LEAKS
44 #include <foreign/nvwa/debug_new.h>
45 #endif // CHECK_MEMORY_LEAKS
46 
47 
48 // ===========================================================================
49 // static members
50 // ===========================================================================
51 const std::string NBRampsComputer::ADDED_ON_RAMP_EDGE("-AddedOnRampEdge");
52 
53 // ===========================================================================
54 // method definitions
55 // ===========================================================================
56 // ---------------------------------------------------------------------------
57 // NBRampsComputer
58 // ---------------------------------------------------------------------------
59 void
61  SUMOReal minHighwaySpeed = oc.getFloat("ramps.min-highway-speed");
62  SUMOReal maxRampSpeed = oc.getFloat("ramps.max-ramp-speed");
63  SUMOReal rampLength = oc.getFloat("ramps.ramp-length");
64  bool dontSplit = oc.getBool("ramps.no-split");
65  std::set<NBEdge*> incremented;
66  // check whether on-off ramps shall be guessed
67  if (oc.getBool("ramps.guess")) {
68  NBNodeCont& nc = nb.getNodeCont();
69  NBEdgeCont& ec = nb.getEdgeCont();
71  // collect join exclusions
72  std::set<std::string> noramps;
73  if (oc.isSet("ramps.unset")) {
74  std::vector<std::string> edges = oc.getStringVector("ramps.unset");
75  noramps.insert(edges.begin(), edges.end());
76  }
77  // exclude roundabouts
78  const std::set<EdgeSet>& roundabouts = ec.getRoundabouts();
79  for (std::set<EdgeSet>::const_iterator it_round = roundabouts.begin();
80  it_round != roundabouts.end(); ++it_round) {
81  for (EdgeSet::const_iterator it_edge = it_round->begin(); it_edge != it_round->end(); ++it_edge) {
82  noramps.insert((*it_edge)->getID());
83  }
84  }
85  // if an edge is part of two ramps, ordering is important
86  std::set<NBNode*, Named::ComparatorIdLess> potOnRamps;
87  std::set<NBNode*, Named::ComparatorIdLess> potOffRamps;
88  for (std::map<std::string, NBNode*>::const_iterator i = nc.begin(); i != nc.end(); ++i) {
89  NBNode* cur = (*i).second;
90  if (mayNeedOnRamp(cur, minHighwaySpeed, maxRampSpeed, noramps)) {
91  potOnRamps.insert(cur);
92  }
93  if (mayNeedOffRamp(cur, minHighwaySpeed, maxRampSpeed, noramps)) {
94  potOffRamps.insert(cur);
95  }
96  }
97  for (std::set<NBNode*, Named::ComparatorIdLess>::const_iterator i = potOnRamps.begin(); i != potOnRamps.end(); ++i) {
98  buildOnRamp(*i, nc, ec, dc, rampLength, dontSplit);
99  }
100  for (std::set<NBNode*, Named::ComparatorIdLess>::const_iterator i = potOffRamps.begin(); i != potOffRamps.end(); ++i) {
101  buildOffRamp(*i, nc, ec, dc, rampLength, dontSplit);
102  }
103  }
104  // check whether on-off ramps are specified
105  if (oc.isSet("ramps.set")) {
106  std::vector<std::string> edges = oc.getStringVector("ramps.set");
107  NBNodeCont& nc = nb.getNodeCont();
108  NBEdgeCont& ec = nb.getEdgeCont();
109  NBDistrictCont& dc = nb.getDistrictCont();
110  for (std::vector<std::string>::iterator i = edges.begin(); i != edges.end(); ++i) {
111  NBEdge* e = ec.retrieve(*i);
112  if (e == 0) {
113  WRITE_WARNING("Can not build on ramp on edge '" + *i + "' - the edge is not known.");
114  continue;
115  }
116  NBNode* from = e->getFromNode();
117  if (from->getIncomingEdges().size() == 2 && from->getOutgoingEdges().size() == 1) {
118  buildOnRamp(from, nc, ec, dc, rampLength, dontSplit);
119  }
120  // load edge again to check offramps
121  e = ec.retrieve(*i);
122  if (e == 0) {
123  WRITE_WARNING("Can not build off ramp on edge '" + *i + "' - the edge is not known.");
124  continue;
125  }
126  NBNode* to = e->getToNode();
127  if (to->getIncomingEdges().size() == 1 && to->getOutgoingEdges().size() == 2) {
128  buildOffRamp(to, nc, ec, dc, rampLength, dontSplit);
129  }
130  }
131  }
132 }
133 
134 
135 bool
136 NBRampsComputer::mayNeedOnRamp(NBNode* cur, SUMOReal minHighwaySpeed, SUMOReal maxRampSpeed, const std::set<std::string>& noramps) {
137  if (cur->getOutgoingEdges().size() != 1 || cur->getIncomingEdges().size() != 2) {
138  return false;
139  }
140  NBEdge* potHighway, *potRamp, *cont;
141  getOnRampEdges(cur, &potHighway, &potRamp, &cont);
142  // may be an on-ramp
143  return fulfillsRampConstraints(potHighway, potRamp, cont, minHighwaySpeed, maxRampSpeed, noramps);
144 }
145 
146 
147 bool
148 NBRampsComputer::mayNeedOffRamp(NBNode* cur, SUMOReal minHighwaySpeed, SUMOReal maxRampSpeed, const std::set<std::string>& noramps) {
149  if (cur->getIncomingEdges().size() != 1 || cur->getOutgoingEdges().size() != 2) {
150  return false;
151  }
152  // may be an off-ramp
153  NBEdge* potHighway, *potRamp, *prev;
154  getOffRampEdges(cur, &potHighway, &potRamp, &prev);
155  return fulfillsRampConstraints(potHighway, potRamp, prev, minHighwaySpeed, maxRampSpeed, noramps);
156 }
157 
158 
159 void
160 NBRampsComputer::buildOnRamp(NBNode* cur, NBNodeCont& nc, NBEdgeCont& ec, NBDistrictCont& dc, SUMOReal rampLength, bool dontSplit) {
161  NBEdge* potHighway, *potRamp, *cont;
162  getOnRampEdges(cur, &potHighway, &potRamp, &cont);
163  // compute the number of lanes to append
164  const int firstLaneNumber = cont->getNumLanes();
165  int toAdd = (potRamp->getNumLanes() + potHighway->getNumLanes()) - firstLaneNumber;
166  NBEdge* first = cont;
167  NBEdge* last = cont;
168  NBEdge* curr = cont;
169  std::set<NBEdge*> incremented;
170  if (toAdd > 0 && find(incremented.begin(), incremented.end(), cont) == incremented.end()) {
171  SUMOReal currLength = 0;
172  while (curr != 0 && currLength + curr->getGeometry().length() - POSITION_EPS < rampLength) {
173  if (find(incremented.begin(), incremented.end(), curr) == incremented.end()) {
174  curr->incLaneNo(toAdd);
175  if (curr->getStep() < NBEdge::LANES2LANES_USER) {
176  curr->invalidateConnections(true);
177  }
178  incremented.insert(curr);
179  moveRampRight(curr, toAdd);
180  currLength += curr->getGeometry().length(); // !!! loaded length?
181  last = curr;
182  }
183  NBNode* nextN = curr->getToNode();
184  if (nextN->getOutgoingEdges().size() == 1) {
185  curr = nextN->getOutgoingEdges()[0];
186  if (curr->getNumLanes() != firstLaneNumber) {
187  // the number of lanes changes along the computation; we'll stop...
188  curr = 0;
189  } else if (curr->isTurningDirectionAt(last)) {
190  // turnarounds certainly should not be included in a ramp
191  curr = 0;
192  } else if (curr == potHighway || curr == potRamp) {
193  // circular connectivity. do not split!
194  curr = 0;
195  }
196  } else {
197  // ambigous; and, in fact, what should it be? ...stop
198  curr = 0;
199  }
200  }
201  // check whether a further split is necessary
202  if (curr != 0 && !dontSplit && currLength - POSITION_EPS < rampLength && curr->getNumLanes() == firstLaneNumber && find(incremented.begin(), incremented.end(), curr) == incremented.end()) {
203  // there is enough place to build a ramp; do it
204  bool wasFirst = first == curr;
205  NBNode* rn = new NBNode(curr->getID() + "-AddedOnRampNode", curr->getGeometry().positionAtOffset(rampLength - currLength));
206  if (!nc.insert(rn)) {
207  throw ProcessError("Ups - could not build on-ramp for edge '" + curr->getID() + "' (node could not be build)!");
208  }
209  std::string name = curr->getID();
210  bool ok = ec.splitAt(dc, curr, rn, curr->getID() + ADDED_ON_RAMP_EDGE, curr->getID(), curr->getNumLanes() + toAdd, curr->getNumLanes());
211  if (!ok) {
212  WRITE_ERROR("Ups - could not build on-ramp for edge '" + curr->getID() + "'!");
213  return;
214  }
215  //ec.retrieve(name)->invalidateConnections();
216  curr = ec.retrieve(name + ADDED_ON_RAMP_EDGE);
217  incremented.insert(curr);
218  last = curr;
219  moveRampRight(curr, toAdd);
220  if (wasFirst) {
221  first = curr;
222  }
223  }
224  if (curr == cont && dontSplit) {
225  WRITE_WARNING("Could not build on-ramp for edge '" + curr->getID() + "' due to option '--ramps.no-split'");
226  return;
227  }
228  }
229  // set connections from ramp/highway to added ramp
230  if (potHighway->getStep() < NBEdge::LANES2LANES_USER) {
231  if (!potHighway->addLane2LaneConnections(0, first, potRamp->getNumLanes(), MIN2(first->getNumLanes() - potRamp->getNumLanes(), potHighway->getNumLanes()), NBEdge::L2L_VALIDATED, true, true)) {
232  throw ProcessError("Could not set connection!");
233  }
234  }
235  if (potRamp->getStep() < NBEdge::LANES2LANES_USER) {
236  if (!potRamp->addLane2LaneConnections(0, first, 0, potRamp->getNumLanes(), NBEdge::L2L_VALIDATED, true, true)) {
237  throw ProcessError("Could not set connection!");
238  }
239  }
240  // patch ramp geometry
241  PositionVector p = potRamp->getGeometry();
242  p.pop_back();
243  p.push_back(first->getLaneShape(0)[0]);
244  potRamp->setGeometry(p);
245 }
246 
247 
248 void
249 NBRampsComputer::buildOffRamp(NBNode* cur, NBNodeCont& nc, NBEdgeCont& ec, NBDistrictCont& dc, SUMOReal rampLength, bool dontSplit) {
250  NBEdge* potHighway, *potRamp, *prev;
251  getOffRampEdges(cur, &potHighway, &potRamp, &prev);
252  // compute the number of lanes to append
253  const int firstLaneNumber = prev->getNumLanes();
254  int toAdd = (potRamp->getNumLanes() + potHighway->getNumLanes()) - firstLaneNumber;
255  NBEdge* first = prev;
256  NBEdge* last = prev;
257  NBEdge* curr = prev;
258  std::set<NBEdge*> incremented;
259  if (toAdd > 0 && find(incremented.begin(), incremented.end(), prev) == incremented.end()) {
260  SUMOReal currLength = 0;
261  while (curr != 0 && currLength + curr->getGeometry().length() - POSITION_EPS < rampLength) {
262  if (find(incremented.begin(), incremented.end(), curr) == incremented.end()) {
263  curr->incLaneNo(toAdd);
264  if (curr->getStep() < NBEdge::LANES2LANES_USER) {
265  curr->invalidateConnections(true);
266  }
267  incremented.insert(curr);
268  moveRampRight(curr, toAdd);
269  currLength += curr->getGeometry().length(); // !!! loaded length?
270  last = curr;
271  }
272  NBNode* prevN = curr->getFromNode();
273  if (prevN->getIncomingEdges().size() == 1) {
274  curr = prevN->getIncomingEdges()[0];
275  if (curr->getStep() < NBEdge::LANES2LANES_USER && toAdd != 0) {
276  // curr might be an onRamp. In this case connections need to be rebuilt
277  curr->invalidateConnections();
278  }
279  if (curr->getNumLanes() != firstLaneNumber) {
280  // the number of lanes changes along the computation; we'll stop...
281  curr = 0;
282  } else if (last->isTurningDirectionAt(curr)) {
283  // turnarounds certainly should not be included in a ramp
284  curr = 0;
285  } else if (curr == potHighway || curr == potRamp) {
286  // circular connectivity. do not split!
287  curr = 0;
288  }
289  } else {
290  // ambigous; and, in fact, what should it be? ...stop
291  curr = 0;
292  }
293  }
294  // check whether a further split is necessary
295  if (curr != 0 && !dontSplit && currLength - POSITION_EPS < rampLength && curr->getNumLanes() == firstLaneNumber && find(incremented.begin(), incremented.end(), curr) == incremented.end()) {
296  // there is enough place to build a ramp; do it
297  bool wasFirst = first == curr;
298  Position pos = curr->getGeometry().positionAtOffset(curr->getGeometry().length() - (rampLength - currLength));
299  NBNode* rn = new NBNode(curr->getID() + "-AddedOffRampNode", pos);
300  if (!nc.insert(rn)) {
301  throw ProcessError("Ups - could not build off-ramp for edge '" + curr->getID() + "' (node could not be build)!");
302  }
303  std::string name = curr->getID();
304  bool ok = ec.splitAt(dc, curr, rn, curr->getID(), curr->getID() + "-AddedOffRampEdge", curr->getNumLanes(), curr->getNumLanes() + toAdd);
305  if (!ok) {
306  WRITE_ERROR("Ups - could not build off-ramp for edge '" + curr->getID() + "'!");
307  return;
308  }
309  curr = ec.retrieve(name + "-AddedOffRampEdge");
310  incremented.insert(curr);
311  last = curr;
312  moveRampRight(curr, toAdd);
313  if (wasFirst) {
314  first = curr;
315  }
316  }
317  if (curr == prev && dontSplit) {
318  WRITE_WARNING("Could not build off-ramp for edge '" + curr->getID() + "' due to option '--ramps.no-split'");
319  return;
320  }
321  }
322  // set connections from added ramp to ramp/highway
323  if (first->getStep() < NBEdge::LANES2LANES_USER) {
324  if (!first->addLane2LaneConnections(potRamp->getNumLanes(), potHighway, 0, MIN2(first->getNumLanes() - 1, potHighway->getNumLanes()), NBEdge::L2L_VALIDATED, true)) {
325  throw ProcessError("Could not set connection!");
326  }
327  if (!first->addLane2LaneConnections(0, potRamp, 0, potRamp->getNumLanes(), NBEdge::L2L_VALIDATED, false)) {
328  throw ProcessError("Could not set connection!");
329  }
330  }
331  // patch ramp geometry
332  PositionVector p = potRamp->getGeometry();
333  p[0] = first->getLaneShape(0)[-1];
334  potRamp->setGeometry(p);
335 }
336 
337 
338 void
339 NBRampsComputer::moveRampRight(NBEdge* ramp, int addedLanes) {
340  if (ramp->getLaneSpreadFunction() != LANESPREAD_CENTER) {
341  return;
342  }
343  try {
344  PositionVector g = ramp->getGeometry();
345  const SUMOReal offset = (0.5 * addedLanes *
347  g.move2side(offset);
348  ramp->setGeometry(g);
349  } catch (InvalidArgument&) {
350  WRITE_WARNING("For edge '" + ramp->getID() + "': could not compute shape.");
351  }
352 }
353 
354 
355 bool
357  if (fabs((*potHighway)->getSpeed() - (*potRamp)->getSpeed()) < .1) {
358  return false;
359  }
360  if ((*potHighway)->getSpeed() < (*potRamp)->getSpeed()) {
361  std::swap(*potHighway, *potRamp);
362  }
363  return true;
364 }
365 
366 
367 bool
369  if ((*potHighway)->getNumLanes() == (*potRamp)->getNumLanes()) {
370  return false;
371  }
372  if ((*potHighway)->getNumLanes() < (*potRamp)->getNumLanes()) {
373  std::swap(*potHighway, *potRamp);
374  }
375  return true;
376 }
377 
378 
379 void
380 NBRampsComputer::getOnRampEdges(NBNode* n, NBEdge** potHighway, NBEdge** potRamp, NBEdge** other) {
381  *other = n->getOutgoingEdges()[0];
382  const std::vector<NBEdge*>& edges = n->getIncomingEdges();
383  assert(edges.size() == 2);
384  *potHighway = edges[0];
385  *potRamp = edges[1];
386  /*
387  // heuristic: highway is faster than ramp
388  if(determinedBySpeed(potHighway, potRamp)) {
389  return;
390  }
391  // heuristic: highway has more lanes than ramp
392  if(determinedByLaneNumber(potHighway, potRamp)) {
393  return;
394  }
395  */
396  // heuristic: ramp comes from right
397  const std::vector<NBEdge*>& edges2 = n->getEdges();
398  std::vector<NBEdge*>::const_iterator i = std::find(edges2.begin(), edges2.end(), *other);
399  NBContHelper::nextCW(edges2, i);
400  if ((*i) == *potHighway) {
401  std::swap(*potHighway, *potRamp);
402  }
403 }
404 
405 
406 void
407 NBRampsComputer::getOffRampEdges(NBNode* n, NBEdge** potHighway, NBEdge** potRamp, NBEdge** other) {
408  *other = n->getIncomingEdges()[0];
409  const std::vector<NBEdge*>& edges = n->getOutgoingEdges();
410  *potHighway = edges[0];
411  *potRamp = edges[1];
412  assert(edges.size() == 2);
413  /*
414  // heuristic: highway is faster than ramp
415  if(determinedBySpeed(potHighway, potRamp)) {
416  return;
417  }
418  // heuristic: highway has more lanes than ramp
419  if(determinedByLaneNumber(potHighway, potRamp)) {
420  return;
421  }
422  */
423  // heuristic: ramp goes to right
424  const std::vector<NBEdge*>& edges2 = n->getEdges();
425  std::vector<NBEdge*>::const_iterator i = std::find(edges2.begin(), edges2.end(), *other);
426  NBContHelper::nextCW(edges2, i);
427  if ((*i) == *potRamp) {
428  std::swap(*potHighway, *potRamp);
429  }
430 }
431 
432 
433 bool
435  NBEdge* potHighway, NBEdge* potRamp, NBEdge* other, SUMOReal minHighwaySpeed, SUMOReal maxRampSpeed,
436  const std::set<std::string>& noramps) {
437  // check modes that are not appropriate for rampsdo not build ramps on rail edges
438  if (hasWrongMode(potHighway) || hasWrongMode(potRamp) || hasWrongMode(other)) {
439  return false;
440  }
441  // do not build ramps on connectors
442  if (potHighway->isMacroscopicConnector() || potRamp->isMacroscopicConnector() || other->isMacroscopicConnector()) {
443  return false;
444  }
445  // check whether a lane is missing
446  if (potHighway->getNumLanes() + potRamp->getNumLanes() <= other->getNumLanes()) {
447  return false;
448  }
449  // is it really a highway?
450  SUMOReal maxSpeed = MAX3(potHighway->getSpeed(), other->getSpeed(), potRamp->getSpeed());
451  if (maxSpeed < minHighwaySpeed) {
452  return false;
453  }
454  // is any of the connections a turnaround?
455  if (other->getToNode() == potHighway->getFromNode()) {
456  // off ramp
457  if (other->isTurningDirectionAt(potHighway) ||
458  other->isTurningDirectionAt(potRamp)) {
459  return false;
460  }
461  } else {
462  // on ramp
463  if (other->isTurningDirectionAt(potHighway) ||
464  other->isTurningDirectionAt(potRamp)) {
465  return false;
466  }
467  }
468  /*
469  if (potHighway->getSpeed() < minHighwaySpeed || other->getSpeed() < minHighwaySpeed) {
470  return false;
471  }
472  */
473  // is it really a ramp?
474  if (maxRampSpeed > 0 && maxRampSpeed < potRamp->getSpeed()) {
475  return false;
476  }
477  if (noramps.find(other->getID()) != noramps.end()) {
478  return false;
479  }
480  return true;
481 }
482 
483 
484 bool
486  // must allow passenger vehicles
487  if ((edge->getPermissions() & SVC_PASSENGER) == 0) {
488  return true;
489  }
490  // must not have a green verge or a lane that is only for soft modes
491  for (int i = 0; i < (int)edge->getNumLanes(); ++i) {
492  if ((edge->getPermissions(i) & ~(SVC_PEDESTRIAN | SVC_BICYCLE)) == 0) {
493  return true;
494  }
495  }
496  return false;
497 }
498 
499 /****************************************************************************/
500 
void invalidateConnections(bool reallowSetting=false)
Definition: NBEdge.cpp:962
std::vector< std::string > getStringVector(const std::string &name) const
Returns the list of string-vector-value of the named option (only for Option_String) ...
const EdgeVector & getIncomingEdges() const
Returns this node&#39;s incoming edges.
Definition: NBNode.h:240
static const SUMOReal UNSPECIFIED_WIDTH
unspecified lane width
Definition: NBEdge.h:203
const SUMOReal SUMO_const_laneWidth
Definition: StdDefs.h:49
is a pedestrian
static bool determinedBySpeed(NBEdge **potHighway, NBEdge **potRamp)
const std::set< EdgeSet > getRoundabouts() const
Returns the determined roundabouts.
Definition: NBEdgeCont.cpp:988
static bool fulfillsRampConstraints(NBEdge *potHighway, NBEdge *potRamp, NBEdge *other, SUMOReal minHighwaySpeed, SUMOReal maxRampSpeed, const std::set< std::string > &noramps)
Checks whether an on-/off-ramp can be bult here.
vehicle is a bicycle
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
The representation of a single edge during network building.
Definition: NBEdge.h:70
A container for districts.
SUMOReal getLaneWidth() const
Returns the default width of lanes of this edge.
Definition: NBEdge.h:469
bool splitAt(NBDistrictCont &dc, NBEdge *edge, NBNode *node)
Splits the edge at the position nearest to the given node.
Definition: NBEdgeCont.cpp:412
static void moveRampRight(NBEdge *ramp, int addedLanes)
Moves the ramp to the right, as new lanes were added.
SUMOReal getFloat(const std::string &name) const
Returns the SUMOReal-value of the named option (only for Option_Float)
static void nextCW(const EdgeVector &edges, EdgeVector::const_iterator &from)
void setGeometry(const PositionVector &g, bool inner=false)
(Re)sets the edge&#39;s geometry
Definition: NBEdge.cpp:449
T MAX3(T a, T b, T c)
Definition: StdDefs.h:89
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:200
The connection was computed and validated.
Definition: NBEdge.h:115
static bool determinedByLaneNumber(NBEdge **potHighway, NBEdge **potRamp)
static const std::string ADDED_ON_RAMP_EDGE
suffix for newly generated on-ramp edges
const EdgeVector & getOutgoingEdges() const
Returns this node&#39;s outgoing edges.
Definition: NBNode.h:248
const std::string & getID() const
Returns the id.
Definition: Named.h:66
void incLaneNo(int by)
Definition: NBEdge.cpp:2392
Lanes to lanes - relationships are loaded; no recheck is necessary/wished.
Definition: NBEdge.h:102
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:46
NBEdgeCont & getEdgeCont()
Returns the edge container.
Definition: NBNetBuilder.h:153
A list of positions.
bool addLane2LaneConnections(int fromLane, NBEdge *dest, int toLane, int no, Lane2LaneInfoType type, bool invalidatePrevious=false, bool mayDefinitelyPass=false)
Builds no connections starting at the given lanes.
Definition: NBEdge.cpp:720
static void buildOnRamp(NBNode *cur, NBNodeCont &nc, NBEdgeCont &ec, NBDistrictCont &dc, SUMOReal rampLength, bool dontSplit)
Builds an on-ramp starting at the given node.
int getNumLanes() const
Returns the number of lanes.
Definition: NBEdge.h:347
EdgeBuildingStep getStep() const
The building step of this edge.
Definition: NBEdge.h:461
bool isTurningDirectionAt(const NBEdge *const edge) const
Returns whether the given edge is the opposite direction to this edge.
Definition: NBEdge.cpp:2038
Position positionAtOffset(SUMOReal pos, SUMOReal lateralOffset=0) const
Returns the position at the given length.
const EdgeVector & getEdges() const
Returns all edges which participate in this node.
Definition: NBNode.h:256
Storage for edges, including some functionality operating on multiple edges.
Definition: NBEdgeCont.h:66
T MIN2(T a, T b)
Definition: StdDefs.h:69
#define POSITION_EPS
Definition: config.h:187
std::map< std::string, NBNode * >::const_iterator end() const
Returns the pointer to the end of the stored nodes.
Definition: NBNodeCont.h:134
vehicle is a passenger car (a "normal" car)
#define WRITE_ERROR(msg)
Definition: MsgHandler.h:206
SVCPermissions getPermissions(int lane=-1) const
get the union of allowed classes over all lanes or for a specific lane
Definition: NBEdge.cpp:2575
SUMOReal length() const
Returns the length.
static bool mayNeedOnRamp(NBNode *cur, SUMOReal minHighwaySpeed, SUMOReal maxRampSpeed, const std::set< std::string > &noramps)
Determines whether the given node may be an on-ramp begin.
NBNode * getToNode() const
Returns the destination node of the edge.
Definition: NBEdge.h:371
static void computeRamps(NBNetBuilder &nb, OptionsCont &oc)
Computes highway on-/off-ramps (if wished)
static bool mayNeedOffRamp(NBNode *cur, SUMOReal minHighwaySpeed, SUMOReal maxRampSpeed, const std::set< std::string > &noramps)
Determines whether the given node may be an off-ramp end.
NBEdge * retrieve(const std::string &id, bool retrieveExtracted=false) const
Returns the edge that has the given id.
Definition: NBEdgeCont.cpp:247
static void getOffRampEdges(NBNode *n, NBEdge **potHighway, NBEdge **potRamp, NBEdge **other)
NBNodeCont & getNodeCont()
Returns the node container.
Definition: NBNetBuilder.h:161
Instance responsible for building networks.
Definition: NBNetBuilder.h:112
const PositionVector & getGeometry() const
Returns the geometry of the edge.
Definition: NBEdge.h:546
bool isMacroscopicConnector() const
Returns whether this edge was marked as a macroscopic connector.
Definition: NBEdge.h:884
A storage for options typed value containers)
Definition: OptionsCont.h:99
bool insert(const std::string &id, const Position &position, NBDistrict *district=0)
Inserts a node into the map.
Definition: NBNodeCont.cpp:81
LaneSpreadFunction getLaneSpreadFunction() const
Returns how this edge&#39;s lanes&#39; lateral offset is computed.
Definition: NBEdge.h:626
Represents a single node (junction) during network building.
Definition: NBNode.h:74
static void getOnRampEdges(NBNode *n, NBEdge **potHighway, NBEdge **potRamp, NBEdge **other)
void move2side(SUMOReal amount)
move position vector to side using certain ammount
#define SUMOReal
Definition: config.h:213
static bool hasWrongMode(NBEdge *edge)
whether the edge has a mode that does not indicate a ramp edge
SUMOReal getSpeed() const
Returns the speed allowed on this edge.
Definition: NBEdge.h:451
Container for nodes during the netbuilding process.
Definition: NBNodeCont.h:63
static void buildOffRamp(NBNode *cur, NBNodeCont &nc, NBEdgeCont &ec, NBDistrictCont &dc, SUMOReal rampLength, bool dontSplit)
Builds an off-ramp ending at the given node.
NBDistrictCont & getDistrictCont()
Returns the districts container.
Definition: NBNetBuilder.h:185
std::map< std::string, NBNode * >::const_iterator begin() const
Returns the pointer to the begin of the stored nodes.
Definition: NBNodeCont.h:126
const PositionVector & getLaneShape(int i) const
Returns the shape of the nth lane.
Definition: NBEdge.cpp:554
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.
NBNode * getFromNode() const
Returns the origin node of the edge.
Definition: NBEdge.h:363