SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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  std::set<std::string> noramps;
69  if (oc.isSet("ramps.unset")) {
70  std::vector<std::string> edges = oc.getStringVector("ramps.unset");
71  noramps.insert(edges.begin(), edges.end());
72  }
73  NBNodeCont& nc = nb.getNodeCont();
74  NBEdgeCont& ec = nb.getEdgeCont();
76  // if an edge is part of two ramps, ordering is important
77  std::set<NBNode*, Named::ComparatorIdLess> potOnRamps;
78  std::set<NBNode*, Named::ComparatorIdLess> potOffRamps;
79  for (std::map<std::string, NBNode*>::const_iterator i = nc.begin(); i != nc.end(); ++i) {
80  NBNode* cur = (*i).second;
81  if (mayNeedOnRamp(cur, minHighwaySpeed, maxRampSpeed, noramps)) {
82  potOnRamps.insert(cur);
83  }
84  if (mayNeedOffRamp(cur, minHighwaySpeed, maxRampSpeed, noramps)) {
85  potOffRamps.insert(cur);
86  }
87  }
88  for (std::set<NBNode*, Named::ComparatorIdLess>::const_iterator i = potOnRamps.begin(); i != potOnRamps.end(); ++i) {
89  buildOnRamp(*i, nc, ec, dc, rampLength, dontSplit, incremented);
90  }
91  for (std::set<NBNode*, Named::ComparatorIdLess>::const_iterator i = potOffRamps.begin(); i != potOffRamps.end(); ++i) {
92  buildOffRamp(*i, nc, ec, dc, rampLength, dontSplit, incremented);
93  }
94  }
95  // check whether on-off ramps are specified
96  if (oc.isSet("ramps.set")) {
97  std::vector<std::string> edges = oc.getStringVector("ramps.set");
98  NBNodeCont& nc = nb.getNodeCont();
99  NBEdgeCont& ec = nb.getEdgeCont();
100  NBDistrictCont& dc = nb.getDistrictCont();
101  for (std::vector<std::string>::iterator i = edges.begin(); i != edges.end(); ++i) {
102  NBEdge* e = ec.retrieve(*i);
103  if (e == 0) {
104  WRITE_WARNING("Can not build on ramp on edge '" + *i + "' - the edge is not known.");
105  continue;
106  }
107  NBNode* from = e->getFromNode();
108  if (from->getIncomingEdges().size() == 2 && from->getOutgoingEdges().size() == 1) {
109  buildOnRamp(from, nc, ec, dc, rampLength, dontSplit, incremented);
110  }
111  // load edge again to check offramps
112  e = ec.retrieve(*i);
113  if (e == 0) {
114  WRITE_WARNING("Can not build off ramp on edge '" + *i + "' - the edge is not known.");
115  continue;
116  }
117  NBNode* to = e->getToNode();
118  if (to->getIncomingEdges().size() == 1 && to->getOutgoingEdges().size() == 2) {
119  buildOffRamp(to, nc, ec, dc, rampLength, dontSplit, incremented);
120  }
121  }
122  }
123 }
124 
125 
126 bool
127 NBRampsComputer::mayNeedOnRamp(NBNode* cur, SUMOReal minHighwaySpeed, SUMOReal maxRampSpeed, const std::set<std::string>& noramps) {
128  if (cur->getOutgoingEdges().size() != 1 || cur->getIncomingEdges().size() != 2) {
129  return false;
130  }
131  NBEdge* potHighway, *potRamp, *cont;
132  getOnRampEdges(cur, &potHighway, &potRamp, &cont);
133  // may be an on-ramp
134  return fulfillsRampConstraints(potHighway, potRamp, cont, minHighwaySpeed, maxRampSpeed, noramps);
135 }
136 
137 
138 bool
139 NBRampsComputer::mayNeedOffRamp(NBNode* cur, SUMOReal minHighwaySpeed, SUMOReal maxRampSpeed, const std::set<std::string>& noramps) {
140  if (cur->getIncomingEdges().size() != 1 || cur->getOutgoingEdges().size() != 2) {
141  return false;
142  }
143  // may be an off-ramp
144  NBEdge* potHighway, *potRamp, *prev;
145  getOffRampEdges(cur, &potHighway, &potRamp, &prev);
146  return fulfillsRampConstraints(potHighway, potRamp, prev, minHighwaySpeed, maxRampSpeed, noramps);
147 }
148 
149 
150 void
151 NBRampsComputer::buildOnRamp(NBNode* cur, NBNodeCont& nc, NBEdgeCont& ec, NBDistrictCont& dc, SUMOReal rampLength, bool dontSplit, std::set<NBEdge*>& incremented) {
152  NBEdge* potHighway, *potRamp, *cont;
153  getOnRampEdges(cur, &potHighway, &potRamp, &cont);
154  // compute the number of lanes to append
155  const unsigned int firstLaneNumber = cont->getNumLanes();
156  int toAdd = (potRamp->getNumLanes() + potHighway->getNumLanes()) - firstLaneNumber;
157  NBEdge* first = cont;
158  NBEdge* last = cont;
159  NBEdge* curr = cont;
160  if (toAdd > 0 && find(incremented.begin(), incremented.end(), cont) == incremented.end()) {
161  SUMOReal currLength = 0;
162  while (curr != 0 && currLength + curr->getGeometry().length() - POSITION_EPS < rampLength) {
163  if (find(incremented.begin(), incremented.end(), curr) == incremented.end()) {
164  curr->incLaneNo(toAdd);
165  curr->invalidateConnections(true);
166  incremented.insert(curr);
167  moveRampRight(curr, toAdd);
168  currLength += curr->getLength(); // !!! loaded length?
169  last = curr;
170  }
171  NBNode* nextN = curr->getToNode();
172  if (nextN->getOutgoingEdges().size() == 1) {
173  curr = nextN->getOutgoingEdges()[0];
174  if (curr->getNumLanes() != firstLaneNumber) {
175  // the number of lanes changes along the computation; we'll stop...
176  curr = 0;
177  } else if (curr->isTurningDirectionAt(last)) {
178  // turnarounds certainly should not be included in a ramp
179  curr = 0;
180  } else if (curr == potHighway || curr == potRamp) {
181  // circular connectivity. do not split!
182  curr = 0;
183  }
184  } else {
185  // ambigous; and, in fact, what should it be? ...stop
186  curr = 0;
187  }
188  }
189  // check whether a further split is necessary
190  if (curr != 0 && !dontSplit && currLength - POSITION_EPS < rampLength && curr->getNumLanes() == firstLaneNumber && find(incremented.begin(), incremented.end(), curr) == incremented.end()) {
191  // there is enough place to build a ramp; do it
192  bool wasFirst = first == curr;
193  NBNode* rn = new NBNode(curr->getID() + "-AddedOnRampNode", curr->getGeometry().positionAtOffset(rampLength - currLength));
194  if (!nc.insert(rn)) {
195  throw ProcessError("Ups - could not build on-ramp for edge '" + curr->getID() + "' (node could not be build)!");
196  }
197  std::string name = curr->getID();
198  bool ok = ec.splitAt(dc, curr, rn, curr->getID() + ADDED_ON_RAMP_EDGE, curr->getID(), curr->getNumLanes() + toAdd, curr->getNumLanes());
199  if (!ok) {
200  WRITE_ERROR("Ups - could not build on-ramp for edge '" + curr->getID() + "'!");
201  return;
202  }
203  //ec.retrieve(name)->invalidateConnections();
204  curr = ec.retrieve(name + ADDED_ON_RAMP_EDGE);
205  incremented.insert(curr);
206  last = curr;
207  moveRampRight(curr, toAdd);
208  if (wasFirst) {
209  first = curr;
210  }
211  }
212  if (curr == cont && dontSplit) {
213  WRITE_WARNING("Could not build on-ramp for edge '" + curr->getID() + "' due to option '--ramps.no-split'");
214  return;
215  }
216  }
217  // set connections from ramp/highway to added ramp
218  if (!potHighway->addLane2LaneConnections(0, first, potRamp->getNumLanes(), MIN2(first->getNumLanes() - potRamp->getNumLanes(), potHighway->getNumLanes()), NBEdge::L2L_VALIDATED, true, true)) {
219  throw ProcessError("Could not set connection!");
220  }
221  if (!potRamp->addLane2LaneConnections(0, first, 0, potRamp->getNumLanes(), NBEdge::L2L_VALIDATED, true, true)) {
222  throw ProcessError("Could not set connection!");
223  }
224  // patch ramp geometry
225  PositionVector p = potRamp->getGeometry();
226  p.pop_back();
227  p.push_back(first->getLaneShape(0)[0]);
228  potRamp->setGeometry(p);
229 }
230 
231 
232 void
233 NBRampsComputer::buildOffRamp(NBNode* cur, NBNodeCont& nc, NBEdgeCont& ec, NBDistrictCont& dc, SUMOReal rampLength, bool dontSplit, std::set<NBEdge*>& incremented) {
234  NBEdge* potHighway, *potRamp, *prev;
235  getOffRampEdges(cur, &potHighway, &potRamp, &prev);
236  // compute the number of lanes to append
237  const unsigned int firstLaneNumber = prev->getNumLanes();
238  int toAdd = (potRamp->getNumLanes() + potHighway->getNumLanes()) - firstLaneNumber;
239  NBEdge* first = prev;
240  NBEdge* last = prev;
241  NBEdge* curr = prev;
242  if (toAdd > 0 && find(incremented.begin(), incremented.end(), prev) == incremented.end()) {
243  SUMOReal currLength = 0;
244  while (curr != 0 && currLength + curr->getGeometry().length() - POSITION_EPS < rampLength) {
245  if (find(incremented.begin(), incremented.end(), curr) == incremented.end()) {
246  curr->incLaneNo(toAdd);
247  curr->invalidateConnections(true);
248  incremented.insert(curr);
249  moveRampRight(curr, toAdd);
250  currLength += curr->getLength(); // !!! loaded length?
251  last = curr;
252  }
253  NBNode* prevN = curr->getFromNode();
254  if (prevN->getIncomingEdges().size() == 1) {
255  curr = prevN->getIncomingEdges()[0];
256  if (curr->getNumLanes() != firstLaneNumber) {
257  // the number of lanes changes along the computation; we'll stop...
258  curr = 0;
259  } else if (last->isTurningDirectionAt(curr)) {
260  // turnarounds certainly should not be included in a ramp
261  curr = 0;
262  } else if (curr == potHighway || curr == potRamp) {
263  // circular connectivity. do not split!
264  curr = 0;
265  }
266  } else {
267  // ambigous; and, in fact, what should it be? ...stop
268  curr = 0;
269  }
270  }
271  // check whether a further split is necessary
272  if (curr != 0 && !dontSplit && currLength - POSITION_EPS < rampLength && curr->getNumLanes() == firstLaneNumber && find(incremented.begin(), incremented.end(), curr) == incremented.end()) {
273  // there is enough place to build a ramp; do it
274  bool wasFirst = first == curr;
275  Position pos = curr->getGeometry().positionAtOffset(curr->getGeometry().length() - (rampLength - currLength));
276  NBNode* rn = new NBNode(curr->getID() + "-AddedOffRampNode", pos);
277  if (!nc.insert(rn)) {
278  throw ProcessError("Ups - could not build off-ramp for edge '" + curr->getID() + "' (node could not be build)!");
279  }
280  std::string name = curr->getID();
281  bool ok = ec.splitAt(dc, curr, rn, curr->getID(), curr->getID() + "-AddedOffRampEdge", curr->getNumLanes(), curr->getNumLanes() + toAdd);
282  if (!ok) {
283  WRITE_ERROR("Ups - could not build off-ramp for edge '" + curr->getID() + "'!");
284  return;
285  }
286  curr = ec.retrieve(name + "-AddedOffRampEdge");
287  incremented.insert(curr);
288  last = curr;
289  moveRampRight(curr, toAdd);
290  if (wasFirst) {
291  first = curr;
292  }
293  }
294  if (curr == prev && dontSplit) {
295  WRITE_WARNING("Could not build off-ramp for edge '" + curr->getID() + "' due to option '--ramps.no-split'");
296  return;
297  }
298  }
299  // set connections from added ramp to ramp/highway
300  if (!first->addLane2LaneConnections(potRamp->getNumLanes(), potHighway, 0, MIN2(first->getNumLanes() - 1, potHighway->getNumLanes()), NBEdge::L2L_VALIDATED, true)) {
301  throw ProcessError("Could not set connection!");
302  }
303  if (!first->addLane2LaneConnections(0, potRamp, 0, potRamp->getNumLanes(), NBEdge::L2L_VALIDATED, false)) {
304  throw ProcessError("Could not set connection!");
305  }
306  // patch ramp geometry
307  PositionVector p = potRamp->getGeometry();
308  p.pop_front();
309  p.push_front(first->getLaneShape(0)[-1]);
310  potRamp->setGeometry(p);
311 }
312 
313 
314 void
315 NBRampsComputer::moveRampRight(NBEdge* ramp, int addedLanes) {
316  if (ramp->getLaneSpreadFunction() != LANESPREAD_CENTER) {
317  return;
318  }
319  try {
320  PositionVector g = ramp->getGeometry();
321  const SUMOReal offset = (0.5 * addedLanes *
323  g.move2side(offset);
324  ramp->setGeometry(g);
325  } catch (InvalidArgument&) {
326  WRITE_WARNING("For edge '" + ramp->getID() + "': could not compute shape.");
327  }
328 }
329 
330 
331 bool
333  if (fabs((*potHighway)->getSpeed() - (*potRamp)->getSpeed()) < .1) {
334  return false;
335  }
336  if ((*potHighway)->getSpeed() < (*potRamp)->getSpeed()) {
337  std::swap(*potHighway, *potRamp);
338  }
339  return true;
340 }
341 
342 
343 bool
345  if ((*potHighway)->getNumLanes() == (*potRamp)->getNumLanes()) {
346  return false;
347  }
348  if ((*potHighway)->getNumLanes() < (*potRamp)->getNumLanes()) {
349  std::swap(*potHighway, *potRamp);
350  }
351  return true;
352 }
353 
354 
355 void
356 NBRampsComputer::getOnRampEdges(NBNode* n, NBEdge** potHighway, NBEdge** potRamp, NBEdge** other) {
357  *other = n->getOutgoingEdges()[0];
358  const std::vector<NBEdge*>& edges = n->getIncomingEdges();
359  assert(edges.size() == 2);
360  *potHighway = edges[0];
361  *potRamp = edges[1];
362  /*
363  // heuristic: highway is faster than ramp
364  if(determinedBySpeed(potHighway, potRamp)) {
365  return;
366  }
367  // heuristic: highway has more lanes than ramp
368  if(determinedByLaneNumber(potHighway, potRamp)) {
369  return;
370  }
371  */
372  // heuristic: ramp comes from right
373  const std::vector<NBEdge*>& edges2 = n->getEdges();
374  std::vector<NBEdge*>::const_iterator i = std::find(edges2.begin(), edges2.end(), *other);
375  NBContHelper::nextCW(edges2, i);
376  if ((*i) == *potHighway) {
377  std::swap(*potHighway, *potRamp);
378  }
379 }
380 
381 
382 void
383 NBRampsComputer::getOffRampEdges(NBNode* n, NBEdge** potHighway, NBEdge** potRamp, NBEdge** other) {
384  *other = n->getIncomingEdges()[0];
385  const std::vector<NBEdge*>& edges = n->getOutgoingEdges();
386  *potHighway = edges[0];
387  *potRamp = edges[1];
388  assert(edges.size() == 2);
389  /*
390  // heuristic: highway is faster than ramp
391  if(determinedBySpeed(potHighway, potRamp)) {
392  return;
393  }
394  // heuristic: highway has more lanes than ramp
395  if(determinedByLaneNumber(potHighway, potRamp)) {
396  return;
397  }
398  */
399  // heuristic: ramp goes to right
400  const std::vector<NBEdge*>& edges2 = n->getEdges();
401  std::vector<NBEdge*>::const_iterator i = std::find(edges2.begin(), edges2.end(), *other);
402  NBContHelper::nextCW(edges2, i);
403  if ((*i) == *potRamp) {
404  std::swap(*potHighway, *potRamp);
405  }
406 }
407 
408 
409 bool
411  NBEdge* potHighway, NBEdge* potRamp, NBEdge* other, SUMOReal minHighwaySpeed, SUMOReal maxRampSpeed,
412  const std::set<std::string>& noramps) {
413  // do not build ramps on rail edges
414  if (isRailway(potHighway->getPermissions()) || isRailway(potRamp->getPermissions())) {
415  return false;
416  }
417  // do not build ramps on connectors
418  if (potHighway->isMacroscopicConnector() || potRamp->isMacroscopicConnector() || other->isMacroscopicConnector()) {
419  return false;
420  }
421  // check whether a lane is missing
422  if (potHighway->getNumLanes() + potRamp->getNumLanes() <= other->getNumLanes()) {
423  return false;
424  }
425  // is it really a highway?
426  SUMOReal maxSpeed = MAX3(potHighway->getSpeed(), other->getSpeed(), potRamp->getSpeed());
427  if (maxSpeed < minHighwaySpeed) {
428  return false;
429  }
430  // is any of the connections a turnaround?
431  if (other->getToNode() == potHighway->getFromNode()) {
432  // off ramp
433  if (other->isTurningDirectionAt(potHighway) ||
434  other->isTurningDirectionAt(potRamp)) {
435  return false;
436  }
437  } else {
438  // on ramp
439  if (other->isTurningDirectionAt(potHighway) ||
440  other->isTurningDirectionAt(potRamp)) {
441  return false;
442  }
443  }
444  /*
445  if (potHighway->getSpeed() < minHighwaySpeed || other->getSpeed() < minHighwaySpeed) {
446  return false;
447  }
448  */
449  // is it really a ramp?
450  if (maxRampSpeed > 0 && maxRampSpeed < potRamp->getSpeed()) {
451  return false;
452  }
453  if (noramps.find(other->getID()) != noramps.end()) {
454  return false;
455  }
456  return true;
457 }
458 
459 
460 /****************************************************************************/
461 
void invalidateConnections(bool reallowSetting=false)
Definition: NBEdge.cpp:920
const PositionVector & getLaneShape(unsigned int i) const
Returns the shape of the nth lane.
Definition: NBEdge.cpp:531
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:247
static const SUMOReal UNSPECIFIED_WIDTH
unspecified lane width
Definition: NBEdge.h:203
const SUMOReal SUMO_const_laneWidth
Definition: StdDefs.h:46
static bool determinedBySpeed(NBEdge **potHighway, NBEdge **potRamp)
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.
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:71
void incLaneNo(unsigned int by)
Definition: NBEdge.cpp:2180
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:693
SUMOReal getLaneWidth() const
Returns the default width of lanes of this edge.
Definition: NBEdge.h:445
bool splitAt(NBDistrictCont &dc, NBEdge *edge, NBNode *node)
Splits the edge at the position nearest to the given node.
Definition: NBEdgeCont.cpp:439
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)
bool isRailway(SVCPermissions permissions)
Returns whether an edge with the given permission is a railway edge.
void setGeometry(const PositionVector &g, bool inner=false)
(Re)sets the edge&#39;s geometry
Definition: NBEdge.cpp:428
T MAX3(T a, T b, T c)
Definition: StdDefs.h:88
#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:116
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:255
const std::string & getID() const
Returns the id.
Definition: Named.h:60
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
Position pop_front()
Removes and returns the position at the fron of the list.
NBEdgeCont & getEdgeCont()
Returns the edge container.
Definition: NBNetBuilder.h:154
A list of positions.
void push_front(const Position &p)
Puts the given position at the front of the list.
unsigned int getNumLanes() const
Returns the number of lanes.
Definition: NBEdge.h:343
bool isTurningDirectionAt(const NBEdge *const edge) const
Returns whether the given edge is the opposite direction to this edge.
Definition: NBEdge.cpp:1858
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:263
Storage for edges, including some functionality operating on multiple edges.
Definition: NBEdgeCont.h:66
T MIN2(T a, T b)
Definition: StdDefs.h:68
#define POSITION_EPS
Definition: config.h:189
std::map< std::string, NBNode * >::const_iterator end() const
Returns the pointer to the end of the stored nodes.
Definition: NBNodeCont.h:135
#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:2374
SUMOReal length() const
Returns the length.
void push_back(const PositionVector &p)
Appends all positions from the given vector.
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:367
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:274
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:519
bool isMacroscopicConnector() const
Returns whether this edge was marked as a macroscopic connector.
Definition: NBEdge.h:849
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:79
LaneSpreadFunction getLaneSpreadFunction() const
Returns how this edge&#39;s lanes&#39; lateral offset is computed.
Definition: NBEdge.h:599
Represents a single node (junction) during network building.
Definition: NBNode.h:75
static void getOnRampEdges(NBNode *n, NBEdge **potHighway, NBEdge **potRamp, NBEdge **other)
void move2side(SUMOReal amount)
#define SUMOReal
Definition: config.h:215
SUMOReal getSpeed() const
Returns the speed allowed on this edge.
Definition: NBEdge.h:427
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
SUMOReal getLength() const
Returns the computed length of the edge.
Definition: NBEdge.h:402
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:359