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-2017 German Aerospace Center (DLR) and others.
4 /****************************************************************************/
5 //
6 // This program and the accompanying materials
7 // are made available under the terms of the Eclipse Public License v2.0
8 // which accompanies this distribution, and is available at
9 // http://www.eclipse.org/legal/epl-v20.html
10 //
11 /****************************************************************************/
17 // The class for a PushButton
18 /****************************************************************************/
19 
20 #ifndef SRC_MICROSIM_TRAFFIC_LIGHTS_MSPUSHBUTTON_H_
21 #define SRC_MICROSIM_TRAFFIC_LIGHTS_MSPUSHBUTTON_H_
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;
57 };
58 
63 public:
69  MSPedestrianPushButton(const MSEdge* walkingEdge, const MSEdge* crossingEdge);
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;
102 // Load the crossingEdgeMap
103  static void loadCrossingEdgeMap();
104 };
105 
106 #endif /* SRC_MICROSIM_TRAFFIC_LIGHTS_MSPUSHBUTTON_H_ */
static std::map< std::string, std::vector< std::string > > m_crossingEdgeMap
Definition: MSPushButton.h:100
virtual bool isActivated() const =0
Checks if the the pushbutton has been pressed.
static bool m_crossingEdgeMapLoaded
Definition: MSPushButton.h:101
A road/street connecting two junctions.
Definition: MSEdge.h:80
const MSEdge * m_edge
Definition: MSPushButton.h:55
const MSEdge * m_crossingEdge
Definition: MSPushButton.h:56
virtual ~MSPedestrianPushButton()
Definition: MSPushButton.h:70
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)