SUMO - Simulation of Urban MObility
MSPedestrianPushButton Class Reference

#include <MSPushButton.h>

Inheritance diagram for MSPedestrianPushButton:
Inheritance graph
Collaboration diagram for MSPedestrianPushButton:
Collaboration graph

Public Member Functions

 MSPedestrianPushButton (const MSEdge *walkingEdge, const MSEdge *crossingEdge)
 
virtual ~MSPedestrianPushButton ()
 
bool isActivated () const
 abstract methods inherited from PedestrianState More...
 

Static Public Member Functions

static bool isActiveForEdge (const MSEdge *walkingEdge, const MSEdge *crossing)
 Static method with the same behavior of isActivated. More...
 
static bool isActiveOnAnySideOfTheRoad (const MSEdge *crossing)
 Static method to check if the push button is active on both side of the road. More...
 
static std::vector< MSPushButton * > loadPushButtons (const MSPhaseDefinition *)
 Loads all the pushbuttons for all the controlled lanes of a stage. More...
 

Static Private Member Functions

static bool anyActive (const std::vector< MSPushButton * > &)
 Checks if any pushbutton in the vector is active. More...
 
static void loadCrossingEdgeMap ()
 

Private Attributes

const MSEdgem_crossingEdge
 
const MSEdgem_edge
 

Static Private Attributes

static std::map< std::string, std::vector< std::string > > m_crossingEdgeMap
 
static bool m_crossingEdgeMapLoaded = false
 

Detailed Description

Pedestrian push button

Definition at line 63 of file MSPushButton.h.

Constructor & Destructor Documentation

MSPedestrianPushButton::MSPedestrianPushButton ( const MSEdge walkingEdge,
const MSEdge crossingEdge 
)

MSPedestrianPushButton constructor

Parameters
[in]edgethe edge where the push button is located. Must be a walking area.
[in]crossingEdgethe crossing controlled by the push button. Must be a crossing.

Definition at line 51 of file MSPushButton.cpp.

References MSEdge::getPermissions(), MSEdge::isCrossing(), MSEdge::isWalkingArea(), and SVC_PEDESTRIAN.

Referenced by loadPushButtons().

virtual MSPedestrianPushButton::~MSPedestrianPushButton ( )
inlinevirtual

Definition at line 71 of file MSPushButton.h.

References MSPushButton::isActivated().

Member Function Documentation

bool MSPushButton::anyActive ( const std::vector< MSPushButton * > &  pushButtons)
staticinherited

Checks if any pushbutton in the vector is active.

Returns
True if at least one pushbutton is active, false otherwise

Definition at line 39 of file MSPushButton.cpp.

References m_crossingEdgeMap, and m_crossingEdgeMapLoaded.

Referenced by MSSOTLTrafficLightLogic::isPushButtonPressed().

bool MSPedestrianPushButton::isActivated ( ) const
virtual

abstract methods inherited from PedestrianState

Implements MSPushButton.

Definition at line 57 of file MSPushButton.cpp.

References isActiveForEdge(), MSPushButton::m_crossingEdge, and MSPushButton::m_edge.

bool MSPedestrianPushButton::isActiveForEdge ( const MSEdge walkingEdge,
const MSEdge crossing 
)
static

Static method with the same behavior of isActivated.

Checks if the the pushbutton has been pressed for a particular crossing from a edge.

Returns
true if pressed, false otherwise

TODO keep using >= 1 or switch to ==1. Should change return value from always active to active only when pressed? TODO If changed the swarm logic must be changed since it relies on this behavior that keeps it active

Definition at line 61 of file MSPushButton.cpp.

References DBG, Named::getID(), MSBaseVehicle::getID(), MSTransportable::getID(), MSEdge::getLanes(), MSPerson::getNextEdgePtr(), MSEdge::getPersons(), MSEdge::getPredecessors(), MSEdge::getSuccessors(), MSBaseVehicle::getVClass(), MSLane::getVehiclesSecure(), MSTransportable::getWaitingSeconds(), MSVehicle::getWaitingSeconds(), MSLane::releaseVehicles(), MSBaseVehicle::succEdge(), SVC_PEDESTRIAN, and WRITE_MESSAGE.

Referenced by isActivated(), and isActiveOnAnySideOfTheRoad().

bool MSPedestrianPushButton::isActiveOnAnySideOfTheRoad ( const MSEdge crossing)
static

Static method to check if the push button is active on both side of the road.

Parameters
[in]Acrossing edge
Returns
true if pressed, false otherwise

Definition at line 140 of file MSPushButton.cpp.

References DBG, Named::getID(), getWalkingAreas(), isActiveForEdge(), and WRITE_MESSAGE.

void MSPedestrianPushButton::loadCrossingEdgeMap ( )
staticprivate
std::vector< MSPushButton * > MSPedestrianPushButton::loadPushButtons ( const MSPhaseDefinition phase)
static

Loads all the pushbuttons for all the controlled lanes of a stage.

Parameters
[in]Aphase definition
Returns
A list of pushbuttons

Definition at line 152 of file MSPushButton.cpp.

References DBG, MSLane::dictionary(), MSEdge::dictionary(), MSLane::getEdge(), Named::getID(), MSPhaseDefinition::getState(), MSPhaseDefinition::getTargetLaneSet(), getWalkingAreas(), loadCrossingEdgeMap(), m_crossingEdgeMap, MSPedestrianPushButton(), and WRITE_MESSAGE.

Referenced by MSSOTLTrafficLightLogic::isPushButtonPressed().

Field Documentation

const MSEdge* MSPushButton::m_crossingEdge
protectedinherited

Definition at line 57 of file MSPushButton.h.

Referenced by isActivated(), and MSPushButton::MSPushButton().

std::map< std::string, std::vector< std::string > > MSPedestrianPushButton::m_crossingEdgeMap
staticprivate

Definition at line 101 of file MSPushButton.h.

Referenced by MSPushButton::anyActive(), loadCrossingEdgeMap(), and loadPushButtons().

bool MSPedestrianPushButton::m_crossingEdgeMapLoaded = false
staticprivate

Definition at line 102 of file MSPushButton.h.

Referenced by MSPushButton::anyActive(), and loadCrossingEdgeMap().

const MSEdge* MSPushButton::m_edge
protectedinherited

Definition at line 56 of file MSPushButton.h.

Referenced by isActivated(), and MSPushButton::MSPushButton().


The documentation for this class was generated from the following files: