SUMO - Simulation of Urban MObility
MSPerson Class Reference

#include <MSPerson.h>

Inheritance diagram for MSPerson:
Inheritance graph
Collaboration diagram for MSPerson:
Collaboration graph

Data Structures

class  Influencer
 Changes the wished person speed and position. More...
 
class  MSPersonStage_Access
 
class  MSPersonStage_Driving
 
class  MSPersonStage_Walking
 

Public Types

typedef std::vector< MSTransportable::Stage * > MSTransportablePlan
 the structure holding the plan of a transportable More...
 
enum  StageType {
  WAITING_FOR_DEPART = 0, WAITING = 1, MOVING_WITHOUT_VEHICLE = 2, DRIVING = 3,
  ACCESS = 4, TRIP = 5
}
 

Public Member Functions

void appendStage (Stage *stage, int next=-1)
 Appends the given stage to the current plan. More...
 
virtual double getAngle () const
 return the current angle of the transportable More...
 
const MSEdgegetArrivalEdge () const
 returns the final arrival edge More...
 
double getArrivalPos () const
 returns the final arrival pos More...
 
PositionVector getBoundingBox () const
 return the bounding box of the person More...
 
MSTransportable::StagegetCurrentStage () const
 Return the current stage. More...
 
std::string getCurrentStageDescription () const
 Returns the current stage description as a string. More...
 
StageType getCurrentStageType () const
 the current stage type of the transportable More...
 
SUMOTime getDesiredDepart () const
 Returns the desired departure time. More...
 
const MSEdgegetDestination () const
 Returns the current destination. More...
 
const MSEdgegetEdge () const
 Returns the current edge. More...
 
virtual double getEdgePos () const
 Return the position on the edge. More...
 
ConstMSEdgeVector getEdges (int next) const
 Return the edges of the nth next stage. More...
 
const MSEdgegetFromEdge () const
 Returns the departure edge. More...
 
const std::string & getID () const
 returns the id of the transportable More...
 
InfluencergetInfluencer ()
 Returns the velocity/lane influencer. More...
 
const InfluencergetInfluencer () const
 
const MSEdgegetNextDestination () const
 Returns the destination after the current destination. More...
 
const std::string & getNextEdge () const
 return the list of internal edges if this person is walking and the pedestrian model allows it More...
 
const MSEdgegetNextEdgePtr () const
 returns the next edge ptr if this person is walking and the pedestrian model allows it More...
 
MSTransportable::StagegetNextStage (int next) const
 Return the current stage. More...
 
int getNumRemainingStages () const
 Return the number of remaining stages (including the current) More...
 
int getNumStages () const
 Return the total number stages in this persons plan. More...
 
const SUMOVehicleParametergetParameter () const
 
virtual Position getPosition () const
 Return the Network coordinate of the transportable. More...
 
MSVehicleTypegetSingularType ()
 Replaces the current vehicle type with a new one used by this vehicle only. More...
 
virtual double getSpeed () const
 the current speed of the transportable More...
 
double getSpeedFactor () const
 the current speed factor of the transportable (where applicable) More...
 
std::string getStageSummary (int stageIndex) const
 return textual summary for the given stage More...
 
StageType getStageType (int next) const
 the stage type for the nth next stage More...
 
SUMOVehiclegetVehicle () const
 The vehicle associated with this transportable. More...
 
const MSVehicleTypegetVehicleType () const
 
virtual double getWaitingSeconds () const
 the time this transportable spent waiting in seconds More...
 
bool hasArrived () const
 return whether the person has reached the end of its plan More...
 
bool hasInfluencer () const
 
virtual bool isSelected () const
 whether this person is selected in the GUI More...
 
bool isWaiting4Vehicle () const
 Whether the transportable waits for a vehicle. More...
 
bool isWaitingFor (const std::string &line) const
 Whether the transportable waits for a vehicle of the line specified. More...
 
 MSPerson (const SUMOVehicleParameter *pars, MSVehicleType *vtype, MSTransportable::MSTransportablePlan *plan, const double speedFactor)
 constructor More...
 
bool proceed (MSNet *net, SUMOTime time)
 
void removeStage (int next)
 removes the nth next stage More...
 
void replaceVehicleType (MSVehicleType *type)
 Replaces the current vehicle type by the one given. More...
 
void reroute (ConstMSEdgeVector &newEdges, double departPos, int firstIndex, int nextIndex)
 set new walk and replace the stages with relative indices in the interval [firstIndex, nextIndex[ More...
 
void rerouteParkingArea (MSStoppingPlace *orig, MSStoppingPlace *replacement)
 adapt plan when the vehicle reroutes and now stops at replacement instead of orig More...
 
virtual void routeOutput (OutputDevice &os, const bool withRouteLength) const
 Called on writing vehroute output. More...
 
void setDeparted (SUMOTime now)
 logs depart time of the current stage More...
 
void setRemoteState (Position xyPos)
 sets position outside the road network More...
 
void setSpeed (double speed)
 sets the walking speed (ignored in other stages) More...
 
virtual void tripInfoOutput (OutputDevice &os) const
 Called on writing tripinfo output. More...
 
virtual ~MSPerson ()
 destructor More...
 

Protected Attributes

const SUMOVehicleParametermyParameter
 the plan of the transportable More...
 
MSTransportablePlanmyPlan
 the plan of the transportable More...
 
MSTransportablePlan::iterator myStep
 the iterator over the route More...
 
MSVehicleTypemyVType
 This transportable's type. (mainly used for drawing related information Note sure if it is really necessary. More...
 
bool myWriteEvents
 Whether events shall be written. More...
 

Static Protected Attributes

static const double ROADSIDE_OFFSET
 the offset for computing positions when standing at an edge More...
 

Private Member Functions

 MSPerson (const MSPerson &)
 Invalidated copy constructor. More...
 
MSPersonoperator= (const MSPerson &)
 Invalidated assignment operator. More...
 

Private Attributes

const double myChosenSpeedFactor
 
InfluencermyInfluencer
 An instance of a speed/position influencing instance; built in "getInfluencer". More...
 

Static Private Attributes

static DummyState myDummyState
 

Detailed Description

The class holds a simulated person together with her movement stages

Definition at line 64 of file MSPerson.h.

Member Typedef Documentation

◆ MSTransportablePlan

the structure holding the plan of a transportable

Definition at line 489 of file MSTransportable.h.

Member Enumeration Documentation

◆ StageType

Enumerator
WAITING_FOR_DEPART 
WAITING 
MOVING_WITHOUT_VEHICLE 
DRIVING 
ACCESS 
TRIP 

Definition at line 59 of file MSTransportable.h.

Constructor & Destructor Documentation

◆ MSPerson() [1/2]

MSPerson::MSPerson ( const SUMOVehicleParameter pars,
MSVehicleType vtype,
MSTransportable::MSTransportablePlan plan,
const double  speedFactor 
)

constructor

Definition at line 547 of file MSPerson.cpp.

◆ ~MSPerson()

MSPerson::~MSPerson ( )
virtual

destructor

Definition at line 553 of file MSPerson.cpp.

◆ MSPerson() [2/2]

MSPerson::MSPerson ( const MSPerson )
private

Invalidated copy constructor.

Member Function Documentation

◆ appendStage()

◆ getAngle()

◆ getArrivalEdge()

const MSEdge* MSTransportable::getArrivalEdge ( ) const
inlineinherited

◆ getArrivalPos()

double MSTransportable::getArrivalPos ( ) const
inlineinherited

◆ getBoundingBox()

◆ getCurrentStage()

◆ getCurrentStageDescription()

std::string MSTransportable::getCurrentStageDescription ( ) const
inlineinherited

◆ getCurrentStageType()

◆ getDesiredDepart()

SUMOTime MSTransportable::getDesiredDepart ( ) const
inherited

◆ getDestination()

const MSEdge* MSTransportable::getDestination ( ) const
inlineinherited

◆ getEdge()

◆ getEdgePos()

◆ getEdges()

◆ getFromEdge()

◆ getID()

const std::string & MSTransportable::getID ( ) const
inherited

returns the id of the transportable

Definition at line 640 of file MSTransportable.cpp.

References SUMOVehicleParameter::id, and MSTransportable::myParameter.

Referenced by MSTransportableControl::abortWaitingForVehicle(), MSPModel_Remote::add(), MSPModel_Striping::add(), MSVehicle::addContainer(), MSVehicle::addPerson(), MSTransportable::appendStage(), libsumo::Person::appendWalkingStage(), MSPerson::MSPersonStage_Walking::beginEventOutput(), MSContainer::MSContainerStage_Tranship::beginEventOutput(), MSTransportable::Stage_Waiting::beginEventOutput(), MSTransportable::Stage_Driving::beginEventOutput(), MSPersonDevice_Routing::buildDevices(), MSPModel_Striping::PState::distanceTo(), MSPerson::MSPersonStage_Walking::endEventOutput(), MSContainer::MSContainerStage_Tranship::endEventOutput(), MSTransportable::Stage_Waiting::endEventOutput(), MSTransportable::Stage_Driving::endEventOutput(), MSTransportableControl::erase(), MSPModel_Striping::MovePedestrians::execute(), MSPModel_Striping::getNeighboringObstacles(), MSPModel_Striping::getNextLane(), MSPModel_Striping::getNextLaneObstacles(), GUIContainer::getParameterWindow(), GUIPerson::getParameterWindow(), MSTransportable::getSingularType(), MSPModel_Striping::getVehicleObstacles(), MSPedestrianPushButton::isActiveForEdge(), MSPModel_Striping::moveInDirection(), MSPModel_Striping::moveInDirectionOnLane(), MSPModel_Striping::PState::moveToNextLane(), libsumo::Person::moveToXY(), MSDevice_Transportable::notifyLeave(), MSPModel_Striping::by_xpos_sorter::operator()(), MSEdge::transportable_by_position_sorter::operator()(), MSContainer::MSContainerStage_Driving::proceed(), MSPerson::MSPersonStage_Driving::proceed(), MSPModel_Striping::PState::PState(), reroute(), MSContainer::MSContainerStage_Driving::routeOutput(), MSContainer::routeOutput(), MSPerson::MSPersonStage_Driving::routeOutput(), MSTransportable::Stage_Waiting::routeOutput(), MSTransportable::Stage_Trip::setArrived(), libsumo::Helper::setRemoteControlled(), MSContainer::tripInfoOutput(), MSPerson::MSPersonStage_Access::tripInfoOutput(), tripInfoOutput(), MSPModel_Striping::PState::walk(), MSFCDExport::writeTransportable(), and MSXMLRawOut::writeTransportable().

◆ getInfluencer() [1/2]

MSPerson::Influencer & MSPerson::getInfluencer ( )

Returns the velocity/lane influencer.

If no influencer was existing before, one is built, first

Returns
Reference to this vehicle's speed influencer

Definition at line 690 of file MSPerson.cpp.

References myInfluencer.

Referenced by libsumo::Helper::setRemoteControlled().

◆ getInfluencer() [2/2]

const MSPerson::Influencer * MSPerson::getInfluencer ( ) const

Definition at line 699 of file MSPerson.cpp.

References myInfluencer.

◆ getNextDestination()

const MSEdge* MSTransportable::getNextDestination ( ) const
inlineinherited

Returns the destination after the current destination.

Definition at line 524 of file MSTransportable.h.

References MSTransportable::myStep.

◆ getNextEdge()

const std::string & MSPerson::getNextEdge ( ) const

return the list of internal edges if this person is walking and the pedestrian model allows it

Definition at line 605 of file MSPerson.cpp.

References StringUtils::emptyString, Named::getID(), and getNextEdgePtr().

Referenced by libsumo::Person::getNextEdge().

◆ getNextEdgePtr()

const MSEdge * MSPerson::getNextEdgePtr ( ) const

returns the next edge ptr if this person is walking and the pedestrian model allows it

Definition at line 624 of file MSPerson.cpp.

References MSTransportable::getCurrentStageType(), PedestrianState::getNextEdge(), MSPerson::MSPersonStage_Walking::getPedestrianState(), and MSTransportable::MOVING_WITHOUT_VEHICLE.

Referenced by getNextEdge(), and MSPedestrianPushButton::isActiveForEdge().

◆ getNextStage()

MSTransportable::Stage* MSTransportable::getNextStage ( int  next) const
inlineinherited

◆ getNumRemainingStages()

◆ getNumStages()

int MSTransportable::getNumStages ( ) const
inherited

◆ getParameter()

◆ getPosition()

Position MSTransportable::getPosition ( ) const
virtualinherited

◆ getSingularType()

MSVehicleType & MSTransportable::getSingularType ( )
inherited

Replaces the current vehicle type with a new one used by this vehicle only.

If the currently used vehicle type is already marked as being used by this vehicle only, no new type is created.

Returns
The new modifiable vehicle type
See also
MSTransportable::myVType

Definition at line 745 of file MSTransportable.cpp.

References MSVehicleType::buildSingularType(), MSVehicleType::getID(), MSTransportable::getID(), MSVehicleType::isVehicleSpecific(), MSTransportable::myVType, and MSTransportable::replaceVehicleType().

Referenced by MSTransportable::getArrivalEdge(), TraCIServerAPI_Person::processSet(), and libsumo::Person::setParameter().

◆ getSpeed()

double MSTransportable::getSpeed ( ) const
virtualinherited

the current speed of the transportable

Reimplemented in GUIPerson, and GUIContainer.

Definition at line 675 of file MSTransportable.cpp.

Referenced by libsumo::Person::getSpeed(), GUIContainer::getSpeed(), GUIPerson::getSpeed(), and MSFCDExport::writeTransportable().

◆ getSpeedFactor()

double MSPerson::getSpeedFactor ( ) const
inlinevirtual

the current speed factor of the transportable (where applicable)

Reimplemented from MSTransportable.

Definition at line 368 of file MSPerson.h.

References myChosenSpeedFactor, and reroute().

Referenced by GUIPerson::getParameterWindow().

◆ getStageSummary()

std::string MSTransportable::getStageSummary ( int  stageIndex) const
inherited

return textual summary for the given stage

Definition at line 774 of file MSTransportable.cpp.

References MSTransportable::myPlan.

Referenced by GUIPerson::GUIPersonPopupMenu::onCmdShowPlan().

◆ getStageType()

◆ getVehicle()

SUMOVehicle* MSTransportable::getVehicle ( ) const
inlineinherited

The vehicle associated with this transportable.

Definition at line 628 of file MSTransportable.h.

References MSTransportable::appendStage(), MSTransportable::removeStage(), and MSTransportable::Stage::setSpeed().

Referenced by libsumo::Person::getVehicle().

◆ getVehicleType()

◆ getWaitingSeconds()

double MSTransportable::getWaitingSeconds ( ) const
virtualinherited

◆ hasArrived()

bool MSTransportable::hasArrived ( ) const
inherited

return whether the person has reached the end of its plan

Definition at line 782 of file MSTransportable.cpp.

References MSTransportable::myPlan, and MSTransportable::myStep.

Referenced by MSTransportable::getArrivalEdge(), and routeOutput().

◆ hasInfluencer()

bool MSPerson::hasInfluencer ( ) const
inline

Definition at line 424 of file MSPerson.h.

References myInfluencer, and setRemoteState().

◆ isSelected()

virtual bool MSPerson::isSelected ( ) const
inlinevirtual

whether this person is selected in the GUI

Reimplemented in GUIPerson.

Definition at line 364 of file MSPerson.h.

◆ isWaiting4Vehicle()

bool MSTransportable::isWaiting4Vehicle ( ) const
inlineinherited

Whether the transportable waits for a vehicle.

Definition at line 623 of file MSTransportable.h.

Referenced by GUIContainer::drawGL(), GUIContainer::getColorValue(), GUIPerson::getColorValue(), and GUIPerson::getGUIPosition().

◆ isWaitingFor()

bool MSTransportable::isWaitingFor ( const std::string &  line) const
inlineinherited

Whether the transportable waits for a vehicle of the line specified.

Definition at line 618 of file MSTransportable.h.

◆ operator=()

MSPerson& MSPerson::operator= ( const MSPerson )
private

Invalidated assignment operator.

◆ proceed()

◆ removeStage()

◆ replaceVehicleType()

void MSTransportable::replaceVehicleType ( MSVehicleType type)
inherited

Replaces the current vehicle type by the one given.

If the currently used vehicle type is marked as being used by this vehicle only, it is deleted, first. The new, given type is then assigned to "myVType".

Parameters
[in]typeThe new vehicle type
See also
MSTransportable::myVType

Definition at line 736 of file MSTransportable.cpp.

References MSNet::getInstance(), MSNet::getVehicleControl(), MSVehicleType::isVehicleSpecific(), MSTransportable::myVType, and MSVehicleControl::removeVType().

Referenced by MSTransportable::getArrivalEdge(), MSTransportable::getSingularType(), and libsumo::Person::setType().

◆ reroute()

void MSPerson::reroute ( ConstMSEdgeVector newEdges,
double  departPos,
int  firstIndex,
int  nextIndex 
)

set new walk and replace the stages with relative indices in the interval [firstIndex, nextIndex[

Definition at line 665 of file MSPerson.cpp.

References MSTransportable::appendStage(), MSTransportable::getArrivalPos(), MSTransportable::getID(), MSTransportable::getNextStage(), and MSTransportable::removeStage().

Referenced by getSpeedFactor(), and libsumo::Person::rerouteTraveltime().

◆ rerouteParkingArea()

◆ routeOutput()

void MSPerson::routeOutput ( OutputDevice os,
const bool  withRouteLength 
) const
virtual

◆ setDeparted()

void MSTransportable::setDeparted ( SUMOTime  now)
inherited

logs depart time of the current stage

Definition at line 650 of file MSTransportable.cpp.

Referenced by MSTransportableControl::abortWaitingForVehicle().

◆ setRemoteState()

void MSPerson::setRemoteState ( Position  xyPos)

sets position outside the road network

Referenced by hasInfluencer().

◆ setSpeed()

void MSTransportable::setSpeed ( double  speed)
inherited

sets the walking speed (ignored in other stages)

Definition at line 728 of file MSTransportable.cpp.

References MSTransportable::myPlan.

Referenced by libsumo::Person::setSpeed().

◆ tripInfoOutput()

void MSPerson::tripInfoOutput ( OutputDevice os) const
virtual

Called on writing tripinfo output.

Parameters
[in]osThe stream to write the information into
Exceptions
IOErrornot yet implemented

Implements MSTransportable.

Definition at line 637 of file MSPerson.cpp.

References OutputDevice::closeTag(), MSTransportable::getDesiredDepart(), MSTransportable::getID(), MSTransportable::getVehicleType(), MSTransportable::myPlan, OutputDevice::openTag(), time2string(), and OutputDevice::writeAttr().

Field Documentation

◆ myChosenSpeedFactor

const double MSPerson::myChosenSpeedFactor
private

Definition at line 435 of file MSPerson.h.

Referenced by getSpeedFactor().

◆ myDummyState

DummyState MSPerson::myDummyState
staticprivate

Definition at line 437 of file MSPerson.h.

Referenced by MSPerson::MSPersonStage_Walking::~MSPersonStage_Walking().

◆ myInfluencer

Influencer* MSPerson::myInfluencer
private

An instance of a speed/position influencing instance; built in "getInfluencer".

Definition at line 433 of file MSPerson.h.

Referenced by getInfluencer(), and hasInfluencer().

◆ myParameter

const SUMOVehicleParameter* MSTransportable::myParameter
protectedinherited

◆ myPlan

◆ myStep

◆ myVType

MSVehicleType* MSTransportable::myVType
protectedinherited

This transportable's type. (mainly used for drawing related information Note sure if it is really necessary.

Definition at line 691 of file MSTransportable.h.

Referenced by MSTransportable::getSingularType(), GUIContainer::getTypeParameterWindow(), GUIPerson::getTypeParameterWindow(), MSTransportable::getVehicleType(), MSTransportable::replaceVehicleType(), and MSTransportable::~MSTransportable().

◆ myWriteEvents

bool MSTransportable::myWriteEvents
protectedinherited

Whether events shall be written.

Definition at line 694 of file MSTransportable.h.

◆ ROADSIDE_OFFSET

const double MSTransportable::ROADSIDE_OFFSET
staticprotectedinherited

the offset for computing positions when standing at an edge

Definition at line 684 of file MSTransportable.h.

Referenced by MSTransportable::Stage_Waiting::getPosition(), and MSTransportable::Stage_Driving::getPosition().


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