source: ntrip/trunk/BNC/qwt/qwt_transform.h@ 10166

Last change on this file since 10166 was 9383, checked in by stoecker, 4 years ago

update to qwt verion 6.1.1 to fix build with newer Qt5

File size: 3.5 KB
RevLine 
[8127]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_TRANSFORM_H
11#define QWT_TRANSFORM_H
12
13#include "qwt_global.h"
14
15/*!
16 \brief A transformation between coordinate systems
17
18 QwtTransform manipulates values, when being mapped between
19 the scale and the paint device coordinate system.
20
21 A transformation consists of 2 methods:
22
23 - transform
24 - invTransform
25
26 where one is is the inverse function of the other.
27
28 When p1, p2 are the boundaries of the paint device coordinates
29 and s1, s2 the boundaries of the scale, QwtScaleMap uses the
30 following calculations:
31
32 - p = p1 + ( p2 - p1 ) * ( T( s ) - T( s1 ) / ( T( s2 ) - T( s1 ) );
33 - s = invT ( T( s1 ) + ( T( s2 ) - T( s1 ) ) * ( p - p1 ) / ( p2 - p1 ) );
34*/
35class QWT_EXPORT QwtTransform
36{
37public:
38 QwtTransform();
39 virtual ~QwtTransform();
40
41 /*!
42 Modify value to be a valid value for the transformation.
43 The default implementation does nothing.
44 */
45 virtual double bounded( double value ) const;
46
47 /*!
48 Transformation function
49
50 \param value Value
51 \return Modified value
52
53 \sa invTransform()
54 */
55 virtual double transform( double value ) const = 0;
56
57 /*!
58 Inverse transformation function
59
60 \param value Value
61 \return Modified value
62
63 \sa transform()
64 */
65 virtual double invTransform( double value ) const = 0;
66
67 //! Virtualized copy operation
68 virtual QwtTransform *copy() const = 0;
69};
70
71/*!
72 \brief Null transformation
73
74 QwtNullTransform returns the values unmodified.
[9383]75
[8127]76 */
77class QWT_EXPORT QwtNullTransform: public QwtTransform
78{
79public:
80 QwtNullTransform();
81 virtual ~QwtNullTransform();
82
83 virtual double transform( double value ) const;
84 virtual double invTransform( double value ) const;
85
86 virtual QwtTransform *copy() const;
87};
88/*!
89 \brief Logarithmic transformation
90
91 QwtLogTransform modifies the values using log() and exp().
92
93 \note In the calculations of QwtScaleMap the base of the log function
[9383]94 has no effect on the mapping. So QwtLogTransform can be used
[8127]95 for log2(), log10() or any other logarithmic scale.
96 */
97class QWT_EXPORT QwtLogTransform: public QwtTransform
[9383]98{
[8127]99public:
100 QwtLogTransform();
101 virtual ~QwtLogTransform();
[9383]102
[8127]103 virtual double transform( double value ) const;
104 virtual double invTransform( double value ) const;
105
106 virtual double bounded( double value ) const;
107
108 virtual QwtTransform *copy() const;
109
110#if QT_VERSION >= 0x050400
111 static const double LogMin;
112 static const double LogMax;
113#else
114 QT_STATIC_CONST double LogMin;
115 QT_STATIC_CONST double LogMax;
116#endif
117};
118
119/*!
120 \brief A transformation using pow()
121
[9383]122 QwtPowerTransform preserves the sign of a value.
[8127]123 F.e. a transformation with a factor of 2
124 transforms a value of -3 to -9 and v.v. Thus QwtPowerTransform
125 can be used for scales including negative values.
126 */
127class QWT_EXPORT QwtPowerTransform: public QwtTransform
128{
129public:
130 QwtPowerTransform( double exponent );
131 virtual ~QwtPowerTransform();
132
133 virtual double transform( double value ) const;
134 virtual double invTransform( double value ) const;
135
136 virtual QwtTransform *copy() const;
137
138private:
139 const double d_exponent;
140};
141
142#endif
Note: See TracBrowser for help on using the repository browser.