Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

_HistoCanvas Class Reference

This GUI element is not for common use in vuMarchingCubes. More...

#include <vuMarchingCubes.h>

Inheritance diagram for _HistoCanvas:

Inheritance graph
[legend]
Collaboration diagram for _HistoCanvas:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 _HistoCanvas ()
 Default constructor.
 _HistoCanvas (vuMCHistogram *parent, wxWindowID id=-1, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize)
virtual ~_HistoCanvas ()
void Reset ()
 Resets the histogram to it's start value.
void Inc (int n, int val)
 Increments the value at position n.
void SetSelColor (wxColour &c)
void Select (int idx)
void DelayedUpdate (bool m)
bool DelayedUpdate ()
void OnPaint (wxPaintEvent &event)
void OnMotion (wxMouseEvent &event)
void OnMouse (wxMouseEvent &event)
 DECLARE_DYNAMIC_CLASS (_HistoCanvas)
 DECLARE_EVENT_TABLE ()

Private Attributes

int _min
 This variable will be set to the lowest index in the map _histo.
int _max
 This variable will be set to the highest index in the map _histo.
int _vmax
 This value holds the biggest value in the map _histo.
float _vpp
 Holds the density in y-direction (values per pixel).
float _ppe
 Holds the density in x-direction (pixel per element).
map< int, int > _histo
 The map holds the histogram values that will be painted.
vuMCHistogram_callback
 We want to inform the parent if, the mouse is over a element in the histogram.
int _updateCounter
 This variable counts GUI updates.
bool _delayedUpdate
 If this value is true, GUI updates take place only when _updateCounter reaches HC_UPDATE_WATERMARK.
int _idx
 The actual index, where the mouse is on. This is updated when the mouse moves.
int _selected
 The selected index.
wxColour _selColor
 The color used to paint the selected index.

Detailed Description

This GUI element is not for common use in vuMarchingCubes.

As a consequence of a bug in wxGTK-2.4 we had to move this class out from vuMCHistogram. This class provides the DC where the histogram is actually drawn. The class also provides functionallity to controll the GUI-update behaviour.

Definition at line 774 of file vuMarchingCubes.h.


Constructor & Destructor Documentation

_HistoCanvas::_HistoCanvas  ) 
 

Default constructor.

Definition at line 743 of file vuMarchingCubes.cpp.

References DEBUGC.

_HistoCanvas::_HistoCanvas vuMCHistogram parent,
wxWindowID  id = -1,
const wxPoint &  pos = wxDefaultPosition,
const wxSize &  size = wxDefaultSize
 

Definition at line 749 of file vuMarchingCubes.cpp.

References DEBUGC, and size.

_HistoCanvas::~_HistoCanvas  )  [virtual]
 

Definition at line 759 of file vuMarchingCubes.cpp.

References DEBUGD.


Member Function Documentation

_HistoCanvas::DECLARE_DYNAMIC_CLASS _HistoCanvas   ) 
 

_HistoCanvas::DECLARE_EVENT_TABLE  ) 
 

bool _HistoCanvas::DelayedUpdate  ) 
 

Definition at line 829 of file vuMarchingCubes.cpp.

References DEBUG0.

void _HistoCanvas::DelayedUpdate bool  m  ) 
 

Definition at line 821 of file vuMarchingCubes.cpp.

References _delayedUpdate, _updateCounter, DEBUG0, and DEBUG3.

Referenced by vuMCHistogram::OnDelayedUpdateChecked().

void _HistoCanvas::Inc int  n,
int  val
 

Increments the value at position n.

Incrementing is a little bit of a problem because we do not know how the map intitializes the elements. So we implement the following algorithm:

  • first of all we can rely on the int variables _max and _min which represent the biggest and the smallest element in the map.
  • At the beginning we initialize this values with -1 so we get to a defined state.
  • The first element int the map that is changed will find _min and _max out of range and set both to the actual index and initialize the value itself to zero.
  • Every change to any of the two variables _min and _max initializes the range from the old value of the respective variable to the new one with zeros.
This ensures, no element in the map is reset to zero by accident.

Definition at line 775 of file vuMarchingCubes.cpp.

References _histo, _max, _min, _updateCounter, _vmax, DEBUG0, and DEBUG2.

Referenced by vuMCHistogram::Inc().

void _HistoCanvas::OnMotion wxMouseEvent &  event  ) 
 

Definition at line 911 of file vuMarchingCubes.cpp.

References _callback, _histo, _idx, _max, _min, _ppe, DEBUG0, DEBUG2, and vuMCHistogram::OnTextChange().

Here is the call graph for this function:

void _HistoCanvas::OnMouse wxMouseEvent &  event  ) 
 

Definition at line 935 of file vuMarchingCubes.cpp.

References _callback, _idx, _selected, DEBUG0, and vuMCHistogram::OnClicked().

Here is the call graph for this function:

void _HistoCanvas::OnPaint wxPaintEvent &  event  ) 
 

This is how we work:

  • First we set the device up for drawing.
  • We clear it.
  • and set the description.
  • If the history is empty, we exit here.
  • Next we calculate the geometry.

  • and than we either draw blocks, if there are less blocks than horizontal pixels, or

  • lines otherwise. In this case we calculate a average over all elements at this pixel.

Definition at line 835 of file vuMarchingCubes.cpp.

References _callback, _histo, _max, _min, _ppe, _selColor, _vpp, dc, DEBUG0, DEBUG2, DEBUG3, and vuMCHistogram::OnTextChange().

Referenced by vuMCHistogram::Flush().

Here is the call graph for this function:

void _HistoCanvas::Reset  ) 
 

Resets the histogram to it's start value.

Definition at line 764 of file vuMarchingCubes.cpp.

References _histo, _max, _min, _updateCounter, _vmax, and DEBUG0.

Referenced by vuMCHistogram::Clear().

void _HistoCanvas::Select int  idx  ) 
 

Definition at line 815 of file vuMarchingCubes.cpp.

References _selected, and DEBUG0.

Referenced by vuMCHistogram::OnClicked(), and vuMCHistogram::Select().

void _HistoCanvas::SetSelColor wxColour &  c  ) 
 

Definition at line 805 of file vuMarchingCubes.cpp.

References _selColor, DEBUG0, and max.

Referenced by vuMCHistogram::SetSelColor().


Member Data Documentation

vuMCHistogram* _HistoCanvas::_callback [private]
 

We want to inform the parent if, the mouse is over a element in the histogram.

Definition at line 801 of file vuMarchingCubes.h.

Referenced by OnMotion(), OnMouse(), and OnPaint().

bool _HistoCanvas::_delayedUpdate [private]
 

If this value is true, GUI updates take place only when _updateCounter reaches HC_UPDATE_WATERMARK.

Definition at line 806 of file vuMarchingCubes.h.

Referenced by DelayedUpdate().

map<int, int> _HistoCanvas::_histo [private]
 

The map holds the histogram values that will be painted.

Definition at line 799 of file vuMarchingCubes.h.

Referenced by Inc(), OnMotion(), OnPaint(), and Reset().

int _HistoCanvas::_idx [private]
 

The actual index, where the mouse is on. This is updated when the mouse moves.

Definition at line 808 of file vuMarchingCubes.h.

Referenced by OnMotion(), and OnMouse().

int _HistoCanvas::_max [private]
 

This variable will be set to the highest index in the map _histo.

See description of Inc for more information.

Definition at line 788 of file vuMarchingCubes.h.

Referenced by Inc(), OnMotion(), OnPaint(), and Reset().

int _HistoCanvas::_min [private]
 

This variable will be set to the lowest index in the map _histo.

See description of Inc for more information.

Definition at line 783 of file vuMarchingCubes.h.

Referenced by Inc(), OnMotion(), OnPaint(), and Reset().

float _HistoCanvas::_ppe [private]
 

Holds the density in x-direction (pixel per element).

Definition at line 797 of file vuMarchingCubes.h.

Referenced by OnMotion(), and OnPaint().

wxColour _HistoCanvas::_selColor [private]
 

The color used to paint the selected index.

Definition at line 812 of file vuMarchingCubes.h.

Referenced by OnPaint(), and SetSelColor().

int _HistoCanvas::_selected [private]
 

The selected index.

Definition at line 810 of file vuMarchingCubes.h.

Referenced by OnMouse(), and Select().

int _HistoCanvas::_updateCounter [private]
 

This variable counts GUI updates.

Definition at line 803 of file vuMarchingCubes.h.

Referenced by DelayedUpdate(), Inc(), and Reset().

int _HistoCanvas::_vmax [private]
 

This value holds the biggest value in the map _histo.

It is needed to speed up the histogram drawing.

Definition at line 793 of file vuMarchingCubes.h.

Referenced by Inc(), and Reset().

float _HistoCanvas::_vpp [private]
 

Holds the density in y-direction (values per pixel).

Definition at line 795 of file vuMarchingCubes.h.

Referenced by OnPaint().


The documentation for this class was generated from the following files:
Generated on Wed Dec 15 21:20:55 2004 for vuVolume by  doxygen 1.3.9.1