|
QWT API (English) 7.3.0
Qt Widget Library for Technical Applications - English API Documentation
|
A helper class for translating a series of points. More...
#include <qwt_point_mapper.h>
Classes | |
| class | PrivateData |
Public Types | |
| enum | TransformationFlag { RoundPoints = 0x01 , WeedOutPoints = 0x02 , WeedOutIntermediatePoints = 0x04 , PixelColumnReduce = 0x08 , MinMaxReduce = 0x10 } |
| Flags affecting the transformation process. More... | |
Public Member Functions | |
| QwtPointMapper () | |
| Constructor. | |
| void | setFlags (TransformationFlags) |
| Set the flags affecting the transformation process. | |
| TransformationFlags | flags () const |
| Get the flags affecting the transformation process. | |
| void | setFlag (TransformationFlag, bool on=true) |
| Modify a flag affecting the transformation process. | |
| bool | testFlag (TransformationFlag) const |
| Test if a flag is set. | |
| void | setBoundingRect (const QRectF &) |
| Set a bounding rectangle for the point mapping algorithm. | |
| QRectF | boundingRect () const |
| Get the bounding rectangle. | |
| 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. | |
| 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. | |
| 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 (scattered points) | |
| QPolygonF | toPointsF (const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QwtSeriesData< QPointF > *series, int from, int to) const |
| Translate a series into a QPolygonF (scattered points) | |
| 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. | |
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>.
Flags affecting the transformation process.
| Enumerator | |
|---|---|
| RoundPoints | Round points to integer values. |
| WeedOutPoints | Try to remove points, that are translated to the same position. |
| WeedOutIntermediatePoints | An even more aggressive weeding algorithm. An even more aggressive weeding algorithm, that can be used in toPolygon(). A consecutive chunk of points being mapped to the same x coordinate is reduced to 4 points:
In the worst case (first and last points are never one of the extremes) the number of points will be 4 times the width. As the algorithm is fast it can be used inside of a polyline render cycle. |
| PixelColumnReduce | Pixel-column based downsampling. Allocates a bin array indexed by pixel column and stores first/min/max/last Y per column. Output is at most 4 points per column. Requires a valid boundingRect() to determine the canvas width. Overrides WeedOutIntermediatePoints when both are set. |
| MinMaxReduce | MinMax bucket downsampling. Divides the visible data into equal-count buckets and keeps the min-Y and max-Y point from each bucket. Target bucket count is derived from boundingRect() width. Overrides WeedOutIntermediatePoints when both are set. |
| QwtPointMapper::QwtPointMapper | ( | ) |
Constructor.
Creates a QwtPointMapper with default settings.
Destructor
Destroys the QwtPointMapper and frees all allocated resources.
| QRectF QwtPointMapper::boundingRect | ( | ) | const |
| QwtPointMapper::TransformationFlags QwtPointMapper::flags | ( | ) | const |
Get the flags affecting the transformation process.
| void QwtPointMapper::setBoundingRect | ( | const QRectF & | rect | ) |
Set a bounding rectangle for the point mapping algorithm.
A valid bounding rectangle can be used for optimizations.
| [in] | rect | Bounding rectangle |
| void QwtPointMapper::setFlag | ( | TransformationFlag | flag, |
| bool | on = true |
||
| ) |
Modify a flag affecting the transformation process.
| [in] | flag | Flag type |
| [in] | on | Value |
| void QwtPointMapper::setFlags | ( | TransformationFlags | flags | ) |
| bool QwtPointMapper::testFlag | ( | TransformationFlag | flag | ) | const |
Test if a flag is set.
| [in] | flag | Flag type |
| 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.
| [in] | xMap | x map |
| [in] | yMap | y map |
| [in] | series | Series of points to be mapped |
| [in] | from | Index of the first point to be painted |
| [in] | to | Index of the last point to be painted |
| [in] | pen | Pen used for drawing a point of the image, where a point is mapped to |
| [in] | antialiased | True when the dots should be displayed antialiased |
| [in] | numThreads | Number of threads to be used for rendering. If numThreads is set to 0, the system specific ideal thread count is used. |
| 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 (scattered points)
| [in] | xMap | x map |
| [in] | yMap | y map |
| [in] | series | Series of points to be mapped |
| [in] | from | Index of the first point to be painted |
| [in] | to | Index of the last point to be painted |
| QPolygonF QwtPointMapper::toPointsF | ( | const QwtScaleMap & | xMap, |
| const QwtScaleMap & | yMap, | ||
| const QwtSeriesData< QPointF > * | series, | ||
| int | from, | ||
| int | to | ||
| ) | const |
Translate a series into a QPolygonF (scattered points)
!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.
| [in] | xMap | x map |
| [in] | yMap | y map |
| [in] | series | Series of points to be mapped |
| [in] | from | Index of the first point to be painted |
| [in] | to | Index of the last point to be painted |
| 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.
| [in] | xMap | x map |
| [in] | yMap | y map |
| [in] | series | Series of points to be mapped |
| [in] | from | Index of the first point to be painted |
| [in] | to | Index of the last point to be painted |
| 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. When RoundPoints & WeedOutIntermediatePoints is enabled, an even more aggressive weeding algorithm is enabled.
| [in] | xMap | x map |
| [in] | yMap | y map |
| [in] | series | Series of points to be mapped |
| [in] | from | Index of the first point to be painted |
| [in] | to | Index of the last point to be painted |