source: ntrip/trunk/BNC/qwt/qwt_transform.cpp@ 10150

Last change on this file since 10150 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.4 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#include "qwt_transform.h"
11#include "qwt_math.h"
12
13#if QT_VERSION < 0x040601
14#define qExp(x) ::exp(x)
15#endif
16
17#if QT_VERSION >= 0x050400
18
19//! Smallest allowed value for logarithmic scales: 1.0e-150
20const double QwtLogTransform::LogMin = 1.0e-150;
[9383]21
[8127]22//! Largest allowed value for logarithmic scales: 1.0e150
23const double QwtLogTransform::LogMax = 1.0e150;
24
25#else
26
27//! Smallest allowed value for logarithmic scales: 1.0e-150
28QT_STATIC_CONST_IMPL double QwtLogTransform::LogMin = 1.0e-150;
29
30//! Largest allowed value for logarithmic scales: 1.0e150
31QT_STATIC_CONST_IMPL double QwtLogTransform::LogMax = 1.0e150;
32
33#endif
34
35//! Constructor
36QwtTransform::QwtTransform()
37{
38}
39
40//! Destructor
41QwtTransform::~QwtTransform()
42{
43}
44
[9383]45/*!
[8127]46 \param value Value to be bounded
47 \return value unmodified
48 */
49double QwtTransform::bounded( double value ) const
50{
51 return value;
52}
53
54//! Constructor
55QwtNullTransform::QwtNullTransform():
56 QwtTransform()
57{
58}
59
60//! Destructor
61QwtNullTransform::~QwtNullTransform()
62{
63}
64
[9383]65/*!
[8127]66 \param value Value to be transformed
67 \return value unmodified
68 */
69double QwtNullTransform::transform( double value ) const
70{
71 return value;
72}
73
[9383]74/*!
[8127]75 \param value Value to be transformed
76 \return value unmodified
77 */
78double QwtNullTransform::invTransform( double value ) const
79{
80 return value;
81}
82
83//! \return Clone of the transformation
84QwtTransform *QwtNullTransform::copy() const
85{
86 return new QwtNullTransform();
87}
88
89//! Constructor
90QwtLogTransform::QwtLogTransform():
91 QwtTransform()
92{
93}
94
95//! Destructor
96QwtLogTransform::~QwtLogTransform()
97{
98}
99
[9383]100/*!
[8127]101 \param value Value to be transformed
102 \return log( value )
103 */
104double QwtLogTransform::transform( double value ) const
105{
106 return ::log( value );
107}
108
[9383]109/*!
[8127]110 \param value Value to be transformed
111 \return exp( value )
112 */
113double QwtLogTransform::invTransform( double value ) const
114{
115 return qExp( value );
116}
117
[9383]118/*!
[8127]119 \param value Value to be bounded
120 \return qBound( LogMin, value, LogMax )
121 */
122double QwtLogTransform::bounded( double value ) const
123{
124 return qBound( LogMin, value, LogMax );
125}
126
127//! \return Clone of the transformation
128QwtTransform *QwtLogTransform::copy() const
129{
130 return new QwtLogTransform();
131}
132
133/*!
134 Constructor
135 \param exponent Exponent
136*/
137QwtPowerTransform::QwtPowerTransform( double exponent ):
138 QwtTransform(),
139 d_exponent( exponent )
140{
141}
142
143//! Destructor
144QwtPowerTransform::~QwtPowerTransform()
145{
146}
147
[9383]148/*!
[8127]149 \param value Value to be transformed
150 \return Exponentiation preserving the sign
151 */
152double QwtPowerTransform::transform( double value ) const
153{
154 if ( value < 0.0 )
155 return -qPow( -value, 1.0 / d_exponent );
156 else
157 return qPow( value, 1.0 / d_exponent );
[9383]158
[8127]159}
160
[9383]161/*!
[8127]162 \param value Value to be transformed
163 \return Inverse exponentiation preserving the sign
164 */
165double QwtPowerTransform::invTransform( double value ) const
166{
167 if ( value < 0.0 )
168 return -qPow( -value, d_exponent );
169 else
170 return qPow( value, d_exponent );
171}
172
173//! \return Clone of the transformation
174QwtTransform *QwtPowerTransform::copy() const
175{
176 return new QwtPowerTransform( d_exponent );
177}
Note: See TracBrowser for help on using the repository browser.