Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
MSJunction.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/****************************************************************************/
20// The base class for an intersection
21/****************************************************************************/
22#include <config.h>
23
24#include "MSVehicle.h"
25#include "MSEdge.h"
26#include "MSJunction.h"
27
28
29
30
31
32
33// ===========================================================================
34// debug constants
35// ===========================================================================
36//#define DEBUG_LINKLEADER
37//#define DEBUG_COND (ego->isSelected())
38//#define DEBUG_COND (true)
39
40
41
42// ===========================================================================
43// class declarations
44// ===========================================================================
45class MSLink;
46
47// ===========================================================================
48// static member definitions
49// ===========================================================================
50
51// ===========================================================================
52// member method definition
53// ===========================================================================
54MSJunction::MSJunction(const std::string& id, SumoXMLNodeType type, const Position& position,
55 const PositionVector& shape, const std::string& name) :
56 Named(id),
57 myType(type),
58 myPosition(position),
59 myShape(shape),
60 myName(name) {
61}
62
63
65
66
67const Position&
68MSJunction::getPosition(bool secondaryShape) const {
69 return secondaryShape ? myPosition2 : myPosition;
70}
71
72
73void
75
76
77int
79 int nr = 0;
80 for (const MSEdge* e : myIncoming) {
81 nr += (int)e->getLanes().size();
82 }
83 return nr;
84}
85
86
87/****************************************************************************/
SumoXMLNodeType
Numbers representing special SUMO-XML-attribute values for representing node- (junction-) types used ...
A road/street connecting two junctions.
Definition MSEdge.h:77
Position myPosition2
The secondary position of the junction.
Definition MSJunction.h:153
virtual ~MSJunction()
Destructor.
Position myPosition
The position of the junction.
Definition MSJunction.h:150
int getNrOfIncomingLanes() const
MSJunction(const std::string &id, SumoXMLNodeType type, const Position &position, const PositionVector &shape, const std::string &name)
Constructor.
ConstMSEdgeVector myIncoming
incoming edges
Definition MSJunction.h:166
const Position & getPosition(bool secondaryShape=false) const
virtual void postloadInit()
Base class for objects which have an id.
Definition Named.h:54
A point in 2D or 3D with translation and scaling methods.
Definition Position.h:37
A list of positions.