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

#include <GUIViewTraffic.h>

Inheritance diagram for GUIViewTraffic:
GUISUMOAbstractView FXGLCanvas

Public Member Functions

void addDecals (const std::vector< Decal > &decals)
 
virtual void buildViewToolBars (GUIGlChildWindow &)
 builds the view toolbars More...
 
virtual void centerTo (GUIGlID id, bool applyZoom, SUMOReal zoomDist=20)
 centers to the chosen artifact More...
 
void centerTo (const Boundary &bound)
 centers to the chosen artifact More...
 
void destroyPopup ()
 destoys the popup More...
 
GUIPerspectiveChangergetChanger () const
 
FXComboBox & getColoringSchemesCombo ()
 
SUMOTime getCurrentTimeStep () const
 get the current simulation time More...
 
SUMOReal getDelay () const
 Returns the delay of the parent application. More...
 
SUMOReal getGridHeight () const
 
SUMOReal getGridWidth () const
 
Position getPositionInformation () const
 Returns the cursor's x/y position within the network. More...
 
int getTrackedID () const
 Returns the id of the tracked vehicle (-1 if none) More...
 
GUIDialog_EditViewportgetViewportEditor ()
 get the viewport and create it on first access More...
 
Boundary getVisibleBoundary () const
 
GUIVisualizationSettingsgetVisualisationSettings ()
 
 GUIViewTraffic (FXComposite *p, GUIMainWindow &app, GUISUMOViewParent *parent, GUINet &net, FXGLVisual *glVis, FXGLCanvas *share)
 constructor More...
 
bool isInEditMode ()
 returns true, if the edit button was pressed More...
 
SUMOReal m2p (SUMOReal meter) const
 meter-to-pixels conversion method More...
 
FXbool makeCurrent ()
 A reimplementation due to some internal reasons. More...
 
virtual long onConfigure (FXObject *, FXSelector, void *)
 
void onGamingClick (Position pos)
 handle mouse click in gaming mode More...
 
virtual long onKeyPress (FXObject *o, FXSelector sel, void *data)
 
virtual long onKeyRelease (FXObject *o, FXSelector sel, void *data)
 
virtual long onLeftBtnPress (FXObject *, FXSelector, void *)
 
virtual long onLeftBtnRelease (FXObject *, FXSelector, void *)
 
virtual long onMiddleBtnPress (FXObject *, FXSelector, void *)
 
virtual long onMiddleBtnRelease (FXObject *, FXSelector, void *)
 
virtual long onMouseLeft (FXObject *, FXSelector, void *)
 
virtual long onMouseMove (FXObject *, FXSelector, void *)
 
virtual long onMouseWheel (FXObject *, FXSelector, void *)
 
virtual long onPaint (FXObject *, FXSelector, void *)
 
virtual long onRightBtnPress (FXObject *, FXSelector, void *)
 
virtual long onRightBtnRelease (FXObject *, FXSelector, void *)
 
virtual void openObjectDialog ()
 
SUMOReal p2m (SUMOReal pixel) const
 pixels-to-meters conversion method More...
 
virtual void recenterView ()
 recenters the view More...
 
void remove (GUIDialog_EditViewport *)
 
void remove (GUIDialog_ViewSettings *)
 
bool setColorScheme (const std::string &name)
 
virtual void setViewport (const Position &lookFrom, const Position &lookAt)
 applies the given viewport settings More...
 
void setWindowCursorPosition (FXint x, FXint y)
 Returns the information whether rotation is allowd. More...
 
void showToolTips (bool val)
 
virtual void showViewportEditor ()
 
void showViewschemeEditor ()
 
void startTrack (int id)
 Starts vehicle tracking. More...
 
void stopTrack ()
 Stops vehicle tracking. More...
 
void updateToolTip ()
 A method that updates the tooltip. More...
 
virtual ~GUIViewTraffic ()
 destructor More...
 
Dealing with snapshots
void setSnapshots (std::map< SUMOTime, std::string > snaps)
 Sets the snapshot time to file map. More...
 
std::string makeSnapshot (const std::string &destFile)
 Takes a snapshots and writes it into the given file. More...
 
void checkSnapshots ()
 Checks whether it is time for a snapshot. More...
 
Additional visualisations
bool addAdditionalGLVisualisation (GUIGlObject *const which)
 Adds an object to call its additional visualisation method. More...
 
bool removeAdditionalGLVisualisation (GUIGlObject *const which)
 Removes an object from the list of objects that show additional things. More...
 

Protected Member Functions

void applyGLTransform (bool fixRatio=true)
 
FXImage * checkGDALImage (Decal &d)
 check whether we can read image data or position with gdal More...
 
void displayLegend ()
 
virtual void doInit ()
 
int doPaintGL (int mode, const Boundary &bound)
 
void drawDecals ()
 Draws the stored decals. More...
 
GUIGlID getObjectAtPosition (Position pos)
 returns the id of the object at position using GL_SELECT More...
 
std::vector< GUIGlIDgetObjectsAtPosition (Position pos, SUMOReal radius)
 returns the ids of the object at position within the given (rectangular) radius using GL_SELECT More...
 
std::vector< GUIGlIDgetObjectsInBoundary (const Boundary &bound)
 returns the ids of all objects in the given boundary More...
 
GUIGlID getObjectUnderCursor ()
 returns the id of the object under the cursor using GL_SELECT More...
 
 GUIViewTraffic ()
 
void paintGL ()
 performs the painting of the simulation More...
 
void paintGLGrid ()
 paints a grid More...
 
void showToolTipFor (unsigned int id)
 invokes the tooltip for the given object More...
 
void updatePositionInformation () const
 

Protected Attributes

std::map< GUIGlObject *, int > myAdditionallyDrawn
 List of objects for which GUIGlObject::drawGLAdditional is called. More...
 
bool myAmInitialised
 Internal information whether doInit() was called. More...
 
GUIMainWindowmyApp
 The application. More...
 
GUIPerspectiveChangermyChanger
 The perspective changer. More...
 
SUMORTreemyGrid
 The visualization speed-up. More...
 
bool myInEditMode
 Information whether too-tip informations shall be generated. More...
 
int myMouseHotspotX
 Offset to the mouse-hotspot from the mouse position. More...
 
int myMouseHotspotY
 
GUIGlChildWindowmyParent
 The parent window. More...
 
MFXMutex myPolyDrawLock
 
GUIGLObjectPopupMenumyPopup
 The current popup-menu. More...
 
std::map< SUMOTime, std::string > mySnapshots
 
bool myUseToolTips
 
GUIDialog_EditViewportmyViewportChooser
 
GUIDialog_ViewSettingsmyVisualizationChanger
 
GUIVisualizationSettingsmyVisualizationSettings
 
FXint myWindowCursorPositionX
 Position of the cursor relative to the window. More...
 
FXint myWindowCursorPositionY
 
Optionally shown decals
std::vector< DecalmyDecals
 The list of decals to show. More...
 
MFXMutex myDecalsLock
 The mutex to use before accessing the decals list in order to avoid thread conficts. More...
 

Private Attributes

int myTrackedID
 

Detailed Description

Microsocopic view at the simulation

Definition at line 62 of file GUIViewTraffic.h.

Constructor & Destructor Documentation

GUIViewTraffic::GUIViewTraffic ( FXComposite *  p,
GUIMainWindow app,
GUISUMOViewParent parent,
GUINet net,
FXGLVisual *  glVis,
FXGLCanvas share 
)

constructor

Definition at line 76 of file GUIViewTraffic.cpp.

GUIViewTraffic::~GUIViewTraffic ( )
virtual

destructor

Definition at line 86 of file GUIViewTraffic.cpp.

GUIViewTraffic::GUIViewTraffic ( )
inlineprotected

Definition at line 107 of file GUIViewTraffic.h.

Member Function Documentation

bool GUISUMOAbstractView::addAdditionalGLVisualisation ( GUIGlObject *const  which)
inherited

Adds an object to call its additional visualisation method.

Parameters
[in]whichThe object to add
Returns
Always true
See also
GUIGlObject::drawGLAdditional

Definition at line 1096 of file GUISUMOAbstractView.cpp.

References GUISUMOAbstractView::myAdditionallyDrawn.

Referenced by GUIVehicle::addActiveAddVisualisation(), and GUIPerson::addActiveAddVisualisation().

void GUISUMOAbstractView::addDecals ( const std::vector< Decal > &  decals)
inlineinherited
void GUISUMOAbstractView::centerTo ( GUIGlID  id,
bool  applyZoom,
SUMOReal  zoomDist = 20 
)
virtualinherited

centers to the chosen artifact

Parameters
[in]idThe id of the artifact to center to
[in]applyZoomWhether to zoom in
[in]zoomDistThe distance in m to use for the zoom, values < 0 means: use the centeringBoundary
Note
caller is responsible for calling update

Definition at line 506 of file GUISUMOAbstractView.cpp.

References GUIPerspectiveChanger::centerTo(), Boundary::getCenter(), GUIGlObject::getCenteringBoundary(), GUIGlObjectStorage::getObjectBlocking(), GUIGlObjectStorage::gIDStorage, GUISUMOAbstractView::myChanger, GUIPerspectiveChanger::setViewport(), and GUIGlObjectStorage::unblockObject().

Referenced by GUIGLObjectPopupMenu::onCmdCenter(), GUISUMOAbstractView::paintGL(), TraCIServerAPI_GUI::processSet(), and GUIGlChildWindow::setView().

void GUISUMOAbstractView::centerTo ( const Boundary bound)
inherited

centers to the chosen artifact

Definition at line 522 of file GUISUMOAbstractView.cpp.

References GUISUMOAbstractView::myChanger, and GUIPerspectiveChanger::setViewport().

void GUISUMOAbstractView::checkSnapshots ( )
inherited
void GUISUMOAbstractView::destroyPopup ( )
inherited
void GUISUMOAbstractView::displayLegend ( )
protectedinherited

brief Draws the size legend

Draws a line with ticks, and the length information.

Definition at line 419 of file GUISUMOAbstractView.cpp.

References GUISUMOAbstractView::m2p(), pfDrawString(), pfSetPosition(), pfSetScaleXY(), and SUMOReal.

Referenced by GUISUMOAbstractView::makeSnapshot(), and GUISUMOAbstractView::paintGL().

virtual void GUISUMOAbstractView::doInit ( )
inlineprotectedvirtualinherited

Definition at line 328 of file GUISUMOAbstractView.h.

Referenced by GUISUMOAbstractView::onConfigure().

GUIPerspectiveChanger& GUISUMOAbstractView::getChanger ( ) const
inlineinherited
SUMOTime GUIViewTraffic::getCurrentTimeStep ( ) const
virtual

get the current simulation time

Reimplemented from GUISUMOAbstractView.

Definition at line 281 of file GUIViewTraffic.cpp.

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

Referenced by onGamingClick().

SUMOReal GUISUMOAbstractView::getDelay ( ) const
inherited

Returns the delay of the parent application.

Returns
delay in milliseconds

Definition at line 1145 of file GUISUMOAbstractView.cpp.

References GUIMainWindow::getDelay(), and GUISUMOAbstractView::myApp.

Referenced by GUIDialog_ViewSettings::onCmdExportSetting().

SUMOReal GUISUMOAbstractView::getGridHeight ( ) const
inherited
SUMOReal GUISUMOAbstractView::getGridWidth ( ) const
inherited
std::vector< GUIGlID > GUISUMOAbstractView::getObjectsAtPosition ( Position  pos,
SUMOReal  radius 
)
protectedinherited
GUIGlID GUISUMOAbstractView::getObjectUnderCursor ( )
protectedinherited
int GUIViewTraffic::getTrackedID ( ) const
virtual

Returns the id of the tracked vehicle (-1 if none)

Returns
The glID of the vehicle to track

Reimplemented from GUISUMOAbstractView.

Definition at line 233 of file GUIViewTraffic.cpp.

References myTrackedID.

Boundary GUISUMOAbstractView::getVisibleBoundary ( ) const
inherited
GUIVisualizationSettings* GUISUMOAbstractView::getVisualisationSettings ( )
inlineinherited
bool GUISUMOAbstractView::isInEditMode ( )
inherited

returns true, if the edit button was pressed

Definition at line 155 of file GUISUMOAbstractView.cpp.

References GUISUMOAbstractView::myInEditMode.

SUMOReal GUISUMOAbstractView::m2p ( SUMOReal  meter) const
inherited
FXbool GUISUMOAbstractView::makeCurrent ( )
inherited
long GUISUMOAbstractView::onKeyPress ( FXObject o,
FXSelector  sel,
void *  data 
)
virtualinherited

Definition at line 707 of file GUISUMOAbstractView.cpp.

long GUISUMOAbstractView::onKeyRelease ( FXObject o,
FXSelector  sel,
void *  data 
)
virtualinherited

Definition at line 736 of file GUISUMOAbstractView.cpp.

virtual long GUISUMOAbstractView::onMiddleBtnPress ( FXObject ,
FXSelector  ,
void *   
)
inlinevirtualinherited

Definition at line 141 of file GUISUMOAbstractView.h.

virtual long GUISUMOAbstractView::onMiddleBtnRelease ( FXObject ,
FXSelector  ,
void *   
)
inlinevirtualinherited

Definition at line 144 of file GUISUMOAbstractView.h.

long GUISUMOAbstractView::onMouseLeft ( FXObject ,
FXSelector  ,
void *   
)
virtualinherited

Definition at line 669 of file GUISUMOAbstractView.cpp.

long GUISUMOAbstractView::onMouseWheel ( FXObject ,
FXSelector  ,
void *  data 
)
virtualinherited
long GUISUMOAbstractView::onPaint ( FXObject ,
FXSelector  ,
void *   
)
virtualinherited
long GUISUMOAbstractView::onRightBtnPress ( FXObject ,
FXSelector  ,
void *  data 
)
virtualinherited
void GUISUMOAbstractView::recenterView ( )
virtualinherited
void GUISUMOAbstractView::remove ( GUIDialog_EditViewport )
inlineinherited
void GUISUMOAbstractView::remove ( GUIDialog_ViewSettings )
inlineinherited
bool GUISUMOAbstractView::removeAdditionalGLVisualisation ( GUIGlObject *const  which)
inherited

Removes an object from the list of objects that show additional things.

Parameters
[in]whichThe object to remoe
Returns
True if the object was known, false otherwise
See also
GUIGlObject::drawGLAdditional

Definition at line 1108 of file GUISUMOAbstractView.cpp.

References GUIGlObject::getGlID(), GUISUMOAbstractView::getTrackedID(), GUISUMOAbstractView::myAdditionallyDrawn, and GUISUMOAbstractView::stopTrack().

Referenced by GUIVehicle::removeActiveAddVisualisation(), and GUIPerson::removeActiveAddVisualisation().

void GUISUMOAbstractView::setSnapshots ( std::map< SUMOTime, std::string >  snaps)
inherited

Sets the snapshot time to file map.

Parameters
[in]snapsThe snapshots to take at certain times

Definition at line 748 of file GUISUMOAbstractView.cpp.

References GUISUMOAbstractView::mySnapshots.

Referenced by GUISettingsHandler::setSnapshots().

void GUISUMOAbstractView::setWindowCursorPosition ( FXint  x,
FXint  y 
)
inherited

Returns the information whether rotation is allowd.

Returns the gl-id of the object under the given coordinates

Definition at line 536 of file GUISUMOAbstractView.cpp.

References GUISUMOAbstractView::myMouseHotspotX, GUISUMOAbstractView::myMouseHotspotY, GUISUMOAbstractView::myWindowCursorPositionX, and GUISUMOAbstractView::myWindowCursorPositionY.

Referenced by GUIDanielPerspectiveChanger::onMouseMove().

void GUISUMOAbstractView::showToolTips ( bool  val)
inherited
void GUIViewTraffic::startTrack ( int  id)
virtual

Starts vehicle tracking.

Parameters
[in]idThe glID of the vehicle to track

Reimplemented from GUISUMOAbstractView.

Definition at line 221 of file GUIViewTraffic.cpp.

References myTrackedID.

void GUIViewTraffic::stopTrack ( )
virtual

Stops vehicle tracking.

Reimplemented from GUISUMOAbstractView.

Definition at line 227 of file GUIViewTraffic.cpp.

References myTrackedID.

void GUISUMOAbstractView::updateToolTip ( )
inherited

A method that updates the tooltip.

Definition at line 161 of file GUISUMOAbstractView.cpp.

References GUISUMOAbstractView::myUseToolTips.

Referenced by GUIDanielPerspectiveChanger::onMouseMove(), and GUIDanielPerspectiveChanger::onMouseWheel().

Field Documentation

std::map<GUIGlObject*, int> GUISUMOAbstractView::myAdditionallyDrawn
protectedinherited
bool GUISUMOAbstractView::myAmInitialised
protectedinherited

Internal information whether doInit() was called.

Definition at line 401 of file GUISUMOAbstractView.h.

Referenced by GUISUMOAbstractView::onConfigure(), GUISUMOAbstractView::onPaint(), and GUISUMOAbstractView::openObjectDialog().

std::vector<Decal> GUISUMOAbstractView::myDecals
protectedinherited
MFXMutex GUISUMOAbstractView::myDecalsLock
protectedinherited

The mutex to use before accessing the decals list in order to avoid thread conficts.

Definition at line 415 of file GUISUMOAbstractView.h.

Referenced by GUISUMOAbstractView::drawDecals(), and GUISUMOAbstractView::showViewschemeEditor().

bool GUISUMOAbstractView::myInEditMode
protectedinherited

Information whether too-tip informations shall be generated.

Definition at line 385 of file GUISUMOAbstractView.h.

Referenced by GUISUMOAbstractView::isInEditMode().

int GUISUMOAbstractView::myMouseHotspotX
protectedinherited

Offset to the mouse-hotspot from the mouse position.

Definition at line 391 of file GUISUMOAbstractView.h.

Referenced by GUISUMOAbstractView::setWindowCursorPosition().

int GUISUMOAbstractView::myMouseHotspotY
protectedinherited

Definition at line 391 of file GUISUMOAbstractView.h.

Referenced by GUISUMOAbstractView::setWindowCursorPosition().

GUIGlChildWindow* GUISUMOAbstractView::myParent
protectedinherited

The parent window.

Definition at line 376 of file GUISUMOAbstractView.h.

Referenced by GUISUMOAbstractView::getColoringSchemesCombo().

MFXMutex GUISUMOAbstractView::myPolyDrawLock
mutableprotectedinherited

Definition at line 421 of file GUISUMOAbstractView.h.

GUIGLObjectPopupMenu* GUISUMOAbstractView::myPopup
protectedinherited
std::map<SUMOTime, std::string> GUISUMOAbstractView::mySnapshots
protectedinherited
int GUIViewTraffic::myTrackedID
private

Definition at line 104 of file GUIViewTraffic.h.

Referenced by getTrackedID(), startTrack(), and stopTrack().

GUIDialog_ViewSettings* GUISUMOAbstractView::myVisualizationChanger
protectedinherited
FXint GUISUMOAbstractView::myWindowCursorPositionX
protectedinherited

Position of the cursor relative to the window.

Definition at line 388 of file GUISUMOAbstractView.h.

Referenced by GUISUMOAbstractView::getPositionInformation(), and GUISUMOAbstractView::setWindowCursorPosition().

FXint GUISUMOAbstractView::myWindowCursorPositionY
protectedinherited

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