summaryrefslogtreecommitdiff
path: root/gr-qtgui/lib
diff options
context:
space:
mode:
authorTom Rondeau2011-10-16 16:32:41 -0400
committerTom Rondeau2011-10-16 16:32:41 -0400
commit4496fae2deea200755225c007a26f4c7be0470e9 (patch)
tree88a6c2e22e53180b07f48dd5d9fb33aa06217189 /gr-qtgui/lib
parent4ba2c75f9109b750f8c04b60a04f2100e33e9416 (diff)
downloadgnuradio-4496fae2deea200755225c007a26f4c7be0470e9.tar.gz
gnuradio-4496fae2deea200755225c007a26f4c7be0470e9.tar.bz2
gnuradio-4496fae2deea200755225c007a26f4c7be0470e9.zip
qtgui: waterfall plot mostly working under qwt6 (plots, but updates to scale and color not working yet).
Diffstat (limited to 'gr-qtgui/lib')
-rw-r--r--gr-qtgui/lib/Makefile.am2
-rw-r--r--gr-qtgui/lib/SpectrumGUIClass.cc2
-rw-r--r--gr-qtgui/lib/WaterfallDisplayPlot.cc78
-rw-r--r--gr-qtgui/lib/WaterfallDisplayPlot.h9
-rw-r--r--gr-qtgui/lib/plot_waterfall.cc29
-rw-r--r--gr-qtgui/lib/plot_waterfall.h1
-rw-r--r--gr-qtgui/lib/spectrumdisplayform.cc51
-rw-r--r--gr-qtgui/lib/spectrumdisplayform.h6
-rw-r--r--gr-qtgui/lib/waterfallGlobalData.cc75
-rw-r--r--gr-qtgui/lib/waterfallGlobalData.h5
10 files changed, 116 insertions, 142 deletions
diff --git a/gr-qtgui/lib/Makefile.am b/gr-qtgui/lib/Makefile.am
index 849ee8360..99c42a9f7 100644
--- a/gr-qtgui/lib/Makefile.am
+++ b/gr-qtgui/lib/Makefile.am
@@ -54,7 +54,6 @@ 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 \
@@ -70,7 +69,6 @@ grinclude_HEADERS = \
WaterfallDisplayPlot.h \
waterfallGlobalData.h \
ConstellationDisplayPlot.h \
- plot_waterfall.h \
spectrumdisplayform.h \
timedisplayform.h \
SpectrumGUIClass.h \
diff --git a/gr-qtgui/lib/SpectrumGUIClass.cc b/gr-qtgui/lib/SpectrumGUIClass.cc
index f71f457d9..af95e2bb2 100644
--- a/gr-qtgui/lib/SpectrumGUIClass.cc
+++ b/gr-qtgui/lib/SpectrumGUIClass.cc
@@ -104,7 +104,7 @@ SpectrumGUIClass::OpenSpectrumWindow(QWidget* parent,
// Toggle Windows on/off
_spectrumDisplayForm->ToggleTabFrequency(frequency);
- //_spectrumDisplayForm->ToggleTabWaterfall(waterfall);
+ _spectrumDisplayForm->ToggleTabWaterfall(waterfall);
_spectrumDisplayForm->ToggleTabTime(time);
_spectrumDisplayForm->ToggleTabConstellation(constellation);
diff --git a/gr-qtgui/lib/WaterfallDisplayPlot.cc b/gr-qtgui/lib/WaterfallDisplayPlot.cc
index 8d0622c94..b7e511b5b 100644
--- a/gr-qtgui/lib/WaterfallDisplayPlot.cc
+++ b/gr-qtgui/lib/WaterfallDisplayPlot.cc
@@ -241,8 +241,6 @@ WaterfallDisplayPlot::WaterfallDisplayPlot(QWidget* parent)
resize(parent->width(), parent->height());
_numPoints = 1024;
- _waterfallData = new WaterfallData(_startFrequency, _stopFrequency, _numPoints, 200);
-
QPalette palette;
palette.setColor(canvas()->backgroundRole(), QColor("white"));
canvas()->setPalette(palette);
@@ -255,24 +253,26 @@ WaterfallDisplayPlot::WaterfallDisplayPlot(QWidget* parent)
_lastReplot = 0;
- d_spectrogram = new PlotWaterfall(_waterfallData, "Waterfall Display");
-
_intensityColorMapType = INTENSITY_COLOR_MAP_TYPE_MULTI_COLOR;
- QwtLinearColorMap colorMap(Qt::darkCyan, Qt::white);
- colorMap.addColorStop(0.25, Qt::cyan);
- colorMap.addColorStop(0.5, Qt::yellow);
- colorMap.addColorStop(0.75, Qt::red);
+ QwtLinearColorMap *colorMap = new QwtLinearColorMap(Qt::darkCyan, Qt::white);
+ colorMap->addColorStop(0.25, Qt::cyan);
+ colorMap->addColorStop(0.5, Qt::yellow);
+ colorMap->addColorStop(0.75, Qt::red);
- d_spectrogram->setColorMap(colorMap);
+ d_data = new WaterfallData(_startFrequency, _stopFrequency,
+ _numPoints, 200);
+ d_spectrogram = new QwtPlotSpectrogram("Spectrogram");
+ d_spectrogram->setColorMap(colorMap);
+ d_spectrogram->setData(d_data);
d_spectrogram->attach(this);
+ d_spectrogram->setDisplayMode(QwtPlotSpectrogram::ImageMode, true);
// LeftButton for the zooming
// MidButton for the panning
// RightButton: zoom out by 1
// Ctrl+RighButton: zoom out to full size
-
_zoomer = new WaterfallZoomer(canvas(), 0);
#if QWT_VERSION < 0x060000
_zoomer->setSelectionFlags(QwtPicker::RectSelection | QwtPicker::DragSelection);
@@ -298,7 +298,7 @@ WaterfallDisplayPlot::WaterfallDisplayPlot(QWidget* parent)
QwtScaleDraw *sd = axisScaleDraw(QwtPlot::yLeft);
sd->setMinimumExtent( fm.width("100.00") );
- const QColor c(Qt::white);
+ const QColor c(Qt::black);
_zoomer->setRubberBandPen(c);
_zoomer->setTrackerPen(c);
@@ -309,15 +309,14 @@ WaterfallDisplayPlot::WaterfallDisplayPlot(QWidget* parent)
WaterfallDisplayPlot::~WaterfallDisplayPlot()
{
- delete _waterfallData;
delete d_spectrogram;
}
void
WaterfallDisplayPlot::Reset()
{
- _waterfallData->ResizeData(_startFrequency, _stopFrequency, _numPoints);
- _waterfallData->Reset();
+ d_data->ResizeData(_startFrequency, _stopFrequency, _numPoints);
+ d_data->Reset();
setAxisScale(QwtPlot::xBottom, _startFrequency, _stopFrequency);
@@ -410,9 +409,8 @@ WaterfallDisplayPlot::PlotNewData(const double* dataPoints,
}
if(gruel::high_res_timer_now() - _lastReplot > timePerFFT*gruel::high_res_timer_tps()) {
- //FIXME: We may want to average the data between these updates to smooth display
- _waterfallData->addFFTData(dataPoints, numDataPoints, droppedFrames);
- _waterfallData->IncrementNumLinesToUpdate();
+ d_data->addFFTData(dataPoints, numDataPoints, droppedFrames);
+ d_data->IncrementNumLinesToUpdate();
QwtTimeScaleDraw* timeScale = (QwtTimeScaleDraw*)axisScaleDraw(QwtPlot::yLeft);
timeScale->SetSecondsPerLine(timePerFFT);
@@ -423,7 +421,7 @@ WaterfallDisplayPlot::PlotNewData(const double* dataPoints,
d_spectrogram->invalidateCache();
d_spectrogram->itemChanged();
-
+
replot();
_lastReplot = gruel::high_res_timer_now();
@@ -433,14 +431,8 @@ WaterfallDisplayPlot::PlotNewData(const double* dataPoints,
void
WaterfallDisplayPlot::SetIntensityRange(const double minIntensity,
- const double maxIntensity)
+ 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);
@@ -453,7 +445,8 @@ WaterfallDisplayPlot::replot()
QwtTimeScaleDraw* timeScale = (QwtTimeScaleDraw*)axisScaleDraw(QwtPlot::yLeft);
timeScale->initiateUpdate();
- WaterfallFreqDisplayScaleDraw* freqScale = (WaterfallFreqDisplayScaleDraw*)axisScaleDraw(QwtPlot::xBottom);
+ WaterfallFreqDisplayScaleDraw* freqScale = \
+ (WaterfallFreqDisplayScaleDraw*)axisScaleDraw(QwtPlot::xBottom);
freqScale->initiateUpdate();
// Update the time axis display
@@ -496,29 +489,29 @@ WaterfallDisplayPlot::SetIntensityColorMapType(const int newType,
switch(newType){
case INTENSITY_COLOR_MAP_TYPE_MULTI_COLOR:{
_intensityColorMapType = newType;
- QwtLinearColorMap colorMap(Qt::darkCyan, Qt::white);
- colorMap.addColorStop(0.25, Qt::cyan);
- colorMap.addColorStop(0.5, Qt::yellow);
- colorMap.addColorStop(0.75, Qt::red);
+ QwtLinearColorMap *colorMap = new QwtLinearColorMap(Qt::darkCyan, Qt::white);
+ colorMap->addColorStop(0.25, Qt::cyan);
+ colorMap->addColorStop(0.5, Qt::yellow);
+ colorMap->addColorStop(0.75, Qt::red);
d_spectrogram->setColorMap(colorMap);
break;
}
case INTENSITY_COLOR_MAP_TYPE_WHITE_HOT:{
_intensityColorMapType = newType;
- QwtLinearColorMap colorMap(Qt::black, Qt::white);
+ QwtLinearColorMap *colorMap = new QwtLinearColorMap(Qt::black, Qt::white);
d_spectrogram->setColorMap(colorMap);
break;
}
case INTENSITY_COLOR_MAP_TYPE_BLACK_HOT:{
_intensityColorMapType = newType;
- QwtLinearColorMap colorMap(Qt::white, Qt::black);
+ QwtLinearColorMap *colorMap = new QwtLinearColorMap(Qt::white, Qt::black);
d_spectrogram->setColorMap(colorMap);
break;
}
case INTENSITY_COLOR_MAP_TYPE_INCANDESCENT:{
_intensityColorMapType = newType;
- QwtLinearColorMap colorMap(Qt::black, Qt::white);
- colorMap.addColorStop(0.5, Qt::darkRed);
+ QwtLinearColorMap *colorMap = new QwtLinearColorMap(Qt::black, Qt::white);
+ colorMap->addColorStop(0.5, Qt::darkRed);
d_spectrogram->setColorMap(colorMap);
break;
}
@@ -526,7 +519,8 @@ WaterfallDisplayPlot::SetIntensityColorMapType(const int newType,
_userDefinedLowIntensityColor = lowColor;
_userDefinedHighIntensityColor = highColor;
_intensityColorMapType = newType;
- QwtLinearColorMap colorMap(_userDefinedLowIntensityColor, _userDefinedHighIntensityColor);
+ QwtLinearColorMap *colorMap = new QwtLinearColorMap(_userDefinedLowIntensityColor,
+ _userDefinedHighIntensityColor);
d_spectrogram->setColorMap(colorMap);
break;
}
@@ -561,11 +555,11 @@ WaterfallDisplayPlot::_UpdateIntensityRangeDisplay()
d_spectrogram->colorMap());
setAxisScale(QwtPlot::yRight,
d_spectrogram->data()->range().minValue(),
- d_spectrogram->data()->range().maxValue() );
+ d_spectrogram->data()->range().maxValue());
#else
- QwtInterval intv = d_spectrogram->data()->interval();
- QwtColorMap *map = (QwtColorMap*)(&d_spectrogram->colorMap());
- rightAxis->setColorMap(intv, map);
+ QwtInterval intv = d_spectrogram->interval(Qt::ZAxis);
+ const QwtColorMap *map = d_spectrogram->colorMap();
+ rightAxis->setColorMap(intv, (QwtColorMap*)map);
setAxisScale(QwtPlot::yRight, intv.minValue(), intv.maxValue());
#endif
@@ -574,8 +568,8 @@ WaterfallDisplayPlot::_UpdateIntensityRangeDisplay()
plotLayout()->setAlignCanvasToScales(true);
// Tell the display to redraw everything
- d_spectrogram->invalidateCache();
- d_spectrogram->itemChanged();
+ ////d_spectrogram->invalidateCache();
+ ////d_spectrogram->itemChanged();
// Draw again
replot();
@@ -588,7 +582,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 17eba13b2..90a72ff2e 100644
--- a/gr-qtgui/lib/WaterfallDisplayPlot.h
+++ b/gr-qtgui/lib/WaterfallDisplayPlot.h
@@ -26,11 +26,13 @@
#include <stdint.h>
#include <cstdio>
#include <qwt_plot.h>
+#include <qwt_plot_spectrogram.h>
#include <qwt_plot_zoomer.h>
#include <qwt_plot_panner.h>
#include <qtgui_util.h>
-#include <plot_waterfall.h>
+//#include <plot_waterfall.h>
+#include <waterfallGlobalData.h>
#include <gruel/high_res_timer.h>
@@ -93,14 +95,13 @@ private:
double _stopFrequency;
int _xAxisMultiplier;
- PlotWaterfall *d_spectrogram;
-
QwtPlotPanner* _panner;
QwtPlotZoomer* _zoomer;
QwtDblClickPlotPicker *_picker;
- WaterfallData* _waterfallData;
+ WaterfallData *d_data;
+ QwtPlotSpectrogram *d_spectrogram;
gruel::high_res_timer_type _lastReplot;
diff --git a/gr-qtgui/lib/plot_waterfall.cc b/gr-qtgui/lib/plot_waterfall.cc
index e8e9c0e49..26f41e722 100644
--- a/gr-qtgui/lib/plot_waterfall.cc
+++ b/gr-qtgui/lib/plot_waterfall.cc
@@ -36,18 +36,18 @@ public:
class PlotWaterfall::PrivateData
{
public:
- PrivateData()
- {
- data = NULL;
- colorMap = new QwtLinearColorMap();
- }
- ~PrivateData()
- {
- delete colorMap;
- }
-
- WaterfallData *data;
- QwtColorMap *colorMap;
+ PrivateData()
+ {
+ data = NULL;
+ colorMap = new QwtLinearColorMap();
+ }
+ ~PrivateData()
+ {
+ delete colorMap;
+ }
+
+ WaterfallData *data;
+ QwtColorMap *colorMap;
};
/*!
@@ -121,8 +121,9 @@ void PlotWaterfall::setColorMap(const QwtColorMap &colorMap)
*/
const QwtColorMap &PlotWaterfall::colorMap() const
{
- return *d_data->colorMap;
+ return *d_data->colorMap;
}
+
/*!
\return Bounding rect of the data
\sa QwtRasterData::boundingRect
@@ -223,7 +224,7 @@ QImage PlotWaterfall::renderImage(const QwtScaleMap &xMap,
#if QWT_VERSION < 0x060000
const QwtDoubleInterval intensityRange = d_data->data->range();
#else
- const QwtInterval intensityRange = d_data->data->interval();
+ const QwtInterval intensityRange = d_data->data->interval(Qt::ZAxis);
#endif
if ( !intensityRange.isValid() )
return image;
diff --git a/gr-qtgui/lib/plot_waterfall.h b/gr-qtgui/lib/plot_waterfall.h
index ce24d88d8..120b5b4cf 100644
--- a/gr-qtgui/lib/plot_waterfall.h
+++ b/gr-qtgui/lib/plot_waterfall.h
@@ -32,6 +32,7 @@ public:
const WaterfallData* data()const;
void setColorMap(const QwtColorMap &);
+
const QwtColorMap &colorMap() const;
#if QWT_VERSION < 0x060000
diff --git a/gr-qtgui/lib/spectrumdisplayform.cc b/gr-qtgui/lib/spectrumdisplayform.cc
index 6f82c03ff..9fe553557 100644
--- a/gr-qtgui/lib/spectrumdisplayform.cc
+++ b/gr-qtgui/lib/spectrumdisplayform.cc
@@ -34,7 +34,7 @@ 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);
_numRealDataPoints = 1024;
@@ -49,21 +49,21 @@ SpectrumDisplayForm::SpectrumDisplayForm(QWidget* parent)
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);
@@ -76,7 +76,7 @@ SpectrumDisplayForm::SpectrumDisplayForm(QWidget* parent)
Reset();
ToggleTabFrequency(false);
- //ToggleTabWaterfall(false);
+ ToggleTabWaterfall(false);
ToggleTabTime(false);
ToggleTabConstellation(false);
@@ -91,8 +91,8 @@ SpectrumDisplayForm::SpectrumDisplayForm(QWidget* parent)
connect(_frequencyDisplayPlot, SIGNAL(plotPointSelected(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)));
@@ -249,7 +249,6 @@ SpectrumDisplayForm::newFrequencyData( const SpectrumUpdateEvent* spectrumUpdate
d_update_time);
}
- /*
// Don't update the repeated data for the waterfall
if(!repeatDataFlag){
if(tabindex == d_plot_waterfall) {
@@ -258,7 +257,6 @@ SpectrumDisplayForm::newFrequencyData( const SpectrumUpdateEvent* spectrumUpdate
spectrumUpdateEvent->getDroppedFFTFrames());
}
}
- */
// Tell the system the GUI has been updated
if(_systemSpecifiedFlag){
@@ -280,11 +278,9 @@ SpectrumDisplayForm::resizeEvent( QResizeEvent *e )
s.setHeight(TimeDomainDisplayFrame->height());
emit _timeDomainDisplayPlot->resizeSlot(&s);
- /*
s.setWidth(WaterfallPlotDisplayFrame->width());
s.setHeight(WaterfallPlotDisplayFrame->height());
emit _waterfallDisplayPlot->resizeSlot(&s);
- */
s.setWidth(ConstellationDisplayFrame->width());
s.setHeight(ConstellationDisplayFrame->height());
@@ -298,11 +294,10 @@ SpectrumDisplayForm::customEvent( QEvent * e)
if(_systemSpecifiedFlag){
WindowComboBox->setCurrentIndex(_system->GetWindowType());
FFTSizeComboBox->setCurrentIndex(_system->GetFFTSizeIndex());
- //FFTSizeComboBox->setCurrentIndex(1);
}
- //waterfallMinimumIntensityChangedCB(WaterfallMinimumIntensityWheel->value());
- //waterfallMaximumIntensityChangedCB(WaterfallMaximumIntensityWheel->value());
+ waterfallMinimumIntensityChangedCB(WaterfallMinimumIntensityWheel->value());
+ waterfallMaximumIntensityChangedCB(WaterfallMaximumIntensityWheel->value());
// Clear any previous display
Reset();
@@ -335,7 +330,7 @@ SpectrumDisplayForm::UpdateGuiTimer()
// This is called by the displayTimer and redraws the canvases of
// all of the plots.
_frequencyDisplayPlot->canvas()->update();
- //_waterfallDisplayPlot->canvas()->update();
+ _waterfallDisplayPlot->canvas()->update();
_timeDomainDisplayPlot->canvas()->update();
_constellationDisplayPlot->canvas()->update();
}
@@ -419,13 +414,11 @@ SpectrumDisplayForm::SetFrequencyRange(const double newCenterFrequency,
_centerFrequency,
UseRFFrequenciesCheckBox->isChecked(),
units, strunits[iunit]);
- /*
_waterfallDisplayPlot->SetFrequencyRange(_startFrequency,
_stopFrequency,
_centerFrequency,
UseRFFrequenciesCheckBox->isChecked(),
units, strunits[iunit]);
- */
_timeDomainDisplayPlot->SetSampleRate(_stopFrequency - _startFrequency,
units, strtime[iunit]);
}
@@ -516,7 +509,7 @@ SpectrumDisplayForm::Reset()
{
AverageDataReset();
- //_waterfallDisplayPlot->Reset();
+ _waterfallDisplayPlot->Reset();
}
@@ -565,7 +558,6 @@ SpectrumDisplayForm::UseRFFrequenciesCB( bool useRFFlag )
void
SpectrumDisplayForm::waterfallMaximumIntensityChangedCB( double newValue )
{
- /*
if(newValue > WaterfallMinimumIntensityWheel->value()){
WaterfallMaximumIntensityLabel->setText(QString("%1 dB").arg(newValue, 0, 'f', 0));
}
@@ -575,14 +567,12 @@ 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));
}
@@ -592,7 +582,6 @@ SpectrumDisplayForm::waterfallMinimumIntensityChangedCB( double newValue )
_waterfallDisplayPlot->SetIntensityRange(WaterfallMinimumIntensityWheel->value(),
WaterfallMaximumIntensityWheel->value());
- */
}
void
@@ -607,7 +596,6 @@ SpectrumDisplayForm::FFTComboBoxSelectedCB( const QString &fftSizeString )
void
SpectrumDisplayForm::WaterfallAutoScaleBtnCB()
{
- /*
double minimumIntensity = _noiseFloorAmplitude - 5;
if(minimumIntensity < WaterfallMinimumIntensityWheel->minValue()){
minimumIntensity = WaterfallMinimumIntensityWheel->minValue();
@@ -619,13 +607,11 @@ 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){
@@ -647,7 +633,6 @@ SpectrumDisplayForm::WaterfallIntensityColorTypeChanged( int newType )
}
_waterfallDisplayPlot->SetIntensityColorMapType(newType, lowIntensityColor, highIntensityColor);
- */
}
void
@@ -668,7 +653,6 @@ SpectrumDisplayForm::ToggleTabFrequency(const bool state)
void
SpectrumDisplayForm::ToggleTabWaterfall(const bool state)
{
- /*
if(state == true) {
if(d_plot_waterfall == -1) {
SpectrumTypeTab->addTab(WaterfallPage, "Waterfall Display");
@@ -679,7 +663,6 @@ SpectrumDisplayForm::ToggleTabWaterfall(const bool state)
SpectrumTypeTab->removeTab(SpectrumTypeTab->indexOf(WaterfallPage));
d_plot_waterfall = -1;
}
- */
}
void
diff --git a/gr-qtgui/lib/spectrumdisplayform.h b/gr-qtgui/lib/spectrumdisplayform.h
index 8ee450daf..30303a36f 100644
--- a/gr-qtgui/lib/spectrumdisplayform.h
+++ b/gr-qtgui/lib/spectrumdisplayform.h
@@ -30,7 +30,7 @@ class SpectrumGUIClass;
#include <SpectrumGUIClass.h>
#include <FrequencyDisplayPlot.h>
-//#include <WaterfallDisplayPlot.h>
+#include <WaterfallDisplayPlot.h>
#include <TimeDomainDisplayPlot.h>
#include <ConstellationDisplayPlot.h>
#include <QValidator>
@@ -112,7 +112,7 @@ private:
double* _realFFTDataPoints;
QIntValidator* _intValidator;
FrequencyDisplayPlot* _frequencyDisplayPlot;
- //WaterfallDisplayPlot* _waterfallDisplayPlot;
+ WaterfallDisplayPlot* _waterfallDisplayPlot;
TimeDomainDisplayPlot* _timeDomainDisplayPlot;
ConstellationDisplayPlot* _constellationDisplayPlot;
SpectrumGUIClass* _system;
@@ -128,7 +128,7 @@ private:
// whether or not to use a particular display
int d_plot_fft;
- //int d_plot_waterfall;
+ int d_plot_waterfall;
int d_plot_time;
int d_plot_constellation;
diff --git a/gr-qtgui/lib/waterfallGlobalData.cc b/gr-qtgui/lib/waterfallGlobalData.cc
index 66bea855a..c57a3b5c1 100644
--- a/gr-qtgui/lib/waterfallGlobalData.cc
+++ b/gr-qtgui/lib/waterfallGlobalData.cc
@@ -12,18 +12,9 @@ WaterfallData::WaterfallData(const double minimumFrequency,
maximumFrequency - minimumFrequency /* WIDTH */,
static_cast<double>(historyExtent)/* HEIGHT */))
#else
- : QwtRasterData()
+ : 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;
@@ -31,6 +22,12 @@ WaterfallData::WaterfallData(const double minimumFrequency,
_spectrumData = new double[_fftPoints * _historyLength];
+#if QWT_VERSION >= 0x060000
+ setInterval(Qt::XAxis, QwtInterval(minimumFrequency, maximumFrequency));
+ setInterval(Qt::YAxis, QwtInterval(0, historyExtent));
+ setInterval(Qt::ZAxis, QwtInterval(-200, 0.0));
+#endif
+
Reset();
}
@@ -71,7 +68,9 @@ void WaterfallData::Copy(const WaterfallData* rhs)
#if QWT_VERSION < 0x060000
setRange(rhs->range());
#else
- setInterval(Qt::ZAxis, rhs->interval());
+ setInterval(Qt::XAxis, rhs->interval(Qt::XAxis));
+ setInterval(Qt::YAxis, rhs->interval(Qt::YAxis));
+ setInterval(Qt::ZAxis, rhs->interval(Qt::ZAxis));
#endif
}
@@ -93,31 +92,33 @@ void WaterfallData::ResizeData(const double startFreq,
}
#else
-
if((fftPoints != GetNumFFTPoints()) ||
- (_bounding_rect.width() != (stopFreq - startFreq)) ||
- (_bounding_rect.left() != startFreq)){
+ (interval(Qt::XAxis).width() != (stopFreq - startFreq)) ||
+ (interval(Qt::XAxis).minValue() != startFreq)){
- _bounding_rect = QRectF(startFreq, 0,
- stopFreq-startFreq,
- _bounding_rect.height());
- pixelHint(_bounding_rect);
+ setInterval(Qt::XAxis, QwtInterval(startFreq, stopFreq));
_fftPoints = fftPoints;
delete[] _spectrumData;
_spectrumData = new double[_fftPoints * _historyLength];
}
#endif
-
-
+
Reset();
}
QwtRasterData *WaterfallData::copy() const
{
- WaterfallData* returnData = new WaterfallData(_bounding_rect.left(),
- _bounding_rect.right(),
+#if QWT_VERSION < 0x060000
+ WaterfallData* returnData = new WaterfallData(boundingRect().left(),
+ boundingRect().right(),
_fftPoints, _historyLength);
+#else
+ WaterfallData* returnData = new WaterfallData(interval(Qt::XAxis).minValue(),
+ interval(Qt::XAxis).maxValue(),
+ _fftPoints, _historyLength);
+#endif
+
returnData->Copy(this);
return returnData;
}
@@ -134,28 +135,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/_bounding_rect.height())) *
+
+#if QWT_VERSION < 0x060000
+ 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 - _bounding_rect.left()) / _bounding_rect.width()) *
+ const unsigned int intX = static_cast<unsigned int>((((x - boundingRect().left()) / boundingRect().width()) *
static_cast<double>(_fftPoints-1)) + 0.5);
+#else
+ double height = interval(Qt::YAxis).maxValue();
+ double left = interval(Qt::XAxis).minValue();
+ double right = interval(Qt::XAxis).maxValue();
+ double ylen = static_cast<double>(_historyLength-1);
+ double xlen = static_cast<double>(_fftPoints-1);
+ const unsigned int intY = static_cast<unsigned int>((1.0 - y/height) * ylen);
+ const unsigned int intX = static_cast<unsigned int>((((x - left) / (right-left)) * xlen) + 0.5);
+#endif
const int location = (intY * _fftPoints) + intX;
if((location > -1) && (location < static_cast<int64_t>(_fftPoints * _historyLength))){
@@ -196,7 +196,8 @@ void WaterfallData::addFFTData(const double* fftData,
}
// add the new buffer
- memcpy(&_spectrumData[(_historyLength - 1) * _fftPoints], fftData, _fftPoints*sizeof(double));
+ memcpy(&_spectrumData[(_historyLength - 1) * _fftPoints], fftData,
+ _fftPoints*sizeof(double));
}
}
diff --git a/gr-qtgui/lib/waterfallGlobalData.h b/gr-qtgui/lib/waterfallGlobalData.h
index f274daa2d..89e48da5f 100644
--- a/gr-qtgui/lib/waterfallGlobalData.h
+++ b/gr-qtgui/lib/waterfallGlobalData.h
@@ -25,9 +25,6 @@ public:
#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;
@@ -49,8 +46,6 @@ protected:
uint64_t _historyLength;
int _numLinesToUpdate;
- QRectF _bounding_rect;
-
#if QWT_VERSION < 0x060000
QwtDoubleInterval _intensityRange;
#else