diff options
-rw-r--r-- | gr-qtgui/lib/ConstellationDisplayPlot.cc | 17 | ||||
-rw-r--r-- | gr-qtgui/lib/ConstellationDisplayPlot.h | 5 | ||||
-rw-r--r-- | gr-qtgui/lib/FrequencyDisplayPlot.cc | 17 | ||||
-rw-r--r-- | gr-qtgui/lib/FrequencyDisplayPlot.h | 5 | ||||
-rw-r--r-- | gr-qtgui/lib/Makefile.am | 2 | ||||
-rw-r--r-- | gr-qtgui/lib/TimeDomainDisplayPlot.cc | 16 | ||||
-rw-r--r-- | gr-qtgui/lib/TimeDomainDisplayPlot.h | 4 | ||||
-rw-r--r-- | gr-qtgui/lib/WaterfallDisplayPlot.cc | 30 | ||||
-rw-r--r-- | gr-qtgui/lib/WaterfallDisplayPlot.h | 12 | ||||
-rw-r--r-- | gr-qtgui/lib/plot_waterfall.cc | 17 | ||||
-rw-r--r-- | gr-qtgui/lib/plot_waterfall.h | 11 | ||||
-rw-r--r-- | gr-qtgui/lib/waterfallGlobalData.cc | 1 |
12 files changed, 112 insertions, 25 deletions
diff --git a/gr-qtgui/lib/ConstellationDisplayPlot.cc b/gr-qtgui/lib/ConstellationDisplayPlot.cc index e01c99b74..ca7eede36 100644 --- a/gr-qtgui/lib/ConstellationDisplayPlot.cc +++ b/gr-qtgui/lib/ConstellationDisplayPlot.cc @@ -135,8 +135,15 @@ ConstellationDisplayPlot::ConstellationDisplayPlot(QWidget* parent) // emit the position of clicks on widget _picker = new QwtDblClickPlotPicker(canvas()); + +#if QWT_VERSION < 0x060000 + connect(_picker, SIGNAL(selected(const QwtDoublePoint &)), + this, SLOT(OnPickerPointSelected(const QwtDoublePoint &))); +#else connect(_picker, SIGNAL(selected(const QPointF &)), this, SLOT(OnPickerPointSelected(const QPointF &))); +#endif + connect(this, SIGNAL(legendChecked(QwtPlotItem *, bool ) ), this, SLOT(LegendEntryChecked(QwtPlotItem *, bool ) )); } @@ -229,6 +236,15 @@ ConstellationDisplayPlot::LegendEntryChecked(QwtPlotItem* plotItem, bool on) plotItem->setVisible(!on); } +#if QWT_VERSION < 0x060000 +void +ConstellationDisplayPlot::OnPickerPointSelected(const QwtDoublePoint & p) +{ + QPointF point = p; + //fprintf(stderr,"OnPickerPointSelected %f %f\n", point.x(), point.y()); + emit plotPointSelected(point); +} +#else void ConstellationDisplayPlot::OnPickerPointSelected(const QPointF & p) { @@ -236,5 +252,6 @@ ConstellationDisplayPlot::OnPickerPointSelected(const QPointF & p) //fprintf(stderr,"OnPickerPointSelected %f %f\n", point.x(), point.y()); emit plotPointSelected(point); } +#endif #endif /* CONSTELLATION_DISPLAY_PLOT_C */ diff --git a/gr-qtgui/lib/ConstellationDisplayPlot.h b/gr-qtgui/lib/ConstellationDisplayPlot.h index cab11c704..d252a8c87 100644 --- a/gr-qtgui/lib/ConstellationDisplayPlot.h +++ b/gr-qtgui/lib/ConstellationDisplayPlot.h @@ -66,7 +66,12 @@ public: public slots: void resizeSlot( QSize *s ); + +#if QWT_VERSION < 0x060000 + void OnPickerPointSelected(const QwtDoublePoint & p); +#else void OnPickerPointSelected(const QPointF & p); +#endif signals: void plotPointSelected(const QPointF p); diff --git a/gr-qtgui/lib/FrequencyDisplayPlot.cc b/gr-qtgui/lib/FrequencyDisplayPlot.cc index 4e71dcad4..2e62f2b96 100644 --- a/gr-qtgui/lib/FrequencyDisplayPlot.cc +++ b/gr-qtgui/lib/FrequencyDisplayPlot.cc @@ -250,8 +250,14 @@ FrequencyDisplayPlot::FrequencyDisplayPlot(QWidget* parent) // emit the position of clicks on widget _picker = new QwtDblClickPlotPicker(canvas()); + +#if QWT_VERSION < 0x060000 + connect(_picker, SIGNAL(selected(const QwtDoublePoint &)), + this, SLOT(OnPickerPointSelected(const QwtDoublePoint &))); +#else connect(_picker, SIGNAL(selected(const QPointF &)), this, SLOT(OnPickerPointSelected(const QPointF &))); +#endif // Configure magnify on mouse wheel _magnifier = new QwtPlotMagnifier(canvas()); @@ -532,6 +538,16 @@ FrequencyDisplayPlot::ShowCFMarker (const bool show) _markerCF->hide(); } +#if QWT_VERSION < 0x060000 +void +FrequencyDisplayPlot::OnPickerPointSelected(const QwtDoublePoint & p) +{ + QPointF point = p; + //fprintf(stderr,"OnPickerPointSelected %f %f %d\n", point.x(), point.y(), _xAxisMultiplier); + point.setX(point.x() * _xAxisMultiplier); + emit plotPointSelected(point); +} +#else void FrequencyDisplayPlot::OnPickerPointSelected(const QPointF & p) { @@ -540,5 +556,6 @@ FrequencyDisplayPlot::OnPickerPointSelected(const QPointF & p) point.setX(point.x() * _xAxisMultiplier); emit plotPointSelected(point); } +#endif #endif /* FREQUENCY_DISPLAY_PLOT_C */ diff --git a/gr-qtgui/lib/FrequencyDisplayPlot.h b/gr-qtgui/lib/FrequencyDisplayPlot.h index cd9393de8..961f30168 100644 --- a/gr-qtgui/lib/FrequencyDisplayPlot.h +++ b/gr-qtgui/lib/FrequencyDisplayPlot.h @@ -79,7 +79,12 @@ public slots: void resizeSlot( QSize *e ); void SetLowerIntensityLevel(const double); void SetUpperIntensityLevel(const double); + +#if QWT_VERSION < 0x060000 + void OnPickerPointSelected(const QwtDoublePoint & p); +#else void OnPickerPointSelected(const QPointF & p); +#endif signals: void plotPointSelected(const QPointF p); diff --git a/gr-qtgui/lib/Makefile.am b/gr-qtgui/lib/Makefile.am index 99c42a9f7..3257c3aae 100644 --- a/gr-qtgui/lib/Makefile.am +++ b/gr-qtgui/lib/Makefile.am @@ -54,6 +54,7 @@ libgnuradio_qtgui_la_SOURCES = \ timedisplayform.cc \ SpectrumGUIClass.cc \ spectrumUpdateEvents.cc \ + plot_waterfall.cc \ qtgui_sink_c.cc \ qtgui_sink_f.cc \ qtgui_time_sink_c.cc \ @@ -73,6 +74,7 @@ grinclude_HEADERS = \ timedisplayform.h \ SpectrumGUIClass.h \ spectrumUpdateEvents.h \ + plot_waterfall.h \ gr_qtgui_api.h \ qtgui_sink_c.h \ qtgui_sink_f.h \ diff --git a/gr-qtgui/lib/TimeDomainDisplayPlot.cc b/gr-qtgui/lib/TimeDomainDisplayPlot.cc index 8bc40b998..eca6076b6 100644 --- a/gr-qtgui/lib/TimeDomainDisplayPlot.cc +++ b/gr-qtgui/lib/TimeDomainDisplayPlot.cc @@ -170,8 +170,14 @@ TimeDomainDisplayPlot::TimeDomainDisplayPlot(int nplots, QWidget* parent) // emit the position of clicks on widget _picker = new QwtDblClickPlotPicker(canvas()); + +#if QWT_VERSION < 0x060000 + connect(_picker, SIGNAL(selected(const QwtDoublePoint &)), + this, SLOT(OnPickerPointSelected(const QwtDoublePoint &))); +#else connect(_picker, SIGNAL(selected(const QPointF &)), this, SLOT(OnPickerPointSelected(const QPointF &))); +#endif // Configure magnify on mouse wheel _magnifier = new QwtPlotMagnifier(canvas()); @@ -320,6 +326,15 @@ TimeDomainDisplayPlot::SetSampleRate(double sr, double units, } +#if QWT_VERSION < 0x060000 +void +TimeDomainDisplayPlot::OnPickerPointSelected(const QwtDoublePoint & p) +{ + QPointF point = p; + //fprintf(stderr,"OnPickerPointSelected %f %f\n", point.x(), point.y()); + emit plotPointSelected(point); +} +#else void TimeDomainDisplayPlot::OnPickerPointSelected(const QPointF & p) { @@ -327,5 +342,6 @@ TimeDomainDisplayPlot::OnPickerPointSelected(const QPointF & p) //fprintf(stderr,"OnPickerPointSelected %f %f\n", point.x(), point.y()); emit plotPointSelected(point); } +#endif #endif /* TIME_DOMAIN_DISPLAY_PLOT_C */ diff --git a/gr-qtgui/lib/TimeDomainDisplayPlot.h b/gr-qtgui/lib/TimeDomainDisplayPlot.h index 8e277bc81..6c7fc4330 100644 --- a/gr-qtgui/lib/TimeDomainDisplayPlot.h +++ b/gr-qtgui/lib/TimeDomainDisplayPlot.h @@ -65,7 +65,11 @@ public slots: void SetSampleRate(double sr, double units, const std::string &strunits); +#if QWT_VERSION < 0x060000 + void OnPickerPointSelected(const QwtDoublePoint & p); +#else void OnPickerPointSelected(const QPointF & p); +#endif signals: void plotPointSelected(const QPointF p); diff --git a/gr-qtgui/lib/WaterfallDisplayPlot.cc b/gr-qtgui/lib/WaterfallDisplayPlot.cc index 84d71d76d..7abd9aeef 100644 --- a/gr-qtgui/lib/WaterfallDisplayPlot.cc +++ b/gr-qtgui/lib/WaterfallDisplayPlot.cc @@ -310,17 +310,20 @@ WaterfallDisplayPlot::WaterfallDisplayPlot(QWidget* parent) d_data = new WaterfallData(_startFrequency, _stopFrequency, _numPoints, 200); - d_spectrogram = new QwtPlotSpectrogram("Spectrogram"); - d_spectrogram->setData(*d_data); - d_spectrogram->attach(this); - d_spectrogram->setDisplayMode(QwtPlotSpectrogram::ImageMode, true); - #if QWT_VERSION < 0x060000 + d_spectrogram = new PlotWaterfall(d_data, "Waterfall Display"); + ColorMap_MultiColor colorMap; d_spectrogram->setColorMap(colorMap); + #else + d_spectrogram = new QwtPlotSpectrogram("Spectrogram"); + d_spectrogram->setData(*d_data); + d_spectrogram->setDisplayMode(QwtPlotSpectrogram::ImageMode, true); d_spectrogram->setColorMap(new ColorMap_MultiColor()); #endif + + d_spectrogram->attach(this); // LeftButton for the zooming // MidButton for the panning @@ -492,14 +495,15 @@ void WaterfallDisplayPlot::SetIntensityRange(const double minIntensity, const double maxIntensity) { - emit UpdatedLowerIntensityLevel(minIntensity); - emit UpdatedUpperIntensityLevel(maxIntensity); - #if QWT_VERSION < 0x060000 + d_data->setRange(QwtDoubleInterval(minIntensity, maxIntensity)); #else d_data->setInterval(Qt::ZAxis, QwtInterval(minIntensity, maxIntensity)); #endif + emit UpdatedLowerIntensityLevel(minIntensity); + emit UpdatedUpperIntensityLevel(maxIntensity); + _UpdateIntensityRangeDisplay(); } @@ -630,11 +634,11 @@ WaterfallDisplayPlot::_UpdateIntensityRangeDisplay() rightAxis->setColorBarEnabled(true); #if QWT_VERSION < 0x060000 - rightAxis->setColorMap(d_data->range(), + rightAxis->setColorMap(d_spectrogram->data()->range(), d_spectrogram->colorMap()); setAxisScale(QwtPlot::yRight, - d_data->range().minValue(), - d_data->range().maxValue()); + d_spectrogram->data()->range().minValue(), + d_spectrogram->data()->range().maxValue()); #else QwtInterval intv = d_spectrogram->interval(Qt::ZAxis); switch(_intensityColorMapType) { @@ -675,7 +679,7 @@ void WaterfallDisplayPlot::OnPickerPointSelected(const QwtDoublePoint & p) { QPointF point = p; - fprintf(stderr,"OnPickerPointSelected %f %f\n", point.x(), point.y()); + //fprintf(stderr,"OnPickerPointSelected %f %f\n", point.x(), point.y()); point.setX(point.x() * _xAxisMultiplier); emit plotPointSelected(point); } @@ -684,7 +688,7 @@ void WaterfallDisplayPlot::OnPickerPointSelected(const QPointF & p) { QPointF point = p; - fprintf(stderr,"OnPickerPointSelected %f %f\n", point.x(), point.y()); + //fprintf(stderr,"OnPickerPointSelected %f %f\n", point.x(), point.y()); point.setX(point.x() * _xAxisMultiplier); emit plotPointSelected(point); } diff --git a/gr-qtgui/lib/WaterfallDisplayPlot.h b/gr-qtgui/lib/WaterfallDisplayPlot.h index 611566995..0458597b0 100644 --- a/gr-qtgui/lib/WaterfallDisplayPlot.h +++ b/gr-qtgui/lib/WaterfallDisplayPlot.h @@ -29,14 +29,14 @@ #include <qwt_plot_spectrogram.h> #include <qwt_plot_zoomer.h> #include <qwt_plot_panner.h> - #include <qtgui_util.h> -//#include <plot_waterfall.h> #include <waterfallGlobalData.h> #include <gruel/high_res_timer.h> -#if QWT_VERSION >= 0x060000 +#if QWT_VERSION < 0x060000 +#include <plot_waterfall.h> +#else #include <qwt_compat.h> #endif @@ -79,6 +79,7 @@ public: public slots: void resizeSlot( QSize *s ); + #if QWT_VERSION < 0x060000 void OnPickerPointSelected(const QwtDoublePoint & p); #else @@ -105,7 +106,12 @@ private: QwtDblClickPlotPicker *_picker; WaterfallData *d_data; + +#if QWT_VERSION < 0x060000 + PlotWaterfall *d_spectrogram; +#else QwtPlotSpectrogram *d_spectrogram; +#endif gruel::high_res_timer_type _lastReplot; diff --git a/gr-qtgui/lib/plot_waterfall.cc b/gr-qtgui/lib/plot_waterfall.cc index 26f41e722..527eea22e 100644 --- a/gr-qtgui/lib/plot_waterfall.cc +++ b/gr-qtgui/lib/plot_waterfall.cc @@ -107,8 +107,6 @@ void PlotWaterfall::setColorMap(const QwtColorMap &colorMap) delete d_data->colorMap; #if QWT_VERSION < 0x060000 d_data->colorMap = colorMap.copy(); -#else - memcpy(&d_data->colorMap, &colorMap, sizeof(colorMap)); #endif invalidateCache(); @@ -144,7 +142,7 @@ QwtDoubleRect PlotWaterfall::boundingRect() const \param rect Rect for the raster hint \return data().rasterHint(rect) */ -#if 0 +#if QWT_VERSION < 0x060000 QSize PlotWaterfall::rasterHint(const QwtDoubleRect &rect) const { return d_data->data->rasterHint(rect); @@ -168,21 +166,26 @@ QSize PlotWaterfall::rasterHint(const QwtDoubleRect &rect) const \sa QwtRasterData::intensity(), QwtColorMap::rgb(), QwtColorMap::colorIndex() */ +#if QWT_VERSION < 0x060000 +QImage PlotWaterfall::renderImage(const QwtScaleMap &xMap, + const QwtScaleMap &yMap, + const QwtDoubleRect &area) const +#else QImage PlotWaterfall::renderImage(const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &area, const QSize &size) const +#endif { if ( area.isEmpty() ) return QImage(); - //QRect rect = transform(xMap, yMap, area); - QRect rect = QRect(0,0,0,0); + QRect rect = transform(xMap, yMap, area); QwtScaleMap xxMap = xMap; QwtScaleMap yyMap = yMap; - const QSize res(0,0); // = d_data->data->rasterHint(area); + const QSize res = d_data->data->rasterHint(area); if ( res.isValid() ) { /* @@ -295,7 +298,7 @@ QImage PlotWaterfall::renderImage(const QwtScaleMap &xMap, void PlotWaterfall::draw(QPainter *painter, const QwtScaleMap &xMap, const QwtScaleMap &yMap, - const QRectF &canvasRect) const + const QRect &canvasRect) const { QwtPlotRasterItem::draw(painter, xMap, yMap, canvasRect); } diff --git a/gr-qtgui/lib/plot_waterfall.h b/gr-qtgui/lib/plot_waterfall.h index 120b5b4cf..d4cb8d6da 100644 --- a/gr-qtgui/lib/plot_waterfall.h +++ b/gr-qtgui/lib/plot_waterfall.h @@ -38,20 +38,27 @@ public: #if QWT_VERSION < 0x060000 virtual QwtDoubleRect boundingRect() const; #endif - //virtual QSize rasterHint(const QwtDoubleRect &) const; + + virtual QSize rasterHint(const QwtDoubleRect &) const; virtual int rtti() const; virtual void draw(QPainter *p, const QwtScaleMap &xMap, const QwtScaleMap &yMap, - const QRectF &rect) const; + const QRect &rect) const; protected: +#if QWT_VERSION < 0x060000 + QImage renderImage(const QwtScaleMap &xMap, + const QwtScaleMap &yMap, + const QwtDoubleRect &rect) const; +#else QImage renderImage(const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &rect, const QSize &size=QSize(0,0)) const; +#endif private: class PrivateData; diff --git a/gr-qtgui/lib/waterfallGlobalData.cc b/gr-qtgui/lib/waterfallGlobalData.cc index c57a3b5c1..04366a297 100644 --- a/gr-qtgui/lib/waterfallGlobalData.cc +++ b/gr-qtgui/lib/waterfallGlobalData.cc @@ -2,6 +2,7 @@ #define WATERFALL_GLOBAL_DATA_CPP #include <waterfallGlobalData.h> +#include <cstdio> WaterfallData::WaterfallData(const double minimumFrequency, const double maximumFrequency, |