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-2018 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
15 // The class for a PushButton
16 /****************************************************************************/
17 
18 #ifndef SRC_MICROSIM_TRAFFIC_LIGHTS_MSPUSHBUTTON_H_
19 #define SRC_MICROSIM_TRAFFIC_LIGHTS_MSPUSHBUTTON_H_
20 
21 #include <vector>
22 #include <map>
23 #include <string>
24 
25 class MSEdge;
26 class MSPhaseDefinition;
27 
31 class MSPushButton {
32 public:
33  virtual ~MSPushButton();
34 
39  virtual bool isActivated() const = 0;
40 
45  static bool anyActive(const std::vector<MSPushButton*>&);
46 protected:
52  MSPushButton(const MSEdge* edge, const MSEdge* crossingEdge);
53  const MSEdge* m_edge;
55 };
56 
61 public:
67  MSPedestrianPushButton(const MSEdge* walkingEdge, const MSEdge* crossingEdge);
69  }
70 
73  bool isActivated() const;
75 
81  static bool isActiveForEdge(const MSEdge* walkingEdge, const MSEdge* crossing);
82 
88  static bool isActiveOnAnySideOfTheRoad(const MSEdge* crossing);
89 
95  static std::vector<MSPushButton*> loadPushButtons(const MSPhaseDefinition*);
96 private:
97 // Map edge id -> list of crossing edges that crosses it
98  static std::map<std::string, std::vector<std::string> > m_crossingEdgeMap;
100 // Load the crossingEdgeMap
101  static void loadCrossingEdgeMap();
102 };
103 
104 #endif /* SRC_MICROSIM_TRAFFIC_LIGHTS_MSPUSHBUTTON_H_ */
static std::map< std::string, std::vector< std::string > > m_crossingEdgeMap
Definition: MSPushButton.h:98
virtual bool isActivated() const =0
Checks if the the pushbutton has been pressed.
static bool m_crossingEdgeMapLoaded
Definition: MSPushButton.h:99
A road/street connecting two junctions.
Definition: MSEdge.h:75
const MSEdge * m_edge
Definition: MSPushButton.h:53
const MSEdge * m_crossingEdge
Definition: MSPushButton.h:54
virtual ~MSPedestrianPushButton()
Definition: MSPushButton.h:68
static bool anyActive(const std::vector< MSPushButton *> &)
Checks if any pushbutton in the vector is active.
The definition of a single phase of a tls logic.
virtual ~MSPushButton()
MSPushButton(const MSEdge *edge, const MSEdge *crossingEdge)