[4271] | 1 | /* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
|
---|
| 2 | * Qwt Widget Library
|
---|
| 3 | * Copyright (C) 1997 Josef Wilgen
|
---|
| 4 | * Copyright (C) 2002 Uwe Rathmann
|
---|
| 5 | *
|
---|
| 6 | * This library is free software; you can redistribute it and/or
|
---|
| 7 | * modify it under the terms of the Qwt License, Version 1.0
|
---|
| 8 | *****************************************************************************/
|
---|
| 9 |
|
---|
| 10 | #ifndef QWT_SCALE_DIV_H
|
---|
| 11 | #define QWT_SCALE_DIV_H
|
---|
| 12 |
|
---|
| 13 | #include "qwt_global.h"
|
---|
| 14 | #include "qwt_interval.h"
|
---|
| 15 | #include <qlist.h>
|
---|
| 16 |
|
---|
[8127] | 17 | #ifndef QT_NO_DEBUG_STREAM
|
---|
| 18 | #include <qdebug.h>
|
---|
| 19 | #endif
|
---|
[4271] | 20 |
|
---|
| 21 | /*!
|
---|
| 22 | \brief A class representing a scale division
|
---|
| 23 |
|
---|
[8127] | 24 | A Qwt scale is defined by its boundaries and 3 list
|
---|
| 25 | for the positions of the major, medium and minor ticks.
|
---|
[4271] | 26 |
|
---|
[8127] | 27 | The upperBound() might be smaller than the lowerBound()
|
---|
| 28 | to indicate inverted scales.
|
---|
[4271] | 29 |
|
---|
[8127] | 30 | Scale divisions can be calculated from a QwtScaleEngine.
|
---|
| 31 |
|
---|
| 32 | \sa QwtScaleEngine::divideScale(), QwtPlot::setAxisScaleDiv(),
|
---|
| 33 | QwtAbstractSlider::setScaleDiv()
|
---|
[4271] | 34 | */
|
---|
| 35 |
|
---|
| 36 | class QWT_EXPORT QwtScaleDiv
|
---|
| 37 | {
|
---|
| 38 | public:
|
---|
| 39 | //! Scale tick types
|
---|
| 40 | enum TickType
|
---|
| 41 | {
|
---|
| 42 | //! No ticks
|
---|
| 43 | NoTick = -1,
|
---|
| 44 |
|
---|
| 45 | //! Minor ticks
|
---|
| 46 | MinorTick,
|
---|
| 47 |
|
---|
| 48 | //! Medium ticks
|
---|
| 49 | MediumTick,
|
---|
| 50 |
|
---|
| 51 | //! Major ticks
|
---|
| 52 | MajorTick,
|
---|
| 53 |
|
---|
| 54 | //! Number of valid tick types
|
---|
| 55 | NTickTypes
|
---|
| 56 | };
|
---|
| 57 |
|
---|
[9383] | 58 | explicit QwtScaleDiv( double lowerBound = 0.0,
|
---|
[8127] | 59 | double upperBound = 0.0 );
|
---|
| 60 |
|
---|
[4271] | 61 | explicit QwtScaleDiv( const QwtInterval &, QList<double>[NTickTypes] );
|
---|
| 62 |
|
---|
[8127] | 63 | explicit QwtScaleDiv( double lowerBound, double upperBound,
|
---|
| 64 | QList<double>[NTickTypes] );
|
---|
[4271] | 65 |
|
---|
[9383] | 66 | explicit QwtScaleDiv( double lowerBound, double upperBound,
|
---|
[8127] | 67 | const QList<double> &minorTicks, const QList<double> &mediumTicks,
|
---|
| 68 | const QList<double> &majorTicks );
|
---|
| 69 |
|
---|
| 70 | bool operator==( const QwtScaleDiv & ) const;
|
---|
| 71 | bool operator!=( const QwtScaleDiv & ) const;
|
---|
| 72 |
|
---|
[4271] | 73 | void setInterval( double lowerBound, double upperBound );
|
---|
| 74 | void setInterval( const QwtInterval & );
|
---|
| 75 | QwtInterval interval() const;
|
---|
| 76 |
|
---|
[8127] | 77 | void setLowerBound( double );
|
---|
[4271] | 78 | double lowerBound() const;
|
---|
[8127] | 79 |
|
---|
| 80 | void setUpperBound( double );
|
---|
[4271] | 81 | double upperBound() const;
|
---|
[8127] | 82 |
|
---|
[4271] | 83 | double range() const;
|
---|
| 84 |
|
---|
[8127] | 85 | bool contains( double value ) const;
|
---|
[4271] | 86 |
|
---|
[8127] | 87 | void setTicks( int tickType, const QList<double> & );
|
---|
| 88 | QList<double> ticks( int tickType ) const;
|
---|
[4271] | 89 |
|
---|
[8127] | 90 | bool isEmpty() const;
|
---|
| 91 | bool isIncreasing() const;
|
---|
[4271] | 92 |
|
---|
| 93 | void invert();
|
---|
[8127] | 94 | QwtScaleDiv inverted() const;
|
---|
[4271] | 95 |
|
---|
[8127] | 96 | QwtScaleDiv bounded( double lowerBound, double upperBound ) const;
|
---|
| 97 |
|
---|
[4271] | 98 | private:
|
---|
| 99 | double d_lowerBound;
|
---|
| 100 | double d_upperBound;
|
---|
| 101 | QList<double> d_ticks[NTickTypes];
|
---|
| 102 | };
|
---|
| 103 |
|
---|
[8127] | 104 | Q_DECLARE_TYPEINFO( QwtScaleDiv, Q_MOVABLE_TYPE );
|
---|
[4271] | 105 |
|
---|
[8127] | 106 | #ifndef QT_NO_DEBUG_STREAM
|
---|
| 107 | QWT_EXPORT QDebug operator<<( QDebug, const QwtScaleDiv & );
|
---|
| 108 | #endif
|
---|
[4271] | 109 |
|
---|
| 110 | #endif
|
---|