source: ntrip/trunk/BNC/qwt/qwt_scale_div.h@ 6381

Last change on this file since 6381 was 4271, checked in by mervart, 12 years ago
File size: 2.8 KB
RevLine 
[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
17class QwtInterval;
18
19/*!
20 \brief A class representing a scale division
21
22 A scale division consists of its limits and 3 list
23 of tick values qualified as major, medium and minor ticks.
24
25 In most cases scale divisions are calculated by a QwtScaleEngine.
26
27 \sa subDivideInto(), subDivide()
28*/
29
30class QWT_EXPORT QwtScaleDiv
31{
32public:
33 //! Scale tick types
34 enum TickType
35 {
36 //! No ticks
37 NoTick = -1,
38
39 //! Minor ticks
40 MinorTick,
41
42 //! Medium ticks
43 MediumTick,
44
45 //! Major ticks
46 MajorTick,
47
48 //! Number of valid tick types
49 NTickTypes
50 };
51
52 explicit QwtScaleDiv();
53 explicit QwtScaleDiv( const QwtInterval &, QList<double>[NTickTypes] );
54 explicit QwtScaleDiv(
55 double lowerBound, double upperBound, QList<double>[NTickTypes] );
56
57 bool operator==( const QwtScaleDiv &s ) const;
58 bool operator!=( const QwtScaleDiv &s ) const;
59
60 void setInterval( double lowerBound, double upperBound );
61 void setInterval( const QwtInterval & );
62 QwtInterval interval() const;
63
64 double lowerBound() const;
65 double upperBound() const;
66 double range() const;
67
68 bool contains( double v ) const;
69
70 void setTicks( int type, const QList<double> & );
71 const QList<double> &ticks( int type ) const;
72
73 void invalidate();
74 bool isValid() const;
75
76 void invert();
77
78private:
79 double d_lowerBound;
80 double d_upperBound;
81 QList<double> d_ticks[NTickTypes];
82
83 bool d_isValid;
84};
85
86Q_DECLARE_TYPEINFO(QwtScaleDiv, Q_MOVABLE_TYPE);
87
88/*!
89 Change the interval
90 \param lowerBound lower bound
91 \param upperBound upper bound
92*/
93inline void QwtScaleDiv::setInterval( double lowerBound, double upperBound )
94{
95 d_lowerBound = lowerBound;
96 d_upperBound = upperBound;
97}
98
99/*!
100 \return lowerBound -> upperBound
101*/
102inline QwtInterval QwtScaleDiv::interval() const
103{
104 return QwtInterval( d_lowerBound, d_upperBound );
105}
106
107/*!
108 \return lower bound
109 \sa upperBound()
110*/
111inline double QwtScaleDiv::lowerBound() const
112{
113 return d_lowerBound;
114}
115
116/*!
117 \return upper bound
118 \sa lowerBound()
119*/
120inline double QwtScaleDiv::upperBound() const
121{
122 return d_upperBound;
123}
124
125/*!
126 \return upperBound() - lowerBound()
127*/
128inline double QwtScaleDiv::range() const
129{
130 return d_upperBound - d_lowerBound;
131}
132#endif
Note: See TracBrowser for help on using the repository browser.