Helper class to step through a list. More...
#include <mitkStepper.h>
Public Member Functions | |
mitkClassMacro (Stepper, itk::Object) | |
virtual unsigned int | GetPos () |
virtual void | SetPos (unsigned int pos) |
virtual unsigned int | GetSteps () |
virtual void | SetSteps (unsigned int _arg) |
virtual bool | GetAutoRepeat () |
virtual void | SetAutoRepeat (bool _arg) |
virtual void | AutoRepeatOn () |
virtual void | AutoRepeatOff () |
virtual void | SetPingPong (bool _arg) |
virtual bool | GetPingPong () |
virtual void | PingPongOn () |
virtual void | PingPongOff () |
virtual void | SetInverseDirection (bool _arg) |
virtual bool | GetInverseDirection () |
virtual void | InverseDirectionOn () |
virtual void | InverseDirectionOff () |
void | SetRange (ScalarType min, ScalarType max) |
void | InvalidateRange () |
ScalarType | GetRangeMin () const |
ScalarType | GetRangeMax () const |
bool | HasValidRange () const |
void | RemoveRange () |
bool | HasRange () const |
void | SetUnitName (const char *unitName) |
const char * | GetUnitName () const |
void | RemoveUnitName () |
bool | HasUnitName () const |
virtual void | Next () |
virtual void | Previous () |
virtual void | First () |
virtual void | Last () |
Static Public Member Functions | |
static Pointer | New () |
Protected Member Functions | |
Stepper () | |
virtual | ~Stepper () |
void | Increase () |
void | Decrease () |
Protected Attributes | |
unsigned int | m_Pos |
unsigned int | m_Steps |
bool | m_AutoRepeat |
bool | m_PingPong |
bool | m_InverseDirection |
ScalarType | m_RangeMin |
ScalarType | m_RangeMax |
bool | m_RangeValid |
bool | m_HasRange |
std::string | m_UnitName |
bool | m_HasUnitName |
Helper class to step through a list.
A helper class to step through a list. Does not contain the list, just the position in the list (between 0 and GetSteps()). Provides methods like First (go to the first element), Next (go to the next one), etc.
Besides the actual number of steps, the stepper can also hold a stepping range, indicating the scalar values corresponding to the covered steps. For example, steppers are generally used to slice a dataset with a plane; Hereby, Steps indicates the total number of steps (positions) available for the plane, Pos indicates the current step, and Range indicates the physical minimum and maximum values for the plane, in this case a value in mm.
The range can also be supplied with a unit name (a string) which can be used by classes providing information about the stepping (e.g. graphical sliders).
Definition at line 52 of file mitkStepper.h.
mitk::Stepper::Stepper | ( | ) | [protected] |
Definition at line 22 of file mitkStepper.cpp.
: m_Pos( 0 ), m_Steps( 0 ), m_AutoRepeat( false ), m_PingPong( false ), m_InverseDirection( false ), m_RangeMin( 0.0 ), m_RangeMax( -1.0 ), m_RangeValid( false ), m_HasRange( false ), m_HasUnitName( false ) { }
mitk::Stepper::~Stepper | ( | ) | [protected, virtual] |
Definition at line 37 of file mitkStepper.cpp.
{ }
virtual void mitk::Stepper::AutoRepeatOff | ( | ) | [virtual] |
virtual void mitk::Stepper::AutoRepeatOn | ( | ) | [virtual] |
void mitk::Stepper::Decrease | ( | ) | [protected] |
Definition at line 155 of file mitkStepper.cpp.
{ if (this->GetPos() > 0) { this->SetPos(this->GetPos() - 1); } else if (m_AutoRepeat) { if (!m_PingPong) { this->SetPos(this->GetSteps() - 1); } else { m_InverseDirection = false; if (this->GetPos() < this->GetSteps() - 1) { this->SetPos(this->GetPos() + 1); } } } }
void mitk::Stepper::First | ( | ) | [virtual] |
Definition at line 208 of file mitkStepper.cpp.
Referenced by QmitkMovieMaker::StopPlaying().
{ this->SetPos(0); }
virtual bool mitk::Stepper::GetAutoRepeat | ( | ) | [virtual] |
virtual bool mitk::Stepper::GetInverseDirection | ( | ) | [virtual] |
virtual bool mitk::Stepper::GetPingPong | ( | ) | [virtual] |
virtual unsigned int mitk::Stepper::GetPos | ( | ) | [virtual] |
mitk::ScalarType mitk::Stepper::GetRangeMax | ( | ) | const |
Definition at line 70 of file mitkStepper.cpp.
{ return m_RangeMax; }
mitk::ScalarType mitk::Stepper::GetRangeMin | ( | ) | const |
Definition at line 63 of file mitkStepper.cpp.
{ return m_RangeMin; }
virtual unsigned int mitk::Stepper::GetSteps | ( | ) | [virtual] |
const char * mitk::Stepper::GetUnitName | ( | ) | const |
Definition at line 108 of file mitkStepper.cpp.
{ return m_UnitName.c_str(); }
bool mitk::Stepper::HasRange | ( | ) | const |
Definition at line 92 of file mitkStepper.cpp.
{ return m_HasRange; }
bool mitk::Stepper::HasUnitName | ( | ) | const |
Definition at line 123 of file mitkStepper.cpp.
{ return m_HasUnitName; }
bool mitk::Stepper::HasValidRange | ( | ) | const |
Definition at line 85 of file mitkStepper.cpp.
{ return (m_HasRange && m_RangeValid); }
void mitk::Stepper::Increase | ( | ) | [protected] |
Definition at line 130 of file mitkStepper.cpp.
{ if (this->GetPos() < this->GetSteps() - 1) { this->SetPos(this->GetPos() + 1); } else if (m_AutoRepeat) { if (!m_PingPong) { this->SetPos(0); } else { m_InverseDirection = true; if (this->GetPos() > 0) { this->SetPos(this->GetPos() - 1); } } } }
void mitk::Stepper::InvalidateRange | ( | ) |
Definition at line 54 of file mitkStepper.cpp.
{ m_HasRange = true; m_RangeValid = false; this->Modified(); }
virtual void mitk::Stepper::InverseDirectionOff | ( | ) | [virtual] |
Referenced by QmitkMovieMaker::FocusChange().
virtual void mitk::Stepper::InverseDirectionOn | ( | ) | [virtual] |
void mitk::Stepper::Last | ( | ) | [virtual] |
Definition at line 215 of file mitkStepper.cpp.
Referenced by QmitkMovieMaker::StopPlaying().
mitk::Stepper::mitkClassMacro | ( | Stepper | , |
itk::Object | |||
) |
static Pointer mitk::Stepper::New | ( | ) | [static] |
Reimplemented in mitk::MultiStepper.
Referenced by mitkMultiStepperTest(), and mitkStepperTest().
void mitk::Stepper::Next | ( | ) | [virtual] |
Definition at line 180 of file mitkStepper.cpp.
Referenced by QmitkMovieMaker::AdvanceAnimation(), QmitkSelectableGLWidget::wheelEvent(), and mitk::RenderWindowBase::wheelMitkEvent().
{ if (!m_InverseDirection) { this->Increase(); } else { this->Decrease(); } }
virtual void mitk::Stepper::PingPongOff | ( | ) | [virtual] |
virtual void mitk::Stepper::PingPongOn | ( | ) | [virtual] |
void mitk::Stepper::Previous | ( | ) | [virtual] |
Definition at line 194 of file mitkStepper.cpp.
Referenced by QmitkSelectableGLWidget::wheelEvent(), and mitk::RenderWindowBase::wheelMitkEvent().
{ if (!m_InverseDirection) { this->Decrease(); } else { this->Increase(); } }
void mitk::Stepper::RemoveRange | ( | ) |
Definition at line 77 of file mitkStepper.cpp.
{ m_HasRange = false; this->Modified(); }
void mitk::Stepper::RemoveUnitName | ( | ) |
Definition at line 115 of file mitkStepper.cpp.
{ m_HasUnitName = false; this->Modified(); }
virtual void mitk::Stepper::SetAutoRepeat | ( | bool | _arg ) | [virtual] |
virtual void mitk::Stepper::SetInverseDirection | ( | bool | _arg ) | [virtual] |
If set to true, the Next() decreases the stepper and Previous() decreases it
virtual void mitk::Stepper::SetPingPong | ( | bool | _arg ) | [virtual] |
Causes the stepper to shift direction when the boundary is reached
virtual void mitk::Stepper::SetPos | ( | unsigned int | pos ) | [inline, virtual] |
Reimplemented in mitk::MultiStepper.
Definition at line 60 of file mitkStepper.h.
Referenced by main(), and mitk::MultiStepper::SetPos().
void mitk::Stepper::SetRange | ( | ScalarType | min, |
ScalarType | max | ||
) |
Definition at line 43 of file mitkStepper.cpp.
References QuadProgPP::max(), and min.
{ m_RangeMin = min; m_RangeMax = max; m_HasRange = true; m_RangeValid = true; this->Modified(); }
virtual void mitk::Stepper::SetSteps | ( | unsigned int | _arg ) | [virtual] |
Reimplemented in mitk::MultiStepper.
void mitk::Stepper::SetUnitName | ( | const char * | unitName ) |
Definition at line 99 of file mitkStepper.cpp.
{ m_UnitName = std::string( unitName ); m_HasUnitName = true; this->Modified(); }
bool mitk::Stepper::m_AutoRepeat [protected] |
Definition at line 132 of file mitkStepper.h.
bool mitk::Stepper::m_HasRange [protected] |
Definition at line 140 of file mitkStepper.h.
bool mitk::Stepper::m_HasUnitName [protected] |
Definition at line 143 of file mitkStepper.h.
bool mitk::Stepper::m_InverseDirection [protected] |
Definition at line 135 of file mitkStepper.h.
bool mitk::Stepper::m_PingPong [protected] |
Definition at line 134 of file mitkStepper.h.
unsigned int mitk::Stepper::m_Pos [protected] |
Definition at line 128 of file mitkStepper.h.
ScalarType mitk::Stepper::m_RangeMax [protected] |
Definition at line 138 of file mitkStepper.h.
ScalarType mitk::Stepper::m_RangeMin [protected] |
Definition at line 137 of file mitkStepper.h.
bool mitk::Stepper::m_RangeValid [protected] |
Definition at line 139 of file mitkStepper.h.
unsigned int mitk::Stepper::m_Steps [protected] |
Definition at line 130 of file mitkStepper.h.
std::string mitk::Stepper::m_UnitName [protected] |
Definition at line 142 of file mitkStepper.h.