SUMO - Simulation of Urban MObility
MSNoLogicJunction.cpp
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2002-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 // -------------------
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 "MSNoLogicJunction.h"
33 #include "MSLane.h"
34 #include <algorithm>
35 #include <cassert>
36 #include <cmath>
37 
38 
39 // ===========================================================================
40 // static member definitions
41 // ===========================================================================
42 
43 // ===========================================================================
44 // method definitions
45 // ===========================================================================
47  SumoXMLNodeType type,
48  const Position& position,
49  const PositionVector& shape,
50  std::vector<MSLane*> incoming, std::vector<MSLane*> internal):
51  MSJunction(id, type, position, shape),
52  myIncomingLanes(incoming),
53  myInternalLanes(internal) {
54 }
55 
56 
58 
59 
60 void
62  std::vector<MSLane*>::iterator i;
63  // inform links where they have to report approaching vehicles to
64  for (i = myIncomingLanes.begin(); i != myIncomingLanes.end(); ++i) {
65  const MSLinkCont& links = (*i)->getLinkCont();
66  for (MSLinkCont::const_iterator j = links.begin(); j != links.end(); j++) {
67  (*j)->setRequestInformation(-1, false, false, std::vector<MSLink*>(), std::vector<MSLane*>());
68  }
69  }
70 }
71 
72 
73 const std::vector<MSLane*>
75  // Besides the lanes im myInternal lanes, which are only the last parts of the connections,
76  // this collects all lanes on the junction
77  std::vector<MSLane*> allInternalLanes;
78  for (std::vector<MSLane*>::const_iterator i = myInternalLanes.begin(); i != myInternalLanes.end(); ++i) {
79  MSLane* l = *i;
80  while (l != 0) {
81  allInternalLanes.push_back(l);
82  const std::vector<MSLane::IncomingLaneInfo> incoming = l->getIncomingLanes();
83  if (incoming.size() == 0) {
84  break;
85  }
86  assert(l->getIncomingLanes().size() == 1);
87  l = l->getIncomingLanes()[0].lane;
88  if (!l->isInternal()) {
89  break;
90  }
91  }
92  }
93  return allInternalLanes;
94 }
95 
96 
97 
98 /****************************************************************************/
99 
const std::vector< IncomingLaneInfo > & getIncomingLanes() const
Definition: MSLane.h:752
virtual const std::vector< MSLane * > getInternalLanes() const
Returns all internal lanes on the junction.
std::vector< MSLane * > myIncomingLanes
The base class for an intersection.
Definition: MSJunction.h:64
virtual ~MSNoLogicJunction()
Destructor.
MSNoLogicJunction(const std::string &id, SumoXMLNodeType type, const Position &position, const PositionVector &shape, std::vector< MSLane *> incoming, std::vector< MSLane *> internal)
Constructor.
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:45
A list of positions.
std::vector< MSLane * > myInternalLanes
SumoXMLNodeType
Numbers representing special SUMO-XML-attribute values for representing node- (junction-) types used ...
Representation of a lane in the micro simulation.
Definition: MSLane.h:77