Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
MSTrainHelper Class Reference

A class that helps computing positions of a train's carriages and additional structures. More...

#include <MSTrainHelper.h>

Collaboration diagram for MSTrainHelper:
[legend]

Data Structures

struct  Carriage
 

Public Member Functions

void computeDoorPositions ()
 compute door positions on demand and fills the carriage structures
 
void computeUnboardingPositions (double passengerRadius, std::vector< Position > &unboardingPositions)
 compute unboarding positions on demand and fills the carriage structures
 
int getCarriageDoors () const
 
double getCarriageLength () const
 
const std::vector< Carriage * > & getCarriages () const
 
double getFirstCarriageLength () const
 
int getFirstCarriageNo () const
 
int getFirstPassengerCarriage () const
 
double getHalfWidth () const
 
int getNumCarriages () const
 
double getUpscaleLength () const
 
bool isReversed () const
 
 MSTrainHelper (const MSVehicle *vehicle, bool reversed=false, bool secondaryShape=false, double exaggeration=1.0, int vehicleQuality=3)
 
 ~MSTrainHelper ()
 

Static Public Member Functions

static double getUpscaleLength (double upscale, double length, double width, int vehicleQuality)
 return length exaggeration factor (special for long vehicles)
 

Static Public Attributes

static const double CARRIAGE_DOOR_WIDTH = 1.5
 average door width used to compute doors positions
 
static const double PEDESTRIAN_RADIUS_EXTRA_TOLERANCE = 0.01
 small extra tolerance used to avoid constraint violations
 

Private Member Functions

void computeCarriages (bool reversed, bool secondaryShape)
 
void computeTrainDimensions (double exaggeration, int vehicleQuality)
 

Private Attributes

int myCarriageDoors
 
double myCarriageGap
 
double myCarriageLength
 
double myCarriageLengthWithGap
 
std::vector< Carriage * > myCarriages
 
double myDefaultLength
 
double myFirstCarriageLength
 
int myFirstCarriageNo
 
int myFirstPassengerCarriage
 
double myHalfWidth
 
bool myIsReversed
 
double myLength
 
double myLocomotiveLength
 
int myNumCarriages
 
const MSVehiclemyTrain
 
double myUpscaleLength
 

Detailed Description

A class that helps computing positions of a train's carriages and additional structures.

Definition at line 42 of file MSTrainHelper.h.

Constructor & Destructor Documentation

◆ MSTrainHelper()

MSTrainHelper::MSTrainHelper ( const MSVehicle vehicle,
bool  reversed = false,
bool  secondaryShape = false,
double  exaggeration = 1.0,
int  vehicleQuality = 3 
)
inline

Definition at line 51 of file MSTrainHelper.h.

References computeCarriages(), and computeTrainDimensions().

◆ ~MSTrainHelper()

MSTrainHelper::~MSTrainHelper ( )
inline

Definition at line 57 of file MSTrainHelper.h.

References myCarriages.

Member Function Documentation

◆ computeCarriages()

◆ computeDoorPositions()

void MSTrainHelper::computeDoorPositions ( )

compute door positions on demand and fills the carriage structures

Remarks
need to be called before retrieving carriages if door positions needed

Definition at line 148 of file MSTrainHelper.cpp.

References Position::length2D(), myCarriageDoors, myCarriages, and Position::norm2D().

Referenced by MSPModel_JuPedSim::execute(), and MSStageDriving::setArrived().

Here is the caller graph for this function:

◆ computeTrainDimensions()

void MSTrainHelper::computeTrainDimensions ( double  exaggeration,
int  vehicleQuality 
)
private

◆ computeUnboardingPositions()

void MSTrainHelper::computeUnboardingPositions ( double  passengerRadius,
std::vector< Position > &  unboardingPositions 
)

compute unboarding positions on demand and fills the carriage structures

Remarks
need to be called before retrieving carriages if unboarding positions needed

Definition at line 164 of file MSTrainHelper.cpp.

References Position::length2D(), myCarriages, myHalfWidth, Position::norm2D(), PEDESTRIAN_RADIUS_EXTRA_TOLERANCE, RandHelper::shuffle(), Position::x(), and Position::y().

Referenced by MSStageDriving::setArrived().

Here is the caller graph for this function:

◆ getCarriageDoors()

int MSTrainHelper::getCarriageDoors ( ) const
inline

Definition at line 83 of file MSTrainHelper.h.

References myCarriageDoors.

Referenced by MSStageDriving::setArrived().

Here is the caller graph for this function:

◆ getCarriageLength()

double MSTrainHelper::getCarriageLength ( ) const
inline

Definition at line 75 of file MSTrainHelper.h.

References myCarriageLength.

Referenced by GUIVehicle::drawAction_drawCarriageClass().

Here is the caller graph for this function:

◆ getCarriages()

const std::vector< Carriage * > & MSTrainHelper::getCarriages ( ) const
inline

Definition at line 99 of file MSTrainHelper.h.

References myCarriages.

Referenced by GUIVehicle::drawAction_drawCarriageClass(), MSPModel_JuPedSim::execute(), and MSStageDriving::setArrived().

Here is the caller graph for this function:

◆ getFirstCarriageLength()

double MSTrainHelper::getFirstCarriageLength ( ) const
inline

Definition at line 79 of file MSTrainHelper.h.

References myFirstCarriageLength.

Referenced by GUIVehicle::drawAction_drawCarriageClass().

Here is the caller graph for this function:

◆ getFirstCarriageNo()

int MSTrainHelper::getFirstCarriageNo ( ) const
inline

Definition at line 87 of file MSTrainHelper.h.

References myFirstCarriageNo.

Referenced by GUIVehicle::drawAction_drawCarriageClass().

Here is the caller graph for this function:

◆ getFirstPassengerCarriage()

int MSTrainHelper::getFirstPassengerCarriage ( ) const
inline

Definition at line 91 of file MSTrainHelper.h.

References myFirstPassengerCarriage.

Referenced by GUIVehicle::drawAction_drawCarriageClass(), and MSStageDriving::setArrived().

Here is the caller graph for this function:

◆ getHalfWidth()

double MSTrainHelper::getHalfWidth ( ) const
inline

Definition at line 67 of file MSTrainHelper.h.

References myHalfWidth.

Referenced by GUIVehicle::drawAction_drawCarriageClass(), and MSPModel_JuPedSim::execute().

Here is the caller graph for this function:

◆ getNumCarriages()

int MSTrainHelper::getNumCarriages ( ) const
inline

Definition at line 71 of file MSTrainHelper.h.

References myNumCarriages.

Referenced by GUIVehicle::drawAction_drawCarriageClass(), and MSStageDriving::setArrived().

Here is the caller graph for this function:

◆ getUpscaleLength() [1/2]

double MSTrainHelper::getUpscaleLength ( ) const
inline

Definition at line 63 of file MSTrainHelper.h.

References myUpscaleLength.

Referenced by computeTrainDimensions(), GUIVehicle::drawAction_drawCarriageClass(), and GUIBaseVehicle::drawOnPos().

Here is the caller graph for this function:

◆ getUpscaleLength() [2/2]

double MSTrainHelper::getUpscaleLength ( double  upscale,
double  length,
double  width,
int  vehicleQuality 
)
static

return length exaggeration factor (special for long vehicles)

Definition at line 191 of file MSTrainHelper.cpp.

References MAX2().

◆ isReversed()

bool MSTrainHelper::isReversed ( ) const
inline

Definition at line 95 of file MSTrainHelper.h.

References myIsReversed.

Referenced by GUIVehicle::drawAction_drawCarriageClass().

Here is the caller graph for this function:

Field Documentation

◆ CARRIAGE_DOOR_WIDTH

const double MSTrainHelper::CARRIAGE_DOOR_WIDTH = 1.5
static

average door width used to compute doors positions

Definition at line 115 of file MSTrainHelper.h.

Referenced by MSPModel_JuPedSim::execute(), and MSStageDriving::setArrived().

◆ myCarriageDoors

int MSTrainHelper::myCarriageDoors
private

Definition at line 135 of file MSTrainHelper.h.

Referenced by computeDoorPositions(), computeTrainDimensions(), and getCarriageDoors().

◆ myCarriageGap

double MSTrainHelper::myCarriageGap
private

Definition at line 128 of file MSTrainHelper.h.

Referenced by computeCarriages(), and computeTrainDimensions().

◆ myCarriageLength

double MSTrainHelper::myCarriageLength
private

Definition at line 133 of file MSTrainHelper.h.

Referenced by computeCarriages(), computeTrainDimensions(), and getCarriageLength().

◆ myCarriageLengthWithGap

double MSTrainHelper::myCarriageLengthWithGap
private

Definition at line 132 of file MSTrainHelper.h.

Referenced by computeCarriages(), and computeTrainDimensions().

◆ myCarriages

std::vector<Carriage*> MSTrainHelper::myCarriages
private

◆ myDefaultLength

double MSTrainHelper::myDefaultLength
private

Definition at line 127 of file MSTrainHelper.h.

Referenced by computeCarriages(), and computeTrainDimensions().

◆ myFirstCarriageLength

double MSTrainHelper::myFirstCarriageLength
private

◆ myFirstCarriageNo

int MSTrainHelper::myFirstCarriageNo
private

Definition at line 136 of file MSTrainHelper.h.

Referenced by computeCarriages(), and getFirstCarriageNo().

◆ myFirstPassengerCarriage

int MSTrainHelper::myFirstPassengerCarriage
private

Definition at line 137 of file MSTrainHelper.h.

Referenced by computeCarriages(), and getFirstPassengerCarriage().

◆ myHalfWidth

double MSTrainHelper::myHalfWidth
private

◆ myIsReversed

bool MSTrainHelper::myIsReversed
private

Definition at line 138 of file MSTrainHelper.h.

Referenced by computeCarriages(), and isReversed().

◆ myLength

double MSTrainHelper::myLength
private

Definition at line 129 of file MSTrainHelper.h.

Referenced by computeTrainDimensions().

◆ myLocomotiveLength

double MSTrainHelper::myLocomotiveLength
private

Definition at line 126 of file MSTrainHelper.h.

Referenced by computeCarriages(), and computeTrainDimensions().

◆ myNumCarriages

int MSTrainHelper::myNumCarriages
private

Definition at line 131 of file MSTrainHelper.h.

Referenced by computeCarriages(), computeTrainDimensions(), and getNumCarriages().

◆ myTrain

const MSVehicle* MSTrainHelper::myTrain
private

Definition at line 124 of file MSTrainHelper.h.

Referenced by computeCarriages(), and computeTrainDimensions().

◆ myUpscaleLength

double MSTrainHelper::myUpscaleLength
private

Definition at line 125 of file MSTrainHelper.h.

Referenced by computeTrainDimensions(), and getUpscaleLength().

◆ PEDESTRIAN_RADIUS_EXTRA_TOLERANCE

const double MSTrainHelper::PEDESTRIAN_RADIUS_EXTRA_TOLERANCE = 0.01
static

small extra tolerance used to avoid constraint violations

Definition at line 118 of file MSTrainHelper.h.

Referenced by computeUnboardingPositions().


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