QWT API (English) 7.3.0
Qt Widget Library for Technical Applications - English API Documentation
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
QwtScaleMap Class Reference

A scale map. More...

#include <qwt_scale_map.h>

Public Member Functions

 QwtScaleMap ()
 Default constructor.
 
 QwtScaleMap (const QwtScaleMap &)
 Copy constructor.
 
 QwtScaleMap (QwtScaleMap &&)
 Move constructor.
 
 ~QwtScaleMap ()
 Destructor.
 
QwtScaleMapoperator= (const QwtScaleMap &)
 Copy assignment operator.
 
QwtScaleMapoperator= (QwtScaleMap &&)
 Move assignment operator.
 
void setTransformation (QwtTransform *)
 Set the transformation (takes ownership)
 
const QwtTransformtransformation () const
 Return the transformation.
 
void setPaintInterval (double p1, double p2)
 Set the paint device interval boundaries.
 
void setScaleInterval (double s1, double s2)
 Set the scale interval boundaries.
 
double transform (double s) const
 Transform a scale value to paint device coordinate.
 
double invTransform (double p) const
 Transform a paint device coordinate to scale value.
 
constexpr double p1 () const noexcept
 Return first border of paint interval.
 
constexpr double p2 () const noexcept
 Return second border of paint interval.
 
constexpr double s1 () const noexcept
 Return first border of scale interval.
 
constexpr double s2 () const noexcept
 Return second border of scale interval.
 
double pDist () const
 Return distance between paint interval boundaries.
 
double sDist () const
 Return distance between scale interval boundaries.
 
constexpr bool isLinear () const noexcept
 Check if this scale has no nonlinear transformation.
 
constexpr bool isInverting () const noexcept
 Check if the mapping direction is inverted.
 
constexpr double cnv () const noexcept
 Conversion factor for linear fast-path: result = p1() + (value - ts1()) * cnv()
 
constexpr double ts1 () const noexcept
 Transformed scale origin for linear fast-path.
 

Static Public Member Functions

static QRectF transform (const QwtScaleMap &, const QwtScaleMap &, const QRectF &)
 Transform a rectangle from scale to paint coordinates.
 
static QRectF invTransform (const QwtScaleMap &, const QwtScaleMap &, const QRectF &)
 Transform a rectangle from paint to scale coordinates.
 
static QPointF transform (const QwtScaleMap &, const QwtScaleMap &, const QPointF &)
 Transform a point from scale to paint coordinates.
 
static QPointF invTransform (const QwtScaleMap &, const QwtScaleMap &, const QPointF &)
 Transform a point from paint to scale coordinates.
 
static bool isLinerScale (const QwtScaleMap &sm)
 Check if the scale is linear (no transformation)
 

Protected Member Functions

void swap (QwtScaleMap &other) noexcept
 

Detailed Description

A scale map.

QwtScaleMap offers transformations from the coordinate system of a scale into the linear coordinate system of a paint device and vice versa.

See also
QwtTransform, QwtScaleDiv

Constructor & Destructor Documentation

◆ QwtScaleMap()

QwtScaleMap::QwtScaleMap ( )

Default constructor.

The scale and paint device intervals are both set to [0,1].

Member Function Documentation

◆ cnv()

constexpr double QwtScaleMap::cnv ( ) const
inlineconstexprnoexcept

Conversion factor for linear fast-path: result = p1() + (value - ts1()) * cnv()

Return the conversion factor for linear fast-path transform.

◆ invTransform() [1/3]

QPointF QwtScaleMap::invTransform ( const QwtScaleMap xMap,
const QwtScaleMap yMap,
const QPointF &  pos 
)
static

Transform a point from paint to scale coordinates.

Parameters
xMapX axis scale map
yMapY axis scale map
posPosition in paint coordinates
Returns
Position in scale coordinates
See also
transform()

◆ invTransform() [2/3]

QRectF QwtScaleMap::invTransform ( const QwtScaleMap xMap,
const QwtScaleMap yMap,
const QRectF &  rect 
)
static

Transform a rectangle from paint to scale coordinates.

Parameters
xMapX axis scale map
yMapY axis scale map
rectRectangle in paint coordinates
Returns
Rectangle in scale coordinates
See also
transform()

◆ invTransform() [3/3]

double QwtScaleMap::invTransform ( double  p) const
inline

Transform a paint device coordinate to scale value.

Transform a paint device value into a value in the interval of the scale.

Parameters
pValue relative to the coordinates of the paint device
Returns
Transformed value
See also
transform()

◆ isInverting()

constexpr bool QwtScaleMap::isInverting ( ) const
inlineconstexprnoexcept

Check if the mapping direction is inverted.

Return true when ( p1() < p2() ) != ( s1() < s2() )

◆ isLinear()

constexpr bool QwtScaleMap::isLinear ( ) const
inlineconstexprnoexcept

Check if this scale has no nonlinear transformation.

Return true when there is no nonlinear transformation.

◆ isLinerScale()

bool QwtScaleMap::isLinerScale ( const QwtScaleMap sm)
static

Check if the scale is linear (no transformation)

Parameters
smScale map to check
Returns
True if the scale has no transformation (linear scale)

◆ operator=()

QwtScaleMap & QwtScaleMap::operator= ( const QwtScaleMap other)

Copy assignment operator.

Assignment operator.

◆ p1()

constexpr double QwtScaleMap::p1 ( ) const
inlineconstexprnoexcept

Return first border of paint interval.

Return first border of the paint interval.

◆ p2()

constexpr double QwtScaleMap::p2 ( ) const
inlineconstexprnoexcept

Return second border of paint interval.

Return second border of the paint interval.

◆ pDist()

double QwtScaleMap::pDist ( ) const
inline

Return distance between paint interval boundaries.

Return qwtAbs(p2() - p1())

◆ s1()

constexpr double QwtScaleMap::s1 ( ) const
inlineconstexprnoexcept

Return first border of scale interval.

Return first border of the scale interval.

◆ s2()

constexpr double QwtScaleMap::s2 ( ) const
inlineconstexprnoexcept

Return second border of scale interval.

Return second border of the scale interval.

◆ sDist()

double QwtScaleMap::sDist ( ) const
inline

Return distance between scale interval boundaries.

Return qwtAbs(s2() - s1())

◆ setPaintInterval()

void QwtScaleMap::setPaintInterval ( double  p1,
double  p2 
)

Set the paint device interval boundaries.

Specify the borders of the paint device interval.

Parameters
p1First border
p2Second border

◆ setScaleInterval()

void QwtScaleMap::setScaleInterval ( double  s1,
double  s2 
)

Set the scale interval boundaries.

Specify the borders of the scale interval.

Scales might be aligned to transformation depending boundaries

Parameters
s1First border
s2Second border

◆ setTransformation()

void QwtScaleMap::setTransformation ( QwtTransform transform)

Set the transformation (takes ownership)

Initialize the map with a transformation.

Parameters
transformTransformation object (takes ownership)

◆ transform() [1/3]

QPointF QwtScaleMap::transform ( const QwtScaleMap xMap,
const QwtScaleMap yMap,
const QPointF &  pos 
)
static

Transform a point from scale to paint coordinates.

Parameters
xMapX axis scale map
yMapY axis scale map
posPosition in scale coordinates
Returns
Position in paint coordinates
See also
invTransform()

◆ transform() [2/3]

QRectF QwtScaleMap::transform ( const QwtScaleMap xMap,
const QwtScaleMap yMap,
const QRectF &  rect 
)
static

Transform a rectangle from scale to paint coordinates.

Parameters
xMapX axis scale map
yMapY axis scale map
rectRectangle in scale coordinates
Returns
Rectangle in paint coordinates
See also
invTransform()

◆ transform() [3/3]

double QwtScaleMap::transform ( double  s) const
inline

Transform a scale value to paint device coordinate.

Transform a point related to the scale interval into a point related to the paint device interval.

Parameters
sValue relative to the coordinates of the scale
Returns
Transformed value
See also
invTransform()

◆ transformation()

const QwtTransform * QwtScaleMap::transformation ( ) const

Return the transformation.

Get the transformation.

Returns
Transformation object

◆ ts1()

constexpr double QwtScaleMap::ts1 ( ) const
inlineconstexprnoexcept

Transformed scale origin for linear fast-path.

Return the transformed scale origin for linear fast-path transform.


The documentation for this class was generated from the following files: