SUMO - Simulation of Urban MObility
MSLogicJunction.cpp
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-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 /****************************************************************************/
20 // with one ore more logics.
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 "MSLogicJunction.h"
34 #include "MSLane.h"
35 
36 
37 // ===========================================================================
38 // member method definitions
39 // ===========================================================================
40 /* -------------------------------------------------------------------------
41  * methods from MSLogicJunction
42  * ----------------------------------------------------------------------- */
43 MSLogicJunction::MSLogicJunction(const std::string& id,
44  SumoXMLNodeType type,
45  const Position& position,
46  const PositionVector& shape,
47  std::vector<MSLane*> incoming
48  , std::vector<MSLane*> internal
49  ):
50  MSJunction(id, type, position, shape),
51  myIncomingLanes(incoming),
52  myInternalLanes(internal) {
53 }
54 
55 
57 
58 
59 void
61  /*
62  if(getID()=="1565") {
63  int bla = 0;
64  }
65  // inform links where they have to report approaching vehicles to
66  int requestPos = 0;
67  std::vector<MSLane*>::iterator i;
68  // going through the incoming lanes...
69  for(i=myIncomingLanes.begin(); i!=myIncomingLanes.end(); ++i) {
70  const MSLinkCont &links = (*i)->getLinkCont();
71  // ... set information for every link
72  for(MSLinkCont::const_iterator j=links.begin(); j!=links.end(); j++) {
73  (*j)->setRequestInformation(&myRequest, requestPos,
74  &myRespond, requestPos/, clearInfo/);
75  requestPos++;
76  }
77  }
78  // set information for the internal lanes
79  requestPos = 0;
80  for(i=myInternalLanes.begin(); i!=myInternalLanes.end(); ++i) {
81  // ... set information about participation
82  static_cast<MSInternalLane*>(*i)->setParentJunctionInformation(
83  &myInnerState, requestPos++);
84  }
85  */
86 }
87 
88 const std::vector<MSLane*>
90  // Besides the lanes im myInternal lanes, which are only the last parts of the connections,
91  // this collects all lanes on the junction
92  std::vector<MSLane*> allInternalLanes;
93  for (std::vector<MSLane*>::const_iterator i = myInternalLanes.begin(); i != myInternalLanes.end(); ++i) {
94  MSLane* l = *i;
95  while (l != 0) {
96  allInternalLanes.push_back(l);
97  const std::vector<MSLane::IncomingLaneInfo> incoming = l->getIncomingLanes();
98  if (incoming.size() == 0) {
99  break;
100  }
101  assert(l->getIncomingLanes().size() == 1);
102  l = l->getIncomingLanes()[0].lane;
103  if (!l->isInternal()) {
104  break;
105  }
106  }
107  }
108  return allInternalLanes;
109 }
110 
111 
112 
113 /****************************************************************************/
114 
const std::vector< IncomingLaneInfo > & getIncomingLanes() const
Definition: MSLane.h:752
The base class for an intersection.
Definition: MSJunction.h:64
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:45
A list of positions.
virtual ~MSLogicJunction()
Destructor.
const std::vector< MSLane * > getInternalLanes() const
Returns all internal lanes on the junction.
virtual void postloadInit()
initialises the junction after the whole net has been loaded
std::vector< MSLane * > myInternalLanes
list of internal lanes
SumoXMLNodeType
Numbers representing special SUMO-XML-attribute values for representing node- (junction-) types used ...
MSLogicJunction(const std::string &id, SumoXMLNodeType type, const Position &position, const PositionVector &shape, std::vector< MSLane *> incoming, std::vector< MSLane *> internal)
Constructor.
Representation of a lane in the micro simulation.
Definition: MSLane.h:77