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 {
00037 NoTick = -1,
00038
00040 MinorTick,
00041
00043 MediumTick,
00044
00046 MajorTick,
00047
00049 NTickTypes
00050 };
00051
00052 explicit QwtScaleDiv();
00053 explicit QwtScaleDiv( const QwtInterval &, QList<double>[NTickTypes] );
00054 explicit QwtScaleDiv(
00055 double lowerBound, double upperBound, QList<double>[NTickTypes] );
00056
00057 bool operator==( const QwtScaleDiv &s ) const;
00058 bool operator!=( const QwtScaleDiv &s ) const;
00059
00060 void setInterval( double lowerBound, double upperBound );
00061 void setInterval( const QwtInterval & );
00062 QwtInterval interval() const;
00063
00064 double lowerBound() const;
00065 double upperBound() const;
00066 double range() const;
00067
00068 bool contains( double v ) const;
00069
00070 void setTicks( int type, const QList<double> & );
00071 const QList<double> &ticks( int type ) const;
00072
00073 void invalidate();
00074 bool isValid() const;
00075
00076 void invert();
00077
00078 private:
00079 double d_lowerBound;
00080 double d_upperBound;
00081 QList<double> d_ticks[NTickTypes];
00082
00083 bool d_isValid;
00084 };
00085
00086 Q_DECLARE_TYPEINFO(QwtScaleDiv, Q_MOVABLE_TYPE);
00087
00093 inline void QwtScaleDiv::setInterval( double lowerBound, double upperBound )
00094 {
00095 d_lowerBound = lowerBound;
00096 d_upperBound = upperBound;
00097 }
00098
00102 inline QwtInterval QwtScaleDiv::interval() const
00103 {
00104 return QwtInterval( d_lowerBound, d_upperBound );
00105 }
00106
00111 inline double QwtScaleDiv::lowerBound() const
00112 {
00113 return d_lowerBound;
00114 }
00115
00120 inline double QwtScaleDiv::upperBound() const
00121 {
00122 return d_upperBound;
00123 }
00124
00128 inline double QwtScaleDiv::range() const
00129 {
00130 return d_upperBound - d_lowerBound;
00131 }
00132 #endif