SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GUIPerson Class Reference

#include <GUIPerson.h>

Inheritance diagram for GUIPerson:
MSPerson GUIGlObject

Data Structures

class  GUIPersonPopupMenu
 

Public Types

typedef std::vector
< MSPersonStage * > 
MSPersonPlan
 the structure holding the plan of a person More...
 
enum  StageType { WALKING = 0, DRIVING = 1, WAITING = 2 }
 

Public Member Functions

void drawName (const Position &pos, const SUMOReal scale, const GUIVisualizationTextSettings &settings, const SUMOReal angle=0) const
 
MSPersonStagegetCurrentStage () const
 
std::string getCurrentStageDescription () const
 
StageType getCurrentStageType () const
 
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...
 
const MSEdgegetFromEdge () const
 Returns the departure edge. More...
 
const std::string & getID () const
 returns the person id More...
 
const SUMOVehicleParametergetParameter () const
 
const MSVehicleTypegetVehicleType () const
 
 GUIPerson (const SUMOVehicleParameter *pars, const MSVehicleType *vtype, MSPerson::MSPersonPlan *plan)
 Constructor. More...
 
bool isWaiting4Vehicle () const
 Whether the person waits for a vehicle. More...
 
bool isWaitingFor (const std::string &line) const
 Whether the person waits for a vehicle of the line specified. More...
 
bool proceed (MSNet *net, SUMOTime time)
 
void routeOutput (OutputDevice &os) const
 Called on writing vehroute output. More...
 
void setDeparted (SUMOTime now)
 logs end of the step More...
 
void setPositionInVehicle (const Position &pos)
 
void tripInfoOutput (OutputDevice &os) const
 Called on writing tripinfo output. More...
 
 ~GUIPerson ()
 destructor More...
 
inherited from GUIGlObject
GUIGLObjectPopupMenugetPopUpMenu (GUIMainWindow &app, GUISUMOAbstractView &parent)
 Returns an own popup-menu. More...
 
GUIParameterTableWindowgetParameterWindow (GUIMainWindow &app, GUISUMOAbstractView &parent)
 Returns an own parameter window. More...
 
Boundary getCenteringBoundary () const
 Returns the boundary to which the view shall be centered in order to show the object. More...
 
void drawGL (const GUIVisualizationSettings &s) const
 Draws the object. More...
 
virtual void drawGLAdditional (GUISUMOAbstractView *const parent, const GUIVisualizationSettings &s) const
 Draws additionally triggered visualisations. More...
 
inherited from MSPerson with added locking
SUMOReal getEdgePos () const
 return the offset from the start of the current edge More...
 
Position getPosition () const
 return the Network coordinate of the person More...
 
SUMOReal getAngle () const
 return the current angle of the person More...
 
SUMOReal getWaitingSeconds () const
 the time this person spent waiting in seconds More...
 
SUMOReal getSpeed () const
 the current speed of the person More...
 
Atomar getter methods
const std::string & getFullName () const
 Returns the full name appearing in the tool tip. More...
 
GUIGlID getGlID () const
 Returns the numerical id of the object. More...
 
interfaces to be implemented by derived classes
const std::string & getMicrosimID () const
 Returns the id of the object as known to microsim. More...
 
void setMicrosimID (const std::string &newID)
 Changes the microsimID of the object (happens in NETEDIT) More...
 
GUIGlObjectType getType () const
 Returns the type of the object as coded in GUIGlObjectType. More...
 
Parameter table window I/O
void addParameterTable (GUIParameterTableWindow *w)
 Lets this object know a parameter window showing the object's values was opened. More...
 
void removeParameterTable (GUIParameterTableWindow *w)
 Lets this object know a parameter window showing the object's values was closed. More...
 

Data Fields

std::map< GUISUMOAbstractView
*, int
myAdditionalVisualizations
 Enabled visualisations, per view. More...
 

Static Public Attributes

static StringBijection
< GUIGlObjectType
TypeNames
 associates object types with strings More...
 

Protected Member Functions

void setPrefix (const std::string &prefix)
 
helper methods for building popup-menus
void buildPopupHeader (GUIGLObjectPopupMenu *ret, GUIMainWindow &app, bool addSeparator=true)
 Builds the header. More...
 
void buildCenterPopupEntry (GUIGLObjectPopupMenu *ret, bool addSeparator=true)
 Builds an entry which allows to center to the object. More...
 
void buildNameCopyPopupEntry (GUIGLObjectPopupMenu *ret, bool addSeparator=true)
 Builds entries which allow to copy the name / typed name into the clipboard. More...
 
void buildSelectionPopupEntry (GUIGLObjectPopupMenu *ret, bool addSeparator=true)
 Builds an entry which allows to (de)select the object. More...
 
void buildShowParamsPopupEntry (GUIGLObjectPopupMenu *ret, bool addSeparator=true)
 Builds an entry which allows to open the parameter window. More...
 
void buildPositionCopyEntry (GUIGLObjectPopupMenu *ret, bool addSeparator=true)
 Builds an entry which allows to copy the cursor position if geo projection is used, also builds an entry for copying the geo-position. More...
 
void buildShowManipulatorPopupEntry (GUIGLObjectPopupMenu *ret, bool addSeparator=true)
 Builds an entry which allows to open the manipulator window. More...
 

Protected Attributes

const SUMOVehicleParametermyParameter
 the plan of the person More...
 
MSPersonPlanmyPlan
 the plan of the person More...
 
MSPersonPlan::iterator myStep
 the iterator over the route More...
 
const MSVehicleTypemyVType
 This Persons's type. (mainly used for drawing related information. More...
 
bool myWriteEvents
 Whether events shall be written. More...
 

Private Member Functions

SUMOReal getColorValue (size_t activeScheme) const
 gets the color value according to the current scheme index More...
 
void setColor (const GUIVisualizationSettings &s) const
 sets the color according to the currente settings More...
 
bool setFunctionalColor (size_t activeScheme) const
 sets the color according to the current scheme index and some vehicle function More...
 
drawing helper methods
void drawAction_drawAsTriangle (const GUIVisualizationSettings &s) const
 
void drawAction_drawAsPoly (const GUIVisualizationSettings &s) const
 
void drawAction_drawAsImage (const GUIVisualizationSettings &s) const
 

Private Attributes

bool myAmVisualizedAsStopped
 whether the person is visualized as stopped More...
 
MFXMutex myLock
 The mutex used to avoid concurrent updates of the vehicle buffer. More...
 
Position myPositionInVehicle
 The position of a person while riding a vehicle. More...
 

Detailed Description

Definition at line 61 of file GUIPerson.h.

Member Typedef Documentation

typedef std::vector<MSPersonStage*> MSPerson::MSPersonPlan
inherited

the structure holding the plan of a person

Definition at line 515 of file MSPerson.h.

Member Enumeration Documentation

enum MSPerson::StageType
inherited
Enumerator
WALKING 
DRIVING 
WAITING 

Definition at line 72 of file MSPerson.h.

Constructor & Destructor Documentation

GUIPerson::GUIPerson ( const SUMOVehicleParameter pars,
const MSVehicleType vtype,
MSPerson::MSPersonPlan plan 
)

Constructor.

Definition at line 110 of file GUIPerson.cpp.

GUIPerson::~GUIPerson ( )

destructor

Definition at line 117 of file GUIPerson.cpp.

Member Function Documentation

void GUIGlObject::addParameterTable ( GUIParameterTableWindow w)
inherited

Lets this object know a parameter window showing the object's values was opened.

Parameters
[in]wThe opened parameter window

Definition at line 187 of file GUIGlObject.cpp.

References GUIGlObject::myParamWindows.

void GUIGlObject::buildCenterPopupEntry ( GUIGLObjectPopupMenu ret,
bool  addSeparator = true 
)
protectedinherited
void GUIGlObject::buildNameCopyPopupEntry ( GUIGLObjectPopupMenu ret,
bool  addSeparator = true 
)
protectedinherited
void GUIGlObject::buildPositionCopyEntry ( GUIGLObjectPopupMenu ret,
bool  addSeparator = true 
)
protectedinherited

Builds an entry which allows to copy the cursor position if geo projection is used, also builds an entry for copying the geo-position.

Parameters
in,filled]ret The popup menu to add the entry to
[in]addSeparatorWhether a separator shall be added, too

Definition at line 166 of file GUIGlObject.cpp.

References GeoConvHelper::getFinal(), MID_COPY_CURSOR_GEOPOSITION, and MID_COPY_CURSOR_POSITION.

Referenced by GUIDetectorWrapper::getPopUpMenu(), GUITrafficLightLogicWrapper::getPopUpMenu(), GUIPolygon::getPopUpMenu(), getPopUpMenu(), GUILaneSpeedTrigger::getPopUpMenu(), GUICalibrator::getPopUpMenu(), GUIPointOfInterest::getPopUpMenu(), GUITriggeredRerouter::getPopUpMenu(), GUIJunctionWrapper::getPopUpMenu(), GUIVehicle::getPopUpMenu(), GUIBusStop::getPopUpMenu(), GUIEdge::getPopUpMenu(), GUINet::getPopUpMenu(), and GUILane::getPopUpMenu().

void GUIGlObject::buildShowManipulatorPopupEntry ( GUIGLObjectPopupMenu ret,
bool  addSeparator = true 
)
protectedinherited

Builds an entry which allows to open the manipulator window.

Parameters
in,filled]ret The popup menu to add the entry to
[in]addSeparatorWhether a separator shall be added, too

Definition at line 178 of file GUIGlObject.cpp.

References GUIIconSubSys::getIcon(), ICON_MANIP, and MID_MANIP.

Referenced by GUILaneSpeedTrigger::getPopUpMenu(), and GUITriggeredRerouter::getPopUpMenu().

void GUIGlObject::buildShowParamsPopupEntry ( GUIGLObjectPopupMenu ret,
bool  addSeparator = true 
)
protectedinherited

Builds an entry which allows to open the parameter window.

Parameters
in,filled]ret The popup menu to add the entry to
[in]addSeparatorWhether a separator shall be added, too

Definition at line 157 of file GUIGlObject.cpp.

References GUIIconSubSys::getIcon(), ICON_APP_TABLE, and MID_SHOWPARS.

Referenced by GUIDetectorWrapper::getPopUpMenu(), getPopUpMenu(), GUILaneSpeedTrigger::getPopUpMenu(), GUICalibrator::getPopUpMenu(), GUIVehicle::getPopUpMenu(), GUIBusStop::getPopUpMenu(), GUIEdge::getPopUpMenu(), GUINet::getPopUpMenu(), and GUILane::getPopUpMenu().

void GUIPerson::drawAction_drawAsPoly ( const GUIVisualizationSettings s) const
private
void GUIPerson::drawAction_drawAsTriangle ( const GUIVisualizationSettings s) const
private

Definition at line 380 of file GUIPerson.cpp.

References getAngle(), and MSPerson::getVehicleType().

Referenced by drawGL().

void GUIPerson::drawGLAdditional ( GUISUMOAbstractView *const  parent,
const GUIVisualizationSettings s 
) const
virtual

Draws additionally triggered visualisations.

Parameters
[in]parentThe view
[in]sThe settings for the current view (may influence drawing)

Reimplemented from GUIGlObject.

Definition at line 216 of file GUIPerson.cpp.

References GUIGlObject::getGlID().

SUMOReal GUIPerson::getAngle ( ) const
virtual

return the current angle of the person

Reimplemented from MSPerson.

Definition at line 359 of file GUIPerson.cpp.

References MSPerson::getAngle(), and myLock.

Referenced by drawAction_drawAsImage(), drawAction_drawAsPoly(), drawAction_drawAsTriangle(), getParameterWindow(), and setFunctionalColor().

Boundary GUIPerson::getCenteringBoundary ( ) const
virtual

Returns the boundary to which the view shall be centered in order to show the object.

Returns
The boundary the object is within
See also
GUIGlObject::getCenteringBoundary

Implements GUIGlObject.

Definition at line 158 of file GUIPerson.cpp.

References Boundary::add(), getPosition(), and Boundary::grow().

SUMOReal GUIPerson::getColorValue ( size_t  activeScheme) const
private

gets the color value according to the current scheme index

Definition at line 322 of file GUIPerson.cpp.

References MSPerson::getCurrentStageType(), GUIGlObject::getGlID(), getSpeed(), getWaitingSeconds(), GLO_PERSON, gSelected, GUISelectedStorage::isSelected(), MSPerson::isWaiting4Vehicle(), and SUMOReal.

Referenced by setColor().

MSPersonStage* MSPerson::getCurrentStage ( ) const
inlineinherited

Definition at line 593 of file MSPerson.h.

References MSPerson::myStep.

Referenced by drawGL(), and MSEdge::person_by_offset_sorter::operator()().

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

Definition at line 589 of file MSPerson.h.

Referenced by getParameterWindow().

StageType MSPerson::getCurrentStageType ( ) const
inlineinherited

Definition at line 584 of file MSPerson.h.

Referenced by MSPModel_Striping::add(), getColorValue(), and getPosition().

SUMOTime MSPerson::getDesiredDepart ( ) const
inherited

Returns the desired departure time.

Definition at line 584 of file MSPerson.cpp.

References SUMOVehicleParameter::depart, and MSPerson::myParameter.

Referenced by MSPersonControl::erase(), and MSPerson::routeOutput().

const MSEdge& MSPerson::getDestination ( ) const
inlineinherited
SUMOReal GUIPerson::getEdgePos ( ) const
virtual

return the offset from the start of the current edge

Reimplemented from MSPerson.

Definition at line 342 of file GUIPerson.cpp.

References MSPerson::getEdgePos(), and myLock.

Referenced by getParameterWindow().

const MSEdge* MSPerson::getFromEdge ( ) const
inlineinherited

Returns the departure edge.

Definition at line 564 of file MSPerson.h.

Referenced by getParameterWindow(), and MSPerson::MSPersonStage_Driving::routeOutput().

const std::string& GUIGlObject::getMicrosimID ( ) const
inlineinherited

Returns the id of the object as known to microsim.

Returns
The id of the object

Definition at line 146 of file GUIGlObject.h.

References GUIGlObject::myMicrosimID.

Referenced by GUIGlObject::createFullName(), GUIGlObject::drawName(), GUIDialog_GLObjChooser::GUIDialog_GLObjChooser(), and GUIGLObjectPopupMenu::onCmdCopyName().

const SUMOVehicleParameter& MSPerson::getParameter ( ) const
inlineinherited

Definition at line 622 of file MSPerson.h.

References MSPerson::myParameter.

Referenced by setFunctionalColor().

GUIParameterTableWindow * GUIPerson::getParameterWindow ( GUIMainWindow app,
GUISUMOAbstractView parent 
)
virtual

Returns an own parameter window.

Parameters
[in]appThe application needed to build the parameter window
[in]parentThe parent window needed to build the parameter window
Returns
The built parameter window
See also
GUIGlObject::getParameterWindow

Implements GUIGlObject.

Definition at line 137 of file GUIPerson.cpp.

References GUIParameterTableWindow::closeBuilding(), getAngle(), MSPerson::getCurrentStageDescription(), MSPerson::getDestination(), MSPerson::getEdge(), getEdgePos(), MSPerson::getFromEdge(), MSPerson::getID(), getSpeed(), getWaitingSeconds(), and GUIParameterTableWindow::mkItem().

GUIGLObjectPopupMenu * GUIPerson::getPopUpMenu ( GUIMainWindow app,
GUISUMOAbstractView parent 
)
virtual

Returns an own popup-menu.

Parameters
[in]appThe application needed to build the popup-menu
[in]parentThe parent window needed to build the popup-menu
Returns
The built popup-menu
See also
GUIGlObject::getPopUpMenu

Implements GUIGlObject.

Definition at line 122 of file GUIPerson.cpp.

References GUIGlObject::buildCenterPopupEntry(), GUIGlObject::buildNameCopyPopupEntry(), GUIGlObject::buildPopupHeader(), GUIGlObject::buildPositionCopyEntry(), GUIGlObject::buildSelectionPopupEntry(), GUIGlObject::buildShowParamsPopupEntry(), and myAdditionalVisualizations.

Position GUIPerson::getPosition ( ) const
virtual

return the Network coordinate of the person

Reimplemented from MSPerson.

Definition at line 349 of file GUIPerson.cpp.

References MSPerson::DRIVING, MSPerson::getCurrentStageType(), MSPerson::getPosition(), MSPerson::isWaiting4Vehicle(), myLock, and myPositionInVehicle.

Referenced by drawGL(), and getCenteringBoundary().

SUMOReal GUIPerson::getSpeed ( ) const
virtual

the current speed of the person

Reimplemented from MSPerson.

Definition at line 373 of file GUIPerson.cpp.

References MSPerson::getSpeed(), and myLock.

Referenced by getColorValue(), and getParameterWindow().

const MSVehicleType& MSPerson::getVehicleType ( ) const
inlineinherited
SUMOReal GUIPerson::getWaitingSeconds ( ) const
virtual

the time this person spent waiting in seconds

Reimplemented from MSPerson.

Definition at line 366 of file GUIPerson.cpp.

References MSPerson::getWaitingSeconds(), and myLock.

Referenced by getColorValue(), and getParameterWindow().

bool MSPerson::isWaiting4Vehicle ( ) const
inlineinherited

Whether the person waits for a vehicle.

Definition at line 617 of file MSPerson.h.

Referenced by getColorValue(), getPosition(), MSPerson::MSPersonStage_Driving::getStageDescription(), and MSPerson::MSPersonStage_Driving::getWaitingTime().

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

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

Definition at line 612 of file MSPerson.h.

void GUIGlObject::removeParameterTable ( GUIParameterTableWindow w)
inherited

Lets this object know a parameter window showing the object's values was closed.

Parameters
[in]wThe closed parameter window

Definition at line 193 of file GUIGlObject.cpp.

References GUIGlObject::myParamWindows.

Referenced by GUIParameterTableWindow::~GUIParameterTableWindow().

void MSPerson::routeOutput ( OutputDevice os) const
inherited

Called on writing vehroute output.

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

Definition at line 604 of file MSPerson.cpp.

References MSPerson::getDesiredDepart(), MSPerson::MSPersonStage_Waiting::getUntil(), MSPerson::myPlan, and MSPerson::WAITING.

Referenced by MSPersonControl::erase().

void GUIPerson::setColor ( const GUIVisualizationSettings s) const
private
void MSPerson::setDeparted ( SUMOTime  now)
inherited

logs end of the step

Definition at line 590 of file MSPerson.cpp.

bool GUIPerson::setFunctionalColor ( size_t  activeScheme) const
private

sets the color according to the current scheme index and some vehicle function

Definition at line 283 of file GUIPerson.cpp.

References RGBColor::fromHSV(), getAngle(), MSPerson::getParameter(), MSPerson::getVehicleType(), GLHelper::setColor(), SUMOReal, VEHPARS_COLOR_SET, and VTYPEPARS_COLOR_SET.

Referenced by setColor().

void GUIGlObject::setMicrosimID ( const std::string &  newID)
inherited

Changes the microsimID of the object (happens in NETEDIT)

Definition at line 108 of file GUIGlObject.cpp.

References GUIGlObject::createFullName(), GUIGlObject::myFullName, and GUIGlObject::myMicrosimID.

void GUIPerson::setPositionInVehicle ( const Position pos)
inline

Definition at line 120 of file GUIPerson.h.

References myPositionInVehicle.

Referenced by GUIVehicle::drawGL().

void GUIGlObject::setPrefix ( const std::string &  prefix)
protectedinherited
void MSPerson::tripInfoOutput ( OutputDevice os) const
inherited

Called on writing tripinfo output.

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

Definition at line 596 of file MSPerson.cpp.

References MSPerson::myPlan.

Referenced by MSPersonControl::erase().

Field Documentation

std::map<GUISUMOAbstractView*, int> GUIPerson::myAdditionalVisualizations

Enabled visualisations, per view.

Definition at line 183 of file GUIPerson.h.

Referenced by getPopUpMenu().

bool GUIPerson::myAmVisualizedAsStopped
private

whether the person is visualized as stopped

Definition at line 205 of file GUIPerson.h.

MFXMutex GUIPerson::myLock
mutableprivate

The mutex used to avoid concurrent updates of the vehicle buffer.

Definition at line 190 of file GUIPerson.h.

Referenced by getAngle(), getEdgePos(), getPosition(), getSpeed(), and getWaitingSeconds().

const SUMOVehicleParameter* MSPerson::myParameter
protectedinherited

the plan of the person

Definition at line 519 of file MSPerson.h.

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

MSPersonPlan* MSPerson::myPlan
protectedinherited

the plan of the person

Definition at line 525 of file MSPerson.h.

Referenced by MSPerson::MSPerson(), MSPerson::proceed(), MSPerson::routeOutput(), MSPerson::tripInfoOutput(), and MSPerson::~MSPerson().

Position GUIPerson::myPositionInVehicle
private

The position of a person while riding a vehicle.

Definition at line 193 of file GUIPerson.h.

Referenced by getPosition(), and setPositionInVehicle().

MSPersonPlan::iterator MSPerson::myStep
protectedinherited

the iterator over the route

Definition at line 528 of file MSPerson.h.

Referenced by MSPerson::getCurrentStage(), MSPerson::MSPerson(), and MSPerson::proceed().

const MSVehicleType* MSPerson::myVType
protectedinherited

This Persons's type. (mainly used for drawing related information.

Definition at line 522 of file MSPerson.h.

Referenced by MSPerson::getVehicleType().

bool MSPerson::myWriteEvents
protectedinherited

Whether events shall be written.

Definition at line 531 of file MSPerson.h.

StringBijection< GUIGlObjectType > GUIGlObject::TypeNames
staticinherited

associates object types with strings

Definition at line 99 of file GUIGlObject.h.


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