rtVTK  0.6.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends
Public Slots | Signals | Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes
rtVTK::glWidget Class Reference

Controls drawing of rtVTK image. More...

List of all members.

Public Slots

void slotSetView (const Scene::ViewParameters &)
void slotSetLookMode (uiCore::CameraMode)
void slotSetRotate (float)
void slotSetTranslate (float)
void slotSetDolly (float)
void slotSetFOV (float)
void slotResetView ()
void slotSetBG (float, float, float)
void slotRender ()
void slotTimerEvent ()
void slotSetIdle (bool)
void slotToggleMouseActive ()

Signals

void sgnlUpdateCoords (const Camera &)
void sgnlUpdateTitle ()
void sgnlRender ()
void sgnlResetRL ()
Mouse Signals

Signals to be caught by relevant plugins.

void sgnlMousePressEvent (QMouseEvent *)
void sgnlMouseMoveEvent (QMouseEvent *)
void sgnlMouseReleaseEvent (QMouseEvent *)
void sgnlMouseInactive ()

Public Member Functions

 glWidget (const vector< Plugin * > &, const RGB &=RGB::One)
 ~glWidget ()
TrackballgetTrackball ()
void idle ()

Static Public Attributes

static const uint MinimumWidth = 128
static const uint MinimumHeight = 128

Protected Member Functions

void initializeGL ()
void resizeGL (int, int)
void paintGL ()
void render ()
Mouse Event Functions
void mousePressEvent (QMouseEvent *)
void mouseMoveEvent (QMouseEvent *)
void mouseReleaseEvent (QMouseEvent *)

Protected Attributes

bool refresh
RGB bg
Trackball trackball
bool tbValid
float rscale
float tscale
float dscale
const vector< Plugin * > & plugins
QTimer * timer
bool mouseActive
Mouse::Button button
Internal Width and Height
uint w
uint h

Detailed Description

Controls drawing of rtVTK image.

glWidget is responsible for calling the various interface functions of the plugins in MainWindow's active pipeline at a given point in time. In particular, glWidget is responsible for calling the render and idle functions and updating the image being displayed in MainWindow's renderWindow.


Constructor & Destructor Documentation

rtVTK::glWidget::glWidget ( const vector< Plugin * > &  plugins_,
const RGB &  bg_ = RGB::One 
)

Initializes members of glWidget. Binds plugins member to a pipeline provided as an argument. Sets up glWidget's minimum dimensions. Creates and starts a timer for use in calling idle() when idling is enabled.

Parameters:
plugins_:const vector<Plugin*>& - a reference to MainWindow's pipeline. Once bound to glWidget's plugins member, any changes in the pipeline will be reflected in glWidget, since plugins is merely a reference.
bg_:const RGB& = RGB::One - starting background color.
Bug:
XXX(cpg) - good values?

References MinimumHeight, MinimumWidth, sgnlRender(), slotRender(), slotTimerEvent(), and timer.

Destroys heap-allocated timer.

References timer.


Member Function Documentation

Iterates over all active plugins, calling their idle() functions. Note that refresh is set to false, to avoid re-rendering the image from scratch; instead glDraw() is invoked, which causes the image, possibly updated by the plugins' idle functions, to be displayed.

References bg, plugins, and refresh.

Referenced by slotTimerEvent().

void rtVTK::glWidget::initializeGL ( ) [protected]

Iterates over all active plugins, calling their init() functions.

References plugins.

void rtVTK::glWidget::mouseMoveEvent ( QMouseEvent *  event) [protected]

This function listens for input from the mouse. If mouseActive is true, information about the mouse event is passed to trackball; otherwise, the mouse event will not affect glWidget.
Emits sgnlMouseMoveEvent.
Emits sgnlRender.

Parameters:
event: QMouseEvent*

References dscale, h, mouseActive, uiCore::Trackball::mouseMove(), plugins, rscale, sgnlMouseMoveEvent(), sgnlRender(), tbValid, trackball, tscale, and w.

void rtVTK::glWidget::mousePressEvent ( QMouseEvent *  event) [protected]

This function listens for a mouse click. If mouseActive is true, information about the mouse event is passed to trackball; otherwise, the mouse event will not affect trackball.
If the Ctrl key is being held when the mouse click occurs, then the TraceRay functions of the currently active plugins are invoked (note that this iterating will terminate after the first function to return true).
Emits sgnlMousePressEvent.

Parameters:
event: QMouseEvent*

References button, h, uiCore::Mouse::Left, uiCore::Mouse::Mid, mouseActive, uiCore::Trackball::mouseClick(), uiCore::Mouse::None, plugins, uiCore::Mouse::Right, sgnlMousePressEvent(), sgnlRender(), sgnlResetRL(), tbValid, and trackball.

void rtVTK::glWidget::mouseReleaseEvent ( QMouseEvent *  event) [protected]

This function listens for input from the mouse. If mouseActive is true, information about the mouse event is passed to trackball; otherwise, the mouse event will not affect glWidget.
Emits sgnlMousReleaseEvent.

Parameters:
event: QMouseEvent*

References button, h, uiCore::Mouse::Left, uiCore::Mouse::Mid, mouseActive, uiCore::Trackball::mouseClick(), uiCore::Mouse::None, plugins, uiCore::Mouse::Right, sgnlMouseReleaseEvent(), tbValid, and trackball.

void rtVTK::glWidget::paintGL ( ) [protected]

Iterates over all active plugins, calling their render() functions, if a refresh is necessary.

References bg, plugins, and refresh.

void rtVTK::glWidget::render ( ) [protected]
Todo:
NOTE(cpg) - should this be private?
void rtVTK::glWidget::resizeGL ( int  w_,
int  h_ 
) [protected]

This function is called when the glWidget is resized. It iterates over all active plugins, calling their resize functions.
Emits sgnlRender.

Parameters:
w_: int - new width
h_: int - new height

References h, plugins, sgnlRender(), sgnlUpdateTitle(), and w.

Referenced by slotToggleMouseActive().

void rtVTK::glWidget::sgnlMouseMoveEvent ( QMouseEvent *  ) [signal]

Referenced by mouseMoveEvent().

void rtVTK::glWidget::sgnlMousePressEvent ( QMouseEvent *  ) [signal]

Referenced by mousePressEvent().

void rtVTK::glWidget::sgnlMouseReleaseEvent ( QMouseEvent *  ) [signal]

Referenced by mouseReleaseEvent().

void rtVTK::glWidget::sgnlRender ( ) [signal]
void rtVTK::glWidget::sgnlResetRL ( ) [signal]

Referenced by mousePressEvent().

void rtVTK::glWidget::sgnlUpdateCoords ( const Camera ) [signal]

Referenced by slotRender().

Referenced by resizeGL().

void rtVTK::glWidget::slotRender ( ) [slot]

Emits sgnlUpdateCoords and indicates an image refresh is necessary. This slot may be connected to signals from other classes that are interested in causing glWidget to re-render the image.

References uiCore::Trackball::getCam(), refresh, sgnlUpdateCoords(), and trackball.

Referenced by glWidget().

Resets camera to the view provided by the most recently loaded view or scene.

References uiCore::Trackball::reset(), sgnlRender(), and trackball.

void rtVTK::glWidget::slotSetBG ( float  r,
float  g,
float  b 
) [slot]

Sets the background color of glWidget.
Emits sgnlRender.

Parameters:
r: float - red component of new background color.
g: float - green component of new background color.
b: float - blue component of new background color.

References bg, and sgnlRender().

void rtVTK::glWidget::slotSetDolly ( float  dscale_) [slot]

Sets rscale based on transformation of dolly speed slide value provided by MainWindow.

Parameters:
dscale_: float - updated value.

References dscale.

void rtVTK::glWidget::slotSetFOV ( float  fov) [slot]

Sets trackball's FOV based on transformation of FOV slider value provided by MainWindow.

Parameters:
fov: float - updated value.

References uiCore::Trackball::setFOV(), sgnlRender(), and trackball.

void rtVTK::glWidget::slotSetIdle ( bool  value) [slot]

Toggles glWidget's timer on and off.

Parameters:
value:bool - If true, timer starts. timer stops otherwise.

References timer.

Sets the lookat mode. This causes the camera to rotate about either the eye or about the lookat point.

Parameters:
mode: uiCore::CameraMode - new mode.

References uiCore::Trackball::setLookMode(), tbValid, and trackball.

void rtVTK::glWidget::slotSetRotate ( float  rscale_) [slot]

Sets rscale based on transformation of rotation speed slider value provided by MainWindow.

Parameters:
rscale_: float - updated value.

References rscale.

void rtVTK::glWidget::slotSetTranslate ( float  tscale_) [slot]

Sets rscale based on transformation of translation speed slider value provided by MainWindow.

Parameters:
tscale_: float - updated value.

References tscale.

void rtVTK::glWidget::slotSetView ( const Scene::ViewParameters view) [slot]

Sets trackball's camera based on information from a given view.

Parameters:
view: const Scene::ViewParameters& - new view information.
Todo:
TODO(cpg) - need to deal with "lens" specifications from the view file correctly, but just punt for now...
Bug:
XXX(cpg) - don't like the ctor + assignment here...

References ioCore::Scene::ViewParameters::eye, ioCore::Scene::ViewParameters::fov, uiCore::Trackball::getMode(), ioCore::Scene::ViewParameters::lookat, sgnlRender(), tbValid, trackball, and ioCore::Scene::ViewParameters::up.

This slot is invoked each time glWidget's timer runs down. It invokes glWidget's idle function.

References idle().

Referenced by glWidget().

Toggles the mouseActive flag. If mouseActive is set to false, emits sgnlMouseInactive. This signal is of interest to plugins that want to use mouse movement information for reasons besides positioning the camera.

References mouseActive, and sgnlMouseInactive().


Member Data Documentation

RGB rtVTK::glWidget::bg [protected]

Referenced by idle(), paintGL(), and slotSetBG().

Used for storing the enum of the button that was first pushed down. Before the first button is released, if other buttons are pushed down after the first button they are to be ignored by the mousePushedEvent. This behavior is implemented in the glWidget::mousePushedEvent(QMouseEvent*).

Referenced by mousePressEvent(), and mouseReleaseEvent().

float rtVTK::glWidget::dscale [protected]

Referenced by mouseMoveEvent(), and slotSetDolly().

uint rtVTK::glWidget::h [protected]
const uint rtVTK::glWidget::MinimumHeight = 128 [static]

Referenced by glWidget().

const uint rtVTK::glWidget::MinimumWidth = 128 [static]

Referenced by glWidget().

bool rtVTK::glWidget::mouseActive [protected]
const vector<Plugin*>& rtVTK::glWidget::plugins [protected]

A reference to the current pipeline of plugins, which is maintained by MainWindow. Various glWidget functions iterate over this vector, invoking relevant plugin functions.

Referenced by idle(), initializeGL(), mouseMoveEvent(), mousePressEvent(), mouseReleaseEvent(), paintGL(), and resizeGL().

bool rtVTK::glWidget::refresh [protected]

Referenced by idle(), paintGL(), and slotRender().

float rtVTK::glWidget::rscale [protected]

Referenced by mouseMoveEvent(), and slotSetRotate().

bool rtVTK::glWidget::tbValid [protected]
QTimer* rtVTK::glWidget::timer [protected]

For events that run on a timer, such as calling plugins' idle functions when idling is enabled.

Referenced by glWidget(), slotSetIdle(), and ~glWidget().

float rtVTK::glWidget::tscale [protected]

Referenced by mouseMoveEvent(), and slotSetTranslate().

uint rtVTK::glWidget::w [protected]

Referenced by mouseMoveEvent(), and resizeGL().


The documentation for this class was generated from the following files:
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends