SUMO - Simulation of Urban MObility
MSEdge.cpp
Go to the documentation of this file.
1 /****************************************************************************/
13 // A road/street connecting two junctions
14 /****************************************************************************/
15 // SUMO, Simulation of Urban MObility; see http://sumo-sim.org/
16 // Copyright (C) 2001-2014 DLR (http://www.dlr.de/) and contributors
17 /****************************************************************************/
18 //
19 // This file is part of SUMO.
20 // SUMO is free software: you can redistribute it and/or modify
21 // it under the terms of the GNU General Public License as published by
22 // the Free Software Foundation, either version 3 of the License, or
23 // (at your option) any later version.
24 //
25 /****************************************************************************/
26 
27 
28 // ===========================================================================
29 // included modules
30 // ===========================================================================
31 #ifdef _MSC_VER
32 #include <windows_config.h>
33 #else
34 #include <config.h>
35 #endif
36 
37 #include <algorithm>
38 #include <iostream>
39 #include <cassert>
42 #include "MSEdge.h"
43 #include "MSLane.h"
44 #include "MSLaneChanger.h"
45 #include "MSGlobals.h"
46 #include "MSVehicle.h"
47 #include "MSPerson.h"
48 #include "MSEdgeWeightsStorage.h"
49 
50 #ifdef HAVE_INTERNAL
51 #include <mesosim/MELoop.h>
52 #include <mesosim/MESegment.h>
53 #include <mesosim/MEVehicle.h>
54 #endif
55 
56 #ifdef CHECK_MEMORY_LEAKS
57 #include <foreign/nvwa/debug_new.h>
58 #endif // CHECK_MEMORY_LEAKS
59 
60 
61 // ===========================================================================
62 // static member definitions
63 // ===========================================================================
65 std::vector<MSEdge*> MSEdge::myEdges;
66 
67 
68 // ===========================================================================
69 // member method definitions
70 // ===========================================================================
71 MSEdge::MSEdge(const std::string& id, int numericalID,
72  const EdgeBasicFunction function,
73  const std::string& streetName,
74  const std::string& edgeType) :
75  Named(id), myNumericalID(numericalID), myLanes(0),
76  myLaneChanger(0), myFunction(function), myVaporizationRequests(0),
77  myLastFailedInsertionTime(-1),
78  myFromJunction(0), myToJunction(0),
79  myStreetName(streetName),
80  myEdgeType(edgeType),
81  myAmRoundabout(false) {}
82 
83 
85  delete myLaneChanger;
86  for (AllowedLanesCont::iterator i1 = myAllowed.begin(); i1 != myAllowed.end(); i1++) {
87  delete(*i1).second;
88  }
89  for (ClassedAllowedLanesCont::iterator i2 = myClassedAllowed.begin(); i2 != myClassedAllowed.end(); i2++) {
90  for (AllowedLanesCont::iterator i1 = (*i2).second.begin(); i1 != (*i2).second.end(); i1++) {
91  delete(*i1).second;
92  }
93  }
94  delete myLanes;
95  // Note: Lanes are delete using MSLane::clear();
96 }
97 
98 
99 void
100 MSEdge::initialize(std::vector<MSLane*>* lanes) {
101  assert(myFunction == EDGEFUNCTION_DISTRICT || lanes != 0);
102  myLanes = lanes;
103  if (myLanes && myLanes->size() > 1) {
104  myLaneChanger = new MSLaneChanger(myLanes, OptionsCont::getOptions().getBool("lanechange.allow-swap"));
105  }
108  }
109 }
110 
111 
112 bool
114  if (myLanes == 0 || myLanes->size() < 2) {
115  return false;
116  }
118  return true;
119  }
120  // allow changing only if all links leading to this internal lane have priority
121  for (std::vector<MSLane*>::iterator it = myLanes->begin(); it != myLanes->end(); ++it) {
122  MSLane* pred = (*it)->getLogicalPredecessorLane();
123  MSLink* link = MSLinkContHelper::getConnectingLink(*pred, **it);
124  assert(link != 0);
125  if (!link->havePriority()) {
126  return false;
127  }
128  }
129  return true;
130 }
131 
132 
133 void
135  myAllowed[0] = new std::vector<MSLane*>();
136  for (std::vector<MSLane*>::iterator i = myLanes->begin(); i != myLanes->end(); ++i) {
137  myAllowed[0]->push_back(*i);
138  const MSLinkCont& lc = (*i)->getLinkCont();
139  for (MSLinkCont::const_iterator j = lc.begin(); j != lc.end(); ++j) {
140  MSLane* toL = (*j)->getLane();
141  if (toL != 0) {
142  MSEdge& to = toL->getEdge();
143  //
144  if (std::find(mySuccessors.begin(), mySuccessors.end(), &to) == mySuccessors.end()) {
145  mySuccessors.push_back(&to);
146  }
147  if (std::find(to.myPredeccesors.begin(), to.myPredeccesors.end(), this) == to.myPredeccesors.end()) {
148  to.myPredeccesors.push_back(this);
149  }
150  //
151  if (myAllowed.find(&to) == myAllowed.end()) {
152  myAllowed[&to] = new std::vector<MSLane*>();
153  }
154  myAllowed[&to]->push_back(*i);
155  }
156 #ifdef HAVE_INTERNAL_LANES
157  toL = (*j)->getViaLane();
158  if (toL != 0) {
159  MSEdge& to = toL->getEdge();
160  if (std::find(to.myPredeccesors.begin(), to.myPredeccesors.end(), this) == to.myPredeccesors.end()) {
161  to.myPredeccesors.push_back(this);
162  }
163  }
164 #endif
165  }
166  }
167  std::sort(mySuccessors.begin(), mySuccessors.end(), by_id_sorter());
169 }
170 
171 
172 void
174  // clear myClassedAllowed.
175  // it will be rebuilt on demand
176  for (ClassedAllowedLanesCont::iterator i2 = myClassedAllowed.begin(); i2 != myClassedAllowed.end(); i2++) {
177  for (AllowedLanesCont::iterator i1 = (*i2).second.begin(); i1 != (*i2).second.end(); i1++) {
178  delete(*i1).second;
179  }
180  }
181  myClassedAllowed.clear();
182  // rebuild myMinimumPermissions and myCombinedPermissions
185  for (std::vector<MSLane*>::iterator i = myLanes->begin(); i != myLanes->end(); ++i) {
186  myMinimumPermissions &= (*i)->getPermissions();
187  myCombinedPermissions |= (*i)->getPermissions();
188  }
189 }
190 
191 
192 // ------------ Access to the edge's lanes
193 MSLane*
194 MSEdge::leftLane(const MSLane* const lane) const {
195  return parallelLane(lane, 1);
196 }
197 
198 
199 MSLane*
200 MSEdge::rightLane(const MSLane* const lane) const {
201  return parallelLane(lane, -1);
202 }
203 
204 
205 MSLane*
206 MSEdge::parallelLane(const MSLane* const lane, int offset) const {
207  const int index = (int)(find(myLanes->begin(), myLanes->end(), lane) - myLanes->begin());
208  if (index == (int)myLanes->size()) {
209  return 0;
210  }
211  const int resultIndex = index + offset;
212  if (resultIndex >= (int)myLanes->size() || resultIndex < 0) {
213  return 0;
214  } else {
215  return (*myLanes)[resultIndex];
216  }
217 }
218 
219 
220 const std::vector<MSLane*>*
221 MSEdge::allowedLanes(const MSEdge& destination, SUMOVehicleClass vclass) const {
222  return allowedLanes(&destination, vclass);
223 }
224 
225 
226 const std::vector<MSLane*>*
228  return allowedLanes(0, vclass);
229 }
230 
231 
232 const std::vector<MSLane*>*
234  AllowedLanesCont::const_iterator it = c.find(dest);
235  if (it == c.end()) {
236  return 0;
237  }
238  return it->second;
239 }
240 
241 
242 const std::vector<MSLane*>*
243 MSEdge::allowedLanes(const MSEdge* destination, SUMOVehicleClass vclass) const {
244  if ((myMinimumPermissions & vclass) == vclass) {
245  // all lanes allow vclass
246  return getAllowedLanesWithDefault(myAllowed, destination);
247  }
248  // look up cached result in myClassedAllowed
249  ClassedAllowedLanesCont::const_iterator i = myClassedAllowed.find(vclass);
250  if (i != myClassedAllowed.end()) {
251  // can use cached value
252  const AllowedLanesCont& c = (*i).second;
253  return getAllowedLanesWithDefault(c, destination);
254  } else {
255  // this vclass is requested for the first time. rebuild all destinations
256  // go through connected edges
257  for (AllowedLanesCont::const_iterator i1 = myAllowed.begin(); i1 != myAllowed.end(); ++i1) {
258  const MSEdge* edge = i1->first;
259  const std::vector<MSLane*>* lanes = i1->second;
260  myClassedAllowed[vclass][edge] = new std::vector<MSLane*>();
261  // go through lanes approaching current edge
262  for (std::vector<MSLane*>::const_iterator i2 = lanes->begin(); i2 != lanes->end(); ++i2) {
263  // allows the current vehicle class?
264  if ((*i2)->allowsVehicleClass(vclass)) {
265  // -> may be used
266  myClassedAllowed[vclass][edge]->push_back(*i2);
267  }
268  }
269  // assert that 0 is returned if no connection is allowed for a class
270  if (myClassedAllowed[vclass][edge]->size() == 0) {
271  delete myClassedAllowed[vclass][edge];
272  myClassedAllowed[vclass][edge] = 0;
273  }
274  }
275  return myClassedAllowed[vclass][destination];
276  }
277 }
278 
279 
280 // ------------
281 SUMOTime
284  return 0;
285 }
286 
287 
288 SUMOTime
291  return 0;
292 }
293 
294 
295 MSLane*
296 MSEdge::getFreeLane(const std::vector<MSLane*>* allowed, const SUMOVehicleClass vclass) const {
297  if (allowed == 0) {
298  allowed = allowedLanes(vclass);
299  }
300  MSLane* res = 0;
301  if (allowed != 0) {
302  unsigned int noCars = INT_MAX;
303  for (std::vector<MSLane*>::const_iterator i = allowed->begin(); i != allowed->end(); ++i) {
304  if ((*i)->getVehicleNumber() < noCars) {
305  res = (*i);
306  noCars = (*i)->getVehicleNumber();
307  }
308  }
309  }
310  return res;
311 }
312 
313 
314 MSLane*
315 MSEdge::getDepartLane(const MSVehicle& veh) const {
316  switch (veh.getParameter().departLaneProcedure) {
317  case DEPART_LANE_GIVEN:
318  if ((int) myLanes->size() <= veh.getParameter().departLane || !(*myLanes)[veh.getParameter().departLane]->allowsVehicleClass(veh.getVehicleType().getVehicleClass())) {
319  return 0;
320  }
321  return (*myLanes)[veh.getParameter().departLane];
322  case DEPART_LANE_RANDOM:
324  case DEPART_LANE_FREE:
325  return getFreeLane(0, veh.getVehicleType().getVehicleClass());
327  if (veh.getRoute().size() == 1) {
328  return getFreeLane(0, veh.getVehicleType().getVehicleClass());
329  } else {
330  return getFreeLane(allowedLanes(**(veh.getRoute().begin() + 1)), veh.getVehicleType().getVehicleClass());
331  }
332  case DEPART_LANE_BEST_FREE: {
333  const std::vector<MSVehicle::LaneQ>& bl = veh.getBestLanes();
334  SUMOReal bestLength = -1;
335  for (std::vector<MSVehicle::LaneQ>::const_iterator i = bl.begin(); i != bl.end(); ++i) {
336  if ((*i).length > bestLength) {
337  bestLength = (*i).length;
338  }
339  }
340  std::vector<MSLane*>* bestLanes = new std::vector<MSLane*>();
341  for (std::vector<MSVehicle::LaneQ>::const_iterator i = bl.begin(); i != bl.end(); ++i) {
342  if ((*i).length == bestLength) {
343  bestLanes->push_back((*i).lane);
344  }
345  }
346  MSLane* ret = getFreeLane(bestLanes, veh.getVehicleType().getVehicleClass());
347  delete bestLanes;
348  return ret;
349  }
350  case DEPART_LANE_DEFAULT:
351  default:
352  break;
353  }
354  if (!(*myLanes)[0]->allowsVehicleClass(veh.getVehicleType().getVehicleClass())) {
355  return 0;
356  }
357  return (*myLanes)[0];
358 }
359 
360 
361 bool
363  // when vaporizing, no vehicles are inserted...
364  if (isVaporizing()) {
365  return false;
366  }
367 #ifdef HAVE_INTERNAL
369  const SUMOVehicleParameter& pars = v.getParameter();
370  SUMOReal pos = 0.0;
371  switch (pars.departPosProcedure) {
372  case DEPART_POS_GIVEN:
373  if (pars.departPos >= 0.) {
374  pos = pars.departPos;
375  } else {
376  pos = pars.departPos + getLength();
377  }
378  if (pos < 0 || pos > getLength()) {
379  WRITE_WARNING("Invalid departPos " + toString(pos) + " given for vehicle '" +
380  v.getID() + "'. Inserting at lane end instead.");
381  pos = getLength();
382  }
383  break;
384  case DEPART_POS_RANDOM:
386  pos = RandHelper::rand(getLength());
387  break;
388  default:
389  break;
390  }
391  bool result = false;
392  MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this, pos);
393  MEVehicle* veh = static_cast<MEVehicle*>(&v);
394  if (pars.departPosProcedure == DEPART_POS_FREE) {
395  while (segment != 0 && !result) {
396  result = segment->initialise(veh, time);
397  segment = segment->getNextSegment();
398  }
399  } else {
400  result = segment->initialise(veh, time);
401  }
402  return result;
403  }
404 #else
405  UNUSED_PARAMETER(time);
406 #endif
407  MSLane* insertionLane = getDepartLane(static_cast<MSVehicle&>(v));
408  return insertionLane != 0 && insertionLane->insertVehicle(static_cast<MSVehicle&>(v));
409 }
410 
411 
412 void
414  if (laneChangeAllowed()) {
416  }
417 }
418 
419 
420 
421 #ifdef HAVE_INTERNAL_LANES
422 const MSEdge*
423 MSEdge::getInternalFollowingEdge(MSEdge* followerAfterInternal) const {
424  //@todo to be optimized
425  for (std::vector<MSLane*>::const_iterator i = myLanes->begin(); i != myLanes->end(); ++i) {
426  MSLane* l = *i;
427  const MSLinkCont& lc = l->getLinkCont();
428  for (MSLinkCont::const_iterator j = lc.begin(); j != lc.end(); ++j) {
429  MSLink* link = *j;
430  if (&link->getLane()->getEdge() == followerAfterInternal) {
431  if (link->getViaLane() != 0) {
432  return &link->getViaLane()->getEdge();
433  } else {
434  return 0; // network without internal links
435  }
436  }
437  }
438  }
439  return 0;
440 }
441 #endif
442 
443 
444 SUMOReal
446  assert(minSpeed > 0);
447  SUMOReal v = 0;
448 #ifdef HAVE_INTERNAL
450  MESegment* first = MSGlobals::gMesoNet->getSegmentForEdge(*this);
451  unsigned segments = 0;
452  do {
453  v += first->getMeanSpeed();
454  first = first->getNextSegment();
455  segments++;
456  } while (first != 0);
457  v /= (SUMOReal) segments;
458  } else {
459 #endif
460  for (std::vector<MSLane*>::iterator i = myLanes->begin(); i != myLanes->end(); ++i) {
461  v += (*i)->getMeanSpeed();
462  }
463  v /= (SUMOReal) myLanes->size();
464 #ifdef HAVE_INTERNAL
465  }
466 #endif
467  v = MAX2(minSpeed, v);
468  return getLength() / v;
469 }
470 
471 
472 bool
473 MSEdge::dictionary(const std::string& id, MSEdge* ptr) {
474  DictType::iterator it = myDict.find(id);
475  if (it == myDict.end()) {
476  // id not in myDict.
477  myDict[id] = ptr;
478  while ((int)myEdges.size() < ptr->getNumericalID() + 1) {
479  myEdges.push_back(0);
480  }
481  myEdges[ptr->getNumericalID()] = ptr;
482  return true;
483  }
484  return false;
485 }
486 
487 
488 MSEdge*
489 MSEdge::dictionary(const std::string& id) {
490  DictType::iterator it = myDict.find(id);
491  if (it == myDict.end()) {
492  // id not in myDict.
493  return 0;
494  }
495  return it->second;
496 }
497 
498 
499 MSEdge*
500 MSEdge::dictionary(size_t id) {
501  assert(myEdges.size() > id);
502  return myEdges[id];
503 }
504 
505 
506 size_t
508  return myDict.size();
509 }
510 
511 
512 size_t
514  return myEdges.size();
515 }
516 
517 
518 void
520  for (DictType::iterator i = myDict.begin(); i != myDict.end(); ++i) {
521  delete(*i).second;
522  }
523  myDict.clear();
524 }
525 
526 
527 void
528 MSEdge::insertIDs(std::vector<std::string>& into) {
529  for (DictType::iterator i = myDict.begin(); i != myDict.end(); ++i) {
530  into.push_back((*i).first);
531  }
532 }
533 
534 
535 void
536 MSEdge::parseEdgesList(const std::string& desc, std::vector<const MSEdge*>& into,
537  const std::string& rid) {
538  if (desc[0] == BinaryFormatter::BF_ROUTE) {
539  std::istringstream in(desc, std::ios::binary);
540  char c;
541  in >> c;
542  FileHelpers::readEdgeVector(in, into, rid);
543  } else {
544  StringTokenizer st(desc);
545  parseEdgesList(st.getVector(), into, rid);
546  }
547 }
548 
549 
550 void
551 MSEdge::parseEdgesList(const std::vector<std::string>& desc, std::vector<const MSEdge*>& into,
552  const std::string& rid) {
553  for (std::vector<std::string>::const_iterator i = desc.begin(); i != desc.end(); ++i) {
554  const MSEdge* edge = MSEdge::dictionary(*i);
555  // check whether the edge exists
556  if (edge == 0) {
557  throw ProcessError("The edge '" + *i + "' within the route " + rid + " is not known."
558  + "\n The route can not be build.");
559  }
560  into.push_back(edge);
561  }
562 }
563 
564 
565 SUMOReal
566 MSEdge::getDistanceTo(const MSEdge* other) const {
567  if (getLanes().size() > 0 && other->getLanes().size() > 0) {
568  return getLanes()[0]->getShape()[-1].distanceTo2D(other->getLanes()[0]->getShape()[0]);
569  } else {
570  return 0; // optimism is just right for astar
571  }
572 }
573 
574 
575 SUMOReal
577  return getLanes()[0]->getLength();
578 }
579 
580 
581 SUMOReal
583  // @note lanes might have different maximum speeds in theory
584  return getLanes()[0]->getSpeedLimit();
585 }
586 
587 
588 SUMOReal
589 MSEdge::getVehicleMaxSpeed(const SUMOVehicle* const veh) const {
590  // @note lanes might have different maximum speeds in theory
591  return getLanes()[0]->getVehicleMaxSpeed(veh);
592 }
593 
594 
595 std::vector<MSPerson*>
597  std::vector<MSPerson*> result(myPersons.begin(), myPersons.end());
598  sort(result.begin(), result.end(), person_by_offset_sorter(timestep));
599  return result;
600 }
601 
602 
603 int
604 MSEdge::person_by_offset_sorter::operator()(const MSPerson* const p1, const MSPerson* const p2) const {
605  const SUMOReal pos1 = p1->getCurrentStage()->getEdgePos(myTime);
606  const SUMOReal pos2 = p2->getCurrentStage()->getEdgePos(myTime);
607  if (pos1 != pos2) {
608  return pos1 < pos2;
609  }
610  return p1->getID() < p2->getID();
611 }
612 
613 /****************************************************************************/
614 
void laneChange(SUMOTime t)
Start lane-change-process for all vehicles on the edge'e lanes.
const std::string & getID() const
returns the person id
Definition: MSPerson.cpp:551
std::set< MSPerson * > myPersons
Persons on the edge (only for drawing)
Definition: MSEdge.h:632
MSEdge & getEdge() const
Returns the lane's edge.
Definition: MSLane.h:454
Representation of a vehicle in the micro simulation.
Definition: MSVehicle.h:77
std::vector< MSLane * > * myLanes
Container for the edge's lane; should be sorted: (right-hand-traffic) the more left the lane...
Definition: MSEdge.h:607
static void insertIDs(std::vector< std::string > &into)
Inserts IDs of all known edges into the given vector.
Definition: MSEdge.cpp:528
SUMOVehicleClass getVehicleClass() const
Get this vehicle type's vehicle class.
Sorts edges by their ids.
Definition: MSEdge.h:560
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types...
SUMOReal getDistanceTo(const MSEdge *other) const
optimistic air distance heuristic for use in routing
Definition: MSEdge.cpp:566
static size_t numericalDictSize()
Returns the number of edges with a numerical id.
Definition: MSEdge.cpp:513
const std::vector< MSLane * > & getLanes() const
Returns this edge's lanes.
Definition: MSEdge.h:173
std::vector< MSEdge * > mySuccessors
The succeeding edges.
Definition: MSEdge.h:622
DepartLaneDefinition departLaneProcedure
Information how the vehicle shall choose the lane to depart from.
const EdgeBasicFunction myFunction
the purpose of the edge
Definition: MSEdge.h:613
The position is given.
ClassedAllowedLanesCont myClassedAllowed
From vehicle class to lanes allowed to be used by it.
Definition: MSEdge.h:642
The least occupied lane is used.
void closeBuilding()
Definition: MSEdge.cpp:134
static SUMOReal rand()
Returns a random real number in [0, 1)
Definition: RandHelper.h:62
virtual ~MSEdge()
Destructor.
Definition: MSEdge.cpp:84
SUMOReal getCurrentTravelTime(const SUMOReal minSpeed=0.00001) const
Computes and returns the current travel time for this edge.
Definition: MSEdge.cpp:445
T MAX2(T a, T b)
Definition: StdDefs.h:72
const MSRoute & getRoute() const
Returns the current route.
Definition: MSBaseVehicle.h:87
static bool dictionary(const std::string &id, MSEdge *edge)
Inserts edge into the static dictionary Returns true if the key id isn't already in the dictionary...
Definition: MSEdge.cpp:473
SUMOTime incVaporization(SUMOTime t)
Enables vaporization.
Definition: MSEdge.cpp:282
MSLane * getFreeLane(const std::vector< MSLane * > *allowed, const SUMOVehicleClass vclass) const
Finds the emptiest lane allowing the vehicle class.
Definition: MSEdge.cpp:296
The lane is chosen randomly.
static T getRandomFrom(const std::vector< T > &v)
Returns a random element from the given vector.
Definition: RandHelper.h:99
const SVCPermissions SVCAll
int myVaporizationRequests
Vaporizer counter.
Definition: MSEdge.h:616
EdgeBasicFunction
Defines possible edge types.
Definition: MSEdge.h:83
The least occupied lane from best lanes.
The position is chosen randomly.
SUMOTime decVaporization(SUMOTime t)
Disables vaporization.
Definition: MSEdge.cpp:289
#define UNUSED_PARAMETER(x)
Definition: StdDefs.h:39
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:200
std::map< std::string, MSEdge * > DictType
definition of the static dictionary type
Definition: MSEdge.h:663
static OptionsCont & getOptions()
Retrieves the options.
Definition: OptionsCont.cpp:67
void initialize(std::vector< MSLane * > *lanes)
Initialize the edge.
Definition: MSEdge.cpp:100
The lane is given.
static std::vector< MSEdge * > myEdges
Static list of edges.
Definition: MSEdge.h:673
Performs lane changing of vehicles.
Definition: MSLaneChanger.h:55
A road/street connecting two junctions.
Definition: MSEdge.h:74
static void parseEdgesList(const std::string &desc, std::vector< const MSEdge * > &into, const std::string &rid)
Parses the given string assuming it contains a list of edge ids divided by spaces.
Definition: MSEdge.cpp:536
bool insertVehicle(MSVehicle &v)
Tries to insert the given vehicle.
Definition: MSLane.cpp:336
void rebuildAllowedLanes()
Definition: MSEdge.cpp:173
Sorts edges by their ids.
Definition: MSEdge.h:575
SUMOReal getLength() const
return the length of the edge
Definition: MSEdge.cpp:576
MSLane * getLogicalPredecessorLane() const
Definition: MSLane.cpp:1226
The edge is a district edge.
Definition: MSEdge.h:93
Representation of a vehicle.
Definition: SUMOVehicle.h:64
DepartPosDefinition departPosProcedure
Information how the vehicle shall choose the departure position.
The least occupied lane from lanes which allow the continuation.
AllowedLanesCont myAllowed
Associative container from destination-edge to allowed-lanes.
Definition: MSEdge.h:638
static void clear()
Clears the dictionary.
Definition: MSEdge.cpp:519
SVCPermissions myMinimumPermissions
The intersection of lane permissions for this edge.
Definition: MSEdge.h:645
MSPersonStage * getCurrentStage() const
Definition: MSPerson.h:593
MSLane * leftLane(const MSLane *const lane) const
Returns the lane left to the one given, 0 if the given lane is leftmost.
Definition: MSEdge.cpp:194
MSLaneChanger * myLaneChanger
This member will do the lane-change.
Definition: MSEdge.h:610
bool isVaporizing() const
Returns whether vehicles on this edge shall be vaporized.
Definition: MSEdge.h:316
std::vector< MSEdge * > myPredeccesors
The preceeding edges.
Definition: MSEdge.h:625
int operator()(const MSPerson *const p1, const MSPerson *const p2) const
comparing operator
Definition: MSEdge.cpp:604
MSLane * getDepartLane(const MSVehicle &veh) const
Finds a depart lane for the given vehicle parameters.
Definition: MSEdge.cpp:315
std::string toString(const T &t, std::streamsize accuracy=OUTPUT_ACCURACY)
Definition: ToString.h:53
SUMOReal getSpeedLimit() const
Returns the speed limit of the edge The speed limit of the first lane is retured; should probably be...
Definition: MSEdge.cpp:582
If a fixed number of random choices fails, a free position is chosen.
const std::vector< LaneQ > & getBestLanes() const
Returns the description of best lanes to use in order to continue the route.
Definition: MSVehicle.cpp:1762
Base class for objects which have an id.
Definition: Named.h:45
int departLane
(optional) The lane the vehicle shall depart from (index in edge)
virtual SUMOReal getEdgePos(SUMOTime now) const =0
std::vector< std::string > getVector()
unsigned int getVehicleNumber() const
Returns the number of vehicles on this lane.
Definition: MSLane.h:285
SVCPermissions myCombinedPermissions
The union of lane permissions for this edge.
Definition: MSEdge.h:647
No information given; use default.
Structure representing possible vehicle parameter.
int getNumericalID() const
Returns the numerical id of the edge.
Definition: MSEdge.h:237
MSLane * parallelLane(const MSLane *const lane, int offset) const
Returns the lane with the given offset parallel to the given lane one or 0 if it does not exist...
Definition: MSEdge.cpp:206
virtual void changeLanes(SUMOTime t)
Performs lane changing on this edge.
Definition: MSEdge.cpp:413
virtual const SUMOVehicleParameter & getParameter() const =0
Returns the vehicle's parameter (including departure definition)
const std::vector< MSLane * > * allowedLanes(const MSEdge &destination, SUMOVehicleClass vclass=SVC_IGNORING) const
Get the allowed lanes to reach the destination-edge.
Definition: MSEdge.cpp:221
static size_t dictSize()
Returns the number of edges.
Definition: MSEdge.cpp:507
const MSVehicleType & getVehicleType() const
Returns the vehicle's type definition.
Definition: MSBaseVehicle.h:95
int SUMOTime
Definition: SUMOTime.h:43
const SUMOVehicleParameter & getParameter() const
Returns the vehicle's parameter (including departure definition)
SUMOReal departPos
(optional) The position the vehicle shall depart from
std::map< const MSEdge *, std::vector< MSLane * > * > AllowedLanesCont
Suceeding edges (keys) and allowed lanes to reach these edges (values).
Definition: MSEdge.h:102
unsigned size() const
Returns the number of edges to pass.
Definition: MSRoute.cpp:87
static DictType myDict
Static dictionary to associate string-ids with objects.
Definition: MSEdge.h:668
static void readEdgeVector(std::istream &in, std::vector< const E * > &edges, const std::string &rid)
Reads an edge vector binary.
Definition: FileHelpers.h:279
#define SUMOReal
Definition: config.h:215
static const bool gUseMesoSim
Definition: MSGlobals.h:99
bool laneChangeAllowed() const
whether lane changing may be performed on this edge
Definition: MSEdge.cpp:113
SUMOReal getVehicleMaxSpeed(const SUMOVehicle *const veh) const
Returns the maximum speed the vehicle may use on this edge.
Definition: MSEdge.cpp:589
const MSLinkCont & getLinkCont() const
returns the container with all links !!!
Definition: MSLane.cpp:997
A free position is chosen.
MSLane * rightLane(const MSLane *const lane) const
Returns the lane right to the one given, 0 if the given lane is rightmost.
Definition: MSEdge.cpp:200
bool insertVehicle(SUMOVehicle &v, SUMOTime time) const
Tries to insert the given vehicle into the network.
Definition: MSEdge.cpp:362
MSEdge(const std::string &id, int numericalID, const EdgeBasicFunction function, const std::string &streetName="", const std::string &edgeType="")
Constructor.
Definition: MSEdge.cpp:71
The edge is an internal edge.
Definition: MSEdge.h:91
const std::vector< MSLane * > * getAllowedLanesWithDefault(const AllowedLanesCont &c, const MSEdge *dest) const
lookup in map and return 0 if not found
Definition: MSEdge.cpp:233
std::vector< MSPerson * > getSortedPersons(SUMOTime timestep) const
Returns this edge's persons sorted by pos.
Definition: MSEdge.cpp:596
Representation of a lane in the micro simulation.
Definition: MSLane.h:77
virtual const std::string & getID() const =0
Get the vehicle's ID.
MSRouteIterator begin() const
Returns the begin of the list of edges to pass.
Definition: MSRoute.cpp:75