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