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

#include <GUISUMOAbstractView.h>

Inheritance diagram for GUISUMOAbstractView:
FXGLCanvas GUIViewTraffic

Data Structures

struct  Decal
 A decal (an image) that can be shown. More...
 

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 ()
 
SUMOReal getGridHeight () const
 
SUMOReal getGridWidth () const
 
Position getPositionInformation () const
 Returns the cursor's x/y position within the network. More...
 
virtual int getTrackedID () const
 
Boundary getVisibleBoundary () const
 
const GUIVisualizationSettingsgetVisualisationSettings ()
 
 GUISUMOAbstractView (FXComposite *p, GUIMainWindow &app, GUIGlChildWindow *parent, const SUMORTree &grid, 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 *)
 
virtual void onGamingClick (Position)
 
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 *)
 
virtual bool setColorScheme (const std::string &)
 
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 ()
 
virtual void startTrack (int)
 
virtual void stopTrack ()
 
void updateToolTip ()
 A method that updates the tooltip. More...
 
virtual ~GUISUMOAbstractView ()
 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...
 
virtual SUMOTime getCurrentTimeStep () const
 get the current simulation time 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 ()
 
virtual int doPaintGL (int, const Boundary &)
 
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< 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...
 
 GUISUMOAbstractView ()
 
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 *, intmyAdditionallyDrawn
 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...
 

Detailed Description

This class is meant to be pure virtual later; It shall be the main class to inherit views of the simulation (micro- or macroscopic ones) from it.

Definition at line 82 of file GUISUMOAbstractView.h.

Constructor & Destructor Documentation

GUISUMOAbstractView::GUISUMOAbstractView ( FXComposite *  p,
GUIMainWindow app,
GUIGlChildWindow parent,
const SUMORTree grid,
FXGLVisual *  glVis,
FXGLCanvas share 
)
GUISUMOAbstractView::GUISUMOAbstractView ( )
inlineprotected

Definition at line 418 of file GUISUMOAbstractView.h.

Member Function Documentation

bool GUISUMOAbstractView::addAdditionalGLVisualisation ( GUIGlObject *const  which)

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

References myAdditionallyDrawn.

Referenced by GUIVehicle::addActiveAddVisualisation().

void GUISUMOAbstractView::addDecals ( const std::vector< Decal > &  decals)
inline

Definition at line 300 of file GUISUMOAbstractView.h.

References myDecals.

Referenced by GUIApplicationWindow::handleEvent_SimulationLoaded().

void GUISUMOAbstractView::applyGLTransform ( bool  fixRatio = true)
protected
virtual void GUISUMOAbstractView::buildViewToolBars ( GUIGlChildWindow )
inlinevirtual

builds the view toolbars

Reimplemented in GUIViewTraffic.

Definition at line 94 of file GUISUMOAbstractView.h.

Referenced by GUISUMOViewParent::init().

void GUISUMOAbstractView::centerTo ( GUIGlID  id,
bool  applyZoom,
SUMOReal  zoomDist = 20 
)
virtual

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

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

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

void GUISUMOAbstractView::centerTo ( const Boundary bound)

centers to the chosen artifact

Definition at line 478 of file GUISUMOAbstractView.cpp.

References myChanger, and GUIPerspectiveChanger::setViewport().

void GUISUMOAbstractView::checkSnapshots ( )

Checks whether it is time for a snapshot.

Definition at line 855 of file GUISUMOAbstractView.cpp.

References getCurrentTimeStep(), makeSnapshot(), mySnapshots, and WRITE_WARNING.

Referenced by onConfigure(), and GUISUMOViewParent::onSimStep().

void GUISUMOAbstractView::destroyPopup ( )

destoys the popup

Definition at line 537 of file GUISUMOAbstractView.cpp.

References myPopup.

Referenced by onLeftBtnPress(), onLeftBtnRelease(), onRightBtnPress(), and onRightBtnRelease().

void GUISUMOAbstractView::displayLegend ( )
protected

brief Draws the size legend

Draws a line with ticks, and the length information.

Definition at line 377 of file GUISUMOAbstractView.cpp.

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

Referenced by makeSnapshot(), and paintGL().

virtual void GUISUMOAbstractView::doInit ( )
inlineprotectedvirtual

Definition at line 321 of file GUISUMOAbstractView.h.

Referenced by onConfigure().

virtual int GUISUMOAbstractView::doPaintGL ( int  ,
const Boundary  
)
inlineprotectedvirtual

Reimplemented in GUIViewTraffic.

Definition at line 317 of file GUISUMOAbstractView.h.

Referenced by getObjectsInBoundary(), makeSnapshot(), and paintGL().

GUIPerspectiveChanger& GUISUMOAbstractView::getChanger ( ) const
inline

Definition at line 131 of file GUISUMOAbstractView.h.

References myChanger.

Referenced by TraCIServerAPI_GUI::processGet(), and TraCIServerAPI_GUI::processSet().

virtual SUMOTime GUISUMOAbstractView::getCurrentTimeStep ( ) const
inlinevirtual

get the current simulation time

Reimplemented in GUIViewTraffic.

Definition at line 186 of file GUISUMOAbstractView.h.

Referenced by checkSnapshots().

SUMOReal GUISUMOAbstractView::getGridHeight ( ) const
SUMOReal GUISUMOAbstractView::getGridWidth ( ) const

Definition at line 909 of file GUISUMOAbstractView.cpp.

References Boundary::getWidth(), and myGrid.

Referenced by checkGDALImage(), and GUIDialog_ViewSettings::onCmdEditTable().

GUIGlID GUISUMOAbstractView::getObjectAtPosition ( Position  pos)
protected
std::vector< GUIGlID > GUISUMOAbstractView::getObjectsInBoundary ( const Boundary bound)
protected
GUIGlID GUISUMOAbstractView::getObjectUnderCursor ( )
protected

returns the id of the object under the cursor using GL_SELECT

Definition at line 253 of file GUISUMOAbstractView.cpp.

References getObjectAtPosition(), and getPositionInformation().

Referenced by onLeftBtnPress(), openObjectDialog(), and paintGL().

virtual int GUISUMOAbstractView::getTrackedID ( ) const
inlinevirtual

Reimplemented in GUIViewTraffic.

Definition at line 216 of file GUISUMOAbstractView.h.

Referenced by GUIVehicle::getPopUpMenu(), paintGL(), and removeAdditionalGLVisualisation().

Boundary GUISUMOAbstractView::getVisibleBoundary ( ) const
const GUIVisualizationSettings* GUISUMOAbstractView::getVisualisationSettings ( )
inline

Definition at line 305 of file GUISUMOAbstractView.h.

References myVisualizationSettings.

bool GUISUMOAbstractView::isInEditMode ( )

returns true, if the edit button was pressed

Definition at line 155 of file GUISUMOAbstractView.cpp.

References myInEditMode.

SUMOReal GUISUMOAbstractView::m2p ( SUMOReal  meter) const

meter-to-pixels conversion method

Definition at line 446 of file GUISUMOAbstractView.cpp.

References GUIPerspectiveChanger::getViewport(), Boundary::getWidth(), and myChanger.

Referenced by displayLegend(), GUIViewTraffic::doPaintGL(), and makeSnapshot().

FXbool GUISUMOAbstractView::makeCurrent ( )

A reimplementation due to some internal reasons.

Definition at line 499 of file GUISUMOAbstractView.cpp.

Referenced by makeSnapshot(), onConfigure(), onLeftBtnPress(), onPaint(), and openObjectDialog().

long GUISUMOAbstractView::onConfigure ( FXObject ,
FXSelector  ,
void *   
)
virtual
virtual void GUISUMOAbstractView::onGamingClick ( Position  )
inlinevirtual

Reimplemented in GUIViewTraffic.

Definition at line 220 of file GUISUMOAbstractView.h.

Referenced by onLeftBtnRelease().

long GUISUMOAbstractView::onKeyPress ( FXObject o,
FXSelector  sel,
void *  data 
)
virtual

Definition at line 665 of file GUISUMOAbstractView.cpp.

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

Definition at line 694 of file GUISUMOAbstractView.cpp.

long GUISUMOAbstractView::onLeftBtnPress ( FXObject ,
FXSelector  ,
void *  data 
)
virtual
long GUISUMOAbstractView::onLeftBtnRelease ( FXObject ,
FXSelector  ,
void *  data 
)
virtual
virtual long GUISUMOAbstractView::onMiddleBtnPress ( FXObject ,
FXSelector  ,
void *   
)
inlinevirtual

Definition at line 141 of file GUISUMOAbstractView.h.

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

Definition at line 144 of file GUISUMOAbstractView.h.

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

Definition at line 627 of file GUISUMOAbstractView.cpp.

long GUISUMOAbstractView::onMouseWheel ( FXObject ,
FXSelector  ,
void *  data 
)
virtual

Definition at line 603 of file GUISUMOAbstractView.cpp.

References myChanger, and GUIPerspectiveChanger::onMouseWheel().

long GUISUMOAbstractView::onPaint ( FXObject ,
FXSelector  ,
void *   
)
virtual

Definition at line 524 of file GUISUMOAbstractView.cpp.

References makeCurrent(), myAmInitialised, and paintGL().

long GUISUMOAbstractView::onRightBtnPress ( FXObject ,
FXSelector  ,
void *  data 
)
virtual
long GUISUMOAbstractView::onRightBtnRelease ( FXObject o,
FXSelector  sel,
void *  data 
)
virtual
SUMOReal GUISUMOAbstractView::p2m ( SUMOReal  pixel) const
void GUISUMOAbstractView::recenterView ( )
virtual
void GUISUMOAbstractView::remove ( GUIDialog_EditViewport )
inline

Definition at line 200 of file GUISUMOAbstractView.h.

References myViewportChooser.

Referenced by GUIDialog_ViewSettings::~GUIDialog_ViewSettings().

void GUISUMOAbstractView::remove ( GUIDialog_ViewSettings )
inline

Definition at line 204 of file GUISUMOAbstractView.h.

References myVisualizationChanger.

bool GUISUMOAbstractView::removeAdditionalGLVisualisation ( GUIGlObject *const  which)

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

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

Referenced by GUIVehicle::removeActiveAddVisualisation().

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

Sets the snapshot time to file map.

Parameters
[in]snapsThe snapshots to take at certain times

Definition at line 706 of file GUISUMOAbstractView.cpp.

References mySnapshots.

Referenced by GUISettingsHandler::setSnapshots().

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

Returns the information whether rotation is allowd.

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

Definition at line 492 of file GUISUMOAbstractView.cpp.

References myMouseHotspotX, myMouseHotspotY, myWindowCursorPositionX, and myWindowCursorPositionY.

Referenced by GUIDanielPerspectiveChanger::onMouseMove().

void GUISUMOAbstractView::showToolTipFor ( unsigned int  id)
protected
void GUISUMOAbstractView::showToolTips ( bool  val)

Definition at line 902 of file GUISUMOAbstractView.cpp.

References myUseToolTips.

Referenced by GUIGlChildWindow::onCmdShowToolTips().

void GUISUMOAbstractView::showViewschemeEditor ( )
virtual void GUISUMOAbstractView::startTrack ( int  )
inlinevirtual

Reimplemented in GUIViewTraffic.

Definition at line 214 of file GUISUMOAbstractView.h.

Referenced by TraCIServerAPI_GUI::processSet().

virtual void GUISUMOAbstractView::stopTrack ( )
inlinevirtual

Reimplemented in GUIViewTraffic.

Definition at line 215 of file GUISUMOAbstractView.h.

Referenced by TraCIServerAPI_GUI::processSet(), and removeAdditionalGLVisualisation().

void GUISUMOAbstractView::updateToolTip ( )

A method that updates the tooltip.

Definition at line 161 of file GUISUMOAbstractView.cpp.

References myUseToolTips.

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

Field Documentation

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

Internal information whether doInit() was called.

Definition at line 391 of file GUISUMOAbstractView.h.

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

GUIMainWindow* GUISUMOAbstractView::myApp
protected
std::vector<Decal> GUISUMOAbstractView::myDecals
protected

The list of decals to show.

Definition at line 402 of file GUISUMOAbstractView.h.

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

MFXMutex GUISUMOAbstractView::myDecalsLock
protected

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

Definition at line 405 of file GUISUMOAbstractView.h.

Referenced by drawDecals(), and showViewschemeEditor().

SUMORTree* GUISUMOAbstractView::myGrid
protected

The visualization speed-up.

Definition at line 369 of file GUISUMOAbstractView.h.

Referenced by GUIViewTraffic::doPaintGL(), getGridHeight(), getGridWidth(), makeSnapshot(), paintGLGrid(), and recenterView().

bool GUISUMOAbstractView::myInEditMode
protected

Information whether too-tip informations shall be generated.

Definition at line 375 of file GUISUMOAbstractView.h.

Referenced by isInEditMode().

int GUISUMOAbstractView::myMouseHotspotX
protected

Offset to the mouse-hotspot from the mouse position.

Definition at line 381 of file GUISUMOAbstractView.h.

Referenced by setWindowCursorPosition().

int GUISUMOAbstractView::myMouseHotspotY
protected

Definition at line 381 of file GUISUMOAbstractView.h.

Referenced by setWindowCursorPosition().

GUIGlChildWindow* GUISUMOAbstractView::myParent
protected

The parent window.

Definition at line 366 of file GUISUMOAbstractView.h.

Referenced by getColoringSchemesCombo().

MFXMutex GUISUMOAbstractView::myPolyDrawLock
mutableprotected

Definition at line 411 of file GUISUMOAbstractView.h.

GUIGLObjectPopupMenu* GUISUMOAbstractView::myPopup
protected

The current popup-menu.

Definition at line 384 of file GUISUMOAbstractView.h.

Referenced by destroyPopup(), openObjectDialog(), and ~GUISUMOAbstractView().

std::map<SUMOTime, std::string> GUISUMOAbstractView::mySnapshots
protected

Definition at line 409 of file GUISUMOAbstractView.h.

Referenced by checkSnapshots(), and setSnapshots().

bool GUISUMOAbstractView::myUseToolTips
protected
GUIDialog_EditViewport* GUISUMOAbstractView::myViewportChooser
protected
GUIDialog_ViewSettings* GUISUMOAbstractView::myVisualizationChanger
protected
FXint GUISUMOAbstractView::myWindowCursorPositionX
protected

Position of the cursor relative to the window.

Definition at line 378 of file GUISUMOAbstractView.h.

Referenced by getPositionInformation(), and setWindowCursorPosition().

FXint GUISUMOAbstractView::myWindowCursorPositionY
protected

Definition at line 378 of file GUISUMOAbstractView.h.

Referenced by getPositionInformation(), and setWindowCursorPosition().


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