Qwt User's Guide 6.1.3

- Main Page
- Classes

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Types | Public Member Functions | List of all members
QwtPointMapper Class Reference

A helper class for translating a series of points. More...

`#include <qwt_point_mapper.h>`

## Public Types
enum | TransformationFlag { RoundPoints = 0x01, WeedOutPoints = 0x02 }
| Flags affecting the transformation process. More...
typedef QFlags< TransformationFlag > | TransformationFlags
| Flags affecting the transformation process. More...

## Public Member Functions
| QwtPointMapper ()
| Constructor.
| ~QwtPointMapper ()
| Destructor.
void | setFlags (TransformationFlags)
TransformationFlags | flags () const
void | setFlag (TransformationFlag, bool on=true)
bool | testFlag (TransformationFlag) const
void | setBoundingRect (const QRectF &)
QRectF | boundingRect () const
QPolygonF | toPolygonF (const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QwtSeriesData< QPointF > *series, int from, int to) const
| Translate a series of points into a QPolygonF. More...
QPolygon | toPolygon (const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QwtSeriesData< QPointF > *series, int from, int to) const
| Translate a series of points into a QPolygon. More...
QPolygon | toPoints (const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QwtSeriesData< QPointF > *series, int from, int to) const
| Translate a series of points into a QPolygon. More...
QPolygonF | toPointsF (const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QwtSeriesData< QPointF > *series, int from, int to) const
| Translate a series into a QPolygonF. More...
QImage | toImage (const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QwtSeriesData< QPointF > *series, int from, int to, const QPen &, bool antialiased, uint numThreads) const
| Translate a series into a QImage. More...

## Detailed Description

A helper class for translating a series of points.

QwtPointMapper is a collection of methods and optimizations for translating a series of points into paint device coordinates. It is used by QwtPlotCurve but might also be useful for similar plot items displaying a QwtSeriesData<QPointF>.

## Member Typedef Documentation

typedef QFlags<TransformationFlag> QwtPointMapper::TransformationFlags

Flags affecting the transformation process.

See also
  setFlag(), setFlags()

## Member Enumeration Documentation

enum QwtPointMapper::TransformationFlag

Flags affecting the transformation process.

See also
  setFlag(), setFlags()

Enumerator
RoundPoints | Round points to integer values.
WeedOutPoints | Try to remove points, that are translated to the same position.

## Member Function Documentation

QRectF QwtPointMapper::boundingRect | ( |  | ) | const

Returns
  Bounding rectangle

See also
  setBoundingRect()

QwtPointMapper::TransformationFlags QwtPointMapper::flags | ( |  | ) | const

Returns
  Flags affecting the transformation process

See also
  setFlags(), setFlag()

void QwtPointMapper::setBoundingRect | ( | const QRectF & | rect | ) |

Set a bounding rectangle for the point mapping algorithm

A valid bounding rectangle can be used for optimizations

Parameters

  rect | Bounding rectangle

See also
  boundingRect()

void QwtPointMapper::setFlag | ( | TransformationFlag | flag,
|  | bool | on = `true`
| ) |  |

Modify a flag affecting the transformation process

Parameters

  flag | Flag type
  on | Value

See also
  flag(), setFlags()

void QwtPointMapper::setFlags | ( | TransformationFlags | flags | ) |

Set the flags affecting the transformation process

Parameters

  flags | Flags

See also
  flags(), setFlag()

bool QwtPointMapper::testFlag | ( | TransformationFlag | flag | ) | const

Returns
  True, when the flag is set

Parameters

  flag | Flag type

See also
  setFlag(), setFlags()

QImage QwtPointMapper::toImage | ( | const QwtScaleMap & | xMap,
|  | const QwtScaleMap & | yMap,
|  | const QwtSeriesData< QPointF > * | series,
|  | int | from,
|  | int | to,
|  | const QPen & | pen,
|  | bool | antialiased,
|  | uint | numThreads
| ) |  | const

Translate a series into a QImage.

Parameters

  xMap | x map
  yMap | y map
  series | Series of points to be mapped
  from | Index of the first point to be painted
  to | Index of the last point to be painted
  pen | Pen used for drawing a point of the image, where a point is mapped to
  antialiased | True, when the dots should be displayed antialiased
  numThreads | Number of threads to be used for rendering. If numThreads is set to 0, the system specific ideal thread count is used.

Returns
  Image displaying the series

QPolygon QwtPointMapper::toPoints | ( | const QwtScaleMap & | xMap,
|  | const QwtScaleMap & | yMap,
|  | const QwtSeriesData< QPointF > * | series,
|  | int | from,
|  | int | to
| ) |  | const

Translate a series of points into a QPolygon.

- WeedOutPoints & boundingRect().isValid() All points that are mapped to the same position will be one point. Points outside of the bounding rectangle are ignored.
- WeedOutPoints & !boundingRect().isValid() All consecutive points that are mapped to the same position will one point
- !WeedOutPoints & boundingRect().isValid() Points outside of the bounding rectangle are ignored.

Parameters

  xMap | x map
  yMap | y map
  series | Series of points to be mapped
  from | Index of the first point to be painted
  to | Index of the last point to be painted

Returns
  Translated polygon

QPolygonF QwtPointMapper::toPointsF | ( | const QwtScaleMap & | xMap,
|  | const QwtScaleMap & | yMap,
|  | const QwtSeriesData< QPointF > * | series,
|  | int | from,
|  | int | to
| ) |  | const

Translate a series into a QPolygonF.

- WeedOutPoints & RoundPoints & boundingRect().isValid() All points that are mapped to the same position will be one point. Points outside of the bounding rectangle are ignored.
- WeedOutPoints & RoundPoints & !boundingRect().isValid() All consecutive points that are mapped to the same position will one point
- WeedOutPoints & !RoundPoints All consecutive points that are mapped to the same position will one point
- !WeedOutPoints & boundingRect().isValid() Points outside of the bounding rectangle are ignored.

When RoundPoints is set all points are rounded to integers but returned as PolygonF - what only makes sense when the further processing of the values need a QPolygonF.

Parameters

  xMap | x map
  yMap | y map
  series | Series of points to be mapped
  from | Index of the first point to be painted
  to | Index of the last point to be painted

Returns
  Translated polygon

QPolygon QwtPointMapper::toPolygon | ( | const QwtScaleMap & | xMap,
|  | const QwtScaleMap & | yMap,
|  | const QwtSeriesData< QPointF > * | series,
|  | int | from,
|  | int | to
| ) |  | const

Translate a series of points into a QPolygon.

When the WeedOutPoints flag is enabled consecutive points, that are mapped to the same position will be one point.

Parameters

  xMap | x map
  yMap | y map
  series | Series of points to be mapped
  from | Index of the first point to be painted
  to | Index of the last point to be painted

Returns
  Translated polygon

QPolygonF QwtPointMapper::toPolygonF | ( | const QwtScaleMap & | xMap,
|  | const QwtScaleMap & | yMap,
|  | const QwtSeriesData< QPointF > * | series,
|  | int | from,
|  | int | to
| ) |  | const

Translate a series of points into a QPolygonF.

When the WeedOutPoints flag is enabled consecutive points, that are mapped to the same position will be one point.

When RoundPoints is set all points are rounded to integers but returned as PolygonF - what only makes sense when the further processing of the values need a QPolygonF.

Parameters

  xMap | x map
  yMap | y map
  series | Series of points to be mapped
  from | Index of the first point to be painted
  to | Index of the last point to be painted

Returns
  Translated polygon