Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
MSLogicJunction.cpp
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2001-2024 German Aerospace Center (DLR) and others.
4// This program and the accompanying materials are made available under the
5// terms of the Eclipse Public License 2.0 which is available at
6// https://www.eclipse.org/legal/epl-2.0/
7// This Source Code may also be made available under the following Secondary
8// Licenses when the conditions for such availability set forth in the Eclipse
9// Public License 2.0 are satisfied: GNU General Public License, version 2
10// or later which is available at
11// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13/****************************************************************************/
21// with one ore more logics.
22/****************************************************************************/
23#include <config.h>
24
25#include "MSLogicJunction.h"
26#include "MSLane.h"
27
28
29// ===========================================================================
30// member method definitions
31// ===========================================================================
32/* -------------------------------------------------------------------------
33 * methods from MSLogicJunction
34 * ----------------------------------------------------------------------- */
36 SumoXMLNodeType type,
37 const Position& position,
38 const PositionVector& shape,
39 const std::string& name,
40 std::vector<MSLane*> incoming,
41 std::vector<MSLane*> internal):
42 MSJunction(id, type, position, shape, name),
43 myIncomingLanes(incoming),
44 myInternalLanes(internal) {
45}
46
47
49
50
51void
53 /*
54 if(getID()=="1565") {
55 int bla = 0;
56 }
57 // inform links where they have to report approaching vehicles to
58 int requestPos = 0;
59 std::vector<MSLane*>::iterator i;
60 // going through the incoming lanes...
61 for(i=myIncomingLanes.begin(); i!=myIncomingLanes.end(); ++i) {
62 const MSLinkCont &links = (*i)->getLinkCont();
63 // ... set information for every link
64 for(MSLinkCont::const_iterator j=links.begin(); j!=links.end(); j++) {
65 (*j)->setRequestInformation(&myRequest, requestPos,
66 &myRespond, requestPos/, clearInfo/);
67 requestPos++;
68 }
69 }
70 // set information for the internal lanes
71 requestPos = 0;
72 for(i=myInternalLanes.begin(); i!=myInternalLanes.end(); ++i) {
73 // ... set information about participation
74 static_cast<MSInternalLane*>(*i)->setParentJunctionInformation(
75 &myInnerState, requestPos++);
76 }
77 */
78}
79
80const std::vector<MSLane*>
82 // Besides the lanes im myInternal lanes, which are only the last parts of the connections,
83 // this collects all lanes on the junction
84 std::vector<MSLane*> allInternalLanes;
85 for (std::vector<MSLane*>::const_iterator i = myInternalLanes.begin(); i != myInternalLanes.end(); ++i) {
86 MSLane* l = *i;
87 while (l != nullptr) {
88 allInternalLanes.push_back(l);
89 const std::vector<MSLane::IncomingLaneInfo> incoming = l->getIncomingLanes();
90 if (incoming.size() == 0) {
91 break;
92 }
93 assert(l->getIncomingLanes().size() == 1);
94 l = l->getIncomingLanes()[0].lane;
95 if (!l->isInternal()) {
96 break;
97 }
98 }
99 }
100 return allInternalLanes;
101}
102
103
104/****************************************************************************/
SumoXMLNodeType
Numbers representing special SUMO-XML-attribute values for representing node- (junction-) types used ...
The base class for an intersection.
Definition MSJunction.h:58
Representation of a lane in the micro simulation.
Definition MSLane.h:84
const std::vector< IncomingLaneInfo > & getIncomingLanes() const
Definition MSLane.h:950
bool isInternal() const
Definition MSLane.cpp:2545
MSLogicJunction(const std::string &id, SumoXMLNodeType type, const Position &position, const PositionVector &shape, const std::string &name, std::vector< MSLane * > incoming, std::vector< MSLane * > internal)
Constructor.
std::vector< MSLane * > myInternalLanes
list of internal lanes
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
virtual ~MSLogicJunction()
Destructor.
A point in 2D or 3D with translation and scaling methods.
Definition Position.h:37
A list of positions.