#include <vuTransferCanvas.h>
Inheritance diagram for vuTransferCanvas:
Public Member Functions | |
vuTransferCanvas (vuTFDesign &tf, wxWindow *parent, wxWindowID id=-1, bool edit=false) | |
The constructor for the transfer function canvas. | |
~vuTransferCanvas () | |
The destructor. | |
vuTFDesign & | getTransferFunc () |
Returns the transfer function displayed by the canvas. | |
void | setTransferFunc (const vuTFDesign &tf) |
Sets the transfer function to display on the canvas. | |
const vuTFDesign::OpacityNode * | getActiveOpacity () const |
Returns the active control node, or 0 if there is none. | |
void | setActiveOpacity (const vuTFDesign::OpacityNode *) |
Sets the active control node to the given value. | |
const vuTFDesign::ColourNode * | getActiveColour () const |
Returns the active colour. | |
void | setActiveColour (const vuTFDesign::ColourNode *) |
Sets the active colour node to the given value. | |
void | setSmoothing (float opacity, float colour) |
Sets the smoothing of the transfer function. | |
Protected Member Functions | |
bool | glInit () |
Initializes openGL for the transfer function canvas. | |
void | render () |
Renders the transfer function. | |
void | resize () |
Sets up the coordinates for the canvas. | |
void | OnMouse (wxMouseEvent &ev) |
Handles the mouse commands. | |
void | postEvent (wxEventType ev) |
Helper function that posts the passed in event to the event handler. | |
Protected Attributes | |
vuTFDesign & | m_TFunc |
The transfer function being shown in the Canvas. | |
bool | m_Edit |
Whether the transfer function is editeable or not. | |
float | m_xScreenMin |
The coordinates of the screen. | |
float | m_xScreenMax |
The coordinates of the screen. | |
float | m_yScreenMin |
The coordinates of the screen. | |
float | m_yScreenMax |
The coordinates of the screen. | |
float | m_dx |
Grid widths and heights in graph coordinates. | |
float | m_dy |
Grid widths and heights in graph coordinates. | |
dword | m_Opacity |
The opacity node selected, if any (if none then value is -1). | |
dword | m_Colour |
The colour node selected, if any (if none then value is -1). | |
const dword | m_xMin |
These are the ranges for the graph, ie the scales on the axes. | |
const dword | m_xMax |
const float | m_yMin |
const float | m_yMax |
bool | m_DoSpectral |
Indicates whether spectral colours are to be designed or RGBa. |
This class implements an Open GL viewer for the vuTFDesign transfer function. It can be run in both modes: as strictly a viewer, or as a viewer and editor. The class inherits from the wxWindows gl canvas, and is therefore a full- fledged wxWindows widget. It can be plugged into other windows and panels just like any other widget, or it can be made to fill the whole window.
As a viewer, the class displays the transfer function and has the option of going into editing mode. Displaying is done using a method similar to Riemann integrals: a rectangle is drawn for each intensity, where the height corresponds to the opacity at that intensity. The rectangle is assigned the same colour as the intensity. This method gives good results both for the continuity of the function and the continuity in colour gradients. The viewer can also be taken into editing mode. This is done when the user double clicks on it. This action pops up the vuTransferDialog for editing the function. As a viewer, this class could easily be used for any intensity transfer function, though right now it only accepts vuTFDesign transfer functions.
The class can also be run as an editor for the vuTFDesign transfer function. In this mode, it renders the opacity polyline which defines the transfer function. The control nodes defining the opacity polyline and also the colour regions are also drawn. The user can then click on these control regions to select them, can move them around, and can add and delete them. No user interface widgets are provided for this editing, for this kind of functionality look at vuTransferDialog. However, to help with such editing, the class also generates events corresponding to the user's interaction with the window. These events indicate when control nodes have been selected or opened up, and when the transfer function has been changed.
The editing functionality can only be provided for the vuTFDesign transfer function. This is because every transfer function is defined with different parameters, and the control nodes mean different things. However, this class can be used as a model for other transfer function editors.
Definition at line 47 of file vuTransferCanvas.h.
|
The constructor for the transfer function canvas. The transfer canvas can be used in either edit or display mode (as set by the edit parameter). In edit mode, the control nodes are displayed and are moveable; in display mode, simply the transfer function is showed.
Definition at line 17 of file vuTransferCanvas.cpp. |
|
The destructor.
Definition at line 35 of file vuTransferCanvas.cpp. |
|
Returns the active colour.
Definition at line 102 of file vuTransferCanvas.cpp. References vuTFDesign::getColour(), m_Colour, and m_TFunc. Referenced by vuTransferDialog::OnOpen(), and vuTransferDialog::OnSelect(). |
Here is the call graph for this function:
|
Returns the active control node, or 0 if there is none.
Definition at line 74 of file vuTransferCanvas.cpp. References vuTFDesign::getOpacity(), m_Opacity, and m_TFunc. Referenced by vuTransferDialog::OnSelect(), and vuTFDialogSpec::OnSlideLight(). |
Here is the call graph for this function:
|
Returns the transfer function displayed by the canvas.
Definition at line 43 of file vuTransferCanvas.cpp. Referenced by vuTFDialogSpec::buildCustomSizer(), vuTFDialogSpec::editSpecColour(), vuTransferDialog::getTransferFunc(), vuTFDialogSpec::OnEditPalette(), vuTransferDialog::OnLoadTF(), vuTransferDialog::OnOpen(), vuTransferDialog::OnSaveTF(), vuTFDialogSpec::OnSetupNodes(), vuTFDialogSpec::OnSlideLight(), and vuTFDialogSpec::updateSliders(). |
|
Initializes openGL for the transfer function canvas.
Reimplemented from vuGLCanvas. Definition at line 130 of file vuTransferCanvas.cpp. References GL_MODELVIEW, GL_PROJECTION, glClearColor(), glLoadIdentity(), glMatrixMode(), m_xScreenMax, m_xScreenMin, m_yScreenMax, and m_yScreenMin. |
Here is the call graph for this function:
|
Here is the call graph for this function:
|
Helper function that posts the passed in event to the event handler.
Definition at line 441 of file vuTransferCanvas.cpp. References m_TFunc. Referenced by OnMouse(). |
|
Renders the transfer function.
Reimplemented from vuGLCanvas. Definition at line 176 of file vuTransferCanvas.cpp. References dword, vuTFDesign::getColour(), vuColour< S >::getData(), vuTFDesign::getNumColours(), vuTFDesign::getNumOpacities(), vuTFDesign::getOpacity(), vuTFIntensity::getOpacityAtPos(), vuTFIntensity::getRGBa(), GL_COLOR_BUFFER_BIT, GL_LINE_LOOP, GL_LINE_STRIP, GL_QUADS, glBegin(), glClear(), glColor3f(), glColor3fv(), glColor4f(), glEnd(), glVertex2f(), vuTFDesign::ColourNode::intensity, vuTFDesign::OpacityNode::intensity, m_dx, m_dy, m_TFunc, m_xMax, m_xMin, m_yMax, m_yMin, and vuTFDesign::OpacityNode::opacity. |
Here is the call graph for this function:
|
Sets up the coordinates for the canvas.
Reimplemented from vuGLCanvas. Definition at line 148 of file vuTransferCanvas.cpp. References vuGLCanvas::getHeight(), vuGLCanvas::getWidth(), GL_MODELVIEW, GL_PROJECTION, GLint, glLoadIdentity(), glMatrixMode(), glViewport(), m_dx, m_dy, m_xMax, m_xMin, m_xScreenMax, m_xScreenMin, m_yMax, m_yMin, m_yScreenMax, and m_yScreenMin. |
Here is the call graph for this function:
|
Sets the active colour node to the given value.
Definition at line 114 of file vuTransferCanvas.cpp. References vuTFDesign::addColour(), vuTFDesign::ColourNode::col, vuTFDesign::generateFunction(), vuTFDesign::ColourNode::intensity, m_Colour, m_TFunc, vuGLCanvas::redraw(), and vuTFDesign::removeColour(). Referenced by vuTransferDialog::OnOpen(), and vuTransferDialog::OnUpdate(). |
Here is the call graph for this function:
|
Sets the active control node to the given value.
Definition at line 86 of file vuTransferCanvas.cpp. References vuTFDesign::addOpacity(), vuTFDesign::generateFunction(), vuTFDesign::OpacityNode::intensity, m_Opacity, m_TFunc, vuTFDesign::OpacityNode::opacity, vuGLCanvas::redraw(), and vuTFDesign::removeOpacity(). Referenced by vuTransferDialog::OnUpdate(). |
Here is the call graph for this function:
|
Sets the smoothing of the transfer function.
Definition at line 62 of file vuTransferCanvas.cpp. References vuTFDesign::generateFunction(), m_TFunc, vuGLCanvas::redraw(), vuTFDesign::setColourSmoothing(), and vuTFDesign::setOpacitySmoothing(). Referenced by vuTransferDialog::OnUpdate(). |
Here is the call graph for this function:
|
Sets the transfer function to display on the canvas.
Definition at line 52 of file vuTransferCanvas.cpp. References m_TFunc, and vuGLCanvas::redraw(). |
Here is the call graph for this function:
|
The colour node selected, if any (if none then value is -1).
Definition at line 111 of file vuTransferCanvas.h. Referenced by getActiveColour(), OnMouse(), and setActiveColour(). |
|
Indicates whether spectral colours are to be designed or RGBa.
Definition at line 121 of file vuTransferCanvas.h. |
|
Grid widths and heights in graph coordinates.
Definition at line 106 of file vuTransferCanvas.h. |
|
Grid widths and heights in graph coordinates.
Definition at line 106 of file vuTransferCanvas.h. |
|
Whether the transfer function is editeable or not.
Definition at line 101 of file vuTransferCanvas.h. |
|
The opacity node selected, if any (if none then value is -1).
Definition at line 109 of file vuTransferCanvas.h. Referenced by getActiveOpacity(), OnMouse(), and setActiveOpacity(). |
|
The transfer function being shown in the Canvas.
Definition at line 99 of file vuTransferCanvas.h. Referenced by getActiveColour(), getActiveOpacity(), OnMouse(), postEvent(), render(), setActiveColour(), setActiveOpacity(), setSmoothing(), and setTransferFunc(). |
|
Definition at line 116 of file vuTransferCanvas.h. |
|
These are the ranges for the graph, ie the scales on the axes.
Definition at line 115 of file vuTransferCanvas.h. |
|
The coordinates of the screen.
Definition at line 104 of file vuTransferCanvas.h. |
|
The coordinates of the screen.
Definition at line 104 of file vuTransferCanvas.h. |
|
Definition at line 118 of file vuTransferCanvas.h. |
|
Definition at line 117 of file vuTransferCanvas.h. |
|
The coordinates of the screen.
Definition at line 104 of file vuTransferCanvas.h. |
|
The coordinates of the screen.
Definition at line 104 of file vuTransferCanvas.h. |