00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef QWT_SCALE_DIV_H
00011 #define QWT_SCALE_DIV_H
00012
00013 #include "qwt_global.h"
00014 #include "qwt_interval.h"
00015 #include <qlist.h>
00016
00017 class QwtInterval;
00018
00030 class QWT_EXPORT QwtScaleDiv
00031 {
00032 public:
00034 enum TickType
00035 {
00036 NoTick = -1,
00037
00038 MinorTick,
00039 MediumTick,
00040 MajorTick,
00041
00042 NTickTypes
00043 };
00044
00045 explicit QwtScaleDiv();
00046 explicit QwtScaleDiv( const QwtInterval &, QList<double>[NTickTypes] );
00047 explicit QwtScaleDiv(
00048 double lowerBound, double upperBound, QList<double>[NTickTypes] );
00049
00050 bool operator==( const QwtScaleDiv &s ) const;
00051 bool operator!=( const QwtScaleDiv &s ) const;
00052
00053 void setInterval( double lowerBound, double upperBound );
00054 void setInterval( const QwtInterval & );
00055 QwtInterval interval() const;
00056
00057 double lowerBound() const;
00058 double upperBound() const;
00059 double range() const;
00060
00061 bool contains( double v ) const;
00062
00063 void setTicks( int type, const QList<double> & );
00064 const QList<double> &ticks( int type ) const;
00065
00066 void invalidate();
00067 bool isValid() const;
00068
00069 void invert();
00070
00071 private:
00072 double d_lowerBound;
00073 double d_upperBound;
00074 QList<double> d_ticks[NTickTypes];
00075
00076 bool d_isValid;
00077 };
00078
00084 inline void QwtScaleDiv::setInterval( double lowerBound, double upperBound )
00085 {
00086 d_lowerBound = lowerBound;
00087 d_upperBound = upperBound;
00088 }
00089
00093 inline QwtInterval QwtScaleDiv::interval() const
00094 {
00095 return QwtInterval( d_lowerBound, d_upperBound );
00096 }
00097
00102 inline double QwtScaleDiv::lowerBound() const
00103 {
00104 return d_lowerBound;
00105 }
00106
00111 inline double QwtScaleDiv::upperBound() const
00112 {
00113 return d_upperBound;
00114 }
00115
00119 inline double QwtScaleDiv::range() const
00120 {
00121 return d_upperBound - d_lowerBound;
00122 }
00123 #endif