Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef STEPPER_H_HEADER_INCLUDED_C1E77191
00020 #define STEPPER_H_HEADER_INCLUDED_C1E77191
00021
00022 #include "mitkCommon.h"
00023 #include "mitkVector.h"
00024
00025 #include <itkObject.h>
00026 #include <itkObjectFactory.h>
00027
00028 #include <string>
00029
00030 namespace mitk {
00031
00052 class MITK_CORE_EXPORT Stepper : public itk::Object
00053 {
00054 public:
00055 mitkClassMacro(Stepper, itk::Object);
00056 itkNewMacro(Self);
00057
00058 itkGetMacro(Pos, unsigned int);
00059
00060 virtual void SetPos(unsigned int pos)
00061 {
00062
00063 unsigned int newPos;
00064 if ( m_Steps != 0 )
00065 {
00066 newPos = (pos > m_Steps-1 ? m_Steps-1 : pos);
00067 }
00068 else
00069 {
00070 newPos = 0;
00071 }
00072
00073 if (this->m_Pos != newPos )
00074 {
00075 this->m_Pos = newPos ;
00076 this->Modified();
00077 }
00078 }
00079
00080 itkGetMacro(Steps, unsigned int);
00081 itkSetMacro(Steps, unsigned int);
00082
00083 itkGetMacro(AutoRepeat, bool);
00084 itkSetMacro(AutoRepeat, bool);
00085 itkBooleanMacro(AutoRepeat);
00086
00088 itkSetMacro(PingPong, bool);
00089 itkGetMacro(PingPong, bool);
00090 itkBooleanMacro(PingPong);
00091
00094 itkSetMacro(InverseDirection, bool);
00095 itkGetMacro(InverseDirection, bool);
00096 itkBooleanMacro(InverseDirection);
00097
00098 void SetRange( ScalarType min, ScalarType max );
00099 void InvalidateRange();
00100 ScalarType GetRangeMin() const;
00101 ScalarType GetRangeMax() const;
00102 bool HasValidRange() const;
00103 void RemoveRange();
00104 bool HasRange() const;
00105
00106 void SetUnitName( const char *unitName );
00107 const char *GetUnitName() const;
00108 void RemoveUnitName();
00109 bool HasUnitName() const;
00110
00111
00112 virtual void Next();
00113
00114 virtual void Previous();
00115
00116 virtual void First();
00117
00118 virtual void Last();
00119
00120 protected:
00121 Stepper();
00122 virtual ~Stepper();
00123
00124 void Increase();
00125
00126 void Decrease();
00127
00128 unsigned int m_Pos;
00129
00130 unsigned int m_Steps;
00131
00132 bool m_AutoRepeat;
00133
00134 bool m_PingPong;
00135 bool m_InverseDirection;
00136
00137 ScalarType m_RangeMin;
00138 ScalarType m_RangeMax;
00139 bool m_RangeValid;
00140 bool m_HasRange;
00141
00142 std::string m_UnitName;
00143 bool m_HasUnitName;
00144
00145 };
00146
00147 }
00148
00149
00150
00151 #endif