#include <flowvis_canvas.h>
Public Types | |
enum | RenderMode_E { FVC_SCREEN, FVC_VALUE_INTER, FVC_ARROW_INTER } |
Available Render Modes. More... | |
Public Member Functions | |
FlowVisCanvas (wxWindow *parent, wxWindowID id=wxID_ANY) | |
Constructor. | |
~FlowVisCanvas () | |
Destructor. | |
void | SetData (std::auto_ptr< FlowVisData > data) |
Set pointer to flow data structure. | |
void | SetBackgroundSet (int set_nr) |
Set the index of the data channel that is used to generate the background image. | |
void | UpdateTransferFunction (TransferFunctionSampler *sampler, int set_to_update) |
Specifies how to map background data values to color and opacity. | |
void | LoadArrowTexture () |
Load the texture used for drawing arrows. | |
void | LoadGlyphTexture () |
Load the texture used for drawing glyphs on streamlines. | |
void | SetArrows (int x, int y) |
Creates an evenly spaced set of arrows on the velocity field. | |
void | Prepare_Streamlines () |
Calculate evenly spaces streamlines for the current velocity field. | |
void | RenderToFile (const wxString &file_name, int width, int height) |
Render an image, according to the current setting, with given width/height and store it in a file. | |
Enable/Disable the available presentation layers | |
void | SetArrowPlot (bool plot_arrows) |
void | SetStreamlinePlot (bool plot_streamlines) |
void | SetBackgroundPlot (bool plot_background) |
Specify the apearance of streamlines | |
void | SetLineColor (wxColour new_color) |
void | SetLineTapering (bool plot_tapering) |
void | SetLineGlyphs (bool plot_glyphs) |
void | SetGlyphDensity (int new_density) |
Specify the parameters used in streamline calculation | |
void | SetDsep (float dsep) |
void | SetDtest (float dtest) |
void | SetIntegType (int integ_index) |
void | SetMaxIter (int maxiter) |
void | SetStepSize (float step_size) |
Public Attributes | |
RenderMode_E | m_mode |
Current rendering mode. | |
Protected Member Functions | |
Event handling | |
void | OnPaint (wxPaintEvent &event) |
Called when a repaint is needed. | |
void | OnSize (wxSizeEvent &event) |
Called when the client area is resized. | |
void | OnEraseBackground (wxEraseEvent &event) |
Called when the background should be redrawn. Does nothing to prevent flickering. | |
Private Types | |
enum | GLStatus { GLS_INIT_PENDING, GLS_INIT_FAILED, GLS_OK } |
Enum used to determine the OpenGL initialisation status. More... | |
Private Member Functions | |
void | Render () |
Does the rendering. | |
bool | InitGL () |
Initialises OpenGL. Returns false on failure. | |
bool | CheckGL () |
Initialises OpenGL if not yet done and returns true on success. | |
void | InitTextures () |
Create and initialize all textures. | |
void | CreateEvenlySpacedArrows () |
Create an evenly spaced grid of data points on the velocity field. | |
Render functions to produce the selected image layers | |
void | Render_Background () |
void | Render_Arrows () |
void | Render_ToScreen () |
void | Render_ValueInter (int set) |
void | Render_ArrowInter () |
void | Render_Streamlines () |
Private Attributes | |
GLStatus | m_glstatus |
Initialisation status. | |
std::auto_ptr< FlowVisData > | m_data |
Data storage containing flow data. | |
std::auto_ptr< FlowVisProgram > | m_program |
Pointer to class providing custom shader support. | |
std::vector< GLuint > | m_tex_background |
Texture holding the background data. | |
std::vector< GLuint > | m_tex_bg_trafu |
Texture used for transfer function mapping. | |
int | m_background_set |
Currently selected data channel for the background image. | |
GLint | m_viewport_width |
Height of the canvas. | |
GLint | m_viewport_height |
Width of the canvas. | |
std::vector< Streamline > | m_streamlines |
bool | m_plot_background |
Collection of all streamlines (in -1 ... +1 mapping). | |
StreamlinePlotSettings | m_sl_settings |
StreamlineAlgSettings | m_sl_algorithm |
float | m_line_base_thickness |
Arrows | m_arrow_data |
Definition at line 145 of file flowvis_canvas.h.
enum FlowVisCanvas::GLStatus [private] |
Enum used to determine the OpenGL initialisation status.
Definition at line 259 of file flowvis_canvas.h.
FlowVisCanvas::FlowVisCanvas | ( | wxWindow * | parent, | |
wxWindowID | id = wxID_ANY | |||
) |
Constructor.
Definition at line 30 of file flowvis_canvas.cpp.
References CheckGL(), LoadArrowTexture(), LoadGlyphTexture(), m_arrow_data, m_program, Arrows::nr_x, Arrows::nr_y, and Arrows::plot.
FlowVisCanvas::~FlowVisCanvas | ( | ) | [inline] |
void FlowVisCanvas::SetData | ( | std::auto_ptr< FlowVisData > | data | ) |
Set pointer to flow data structure.
Definition at line 50 of file flowvis_canvas.cpp.
References InitTextures(), m_background_set, m_data, Prepare_Streamlines(), Render_ValueInter(), and SetArrows().
Referenced by FlowVisFrame::OnOpen().
void FlowVisCanvas::SetBackgroundSet | ( | int | set_nr | ) |
Set the index of the data channel that is used to generate the background image.
Definition at line 469 of file flowvis_canvas.cpp.
References m_background_set.
Referenced by FlowVisFrame::OnBGComboChange().
void FlowVisCanvas::UpdateTransferFunction | ( | TransferFunctionSampler * | sampler, | |
int | set_to_update | |||
) |
Specifies how to map background data values to color and opacity.
Definition at line 517 of file flowvis_canvas.cpp.
References TransferFunctionSampler::Color::a, TransferFunctionSampler::Color::b, TransferFunctionSampler::Color::g, m_tex_bg_trafu, TransferFunctionSampler::MapDensity(), and TransferFunctionSampler::Color::r.
Referenced by FlowVisFrame::OnTraFuChanged().
void FlowVisCanvas::LoadArrowTexture | ( | ) |
Load the texture used for drawing arrows.
std::exception | if an error occurs. |
Definition at line 90 of file flowvis_canvas.cpp.
References Arrows::arrow_texture, and m_arrow_data.
Referenced by FlowVisCanvas().
void FlowVisCanvas::LoadGlyphTexture | ( | ) |
Load the texture used for drawing glyphs on streamlines.
std::exception | if an error occurs. |
Definition at line 122 of file flowvis_canvas.cpp.
References StreamlinePlotSettings::glyph_texture, and m_sl_settings.
Referenced by FlowVisCanvas().
void FlowVisCanvas::SetArrows | ( | int | x, | |
int | y | |||
) |
Creates an evenly spaced set of arrows on the velocity field.
Definition at line 570 of file flowvis_canvas.cpp.
References CreateEvenlySpacedArrows(), m_arrow_data, Arrows::nr_x, and Arrows::nr_y.
Referenced by FlowVisFrame::OnChangeNrArrows(), and SetData().
void FlowVisCanvas::SetArrowPlot | ( | bool | plot_arrows | ) |
Definition at line 578 of file flowvis_canvas.cpp.
References m_arrow_data, and Arrows::plot.
Referenced by FlowVisFrame::OnPlotSettingsChange().
void FlowVisCanvas::SetStreamlinePlot | ( | bool | plot_streamlines | ) |
Definition at line 584 of file flowvis_canvas.cpp.
References m_sl_settings, and StreamlinePlotSettings::plot.
Referenced by FlowVisFrame::TransferSLPlotSettings().
void FlowVisCanvas::SetBackgroundPlot | ( | bool | plot_background | ) |
Definition at line 589 of file flowvis_canvas.cpp.
References m_plot_background.
Referenced by FlowVisFrame::OnPlotSettingsChange().
void FlowVisCanvas::SetLineColor | ( | wxColour | new_color | ) |
Definition at line 608 of file flowvis_canvas.cpp.
References StreamlinePlotSettings::color, and m_sl_settings.
Referenced by FlowVisFrame::TransferSLPlotSettings().
void FlowVisCanvas::SetLineTapering | ( | bool | plot_tapering | ) |
Definition at line 613 of file flowvis_canvas.cpp.
References m_sl_settings, and StreamlinePlotSettings::plot_tapering.
Referenced by FlowVisFrame::TransferSLPlotSettings().
void FlowVisCanvas::SetLineGlyphs | ( | bool | plot_glyphs | ) |
Definition at line 618 of file flowvis_canvas.cpp.
References m_sl_settings, and StreamlinePlotSettings::plot_glyphs.
Referenced by FlowVisFrame::TransferSLPlotSettings().
void FlowVisCanvas::SetGlyphDensity | ( | int | new_density | ) |
Definition at line 623 of file flowvis_canvas.cpp.
References StreamlinePlotSettings::glyph_density, and m_sl_settings.
Referenced by FlowVisFrame::TransferSLPlotSettings().
void FlowVisCanvas::SetDsep | ( | float | dsep | ) |
Definition at line 628 of file flowvis_canvas.cpp.
References StreamlineAlgSettings::dsep, and m_sl_algorithm.
Referenced by FlowVisFrame::TransferCalcSettings().
void FlowVisCanvas::SetDtest | ( | float | dtest | ) |
Definition at line 633 of file flowvis_canvas.cpp.
References StreamlineAlgSettings::dtest, and m_sl_algorithm.
Referenced by FlowVisFrame::TransferCalcSettings().
void FlowVisCanvas::SetIntegType | ( | int | integ_index | ) |
Definition at line 638 of file flowvis_canvas.cpp.
References StreamlineAlgSettings::interploation, ITER_EULER, ITER_RK, and m_sl_algorithm.
Referenced by FlowVisFrame::TransferCalcSettings().
void FlowVisCanvas::SetMaxIter | ( | int | maxiter | ) |
Definition at line 643 of file flowvis_canvas.cpp.
References m_sl_algorithm, and StreamlineAlgSettings::maxiter.
Referenced by FlowVisFrame::TransferCalcSettings().
void FlowVisCanvas::SetStepSize | ( | float | step_size | ) |
Definition at line 648 of file flowvis_canvas.cpp.
References m_sl_algorithm, and StreamlineAlgSettings::stepsize.
Referenced by FlowVisFrame::TransferCalcSettings().
void FlowVisCanvas::Prepare_Streamlines | ( | ) |
Calculate evenly spaces streamlines for the current velocity field.
Definition at line 595 of file flowvis_canvas.cpp.
References StreamlineAlgSettings::dsep, StreamlineAlgSettings::dtest, StreamlineGenerator::GetStreamlines(), StreamlineAlgSettings::interploation, m_data, m_sl_algorithm, m_streamlines, StreamlineAlgSettings::maxiter, and StreamlineAlgSettings::stepsize.
Referenced by FlowVisFrame::OnApplyCalcSettings(), and SetData().
void FlowVisCanvas::RenderToFile | ( | const wxString & | file_name, | |
int | width, | |||
int | height | |||
) |
Render an image, according to the current setting, with given width/height and store it in a file.
Definition at line 653 of file flowvis_canvas.cpp.
References CheckGL(), m_viewport_height, m_viewport_width, and Render_ToScreen().
Referenced by FlowVisFrame::OnSave().
void FlowVisCanvas::OnPaint | ( | wxPaintEvent & | event | ) | [protected] |
Called when a repaint is needed.
Definition at line 65 of file flowvis_canvas.cpp.
References CheckGL(), m_line_base_thickness, m_viewport_height, m_viewport_width, and Render().
void FlowVisCanvas::OnSize | ( | wxSizeEvent & | event | ) | [protected] |
void FlowVisCanvas::OnEraseBackground | ( | wxEraseEvent & | event | ) | [protected] |
Called when the background should be redrawn. Does nothing to prevent flickering.
Definition at line 85 of file flowvis_canvas.cpp.
void FlowVisCanvas::Render | ( | ) | [private] |
Does the rendering.
Definition at line 173 of file flowvis_canvas.cpp.
References AngleR(), m_data, and Render_ToScreen().
Referenced by OnPaint().
void FlowVisCanvas::Render_Background | ( | ) | [private] |
Definition at line 194 of file flowvis_canvas.cpp.
References m_background_set, FlowVisProgram::M_BG_INTER, m_program, m_tex_background, and m_tex_bg_trafu.
Referenced by Render_ToScreen().
void FlowVisCanvas::Render_Arrows | ( | ) | [private] |
Definition at line 315 of file flowvis_canvas.cpp.
References Arrows::arrow_points, Arrows::arrow_texture, ComputeScaleFactors(), length(), m_arrow_data, m_data, m_viewport_height, and m_viewport_width.
Referenced by Render_ToScreen().
void FlowVisCanvas::Render_ToScreen | ( | ) | [private] |
Definition at line 384 of file flowvis_canvas.cpp.
References ComputeScaleFactors(), m_arrow_data, m_data, m_plot_background, m_sl_settings, m_viewport_height, m_viewport_width, Arrows::plot, StreamlinePlotSettings::plot, Render_Arrows(), Render_Background(), and Render_Streamlines().
Referenced by Render(), and RenderToFile().
void FlowVisCanvas::Render_ValueInter | ( | int | set | ) | [private] |
Definition at line 412 of file flowvis_canvas.cpp.
References m_data, and m_tex_background.
Referenced by SetData().
void FlowVisCanvas::Render_ArrowInter | ( | ) | [private] |
void FlowVisCanvas::Render_Streamlines | ( | ) | [private] |
Definition at line 221 of file flowvis_canvas.cpp.
References AngleR(), F_RGB::blue, StreamlinePlotSettings::color, StreamlinePlotSettings::glyph_density, StreamlinePlotSettings::glyph_texture, F_RGB::green, m_data, m_line_base_thickness, m_program, m_sl_settings, m_streamlines, FlowVisProgram::M_TEXTURE_ROTATION, StreamlinePlotSettings::plot_glyphs, StreamlinePlotSettings::plot_tapering, and F_RGB::red.
Referenced by Render_ToScreen().
bool FlowVisCanvas::InitGL | ( | ) | [private] |
Initialises OpenGL. Returns false on failure.
Definition at line 449 of file flowvis_canvas.cpp.
Referenced by CheckGL().
bool FlowVisCanvas::CheckGL | ( | ) | [private] |
Initialises OpenGL if not yet done and returns true on success.
Definition at line 457 of file flowvis_canvas.cpp.
References GLS_INIT_FAILED, GLS_INIT_PENDING, GLS_OK, InitGL(), and m_glstatus.
Referenced by FlowVisCanvas(), OnPaint(), and RenderToFile().
void FlowVisCanvas::InitTextures | ( | ) | [private] |
Create and initialize all textures.
Definition at line 474 of file flowvis_canvas.cpp.
References m_data, m_tex_background, and m_tex_bg_trafu.
Referenced by SetData().
void FlowVisCanvas::CreateEvenlySpacedArrows | ( | ) | [private] |
Create an evenly spaced grid of data points on the velocity field.
Definition at line 541 of file flowvis_canvas.cpp.
References Arrows::arrow_points, m_arrow_data, m_data, Arrows::nr_x, Arrows::nr_y, x, and y.
Referenced by SetArrows().
GLStatus FlowVisCanvas::m_glstatus [private] |
std::auto_ptr<FlowVisData> FlowVisCanvas::m_data [private] |
Data storage containing flow data.
Definition at line 266 of file flowvis_canvas.h.
Referenced by CreateEvenlySpacedArrows(), InitTextures(), Prepare_Streamlines(), Render(), Render_Arrows(), Render_Streamlines(), Render_ToScreen(), Render_ValueInter(), and SetData().
std::auto_ptr<FlowVisProgram> FlowVisCanvas::m_program [private] |
Pointer to class providing custom shader support.
Definition at line 267 of file flowvis_canvas.h.
Referenced by FlowVisCanvas(), Render_Background(), and Render_Streamlines().
std::vector<GLuint> FlowVisCanvas::m_tex_background [private] |
Texture holding the background data.
Definition at line 269 of file flowvis_canvas.h.
Referenced by InitTextures(), Render_Background(), and Render_ValueInter().
std::vector<GLuint> FlowVisCanvas::m_tex_bg_trafu [private] |
Texture used for transfer function mapping.
Definition at line 270 of file flowvis_canvas.h.
Referenced by InitTextures(), Render_Background(), and UpdateTransferFunction().
int FlowVisCanvas::m_background_set [private] |
Currently selected data channel for the background image.
Definition at line 271 of file flowvis_canvas.h.
Referenced by Render_Background(), SetBackgroundSet(), and SetData().
GLint FlowVisCanvas::m_viewport_width [private] |
Height of the canvas.
Definition at line 272 of file flowvis_canvas.h.
Referenced by OnPaint(), Render_Arrows(), Render_ToScreen(), and RenderToFile().
GLint FlowVisCanvas::m_viewport_height [private] |
Width of the canvas.
Definition at line 273 of file flowvis_canvas.h.
Referenced by OnPaint(), Render_Arrows(), Render_ToScreen(), and RenderToFile().
std::vector<Streamline> FlowVisCanvas::m_streamlines [private] |
Definition at line 275 of file flowvis_canvas.h.
Referenced by Prepare_Streamlines(), and Render_Streamlines().
bool FlowVisCanvas::m_plot_background [private] |
Collection of all streamlines (in -1 ... +1 mapping).
Definition at line 276 of file flowvis_canvas.h.
Referenced by Render_ToScreen(), and SetBackgroundPlot().
Definition at line 278 of file flowvis_canvas.h.
Referenced by LoadGlyphTexture(), Render_Streamlines(), Render_ToScreen(), SetGlyphDensity(), SetLineColor(), SetLineGlyphs(), SetLineTapering(), and SetStreamlinePlot().
Definition at line 279 of file flowvis_canvas.h.
Referenced by Prepare_Streamlines(), SetDsep(), SetDtest(), SetIntegType(), SetMaxIter(), and SetStepSize().
float FlowVisCanvas::m_line_base_thickness [private] |
Arrows FlowVisCanvas::m_arrow_data [private] |
Definition at line 283 of file flowvis_canvas.h.
Referenced by CreateEvenlySpacedArrows(), FlowVisCanvas(), LoadArrowTexture(), Render_Arrows(), Render_ToScreen(), SetArrowPlot(), and SetArrows().