#include <trafu_ctrl.h>
Public Member Functions | |
TransferFunctionCtrlCanvas () | |
Empty constructor. | |
TransferFunctionCtrlCanvas (wxWindow *parent, wxWindowID id, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=0) | |
Main constructor. | |
~TransferFunctionCtrlCanvas () | |
Destructor. | |
void | SetTraFuDataPointer (TraFuData *data) |
This function provides the TransferFunctionCtrlCanvas with access to the Transfer Function Data storage. | |
bool | Create (wxWindow *parent, wxWindowID id, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxSUNKEN_BORDER) |
Seperate creation method for 2-step class initialization. | |
wxSize | DoGetBestSize () const |
Function to the wxWidgets-sizer system what's the best size of the canvas. | |
int | GetCanvasHeight () |
Return height of canvas that is exclusively reserved for drawing the transfer function points. | |
int | GetCanvasWidth () |
Return width of canvas that is exclusively reserved for drawing the transfer function points. | |
wxSize | GetCanvasSize () const |
Return size of canvas that is exclusively reserved for drawing the transfer function points. | |
void | SetHistogramData (const HistogramData *histogramdata) |
User provided histogram data for drawing the density histogram. | |
Protected Member Functions | |
Event handlers | |
void | OnPaint (wxPaintEvent &event) |
void | OnMouseEvent (wxMouseEvent &event) |
void | OnSize (wxSizeEvent &event) |
Private Member Functions | |
void | SetMoving (Mapping_point_iterator_t target, bool holding) |
Flag the specified point as currently moving. | |
void | Init () |
Seperate Init method for 2-step class initialization. | |
void | NotifyChange () |
Send notification of a change in the transfer function. | |
void | SetPointPosition (Mapping_point_iterator_t point, const wxPoint &pos) |
Move the representation of the provided point to provided position on the canvas. | |
Mapping_point_iterator_t | GetHitPoint (const wxPoint &pos) |
Return the transfer function point that's representation includes provided canvas position (if any). | |
bool | PointContains (Mapping_point_iterator_t point, const wxPoint &pos) |
Determine if a specified position (on the canvas) is within the representation of the provided point. | |
wxPoint | GetPosition (const Mapping_point_iterator_t &point) |
Return the position of a provided point. | |
void | SetPosition (Mapping_point_iterator_t &point, const wxPoint &new_pos) |
Set the position of a provided point. | |
void | SetColour (Mapping_point_t &point, const wxColor &new_color) |
Set the color of a provided point (in wxWidgets own color structure). | |
wxColor | GetColour (Mapping_point_t &point) |
Return the color of a provided point (in wxWidgets own color structure). | |
void | SetRGB (Mapping_point_iterator_t &point, const tfRGB &colour) |
Set the color of a provided point. | |
tfRGB | GetRGB (Mapping_point_iterator_t &point) |
Return the color of a provided point. | |
float | Density (const wxPoint &pos) |
Returns the density value corresponding with the given position's x coordinate. | |
float | Opacity (const wxPoint &pos) |
Returns the opacity value corresponding with the given position's y coordinate. | |
void | AddNewPoint (const wxPoint &pos) |
Show a color dialog and add a point with the choosen colour at the provided position. | |
void | AddNewPoint (const wxPoint &pos, const wxColour &colour) |
Add a point with the provided colour at the provided position. | |
void | DeletePoint (Mapping_point_iterator_t target) |
Delete the provided point. | |
void | DrawPoints (wxDC *dc) |
Draw all points of the transfer function. | |
void | DrawHist (wxDC *dc) |
Draw the density histogram. | |
void | DrawRange (wxDC *dc) |
Draw the transfer function's color range. | |
Private Attributes | |
int | m_colour_range_height |
Height (in pixel) that is used for drawing the functions color range. | |
int | m_button_radius |
Radius (in pixel) of a transfer function point representation. | |
TraFuData * | m_points |
Pointer to class responsible for managing the transfer function. | |
Mapping_point_iterator_t | m_active_point |
Iterator containing the point that is currently set as moving (if any). | |
const HistogramData * | m_hist_data |
Object holding histogram information of the currently loaded dataset. |
Definition at line 20 of file trafu_ctrl.h.
TransferFunctionCtrlCanvas::TransferFunctionCtrlCanvas | ( | ) | [inline] |
TransferFunctionCtrlCanvas::TransferFunctionCtrlCanvas | ( | wxWindow * | parent, | |
wxWindowID | id, | |||
const wxPoint & | pos = wxDefaultPosition , |
|||
const wxSize & | size = wxDefaultSize , |
|||
long | style = 0 | |||
) | [inline] |
TransferFunctionCtrlCanvas::~TransferFunctionCtrlCanvas | ( | ) | [inline] |
void TransferFunctionCtrlCanvas::AddNewPoint | ( | const wxPoint & | pos, | |
const wxColour & | colour | |||
) | [private] |
Add a point with the provided colour at the provided position.
Definition at line 245 of file trafu_ctrl.cpp.
References TraFuData::Add(), Density(), m_points, NotifyChange(), and Opacity().
void TransferFunctionCtrlCanvas::AddNewPoint | ( | const wxPoint & | pos | ) | [private] |
Show a color dialog and add a point with the choosen colour at the provided position.
Definition at line 232 of file trafu_ctrl.cpp.
References TraFuData::Add(), Density(), m_points, NotifyChange(), Opacity(), and TraFuData::Sort().
Referenced by OnMouseEvent().
bool TransferFunctionCtrlCanvas::Create | ( | wxWindow * | parent, | |
wxWindowID | id, | |||
const wxPoint & | pos = wxDefaultPosition , |
|||
const wxSize & | size = wxDefaultSize , |
|||
long | style = wxSUNKEN_BORDER | |||
) |
Seperate creation method for 2-step class initialization.
Definition at line 20 of file trafu_ctrl.cpp.
Referenced by TransferFunctionCtrlCanvas().
void TransferFunctionCtrlCanvas::DeletePoint | ( | Mapping_point_iterator_t | target | ) | [private] |
Delete the provided point.
Definition at line 221 of file trafu_ctrl.cpp.
References TraFuData::Delete(), m_points, NotifyChange(), and TFP_NONE.
Referenced by OnMouseEvent().
float TransferFunctionCtrlCanvas::Density | ( | const wxPoint & | pos | ) | [inline, private] |
Returns the density value corresponding with the given position's x coordinate.
Definition at line 127 of file trafu_ctrl.h.
References GetCanvasWidth().
Referenced by AddNewPoint(), and SetPosition().
wxSize TransferFunctionCtrlCanvas::DoGetBestSize | ( | ) | const [inline] |
Function to the wxWidgets-sizer system what's the best size of the canvas.
Definition at line 56 of file trafu_ctrl.h.
void TransferFunctionCtrlCanvas::DrawHist | ( | wxDC * | dc | ) | [private] |
Draw the density histogram.
Definition at line 119 of file trafu_ctrl.cpp.
References GetCanvasHeight(), GetCanvasWidth(), m_hist_data, and HistogramData::ResampleData().
Referenced by OnPaint().
void TransferFunctionCtrlCanvas::DrawPoints | ( | wxDC * | dc | ) | [private] |
Draw all points of the transfer function.
Definition at line 100 of file trafu_ctrl.cpp.
References TraFuData::begin(), TraFuData::end(), GetColour(), GetPosition(), and m_points.
Referenced by OnPaint().
void TransferFunctionCtrlCanvas::DrawRange | ( | wxDC * | dc | ) | [private] |
Draw the transfer function's color range.
Definition at line 141 of file trafu_ctrl.cpp.
References TraFuData::createDensityVector(), GetCanvasWidth(), m_colour_range_height, and m_points.
Referenced by OnPaint().
int TransferFunctionCtrlCanvas::GetCanvasHeight | ( | ) | [inline] |
Return height of canvas that is exclusively reserved for drawing the transfer function points.
Definition at line 59 of file trafu_ctrl.h.
References m_colour_range_height.
Referenced by DrawHist(), GetPosition(), OnMouseEvent(), Opacity(), and SetPointPosition().
wxSize TransferFunctionCtrlCanvas::GetCanvasSize | ( | ) | const [inline] |
Return size of canvas that is exclusively reserved for drawing the transfer function points.
Definition at line 65 of file trafu_ctrl.h.
References m_colour_range_height.
int TransferFunctionCtrlCanvas::GetCanvasWidth | ( | ) | [inline] |
Return width of canvas that is exclusively reserved for drawing the transfer function points.
Definition at line 62 of file trafu_ctrl.h.
Referenced by Density(), DrawHist(), DrawRange(), GetPosition(), and SetPointPosition().
wxColor TransferFunctionCtrlCanvas::GetColour | ( | Mapping_point_t & | point | ) | [inline, private] |
Return the color of a provided point (in wxWidgets own color structure).
Definition at line 109 of file trafu_ctrl.h.
References tfRGB::blue, tfRGB::green, Mapping_data::m_colour, and tfRGB::red.
Referenced by DrawPoints().
Mapping_point_iterator_t TransferFunctionCtrlCanvas::GetHitPoint | ( | const wxPoint & | pos | ) | [private] |
Return the transfer function point that's representation includes provided canvas position (if any).
Definition at line 168 of file trafu_ctrl.cpp.
References TraFuData::begin(), TraFuData::end(), m_points, and PointContains().
Referenced by OnMouseEvent().
wxPoint TransferFunctionCtrlCanvas::GetPosition | ( | const Mapping_point_iterator_t & | point | ) | [inline, private] |
Return the position of a provided point.
Definition at line 90 of file trafu_ctrl.h.
References GetCanvasHeight(), and GetCanvasWidth().
Referenced by DrawPoints(), OnPaint(), and PointContains().
tfRGB TransferFunctionCtrlCanvas::GetRGB | ( | Mapping_point_iterator_t & | point | ) | [inline, private] |
void TransferFunctionCtrlCanvas::Init | ( | ) | [private] |
Seperate Init method for 2-step class initialization.
Definition at line 41 of file trafu_ctrl.cpp.
References m_button_radius, m_colour_range_height, and m_points.
Referenced by TransferFunctionCtrlCanvas().
void TransferFunctionCtrlCanvas::NotifyChange | ( | ) | [private] |
Send notification of a change in the transfer function.
Definition at line 284 of file trafu_ctrl.cpp.
Referenced by AddNewPoint(), DeletePoint(), OnMouseEvent(), and SetPointPosition().
void TransferFunctionCtrlCanvas::OnMouseEvent | ( | wxMouseEvent & | event | ) | [protected] |
Definition at line 176 of file trafu_ctrl.cpp.
References AddNewPoint(), DeletePoint(), TraFuData::end(), GetCanvasHeight(), GetHitPoint(), m_active_point, m_points, NotifyChange(), SetColour(), SetMoving(), and SetPointPosition().
void TransferFunctionCtrlCanvas::OnPaint | ( | wxPaintEvent & | event | ) | [protected] |
Definition at line 56 of file trafu_ctrl.cpp.
References TraFuData::begin(), DrawHist(), DrawPoints(), DrawRange(), TraFuData::end(), GetPosition(), m_active_point, m_points, and TraFuData::Sort().
void TransferFunctionCtrlCanvas::OnSize | ( | wxSizeEvent & | event | ) | [protected] |
Definition at line 16 of file trafu_ctrl.cpp.
float TransferFunctionCtrlCanvas::Opacity | ( | const wxPoint & | pos | ) | [inline, private] |
Returns the opacity value corresponding with the given position's y coordinate.
Definition at line 133 of file trafu_ctrl.h.
References GetCanvasHeight().
Referenced by AddNewPoint(), and SetPosition().
bool TransferFunctionCtrlCanvas::PointContains | ( | Mapping_point_iterator_t | point, | |
const wxPoint & | pos | |||
) | [private] |
Determine if a specified position (on the canvas) is within the representation of the provided point.
Definition at line 160 of file trafu_ctrl.cpp.
References GetPosition().
Referenced by GetHitPoint().
void TransferFunctionCtrlCanvas::SetColour | ( | Mapping_point_t & | point, | |
const wxColor & | new_color | |||
) | [inline, private] |
Set the color of a provided point (in wxWidgets own color structure).
Definition at line 103 of file trafu_ctrl.h.
References Mapping_data::m_colour.
Referenced by OnMouseEvent().
void TransferFunctionCtrlCanvas::SetHistogramData | ( | const HistogramData * | histogramdata | ) |
User provided histogram data for drawing the density histogram.
Definition at line 36 of file trafu_ctrl.cpp.
References m_hist_data.
void TransferFunctionCtrlCanvas::SetMoving | ( | Mapping_point_iterator_t | target, | |
bool | holding | |||
) | [private] |
Flag the specified point as currently moving.
Definition at line 252 of file trafu_ctrl.cpp.
References TraFuData::end(), m_active_point, and m_points.
Referenced by OnMouseEvent().
void TransferFunctionCtrlCanvas::SetPointPosition | ( | Mapping_point_iterator_t | point, | |
const wxPoint & | pos | |||
) | [private] |
Move the representation of the provided point to provided position on the canvas.
Definition at line 259 of file trafu_ctrl.cpp.
References GetCanvasHeight(), GetCanvasWidth(), NotifyChange(), SetPosition(), TFP_END, TFP_NONE, and TFP_START.
Referenced by OnMouseEvent().
void TransferFunctionCtrlCanvas::SetPosition | ( | Mapping_point_iterator_t & | point, | |
const wxPoint & | new_pos | |||
) | [inline, private] |
Set the position of a provided point.
Definition at line 96 of file trafu_ctrl.h.
References Density(), and Opacity().
Referenced by SetPointPosition().
void TransferFunctionCtrlCanvas::SetRGB | ( | Mapping_point_iterator_t & | point, | |
const tfRGB & | colour | |||
) | [inline, private] |
void TransferFunctionCtrlCanvas::SetTraFuDataPointer | ( | TraFuData * | data | ) |
This function provides the TransferFunctionCtrlCanvas with access to the Transfer Function Data storage.
Definition at line 50 of file trafu_ctrl.cpp.
References TraFuData::end(), m_active_point, and m_points.
Iterator containing the point that is currently set as moving (if any).
Definition at line 159 of file trafu_ctrl.h.
Referenced by OnMouseEvent(), OnPaint(), SetMoving(), and SetTraFuDataPointer().
int TransferFunctionCtrlCanvas::m_button_radius [private] |
Radius (in pixel) of a transfer function point representation.
Definition at line 157 of file trafu_ctrl.h.
Referenced by Init().
int TransferFunctionCtrlCanvas::m_colour_range_height [private] |
Height (in pixel) that is used for drawing the functions color range.
Definition at line 156 of file trafu_ctrl.h.
Referenced by DrawRange(), GetCanvasHeight(), GetCanvasSize(), and Init().
const HistogramData* TransferFunctionCtrlCanvas::m_hist_data [private] |
Object holding histogram information of the currently loaded dataset.
Definition at line 160 of file trafu_ctrl.h.
Referenced by DrawHist(), and SetHistogramData().
TraFuData* TransferFunctionCtrlCanvas::m_points [private] |
Pointer to class responsible for managing the transfer function.
Definition at line 158 of file trafu_ctrl.h.
Referenced by AddNewPoint(), DeletePoint(), DrawPoints(), DrawRange(), GetHitPoint(), Init(), OnMouseEvent(), OnPaint(), SetMoving(), and SetTraFuDataPointer().