SUMO - Simulation of Urban MObility
MSLinkCont.cpp
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2004-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 /****************************************************************************/
18 // Helpers for link vector
19 /****************************************************************************/
20 
21 
22 // ===========================================================================
23 // included modules
24 // ===========================================================================
25 #ifdef _MSC_VER
26 #include <windows_config.h>
27 #else
28 #include <config.h>
29 #endif
30 
31 #include "MSLinkCont.h"
32 #include "MSLane.h"
33 
34 
35 // ===========================================================================
36 // method definitions
37 // ===========================================================================
38 const MSEdge*
40  const MSEdge* followerAfterInternal) {
41  //@todo to be optimized
42  const MSLinkCont& lc = fromLane->getLinkCont();
43  for (MSLinkCont::const_iterator j = lc.begin(); j != lc.end(); j++) {
44  MSLink* link = *j;
45  if (&link->getLane()->getEdge() == followerAfterInternal) {
46  if (link->getViaLane() != 0) {
47  return &link->getViaLane()->getEdge();
48  } else {
49  return 0; // network without internal links
50  }
51  }
52  }
53  return 0;
54 }
55 
56 
57 const MSLane*
59  const MSLane* followerAfterInternal) {
60  //@todo to be optimized
61  const MSLinkCont& lc = fromLane->getLinkCont();
62  for (MSLinkCont::const_iterator j = lc.begin(); j != lc.end(); j++) {
63  MSLink* link = *j;
64  if (link->getLane() == followerAfterInternal) {
65  if (link->getViaLane() != 0) {
66  return link->getViaLane();
67  } else {
68  return 0; // network without internal links
69  }
70  }
71  }
72  return 0;
73 }
74 
75 
76 MSLink*
78  const MSLinkCont& lc = from.getLinkCont();
79  for (MSLinkCont::const_iterator j = lc.begin(); j != lc.end(); j++) {
80  MSLink* link = *j;
81  if (link->getLane() == &to) {
82  return link;
83  } else if (link->getViaLaneOrLane() == &to) {
84  return link;
85  }
86  }
87  return 0;
88 }
89 
90 
91 
92 /****************************************************************************/
93 
MSEdge & getEdge() const
Returns the lane&#39;s edge.
Definition: MSLane.h:607
A road/street connecting two junctions.
Definition: MSEdge.h:80
const MSLinkCont & getLinkCont() const
returns the container with all links !!!
Definition: MSLane.cpp:1874
Representation of a lane in the micro simulation.
Definition: MSLane.h:77