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 } |
Flags affecting the transformation process. More... | |
typedef QFlags < TransformationFlag > | TransformationFlags |
Flags affecting the transformation process. | |
Public Member Functions | |
QRectF | boundingRect () const |
TransformationFlags | flags () const |
QwtPointMapper () | |
Constructor. | |
void | setBoundingRect (const QRectF &) |
void | setFlag (TransformationFlag, bool on=true) |
void | setFlags (TransformationFlags) |
bool | testFlag (TransformationFlag) const |
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. | |
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. | |
QPolygonF | toPointsF (const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QwtSeriesData< QPointF > *series, int from, int to) const |
Translate a series 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. | |
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. | |
~QwtPointMapper () | |
Destructor. | |
Private Attributes | |
PrivateData * | d_data |
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>.
Definition at line 29 of file qwt_point_mapper.h.
typedef QFlags<TransformationFlag> QwtPointMapper::TransformationFlags |
Flags affecting the transformation process.
Definition at line 72 of file qwt_point_mapper.h.
Flags affecting the transformation process.
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, 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. |
Definition at line 36 of file qwt_point_mapper.h.
Constructor.
Definition at line 541 of file qwt_point_mapper.cpp.
Destructor.
Definition at line 547 of file qwt_point_mapper.cpp.
QRectF QwtPointMapper::boundingRect | ( | ) | const |
Definition at line 615 of file qwt_point_mapper.cpp.
Definition at line 567 of file qwt_point_mapper.cpp.
void QwtPointMapper::setBoundingRect | ( | const QRectF & | rect | ) |
Set a bounding rectangle for the point mapping algorithm
A valid bounding rectangle can be used for optimizations
rect | Bounding rectangle |
Definition at line 606 of file qwt_point_mapper.cpp.
void QwtPointMapper::setFlag | ( | TransformationFlag | flag, |
bool | on = true |
||
) |
Modify a flag affecting the transformation process
flag | Flag type |
on | Value |
Definition at line 580 of file qwt_point_mapper.cpp.
void QwtPointMapper::setFlags | ( | TransformationFlags | flags | ) |
Set the flags affecting the transformation process
flags | Flags |
Definition at line 558 of file qwt_point_mapper.cpp.
bool QwtPointMapper::testFlag | ( | TransformationFlag | flag | ) | const |
flag | Flag type |
Definition at line 593 of file qwt_point_mapper.cpp.
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.
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. |
Definition at line 877 of file qwt_point_mapper.cpp.
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.
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 |
Definition at line 827 of file qwt_point_mapper.cpp.
QPolygonF QwtPointMapper::toPointsF | ( | const QwtScaleMap & | xMap, |
const QwtScaleMap & | yMap, | ||
const QwtSeriesData< QPointF > * | series, | ||
int | from, | ||
int | to | ||
) | const |
Translate a series into a QPolygonF.
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.
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 |
Definition at line 753 of file qwt_point_mapper.cpp.
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.
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 |
Definition at line 696 of file qwt_point_mapper.cpp.
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.
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 |
Definition at line 641 of file qwt_point_mapper.cpp.
PrivateData* QwtPointMapper::d_data [private] |
Definition at line 105 of file qwt_point_mapper.h.