SUMO - Simulation of Urban MObility
GUIParameterTableWindow Class Reference

A window containing a gl-object's parameter. More...

#include <GUIParameterTableWindow.h>

Inheritance diagram for GUIParameterTableWindow:
FXMainWindow

Public Member Functions

void closeBuilding ()
 Closes the building of the table. More...
 
 GUIParameterTableWindow (GUIMainWindow &app, GUIGlObject &o, size_t noRows)
 Constructor. More...
 
void removeObject (GUIGlObject *const o)
 Lets this window know the object shown is being deleted. More...
 
 ~GUIParameterTableWindow ()
 Destructor. More...
 
Row adding functions
void mkItem (const char *name, bool dynamic, ValueSource< unsigned > *src)
 Adds a row which obtains its value from an unsigned-ValueSource. More...
 
void mkItem (const char *name, bool dynamic, ValueSource< int > *src)
 Adds a row which obtains its value from an integer-ValueSource. More...
 
void mkItem (const char *name, bool dynamic, ValueSource< SUMOReal > *src)
 Adds a row which obtains its value from an SUMOReal-ValueSource. More...
 
void mkItem (const char *name, bool dynamic, std::string value)
 Adds a row which shows a string-value. More...
 
void mkItem (const char *name, bool dynamic, unsigned value)
 Adds a row which shows a unsigned-value. More...
 
void mkItem (const char *name, bool dynamic, int value)
 Adds a row which shows a integer-value. More...
 
void mkItem (const char *name, bool dynamic, SUMOReal value)
 Adds a row which shows a SUMOReal-value. More...
 
FOX-callbacks
long onSimStep (FXObject *, FXSelector, void *)
 Updates the table due to a simulation step. More...
 
long onTableSelected (FXObject *, FXSelector, void *)
 Does nothing. More...
 
long onTableDeselected (FXObject *, FXSelector, void *)
 Does nothing. More...
 
long onRightButtonPress (FXObject *, FXSelector, void *)
 Shows a popup. More...
 

Protected Member Functions

 GUIParameterTableWindow ()
 FOX needs this. More...
 
void updateTable ()
 Updates the table. More...
 

Private Attributes

GUIMainWindowmyApplication
 The main application window. More...
 
unsigned myCurrentPos
 The index of the next row to add - used while building. More...
 
std::vector< GUIParameterTableItemInterface * > myItems
 The list of table rows. More...
 
MFXMutex myLock
 A lock assuring save updates in cse of object deletion. More...
 
GUIGlObjectmyObject
 The object to get the information from. More...
 
FXTablemyTable
 The table to display the information in. More...
 

Detailed Description

A window containing a gl-object's parameter.

This class realises a view on some parameter of a gl-object. The gl-object itself is responsible for filling this table.

After allocating such a table, the object should fill the rows by calling one of the mkItem-methods for each. The building is closed using closeBuilding what forces the table to be displayed.

Each row is represented using an instance of GUIParameterTableItemInterface.

Definition at line 67 of file GUIParameterTableWindow.h.

Constructor & Destructor Documentation

GUIParameterTableWindow::GUIParameterTableWindow ( GUIMainWindow app,
GUIGlObject o,
size_t  noRows 
)

Constructor.

Parameters
[in]appThe application this window belongs to
[in]oThe gl-object this table describes
[in]noRowsNumber of rows to allocate

Definition at line 66 of file GUIParameterTableWindow.cpp.

References GUIIconSubSys::getIcon(), ICON_APP_TABLE, and MID_TABLE.

GUIParameterTableWindow::~GUIParameterTableWindow ( )
GUIParameterTableWindow::GUIParameterTableWindow ( )
inlineprotected

FOX needs this.

Definition at line 236 of file GUIParameterTableWindow.h.

Member Function Documentation

void GUIParameterTableWindow::mkItem ( const char *  name,
bool  dynamic,
ValueSource< int > *  src 
)

Adds a row which obtains its value from an integer-ValueSource.

Parameters
[in]nameThe name of the row entry
[in]dynamicInformation whether the entry is dynamic
[in]srcThe value source to use

Definition at line 172 of file GUIParameterTableWindow.cpp.

References myCurrentPos, myItems, and myTable.

void GUIParameterTableWindow::mkItem ( const char *  name,
bool  dynamic,
ValueSource< SUMOReal > *  src 
)

Adds a row which obtains its value from an SUMOReal-ValueSource.

Parameters
[in]nameThe name of the row entry
[in]dynamicInformation whether the entry is dynamic
[in]srcThe value source to use

Definition at line 180 of file GUIParameterTableWindow.cpp.

References myCurrentPos, myItems, and myTable.

void GUIParameterTableWindow::mkItem ( const char *  name,
bool  dynamic,
std::string  value 
)

Adds a row which shows a string-value.

Parameters
[in]nameThe name of the row entry
[in]dynamicInformation whether the entry is dynamic
[in]valueThe value to show
Todo:
the dynamic-parameter is obsolete(?)

Definition at line 188 of file GUIParameterTableWindow.cpp.

References myCurrentPos, myItems, and myTable.

void GUIParameterTableWindow::mkItem ( const char *  name,
bool  dynamic,
unsigned  value 
)

Adds a row which shows a unsigned-value.

Parameters
[in]nameThe name of the row entry
[in]dynamicInformation whether the entry is dynamic
[in]valueThe value to show
Todo:
the dynamic-parameter is obsolete

Definition at line 205 of file GUIParameterTableWindow.cpp.

References myCurrentPos, myItems, and myTable.

void GUIParameterTableWindow::mkItem ( const char *  name,
bool  dynamic,
int  value 
)

Adds a row which shows a integer-value.

Parameters
[in]nameThe name of the row entry
[in]dynamicInformation whether the entry is dynamic
[in]valueThe value to show
Todo:
the dynamic-parameter is obsolete

Definition at line 213 of file GUIParameterTableWindow.cpp.

References myCurrentPos, myItems, and myTable.

void GUIParameterTableWindow::mkItem ( const char *  name,
bool  dynamic,
SUMOReal  value 
)

Adds a row which shows a SUMOReal-value.

Parameters
[in]nameThe name of the row entry
[in]dynamicInformation whether the entry is dynamic
[in]valueThe value to show
Todo:
the dynamic-parameter is obsolete

Definition at line 197 of file GUIParameterTableWindow.cpp.

References myCurrentPos, myItems, and myTable.

long GUIParameterTableWindow::onRightButtonPress ( FXObject sender,
FXSelector  sel,
void *  data 
)

Shows a popup.

Callback for right-mouse-button pressing event. Obtains the selected row and determines whether it is dynamic. If so, a popup-menu which allows to open a tracker for this value is built and shown.

See also
GUIParameterTableItemInterface
GUIParam_PopupMenuInterface

Definition at line 136 of file GUIParameterTableWindow.cpp.

References GUIParameterTableItemInterface::dynamic(), GUIParameterTableItemInterface::getName(), GUIParameterTableItemInterface::getSUMORealSourceCopy(), MID_OPENTRACKER, myApplication, myItems, myObject, and myTable.

long GUIParameterTableWindow::onSimStep ( FXObject ,
FXSelector  ,
void *   
)

Updates the table due to a simulation step.

Definition at line 116 of file GUIParameterTableWindow.cpp.

References updateTable().

long GUIParameterTableWindow::onTableDeselected ( FXObject ,
FXSelector  ,
void *   
)

Does nothing.

Todo:
Recheck whether this is needed (to override FXTable-behaviour?)

Definition at line 130 of file GUIParameterTableWindow.cpp.

long GUIParameterTableWindow::onTableSelected ( FXObject ,
FXSelector  ,
void *   
)

Does nothing.

Todo:
Recheck whether this is needed (to override FXTable-behaviour?)

Definition at line 124 of file GUIParameterTableWindow.cpp.

void GUIParameterTableWindow::removeObject ( GUIGlObject *const  o)

Lets this window know the object shown is being deleted.

Parameters
[in]oThe deleted (shown) object

Definition at line 109 of file GUIParameterTableWindow.cpp.

References myLock, and myObject.

void GUIParameterTableWindow::updateTable ( )
protected

Updates the table.

Goes through all entries and updates them using GUIParameterTableItemInterface::update.

See also
GUIParameterTableItemInterface::update

Definition at line 221 of file GUIParameterTableWindow.cpp.

References myItems, myLock, and myObject.

Referenced by onSimStep().

Field Documentation

GUIMainWindow* GUIParameterTableWindow::myApplication
private

The main application window.

Definition at line 223 of file GUIParameterTableWindow.h.

Referenced by closeBuilding(), onRightButtonPress(), and ~GUIParameterTableWindow().

unsigned GUIParameterTableWindow::myCurrentPos
private

The index of the next row to add - used while building.

Definition at line 229 of file GUIParameterTableWindow.h.

Referenced by mkItem().

std::vector<GUIParameterTableItemInterface*> GUIParameterTableWindow::myItems
private

The list of table rows.

Definition at line 226 of file GUIParameterTableWindow.h.

Referenced by mkItem(), onRightButtonPress(), updateTable(), and ~GUIParameterTableWindow().

MFXMutex GUIParameterTableWindow::myLock
mutableprivate

A lock assuring save updates in cse of object deletion.

Definition at line 232 of file GUIParameterTableWindow.h.

Referenced by removeObject(), updateTable(), and ~GUIParameterTableWindow().

GUIGlObject* GUIParameterTableWindow::myObject
private

The object to get the information from.

Definition at line 217 of file GUIParameterTableWindow.h.

Referenced by onRightButtonPress(), removeObject(), updateTable(), and ~GUIParameterTableWindow().

FXTable* GUIParameterTableWindow::myTable
private

The table to display the information in.

Definition at line 220 of file GUIParameterTableWindow.h.

Referenced by mkItem(), and onRightButtonPress().


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