[4271] | 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_PLOT_SPECTROGRAM_H
|
---|
| 11 | #define QWT_PLOT_SPECTROGRAM_H
|
---|
| 12 |
|
---|
| 13 | #include "qwt_global.h"
|
---|
| 14 | #include "qwt_raster_data.h"
|
---|
| 15 | #include "qwt_plot_rasteritem.h"
|
---|
| 16 | #include <qlist.h>
|
---|
| 17 |
|
---|
| 18 | class QwtColorMap;
|
---|
| 19 |
|
---|
| 20 | /*!
|
---|
| 21 | \brief A plot item, which displays a spectrogram
|
---|
| 22 |
|
---|
[8127] | 23 | A spectrogram displays 3-dimensional data, where the 3rd dimension
|
---|
[4271] | 24 | ( the intensity ) is displayed using colors. The colors are calculated
|
---|
| 25 | from the values using a color map.
|
---|
| 26 |
|
---|
[8127] | 27 | On multi-core systems the performance of the image composition
|
---|
| 28 | can often be improved by dividing the area into tiles - each of them
|
---|
| 29 | rendered in a different thread ( see QwtPlotItem::setRenderThreadCount() ).
|
---|
| 30 |
|
---|
[4271] | 31 | In ContourMode contour lines are painted for the contour levels.
|
---|
| 32 |
|
---|
| 33 | \image html spectrogram3.png
|
---|
| 34 |
|
---|
[8127] | 35 | \sa QwtRasterData, QwtColorMap, QwtPlotItem::setRenderThreadCount()
|
---|
[4271] | 36 | */
|
---|
| 37 |
|
---|
| 38 | class QWT_EXPORT QwtPlotSpectrogram: public QwtPlotRasterItem
|
---|
| 39 | {
|
---|
| 40 | public:
|
---|
| 41 | /*!
|
---|
| 42 | The display mode controls how the raster data will be represented.
|
---|
| 43 | \sa setDisplayMode(), testDisplayMode()
|
---|
| 44 | */
|
---|
| 45 |
|
---|
| 46 | enum DisplayMode
|
---|
| 47 | {
|
---|
| 48 | //! The values are mapped to colors using a color map.
|
---|
| 49 | ImageMode = 0x01,
|
---|
| 50 |
|
---|
| 51 | //! The data is displayed using contour lines
|
---|
| 52 | ContourMode = 0x02
|
---|
| 53 | };
|
---|
| 54 |
|
---|
| 55 | //! Display modes
|
---|
| 56 | typedef QFlags<DisplayMode> DisplayModes;
|
---|
| 57 |
|
---|
[9383] | 58 | explicit QwtPlotSpectrogram( const QString &title = QString() );
|
---|
[4271] | 59 | virtual ~QwtPlotSpectrogram();
|
---|
| 60 |
|
---|
| 61 | void setDisplayMode( DisplayMode, bool on = true );
|
---|
| 62 | bool testDisplayMode( DisplayMode ) const;
|
---|
| 63 |
|
---|
| 64 | void setData( QwtRasterData *data );
|
---|
| 65 | const QwtRasterData *data() const;
|
---|
| 66 | QwtRasterData *data();
|
---|
| 67 |
|
---|
| 68 | void setColorMap( QwtColorMap * );
|
---|
| 69 | const QwtColorMap *colorMap() const;
|
---|
| 70 |
|
---|
| 71 | virtual QwtInterval interval(Qt::Axis) const;
|
---|
| 72 | virtual QRectF pixelHint( const QRectF & ) const;
|
---|
| 73 |
|
---|
[9383] | 74 | void setDefaultContourPen( const QColor &,
|
---|
[8127] | 75 | qreal width = 0.0, Qt::PenStyle = Qt::SolidLine );
|
---|
[4271] | 76 | void setDefaultContourPen( const QPen & );
|
---|
| 77 | QPen defaultContourPen() const;
|
---|
| 78 |
|
---|
| 79 | virtual QPen contourPen( double level ) const;
|
---|
| 80 |
|
---|
| 81 | void setConrecFlag( QwtRasterData::ConrecFlag, bool on );
|
---|
| 82 | bool testConrecFlag( QwtRasterData::ConrecFlag ) const;
|
---|
| 83 |
|
---|
| 84 | void setContourLevels( const QList<double> & );
|
---|
| 85 | QList<double> contourLevels() const;
|
---|
| 86 |
|
---|
| 87 | virtual int rtti() const;
|
---|
| 88 |
|
---|
[9383] | 89 | virtual void draw( QPainter *,
|
---|
[4271] | 90 | const QwtScaleMap &xMap, const QwtScaleMap &yMap,
|
---|
[9383] | 91 | const QRectF &canvasRect ) const;
|
---|
[4271] | 92 |
|
---|
| 93 | protected:
|
---|
| 94 | virtual QImage renderImage(
|
---|
| 95 | const QwtScaleMap &xMap, const QwtScaleMap &yMap,
|
---|
| 96 | const QRectF &area, const QSize &imageSize ) const;
|
---|
| 97 |
|
---|
| 98 | virtual QSize contourRasterSize(
|
---|
| 99 | const QRectF &, const QRect & ) const;
|
---|
| 100 |
|
---|
| 101 | virtual QwtRasterData::ContourLines renderContourLines(
|
---|
| 102 | const QRectF &rect, const QSize &raster ) const;
|
---|
| 103 |
|
---|
[9383] | 104 | virtual void drawContourLines( QPainter *,
|
---|
[4271] | 105 | const QwtScaleMap &xMap, const QwtScaleMap &yMap,
|
---|
[9383] | 106 | const QwtRasterData::ContourLines& ) const;
|
---|
[4271] | 107 |
|
---|
| 108 | void renderTile( const QwtScaleMap &xMap, const QwtScaleMap &yMap,
|
---|
[9383] | 109 | const QRect &tile, QImage * ) const;
|
---|
[4271] | 110 |
|
---|
| 111 | private:
|
---|
| 112 | class PrivateData;
|
---|
| 113 | PrivateData *d_data;
|
---|
| 114 | };
|
---|
| 115 |
|
---|
| 116 | Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPlotSpectrogram::DisplayModes )
|
---|
| 117 |
|
---|
| 118 | #endif
|
---|