[4272] | 1 | /* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
|
---|
| 2 | * QwtPolar Widget Library
|
---|
| 3 | * Copyright (C) 2008 Uwe Rathmann
|
---|
| 4 | *
|
---|
| 5 | * This library is free software; you can redistribute it and/or
|
---|
| 6 | * modify it under the terms of the Qwt License, Version 1.0
|
---|
| 7 | *****************************************************************************/
|
---|
| 8 |
|
---|
| 9 | #ifndef QWT_POLAR_SPECTROGRAM_H
|
---|
| 10 | #define QWT_POLAR_SPECTROGRAM_H
|
---|
| 11 |
|
---|
| 12 | #include "qwt_polar_global.h"
|
---|
| 13 | #include "qwt_polar_item.h"
|
---|
| 14 | #include <qimage.h>
|
---|
| 15 |
|
---|
| 16 | class QwtRasterData;
|
---|
| 17 | class QwtColorMap;
|
---|
| 18 |
|
---|
| 19 | /*!
|
---|
| 20 | \brief An item, which displays a spectrogram
|
---|
| 21 |
|
---|
| 22 | A spectrogram displays threedimenional data, where the 3rd dimension
|
---|
| 23 | ( the intensity ) is displayed using colors. The colors are calculated
|
---|
| 24 | from the values using a color map.
|
---|
| 25 |
|
---|
| 26 | \sa QwtRasterData, QwtColorMap
|
---|
| 27 | */
|
---|
| 28 | class QWT_POLAR_EXPORT QwtPolarSpectrogram: public QwtPolarItem
|
---|
| 29 | {
|
---|
| 30 | public:
|
---|
| 31 | /*!
|
---|
| 32 | Attributes to modify the drawing algorithm.
|
---|
| 33 | The default setting disables ApproximatedAtan
|
---|
| 34 |
|
---|
| 35 | \sa setPaintAttribute(), testPaintAttribute()
|
---|
| 36 | */
|
---|
| 37 | enum PaintAttribute
|
---|
| 38 | {
|
---|
| 39 | /*!
|
---|
| 40 | Use qwtFastAtan2 instead of atan2 for translating
|
---|
| 41 | widget into polar coordinates.
|
---|
| 42 | */
|
---|
| 43 |
|
---|
| 44 | ApproximatedAtan = 0x01
|
---|
| 45 | };
|
---|
| 46 |
|
---|
| 47 | //! Paint attributes
|
---|
| 48 | typedef QFlags<PaintAttribute> PaintAttributes;
|
---|
| 49 |
|
---|
| 50 | explicit QwtPolarSpectrogram();
|
---|
| 51 | virtual ~QwtPolarSpectrogram();
|
---|
| 52 |
|
---|
| 53 | void setData( QwtRasterData *data );
|
---|
| 54 | const QwtRasterData *data() const;
|
---|
| 55 |
|
---|
| 56 | void setColorMap( QwtColorMap * );
|
---|
| 57 | const QwtColorMap *colorMap() const;
|
---|
| 58 |
|
---|
| 59 | void setPaintAttribute( PaintAttribute, bool on = true );
|
---|
| 60 | bool testPaintAttribute( PaintAttribute ) const;
|
---|
| 61 |
|
---|
| 62 | void setRenderThreadCount( uint numThreads );
|
---|
| 63 | uint renderThreadCount() const;
|
---|
| 64 |
|
---|
| 65 | virtual int rtti() const;
|
---|
| 66 |
|
---|
| 67 | virtual void draw( QPainter *painter,
|
---|
| 68 | const QwtScaleMap &azimuthMap, const QwtScaleMap &radialMap,
|
---|
| 69 | const QPointF &pole, double radius,
|
---|
| 70 | const QRectF &canvasRect ) const;
|
---|
| 71 |
|
---|
| 72 | virtual QwtInterval boundingInterval( int scaleId ) const;
|
---|
| 73 |
|
---|
| 74 | protected:
|
---|
| 75 | virtual QImage renderImage(
|
---|
| 76 | const QwtScaleMap &azimuthMap, const QwtScaleMap &radialMap,
|
---|
| 77 | const QPointF &pole, const QRect &rect ) const;
|
---|
| 78 |
|
---|
| 79 | virtual void renderTile(
|
---|
| 80 | const QwtScaleMap &azimuthMap, const QwtScaleMap &radialMap,
|
---|
| 81 | const QPointF &pole, const QPoint &imagePos,
|
---|
| 82 | const QRect &tile, QImage *image ) const;
|
---|
| 83 |
|
---|
| 84 | private:
|
---|
| 85 | class TileInfo;
|
---|
| 86 | void renderTile( const QwtScaleMap &, const QwtScaleMap &,
|
---|
| 87 | const QPointF &pole, TileInfo * ) const;
|
---|
| 88 |
|
---|
| 89 | class PrivateData;
|
---|
| 90 | PrivateData *d_data;
|
---|
| 91 | };
|
---|
| 92 |
|
---|
| 93 | Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPolarSpectrogram::PaintAttributes )
|
---|
| 94 |
|
---|
| 95 | #endif
|
---|