SUMO - Simulation of Urban MObility
GUISUMOAbstractView Class Reference

#include <GUISUMOAbstractView.h>

Inheritance diagram for GUISUMOAbstractView:
Inheritance graph
Collaboration diagram for GUISUMOAbstractView:
Collaboration graph

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 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...
 
virtual int getTrackedID () const
 
GUIDialog_EditViewportgetViewportEditor ()
 get the viewport and create it on first access More...
 
Boundary getVisibleBoundary () const
 
GUIVisualizationSettingsgetVisualisationSettings () 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 &)
 
void setDelay (SUMOReal delay)
 Sets the delay of the parent application. More...
 
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...
 
virtual void saveFrame (const std::string &destFile, FXColor *buf)
 Adds a frame to a video snapshot which will be initialized if neccessary. More...
 
virtual void endSnapshot ()
 Ends a video snapshot. More...
 
virtual 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< 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...
 
 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 *, 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...
 

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

References myAdditionallyDrawn.

Referenced by GUIBaseVehicle::addActiveAddVisualisation(), GUIPerson::addActiveAddVisualisation(), and onGamingClick().

void GUISUMOAbstractView::addDecals ( const std::vector< Decal > &  decals)
inline
void GUISUMOAbstractView::applyGLTransform ( bool  fixRatio = true)
protected
virtual void GUISUMOAbstractView::buildViewToolBars ( GUIGlChildWindow )
inlinevirtual

builds the view toolbars

Reimplemented in GNEViewNet, and GUIViewTraffic.

Definition at line 94 of file GUISUMOAbstractView.h.

References centerTo(), isInEditMode(), m2p(), makeCurrent(), p2m(), recenterView(), setViewport(), setWindowCursorPosition(), and SUMOReal.

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

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

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

void GUISUMOAbstractView::centerTo ( const Boundary bound)

centers to the chosen artifact

Definition at line 523 of file GUISUMOAbstractView.cpp.

References myChanger, and GUIPerspectiveChanger::setViewport().

void GUISUMOAbstractView::checkSnapshots ( )
virtual

Checks whether it is time for a snapshot.

Reimplemented in GUIViewTraffic.

Definition at line 886 of file GUISUMOAbstractView.cpp.

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

Referenced by GUIViewTraffic::checkSnapshots(), endSnapshot(), onConfigure(), and GUISUMOViewParent::onSimStep().

void GUISUMOAbstractView::destroyPopup ( )
void GUISUMOAbstractView::displayLegend ( )
protected

brief Draws the size legend

Draws a line with ticks, and the length information.

Definition at line 419 of file GUISUMOAbstractView.cpp.

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

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

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

Reimplemented in GNEViewNet, and GUIViewTraffic.

Definition at line 347 of file GUISUMOAbstractView.h.

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

virtual void GUISUMOAbstractView::endSnapshot ( )
inlinevirtual

Ends a video snapshot.

Reimplemented in GUIViewTraffic.

Definition at line 193 of file GUISUMOAbstractView.h.

References checkSnapshots().

Referenced by GUISUMOViewParent::onCmdMakeSnapshot().

FXComboBox & GUISUMOAbstractView::getColoringSchemesCombo ( )
virtual SUMOTime GUISUMOAbstractView::getCurrentTimeStep ( ) const
inlinevirtual

get the current simulation time

Reimplemented in GUIViewTraffic.

Definition at line 201 of file GUISUMOAbstractView.h.

References getViewportEditor(), showToolTips(), showViewportEditor(), and showViewschemeEditor().

Referenced by checkSnapshots().

SUMOReal GUISUMOAbstractView::getDelay ( ) const

Returns the delay of the parent application.

Returns
delay in milliseconds

Definition at line 1134 of file GUISUMOAbstractView.cpp.

References GUIMainWindow::getDelay(), and myApp.

Referenced by getVisualisationSettings(), and GUIDialog_ViewSettings::onCmdExportSetting().

SUMOReal GUISUMOAbstractView::getGridHeight ( ) const
SUMOReal GUISUMOAbstractView::getGridWidth ( ) const
std::vector< GUIGlID > GUISUMOAbstractView::getObjectsAtPosition ( Position  pos,
SUMOReal  radius 
)
protected
GUIGlID GUISUMOAbstractView::getObjectUnderCursor ( )
protected

returns the id of the object under the cursor using GL_SELECT

Definition at line 255 of file GUISUMOAbstractView.cpp.

References getObjectAtPosition(), and getPositionInformation().

Referenced by doInit(), GUIViewTraffic::getLaneUnderCursor(), GNEViewNet::onLeftBtnPress(), onLeftBtnPress(), openObjectDialog(), and paintGL().

virtual int GUISUMOAbstractView::getTrackedID ( ) const
inlinevirtual
Boundary GUISUMOAbstractView::getVisibleBoundary ( ) const
GUIVisualizationSettings* GUISUMOAbstractView::getVisualisationSettings ( ) const
inline
GUIVisualizationSettings* GUISUMOAbstractView::getVisualisationSettings ( )
inline
bool GUISUMOAbstractView::isInEditMode ( )

returns true, if the edit button was pressed

Definition at line 157 of file GUISUMOAbstractView.cpp.

References myInEditMode.

Referenced by buildViewToolBars().

SUMOReal GUISUMOAbstractView::m2p ( SUMOReal  meter) const
long GUISUMOAbstractView::onConfigure ( FXObject *  ,
FXSelector  ,
void *   
)
virtual
virtual void GUISUMOAbstractView::onGamingClick ( Position  )
inlinevirtual
long GUISUMOAbstractView::onKeyPress ( FXObject *  o,
FXSelector  sel,
void *  data 
)
virtual
long GUISUMOAbstractView::onKeyRelease ( FXObject *  o,
FXSelector  sel,
void *  data 
)
virtual
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
long GUISUMOAbstractView::onMouseLeft ( FXObject *  ,
FXSelector  ,
void *   
)
virtual

Definition at line 672 of file GUISUMOAbstractView.cpp.

Referenced by onMiddleBtnRelease().

long GUISUMOAbstractView::onMouseWheel ( FXObject *  ,
FXSelector  ,
void *  data 
)
virtual
long GUISUMOAbstractView::onPaint ( FXObject *  ,
FXSelector  ,
void *   
)
virtual
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 222 of file GUISUMOAbstractView.h.

References myViewportChooser.

Referenced by GUIDialog_ViewSettings::~GUIDialog_ViewSettings().

void GUISUMOAbstractView::remove ( GUIDialog_ViewSettings )
inline
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 1097 of file GUISUMOAbstractView.cpp.

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

Referenced by onGamingClick(), GUIBaseVehicle::removeActiveAddVisualisation(), and GUIPerson::removeActiveAddVisualisation().

virtual void GUISUMOAbstractView::saveFrame ( const std::string &  destFile,
FXColor *  buf 
)
inlinevirtual

Adds a frame to a video snapshot which will be initialized if neccessary.

Reimplemented in GUIViewTraffic.

Definition at line 185 of file GUISUMOAbstractView.h.

References UNUSED_PARAMETER.

Referenced by makeSnapshot().

void GUISUMOAbstractView::setDelay ( SUMOReal  delay)

Sets the delay of the parent application.

Definition at line 1140 of file GUISUMOAbstractView.cpp.

References myApp, and GUIMainWindow::setDelay().

Referenced by getVisualisationSettings(), and GUIDialog_ViewSettings::loadSettings().

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

References mySnapshots.

Referenced by onMiddleBtnRelease(), and 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 537 of file GUISUMOAbstractView.cpp.

References myMouseHotspotX, myMouseHotspotY, myWindowCursorPositionX, and myWindowCursorPositionY.

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

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

Definition at line 940 of file GUISUMOAbstractView.cpp.

References myUseToolTips, and SUMOReal.

Referenced by getCurrentTimeStep(), and GUIGlChildWindow::onCmdShowToolTips().

virtual void GUISUMOAbstractView::startTrack ( int  )
inlinevirtual
virtual void GUISUMOAbstractView::stopTrack ( )
inlinevirtual
void GUISUMOAbstractView::updateToolTip ( )

Field Documentation

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

Internal information whether doInit() was called.

Definition at line 421 of file GUISUMOAbstractView.h.

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

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

The list of decals to show.

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

Referenced by drawDecals(), and showViewschemeEditor().

SUMORTree* GUISUMOAbstractView::myGrid
protected
bool GUISUMOAbstractView::myInEditMode
protected

Information whether too-tip informations shall be generated.

Definition at line 408 of file GUISUMOAbstractView.h.

Referenced by isInEditMode().

int GUISUMOAbstractView::myMouseHotspotX
protected

Offset to the mouse-hotspot from the mouse position.

Definition at line 411 of file GUISUMOAbstractView.h.

Referenced by setWindowCursorPosition().

int GUISUMOAbstractView::myMouseHotspotY
protected

Definition at line 411 of file GUISUMOAbstractView.h.

Referenced by setWindowCursorPosition().

GUIGlChildWindow* GUISUMOAbstractView::myParent
protected

The parent window.

Definition at line 399 of file GUISUMOAbstractView.h.

Referenced by getColoringSchemesCombo().

MFXMutex GUISUMOAbstractView::myPolyDrawLock
mutableprotected

Definition at line 444 of file GUISUMOAbstractView.h.

GUIGLObjectPopupMenu* GUISUMOAbstractView::myPopup
protected

The current popup-menu.

Definition at line 414 of file GUISUMOAbstractView.h.

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

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

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

Referenced by getPositionInformation(), and setWindowCursorPosition().

FXint GUISUMOAbstractView::myWindowCursorPositionY
protected

Definition at line 426 of file GUISUMOAbstractView.h.

Referenced by getPositionInformation(), and setWindowCursorPosition().


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