GNU Radio 3.7.0 C++ API
plot_waterfall.h
Go to the documentation of this file.
00001 /* -*- c++ -*- */
00002 /*
00003  * Copyright 2008-2012 Free Software Foundation, Inc.
00004  *
00005  * This file is part of GNU Radio
00006  *
00007  * GNU Radio is free software; you can redistribute it and/or modify
00008  * it under the terms of the GNU General Public License as published by
00009  * the Free Software Foundation; either version 3, or (at your option)
00010  * any later version.
00011  *
00012  * GNU Radio is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with GNU Radio; see the file COPYING.  If not, write to
00019  * the Free Software Foundation, Inc., 51 Franklin Street,
00020  * Boston, MA 02110-1301, USA.
00021  */
00022 
00023 #ifndef PLOT_WATERFALL_H
00024 #define PLOT_WATERFALL_H
00025 
00026 #include <qglobal.h>
00027 #include <gnuradio/qtgui/waterfallGlobalData.h>
00028 #include <qwt_plot_rasteritem.h>
00029 
00030 #if QWT_VERSION >= 0x060000
00031 #include <qwt_point_3d.h>  // doesn't seem necessary, but is...
00032 #include <qwt_compat.h>
00033 #endif
00034 
00035 class QwtColorMap;
00036 
00037 /*!
00038  * \brief A plot item, which displays a waterfall spectrogram
00039  * \ingroup qtgui_blk
00040  *
00041  * \details
00042  * A waterfall displays threedimenional data, where the 3rd dimension
00043  * (the intensity) is displayed using colors. The colors are calculated
00044  * from the values using a color map.
00045  *
00046  * \sa QwtRasterData, QwtColorMap
00047  */
00048 class PlotWaterfall: public QwtPlotRasterItem
00049 {
00050 public:
00051     explicit PlotWaterfall(WaterfallData* data,
00052                            const QString &title = QString::null);
00053     virtual ~PlotWaterfall();
00054 
00055     const WaterfallData* data()const;
00056 
00057     void setColorMap(const QwtColorMap &);
00058 
00059     const QwtColorMap &colorMap() const;
00060 
00061 #if QWT_VERSION < 0x060000
00062     virtual QwtDoubleRect boundingRect() const;
00063     virtual QSize rasterHint(const QwtDoubleRect &) const;
00064 #endif
00065 
00066     virtual int rtti() const;
00067 
00068     virtual void draw(QPainter *p,
00069                       const QwtScaleMap &xMap,
00070                       const QwtScaleMap &yMap,
00071                       const QRect &rect) const;
00072 
00073 protected:
00074 #if QWT_VERSION < 0x060000
00075     QImage renderImage(const QwtScaleMap &xMap,
00076                        const QwtScaleMap &yMap,
00077                        const QwtDoubleRect &rect) const;
00078 #else
00079     QImage renderImage(const QwtScaleMap &xMap,
00080                        const QwtScaleMap &yMap,
00081                        const QRectF &rect,
00082                        const QSize &size=QSize(0,0)) const;
00083 #endif
00084 
00085 private:
00086     class PrivateData;
00087     PrivateData *d_data;
00088 };
00089 
00090 #endif