SUMO - Simulation of Urban MObility
MSLinkCont.cpp
Go to the documentation of this file.
1 /****************************************************************************/
8 // Helpers for link vector
9 /****************************************************************************/
10 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
11 // Copyright (C) 2004-2017 DLR (http://www.dlr.de/) and contributors
12 /****************************************************************************/
13 //
14 // This file is part of SUMO.
15 // SUMO is free software: you can redistribute it and/or modify
16 // it under the terms of the GNU General Public License as published by
17 // the Free Software Foundation, either version 3 of the License, or
18 // (at your option) any later version.
19 //
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 "MSLinkCont.h"
33 #include "MSLane.h"
34 
35 
36 // ===========================================================================
37 // method definitions
38 // ===========================================================================
39 const MSEdge*
41  const MSEdge* followerAfterInternal) {
42  //@todo to be optimized
43  const MSLinkCont& lc = fromLane->getLinkCont();
44  for (MSLinkCont::const_iterator j = lc.begin(); j != lc.end(); j++) {
45  MSLink* link = *j;
46  if (&link->getLane()->getEdge() == followerAfterInternal) {
47  if (link->getViaLane() != 0) {
48  return &link->getViaLane()->getEdge();
49  } else {
50  return 0; // network without internal links
51  }
52  }
53  }
54  return 0;
55 }
56 
57 
58 const MSLane*
60  const MSLane* followerAfterInternal) {
61  //@todo to be optimized
62  const MSLinkCont& lc = fromLane->getLinkCont();
63  for (MSLinkCont::const_iterator j = lc.begin(); j != lc.end(); j++) {
64  MSLink* link = *j;
65  if (link->getLane() == followerAfterInternal) {
66  if (link->getViaLane() != 0) {
67  return link->getViaLane();
68  } else {
69  return 0; // network without internal links
70  }
71  }
72  }
73  return 0;
74 }
75 
76 
77 MSLink*
79  const MSLinkCont& lc = from.getLinkCont();
80  for (MSLinkCont::const_iterator j = lc.begin(); j != lc.end(); j++) {
81  MSLink* link = *j;
82  if (link->getLane() == &to) {
83  return link;
84  } else if (link->getViaLaneOrLane() == &to) {
85  return link;
86  }
87  }
88  return 0;
89 }
90 
91 
92 
93 /****************************************************************************/
94 
MSEdge & getEdge() const
Returns the lane&#39;s edge.
Definition: MSLane.h:582
A road/street connecting two junctions.
Definition: MSEdge.h:80
const MSLinkCont & getLinkCont() const
returns the container with all links !!!
Definition: MSLane.cpp:1597
Representation of a lane in the micro simulation.
Definition: MSLane.h:79