SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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
GUIPerspectiveChangergetChanger () 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 GUIVisualizationSettingsgetVisualisationSettings ()
 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.
virtual long onConfigure (FXObject *, FXSelector, void *)
void onGamingClick (Position pos)
 handle mouse click in gaming mode
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 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
void recenterView ()
 recenters the view
void remove (GUIDialog_EditViewport *)
void remove (GUIDialog_ViewSettings *)
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< GUIGlIDgetObjectsInBoundary (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 *, intmyAdditionallyDrawn
 List of objects for which GUIGlObject::drawGLAdditional is called.
bool myAmInitialised
 Internal information whether doInit() was called.
GUIMainWindowmyApp
 The application.
GUIPerspectiveChangermyChanger
 The perspective changer.
SUMORTreemyGrid
 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
GUIGlChildWindowmyParent
 The parent window.
MFXMutex myPolyDrawLock
GUIGLObjectPopupMenumyPopup
 The current popup-menu.
std::map< SUMOTime, std::string > mySnapshots
bool myUseToolTips
GUIDialog_EditViewportmyViewportChooser
GUIDialog_ViewSettingsmyVisualizationChanger
GUIVisualizationSettingsmyVisualizationSettings
FXint myWindowCursorPositionX
 Position of the cursor relative to the window.
FXint myWindowCursorPositionY
Optionally shown decals
std::vector< DecalmyDecals
 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 63 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 237 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 82 of file GUIViewTraffic.cpp.

GUIViewTraffic::~GUIViewTraffic ( )
virtual

destructor

Definition at line 92 of file GUIViewTraffic.cpp.

GUIViewTraffic::GUIViewTraffic ( )
inlineprotected

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

References GUISUMOAbstractView::myAdditionallyDrawn.

Referenced by GUIVehicle::addActiveAddVisualisation().

void GUISUMOAbstractView::addDecals ( const std::vector< Decal > &  decals)
inlineinherited
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
Note:
caller is responsible for calling update

Definition at line 481 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 495 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 391 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 302 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 289 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)
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 226 of file GUIViewTraffic.cpp.

References myTrackedID.

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

returns true, if the edit button was pressed

Definition at line 154 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 731 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 
)
virtualinherited

Definition at line 684 of file GUISUMOAbstractView.cpp.

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

Definition at line 713 of file GUISUMOAbstractView.cpp.

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

Definition at line 646 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
long GUISUMOAbstractView::onRightBtnRelease ( FXObject ,
FXSelector  ,
void *  data 
)
virtualinherited
void GUISUMOAbstractView::recenterView ( )
inherited
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 981 of file GUISUMOAbstractView.cpp.

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

Referenced by GUIVehicle::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 725 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 509 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 214 of file GUIViewTraffic.cpp.

References myTrackedID.

void GUIViewTraffic::stopTrack ( )
virtual

Stops vehicle tracking.

Reimplemented from GUISUMOAbstractView.

Definition at line 220 of file GUIViewTraffic.cpp.

References myTrackedID.

void GUISUMOAbstractView::updateToolTip ( )
inherited

A method that updates the tooltip.

Definition at line 160 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 368 of file GUISUMOAbstractView.h.

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

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

The list of decals to show.

Definition at line 379 of file GUISUMOAbstractView.h.

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

MFXMutex GUISUMOAbstractView::myDecalsLock
protectedinherited

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

Definition at line 382 of file GUISUMOAbstractView.h.

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

bool GUISUMOAbstractView::myInEditMode
protectedinherited

Information whether too-tip informations shall be generated.

Definition at line 352 of file GUISUMOAbstractView.h.

Referenced by GUISUMOAbstractView::isInEditMode().

int GUISUMOAbstractView::myMouseHotspotX
protectedinherited

Offset to the mouse-hotspot from the mouse position.

Definition at line 358 of file GUISUMOAbstractView.h.

Referenced by GUISUMOAbstractView::setWindowCursorPosition().

int GUISUMOAbstractView::myMouseHotspotY
protectedinherited

Definition at line 358 of file GUISUMOAbstractView.h.

Referenced by GUISUMOAbstractView::setWindowCursorPosition().

GUIGlChildWindow* GUISUMOAbstractView::myParent
protectedinherited

The parent window.

Definition at line 343 of file GUISUMOAbstractView.h.

Referenced by GUISUMOAbstractView::getColoringSchemesCombo().

MFXMutex GUISUMOAbstractView::myPolyDrawLock
mutableprotectedinherited

Definition at line 388 of file GUISUMOAbstractView.h.

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

Definition at line 107 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 355 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: