Public Types | Public Member Functions

QwtScaleTransformation Class Reference

Operations for linear or logarithmic (base 10) transformations. More...

#include <qwt_scale_map.h>

List of all members.

Public Types

enum  Type { Linear, Log10, Other }

Public Member Functions

 QwtScaleTransformation (Type type)
 Constructor for a linear transformation.
virtual ~QwtScaleTransformation ()
 Destructor.
virtual double xForm (double x, double s1, double s2, double p1, double p2) const
 Transform a value between 2 linear intervals.
virtual double invXForm (double x, double s1, double s2, double p1, double p2) const
 Transform a value from a linear to a logarithmic interval.
Type type () const
virtual QwtScaleTransformationcopy () const
 Create a clone of the transformation.

Detailed Description

Operations for linear or logarithmic (base 10) transformations.

Definition at line 19 of file qwt_scale_map.h.


Member Enumeration Documentation

Enumerator:
Linear 
Log10 
Other 

Definition at line 22 of file qwt_scale_map.h.

    {
        Linear,
        Log10,

        Other
    };

Constructor & Destructor Documentation

QwtScaleTransformation::QwtScaleTransformation ( Type  type )

Constructor for a linear transformation.

Definition at line 16 of file qwt_scale_map.cpp.

References QwtScaleTransformation().

Referenced by QwtScaleTransformation().

                                                       :
    d_type(type)
{
}
QwtScaleTransformation::~QwtScaleTransformation (  ) [virtual]

Destructor.

Definition at line 22 of file qwt_scale_map.cpp.

{
}

Member Function Documentation

QwtScaleTransformation * QwtScaleTransformation::copy (  ) const [virtual]

Create a clone of the transformation.

Definition at line 27 of file qwt_scale_map.cpp.

Referenced by QwtPlotScaleItem::draw(), QwtScaleMap::operator=(), and QwtScaleMap::QwtScaleMap().

{
    return new QwtScaleTransformation(d_type);
}
double QwtScaleTransformation::invXForm ( double  p,
double  p1,
double  p2,
double  s1,
double  s2 
) const [virtual]

Transform a value from a linear to a logarithmic interval.

Parameters:
xvalue related to the linear interval [p1, p2]
p1first border of linear interval
p2first border of linear interval
s1first border of logarithmic interval
s2first border of logarithmic interval
Returns:
exp((x - p1) / (p2 - p1) * log(s2 / s1)) * s1;

Definition at line 72 of file qwt_scale_map.cpp.

References QuadProgPP::exp(), QuadProgPP::log(), and Log10.

Referenced by QwtScaleMap::invTransform().

{
    if ( d_type == Log10 )  
        return exp((p - p1) / (p2 - p1) * log(s2 / s1)) * s1;
    else
        return s1 + (s2 - s1) / (p2 - p1) * (p - p1);
}
Type QwtScaleTransformation::type (  ) const [inline]
double QwtScaleTransformation::xForm ( double  s,
double  s1,
double  s2,
double  p1,
double  p2 
) const [virtual]

Transform a value between 2 linear intervals.

Parameters:
xvalue related to the interval [x1, x2]
x1first border of source interval
x2first border of source interval
y1first border of target interval
y2first border of target interval
Returns:
linear mapping:
y1 + (y2 - y1) / (x2 - x1) * (x - x1)
log10 mapping:
p1 + (p2 - p1) / log(s2 / s1) * log(x / s1)

Definition at line 49 of file qwt_scale_map.cpp.

References QuadProgPP::log(), and Log10.

Referenced by QwtScaleMap::xTransform().

{
    if ( d_type == Log10 )  
        return p1 + (p2 - p1) / log(s2 / s1) * log(s / s1);
    else 
        return p1 + (p2 - p1) / (s2 - s1) * (s - s1);
}

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines