Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
MSNoLogicJunction.cpp
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2002-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/****************************************************************************/
20// -------------------
21/****************************************************************************/
22#include <config.h>
23
24#include <algorithm>
25#include <cassert>
26#include <cmath>
27#include "MSLane.h"
28#include "MSLink.h"
29#include "MSNoLogicJunction.h"
30
31
32// ===========================================================================
33// static member definitions
34// ===========================================================================
35
36// ===========================================================================
37// method definitions
38// ===========================================================================
40 SumoXMLNodeType type,
41 const Position& position,
42 const PositionVector& shape,
43 const std::string& name,
44 std::vector<MSLane*> incoming, std::vector<MSLane*> internal):
45 MSJunction(id, type, position, shape, name),
46 myIncomingLanes(incoming),
47 myInternalLanes(internal) {
48}
49
50
52
53
54void
56 // inform links where they have to report approaching vehicles to
57 for (const MSLane* const l : myIncomingLanes) {
58 for (MSLink* const link : l->getLinkCont()) {
59 link->setRequestInformation(-1, false, false, std::vector<MSLink*>(), std::vector<MSLane*>());
60 }
61 }
62}
63
64
65const std::vector<MSLane*>
67 // Besides the lanes im myInternal lanes, which are only the last parts of the connections,
68 // this collects all lanes on the junction
69 std::vector<MSLane*> allInternalLanes;
70 for (std::vector<MSLane*>::const_iterator i = myInternalLanes.begin(); i != myInternalLanes.end(); ++i) {
71 MSLane* l = *i;
72 while (l != nullptr) {
73 allInternalLanes.push_back(l);
74 const std::vector<MSLane::IncomingLaneInfo> incoming = l->getIncomingLanes();
75 if (incoming.size() == 0) {
76 break;
77 }
78 assert(l->getIncomingLanes().size() == 1);
79 l = l->getIncomingLanes()[0].lane;
80 if (!l->isInternal()) {
81 break;
82 }
83 }
84 }
85 return allInternalLanes;
86}
87
88
89/****************************************************************************/
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:2546
virtual const std::vector< MSLane * > getInternalLanes() const
Returns all internal lanes on the junction.
std::vector< MSLane * > myIncomingLanes
std::vector< MSLane * > myInternalLanes
MSNoLogicJunction(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.
virtual ~MSNoLogicJunction()
Destructor.
A point in 2D or 3D with translation and scaling methods.
Definition Position.h:37
A list of positions.