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-2015 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, incremented);
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, incremented);
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, incremented);
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, incremented);
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, std::set<NBEdge*>& incremented) {
161  NBEdge* potHighway, *potRamp, *cont;
162  getOnRampEdges(cur, &potHighway, &potRamp, &cont);
163  // compute the number of lanes to append
164  const unsigned 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  if (toAdd > 0 && find(incremented.begin(), incremented.end(), cont) == incremented.end()) {
170  SUMOReal currLength = 0;
171  while (curr != 0 && currLength + curr->getGeometry().length() - POSITION_EPS < rampLength) {
172  if (find(incremented.begin(), incremented.end(), curr) == incremented.end()) {
173  curr->incLaneNo(toAdd);
174  curr->invalidateConnections(true);
175  incremented.insert(curr);
176  moveRampRight(curr, toAdd);
177  currLength += curr->getGeometry().length(); // !!! loaded length?
178  last = curr;
179  }
180  NBNode* nextN = curr->getToNode();
181  if (nextN->getOutgoingEdges().size() == 1) {
182  curr = nextN->getOutgoingEdges()[0];
183  if (curr->getNumLanes() != firstLaneNumber) {
184  // the number of lanes changes along the computation; we'll stop...
185  curr = 0;
186  } else if (curr->isTurningDirectionAt(last)) {
187  // turnarounds certainly should not be included in a ramp
188  curr = 0;
189  } else if (curr == potHighway || curr == potRamp) {
190  // circular connectivity. do not split!
191  curr = 0;
192  }
193  } else {
194  // ambigous; and, in fact, what should it be? ...stop
195  curr = 0;
196  }
197  }
198  // check whether a further split is necessary
199  if (curr != 0 && !dontSplit && currLength - POSITION_EPS < rampLength && curr->getNumLanes() == firstLaneNumber && find(incremented.begin(), incremented.end(), curr) == incremented.end()) {
200  // there is enough place to build a ramp; do it
201  bool wasFirst = first == curr;
202  NBNode* rn = new NBNode(curr->getID() + "-AddedOnRampNode", curr->getGeometry().positionAtOffset(rampLength - currLength));
203  if (!nc.insert(rn)) {
204  throw ProcessError("Ups - could not build on-ramp for edge '" + curr->getID() + "' (node could not be build)!");
205  }
206  std::string name = curr->getID();
207  bool ok = ec.splitAt(dc, curr, rn, curr->getID() + ADDED_ON_RAMP_EDGE, curr->getID(), curr->getNumLanes() + toAdd, curr->getNumLanes());
208  if (!ok) {
209  WRITE_ERROR("Ups - could not build on-ramp for edge '" + curr->getID() + "'!");
210  return;
211  }
212  //ec.retrieve(name)->invalidateConnections();
213  curr = ec.retrieve(name + ADDED_ON_RAMP_EDGE);
214  incremented.insert(curr);
215  last = curr;
216  moveRampRight(curr, toAdd);
217  if (wasFirst) {
218  first = curr;
219  }
220  }
221  if (curr == cont && dontSplit) {
222  WRITE_WARNING("Could not build on-ramp for edge '" + curr->getID() + "' due to option '--ramps.no-split'");
223  return;
224  }
225  }
226  // set connections from ramp/highway to added ramp
227  if (!potHighway->addLane2LaneConnections(0, first, potRamp->getNumLanes(), MIN2(first->getNumLanes() - potRamp->getNumLanes(), potHighway->getNumLanes()), NBEdge::L2L_VALIDATED, true, true)) {
228  throw ProcessError("Could not set connection!");
229  }
230  if (!potRamp->addLane2LaneConnections(0, first, 0, potRamp->getNumLanes(), NBEdge::L2L_VALIDATED, true, true)) {
231  throw ProcessError("Could not set connection!");
232  }
233  // patch ramp geometry
234  PositionVector p = potRamp->getGeometry();
235  p.pop_back();
236  p.push_back(first->getLaneShape(0)[0]);
237  potRamp->setGeometry(p);
238 }
239 
240 
241 void
242 NBRampsComputer::buildOffRamp(NBNode* cur, NBNodeCont& nc, NBEdgeCont& ec, NBDistrictCont& dc, SUMOReal rampLength, bool dontSplit, std::set<NBEdge*>& incremented) {
243  NBEdge* potHighway, *potRamp, *prev;
244  getOffRampEdges(cur, &potHighway, &potRamp, &prev);
245  // compute the number of lanes to append
246  const unsigned int firstLaneNumber = prev->getNumLanes();
247  int toAdd = (potRamp->getNumLanes() + potHighway->getNumLanes()) - firstLaneNumber;
248  NBEdge* first = prev;
249  NBEdge* last = prev;
250  NBEdge* curr = prev;
251  if (toAdd > 0 && find(incremented.begin(), incremented.end(), prev) == incremented.end()) {
252  SUMOReal currLength = 0;
253  while (curr != 0 && currLength + curr->getGeometry().length() - POSITION_EPS < rampLength) {
254  if (find(incremented.begin(), incremented.end(), curr) == incremented.end()) {
255  curr->incLaneNo(toAdd);
256  curr->invalidateConnections(true);
257  incremented.insert(curr);
258  moveRampRight(curr, toAdd);
259  currLength += curr->getGeometry().length(); // !!! loaded length?
260  last = curr;
261  }
262  NBNode* prevN = curr->getFromNode();
263  if (prevN->getIncomingEdges().size() == 1) {
264  curr = prevN->getIncomingEdges()[0];
265  if (curr->getNumLanes() != firstLaneNumber) {
266  // the number of lanes changes along the computation; we'll stop...
267  curr = 0;
268  } else if (last->isTurningDirectionAt(curr)) {
269  // turnarounds certainly should not be included in a ramp
270  curr = 0;
271  } else if (curr == potHighway || curr == potRamp) {
272  // circular connectivity. do not split!
273  curr = 0;
274  }
275  } else {
276  // ambigous; and, in fact, what should it be? ...stop
277  curr = 0;
278  }
279  }
280  // check whether a further split is necessary
281  if (curr != 0 && !dontSplit && currLength - POSITION_EPS < rampLength && curr->getNumLanes() == firstLaneNumber && find(incremented.begin(), incremented.end(), curr) == incremented.end()) {
282  // there is enough place to build a ramp; do it
283  bool wasFirst = first == curr;
284  Position pos = curr->getGeometry().positionAtOffset(curr->getGeometry().length() - (rampLength - currLength));
285  NBNode* rn = new NBNode(curr->getID() + "-AddedOffRampNode", pos);
286  if (!nc.insert(rn)) {
287  throw ProcessError("Ups - could not build off-ramp for edge '" + curr->getID() + "' (node could not be build)!");
288  }
289  std::string name = curr->getID();
290  bool ok = ec.splitAt(dc, curr, rn, curr->getID(), curr->getID() + "-AddedOffRampEdge", curr->getNumLanes(), curr->getNumLanes() + toAdd);
291  if (!ok) {
292  WRITE_ERROR("Ups - could not build off-ramp for edge '" + curr->getID() + "'!");
293  return;
294  }
295  curr = ec.retrieve(name + "-AddedOffRampEdge");
296  incremented.insert(curr);
297  last = curr;
298  moveRampRight(curr, toAdd);
299  if (wasFirst) {
300  first = curr;
301  }
302  }
303  if (curr == prev && dontSplit) {
304  WRITE_WARNING("Could not build off-ramp for edge '" + curr->getID() + "' due to option '--ramps.no-split'");
305  return;
306  }
307  }
308  // set connections from added ramp to ramp/highway
309  if (!first->addLane2LaneConnections(potRamp->getNumLanes(), potHighway, 0, MIN2(first->getNumLanes() - 1, potHighway->getNumLanes()), NBEdge::L2L_VALIDATED, true)) {
310  throw ProcessError("Could not set connection!");
311  }
312  if (!first->addLane2LaneConnections(0, potRamp, 0, potRamp->getNumLanes(), NBEdge::L2L_VALIDATED, false)) {
313  throw ProcessError("Could not set connection!");
314  }
315  // patch ramp geometry
316  PositionVector p = potRamp->getGeometry();
317  p[0] = first->getLaneShape(0)[-1];
318  potRamp->setGeometry(p);
319 }
320 
321 
322 void
323 NBRampsComputer::moveRampRight(NBEdge* ramp, int addedLanes) {
324  if (ramp->getLaneSpreadFunction() != LANESPREAD_CENTER) {
325  return;
326  }
327  try {
328  PositionVector g = ramp->getGeometry();
329  const SUMOReal offset = (0.5 * addedLanes *
331  g.move2side(offset);
332  ramp->setGeometry(g);
333  } catch (InvalidArgument&) {
334  WRITE_WARNING("For edge '" + ramp->getID() + "': could not compute shape.");
335  }
336 }
337 
338 
339 bool
341  if (fabs((*potHighway)->getSpeed() - (*potRamp)->getSpeed()) < .1) {
342  return false;
343  }
344  if ((*potHighway)->getSpeed() < (*potRamp)->getSpeed()) {
345  std::swap(*potHighway, *potRamp);
346  }
347  return true;
348 }
349 
350 
351 bool
353  if ((*potHighway)->getNumLanes() == (*potRamp)->getNumLanes()) {
354  return false;
355  }
356  if ((*potHighway)->getNumLanes() < (*potRamp)->getNumLanes()) {
357  std::swap(*potHighway, *potRamp);
358  }
359  return true;
360 }
361 
362 
363 void
364 NBRampsComputer::getOnRampEdges(NBNode* n, NBEdge** potHighway, NBEdge** potRamp, NBEdge** other) {
365  *other = n->getOutgoingEdges()[0];
366  const std::vector<NBEdge*>& edges = n->getIncomingEdges();
367  assert(edges.size() == 2);
368  *potHighway = edges[0];
369  *potRamp = edges[1];
370  /*
371  // heuristic: highway is faster than ramp
372  if(determinedBySpeed(potHighway, potRamp)) {
373  return;
374  }
375  // heuristic: highway has more lanes than ramp
376  if(determinedByLaneNumber(potHighway, potRamp)) {
377  return;
378  }
379  */
380  // heuristic: ramp comes from right
381  const std::vector<NBEdge*>& edges2 = n->getEdges();
382  std::vector<NBEdge*>::const_iterator i = std::find(edges2.begin(), edges2.end(), *other);
383  NBContHelper::nextCW(edges2, i);
384  if ((*i) == *potHighway) {
385  std::swap(*potHighway, *potRamp);
386  }
387 }
388 
389 
390 void
391 NBRampsComputer::getOffRampEdges(NBNode* n, NBEdge** potHighway, NBEdge** potRamp, NBEdge** other) {
392  *other = n->getIncomingEdges()[0];
393  const std::vector<NBEdge*>& edges = n->getOutgoingEdges();
394  *potHighway = edges[0];
395  *potRamp = edges[1];
396  assert(edges.size() == 2);
397  /*
398  // heuristic: highway is faster than ramp
399  if(determinedBySpeed(potHighway, potRamp)) {
400  return;
401  }
402  // heuristic: highway has more lanes than ramp
403  if(determinedByLaneNumber(potHighway, potRamp)) {
404  return;
405  }
406  */
407  // heuristic: ramp goes to right
408  const std::vector<NBEdge*>& edges2 = n->getEdges();
409  std::vector<NBEdge*>::const_iterator i = std::find(edges2.begin(), edges2.end(), *other);
410  NBContHelper::nextCW(edges2, i);
411  if ((*i) == *potRamp) {
412  std::swap(*potHighway, *potRamp);
413  }
414 }
415 
416 
417 bool
419  NBEdge* potHighway, NBEdge* potRamp, NBEdge* other, SUMOReal minHighwaySpeed, SUMOReal maxRampSpeed,
420  const std::set<std::string>& noramps) {
421  // check modes that are not appropriate for rampsdo not build ramps on rail edges
422  if (hasWrongMode(potHighway) || hasWrongMode(potRamp) || hasWrongMode(other)) {
423  return false;
424  }
425  // do not build ramps on connectors
426  if (potHighway->isMacroscopicConnector() || potRamp->isMacroscopicConnector() || other->isMacroscopicConnector()) {
427  return false;
428  }
429  // check whether a lane is missing
430  if (potHighway->getNumLanes() + potRamp->getNumLanes() <= other->getNumLanes()) {
431  return false;
432  }
433  // is it really a highway?
434  SUMOReal maxSpeed = MAX3(potHighway->getSpeed(), other->getSpeed(), potRamp->getSpeed());
435  if (maxSpeed < minHighwaySpeed) {
436  return false;
437  }
438  // is any of the connections a turnaround?
439  if (other->getToNode() == potHighway->getFromNode()) {
440  // off ramp
441  if (other->isTurningDirectionAt(potHighway) ||
442  other->isTurningDirectionAt(potRamp)) {
443  return false;
444  }
445  } else {
446  // on ramp
447  if (other->isTurningDirectionAt(potHighway) ||
448  other->isTurningDirectionAt(potRamp)) {
449  return false;
450  }
451  }
452  /*
453  if (potHighway->getSpeed() < minHighwaySpeed || other->getSpeed() < minHighwaySpeed) {
454  return false;
455  }
456  */
457  // is it really a ramp?
458  if (maxRampSpeed > 0 && maxRampSpeed < potRamp->getSpeed()) {
459  return false;
460  }
461  if (noramps.find(other->getID()) != noramps.end()) {
462  return false;
463  }
464  return true;
465 }
466 
467 
468 bool
470  // must allow passenger vehicles
471  if ((edge->getPermissions() & SVC_PASSENGER) == 0) {
472  return true;
473  }
474  // must not have a green verge or a lane that is only for soft modes
475  for (int i = 0; i < (int)edge->getNumLanes(); ++i) {
476  if ((edge->getPermissions(i) & ~(SVC_PEDESTRIAN | SVC_BICYCLE)) == 0) {
477  return true;
478  }
479  }
480  return false;
481 }
482 
483 /****************************************************************************/
484 
void invalidateConnections(bool reallowSetting=false)
Definition: NBEdge.cpp:943
const PositionVector & getLaneShape(unsigned int i) const
Returns the shape of the nth lane.
Definition: NBEdge.cpp:532
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:201
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:933
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
void incLaneNo(unsigned int by)
Definition: NBEdge.cpp:2179
A container for districts.
bool addLane2LaneConnections(unsigned int fromLane, NBEdge *dest, unsigned int toLane, unsigned int no, Lane2LaneInfoType type, bool invalidatePrevious=false, bool mayDefinitelyPass=false)
Builds no connections starting at the given lanes.
Definition: NBEdge.cpp:699
SUMOReal getLaneWidth() const
Returns the default width of lanes of this edge.
Definition: NBEdge.h:447
bool splitAt(NBDistrictCont &dc, NBEdge *edge, NBNode *node)
Splits the edge at the position nearest to the given node.
Definition: NBEdgeCont.cpp:411
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:427
T MAX3(T a, T b, T c)
Definition: StdDefs.h:93
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:200
static void buildOnRamp(NBNode *cur, NBNodeCont &nc, NBEdgeCont &ec, NBDistrictCont &dc, SUMOReal rampLength, bool dontSplit, std::set< NBEdge * > &incremented)
Builds an on-ramp starting at the given node.
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:65
static void buildOffRamp(NBNode *cur, NBNodeCont &nc, NBEdgeCont &ec, NBDistrictCont &dc, SUMOReal rampLength, bool dontSplit, std::set< NBEdge * > &incremented)
Builds an off-ramp ending at the given node.
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:46
NBEdgeCont & getEdgeCont()
Returns the edge container.
Definition: NBNetBuilder.h:154
A list of positions.
unsigned int getNumLanes() const
Returns the number of lanes.
Definition: NBEdge.h:345
bool isTurningDirectionAt(const NBEdge *const edge) const
Returns whether the given edge is the opposite direction to this edge.
Definition: NBEdge.cpp:1834
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:73
#define POSITION_EPS
Definition: config.h:188
std::map< std::string, NBNode * >::const_iterator end() const
Returns the pointer to the end of the stored nodes.
Definition: NBNodeCont.h:135
vehicle is a passenger car (a "normal" car)
#define WRITE_ERROR(msg)
Definition: MsgHandler.h:205
SVCPermissions getPermissions(int lane=-1) const
get the union of allowed classes over all lanes or for a specific lane
Definition: NBEdge.cpp:2362
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:369
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:246
static void getOffRampEdges(NBNode *n, NBEdge **potHighway, NBEdge **potRamp, NBEdge **other)
NBNodeCont & getNodeCont()
Returns the node container.
Definition: NBNetBuilder.h:162
Instance responsible for building networks.
Definition: NBNetBuilder.h:113
const PositionVector & getGeometry() const
Returns the geometry of the edge.
Definition: NBEdge.h:521
bool isMacroscopicConnector() const
Returns whether this edge was marked as a macroscopic connector.
Definition: NBEdge.h:859
A storage for options typed value containers)
Definition: OptionsCont.h:108
bool insert(const std::string &id, const Position &position, NBDistrict *district=0)
Inserts a node into the map.
Definition: NBNodeCont.cpp:80
LaneSpreadFunction getLaneSpreadFunction() const
Returns how this edge&#39;s lanes&#39; lateral offset is computed.
Definition: NBEdge.h:601
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)
#define SUMOReal
Definition: config.h:214
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:429
Container for nodes during the netbuilding process.
Definition: NBNodeCont.h:64
NBDistrictCont & getDistrictCont()
Returns the districts container.
Definition: NBNetBuilder.h:186
std::map< std::string, NBNode * >::const_iterator begin() const
Returns the pointer to the begin of the stored nodes.
Definition: NBNodeCont.h:127
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:361