Eclipse SUMO - Simulation of Urban MObility
MSTransportable Class Referenceabstract

#include <MSTransportable.h>

Inheritance diagram for MSTransportable:
Collaboration diagram for MSTransportable:

Data Structures

class  Stage
 
class  Stage_Driving
 
class  Stage_Trip
 
class  Stage_Waiting
 

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...
 
MSTransportableDevicegetDevice (const std::type_info &type) const
 Returns a device of the given type if it exists or 0. More...
 
const std::vector< MSTransportableDevice * > & getDevices () const
 Returns this vehicle's devices. 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...
 
const MSEdgegetNextDestination () const
 Returns the destination after the current destination. 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...
 
virtual 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
 Returns the vehicle's type. More...
 
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 hasDeparted () const
 return whether the transportable has started it's plan More...
 
bool isWaiting4Vehicle () const
 Whether the transportable waits for a vehicle. More...
 
bool isWaitingFor (const SUMOVehicle *vehicle) const
 Whether the transportable waits for the given vehicle in the current step. More...
 
 MSTransportable (const SUMOVehicleParameter *pars, MSVehicleType *vtype, MSTransportablePlan *plan)
 constructor More...
 
virtual bool proceed (MSNet *net, SUMOTime time)=0
 
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 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 =0
 Called on writing vehroute output. More...
 
void setDeparted (SUMOTime now)
 logs depart time of the current stage More...
 
void setSpeed (double speed)
 sets the walking speed (ignored in other stages) More...
 
virtual void tripInfoOutput (OutputDevice &os) const =0
 Called on writing tripinfo output. More...
 
virtual ~MSTransportable ()
 destructor More...
 
inherited from SUMOTrafficObject
bool isVehicle () const
 Get the vehicle's ID. More...
 
bool isStopped () const
 Returns whether the vehicle is at a stop. More...
 
double getSlope () const
 Returns the slope of the road at vehicle's position. More...
 
double getChosenSpeedFactor () const
 
SUMOVehicleClass getVClass () const
 Returns the vehicle's access class. More...
 
double getMaxSpeed () const
 Returns the vehicle's maximum speed. More...
 
SUMOTime getWaitingTime () const
 
double getPreviousSpeed () const
 Returns the vehicle's previous speed. More...
 
double getAcceleration () const
 Returns the vehicle's acceleration. More...
 
double getPositionOnLane () const
 Get the vehicle's position along the lane. More...
 
double getBackPositionOnLane (const MSLane *) const
 Get the vehicle's back position along the given lane. More...
 
Position getPosition (const double) const
 Return current position (x/y, cartesian) More...
 

Protected Attributes

std::vector< MSTransportableDevice * > myDevices
 The devices this transportable has. More...
 
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

 MSTransportable (const MSTransportable &)
 Invalidated copy constructor. More...
 
MSTransportableoperator= (const MSTransportable &)
 Invalidated assignment operator. More...
 

Detailed Description

The class holds a simulated moveable object

Definition at line 59 of file MSTransportable.h.

Member Typedef Documentation

◆ MSTransportablePlan

the structure holding the plan of a transportable

Definition at line 588 of file MSTransportable.h.

Member Enumeration Documentation

◆ StageType

Enumerator
WAITING_FOR_DEPART 
WAITING 
MOVING_WITHOUT_VEHICLE 
DRIVING 
ACCESS 
TRIP 

Definition at line 61 of file MSTransportable.h.

Constructor & Destructor Documentation

◆ MSTransportable() [1/2]

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

constructor

Definition at line 665 of file MSTransportable.cpp.

References MSDevice::buildTransportableDevices(), myDevices, myPlan, and myStep.

◆ ~MSTransportable()

◆ MSTransportable() [2/2]

MSTransportable::MSTransportable ( const MSTransportable )
private

Invalidated copy constructor.

Member Function Documentation

◆ appendStage()

◆ getAcceleration()

double MSTransportable::getAcceleration ( ) const
inlinevirtual

Returns the vehicle's acceleration.

Returns
The acceleration

Implements SUMOTrafficObject.

Definition at line 570 of file MSTransportable.h.

◆ getAngle()

double MSTransportable::getAngle ( ) const
virtual

◆ getArrivalEdge()

const MSEdge* MSTransportable::getArrivalEdge ( ) const
inline

returns the final arrival edge

Definition at line 746 of file MSTransportable.h.

References myPlan.

Referenced by libsumo::Person::appendWaitingStage(), and libsumo::Person::convertTraCIStage().

◆ getArrivalPos()

double MSTransportable::getArrivalPos ( ) const
inline

◆ getBackPositionOnLane()

double MSTransportable::getBackPositionOnLane ( const MSLane lane) const
inlinevirtual

Get the vehicle's back position along the given lane.

Returns
The position of the vehicle (in m from the given lane's begin)

Implements SUMOTrafficObject.

Definition at line 578 of file MSTransportable.h.

References getEdgePos().

◆ getBoundingBox()

PositionVector MSTransportable::getBoundingBox ( ) const

◆ getChosenSpeedFactor()

double MSTransportable::getChosenSpeedFactor ( ) const
inlinevirtual

Implements SUMOTrafficObject.

Definition at line 556 of file MSTransportable.h.

◆ getCurrentStage()

◆ getCurrentStageDescription()

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

◆ getCurrentStageType()

◆ getDesiredDepart()

SUMOTime MSTransportable::getDesiredDepart ( ) const

Returns the desired departure time.

Definition at line 699 of file MSTransportable.cpp.

References SUMOVehicleParameter::depart, and myParameter.

Referenced by MSContainer::routeOutput(), MSContainer::tripInfoOutput(), and MSPerson::tripInfoOutput().

◆ getDestination()

◆ getDevice()

MSTransportableDevice * MSTransportable::getDevice ( const std::type_info &  type) const

Returns a device of the given type if it exists or 0.

Definition at line 902 of file MSTransportable.cpp.

References myDevices.

Referenced by MSFCDExport::writeTransportable().

◆ getDevices()

const std::vector<MSTransportableDevice*>& MSTransportable::getDevices ( ) const
inline

Returns this vehicle's devices.

Returns
This vehicle's devices

Definition at line 789 of file MSTransportable.h.

References myDevices.

◆ getEdge()

◆ getEdgePos()

◆ getEdges()

ConstMSEdgeVector MSTransportable::getEdges ( int  next) const
inline

Return the edges of the nth next stage.

Definition at line 690 of file MSTransportable.h.

References myPlan, and myStep.

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

◆ getFromEdge()

◆ getID()

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

returns the id of the transportable

Implements SUMOTrafficObject.

Definition at line 694 of file MSTransportable.cpp.

References SUMOVehicleParameter::id, and myParameter.

Referenced by MSTransportableControl::abortAnyWaitingForVehicle(), MSPModel_Remote::add(), MSPModel_Striping::add(), MSVehicle::addContainer(), MSVehicle::addPerson(), appendStage(), libsumo::Person::appendWalkingStage(), MSPerson::MSPersonStage_Walking::beginEventOutput(), MSContainer::MSContainerStage_Tranship::beginEventOutput(), MSTransportable::Stage_Waiting::beginEventOutput(), MSTransportable::Stage_Driving::beginEventOutput(), MSTransportableDevice_FCD::buildDevices(), MSTransportableDevice_Routing::buildDevices(), libsumo::Person::convertTraCIStage(), 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(), getSingularType(), MSPModel_Striping::getVehicleObstacles(), MSVehicleControl::getWaitingVehicle(), MSPedestrianPushButton::isActiveForEdge(), MSPModel_Striping::moveInDirection(), MSPModel_Striping::moveInDirectionOnLane(), libsumo::Person::moveToXY(), MSDevice_Transportable::notifyLeave(), MSEdge::transportable_by_position_sorter::operator()(), MSPModel_Striping::PState::PState(), MSPerson::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(), MSPerson::tripInfoOutput(), MSFCDExport::writeTransportable(), MSXMLRawOut::writeTransportable(), and MSDevice_Transportable::~MSDevice_Transportable().

◆ getMaxSpeed()

double MSTransportable::getMaxSpeed ( ) const
virtual

Returns the vehicle's maximum speed.

Returns
The vehicle's maximum speed

Implements SUMOTrafficObject.

Definition at line 925 of file MSTransportable.cpp.

References MSVehicleType::getMaxSpeed(), getSpeedFactor(), and getVehicleType().

Referenced by MSTransportable::Stage_Trip::setArrived(), and MSPerson::MSPersonStage_Walking::tripInfoOutput().

◆ getNextDestination()

const MSEdge* MSTransportable::getNextDestination ( ) const
inline

Returns the destination after the current destination.

Definition at line 623 of file MSTransportable.h.

References myStep.

◆ getNextStage()

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

◆ getNumRemainingStages()

◆ getNumStages()

◆ getParameter()

◆ getPosition() [1/2]

Position MSTransportable::getPosition ( ) const
virtual

Return the Network coordinate of the transportable.

Reimplemented in GUIContainer, and GUIPerson.

Definition at line 714 of file MSTransportable.cpp.

References MSNet::getCurrentTimeStep(), and MSNet::getInstance().

Referenced by getBoundingBox(), GUIPerson::getGUIPosition(), GUIPerson::getPosition(), GUIContainer::getPosition(), and getPosition().

◆ getPosition() [2/2]

Position MSTransportable::getPosition ( const double  offset) const
inlinevirtual

Return current position (x/y, cartesian)

If the vehicle is not in the net, Position::INVALID.

Parameters
[in]offsetoptional offset in longitudinal direction
Returns
The current position (in cartesian coordinates)
See also
myLane

Implements SUMOTrafficObject.

Definition at line 582 of file MSTransportable.h.

References getPosition().

Referenced by MSLink::checkWalkingAreaFoe(), libsumo::Person::moveToXY(), and MSFCDExport::writeTransportable().

◆ getPositionOnLane()

double MSTransportable::getPositionOnLane ( ) const
inlinevirtual

Get the vehicle's position along the lane.

Returns
The position of the vehicle (in m from the lane's begin)

Implements SUMOTrafficObject.

Definition at line 574 of file MSTransportable.h.

References getEdgePos().

◆ getPreviousSpeed()

double MSTransportable::getPreviousSpeed ( ) const
inlinevirtual

Returns the vehicle's previous speed.

Returns
The vehicle's previous speed

Implements SUMOTrafficObject.

Definition at line 566 of file MSTransportable.h.

References getSpeed().

◆ getSingularType()

MSVehicleType & MSTransportable::getSingularType ( )

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 799 of file MSTransportable.cpp.

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

Referenced by TraCIServerAPI_Person::processSet().

◆ getSlope()

double MSTransportable::getSlope ( ) const
virtual

Returns the slope of the road at vehicle's position.

Returns
The slope

Implements SUMOTrafficObject.

Definition at line 912 of file MSTransportable.cpp.

References getEdge(), getEdgePos(), and MSEdge::getLanes().

◆ getSpeed()

double MSTransportable::getSpeed ( ) const
virtual

◆ getSpeedFactor()

virtual double MSTransportable::getSpeedFactor ( ) const
inlinevirtual

the current speed factor of the transportable (where applicable)

Reimplemented in MSPerson.

Definition at line 653 of file MSTransportable.h.

Referenced by MSPerson::MSPersonStage_Walking::getMaxSpeed(), getMaxSpeed(), and GUIContainer::getParameterWindow().

◆ getStageSummary()

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

return textual summary for the given stage

Definition at line 828 of file MSTransportable.cpp.

References myPlan.

Referenced by GUIContainer::GUIContainerPopupMenu::onCmdShowPlan(), and GUIPerson::GUIPersonPopupMenu::onCmdShowPlan().

◆ getStageType()

StageType MSTransportable::getStageType ( int  next) const
inline

the stage type for the nth next stage

Definition at line 663 of file MSTransportable.h.

References myPlan, and myStep.

Referenced by libsumo::Person::moveToXY(), MSPerson::Influencer::postProcessRemoteControl(), and libsumo::Person::rerouteTraveltime().

◆ getVClass()

SUMOVehicleClass MSTransportable::getVClass ( ) const
virtual

Returns the vehicle's access class.

Returns
The vehicle's access class

Implements SUMOTrafficObject.

Definition at line 930 of file MSTransportable.cpp.

References MSVehicleType::getVehicleClass(), and getVehicleType().

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

◆ getVehicle()

SUMOVehicle* MSTransportable::getVehicle ( ) const
inline

The vehicle associated with this transportable.

Definition at line 727 of file MSTransportable.h.

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

◆ getVehicleType()

◆ getWaitingSeconds()

double MSTransportable::getWaitingSeconds ( ) const
virtual

◆ getWaitingTime()

SUMOTime MSTransportable::getWaitingTime ( ) const
virtual

Implements SUMOTrafficObject.

Definition at line 920 of file MSTransportable.cpp.

References MSNet::getCurrentTimeStep(), and MSNet::getInstance().

◆ hasArrived()

bool MSTransportable::hasArrived ( ) const
virtual

return whether the person has reached the end of its plan

Implements SUMOTrafficObject.

Definition at line 836 of file MSTransportable.cpp.

References myPlan, and myStep.

Referenced by MSPerson::routeOutput().

◆ hasDeparted()

bool MSTransportable::hasDeparted ( ) const

return whether the transportable has started it's plan

Definition at line 841 of file MSTransportable.cpp.

References myPlan.

◆ isStopped()

bool MSTransportable::isStopped ( ) const
inlinevirtual

Returns whether the vehicle is at a stop.

Returns
Whether the has stopped

Implements SUMOTrafficObject.

Definition at line 550 of file MSTransportable.h.

References getCurrentStageType(), and WAITING.

◆ isVehicle()

bool MSTransportable::isVehicle ( ) const
inlinevirtual

Get the vehicle's ID.

Returns
The the ID of the vehicle

Implements SUMOTrafficObject.

Definition at line 546 of file MSTransportable.h.

◆ isWaiting4Vehicle()

◆ isWaitingFor()

bool MSTransportable::isWaitingFor ( const SUMOVehicle vehicle) const
inline

Whether the transportable waits for the given vehicle in the current step.

Definition at line 717 of file MSTransportable.h.

Referenced by MSVehicleControl::getWaitingVehicle().

◆ operator=()

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

Invalidated assignment operator.

◆ proceed()

◆ removeStage()

void MSTransportable::removeStage ( int  next)

◆ replaceVehicleType()

void MSTransportable::replaceVehicleType ( MSVehicleType type)

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 790 of file MSTransportable.cpp.

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

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

◆ rerouteParkingArea()

◆ routeOutput()

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

Called on writing vehroute output.

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

Implemented in MSPerson, and MSContainer.

Referenced by MSTransportableControl::erase().

◆ setDeparted()

void MSTransportable::setDeparted ( SUMOTime  now)

logs depart time of the current stage

Definition at line 704 of file MSTransportable.cpp.

◆ setSpeed()

void MSTransportable::setSpeed ( double  speed)

sets the walking speed (ignored in other stages)

Definition at line 782 of file MSTransportable.cpp.

References myPlan.

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

◆ tripInfoOutput()

virtual void MSTransportable::tripInfoOutput ( OutputDevice os) const
pure virtual

Called on writing tripinfo output.

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

Implemented in MSPerson, and MSContainer.

Referenced by MSTransportableControl::erase().

Field Documentation

◆ myDevices

std::vector<MSTransportableDevice*> MSTransportable::myDevices
protected

The devices this transportable has.

Definition at line 814 of file MSTransportable.h.

Referenced by getDevice(), getDevices(), and MSTransportable().

◆ myParameter

const SUMOVehicleParameter* MSTransportable::myParameter
protected

the plan of the transportable

Definition at line 798 of file MSTransportable.h.

Referenced by getDesiredDepart(), getID(), getParameter(), MSPerson::routeOutput(), and ~MSTransportable().

◆ myPlan

◆ myStep

◆ myVType

MSVehicleType* MSTransportable::myVType
protected

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

Definition at line 802 of file MSTransportable.h.

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

◆ myWriteEvents

bool MSTransportable::myWriteEvents
protected

Whether events shall be written.

Definition at line 805 of file MSTransportable.h.

◆ ROADSIDE_OFFSET

const double MSTransportable::ROADSIDE_OFFSET
staticprotected

the offset for computing positions when standing at an edge

Definition at line 795 of file MSTransportable.h.

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


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