VAPoR  3.0.0
Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | List of all members
VAPoR::EventRouter Class Referenceabstract

A pure virtual class specifying the common properties of all the parameter tabs in the VAPOR GUI. More...

#include <eventrouter.h>

Inheritance diagram for VAPoR::EventRouter:
VAPoR::ArrowEventRouter VAPoR::HelloEventRouter VAPoR::IsolineEventRouter

Public Member Functions

 EventRouter ()
 
virtual void hookUpTab ()=0
 
void updateTab ()
 
virtual void confirmText ()
 
void reinitTab (bool doOverride)
 
virtual void updateUrgentTabState ()
 
void SetTextChanged (bool on)
 
virtual void captureMouseUp ()
 
virtual void captureMouseDown (int mouseNum)
 
string getTag ()
 
virtual void updateRenderer (RenderParams *rp, bool wasEnabled, int instance, bool newVis)
 
virtual void cleanParams (Params *rp)
 
virtual void sessionLoadTF (string name)
 
virtual void SetLocal (Params *p, bool lg)
 
virtual void SetEnabled (bool On, int instance)
 
virtual void setEditorDirty (RenderParams *)
 
virtual void updateMapBounds (RenderParams *)
 
void saveTF (RenderParams *rParams)
 
void fileSaveTF (RenderParams *rParams)
 
void loadInstalledTF (RenderParams *rParams, string varname)
 
void loadTF (RenderParams *rParams, string varname)
 
void fileLoadTF (RenderParams *rParams, string varname, const char *startPath, bool savePath)
 
virtual Histo * getHistogram (RenderParams *rParam, bool mustGet, bool isIsoWin=false)
 
virtual void refreshHistogram (RenderParams *rp)
 
void refresh2DHistogram (RenderParams *)
 
void calcSliceHistogram (RenderParams *rp, int ts, Histo *histo)
 
virtual MappingFramegetMappingFrame ()
 
virtual void StartCursorMove ()
 
virtual void EndCursorMove ()
 
virtual void SetDimension (int dim)
 
virtual void variableChanged ()
 
virtual void invalidateRenderer (RenderParams *rParams)
 

Static Public Member Functions

static void SetVizWinMgr (VizWinMgr *vizMgr)
 
static void SetDataMgr (DataMgrV3_0 *dataMgr)
 
static void SetMainForm (MainForm *mainForm)
 
static DataMgrV3_0GetDataMgr ()
 Obtain the current DataMgr. More...
 

Protected Member Functions

virtual void _updateTab (Params *p)=0
 
virtual void _confirmText (Params *p)=0
 
virtual void _reinitTab (bool doOverride)=0
 
vector< QAction * > * makeWebHelpActions (const char *text[], const char *urls[])
 
virtual float calcCurrentValue (RenderParams *p, const double point[3])
 
ParamsGetActiveParams ()
 
ParamsGetActiveParams (string tag)
 
int GetActiveVizIndex ()
 
void ForceRender (bool always=false)
 
VisualizerGetActiveVisualizer ()
 Identify the currently active Visualizer instance. More...
 

Static Protected Member Functions

static EventRouterGetEventRouter (const std::string &tag)
 

Detailed Description

A pure virtual class specifying the common properties of all the parameter tabs in the VAPOR GUI.

Author
Alan Norton
Version
3.0
Date
May 2015 The EventRouter class manages communication between tabs in the GUI, visualizers, and params. Implementers of new tabs in vaporgui must implement an EventRouter class that translates user actions in the tab to changes in the corresponding Params instance, and conversely, populates the tab display based on the most recent state of the params.

EventRouter classes are currently of two types: Those that are associated with RenderParams and those that are not. Those that are associated with RenderParams support having multiple sub-tabs, and are presented in the RenderHolder that displays the parameters of the currently selected renderer. Other EventRouter classes are themselves tabs and have their content defined by a Qt Designer .ui file. Such EventRouter classes are derived from the _UI class that is based on the .ui widget.

Each widget in the tab is connected to slots in the EventRouter by signals emitted by the widget when its state is changed. The connections must be set up in the EventRouter::hookUpTab() method.

In addition to implementing the various pure virtual methods on this class, additional virtual methods must be implemented to support changes in rendering, Transfer Functions, etc., based on the functionality of the tab.

Specifically, each EventRouter subclass implementor must provide the following:

Implement hookUpTab() to connect all signals/slots that are permanent (not data dependent). If some widgets are created dynamically, the appropriate connections must be established at that time.

Implement _updateTab() to set the values of all gui elements based on current Params settings, whenever the tab is exposed.

Implement _reinitTab() to set up the gui whenever the DataMgr is changed.

Implement _confirmText() to read all the text values in the tab and set them in the Params

Implement a slot for each widget in the tab to respond to user changes, except QLineEdits get two slots (as described in EventRouter::hookUpTab()) )

If the tab includes a BoxSliderFrame, implement a slot "changeExtents()" that responds to the signal BoxSliderFrame::extentsChanged() whenever the box extents have been changed by the user. Read BoxSliderFrame documentation for additional instructions.

Call confirmText() in the slots associated with each widget change, so that text changes are updated prior to committing the widget change.

If any data variables are associated with the tab (for RenderParams), include the VariablesWidget as a tab inside this gui tab. Note that the VariablesWidget handles its own signals and slots.

Provide text descriptions and URLs for Web-based help as described under EventRouter::makeWebHelpActions()

If there is a MappingFrame in the tab, invoke EventRouter::loadTF(), EventRouter::fileSaveTF(), EventRouter::loadInstalledTF(), EventRouter::saveTF() to load and save the transfer functions. Refer to MappingFrame documentation for additional instructions.

Various widgets associated with the TransferFunction editor are managed by the MappingFrame as described under MappingFrame::hookup(). These must implement EventRouter::refreshHistogram() to refresh the histogram in the Transfer Function Editor.

If there is a MouseMode (manipulator) associated with the tab, then EventRouter::captureMouseUp() and EventRouter::captureMouseDown() must be implemented.

Definition at line 101 of file eventrouter.h.

Constructor & Destructor Documentation

VAPoR::EventRouter::EventRouter ( )
inline

Definition at line 105 of file eventrouter.h.

Member Function Documentation

virtual void VAPoR::EventRouter::_confirmText ( Params p)
protectedpure virtual

Pure virtual method to respond to changes in text in the tab. This method should be called whenever user presses enter, or changes the state of a widget (other than a textEdit) in the tab. In each implementation, the values of ALL QLineEdit's in the tab must be read and set in the corresponding Params instance.

Parameters
[in]pParams instance associated with the current active tab.

Implemented in VAPoR::HelloEventRouter, and VAPoR::ArrowEventRouter.

virtual void VAPoR::EventRouter::_reinitTab ( bool  doOverride)
protectedpure virtual

Pure virtual method to set up the content in a tab based on a change in the DataMgr. Any widgets that are data-specific, such as variable selectors, must be initialized in this method. If there is a VariablesWidget, VariablesWidget::reinitTab() must be called in this method. The doOverride argument indicates that the user has requested default settings, so than any previous setup can be overridden, reverting to default state.

Implemented in VAPoR::HelloEventRouter, and VAPoR::ArrowEventRouter.

virtual void VAPoR::EventRouter::_updateTab ( Params p)
protectedpure virtual

Pure virtual method to set the values of all the gui elements in the tab based on current Params state. This is invoked whenever the tab is redisplayed and the values in the tab need to be refreshed. If there is a VariablesWidget, _updateTab() must invoke VariablesWidget::updateTab().

Parameters
[in]pParams instance associated with the current active tab.

Implemented in VAPoR::HelloEventRouter, and VAPoR::ArrowEventRouter.

virtual float VAPoR::EventRouter::calcCurrentValue ( RenderParams p,
const double  point[3] 
)
protectedvirtual

Determine the value of the current variable at specified point. Return _OUT_OF_BOUNDS if not in current extents but in full domain

Parameters
[in]RenderParams*p is the params whose variable, fidelity, etc. is used for evaluation
[in]point[3]coordinates of point to evaluate.
Returns
value at point, or _OUT_OF_BOUNDS
void VAPoR::EventRouter::calcSliceHistogram ( RenderParams rp,
int  ts,
Histo *  histo 
)

Helper method, calculate a histogram of a slice of 3d variables, such as Probe or IsoLines

Parameters
[in]rpRenderParams* associated with the histogram
[in]tstime step for the histogram
[out]historesulting Histo instance.
virtual void VAPoR::EventRouter::captureMouseDown ( int  mouseNum)
inlinevirtual

Method for classes that capture mouse event events (i.e. have manipulators) This must be reimplemented to respond appropriately when the mouse is pressed. The mouse press event is received by the VizWin instance, which then calls captureMouseDown() for the EventRouter that is associated with the current mouse mode. This method should forget any previous text changes, since that would confuse the extents calculation.

Parameters
[in]mouseNumis 1,2, or 3 for left, middle, or right mouse.

Reimplemented in VAPoR::IsolineEventRouter, and VAPoR::ArrowEventRouter.

Definition at line 163 of file eventrouter.h.

virtual void VAPoR::EventRouter::captureMouseUp ( )
inlinevirtual

Method for classes that capture mouse event events from the visualizers (i.e. have manipulators) This must be reimplemented to respond when the mouse is released. The mouse release event is received by the VizWin instance, which then calls captureMouseUp() for the EventRouter that is associated with the current mouse mode. Ordinarily this method only needs to redisplay the layout and rerender.

Reimplemented in VAPoR::IsolineEventRouter, and VAPoR::ArrowEventRouter.

Definition at line 154 of file eventrouter.h.

virtual void VAPoR::EventRouter::cleanParams ( Params rp)
inlinevirtual

Virtual method invoked when a renderer/visualizer is deleted To make sure the params cleanly detaches from gui, to handle possible connections from editors, frames, etc. Must be implemented if tab is associated with RenderParams. Default does nothing

Parameters
[in]Paramsassociated with the tab.

Definition at line 185 of file eventrouter.h.

virtual void VAPoR::EventRouter::confirmText ( )
virtual

Method to respond to changes in text in the tab. This method should be called whenever user presses enter, or changes the state of a widget (other than a textEdit) in the tab.

virtual void VAPoR::EventRouter::EndCursorMove ( )
virtual

Virtual method responds to cursor move in image window. Default just updates the window

Reimplemented in VAPoR::IsolineEventRouter.

void VAPoR::EventRouter::fileLoadTF ( RenderParams rParams,
string  varname,
const char *  startPath,
bool  savePath 
)

Launch a dialog to enable user to load a transfer function from file.

Parameters
[in]rParamsRenderParams instance associated with the transfer function
[in]varnamename of the variable associated with the TF.
[in]startPathfile path for the dialog to initially present to user
[in]savePathindicates whether or not the resulting path should be saved to user preferences.
void VAPoR::EventRouter::fileSaveTF ( RenderParams rParams)

Launch a dialog to save the current transfer function to file.

Parameters
[in]rParamsRenderParams instance associated with the transfer function
void VAPoR::EventRouter::ForceRender ( bool  always = false)
inlineprotected

Force a rerender of the scene associated with the current active params, provided the params are enabled.

Parameters
[in]alwaysIf true, force render even if the params are not enabled

Definition at line 384 of file eventrouter.h.

References GetActiveParams().

Params* VAPoR::EventRouter::GetActiveParams ( )
inlineprotected

Provide the current Params instance of the type of this EventRouter

Returns
The current active Params for this type of EventRouter

Definition at line 367 of file eventrouter.h.

References VAPoR::ControlExec::GetActiveParams().

Referenced by ForceRender().

Params* VAPoR::EventRouter::GetActiveParams ( string  tag)
inlineprotected

Provide the current Params instance of specified type of this EventRouter

Parameters
[in]stringParams tag
Returns
The current active Params for this type of EventRouter

Definition at line 373 of file eventrouter.h.

References VAPoR::ControlExec::GetActiveParams().

Visualizer* VAPoR::EventRouter::GetActiveVisualizer ( )
inlineprotected

Identify the currently active Visualizer instance.

Definition at line 390 of file eventrouter.h.

References GetActiveVizIndex(), and VAPoR::ControlExec::GetVisualizer().

int VAPoR::EventRouter::GetActiveVizIndex ( )
inlineprotected

Identify the index of the current active visualizer

Returns
integer index of active Visualizer

Definition at line 379 of file eventrouter.h.

References VAPoR::ControlExec::GetActiveVizIndex().

Referenced by GetActiveVisualizer().

static DataMgrV3_0* VAPoR::EventRouter::GetDataMgr ( )
inlinestatic

Obtain the current DataMgr.

Definition at line 308 of file eventrouter.h.

static EventRouter* VAPoR::EventRouter::GetEventRouter ( const std::string &  tag)
inlinestaticprotected

Static method obtains the EventRouter instance associated with a particular Params tag

Parameters
[in]conststd::string& Tag of the Params
Return values
EventRouter*pointer to the associated EventRouter instance

Definition at line 354 of file eventrouter.h.

References VAPoR::VizWinMgr::getEventRouter().

virtual Histo* VAPoR::EventRouter::getHistogram ( RenderParams rParam,
bool  mustGet,
bool  isIsoWin = false 
)
virtual

Obtain the current valid histogram. Optionally will construct a new one if needed.

Parameters
[in]rParamsis RenderParams instance associated with the transfer function
[in]mustGet: Boolean argument indicating that a new histogram is required.
[in]isIsoWin: Boolean argument indicating this is associated with an IsoSelection panel
Return values
Histo*is resulting Histo instance.
virtual MappingFrame* VAPoR::EventRouter::getMappingFrame ( )
inlinevirtual

Virtual method identifies the MappingFrame associated with an EventRouter. Must be implemented in every EventRouter with a MappingFrame

Return values
MappingFrame*is MappingFrame associated with the EventRouter

Reimplemented in VAPoR::IsolineEventRouter.

Definition at line 270 of file eventrouter.h.

string VAPoR::EventRouter::getTag ( )
inline

Indicate the tag associated with this eventRouter

Returns
string tag

Definition at line 167 of file eventrouter.h.

virtual void VAPoR::EventRouter::hookUpTab ( )
pure virtual

Pure virtual method connects all the Qt signals and slots associated with the tab. Must also include connections that send signals when any QTextEdit box is changed and when enter is pressed. Each QLineEdit has a connection to a setTextChanged and enterPressed slot, to register when the value has changed, and when the user has pressed enter over the lineEdit. If there is a TransferFunction editor or IsoSelection panel in the tab, call MappingFrame::hookup() in this method

Implemented in VAPoR::IsolineEventRouter, VAPoR::HelloEventRouter, and VAPoR::ArrowEventRouter.

virtual void VAPoR::EventRouter::invalidateRenderer ( RenderParams rParams)
inlinevirtual

Invalidate the current renderer, forcing rebuild of the cache. Default does nothing.

Parameters
[in]iParamsRenderParams* that is associated with the renderer.

Definition at line 313 of file eventrouter.h.

void VAPoR::EventRouter::loadInstalledTF ( RenderParams rParams,
string  varname 
)

Launch a dialog to enable user to load an installed transfer function.

Parameters
[in]rParamsRenderParams instance associated with the transfer function
[in]varnamename of the variable associated with the TF.
void VAPoR::EventRouter::loadTF ( RenderParams rParams,
string  varname 
)

Launch a dialog to enable user to load a transfer function from session or file.

Parameters
[in]rParamsRenderParams instance associated with the transfer function
[in]varnamename of the variable associated with the TF.
vector<QAction*>* VAPoR::EventRouter::makeWebHelpActions ( const char *  text[],
const char *  urls[] 
)
protected

To support Web help, implementers must provide a static char* array "_webHelpText" and another static char* array "_webHelpURLs" of URLs. The _webHelpText array must be initialized with one line of descriptive text for each help URL, plus an additional line consisting of the string "<>". The _webHelpURLs array must be initialized to the corresponding URL's (and is shorter by 1 than the _webHelpText array.)

In each EventRouter constructor, set the vector<QAction*> _webHelpActions equal to the result of calling makeWebHelpActions(). Also, in the method EventRouter::updateTab() include the following line: MainForm::getInstance()->buildWebTabHelpMenu(_webHelpActions);

Parameters
[in]textis array of descriptive text, one line for each web help URL, terminated with "<>"
[in]urlsis array of url's, one URL for each web help text.
Return values
vector<QAction*>is resulting vector of QActions that is saved as the value of _webHelpActions.
void VAPoR::EventRouter::refresh2DHistogram ( RenderParams )

Helper method to refresh the histogram for a 2D variable

Parameters
[in]rPRenderParams* associated with the histogram
virtual void VAPoR::EventRouter::refreshHistogram ( RenderParams rp)
inlinevirtual

Virtual method to refresh the histogram for the associated EventRouter. Must be reimplemented in every EventRouter class with a Histogram.

Parameters
[in]rpRenderParams* associated with the histogram.

Definition at line 255 of file eventrouter.h.

void VAPoR::EventRouter::reinitTab ( bool  doOverride)

Method to set up the content in a tab based on a change in the DataMgr. Any widgets that are data-specific, such as variable selectors, must be initialized in this method. This invokes _reinitTab() to perform the widget-specific initializations.

Parameters
[in]doOverrideis true if the values should revert to defaults, overriding current values.
void VAPoR::EventRouter::saveTF ( RenderParams rParams)

Method supporting loading/saving transfer functions in tabs with transfer functions Launch a dialog to save the current transfer function to session or file.

Parameters
[in]rParamsRenderParams instance associated with the transfer function
virtual void VAPoR::EventRouter::sessionLoadTF ( string  name)
inlinevirtual

Virtual method supports loading a transfer function from the session, for tabs that have transfer functions. param[in] name indicates the name identifying the transfer function

Definition at line 190 of file eventrouter.h.

static void VAPoR::EventRouter::SetDataMgr ( DataMgrV3_0 dataMgr)
inlinestatic

Set the current DataMgr. static method must be invoked whenever a new DataMgr is created.

Parameters
[in]DataMgrV3_0*dataMgr

Definition at line 300 of file eventrouter.h.

virtual void VAPoR::EventRouter::SetDimension ( int  dim)
inlinevirtual

Respond to user changing the dimension (2 or 3). Make any gui changes needed beyond updating the variable combos RenderParams will already be updated. Default does nothing.

Parameters
[in]dimis new dimension (2 or 3)

Reimplemented in VAPoR::IsolineEventRouter, and VAPoR::ArrowEventRouter.

Definition at line 285 of file eventrouter.h.

virtual void VAPoR::EventRouter::setEditorDirty ( RenderParams )
virtual

Method to indicate that a transfer function has changed so the tab display must be refreshed. Used in all tabs with RenderParams and that have a transfer function. If Params* argument is null, uses default params. Must be reimplemented if there is more than one MappingFrame in the tab.

Parameters
[in]RenderParams*is the Params that owns the Transfer Function
virtual void VAPoR::EventRouter::SetEnabled ( bool  On,
int  instance 
)
virtual

Method that results in enabling or disabling the renderer. It is invoked whenever the user checks or un-checks the enable checkbox in the instance selector.

Parameters
[in]boolTurns on (true) or off the instance.
[in]intInstance that is being enabled or disabled.
virtual void VAPoR::EventRouter::SetLocal ( Params p,
bool  lg 
)
virtual

Virtual method should be invoked to respond to a change in the local/global setting in the tab Only used with non-render params. Default simply ensures that the active params are based on correct setting of local/global

Parameters
[in]Params*p Current params associated with the tab
[in]boollg is true for local, false for global.
static void VAPoR::EventRouter::SetMainForm ( MainForm *  mainForm)
inlinestatic

Set the MainForm static method stores this unchanging instance in the EventRouter

Parameters
[in]MainForm*mainForm

Definition at line 305 of file eventrouter.h.

void VAPoR::EventRouter::SetTextChanged ( bool  on)
inline

Set the TextChanged flag. The flag should be turned on whenever any textbox (affecting the state of the Params) changes in the tab. The change will not take effect until confirmText() is called. The flag will be turned off when confirmText() or updateTab() is called.

Parameters
[in]boolon : true indicates the flag is set.

Definition at line 147 of file eventrouter.h.

static void VAPoR::EventRouter::SetVizWinMgr ( VizWinMgr vizMgr)
inlinestatic

Specify the VizWinMgr static method stores this unchanging instance in the EventRouter

Parameters
[in]VizWinMgr*vizMgr

Definition at line 295 of file eventrouter.h.

virtual void VAPoR::EventRouter::StartCursorMove ( )
virtual

Virtual method responds to cursor move in image window. Default just updates the window

Reimplemented in VAPoR::IsolineEventRouter.

virtual void VAPoR::EventRouter::updateMapBounds ( RenderParams )
inlinevirtual

Method used to indicate that the mapping bounds have changed, in the transfer function editor, requiring update of the display. Must be reimplemented in every EventRouter which has a transfer function.

Parameters
[in]RenderParams*owner of the Transfer Function

Reimplemented in VAPoR::IsolineEventRouter.

Definition at line 217 of file eventrouter.h.

virtual void VAPoR::EventRouter::updateRenderer ( RenderParams rp,
bool  wasEnabled,
int  instance,
bool  newVis 
)
virtual

Virtual method to enable or disable rendering when turned on or off by a gui tab. Only useful if the tab corresponds to a renderer.

Parameters
[in]rpRenderParams instance to be enabled/disabled
[in]wasEnabledindicates if rendering was previously disabled
[in]instanceindex being enabled
[in]newVisindicates if the rendering is being enabled in a new visualizer.
void VAPoR::EventRouter::updateTab ( )

method to set the values of all the gui elements in the tab based on current Params state. This will do appropriate setup and then invoke the pure virtual method _updateTab(). This is invoked whenever the tab is redisplayed and the values in the tab need to be refreshed. If there is a VariablesWidget, updateTab() must invoke VariablesWidget::updateTab().

virtual void VAPoR::EventRouter::updateUrgentTabState ( )
inlinevirtual

Virtual method to update only tab state that is most urgent after an error message. In particular, do not update any GL widgets in this method. This is to deal with error messages coming from the rendering thread that are trapped by the gui thread. Default does nothing.

Definition at line 141 of file eventrouter.h.

virtual void VAPoR::EventRouter::variableChanged ( )
inlinevirtual

Respond to a variable change Make any gui changes beyond updating the variable combos. Default does nothing

Reimplemented in VAPoR::IsolineEventRouter.

Definition at line 290 of file eventrouter.h.


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