Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/src/microsim/MSJunction.cpp
185785 views
1
/****************************************************************************/
2
// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3
// Copyright (C) 2001-2025 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
/****************************************************************************/
14
/// @file MSJunction.cpp
15
/// @author Christian Roessel
16
/// @author Daniel Krajzewicz
17
/// @author Michael Behrisch
18
/// @date Wed, 12 Dez 2001
19
///
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
// ===========================================================================
45
class MSLink;
46
47
// ===========================================================================
48
// static member definitions
49
// ===========================================================================
50
51
// ===========================================================================
52
// member method definition
53
// ===========================================================================
54
MSJunction::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
64
MSJunction::~MSJunction() {}
65
66
67
const Position&
68
MSJunction::getPosition(bool secondaryShape) const {
69
return secondaryShape ? myPosition2 : myPosition;
70
}
71
72
73
void
74
MSJunction::postloadInit() {}
75
76
77
int
78
MSJunction::getNrOfIncomingLanes() const {
79
int nr = 0;
80
for (const MSEdge* e : myIncoming) {
81
nr += (int)e->getLanes().size();
82
}
83
return nr;
84
}
85
86
87
/****************************************************************************/
88
89