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 |
|
---|
17 | #ifndef QT_NO_DEBUG_STREAM
|
---|
18 | #include <qdebug.h>
|
---|
19 | #endif
|
---|
20 |
|
---|
21 | /*!
|
---|
22 | \brief A class representing a scale division
|
---|
23 |
|
---|
24 | A Qwt scale is defined by its boundaries and 3 list
|
---|
25 | for the positions of the major, medium and minor ticks.
|
---|
26 |
|
---|
27 | The upperBound() might be smaller than the lowerBound()
|
---|
28 | to indicate inverted scales.
|
---|
29 |
|
---|
30 | Scale divisions can be calculated from a QwtScaleEngine.
|
---|
31 |
|
---|
32 | \sa QwtScaleEngine::divideScale(), QwtPlot::setAxisScaleDiv(),
|
---|
33 | QwtAbstractSlider::setScaleDiv()
|
---|
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 |
|
---|
58 | explicit QwtScaleDiv( double lowerBound = 0.0,
|
---|
59 | double upperBound = 0.0 );
|
---|
60 |
|
---|
61 | explicit QwtScaleDiv( const QwtInterval &, QList<double>[NTickTypes] );
|
---|
62 |
|
---|
63 | explicit QwtScaleDiv( double lowerBound, double upperBound,
|
---|
64 | QList<double>[NTickTypes] );
|
---|
65 |
|
---|
66 | explicit QwtScaleDiv( double lowerBound, double upperBound,
|
---|
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 |
|
---|
73 | void setInterval( double lowerBound, double upperBound );
|
---|
74 | void setInterval( const QwtInterval & );
|
---|
75 | QwtInterval interval() const;
|
---|
76 |
|
---|
77 | void setLowerBound( double );
|
---|
78 | double lowerBound() const;
|
---|
79 |
|
---|
80 | void setUpperBound( double );
|
---|
81 | double upperBound() const;
|
---|
82 |
|
---|
83 | double range() const;
|
---|
84 |
|
---|
85 | bool contains( double value ) const;
|
---|
86 |
|
---|
87 | void setTicks( int tickType, const QList<double> & );
|
---|
88 | QList<double> ticks( int tickType ) const;
|
---|
89 |
|
---|
90 | bool isEmpty() const;
|
---|
91 | bool isIncreasing() const;
|
---|
92 |
|
---|
93 | void invert();
|
---|
94 | QwtScaleDiv inverted() const;
|
---|
95 |
|
---|
96 | QwtScaleDiv bounded( double lowerBound, double upperBound ) const;
|
---|
97 |
|
---|
98 | private:
|
---|
99 | double d_lowerBound;
|
---|
100 | double d_upperBound;
|
---|
101 | QList<double> d_ticks[NTickTypes];
|
---|
102 | };
|
---|
103 |
|
---|
104 | Q_DECLARE_TYPEINFO( QwtScaleDiv, Q_MOVABLE_TYPE );
|
---|
105 |
|
---|
106 | #ifndef QT_NO_DEBUG_STREAM
|
---|
107 | QWT_EXPORT QDebug operator<<( QDebug, const QwtScaleDiv & );
|
---|
108 | #endif
|
---|
109 |
|
---|
110 | #endif
|
---|