Eclipse SUMO - Simulation of Urban MObility
MSPushButton.h
Go to the documentation of this file.
1
/****************************************************************************/
2
// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3
// Copyright (C) 2010-2020 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
/****************************************************************************/
18
// The class for a PushButton
19
/****************************************************************************/
20
21
#pragma once
22
23
#include <vector>
24
#include <map>
25
#include <string>
26
27
class
MSEdge
;
28
class
MSPhaseDefinition
;
29
33
class
MSPushButton
{
34
public
:
35
virtual
~MSPushButton
();
36
41
virtual
bool
isActivated
()
const
= 0;
42
47
static
bool
anyActive
(
const
std::vector<MSPushButton*>&);
48
protected
:
54
MSPushButton
(
const
MSEdge
* edge,
const
MSEdge
* crossingEdge);
55
const
MSEdge
*
m_edge
;
56
const
MSEdge
*
m_crossingEdge
;
57
};
58
62
class
MSPedestrianPushButton
:
MSPushButton
{
63
public
:
69
MSPedestrianPushButton
(
const
MSEdge
* walkingEdge,
const
MSEdge
* crossingEdge);
70
virtual
~MSPedestrianPushButton
() {
71
}
72
75
bool
isActivated
()
const
;
77
83
static
bool
isActiveForEdge
(
const
MSEdge
* walkingEdge,
const
MSEdge
* crossing);
84
90
static
bool
isActiveOnAnySideOfTheRoad
(
const
MSEdge
* crossing);
91
97
static
std::vector<MSPushButton*>
loadPushButtons
(
const
MSPhaseDefinition
*);
98
private
:
99
// Map edge id -> list of crossing edges that crosses it
100
static
std::map<std::string, std::vector<std::string> >
m_crossingEdgeMap
;
101
static
bool
m_crossingEdgeMapLoaded
;
102
// Load the crossingEdgeMap
103
static
void
loadCrossingEdgeMap
();
104
};
105
MSEdge
A road/street connecting two junctions.
Definition:
MSEdge.h:77
MSPedestrianPushButton
Definition:
MSPushButton.h:62
MSPedestrianPushButton::isActiveOnAnySideOfTheRoad
static bool isActiveOnAnySideOfTheRoad(const MSEdge *crossing)
Static method to check if the push button is active on both side of the road.
Definition:
MSPushButton.cpp:140
MSPedestrianPushButton::isActiveForEdge
static bool isActiveForEdge(const MSEdge *walkingEdge, const MSEdge *crossing)
Static method with the same behavior of isActivated.
Definition:
MSPushButton.cpp:61
MSPedestrianPushButton::loadPushButtons
static std::vector< MSPushButton * > loadPushButtons(const MSPhaseDefinition *)
Loads all the pushbuttons for all the controlled lanes of a stage.
Definition:
MSPushButton.cpp:152
MSPedestrianPushButton::~MSPedestrianPushButton
virtual ~MSPedestrianPushButton()
Definition:
MSPushButton.h:70
MSPedestrianPushButton::isActivated
bool isActivated() const
abstract methods inherited from PedestrianState
Definition:
MSPushButton.cpp:57
MSPedestrianPushButton::m_crossingEdgeMapLoaded
static bool m_crossingEdgeMapLoaded
Definition:
MSPushButton.h:101
MSPedestrianPushButton::loadCrossingEdgeMap
static void loadCrossingEdgeMap()
Definition:
MSPushButton.cpp:185
MSPedestrianPushButton::MSPedestrianPushButton
MSPedestrianPushButton(const MSEdge *walkingEdge, const MSEdge *crossingEdge)
Definition:
MSPushButton.cpp:51
MSPedestrianPushButton::m_crossingEdgeMap
static std::map< std::string, std::vector< std::string > > m_crossingEdgeMap
Definition:
MSPushButton.h:100
MSPhaseDefinition
The definition of a single phase of a tls logic.
Definition:
MSPhaseDefinition.h:48
MSPushButton
Definition:
MSPushButton.h:33
MSPushButton::MSPushButton
MSPushButton(const MSEdge *edge, const MSEdge *crossingEdge)
Definition:
MSPushButton.cpp:30
MSPushButton::isActivated
virtual bool isActivated() const =0
Checks if the the pushbutton has been pressed.
MSPushButton::m_edge
const MSEdge * m_edge
Definition:
MSPushButton.h:55
MSPushButton::~MSPushButton
virtual ~MSPushButton()
Definition:
MSPushButton.cpp:35
MSPushButton::m_crossingEdge
const MSEdge * m_crossingEdge
Definition:
MSPushButton.h:56
MSPushButton::anyActive
static bool anyActive(const std::vector< MSPushButton * > &)
Checks if any pushbutton in the vector is active.
Definition:
MSPushButton.cpp:39
src
microsim
traffic_lights
MSPushButton.h
Generated on Sat Jan 23 2021 10:47:24 for Eclipse SUMO - Simulation of Urban MObility by
1.9.1