diff options
Diffstat (limited to 'gr-qtgui')
-rw-r--r-- | gr-qtgui/lib/ConstellationDisplayPlot.cc | 26 | ||||
-rw-r--r-- | gr-qtgui/lib/ConstellationDisplayPlot.h | 8 | ||||
-rw-r--r-- | gr-qtgui/lib/FrequencyDisplayPlot.cc | 58 | ||||
-rw-r--r-- | gr-qtgui/lib/FrequencyDisplayPlot.h | 8 | ||||
-rw-r--r-- | gr-qtgui/lib/SpectrumGUIClass.cc | 6 | ||||
-rw-r--r-- | gr-qtgui/lib/TimeDomainDisplayPlot.cc | 30 | ||||
-rw-r--r-- | gr-qtgui/lib/TimeDomainDisplayPlot.h | 6 | ||||
-rw-r--r-- | gr-qtgui/lib/WaterfallDisplayPlot.cc | 26 | ||||
-rw-r--r-- | gr-qtgui/lib/WaterfallDisplayPlot.h | 6 | ||||
-rw-r--r-- | gr-qtgui/lib/plot_waterfall.cc | 108 | ||||
-rw-r--r-- | gr-qtgui/lib/plot_waterfall.h | 26 | ||||
-rw-r--r-- | gr-qtgui/lib/qtgui_sink_f.h | 1 | ||||
-rw-r--r-- | gr-qtgui/lib/qtgui_util.cc | 34 | ||||
-rw-r--r-- | gr-qtgui/lib/qtgui_util.h | 9 | ||||
-rw-r--r-- | gr-qtgui/lib/spectrumdisplayform.cc | 87 | ||||
-rw-r--r-- | gr-qtgui/lib/spectrumdisplayform.h | 18 | ||||
-rw-r--r-- | gr-qtgui/lib/waterfallGlobalData.cc | 76 | ||||
-rw-r--r-- | gr-qtgui/lib/waterfallGlobalData.h | 17 |
18 files changed, 390 insertions, 160 deletions
diff --git a/gr-qtgui/lib/ConstellationDisplayPlot.cc b/gr-qtgui/lib/ConstellationDisplayPlot.cc index dda7cfea2..a9c64d274 100644 --- a/gr-qtgui/lib/ConstellationDisplayPlot.cc +++ b/gr-qtgui/lib/ConstellationDisplayPlot.cc @@ -68,11 +68,17 @@ ConstellationDisplayPlot::ConstellationDisplayPlot(QWidget* parent) _imagDataPoints = new double[_numPoints]; // Disable polygon clipping +#if QWT_VERSION < 0x060000 QwtPainter::setDeviceClipping(false); +#else + QwtPainter::setPolylineSplitting(false); +#endif +#if QWT_VERSION < 0x060000 // We don't need the cache here canvas()->setPaintAttribute(QwtPlotCanvas::PaintCached, false); canvas()->setPaintAttribute(QwtPlotCanvas::PaintPacked, false); +#endif QPalette palette; palette.setColor(canvas()->backgroundRole(), QColor("white")); @@ -91,13 +97,22 @@ ConstellationDisplayPlot::ConstellationDisplayPlot(QWidget* parent) _plot_curve->attach(this); _plot_curve->setPen(QPen(Qt::blue, _penSize, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin)); _plot_curve->setStyle(QwtPlotCurve::Dots); + +#if QWT_VERSION < 0x060000 _plot_curve->setRawData(_realDataPoints, _imagDataPoints, _numPoints); +#else + _plot_curve->setRawSamples(_realDataPoints, _imagDataPoints, _numPoints); +#endif memset(_realDataPoints, 0x0, _numPoints*sizeof(double)); memset(_imagDataPoints, 0x0, _numPoints*sizeof(double)); _zoomer = new ConstellationDisplayZoomer(canvas()); + +#if QWT_VERSION < 0x060000 _zoomer->setSelectionFlags(QwtPicker::RectSelection | QwtPicker::DragSelection); +#endif + _zoomer->setMousePattern(QwtEventPattern::MouseSelect2, Qt::RightButton, Qt::ControlModifier); _zoomer->setMousePattern(QwtEventPattern::MouseSelect3, @@ -120,9 +135,8 @@ ConstellationDisplayPlot::ConstellationDisplayPlot(QWidget* parent) // emit the position of clicks on widget _picker = new QwtDblClickPlotPicker(canvas()); - connect(_picker, SIGNAL(selected(const QwtDoublePoint &)), - this, SLOT(OnPickerPointSelected(const QwtDoublePoint &))); - + connect(_picker, SIGNAL(selected(const QPointF &)), + this, SLOT(OnPickerPointSelected(const QPointF &))); connect(this, SIGNAL(legendChecked(QwtPlotItem *, bool ) ), this, SLOT(LegendEntryChecked(QwtPlotItem *, bool ) )); } @@ -193,7 +207,11 @@ void ConstellationDisplayPlot::PlotNewData(const double* realDataPoints, _realDataPoints = new double[_numPoints]; _imagDataPoints = new double[_numPoints]; +#if QWT_VERSION < 0x060000 _plot_curve->setRawData(_realDataPoints, _imagDataPoints, _numPoints); +#else + _plot_curve->setRawSamples(_realDataPoints, _imagDataPoints, _numPoints); +#endif } memcpy(_realDataPoints, realDataPoints, numDataPoints*sizeof(double)); @@ -210,7 +228,7 @@ ConstellationDisplayPlot::LegendEntryChecked(QwtPlotItem* plotItem, bool on) } void -ConstellationDisplayPlot::OnPickerPointSelected(const QwtDoublePoint & p) +ConstellationDisplayPlot::OnPickerPointSelected(const QPointF & p) { QPointF point = p; //fprintf(stderr,"OnPickerPointSelected %f %f\n", point.x(), point.y()); diff --git a/gr-qtgui/lib/ConstellationDisplayPlot.h b/gr-qtgui/lib/ConstellationDisplayPlot.h index 23004f86c..cab11c704 100644 --- a/gr-qtgui/lib/ConstellationDisplayPlot.h +++ b/gr-qtgui/lib/ConstellationDisplayPlot.h @@ -38,6 +38,11 @@ #include <qwt_symbol.h> #include <qtgui_util.h> +#if QWT_VERSION >= 0x060000 +#include <qwt_point_3d.h> // doesn't seem necessary, but is... +#include <qwt_compat.h> +#endif + class ConstellationDisplayPlot : public QwtPlot { Q_OBJECT @@ -61,8 +66,7 @@ public: public slots: void resizeSlot( QSize *s ); - - void OnPickerPointSelected(const QwtDoublePoint & p); + void OnPickerPointSelected(const QPointF & p); signals: void plotPointSelected(const QPointF p); diff --git a/gr-qtgui/lib/FrequencyDisplayPlot.cc b/gr-qtgui/lib/FrequencyDisplayPlot.cc index f57edd8f6..4e71dcad4 100644 --- a/gr-qtgui/lib/FrequencyDisplayPlot.cc +++ b/gr-qtgui/lib/FrequencyDisplayPlot.cc @@ -133,11 +133,17 @@ FrequencyDisplayPlot::FrequencyDisplayPlot(QWidget* parent) _xAxisPoints = new double[_numPoints]; // Disable polygon clipping +#if QWT_VERSION < 0x060000 QwtPainter::setDeviceClipping(false); +#else + QwtPainter::setPolylineSplitting(false); +#endif +#if QWT_VERSION < 0x060000 // We don't need the cache here canvas()->setPaintAttribute(QwtPlotCanvas::PaintCached, false); canvas()->setPaintAttribute(QwtPlotCanvas::PaintPacked, false); +#endif QPalette palette; palette.setColor(canvas()->backgroundRole(), QColor("white")); @@ -156,18 +162,35 @@ FrequencyDisplayPlot::FrequencyDisplayPlot(QWidget* parent) _fft_plot_curve = new QwtPlotCurve("Power Spectrum"); _fft_plot_curve->attach(this); _fft_plot_curve->setPen(QPen(Qt::blue)); + +#if QWT_VERSION < 0x060000 _fft_plot_curve->setRawData(_xAxisPoints, _dataPoints, _numPoints); +#else + _fft_plot_curve->setRawSamples(_xAxisPoints, _dataPoints, _numPoints); +#endif _min_fft_plot_curve = new QwtPlotCurve("Minimum Power"); _min_fft_plot_curve->attach(this); _min_fft_plot_curve->setPen(QPen(Qt::magenta)); + +#if QWT_VERSION < 0x060000 _min_fft_plot_curve->setRawData(_xAxisPoints, _minFFTPoints, _numPoints); +#else + _min_fft_plot_curve->setRawSamples(_xAxisPoints, _minFFTPoints, _numPoints); +#endif + _min_fft_plot_curve->setVisible(false); _max_fft_plot_curve = new QwtPlotCurve("Maximum Power"); _max_fft_plot_curve->attach(this); _max_fft_plot_curve->setPen(QPen(Qt::darkYellow)); + +#if QWT_VERSION < 0x060000 _max_fft_plot_curve->setRawData(_xAxisPoints, _maxFFTPoints, _numPoints); +#else + _max_fft_plot_curve->setRawSamples(_xAxisPoints, _maxFFTPoints, _numPoints); +#endif + _max_fft_plot_curve->setVisible(false); _lower_intensity_marker= new QwtPlotMarker(); @@ -197,9 +220,16 @@ FrequencyDisplayPlot::FrequencyDisplayPlot(QWidget* parent) symbol.setSize(8); symbol.setPen(QPen(Qt::yellow)); symbol.setBrush(QBrush(Qt::yellow)); + +#if QWT_VERSION < 0x060000 _markerPeakAmplitude->setSymbol(symbol); - _markerPeakAmplitude->attach(this); +#else + _markerPeakAmplitude->setSymbol(&symbol); +#endif + /// THIS CAUSES A PROBLEM! + //_markerPeakAmplitude->attach(this); + _markerNoiseFloorAmplitude = new QwtPlotMarker(); _markerNoiseFloorAmplitude->setLineStyle(QwtPlotMarker::HLine); _markerNoiseFloorAmplitude->setLinePen(QPen(Qt::darkRed, 0, Qt::DotLine)); @@ -220,15 +250,19 @@ FrequencyDisplayPlot::FrequencyDisplayPlot(QWidget* parent) // emit the position of clicks on widget _picker = new QwtDblClickPlotPicker(canvas()); - connect(_picker, SIGNAL(selected(const QwtDoublePoint &)), - this, SLOT(OnPickerPointSelected(const QwtDoublePoint &))); + connect(_picker, SIGNAL(selected(const QPointF &)), + this, SLOT(OnPickerPointSelected(const QPointF &))); // Configure magnify on mouse wheel _magnifier = new QwtPlotMagnifier(canvas()); _magnifier->setAxisEnabled(QwtPlot::xBottom, false); _zoomer = new FreqDisplayZoomer(canvas(), 0); + +#if QWT_VERSION < 0x060000 _zoomer->setSelectionFlags(QwtPicker::RectSelection | QwtPicker::DragSelection); +#endif + _zoomer->setMousePattern(QwtEventPattern::MouseSelect2, Qt::RightButton, Qt::ControlModifier); _zoomer->setMousePattern(QwtEventPattern::MouseSelect3, @@ -362,7 +396,7 @@ FrequencyDisplayPlot::PlotNewData(const double* dataPoints, const int64_t numDat { // Only update plot if there is data and if the time interval has elapsed if((numDataPoints > 0) && - (gruel::high_res_timer_now() - _lastReplot > timeInterval*gruel::high_res_timer_tps())) { + (gruel::high_res_timer_now() - _lastReplot > timeInterval*gruel::high_res_timer_tps())) { if(numDataPoints != _numPoints) { _numPoints = numDataPoints; @@ -375,16 +409,22 @@ FrequencyDisplayPlot::PlotNewData(const double* dataPoints, const int64_t numDat _xAxisPoints = new double[_numPoints]; _minFFTPoints = new double[_numPoints]; _maxFFTPoints = new double[_numPoints]; - + +#if QWT_VERSION < 0x060000 _fft_plot_curve->setRawData(_xAxisPoints, _dataPoints, _numPoints); _min_fft_plot_curve->setRawData(_xAxisPoints, _minFFTPoints, _numPoints); _max_fft_plot_curve->setRawData(_xAxisPoints, _maxFFTPoints, _numPoints); +#else + _fft_plot_curve->setRawSamples(_xAxisPoints, _dataPoints, _numPoints); + _min_fft_plot_curve->setRawSamples(_xAxisPoints, _minFFTPoints, _numPoints); + _max_fft_plot_curve->setRawSamples(_xAxisPoints, _maxFFTPoints, _numPoints); +#endif _resetXAxisPoints(); ClearMaxData(); ClearMinData(); } - + memcpy(_dataPoints, dataPoints, numDataPoints*sizeof(double)); for(int64_t point = 0; point < numDataPoints; point++){ if(dataPoints[point] < _minFFTPoints[point]){ @@ -401,6 +441,8 @@ FrequencyDisplayPlot::PlotNewData(const double* dataPoints, const int64_t numDat SetUpperIntensityLevel(_peakAmplitude); + replot(); + _lastReplot = gruel::high_res_timer_now(); } } @@ -478,7 +520,7 @@ FrequencyDisplayPlot::SetBGColour (QColor c) { QPalette palette; palette.setColor(canvas()->backgroundRole(), c); - canvas()->setPalette(palette); + canvas()->setPalette(palette); } void @@ -491,7 +533,7 @@ FrequencyDisplayPlot::ShowCFMarker (const bool show) } void -FrequencyDisplayPlot::OnPickerPointSelected(const QwtDoublePoint & p) +FrequencyDisplayPlot::OnPickerPointSelected(const QPointF & p) { QPointF point = p; //fprintf(stderr,"OnPickerPointSelected %f %f %d\n", point.x(), point.y(), _xAxisMultiplier); diff --git a/gr-qtgui/lib/FrequencyDisplayPlot.h b/gr-qtgui/lib/FrequencyDisplayPlot.h index a263fec2f..cd9393de8 100644 --- a/gr-qtgui/lib/FrequencyDisplayPlot.h +++ b/gr-qtgui/lib/FrequencyDisplayPlot.h @@ -39,6 +39,10 @@ #include <qwt_symbol.h> #include <qtgui_util.h> +#if QWT_VERSION >= 0x060000 +#include <qwt_compat.h> +#endif + class FrequencyDisplayPlot:public QwtPlot{ Q_OBJECT @@ -75,8 +79,7 @@ public slots: void resizeSlot( QSize *e ); void SetLowerIntensityLevel(const double); void SetUpperIntensityLevel(const double); - - void OnPickerPointSelected(const QwtDoublePoint & p); + void OnPickerPointSelected(const QPointF & p); signals: void plotPointSelected(const QPointF p); @@ -107,6 +110,7 @@ private: QwtPlotMarker *_markerCF; QwtDblClickPlotPicker *_picker; + QwtPlotMagnifier *_magnifier; double* _dataPoints; diff --git a/gr-qtgui/lib/SpectrumGUIClass.cc b/gr-qtgui/lib/SpectrumGUIClass.cc index af95e2bb2..e7ab84667 100644 --- a/gr-qtgui/lib/SpectrumGUIClass.cc +++ b/gr-qtgui/lib/SpectrumGUIClass.cc @@ -104,9 +104,9 @@ SpectrumGUIClass::OpenSpectrumWindow(QWidget* parent, // Toggle Windows on/off _spectrumDisplayForm->ToggleTabFrequency(frequency); - _spectrumDisplayForm->ToggleTabWaterfall(waterfall); - _spectrumDisplayForm->ToggleTabTime(time); - _spectrumDisplayForm->ToggleTabConstellation(constellation); + //_spectrumDisplayForm->ToggleTabWaterfall(waterfall); + //_spectrumDisplayForm->ToggleTabTime(time); + //_spectrumDisplayForm->ToggleTabConstellation(constellation); _windowOpennedFlag = true; diff --git a/gr-qtgui/lib/TimeDomainDisplayPlot.cc b/gr-qtgui/lib/TimeDomainDisplayPlot.cc index f635a2b0c..b3c0a035a 100644 --- a/gr-qtgui/lib/TimeDomainDisplayPlot.cc +++ b/gr-qtgui/lib/TimeDomainDisplayPlot.cc @@ -103,14 +103,23 @@ TimeDomainDisplayPlot::TimeDomainDisplayPlot(int nplots, QWidget* parent) memset(_xAxisPoints, 0x0, _numPoints*sizeof(double)); _zoomer = new TimeDomainDisplayZoomer(canvas(), 0); + +#if QWT_VERSION < 0x060000 _zoomer->setSelectionFlags(QwtPicker::RectSelection | QwtPicker::DragSelection); +#endif // Disable polygon clipping +#if QWT_VERSION < 0x060000 QwtPainter::setDeviceClipping(false); +#else + QwtPainter::setPolylineSplitting(false); +#endif +#if QWT_VERSION < 0x060000 // We don't need the cache here canvas()->setPaintAttribute(QwtPlotCanvas::PaintCached, false); canvas()->setPaintAttribute(QwtPlotCanvas::PaintPacked, false); +#endif QPalette palette; palette.setColor(canvas()->backgroundRole(), QColor("white")); @@ -130,8 +139,6 @@ TimeDomainDisplayPlot::TimeDomainDisplayPlot(int nplots, QWidget* parent) << QColor(Qt::yellow) << QColor(Qt::gray) << QColor(Qt::darkRed) << QColor(Qt::darkGreen) << QColor(Qt::darkBlue) << QColor(Qt::darkGray); - int ncolors = colors.size(); - // Setup dataPoints and plot vectors // Automatically deleted when parent is deleted for(int i = 0; i < _nplots; i++) { @@ -141,8 +148,13 @@ TimeDomainDisplayPlot::TimeDomainDisplayPlot(int nplots, QWidget* parent) _plot_curve.push_back(new QwtPlotCurve(QString("Data %1").arg(i))); _plot_curve[i]->attach(this); _plot_curve[i]->setPen(QPen(colors[i])); + +#if QWT_VERSION < 0x060000 _plot_curve[i]->setRawData(_xAxisPoints, _dataPoints[i], _numPoints); - } +#else + _plot_curve[i]->setRawSamples(_xAxisPoints, _dataPoints[i], _numPoints); +#endif +} _sampleRate = 1; _resetXAxisPoints(); @@ -158,8 +170,8 @@ TimeDomainDisplayPlot::TimeDomainDisplayPlot(int nplots, QWidget* parent) // emit the position of clicks on widget _picker = new QwtDblClickPlotPicker(canvas()); - connect(_picker, SIGNAL(selected(const QwtDoublePoint &)), - this, SLOT(OnPickerPointSelected(const QwtDoublePoint &))); + connect(_picker, SIGNAL(selected(const QPointF &)), + this, SLOT(OnPickerPointSelected(const QPointF &))); // Configure magnify on mouse wheel _magnifier = new QwtPlotMagnifier(canvas()); @@ -245,7 +257,12 @@ void TimeDomainDisplayPlot::PlotNewData(const std::vector<double*> dataPoints, for(int i = 0; i < _nplots; i++) { delete[] _dataPoints[i]; _dataPoints[i] = new double[_numPoints]; + +#if QWT_VERSION < 0x060000 _plot_curve[i]->setRawData(_xAxisPoints, _dataPoints[i], _numPoints); +#else + _plot_curve[i]->setRawSamples(_xAxisPoints, _dataPoints[i], _numPoints); +#endif } setXaxis(0, numDataPoints); @@ -300,8 +317,9 @@ TimeDomainDisplayPlot::SetSampleRate(double sr, double units, } } + void -TimeDomainDisplayPlot::OnPickerPointSelected(const QwtDoublePoint & p) +TimeDomainDisplayPlot::OnPickerPointSelected(const QPointF & p) { QPointF point = p; //fprintf(stderr,"OnPickerPointSelected %f %f\n", point.x(), point.y()); diff --git a/gr-qtgui/lib/TimeDomainDisplayPlot.h b/gr-qtgui/lib/TimeDomainDisplayPlot.h index af87e1b14..8e277bc81 100644 --- a/gr-qtgui/lib/TimeDomainDisplayPlot.h +++ b/gr-qtgui/lib/TimeDomainDisplayPlot.h @@ -39,6 +39,10 @@ #include <qwt_symbol.h> #include <qtgui_util.h> +#if QWT_VERSION >= 0x060000 +#include <qwt_compat.h> +#endif + class TimeDomainDisplayPlot:public QwtPlot{ Q_OBJECT @@ -61,7 +65,7 @@ public slots: void SetSampleRate(double sr, double units, const std::string &strunits); - void OnPickerPointSelected(const QwtDoublePoint & p); + void OnPickerPointSelected(const QPointF & p); signals: void plotPointSelected(const QPointF p); diff --git a/gr-qtgui/lib/WaterfallDisplayPlot.cc b/gr-qtgui/lib/WaterfallDisplayPlot.cc index 1476be2bd..8d0622c94 100644 --- a/gr-qtgui/lib/WaterfallDisplayPlot.cc +++ b/gr-qtgui/lib/WaterfallDisplayPlot.cc @@ -274,7 +274,9 @@ WaterfallDisplayPlot::WaterfallDisplayPlot(QWidget* parent) // Ctrl+RighButton: zoom out to full size _zoomer = new WaterfallZoomer(canvas(), 0); +#if QWT_VERSION < 0x060000 _zoomer->setSelectionFlags(QwtPicker::RectSelection | QwtPicker::DragSelection); +#endif _zoomer->setMousePattern(QwtEventPattern::MouseSelect2, Qt::RightButton, Qt::ControlModifier); _zoomer->setMousePattern(QwtEventPattern::MouseSelect3, @@ -286,9 +288,9 @@ WaterfallDisplayPlot::WaterfallDisplayPlot(QWidget* parent) // emit the position of clicks on widget _picker = new QwtDblClickPlotPicker(canvas()); - connect(_picker, SIGNAL(selected(const QwtDoublePoint &)), - this, SLOT(OnPickerPointSelected(const QwtDoublePoint &))); - + connect(_picker, SIGNAL(selected(const QPointF &)), + this, SLOT(OnPickerPointSelected(const QPointF &))); + // Avoid jumping when labels with more/less digits // appear/disappear when scrolling vertically @@ -433,7 +435,11 @@ void WaterfallDisplayPlot::SetIntensityRange(const double minIntensity, const double maxIntensity) { +#if QWT_VERSION < 0x060000 _waterfallData->setRange(QwtDoubleInterval(minIntensity, maxIntensity)); +#else + _waterfallData->setInterval(Qt::ZAxis, QwtInterval(minIntensity, maxIntensity)); +#endif emit UpdatedLowerIntensityLevel(minIntensity); emit UpdatedUpperIntensityLevel(maxIntensity); @@ -549,12 +555,20 @@ WaterfallDisplayPlot::_UpdateIntensityRangeDisplay() QwtScaleWidget *rightAxis = axisWidget(QwtPlot::yRight); rightAxis->setTitle("Intensity (dB)"); rightAxis->setColorBarEnabled(true); + +#if QWT_VERSION < 0x060000 rightAxis->setColorMap(d_spectrogram->data()->range(), d_spectrogram->colorMap()); - setAxisScale(QwtPlot::yRight, d_spectrogram->data()->range().minValue(), d_spectrogram->data()->range().maxValue() ); +#else + QwtInterval intv = d_spectrogram->data()->interval(); + QwtColorMap *map = (QwtColorMap*)(&d_spectrogram->colorMap()); + rightAxis->setColorMap(intv, map); + setAxisScale(QwtPlot::yRight, intv.minValue(), intv.maxValue()); +#endif + enableAxis(QwtPlot::yRight); plotLayout()->setAlignCanvasToScales(true); @@ -571,10 +585,10 @@ WaterfallDisplayPlot::_UpdateIntensityRangeDisplay() } void -WaterfallDisplayPlot::OnPickerPointSelected(const QwtDoublePoint & p) +WaterfallDisplayPlot::OnPickerPointSelected(const QPointF & p) { QPointF point = p; - //fprintf(stderr,"OnPickerPointSelected %f %f %d\n", point.x(), point.y(), _xAxisMultiplier); + //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 0c6a521b1..17eba13b2 100644 --- a/gr-qtgui/lib/WaterfallDisplayPlot.h +++ b/gr-qtgui/lib/WaterfallDisplayPlot.h @@ -34,6 +34,10 @@ #include <gruel/high_res_timer.h> +#if QWT_VERSION >= 0x060000 +#include <qwt_compat.h> +#endif + class WaterfallDisplayPlot:public QwtPlot{ Q_OBJECT @@ -73,7 +77,7 @@ public: public slots: void resizeSlot( QSize *s ); - void OnPickerPointSelected(const QwtDoublePoint & p); + void OnPickerPointSelected(const QPointF & p); signals: void UpdatedLowerIntensityLevel(const double); diff --git a/gr-qtgui/lib/plot_waterfall.cc b/gr-qtgui/lib/plot_waterfall.cc index 2b1447e03..e8e9c0e49 100644 --- a/gr-qtgui/lib/plot_waterfall.cc +++ b/gr-qtgui/lib/plot_waterfall.cc @@ -2,68 +2,35 @@ #include <qpen.h> #include <qpainter.h> #include "qwt_painter.h" -#include "qwt_double_interval.h" #include "qwt_scale_map.h" #include "qwt_color_map.h" #include "plot_waterfall.h" -#if QT_VERSION < 0x040000 -typedef Q3ValueVector<QRgb> QwtColorTable; -#else -typedef QVector<QRgb> QwtColorTable; +#if QWT_VERSION < 0x060000 +#include "qwt_double_interval.h" #endif +typedef QVector<QRgb> QwtColorTable; class PlotWaterfallImage: public QImage { // This class hides some Qt3/Qt4 API differences public: PlotWaterfallImage(const QSize &size, QwtColorMap::Format format): -#if QT_VERSION < 0x040000 - QImage(size, format == QwtColorMap::RGB ? 32 : 8) -#else - QImage(size, format == QwtColorMap::RGB - ? QImage::Format_ARGB32 : QImage::Format_Indexed8 ) -#endif - { - } - - PlotWaterfallImage(const QImage &other): - QImage(other) - { - } - - void initColorTable(const QImage& other) - { -#if QT_VERSION < 0x040000 - const unsigned int numColors = other.numColors(); - - setNumColors(numColors); - for ( unsigned int i = 0; i < numColors; i++ ) - setColor(i, other.color(i)); -#else - setColorTable(other.colorTable()); -#endif - } - -#if QT_VERSION < 0x040000 - - void setColorTable(const QwtColorTable &colorTable) - { - setNumColors(colorTable.size()); - for ( unsigned int i = 0; i < colorTable.size(); i++ ) - setColor(i, colorTable[i]); - } - - QwtColorTable colorTable() const - { - QwtColorTable table(numColors()); - for ( int i = 0; i < numColors(); i++ ) - table[i] = color(i); - - return table; - } -#endif + QImage(size, format == QwtColorMap::RGB + ? QImage::Format_ARGB32 : QImage::Format_Indexed8 ) + { + } + + PlotWaterfallImage(const QImage &other): + QImage(other) + { + } + + void initColorTable(const QImage& other) + { + setColorTable(other.colorTable()); + } }; class PlotWaterfall::PrivateData @@ -138,7 +105,11 @@ int PlotWaterfall::rtti() const 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(); itemChanged(); @@ -156,10 +127,12 @@ const QwtColorMap &PlotWaterfall::colorMap() const \return Bounding rect of the data \sa QwtRasterData::boundingRect */ +#if QWT_VERSION < 0x060000 QwtDoubleRect PlotWaterfall::boundingRect() const { - return d_data->data->boundingRect(); + return d_data->data->boundingRect(); } +#endif /*! \brief Returns the recommended raster for a given rect. @@ -170,10 +143,12 @@ QwtDoubleRect PlotWaterfall::boundingRect() const \param rect Rect for the raster hint \return data().rasterHint(rect) */ +#if 0 QSize PlotWaterfall::rasterHint(const QwtDoubleRect &rect) const { - return d_data->data->rasterHint(rect); + return d_data->data->rasterHint(rect); } +#endif /*! \brief Render an image from the data and color map. @@ -192,19 +167,21 @@ QSize PlotWaterfall::rasterHint(const QwtDoubleRect &rect) const \sa QwtRasterData::intensity(), QwtColorMap::rgb(), QwtColorMap::colorIndex() */ -QImage PlotWaterfall::renderImage( - const QwtScaleMap &xMap, const QwtScaleMap &yMap, - const QwtDoubleRect &area) const +QImage PlotWaterfall::renderImage(const QwtScaleMap &xMap, + const QwtScaleMap &yMap, + const QRectF &area, + const QSize &size) const { if ( area.isEmpty() ) return QImage(); - QRect rect = transform(xMap, yMap, area); + //QRect rect = transform(xMap, yMap, area); + QRect rect = QRect(0,0,0,0); QwtScaleMap xxMap = xMap; QwtScaleMap yyMap = yMap; - const QSize res = d_data->data->rasterHint(area); + const QSize res(0,0); // = d_data->data->rasterHint(area); if ( res.isValid() ) { /* @@ -243,7 +220,11 @@ QImage PlotWaterfall::renderImage( PlotWaterfallImage image(rect.size(), d_data->colorMap->format()); +#if QWT_VERSION < 0x060000 const QwtDoubleInterval intensityRange = d_data->data->range(); +#else + const QwtInterval intensityRange = d_data->data->interval(); +#endif if ( !intensityRange.isValid() ) return image; @@ -292,13 +273,7 @@ QImage PlotWaterfall::renderImage( const bool vInvert = yyMap.p1() < yyMap.p2(); if ( hInvert || vInvert ) { -#ifdef __GNUC__ -#endif -#if QT_VERSION < 0x040000 - image = image.mirror(hInvert, vInvert); -#else - image = image.mirrored(hInvert, vInvert); -#endif + image = image.mirrored(hInvert, vInvert); } return image; @@ -317,8 +292,9 @@ QImage PlotWaterfall::renderImage( */ void PlotWaterfall::draw(QPainter *painter, - const QwtScaleMap &xMap, const QwtScaleMap &yMap, - const QRect &canvasRect) const + const QwtScaleMap &xMap, + const QwtScaleMap &yMap, + const QRectF &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 a11461611..ce24d88d8 100644 --- a/gr-qtgui/lib/plot_waterfall.h +++ b/gr-qtgui/lib/plot_waterfall.h @@ -3,9 +3,12 @@ #include <qglobal.h> #include <waterfallGlobalData.h> +#include <qwt_plot_rasteritem.h> -#include "qwt_valuelist.h" -#include "qwt_plot_rasteritem.h" +#if QWT_VERSION >= 0x060000 +#include <qwt_point_3d.h> // doesn't seem necessary, but is... +#include <qwt_compat.h> +#endif class QwtColorMap; @@ -22,7 +25,8 @@ class QwtColorMap; class PlotWaterfall: public QwtPlotRasterItem { public: - explicit PlotWaterfall(WaterfallData* data, const QString &title = QString::null); + explicit PlotWaterfall(WaterfallData* data, + const QString &title = QString::null); virtual ~PlotWaterfall(); const WaterfallData* data()const; @@ -30,19 +34,23 @@ public: void setColorMap(const QwtColorMap &); const QwtColorMap &colorMap() const; +#if QWT_VERSION < 0x060000 virtual QwtDoubleRect boundingRect() const; - virtual QSize rasterHint(const QwtDoubleRect &) const; +#endif + //virtual QSize rasterHint(const QwtDoubleRect &) const; virtual int rtti() const; virtual void draw(QPainter *p, - const QwtScaleMap &xMap, const QwtScaleMap &yMap, - const QRect &rect) const; + const QwtScaleMap &xMap, + const QwtScaleMap &yMap, + const QRectF &rect) const; protected: - virtual QImage renderImage( - const QwtScaleMap &xMap, const QwtScaleMap &yMap, - const QwtDoubleRect &rect) const; + QImage renderImage(const QwtScaleMap &xMap, + const QwtScaleMap &yMap, + const QRectF &rect, + const QSize &size=QSize(0,0)) const; private: class PrivateData; diff --git a/gr-qtgui/lib/qtgui_sink_f.h b/gr-qtgui/lib/qtgui_sink_f.h index 30db05eea..6d43f18dd 100644 --- a/gr-qtgui/lib/qtgui_sink_f.h +++ b/gr-qtgui/lib/qtgui_sink_f.h @@ -29,7 +29,6 @@ #include <gr_firdes.h> #include <gri_fft.h> #include <qapplication.h> -//#include <qtgui.h> #include "SpectrumGUIClass.h" class qtgui_sink_f; diff --git a/gr-qtgui/lib/qtgui_util.cc b/gr-qtgui/lib/qtgui_util.cc index 87b90997a..543ce1b1c 100644 --- a/gr-qtgui/lib/qtgui_util.cc +++ b/gr-qtgui/lib/qtgui_util.cc @@ -22,17 +22,24 @@ #include <qtgui_util.h> +#if QWT_VERSION < 0x060000 QwtPickerDblClickPointMachine::QwtPickerDblClickPointMachine() : QwtPickerMachine () { - } +#else +QwtPickerDblClickPointMachine::QwtPickerDblClickPointMachine() + : QwtPickerMachine (PointSelection) +{ +} +#endif QwtPickerDblClickPointMachine::~QwtPickerDblClickPointMachine() { } +#if QWT_VERSION < 0x060000 QwtPickerMachine::CommandList QwtPickerDblClickPointMachine::transition(const QwtEventPattern &eventPattern, const QEvent *e) @@ -53,10 +60,35 @@ QwtPickerDblClickPointMachine::transition(const QwtEventPattern &eventPattern, return cmdList; } +#else + +QList<QwtPickerMachine::Command> +QwtPickerDblClickPointMachine::transition(const QwtEventPattern &eventPattern, + const QEvent *e) +{ + QList<QwtPickerMachine::Command> cmdList; + switch(e->type()) { + case QEvent::MouseButtonDblClick: + if ( eventPattern.mouseMatch(QwtEventPattern::MouseSelect1, + (const QMouseEvent *)e) ) { + cmdList += QwtPickerMachine::Begin; + cmdList += QwtPickerMachine::Append; + cmdList += QwtPickerMachine::End; + } + break; + default: + break; + } + return cmdList; +} +#endif + QwtDblClickPlotPicker::QwtDblClickPlotPicker(QwtPlotCanvas* canvas) : QwtPlotPicker(canvas) { +#if QWT_VERSION < 0x060000 setSelectionFlags(QwtPicker::PointSelection); +#endif } QwtDblClickPlotPicker::~QwtDblClickPlotPicker() diff --git a/gr-qtgui/lib/qtgui_util.h b/gr-qtgui/lib/qtgui_util.h index 5b129c7b5..7b3692e75 100644 --- a/gr-qtgui/lib/qtgui_util.h +++ b/gr-qtgui/lib/qtgui_util.h @@ -44,7 +44,14 @@ public: QwtPickerDblClickPointMachine(); ~QwtPickerDblClickPointMachine(); - virtual CommandList transition( const QwtEventPattern &eventPattern, const QEvent *e); +#if QWT_VERSION < 0x060000 + virtual CommandList transition( const QwtEventPattern &eventPattern, + const QEvent *e); +#else + virtual QList<QwtPickerMachine::Command> + transition( const QwtEventPattern &eventPattern, + const QEvent *e); +#endif }; #endif /* INCLUDED_QTGUI_UTIL_H */ diff --git a/gr-qtgui/lib/spectrumdisplayform.cc b/gr-qtgui/lib/spectrumdisplayform.cc index d3ca01483..f52f96241 100644 --- a/gr-qtgui/lib/spectrumdisplayform.cc +++ b/gr-qtgui/lib/spectrumdisplayform.cc @@ -34,37 +34,37 @@ SpectrumDisplayForm::SpectrumDisplayForm(QWidget* parent) _intValidator = new QIntValidator(this); _intValidator->setBottom(0); _frequencyDisplayPlot = new FrequencyDisplayPlot(FrequencyPlotDisplayFrame); - _waterfallDisplayPlot = new WaterfallDisplayPlot(WaterfallPlotDisplayFrame); + //_waterfallDisplayPlot = new WaterfallDisplayPlot(WaterfallPlotDisplayFrame); - _timeDomainDisplayPlot = new TimeDomainDisplayPlot(2, TimeDomainDisplayFrame); - _constellationDisplayPlot = new ConstellationDisplayPlot(ConstellationDisplayFrame); + //_timeDomainDisplayPlot = new TimeDomainDisplayPlot(2, TimeDomainDisplayFrame); + //_constellationDisplayPlot = new ConstellationDisplayPlot(ConstellationDisplayFrame); _numRealDataPoints = 1024; _realFFTDataPoints = new double[_numRealDataPoints]; _averagedValues = new double[_numRealDataPoints]; _historyVector = new std::vector<double*>; - _timeDomainDisplayPlot->setTitle(0, "real"); - _timeDomainDisplayPlot->setTitle(1, "imag"); + //_timeDomainDisplayPlot->setTitle(0, "real"); + //_timeDomainDisplayPlot->setTitle(1, "imag"); AvgLineEdit->setRange(0, 500); // Set range of Average box value from 0 to 500 MinHoldCheckBox_toggled( false ); MaxHoldCheckBox_toggled( false ); - WaterfallMaximumIntensityWheel->setRange(-200, 0); - WaterfallMaximumIntensityWheel->setTickCnt(50); - WaterfallMinimumIntensityWheel->setRange(-200, 0); - WaterfallMinimumIntensityWheel->setTickCnt(50); - WaterfallMinimumIntensityWheel->setValue(-200); + //WaterfallMaximumIntensityWheel->setRange(-200, 0); + //WaterfallMaximumIntensityWheel->setTickCnt(50); + //WaterfallMinimumIntensityWheel->setRange(-200, 0); + //WaterfallMinimumIntensityWheel->setTickCnt(50); + //WaterfallMinimumIntensityWheel->setValue(-200); _peakFrequency = 0; _peakAmplitude = -HUGE_VAL; _noiseFloorAmplitude = -HUGE_VAL; - connect(_waterfallDisplayPlot, SIGNAL(UpdatedLowerIntensityLevel(const double)), - _frequencyDisplayPlot, SLOT(SetLowerIntensityLevel(const double))); - connect(_waterfallDisplayPlot, SIGNAL(UpdatedUpperIntensityLevel(const double)), - _frequencyDisplayPlot, SLOT(SetUpperIntensityLevel(const double))); + //connect(_waterfallDisplayPlot, SIGNAL(UpdatedLowerIntensityLevel(const double)), + // _frequencyDisplayPlot, SLOT(SetLowerIntensityLevel(const double))); + //connect(_waterfallDisplayPlot, SIGNAL(UpdatedUpperIntensityLevel(const double)), + // _frequencyDisplayPlot, SLOT(SetUpperIntensityLevel(const double))); _frequencyDisplayPlot->SetLowerIntensityLevel(-200); _frequencyDisplayPlot->SetUpperIntensityLevel(-200); @@ -77,9 +77,9 @@ SpectrumDisplayForm::SpectrumDisplayForm(QWidget* parent) Reset(); ToggleTabFrequency(false); - ToggleTabWaterfall(false); - ToggleTabTime(false); - ToggleTabConstellation(false); + //ToggleTabWaterfall(false); + //ToggleTabTime(false); + //ToggleTabConstellation(false); _historyEntry = 0; _historyEntryCount = 0; @@ -90,16 +90,16 @@ SpectrumDisplayForm::SpectrumDisplayForm(QWidget* parent) // Connect double click signals up connect(_frequencyDisplayPlot, SIGNAL(plotPointSelected(const QPointF)), - this, SLOT(onFFTPlotPointSelected(const QPointF))); + this, SLOT(onFFTPlotPointSelected(const QPointF))); - connect(_waterfallDisplayPlot, SIGNAL(plotPointSelected(const QPointF)), - this, SLOT(onWFallPlotPointSelected(const QPointF))); + //connect(_waterfallDisplayPlot, SIGNAL(plotPointSelected(const QPointF)), + // this, SLOT(onWFallPlotPointSelected(const QPointF))); - connect(_timeDomainDisplayPlot, SIGNAL(plotPointSelected(const QPointF)), - this, SLOT(onTimePlotPointSelected(const QPointF))); + //connect(_timeDomainDisplayPlot, SIGNAL(plotPointSelected(const QPointF)), + // this, SLOT(onTimePlotPointSelected(const QPointF))); - connect(_constellationDisplayPlot, SIGNAL(plotPointSelected(const QPointF)), - this, SLOT(onConstPlotPointSelected(const QPointF))); + //connect(_constellationDisplayPlot, SIGNAL(plotPointSelected(const QPointF)), + // this, SLOT(onConstPlotPointSelected(const QPointF))); } SpectrumDisplayForm::~SpectrumDisplayForm() @@ -238,6 +238,7 @@ SpectrumDisplayForm::newFrequencyData( const SpectrumUpdateEvent* spectrumUpdate _noiseFloorAmplitude, _peakFrequency, _peakAmplitude, d_update_time); } + /* if(tabindex == d_plot_time) { _timeDomainDisplayPlot->PlotNewData(timeDomainDataPoints, numTimeDomainDataPoints, @@ -258,7 +259,7 @@ SpectrumDisplayForm::newFrequencyData( const SpectrumUpdateEvent* spectrumUpdate spectrumUpdateEvent->getDroppedFFTFrames()); } } - + */ // Tell the system the GUI has been updated if(_systemSpecifiedFlag){ @@ -276,6 +277,7 @@ SpectrumDisplayForm::resizeEvent( QResizeEvent *e ) s.setHeight(FrequencyPlotDisplayFrame->height()); emit _frequencyDisplayPlot->resizeSlot(&s); + /* s.setWidth(TimeDomainDisplayFrame->width()); s.setHeight(TimeDomainDisplayFrame->height()); emit _timeDomainDisplayPlot->resizeSlot(&s); @@ -287,6 +289,7 @@ SpectrumDisplayForm::resizeEvent( QResizeEvent *e ) s.setWidth(ConstellationDisplayFrame->width()); s.setHeight(ConstellationDisplayFrame->height()); emit _constellationDisplayPlot->resizeSlot(&s); + */ } void @@ -299,8 +302,8 @@ SpectrumDisplayForm::customEvent( QEvent * e) //FFTSizeComboBox->setCurrentIndex(1); } - waterfallMinimumIntensityChangedCB(WaterfallMinimumIntensityWheel->value()); - waterfallMaximumIntensityChangedCB(WaterfallMaximumIntensityWheel->value()); + //waterfallMinimumIntensityChangedCB(WaterfallMinimumIntensityWheel->value()); + //waterfallMaximumIntensityChangedCB(WaterfallMaximumIntensityWheel->value()); // Clear any previous display Reset(); @@ -333,9 +336,9 @@ SpectrumDisplayForm::UpdateGuiTimer() // This is called by the displayTimer and redraws the canvases of // all of the plots. _frequencyDisplayPlot->canvas()->update(); - _waterfallDisplayPlot->canvas()->update(); - _timeDomainDisplayPlot->canvas()->update(); - _constellationDisplayPlot->canvas()->update(); + //_waterfallDisplayPlot->canvas()->update(); + //_timeDomainDisplayPlot->canvas()->update(); + //_constellationDisplayPlot->canvas()->update(); } @@ -417,6 +420,7 @@ SpectrumDisplayForm::SetFrequencyRange(const double newCenterFrequency, _centerFrequency, UseRFFrequenciesCheckBox->isChecked(), units, strunits[iunit]); + /* _waterfallDisplayPlot->SetFrequencyRange(_startFrequency, _stopFrequency, _centerFrequency, @@ -424,6 +428,7 @@ SpectrumDisplayForm::SetFrequencyRange(const double newCenterFrequency, units, strunits[iunit]); _timeDomainDisplayPlot->SetSampleRate(_stopFrequency - _startFrequency, units, strtime[iunit]); + */ } } @@ -512,7 +517,7 @@ SpectrumDisplayForm::Reset() { AverageDataReset(); - _waterfallDisplayPlot->Reset(); + //_waterfallDisplayPlot->Reset(); } @@ -561,6 +566,7 @@ SpectrumDisplayForm::UseRFFrequenciesCB( bool useRFFlag ) void SpectrumDisplayForm::waterfallMaximumIntensityChangedCB( double newValue ) { + /* if(newValue > WaterfallMinimumIntensityWheel->value()){ WaterfallMaximumIntensityLabel->setText(QString("%1 dB").arg(newValue, 0, 'f', 0)); } @@ -570,12 +576,14 @@ SpectrumDisplayForm::waterfallMaximumIntensityChangedCB( double newValue ) _waterfallDisplayPlot->SetIntensityRange(WaterfallMinimumIntensityWheel->value(), WaterfallMaximumIntensityWheel->value()); + */ } void SpectrumDisplayForm::waterfallMinimumIntensityChangedCB( double newValue ) { + /* if(newValue < WaterfallMaximumIntensityWheel->value()){ WaterfallMinimumIntensityLabel->setText(QString("%1 dB").arg(newValue, 0, 'f', 0)); } @@ -585,6 +593,7 @@ SpectrumDisplayForm::waterfallMinimumIntensityChangedCB( double newValue ) _waterfallDisplayPlot->SetIntensityRange(WaterfallMinimumIntensityWheel->value(), WaterfallMaximumIntensityWheel->value()); + */ } void @@ -599,6 +608,7 @@ SpectrumDisplayForm::FFTComboBoxSelectedCB( const QString &fftSizeString ) void SpectrumDisplayForm::WaterfallAutoScaleBtnCB() { + /* double minimumIntensity = _noiseFloorAmplitude - 5; if(minimumIntensity < WaterfallMinimumIntensityWheel->minValue()){ minimumIntensity = WaterfallMinimumIntensityWheel->minValue(); @@ -610,11 +620,13 @@ SpectrumDisplayForm::WaterfallAutoScaleBtnCB() } WaterfallMaximumIntensityWheel->setValue(maximumIntensity); waterfallMaximumIntensityChangedCB(maximumIntensity); + */ } void SpectrumDisplayForm::WaterfallIntensityColorTypeChanged( int newType ) { + /* QColor lowIntensityColor; QColor highIntensityColor; if(newType == WaterfallDisplayPlot::INTENSITY_COLOR_MAP_TYPE_USER_DEFINED){ @@ -636,6 +648,7 @@ SpectrumDisplayForm::WaterfallIntensityColorTypeChanged( int newType ) } _waterfallDisplayPlot->SetIntensityColorMapType(newType, lowIntensityColor, highIntensityColor); + */ } void @@ -656,6 +669,7 @@ SpectrumDisplayForm::ToggleTabFrequency(const bool state) void SpectrumDisplayForm::ToggleTabWaterfall(const bool state) { + /* if(state == true) { if(d_plot_waterfall == -1) { SpectrumTypeTab->addTab(WaterfallPage, "Waterfall Display"); @@ -666,11 +680,13 @@ SpectrumDisplayForm::ToggleTabWaterfall(const bool state) SpectrumTypeTab->removeTab(SpectrumTypeTab->indexOf(WaterfallPage)); d_plot_waterfall = -1; } + */ } void SpectrumDisplayForm::ToggleTabTime(const bool state) { + /* if(state == true) { if(d_plot_time == -1) { SpectrumTypeTab->addTab(TimeDomainPage, "Time Domain Display"); @@ -681,11 +697,13 @@ SpectrumDisplayForm::ToggleTabTime(const bool state) SpectrumTypeTab->removeTab(SpectrumTypeTab->indexOf(TimeDomainPage)); d_plot_time = -1; } + */ } void SpectrumDisplayForm::ToggleTabConstellation(const bool state) { + /* if(state == true) { if(d_plot_constellation == -1) { SpectrumTypeTab->addTab(ConstellationPage, "Constellation Display"); @@ -696,26 +714,27 @@ SpectrumDisplayForm::ToggleTabConstellation(const bool state) SpectrumTypeTab->removeTab(SpectrumTypeTab->indexOf(ConstellationPage)); d_plot_constellation = -1; } + */ } void SpectrumDisplayForm::SetTimeDomainAxis(double min, double max) { - _timeDomainDisplayPlot->setYaxis(min, max); + //_timeDomainDisplayPlot->setYaxis(min, max); } void SpectrumDisplayForm::SetConstellationAxis(double xmin, double xmax, double ymin, double ymax) { - _constellationDisplayPlot->set_axis(xmin, xmax, ymin, ymax); + //_constellationDisplayPlot->set_axis(xmin, xmax, ymin, ymax); } void SpectrumDisplayForm::SetConstellationPenSize(int size) { - _constellationDisplayPlot->set_pen_size( size ); + //_constellationDisplayPlot->set_pen_size( size ); } void diff --git a/gr-qtgui/lib/spectrumdisplayform.h b/gr-qtgui/lib/spectrumdisplayform.h index 30303a36f..77b796ae1 100644 --- a/gr-qtgui/lib/spectrumdisplayform.h +++ b/gr-qtgui/lib/spectrumdisplayform.h @@ -30,9 +30,9 @@ class SpectrumGUIClass; #include <SpectrumGUIClass.h> #include <FrequencyDisplayPlot.h> -#include <WaterfallDisplayPlot.h> -#include <TimeDomainDisplayPlot.h> -#include <ConstellationDisplayPlot.h> +//#include <WaterfallDisplayPlot.h> +//#include <TimeDomainDisplayPlot.h> +//#include <ConstellationDisplayPlot.h> #include <QValidator> #include <QTimer> #include <vector> @@ -112,9 +112,9 @@ private: double* _realFFTDataPoints; QIntValidator* _intValidator; FrequencyDisplayPlot* _frequencyDisplayPlot; - WaterfallDisplayPlot* _waterfallDisplayPlot; - TimeDomainDisplayPlot* _timeDomainDisplayPlot; - ConstellationDisplayPlot* _constellationDisplayPlot; + //WaterfallDisplayPlot* _waterfallDisplayPlot; + //TimeDomainDisplayPlot* _timeDomainDisplayPlot; + //ConstellationDisplayPlot* _constellationDisplayPlot; SpectrumGUIClass* _system; bool _systemSpecifiedFlag; double _centerFrequency; @@ -128,9 +128,9 @@ private: // whether or not to use a particular display int d_plot_fft; - int d_plot_waterfall; - int d_plot_time; - int d_plot_constellation; + //int d_plot_waterfall; + //int d_plot_time; + //int d_plot_constellation; QTimer *displayTimer; double d_update_time; diff --git a/gr-qtgui/lib/waterfallGlobalData.cc b/gr-qtgui/lib/waterfallGlobalData.cc index 1ba153f0d..66bea855a 100644 --- a/gr-qtgui/lib/waterfallGlobalData.cc +++ b/gr-qtgui/lib/waterfallGlobalData.cc @@ -7,10 +7,23 @@ WaterfallData::WaterfallData(const double minimumFrequency, const double maximumFrequency, const uint64_t fftPoints, const unsigned int historyExtent) +#if QWT_VERSION < 0x060000 : QwtRasterData(QwtDoubleRect(minimumFrequency /* X START */, 0 /* Y START */, maximumFrequency - minimumFrequency /* WIDTH */, static_cast<double>(historyExtent)/* HEIGHT */)) +#else + : QwtRasterData() +#endif { + _bounding_rect = QRectF(minimumFrequency, + 0, + maximumFrequency - minimumFrequency, + static_cast<double>(historyExtent)); + +#if QWT_VERSION >= 0x060000 + pixelHint(_bounding_rect); +#endif + _intensityRange = QwtDoubleInterval(-200.0, 0.0); _fftPoints = fftPoints; @@ -35,6 +48,7 @@ void WaterfallData::Reset() void WaterfallData::Copy(const WaterfallData* rhs) { +#if QWT_VERSION < 0x060000 if((_fftPoints != rhs->GetNumFFTPoints()) || (boundingRect() != rhs->boundingRect()) ){ _fftPoints = rhs->GetNumFFTPoints(); @@ -42,38 +56,74 @@ void WaterfallData::Copy(const WaterfallData* rhs) delete[] _spectrumData; _spectrumData = new double[_fftPoints * _historyLength]; } +#else + if(_fftPoints != rhs->GetNumFFTPoints()) { + _fftPoints = rhs->GetNumFFTPoints(); + delete[] _spectrumData; + _spectrumData = new double[_fftPoints * _historyLength]; + } +#endif + Reset(); SetSpectrumDataBuffer(rhs->GetSpectrumDataBuffer()); SetNumLinesToUpdate(rhs->GetNumLinesToUpdate()); + +#if QWT_VERSION < 0x060000 setRange(rhs->range()); +#else + setInterval(Qt::ZAxis, rhs->interval()); +#endif } void WaterfallData::ResizeData(const double startFreq, const double stopFreq, const uint64_t fftPoints) { +#if QWT_VERSION < 0x060000 if((fftPoints != GetNumFFTPoints()) || (boundingRect().width() != (stopFreq - startFreq)) || (boundingRect().left() != startFreq)){ + + setBoundingRect(QwtDoubleRect(startFreq, 0, + stopFreq-startFreq, + boundingRect().height())); + _fftPoints = fftPoints; + delete[] _spectrumData; + _spectrumData = new double[_fftPoints * _historyLength]; + } + +#else + + if((fftPoints != GetNumFFTPoints()) || + (_bounding_rect.width() != (stopFreq - startFreq)) || + (_bounding_rect.left() != startFreq)){ + + _bounding_rect = QRectF(startFreq, 0, + stopFreq-startFreq, + _bounding_rect.height()); + pixelHint(_bounding_rect); - setBoundingRect(QwtDoubleRect(startFreq, 0, stopFreq-startFreq, boundingRect().height())); _fftPoints = fftPoints; delete[] _spectrumData; _spectrumData = new double[_fftPoints * _historyLength]; } +#endif + Reset(); } QwtRasterData *WaterfallData::copy() const { - WaterfallData* returnData = new WaterfallData(boundingRect().left(), - boundingRect().right(), + WaterfallData* returnData = new WaterfallData(_bounding_rect.left(), + _bounding_rect.right(), _fftPoints, _historyLength); returnData->Copy(this); return returnData; } + +#if QWT_VERSION < 0x060000 QwtDoubleInterval WaterfallData::range() const { return _intensityRange; @@ -84,13 +134,27 @@ void WaterfallData::setRange(const QwtDoubleInterval& newRange) _intensityRange = newRange; } +#else + +QwtInterval WaterfallData::interval() const +{ + return _intensityRange; +} + +void WaterfallData::setInterval(Qt::Axis axis, const QwtInterval& newRange) +{ + _intensityRange = newRange; +} +#endif + + double WaterfallData::value(double x, double y) const { double returnValue = 0.0; - const unsigned int intY = static_cast<unsigned int>((1.0 - (y/boundingRect().height())) * - static_cast<double>(_historyLength - 1)); - const unsigned int intX = static_cast<unsigned int>((((x - boundingRect().left()) / boundingRect().width()) * + const unsigned int intY = static_cast<unsigned int>((1.0 - (y/_bounding_rect.height())) * + static_cast<double>(_historyLength-1)); + const unsigned int intX = static_cast<unsigned int>((((x - _bounding_rect.left()) / _bounding_rect.width()) * static_cast<double>(_fftPoints-1)) + 0.5); const int location = (intY * _fftPoints) + intX; diff --git a/gr-qtgui/lib/waterfallGlobalData.h b/gr-qtgui/lib/waterfallGlobalData.h index 51f65064c..f274daa2d 100644 --- a/gr-qtgui/lib/waterfallGlobalData.h +++ b/gr-qtgui/lib/waterfallGlobalData.h @@ -4,6 +4,10 @@ #include <qwt_raster_data.h> #include <inttypes.h> +#if QWT_VERSION >= 0x060000 +#include <qwt_point_3d.h> // doesn't seem necessary, but is... +#include <qwt_compat.h> +#endif class WaterfallData: public QwtRasterData { @@ -17,8 +21,14 @@ public: virtual void ResizeData(const double, const double, const uint64_t); virtual QwtRasterData *copy() const; + +#if QWT_VERSION < 0x060000 virtual QwtDoubleInterval range() const; virtual void setRange(const QwtDoubleInterval&); +#else + virtual QwtInterval interval() const; + virtual void setInterval(Qt::Axis axis, const QwtInterval&); +#endif virtual double value(double x, double y) const; @@ -38,7 +48,14 @@ protected: uint64_t _fftPoints; uint64_t _historyLength; int _numLinesToUpdate; + + QRectF _bounding_rect; + +#if QWT_VERSION < 0x060000 QwtDoubleInterval _intensityRange; +#else + QwtInterval _intensityRange; +#endif private: |