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

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

Public Member Functions

QRectF boundingRect () const
 
TransformationFlags flags () const
 
 QwtPointMapper ()
 Constructor. More...
 
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. 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...
 
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...
 
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...
 
 ~QwtPointMapper ()
 Destructor. More...
 

Private Attributes

PrivateDatam_data
 

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

Definition at line 32 of file qwt_point_mapper.h.

Member Enumeration Documentation

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

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:

  • first point
  • point with the minimum y coordinate
  • point with the maximum y coordinate
  • last point

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 39 of file qwt_point_mapper.h.

Constructor & Destructor Documentation

◆ QwtPointMapper()

QwtPointMapper::QwtPointMapper ( )

Constructor.

Definition at line 547 of file qwt_point_mapper.cpp.

◆ ~QwtPointMapper()

QwtPointMapper::~QwtPointMapper ( )

Destructor.

Definition at line 553 of file qwt_point_mapper.cpp.

Member Function Documentation

◆ boundingRect()

QRectF QwtPointMapper::boundingRect ( ) const
Returns
Bounding rectangle
See also
setBoundingRect()

Definition at line 621 of file qwt_point_mapper.cpp.

◆ flags()

QwtPointMapper::TransformationFlags QwtPointMapper::flags ( ) const
Returns
Flags affecting the transformation process
See also
setFlags(), setFlag()

Definition at line 573 of file qwt_point_mapper.cpp.

◆ setBoundingRect()

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
rectBounding rectangle
See also
boundingRect()

Definition at line 612 of file qwt_point_mapper.cpp.

◆ setFlag()

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

Modify a flag affecting the transformation process

Parameters
flagFlag type
onValue
See also
flag(), setFlags()

Definition at line 586 of file qwt_point_mapper.cpp.

◆ setFlags()

void QwtPointMapper::setFlags ( TransformationFlags  flags)

Set the flags affecting the transformation process

Parameters
flagsFlags
See also
flags(), setFlag()

Definition at line 564 of file qwt_point_mapper.cpp.

◆ testFlag()

bool QwtPointMapper::testFlag ( TransformationFlag  flag) const
Returns
True, when the flag is set
Parameters
flagFlag type
See also
setFlag(), setFlags()

Definition at line 599 of file qwt_point_mapper.cpp.

◆ toImage()

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
xMapx map
yMapy map
seriesSeries of points to be mapped
fromIndex of the first point to be painted
toIndex of the last point to be painted
penPen used for drawing a point of the image, where a point is mapped to
antialiasedTrue, when the dots should be displayed antialiased
numThreadsNumber 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

Definition at line 883 of file qwt_point_mapper.cpp.

◆ toPoints()

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
xMapx map
yMapy map
seriesSeries of points to be mapped
fromIndex of the first point to be painted
toIndex of the last point to be painted
Returns
Translated polygon

Definition at line 833 of file qwt_point_mapper.cpp.

◆ toPointsF()

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
xMapx map
yMapy map
seriesSeries of points to be mapped
fromIndex of the first point to be painted
toIndex of the last point to be painted
Returns
Translated polygon

Definition at line 759 of file qwt_point_mapper.cpp.

◆ toPolygon()

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
xMapx map
yMapy map
seriesSeries of points to be mapped
fromIndex of the first point to be painted
toIndex of the last point to be painted
Returns
Translated polygon

Definition at line 702 of file qwt_point_mapper.cpp.

◆ toPolygonF()

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.

Parameters
xMapx map
yMapy map
seriesSeries of points to be mapped
fromIndex of the first point to be painted
toIndex of the last point to be painted
Returns
Translated polygon

Definition at line 647 of file qwt_point_mapper.cpp.

Member Data Documentation

◆ m_data

PrivateData* QwtPointMapper::m_data
private

Definition at line 104 of file qwt_point_mapper.h.


The documentation for this class was generated from the following files:


plotjuggler
Author(s): Davide Faconti
autogenerated on Mon Nov 11 2024 03:23:51