[8127] | 1 | /* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
|
---|
| 2 | * Qwt Widget Library
|
---|
| 3 | * Copyright (C) 1997 Josef Wilgen
|
---|
| 4 | * Copyright (C) 2002 Uwe Rathmann
|
---|
| 5 | *
|
---|
| 6 | * This library is free software; you can redistribute it and/or
|
---|
| 7 | * modify it under the terms of the Qwt License, Version 1.0
|
---|
| 8 | *****************************************************************************/
|
---|
| 9 |
|
---|
| 10 | #ifndef QWT_POINT_MAPPER_H
|
---|
| 11 | #define QWT_POINT_MAPPER_H
|
---|
| 12 |
|
---|
| 13 | #include "qwt_global.h"
|
---|
| 14 | #include "qwt_series_data.h"
|
---|
| 15 | #include <qimage.h>
|
---|
| 16 |
|
---|
| 17 | class QwtScaleMap;
|
---|
| 18 | class QPolygonF;
|
---|
| 19 | class QPolygon;
|
---|
| 20 |
|
---|
| 21 | /*!
|
---|
| 22 | \brief A helper class for translating a series of points
|
---|
| 23 |
|
---|
| 24 | QwtPointMapper is a collection of methods and optimizations
|
---|
[9383] | 25 | for translating a series of points into paint device coordinates.
|
---|
| 26 | It is used by QwtPlotCurve but might also be useful for
|
---|
[8127] | 27 | similar plot items displaying a QwtSeriesData<QPointF>.
|
---|
| 28 | */
|
---|
| 29 | class QWT_EXPORT QwtPointMapper
|
---|
| 30 | {
|
---|
| 31 | public:
|
---|
[9383] | 32 | /*!
|
---|
[8127] | 33 | \brief Flags affecting the transformation process
|
---|
| 34 | \sa setFlag(), setFlags()
|
---|
| 35 | */
|
---|
| 36 | enum TransformationFlag
|
---|
| 37 | {
|
---|
| 38 | //! Round points to integer values
|
---|
| 39 | RoundPoints = 0x01,
|
---|
| 40 |
|
---|
[9383] | 41 | /*!
|
---|
[8127] | 42 | Try to remove points, that are translated to the
|
---|
| 43 | same position.
|
---|
| 44 | */
|
---|
| 45 | WeedOutPoints = 0x02
|
---|
| 46 | };
|
---|
| 47 |
|
---|
[9383] | 48 | /*!
|
---|
[8127] | 49 | \brief Flags affecting the transformation process
|
---|
| 50 | \sa setFlag(), setFlags()
|
---|
| 51 | */
|
---|
| 52 | typedef QFlags<TransformationFlag> TransformationFlags;
|
---|
| 53 |
|
---|
| 54 | QwtPointMapper();
|
---|
| 55 | ~QwtPointMapper();
|
---|
| 56 |
|
---|
| 57 | void setFlags( TransformationFlags );
|
---|
| 58 | TransformationFlags flags() const;
|
---|
| 59 |
|
---|
| 60 | void setFlag( TransformationFlag, bool on = true );
|
---|
| 61 | bool testFlag( TransformationFlag ) const;
|
---|
| 62 |
|
---|
| 63 | void setBoundingRect( const QRectF & );
|
---|
| 64 | QRectF boundingRect() const;
|
---|
| 65 |
|
---|
| 66 | QPolygonF toPolygonF( const QwtScaleMap &xMap, const QwtScaleMap &yMap,
|
---|
| 67 | const QwtSeriesData<QPointF> *series, int from, int to ) const;
|
---|
| 68 |
|
---|
| 69 | QPolygon toPolygon( const QwtScaleMap &xMap, const QwtScaleMap &yMap,
|
---|
| 70 | const QwtSeriesData<QPointF> *series, int from, int to ) const;
|
---|
| 71 |
|
---|
| 72 | QPolygon toPoints( const QwtScaleMap &xMap, const QwtScaleMap &yMap,
|
---|
| 73 | const QwtSeriesData<QPointF> *series, int from, int to ) const;
|
---|
| 74 |
|
---|
| 75 | QPolygonF toPointsF( const QwtScaleMap &xMap, const QwtScaleMap &yMap,
|
---|
| 76 | const QwtSeriesData<QPointF> *series, int from, int to ) const;
|
---|
| 77 |
|
---|
| 78 | QImage toImage( const QwtScaleMap &xMap, const QwtScaleMap &yMap,
|
---|
[9383] | 79 | const QwtSeriesData<QPointF> *series, int from, int to,
|
---|
[8127] | 80 | const QPen &, bool antialiased, uint numThreads ) const;
|
---|
| 81 |
|
---|
| 82 | private:
|
---|
| 83 | class PrivateData;
|
---|
| 84 | PrivateData *d_data;
|
---|
| 85 | };
|
---|
| 86 |
|
---|
| 87 | Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPointMapper::TransformationFlags )
|
---|
| 88 |
|
---|
| 89 | #endif
|
---|