[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 |
|
---|
| 23 | A spectrogram displays threedimenional data, where the 3rd dimension
|
---|
| 24 | ( the intensity ) is displayed using colors. The colors are calculated
|
---|
| 25 | from the values using a color map.
|
---|
| 26 |
|
---|
| 27 | In ContourMode contour lines are painted for the contour levels.
|
---|
| 28 |
|
---|
| 29 | \image html spectrogram3.png
|
---|
| 30 |
|
---|
| 31 | \sa QwtRasterData, QwtColorMap
|
---|
| 32 | */
|
---|
| 33 |
|
---|
| 34 | class QWT_EXPORT QwtPlotSpectrogram: public QwtPlotRasterItem
|
---|
| 35 | {
|
---|
| 36 | public:
|
---|
| 37 | /*!
|
---|
| 38 | The display mode controls how the raster data will be represented.
|
---|
| 39 | \sa setDisplayMode(), testDisplayMode()
|
---|
| 40 | */
|
---|
| 41 |
|
---|
| 42 | enum DisplayMode
|
---|
| 43 | {
|
---|
| 44 | //! The values are mapped to colors using a color map.
|
---|
| 45 | ImageMode = 0x01,
|
---|
| 46 |
|
---|
| 47 | //! The data is displayed using contour lines
|
---|
| 48 | ContourMode = 0x02
|
---|
| 49 | };
|
---|
| 50 |
|
---|
| 51 | //! Display modes
|
---|
| 52 | typedef QFlags<DisplayMode> DisplayModes;
|
---|
| 53 |
|
---|
| 54 | explicit QwtPlotSpectrogram( const QString &title = QString::null );
|
---|
| 55 | virtual ~QwtPlotSpectrogram();
|
---|
| 56 |
|
---|
| 57 | void setRenderThreadCount( uint numThreads );
|
---|
| 58 | uint renderThreadCount() const;
|
---|
| 59 |
|
---|
| 60 | void setDisplayMode( DisplayMode, bool on = true );
|
---|
| 61 | bool testDisplayMode( DisplayMode ) const;
|
---|
| 62 |
|
---|
| 63 | void setData( QwtRasterData *data );
|
---|
| 64 | const QwtRasterData *data() const;
|
---|
| 65 | QwtRasterData *data();
|
---|
| 66 |
|
---|
| 67 | void setColorMap( QwtColorMap * );
|
---|
| 68 | const QwtColorMap *colorMap() const;
|
---|
| 69 |
|
---|
| 70 | virtual QwtInterval interval(Qt::Axis) const;
|
---|
| 71 | virtual QRectF pixelHint( const QRectF & ) const;
|
---|
| 72 |
|
---|
| 73 | void setDefaultContourPen( const QPen & );
|
---|
| 74 | QPen defaultContourPen() const;
|
---|
| 75 |
|
---|
| 76 | virtual QPen contourPen( double level ) const;
|
---|
| 77 |
|
---|
| 78 | void setConrecFlag( QwtRasterData::ConrecFlag, bool on );
|
---|
| 79 | bool testConrecFlag( QwtRasterData::ConrecFlag ) const;
|
---|
| 80 |
|
---|
| 81 | void setContourLevels( const QList<double> & );
|
---|
| 82 | QList<double> contourLevels() const;
|
---|
| 83 |
|
---|
| 84 | virtual int rtti() const;
|
---|
| 85 |
|
---|
| 86 | virtual void draw( QPainter *p,
|
---|
| 87 | const QwtScaleMap &xMap, const QwtScaleMap &yMap,
|
---|
| 88 | const QRectF &rect ) const;
|
---|
| 89 |
|
---|
| 90 | protected:
|
---|
| 91 | virtual QImage renderImage(
|
---|
| 92 | const QwtScaleMap &xMap, const QwtScaleMap &yMap,
|
---|
| 93 | const QRectF &area, const QSize &imageSize ) const;
|
---|
| 94 |
|
---|
| 95 | virtual QSize contourRasterSize(
|
---|
| 96 | const QRectF &, const QRect & ) const;
|
---|
| 97 |
|
---|
| 98 | virtual QwtRasterData::ContourLines renderContourLines(
|
---|
| 99 | const QRectF &rect, const QSize &raster ) const;
|
---|
| 100 |
|
---|
| 101 | virtual void drawContourLines( QPainter *p,
|
---|
| 102 | const QwtScaleMap &xMap, const QwtScaleMap &yMap,
|
---|
| 103 | const QwtRasterData::ContourLines& lines ) const;
|
---|
| 104 |
|
---|
| 105 | void renderTile( const QwtScaleMap &xMap, const QwtScaleMap &yMap,
|
---|
| 106 | const QRect &imageRect, QImage *image ) const;
|
---|
| 107 |
|
---|
| 108 | private:
|
---|
| 109 | class PrivateData;
|
---|
| 110 | PrivateData *d_data;
|
---|
| 111 | };
|
---|
| 112 |
|
---|
| 113 | Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPlotSpectrogram::DisplayModes )
|
---|
| 114 |
|
---|
| 115 | #endif
|
---|