SUMO - Simulation of Urban MObility

GUIViewTraffic Class Reference

#include <GUIViewTraffic.h>

Inheritance diagram for GUIViewTraffic:
GUISUMOAbstractView FXGLCanvas

Public Types

enum  JunctionColoringScheme { VCS_BY_TYPE = 0 }

Public Member Functions

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

Protected Member Functions

void applyGLTransform (bool fixRatio=true)
void displayLegend ()
virtual void doInit ()
int doPaintGL (int mode, const Boundary &bound)
void drawDecals ()
 Draws the stored decals.
GUIGlID getObjectAtPosition (Position pos)
 returns the id of the object at position using GL_SELECT
std::vector< GUIGlID > getObjectsInBoundary (const Boundary &bound)
 returns the ids of all objects in the given boundary
GUIGlID getObjectUnderCursor ()
 returns the id of the object under the cursor using GL_SELECT
 GUIViewTraffic ()
void paintGL ()
 performs the painting of the simulation
void paintGLGrid ()
 paints a grid
void showToolTipFor (unsigned int id)
 invokes the tooltip for the given object
void updatePositionInformation () const

Protected Attributes

std::map< GUIGlObject *, int > myAdditionallyDrawn
 List of objects for which GUIGlObject::drawGLAdditional is called.
bool myAmInitialised
 Internal information whether doInit() was called.
GUIMainWindow * myApp
 The application.
GUIPerspectiveChanger * myChanger
 The perspective changer.
SUMORTree * myGrid
 The visualization speed-up.
bool myInEditMode
 Information whether too-tip informations shall be generated.
int myMouseHotspotX
 Offset to the mouse-hotspot from the mouse position.
int myMouseHotspotY
GUIGlChildWindow * myParent
 The parent window.
MFXMutex myPolyDrawLock
GUIGLObjectPopupMenu * myPopup
 The current popup-menu.
std::map< SUMOTime, std::string > mySnapshots
bool myUseToolTips
GUIDialog_EditViewport * myViewportChooser
GUIDialog_ViewSettings * myVisualizationChanger
GUIVisualizationSettings * myVisualizationSettings
FXint myWindowCursorPositionX
 Position of the cursor relative to the window.
FXint myWindowCursorPositionY
Optionally shown decals
std::vector< Decal > myDecals
 The list of decals to show.
MFXMutex myDecalsLock
 The mutex to use before accessing the decals list in order to avoid thread conficts.

Private Attributes

int myTrackedID

Detailed Description

Microsocopic view at the simulation

Definition at line 59 of file GUIViewTraffic.h.


Member Enumeration Documentation

JunctionColoringScheme This enumeration holds the possible vehicle colouring schemes

Enumerator:
VCS_BY_TYPE 

colouring by vehicle speed

Definition at line 232 of file GUISUMOAbstractView.h.


Constructor & Destructor Documentation

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

constructor

Definition at line 77 of file GUIViewTraffic.cpp.

GUIViewTraffic::~GUIViewTraffic ( ) [virtual]

destructor

Definition at line 87 of file GUIViewTraffic.cpp.

GUIViewTraffic::GUIViewTraffic ( ) [inline, protected]

Definition at line 106 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 965 of file GUISUMOAbstractView.cpp.

References GUISUMOAbstractView::myAdditionallyDrawn.

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

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

Definition at line 476 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 491 of file GUISUMOAbstractView.cpp.

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

void GUISUMOAbstractView::checkSnapshots ( ) [inherited]
void GUISUMOAbstractView::destroyPopup ( ) [inherited]
void GUISUMOAbstractView::displayLegend ( ) [protected, inherited]

brief Draws the size legend

Draws a line with ticks, and the length information.

Definition at line 386 of file GUISUMOAbstractView.cpp.

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

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

virtual void GUISUMOAbstractView::doInit ( ) [inline, protected, virtual, inherited]

Definition at line 297 of file GUISUMOAbstractView.h.

Referenced by GUISUMOAbstractView::onConfigure().

GUIPerspectiveChanger& GUISUMOAbstractView::getChanger ( ) const [inline, inherited]
FXComboBox & GUISUMOAbstractView::getColoringSchemesCombo ( ) [inherited]
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::getGridHeight ( ) const [inherited]
SUMOReal GUISUMOAbstractView::getGridWidth ( ) const [inherited]
std::vector< GUIGlID > GUISUMOAbstractView::getObjectsInBoundary ( const Boundary &  bound) [protected, inherited]
GUIGlID GUISUMOAbstractView::getObjectUnderCursor ( ) [protected, inherited]
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 218 of file GUIViewTraffic.cpp.

References myTrackedID.

Boundary GUISUMOAbstractView::getVisibleBoundary ( ) const [inherited]
const GUIVisualizationSettings* GUISUMOAbstractView::getVisualisationSettings ( ) [inline, inherited]
bool GUISUMOAbstractView::isInEditMode ( ) [inherited]

returns true, if the edit button was pressed

Definition at line 149 of file GUISUMOAbstractView.cpp.

References GUISUMOAbstractView::myInEditMode.

SUMOReal GUISUMOAbstractView::m2p ( SUMOReal  meter) const [inherited]
FXbool GUISUMOAbstractView::makeCurrent ( ) [inherited]
std::string GUISUMOAbstractView::makeSnapshot ( const std::string &  destFile) [inherited]

Takes a snapshots and writes it into the given file.

The format to use is determined from the extension.

Parameters:
[in]destFileThe name of the file to write the snapshot into
Returns:
The error message, if an error occcured; "" otherwise

Definition at line 727 of file GUISUMOAbstractView.cpp.

References GUIVisualizationSettings::antialiase, GUISUMOAbstractView::applyGLTransform(), GUIVisualizationSettings::backgroundColor, RGBColor::blue(), GUISUMOAbstractView::displayLegend(), GUIVisualizationSettings::dither, GUISUMOAbstractView::doPaintGL(), GUISUMOAbstractView::drawDecals(), GUIPerspectiveChanger::getViewport(), GL2PS_DRAW_BACKGROUND, GL2PS_EPS, GL2PS_OVERFLOW, GL2PS_PDF, GL2PS_PGF, GL2PS_PS, GL2PS_SIMPLE_SORT, GL2PS_SVG, GL2PS_TEX, GL2PS_USE_CURRENT_VIEWPORT, gl2psBeginPage(), gl2psEndPage(), RGBColor::green(), GUISUMOAbstractView::m2p(), GUISUMOAbstractView::makeCurrent(), GUISUMOAbstractView::myChanger, GUISUMOAbstractView::myGrid, GUISUMOAbstractView::myUseToolTips, GUISUMOAbstractView::myVisualizationSettings, GUISUMOAbstractView::paintGLGrid(), RGBColor::red(), MFXImageHelper::saveImage(), GUIVisualizationSettings::scale, RTree< DATATYPE, DATATYPENP, ELEMTYPE, NUMDIMS, CONTEXT, ELEMTYPEREAL, TMAXNODES, TMINNODES >::Search(), GUIVisualizationSettings::showGrid, GUIVisualizationSettings::showSizeLegend, FXSingleEventThread::sleep(), SUMO_const_laneWidth, Boundary::xmax(), Boundary::xmin(), Boundary::ymax(), and Boundary::ymin().

Referenced by GUISUMOAbstractView::checkSnapshots(), GUISUMOViewParent::onCmdMakeSnapshot(), and TraCIServerAPI_GUI::processSet().

long GUISUMOAbstractView::onKeyPress ( FXObject *  o,
FXSelector  sel,
void *  data 
) [inherited]

Definition at line 680 of file GUISUMOAbstractView.cpp.

long GUISUMOAbstractView::onKeyRelease ( FXObject *  o,
FXSelector  sel,
void *  data 
) [inherited]

Definition at line 709 of file GUISUMOAbstractView.cpp.

long GUISUMOAbstractView::onMouseLeft ( FXObject *  ,
FXSelector  ,
void *   
) [virtual, inherited]

Definition at line 642 of file GUISUMOAbstractView.cpp.

long GUISUMOAbstractView::onMouseWheel ( FXObject *  ,
FXSelector  ,
void *  data 
) [virtual, inherited]
long GUISUMOAbstractView::onPaint ( FXObject *  ,
FXSelector  ,
void *   
) [inherited]
long GUISUMOAbstractView::onRightBtnPress ( FXObject *  ,
FXSelector  ,
void *  data 
) [virtual, inherited]
long GUISUMOAbstractView::onRightBtnRelease ( FXObject *  ,
FXSelector  ,
void *  data 
) [virtual, inherited]
SUMOReal GUISUMOAbstractView::p2m ( SUMOReal  pixel) const [inherited]
void GUISUMOAbstractView::recenterView ( ) [inherited]
void GUISUMOAbstractView::remove ( GUIDialog_EditViewport *  ) [inline, inherited]
void GUISUMOAbstractView::remove ( GUIDialog_ViewSettings *  ) [inline, inherited]
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 977 of file GUISUMOAbstractView.cpp.

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

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 721 of file GUISUMOAbstractView.cpp.

References GUISUMOAbstractView::mySnapshots.

void GUISUMOAbstractView::setViewport ( SUMOReal  zoom,
SUMOReal  xPos,
SUMOReal  yPos 
) [virtual, inherited]
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 505 of file GUISUMOAbstractView.cpp.

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

Referenced by GUIDanielPerspectiveChanger::onMouseMove().

void GUISUMOAbstractView::showToolTipFor ( unsigned int  id) [protected, inherited]
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 206 of file GUIViewTraffic.cpp.

References myTrackedID.

void GUIViewTraffic::stopTrack ( ) [virtual]

Stops vehicle tracking.

Reimplemented from GUISUMOAbstractView.

Definition at line 212 of file GUIViewTraffic.cpp.

References myTrackedID.

void GUISUMOAbstractView::updateToolTip ( ) [inherited]

A method that updates the tooltip.

Definition at line 155 of file GUISUMOAbstractView.cpp.

References GUISUMOAbstractView::myUseToolTips.

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


Field Documentation

Internal information whether doInit() was called.

Definition at line 363 of file GUISUMOAbstractView.h.

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

std::vector<Decal> GUISUMOAbstractView::myDecals [protected, inherited]

The list of decals to show.

Definition at line 374 of file GUISUMOAbstractView.h.

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

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

Definition at line 377 of file GUISUMOAbstractView.h.

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

bool GUISUMOAbstractView::myInEditMode [protected, inherited]

Information whether too-tip informations shall be generated.

Definition at line 347 of file GUISUMOAbstractView.h.

Referenced by GUISUMOAbstractView::isInEditMode().

int GUISUMOAbstractView::myMouseHotspotX [protected, inherited]

Offset to the mouse-hotspot from the mouse position.

Definition at line 353 of file GUISUMOAbstractView.h.

Referenced by GUISUMOAbstractView::setWindowCursorPosition().

int GUISUMOAbstractView::myMouseHotspotY [protected, inherited]

Definition at line 353 of file GUISUMOAbstractView.h.

Referenced by GUISUMOAbstractView::setWindowCursorPosition().

The parent window.

Definition at line 338 of file GUISUMOAbstractView.h.

Referenced by GUISUMOAbstractView::getColoringSchemesCombo().

MFXMutex GUISUMOAbstractView::myPolyDrawLock [mutable, protected, inherited]

Definition at line 383 of file GUISUMOAbstractView.h.

std::map<SUMOTime, std::string> GUISUMOAbstractView::mySnapshots [protected, inherited]

Definition at line 103 of file GUIViewTraffic.h.

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

FXint GUISUMOAbstractView::myWindowCursorPositionX [protected, inherited]

Position of the cursor relative to the window.

Definition at line 350 of file GUISUMOAbstractView.h.

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


The documentation for this class was generated from the following files:
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Defines