Controls drawing of rtVTK image. More...
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 () | |
Trackball & | getTrackball () |
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 |
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.
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.
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. |
References MinimumHeight, MinimumWidth, sgnlRender(), slotRender(), slotTimerEvent(), and timer.
Destroys heap-allocated timer.
References timer.
Trackball& rtVTK::glWidget::getTrackball | ( | ) | [inline] |
References trackball.
Referenced by rtVTK::MainWindow::initializePlugin(), and rtVTK::MainWindow::slotSaveView().
void rtVTK::glWidget::idle | ( | ) |
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.
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.
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.
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] |
void rtVTK::glWidget::render | ( | ) | [protected] |
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.
w_ | : int - new width |
h_ | : int - new height |
References h, plugins, sgnlRender(), sgnlUpdateTitle(), and w.
void rtVTK::glWidget::sgnlMouseInactive | ( | ) | [signal] |
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] |
Referenced by glWidget(), mouseMoveEvent(), mousePressEvent(), resizeGL(), slotResetView(), slotSetBG(), slotSetFOV(), and slotSetView().
void rtVTK::glWidget::sgnlResetRL | ( | ) | [signal] |
Referenced by mousePressEvent().
void rtVTK::glWidget::sgnlUpdateCoords | ( | const Camera & | ) | [signal] |
Referenced by slotRender().
void rtVTK::glWidget::sgnlUpdateTitle | ( | ) | [signal] |
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().
void rtVTK::glWidget::slotResetView | ( | ) | [slot] |
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.
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.
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.
fov | : float - updated value. |
References uiCore::Trackball::setFOV(), sgnlRender(), and trackball.
void rtVTK::glWidget::slotSetIdle | ( | bool | value | ) | [slot] |
void rtVTK::glWidget::slotSetLookMode | ( | uiCore::CameraMode | mode | ) | [slot] |
Sets the lookat mode. This causes the camera to rotate about either the eye or about the lookat point.
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.
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.
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.
view | : const Scene::ViewParameters& - new view information. |
References ioCore::Scene::ViewParameters::eye, ioCore::Scene::ViewParameters::fov, uiCore::Trackball::getMode(), ioCore::Scene::ViewParameters::lookat, sgnlRender(), tbValid, trackball, and ioCore::Scene::ViewParameters::up.
void rtVTK::glWidget::slotTimerEvent | ( | ) | [slot] |
This slot is invoked each time glWidget's timer runs down. It invokes glWidget's idle function.
References idle().
Referenced by glWidget().
void rtVTK::glWidget::slotToggleMouseActive | ( | ) | [slot] |
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().
RGB rtVTK::glWidget::bg [protected] |
Referenced by idle(), paintGL(), and slotSetBG().
Mouse::Button rtVTK::glWidget::button [protected] |
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] |
Referenced by mouseMoveEvent(), mousePressEvent(), mouseReleaseEvent(), and resizeGL().
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] |
Referenced by mouseMoveEvent(), mousePressEvent(), mouseReleaseEvent(), and slotToggleMouseActive().
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] |
Referenced by mouseMoveEvent(), mousePressEvent(), mouseReleaseEvent(), slotSetLookMode(), and slotSetView().
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().
Trackball rtVTK::glWidget::trackball [protected] |
Referenced by getTrackball(), mouseMoveEvent(), mousePressEvent(), mouseReleaseEvent(), slotRender(), slotResetView(), slotSetFOV(), slotSetLookMode(), and slotSetView().
float rtVTK::glWidget::tscale [protected] |
Referenced by mouseMoveEvent(), and slotSetTranslate().
uint rtVTK::glWidget::w [protected] |
Referenced by mouseMoveEvent(), and resizeGL().