27#ifndef QWT_SCALE_MAP_H
28#define QWT_SCALE_MAP_H
30#include "qwtcore_global.h"
31#include "qwt_transform.h"
67 void setPaintInterval(
double p1,
double p2);
69 void setScaleInterval(
double s1,
double s2);
72 double transform(
double s)
const;
74 double invTransform(
double p)
const;
77 Q_DECL_CONSTEXPR
double p1() const noexcept {
return m_p1; }
79 Q_DECL_CONSTEXPR
double p2() const noexcept {
return m_p2; }
82 Q_DECL_CONSTEXPR
double s1() const noexcept {
return m_s1; }
84 Q_DECL_CONSTEXPR
double s2() const noexcept {
return m_s2; }
87 double pDist()
const {
return qAbs(m_p2 - m_p1); }
89 double sDist()
const {
return qAbs(m_s2 - m_s1); }
107 Q_DECL_CONSTEXPR
bool isLinear() const noexcept {
return m_transform ==
nullptr; }
110 Q_DECL_CONSTEXPR
bool isInverting() const noexcept {
return ((m_p1 < m_p2) != (m_s1 < m_s2)); }
113 Q_DECL_CONSTEXPR
double cnv() const noexcept {
return m_cnv; }
116 Q_DECL_CONSTEXPR
double ts1() const noexcept {
return m_ts1; }
123 double m_s1 { 0.0 }, m_s2 { 1.0 };
124 double m_p1 { 0.0 }, m_p2 { 1.0 };
126 double m_cnv { 1.0 };
127 double m_ts1 { 0.0 };
143 return m_p1 + (s - m_ts1) * m_cnv;
154 double s = m_ts1 + (p - m_p1) / m_cnv;
161#ifndef QT_NO_DEBUG_STREAM
162QWTCORE_EXPORT QDebug operator<<(QDebug,
const QwtScaleMap&);
A scale map
Definition qwt_scale_map.h:44
Q_DECL_CONSTEXPR double p2() const noexcept
Return second border of paint interval
Definition qwt_scale_map.h:79
Q_DECL_CONSTEXPR double s2() const noexcept
Return second border of scale interval
Definition qwt_scale_map.h:84
Q_DECL_CONSTEXPR double p1() const noexcept
Return first border of paint interval
Definition qwt_scale_map.h:77
double pDist() const
Return distance between paint interval boundaries
Definition qwt_scale_map.h:87
double transform(double s) const
Transform a scale value to paint device coordinate
Definition qwt_scale_map.h:138
Q_DECL_CONSTEXPR double ts1() const noexcept
Transformed scale origin for linear fast-path
Definition qwt_scale_map.h:116
double sDist() const
Return distance between scale interval boundaries
Definition qwt_scale_map.h:89
Q_DECL_CONSTEXPR double cnv() const noexcept
Conversion factor for linear fast-path: result = p1() + (value - ts1()) * cnv()
Definition qwt_scale_map.h:113
Q_DECL_CONSTEXPR bool isLinear() const noexcept
Check if this scale has no nonlinear transformation
Definition qwt_scale_map.h:107
double invTransform(double p) const
Transform a paint device coordinate to scale value
Definition qwt_scale_map.h:152
Q_DECL_CONSTEXPR double s1() const noexcept
Return first border of scale interval
Definition qwt_scale_map.h:82
Q_DECL_CONSTEXPR bool isInverting() const noexcept
Check if the mapping direction is inverted
Definition qwt_scale_map.h:110