Qwt User's Guide: QwtScaleMap Class Reference

Qwt User's Guide 6.1.5

Public Member Functions | Static Public Member Functions | List of all members
QwtScaleMap Class Reference

A scale map. More...

`#include <qwt_scale_map.h>`

## Public Member Functions
| QwtScaleMap ()
| Constructor. More...
| QwtScaleMap (const QwtScaleMap &)
| Copy constructor.
| ~QwtScaleMap ()
QwtScaleMap & | operator= (const QwtScaleMap &)
| Assignment operator.
void | setTransformation (QwtTransform *)
const QwtTransform * | transformation () const
| Get the transformation.
void | setPaintInterval (double p1, double p2)
| Specify the borders of the paint device interval. More...
void | setScaleInterval (double s1, double s2)
| Specify the borders of the scale interval. More...
double | transform (double s) const
double | invTransform (double p) const
double | p1 () const
double | p2 () const
double | s1 () const
double | s2 () const
double | pDist () const
double | sDist () const
bool | isInverting () const

## Static Public Member Functions
static QRectF | transform (const QwtScaleMap &, const QwtScaleMap &, const QRectF &)
static QRectF | invTransform (const QwtScaleMap &, const QwtScaleMap &, const QRectF &)
static QPointF | transform (const QwtScaleMap &, const QwtScaleMap &, const QPointF &)
static QPointF | invTransform (const QwtScaleMap &, const QwtScaleMap &, const QPointF &)

## 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.

## Constructor & Destructor Documentation

## ◆ QwtScaleMap()

QwtScaleMap::QwtScaleMap | ( |  | ) |

Constructor.

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

## ◆ ~QwtScaleMap()

QwtScaleMap::~QwtScaleMap | ( |  | ) |

Destructor

## Member Function Documentation

## ◆ invTransform() [1/3]

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

Transform a rectangle from paint to scale coordinates

Parameters

  xMap | X map
  yMap | Y map
  pos | Position 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

  xMap | X map
  yMap | Y map
  rect | Rectangle in paint coordinates

Returns
  Rectangle in scale coordinates

See also
  transform()

## ◆ invTransform() [3/3]

double QwtScaleMap::invTransform | ( | double | p | ) | const
| inline

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

Parameters

  p | Value relative to the coordinates of the paint device

Returns
  Transformed value

See also
  transform()

## ◆ isInverting()

bool QwtScaleMap::isInverting | ( |  | ) | const
| inline

Returns
  True, when ( p1() < p2() ) != ( s1() < s2() )

## ◆ p1()

double QwtScaleMap::p1 | ( |  | ) | const
| inline

Returns
  First border of the paint interval

## ◆ p2()

double QwtScaleMap::p2 | ( |  | ) | const
| inline

Returns
  Second border of the paint interval

## ◆ pDist()

double QwtScaleMap::pDist | ( |  | ) | const
| inline

Returns
  qwtAbs(p2() - p1())

## ◆ s1()

double QwtScaleMap::s1 | ( |  | ) | const
| inline

Returns
  First border of the scale interval

## ◆ s2()

double QwtScaleMap::s2 | ( |  | ) | const
| inline

Returns
  Second border of the scale interval

## ◆ sDist()

double QwtScaleMap::sDist | ( |  | ) | const
| inline

Returns
  qwtAbs(s2() - s1())

## ◆ setPaintInterval()

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

Specify the borders of the paint device interval.

Parameters

  p1 | first border
  p2 | second border

## ◆ setScaleInterval()

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

Specify the borders of the scale interval.

Parameters

  s1 | first border
  s2 | second border

Warning
  scales might be aligned to transformation depending boundaries

## ◆ setTransformation()

void QwtScaleMap::setTransformation | ( | QwtTransform * | transform | ) |

Initialize the map with a transformation

## ◆ 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

  xMap | X map
  yMap | Y map
  pos | Position 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

  xMap | X map
  yMap | Y map
  rect | Rectangle in scale coordinates

Returns
  Rectangle in paint coordinates

See also
  invTransform()

## ◆ transform() [3/3]

double QwtScaleMap::transform | ( | double | s | ) | const
| inline

Transform a point related to the scale interval into an point related to the interval of the paint device

Parameters

  s | Value relative to the coordinates of the scale

Returns
  Transformed value

See also
  invTransform()