diff options
author | Johnathan Corgan | 2010-10-06 12:52:44 -0700 |
---|---|---|
committer | Johnathan Corgan | 2010-10-06 12:52:44 -0700 |
commit | 1c936ad101cbd7edf8e6b96bf3f993163a7dcc7b (patch) | |
tree | d118e6dd1ab5c59fcf0257d256843a047ad55e39 /gr-qtgui/src/lib | |
parent | 9ccd86714958fb2bd0cdc457745737f6d20efd7f (diff) | |
parent | 125433fe84507cc84e585c1e06bb804fdb2ce043 (diff) | |
download | gnuradio-1c936ad101cbd7edf8e6b96bf3f993163a7dcc7b.tar.gz gnuradio-1c936ad101cbd7edf8e6b96bf3f993163a7dcc7b.tar.bz2 gnuradio-1c936ad101cbd7edf8e6b96bf3f993163a7dcc7b.zip |
Merge branch 'master' into next
* master:
Fixed setting of USB_LIBS for *win*
Fix so that non-Darwin OSs use USB_LIBS correctly for linking
New way of checking for various LIBUSB names; for legacy version, make sure the symbol 'usb_debug' exists (so-as to not use the 'compat' version).
Finally, the simple fix for the qtgui issues; also, changed the naming scheme output from _moc to .moc files because I think this looks cleaner.
Removing Waterfall3DPlot. The qwt_plot3d is too much of a hassle to deal with and the plotting is not that stable even when it does work. This does not change the API.
Fixed gitignore to reflect changes in moc/ui file naming.
Fixes a lot of warnings by cleaning up namespace issues.
Finally, the simple fix for the qtgui issues; also, changed the naming scheme output from _moc to .moc files because I think this looks cleaner.
Removing qwtplot3d dependency and fixing a missed include in waterfallGlobalData.h.
Removing Waterfall3DPlot. The qwt_plot3d is too much of a hassle to deal with and the plotting is not that stable even when it does work. This does not change the API.
Updating all of the QA code that I can actually test to work with the new XML output runners.
Updating all python QA programs in gnuradio-core to output XML files.
Adding gr_xmlrunner.py to Makefile.
Adding XML output to Python unittests.
Modified gcell and gr-atsc cppunit tests to output XML files, too. Gcell needs testing.
Moving XML output files from cppunit tests to $HOME/.gnuradio/unittests.
Adding an XML outputter for the CPP Unit tests. This is to a) store the output information but also b) for integration with Hudson for logging and displaying the results during the build stages. This only covers a few cases so far and I need to define a better place to save the output files.
Diffstat (limited to 'gr-qtgui/src/lib')
-rw-r--r-- | gr-qtgui/src/lib/.gitignore | 14 | ||||
-rw-r--r-- | gr-qtgui/src/lib/ConstellationDisplayPlot.cc | 1 | ||||
-rw-r--r-- | gr-qtgui/src/lib/FrequencyDisplayPlot.cc | 3 | ||||
-rw-r--r-- | gr-qtgui/src/lib/Makefile.am | 26 | ||||
-rw-r--r-- | gr-qtgui/src/lib/SpectrumGUIClass.cc | 4 | ||||
-rw-r--r-- | gr-qtgui/src/lib/SpectrumGUIClass.h | 3 | ||||
-rw-r--r-- | gr-qtgui/src/lib/TimeDomainDisplayPlot.cc | 1 | ||||
-rw-r--r-- | gr-qtgui/src/lib/Waterfall3DDisplayPlot.cc | 410 | ||||
-rw-r--r-- | gr-qtgui/src/lib/Waterfall3DDisplayPlot.h | 206 | ||||
-rw-r--r-- | gr-qtgui/src/lib/WaterfallDisplayPlot.cc | 1 | ||||
-rw-r--r-- | gr-qtgui/src/lib/qtgui_sink_c.cc | 10 | ||||
-rw-r--r-- | gr-qtgui/src/lib/qtgui_sink_c.h | 4 | ||||
-rw-r--r-- | gr-qtgui/src/lib/qtgui_sink_f.cc | 10 | ||||
-rw-r--r-- | gr-qtgui/src/lib/qtgui_sink_f.h | 4 | ||||
-rw-r--r-- | gr-qtgui/src/lib/spectrumdisplayform.cc | 183 | ||||
-rw-r--r-- | gr-qtgui/src/lib/spectrumdisplayform.h | 9 | ||||
-rw-r--r-- | gr-qtgui/src/lib/spectrumdisplayform.ui | 217 | ||||
-rw-r--r-- | gr-qtgui/src/lib/waterfallGlobalData.cc | 188 | ||||
-rw-r--r-- | gr-qtgui/src/lib/waterfallGlobalData.h | 32 |
19 files changed, 93 insertions, 1233 deletions
diff --git a/gr-qtgui/src/lib/.gitignore b/gr-qtgui/src/lib/.gitignore index 58c8081e5..11bb4342a 100644 --- a/gr-qtgui/src/lib/.gitignore +++ b/gr-qtgui/src/lib/.gitignore @@ -4,10 +4,10 @@ /.deps /qtgui.cc /qtgui.py -/WaterfallDisplayPlot_moc.cc -/Waterfall3DDisplayPlot_moc.cc -/TimeDomainDisplayPlot_moc.cc -/spectrumdisplayform_moc.cc -/spectrumdisplayform_ui.h -/FrequencyDisplayPlot_moc.cc -/ConstellationDisplayPlot_moc.cc +/WaterfallDisplayPlot.moc.cc +/Waterfall3DDisplayPlot.moc.cc +/TimeDomainDisplayPlot.moc.cc +/spectrumdisplayform.moc.cc +/spectrumdisplayform.ui.h +/FrequencyDisplayPlot.moc.cc +/ConstellationDisplayPlot.moc.cc diff --git a/gr-qtgui/src/lib/ConstellationDisplayPlot.cc b/gr-qtgui/src/lib/ConstellationDisplayPlot.cc index e8e6288f5..9ad5bdd3c 100644 --- a/gr-qtgui/src/lib/ConstellationDisplayPlot.cc +++ b/gr-qtgui/src/lib/ConstellationDisplayPlot.cc @@ -24,6 +24,7 @@ public: } protected: + using QwtPlotZoomer::trackerText; virtual QwtText trackerText( const QwtDoublePoint& p ) const { QwtText t(QString("(%1, %2)").arg(p.x(), 0, 'f', 4). diff --git a/gr-qtgui/src/lib/FrequencyDisplayPlot.cc b/gr-qtgui/src/lib/FrequencyDisplayPlot.cc index f2cde322e..d150e2e4c 100644 --- a/gr-qtgui/src/lib/FrequencyDisplayPlot.cc +++ b/gr-qtgui/src/lib/FrequencyDisplayPlot.cc @@ -79,7 +79,8 @@ public: } protected: - virtual QwtText trackerText( const QwtDoublePoint& p ) const + using QwtPlotZoomer::trackerText; + virtual QwtText trackerText( const QwtDoublePoint& p ) const { QwtText t(QString("%1 %2, %3 dB"). arg(p.x(), 0, 'f', GetFrequencyPrecision()). diff --git a/gr-qtgui/src/lib/Makefile.am b/gr-qtgui/src/lib/Makefile.am index 6d4a91257..4ba637ad6 100644 --- a/gr-qtgui/src/lib/Makefile.am +++ b/gr-qtgui/src/lib/Makefile.am @@ -27,13 +27,12 @@ AM_CPPFLAGS = $(STD_DEFINES_AND_INCLUDES) $(PYTHON_CPPFLAGS) \ # Only include these files in the build if qtgui passes configure checks # This is mostly to help make distcheck pass QMAKE_SOURCES = \ - spectrumdisplayform_moc.cc \ - FrequencyDisplayPlot_moc.cc \ - TimeDomainDisplayPlot_moc.cc \ - WaterfallDisplayPlot_moc.cc \ - Waterfall3DDisplayPlot_moc.cc \ - ConstellationDisplayPlot_moc.cc \ - spectrumdisplayform_ui.h + spectrumdisplayform.moc.cc \ + FrequencyDisplayPlot.moc.cc \ + TimeDomainDisplayPlot.moc.cc \ + WaterfallDisplayPlot.moc.cc \ + ConstellationDisplayPlot.moc.cc \ + spectrumdisplayform.ui.h EXTRA_DIST = spectrumdisplayform.ui @@ -47,7 +46,6 @@ libgnuradio_qtgui_la_SOURCES = \ FrequencyDisplayPlot.cc \ TimeDomainDisplayPlot.cc \ WaterfallDisplayPlot.cc \ - Waterfall3DDisplayPlot.cc \ waterfallGlobalData.cc \ ConstellationDisplayPlot.cc \ spectrumdisplayform.cc \ @@ -57,12 +55,13 @@ libgnuradio_qtgui_la_SOURCES = \ qtgui_sink_c.cc \ qtgui_sink_f.cc +nodist_libgnuradio_qtgui_la_SOURCES=$(BUILT_SOURCES) + # These headers get installed in ${prefix}/include/gnuradio grinclude_HEADERS = \ FrequencyDisplayPlot.h \ TimeDomainDisplayPlot.h \ WaterfallDisplayPlot.h \ - Waterfall3DDisplayPlot.h \ waterfallGlobalData.h \ ConstellationDisplayPlot.h \ highResTimeFunctions.h \ @@ -74,12 +73,11 @@ grinclude_HEADERS = \ qtgui_sink_c.h \ qtgui_sink_f.h -nodist_libqtsrc_la_SOURCES = $(QMAKE_SOURCES) - -%_moc.cc : %.h - $(QT_MOC_EXEC) -DQT_SHARED -DQT_NO_DEBUG -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_CORE_LIB -p $(srcdir) $< -o $@ +QT_MOC_FLAGS=-DQT_SHARED -DQT_NO_DEBUG -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_CORE_LIB +%.moc.cc : %.h + $(QT_MOC_EXEC) $(QT_MOC_FLAGS) -p $(srcdir) $< -o $@ -%_ui.h : %.ui +%.ui.h : %.ui $(QT_UIC_EXEC) $< -o $@ # magic flags diff --git a/gr-qtgui/src/lib/SpectrumGUIClass.cc b/gr-qtgui/src/lib/SpectrumGUIClass.cc index 8c1b36703..563ed34ba 100644 --- a/gr-qtgui/src/lib/SpectrumGUIClass.cc +++ b/gr-qtgui/src/lib/SpectrumGUIClass.cc @@ -61,8 +61,7 @@ SpectrumGUIClass::~SpectrumGUIClass() void SpectrumGUIClass::OpenSpectrumWindow(QWidget* parent, const bool frequency, const bool waterfall, - const bool waterfall3d, const bool time, - const bool constellation, + const bool time, const bool constellation, const bool use_openGL) { //_windowStateLock->Lock(); @@ -87,7 +86,6 @@ SpectrumGUIClass::OpenSpectrumWindow(QWidget* parent, // Toggle Windows on/off _spectrumDisplayForm->ToggleTabFrequency(frequency); _spectrumDisplayForm->ToggleTabWaterfall(waterfall); - _spectrumDisplayForm->ToggleTabWaterfall3D(waterfall3d); _spectrumDisplayForm->ToggleTabTime(time); _spectrumDisplayForm->ToggleTabConstellation(constellation); diff --git a/gr-qtgui/src/lib/SpectrumGUIClass.h b/gr-qtgui/src/lib/SpectrumGUIClass.h index 17d3a54c1..63a340c34 100644 --- a/gr-qtgui/src/lib/SpectrumGUIClass.h +++ b/gr-qtgui/src/lib/SpectrumGUIClass.h @@ -31,8 +31,7 @@ public: void OpenSpectrumWindow(QWidget*, const bool frequency=true, const bool waterfall=true, - const bool waterfall3d=true, const bool time=true, - const bool constellation=true, + const bool time=true, const bool constellation=true, const bool use_openGL=true); void SetDisplayTitle(const std::string); diff --git a/gr-qtgui/src/lib/TimeDomainDisplayPlot.cc b/gr-qtgui/src/lib/TimeDomainDisplayPlot.cc index c299f83a4..9c98cec5b 100644 --- a/gr-qtgui/src/lib/TimeDomainDisplayPlot.cc +++ b/gr-qtgui/src/lib/TimeDomainDisplayPlot.cc @@ -56,6 +56,7 @@ public: } protected: + using QwtPlotZoomer::trackerText; virtual QwtText trackerText( const QwtDoublePoint& p ) const { QwtText t(QString("%1 %2, %3 V").arg(p.x(), 0, 'f', GetTimePrecision()). diff --git a/gr-qtgui/src/lib/Waterfall3DDisplayPlot.cc b/gr-qtgui/src/lib/Waterfall3DDisplayPlot.cc deleted file mode 100644 index f676cb4af..000000000 --- a/gr-qtgui/src/lib/Waterfall3DDisplayPlot.cc +++ /dev/null @@ -1,410 +0,0 @@ -#ifndef WATERFALL_3D_DISPLAY_PLOT_C -#define WATERFALL_3D_DISPLAY_PLOT_C - -#include <Waterfall3DDisplayPlot.h> - -#include <qwt3d_helper.h> -#include <qapplication.h> - -Waterfall3DColorMap::Waterfall3DColorMap(): Qwt3D::Color(), QwtLinearColorMap(){ - _interval.setInterval(0, 1.0); - -} - -Waterfall3DColorMap::~Waterfall3DColorMap(){ - -} - -Qwt3D::RGBA -Waterfall3DColorMap::operator()(double, double, double z) const -{ - return Qwt3D::RGBA(Qwt3D::Qt2GL(color(_interval, z))); -} - -void -Waterfall3DColorMap::SetInterval(const double minValue, const double maxValue) -{ - _interval.setInterval(minValue, maxValue); -} - -Qwt3D::ColorVector& -Waterfall3DColorMap::createVector(Qwt3D::ColorVector& vec) -{ - // Generate 100 interval values and then return those - Qwt3D::ColorVector colorVec; - for(unsigned int number = 0; number < 100; number++){ - double value = (_interval.width() * (static_cast<double>(number) / 100.0)) + _interval.minValue(); - colorVec.push_back(operator()(0,0,value)); - } - vec = colorVec; - return vec; -} - - -const int Waterfall3DDisplayPlot::INTENSITY_COLOR_MAP_TYPE_MULTI_COLOR; -const int Waterfall3DDisplayPlot::INTENSITY_COLOR_MAP_TYPE_WHITE_HOT; -const int Waterfall3DDisplayPlot::INTENSITY_COLOR_MAP_TYPE_BLACK_HOT; -const int Waterfall3DDisplayPlot::INTENSITY_COLOR_MAP_TYPE_INCANDESCENT; -const int Waterfall3DDisplayPlot::INTENSITY_COLOR_MAP_TYPE_USER_DEFINED; - -Waterfall3DDisplayPlot::Waterfall3DDisplayPlot(QWidget* parent):Qwt3D::SurfacePlot(parent) -{ - _startFrequency = 0; - _stopFrequency = 4000; - - _createCoordinateSystemFlag = true; - - _initialized = false; - - _numPoints = 1024; - - _displayIntervalTime = (1.0/5.0); // 1/5 of a second between updates - - timespec_reset(&_lastReplot); - - _useCenterFrequencyFlag = false; - _centerFrequency = 0.0; - - _timePerFFT = 1.0; - timespec_reset(&_dataTimestamp); - - coordinates()->setAutoScale(false); - - _waterfallData = new Waterfall3DData(_startFrequency, _stopFrequency, _numPoints, 200); - _waterfallData->assign(this); - _waterfallData->create(); - - _intensityColorMapType = -1; - SetIntensityColorMapType(INTENSITY_COLOR_MAP_TYPE_MULTI_COLOR, Qt::white, Qt::black, true, true); - - legend()->setScale(Qwt3D::LINEARSCALE); - legend()->setTitleString("Intensity"); - - enableMouse(true); -} - -Waterfall3DDisplayPlot::~Waterfall3DDisplayPlot() -{ - delete _waterfallData; -} - -void -Waterfall3DDisplayPlot::Init() -{ - if(!_initialized && initializedGL()){ - resize(parentWidget()->width(), parentWidget()->height()); - - // Attempting to prevent valgrind uninitialized variable errors in QwtPlot3d::Drawable class - glDisable(GL_POLYGON_OFFSET_FILL); - - setPlotStyle(Qwt3D::FILLED); - - setCoordinateStyle(Qwt3D::FRAME); - setFloorStyle(Qwt3D::FLOORDATA); - setOrtho(true); - - _initialized = true; - } -} - -void -Waterfall3DDisplayPlot::Reset() -{ - _waterfallData->ResizeData(_startFrequency, _stopFrequency, _numPoints); - _waterfallData->Reset(); - - if(initializedGL()){ - setScale(1, static_cast<int>(((_stopFrequency - _startFrequency) / 200) ), 10); - } - - _createCoordinateSystemFlag = true; - - timespec_reset(&_dataTimestamp); - _timePerFFT = 1.0; -} - -void -Waterfall3DDisplayPlot::SetFrequencyRange(const double constStartFreq, - const double constStopFreq, - const double constCenterFreq, - const bool useCenterFrequencyFlag, - const double units, - const std::string &strunits) -{ - double startFreq = constStartFreq / units; - double stopFreq = constStopFreq / units; - double centerFreq = constCenterFreq / units; - - if(stopFreq > startFreq) { - _startFrequency = startFreq; - _stopFrequency = stopFreq; - - _useCenterFrequencyFlag = useCenterFrequencyFlag; - _centerFrequency = centerFreq; - - Reset(); - - // Only replot if screen is visible - if(isVisible()){ - replot(); - } - } -} - -bool -Waterfall3DDisplayPlot::loadFromData(double** data, unsigned int columns, unsigned int rows - ,double minx, double maxx, double miny, double maxy) -{ - - Qwt3D::GridData* gridPtr = (Qwt3D::GridData*)actualData_p; - - gridPtr->setPeriodic(false,false); - gridPtr->setSize(columns,rows); - readIn(*gridPtr,data,columns,rows,minx,maxx,miny,maxy); - calcNormals(*gridPtr); - - updateData(); - updateNormals(); - - if( _createCoordinateSystemFlag ){ - createCoordinateSystem(); - - for (unsigned i=0; i!=coordinates()->axes.size(); ++i) - { - coordinates()->axes[i].setMajors(5); - coordinates()->axes[i].setMinors(3); - } - - coordinates()->axes[Qwt3D::Y1].setLabelString("Time"); - coordinates()->axes[Qwt3D::Y2].setLabelString("Time"); - coordinates()->axes[Qwt3D::Y3].setLabelString("Time"); - coordinates()->axes[Qwt3D::Y4].setLabelString("Time"); - coordinates()->axes[Qwt3D::Z1].setLabelString("Intensity (dB)"); - coordinates()->axes[Qwt3D::Z2].setLabelString("Intensity (dB)"); - coordinates()->axes[Qwt3D::Z3].setLabelString("Intensity (dB)"); - coordinates()->axes[Qwt3D::Z4].setLabelString("Intensity (dB)"); - - coordinates()->axes[Qwt3D::X1].setLabelString((!_useCenterFrequencyFlag ? "Frequency (Hz)" : "Frequency (kHz)")); - coordinates()->axes[Qwt3D::X2].setLabelString((!_useCenterFrequencyFlag ? "Frequency (Hz)" : "Frequency (kHz)")); - coordinates()->axes[Qwt3D::X3].setLabelString((!_useCenterFrequencyFlag ? "Frequency (Hz)" : "Frequency (kHz)")); - coordinates()->axes[Qwt3D::X4].setLabelString((!_useCenterFrequencyFlag ? "Frequency (Hz)" : "Frequency (kHz)")); - - // The QwtPlot3D Interface takes ownership of these items, so there is no need to delete them... - coordinates()->axes[Qwt3D::X1].setScale(new FrequencyScale(_useCenterFrequencyFlag, _centerFrequency)); - coordinates()->axes[Qwt3D::X2].setScale(new FrequencyScale(_useCenterFrequencyFlag, _centerFrequency)); - coordinates()->axes[Qwt3D::X3].setScale(new FrequencyScale(_useCenterFrequencyFlag, _centerFrequency)); - coordinates()->axes[Qwt3D::X4].setScale(new FrequencyScale(_useCenterFrequencyFlag, _centerFrequency)); - - coordinates()->axes[Qwt3D::Y1].setScale(new TimeScale(this)); - coordinates()->axes[Qwt3D::Y2].setScale(new TimeScale(this)); - coordinates()->axes[Qwt3D::Y3].setScale(new TimeScale(this)); - coordinates()->axes[Qwt3D::Y4].setScale(new TimeScale(this)); - - coordinates()->axes[Qwt3D::Z1].setScale(new IntensityScale(_waterfallData->GetFloorValue())); - coordinates()->axes[Qwt3D::Z2].setScale(new IntensityScale(_waterfallData->GetFloorValue())); - coordinates()->axes[Qwt3D::Z3].setScale(new IntensityScale(_waterfallData->GetFloorValue())); - coordinates()->axes[Qwt3D::Z4].setScale(new IntensityScale(_waterfallData->GetFloorValue())); - - _createCoordinateSystemFlag = false; - } - - return true; -} - -double -Waterfall3DDisplayPlot::GetStartFrequency() const -{ - return _startFrequency; -} - -double -Waterfall3DDisplayPlot::GetStopFrequency() const -{ - return _stopFrequency; -} - -void -Waterfall3DDisplayPlot::PlotNewData(const double* dataPoints, - const int64_t numDataPoints, - const double timePerFFT, - const timespec timestamp, - const int droppedFrames) -{ - if(numDataPoints > 0){ - if(numDataPoints != _numPoints){ - _numPoints = numDataPoints; - - Reset(); - - if(isVisible()){ - replot(); - } - - _createCoordinateSystemFlag = true; - - _lastReplot = get_highres_clock(); - } - - _dataTimestamp = timestamp; - _timePerFFT = timePerFFT; - - _waterfallData->addFFTData(dataPoints, numDataPoints, droppedFrames); - _waterfallData->IncrementNumLinesToUpdate(); - } - - // Allow at least a 50% duty cycle - if(diff_timespec(get_highres_clock(), _lastReplot) > _displayIntervalTime){ - // Only update when window is visible - if(isVisible()){ - replot(); - } - - _lastReplot = get_highres_clock(); - } -} - -void -Waterfall3DDisplayPlot::SetIntensityRange(const double minIntensity, - const double maxIntensity) -{ - _waterfallData->SetFloorValue(minIntensity); - _waterfallData->setMinZ(0); - _waterfallData->setMaxZ(maxIntensity-minIntensity); - - _createCoordinateSystemFlag = true; - - emit UpdatedLowerIntensityLevel(minIntensity); - emit UpdatedUpperIntensityLevel(maxIntensity); - - SetIntensityColorMapType(_intensityColorMapType, - _userDefinedLowIntensityColor, - _userDefinedLowIntensityColor, true); -} - -void -Waterfall3DDisplayPlot::replot() -{ - if(!_initialized){ - Init(); - } - if(initializedGL()){ - const timespec startTime = get_highres_clock(); - - _waterfallData->create(); - - legend()->setMajors(4); - legend()->setMinors(5); - double start, stop; - coordinates()->axes[Qwt3D::Z1].limits(start,stop); - legend()->setLimits( _waterfallData->GetFloorValue(), _waterfallData->GetFloorValue() + stop - start ); - - coordinates()->axes[Qwt3D::X1].limits(start,stop); - - showColorLegend(true); - - updateGL(); - - double differenceTime = (diff_timespec(get_highres_clock(), startTime)); - - // Require at least a 20% duty cycle - differenceTime *= 4.0; - if(differenceTime > (1.0/5.0)){ - _displayIntervalTime = differenceTime; - } - } -} - -void -Waterfall3DDisplayPlot::resizeSlot( QSize *s ) -{ - resize(s->width(), s->height()); -} - -int -Waterfall3DDisplayPlot::GetIntensityColorMapType() const -{ - return _intensityColorMapType; -} - -void -Waterfall3DDisplayPlot::SetIntensityColorMapType(const int newType, - const QColor lowColor, - const QColor highColor, - const bool forceFlag, - const bool noReplotFlag) -{ - if(((_intensityColorMapType != newType) || forceFlag) || - ((newType == INTENSITY_COLOR_MAP_TYPE_USER_DEFINED) && - (lowColor.isValid() && highColor.isValid()))){ - - Waterfall3DColorMap* colorMap = new Waterfall3DColorMap(); - colorMap->SetInterval(_waterfallData->minZ(), _waterfallData->maxZ()); - - switch(newType){ - case INTENSITY_COLOR_MAP_TYPE_MULTI_COLOR:{ - _intensityColorMapType = newType; - colorMap->setColorInterval(Qt::darkCyan, Qt::white); - colorMap->addColorStop(0.25, Qt::cyan); - colorMap->addColorStop(0.5, Qt::yellow); - colorMap->addColorStop(0.75, Qt::red); - setBackgroundColor(Qwt3D::Qt2GL(Qt::gray)); - break; - } - case INTENSITY_COLOR_MAP_TYPE_WHITE_HOT:{ - _intensityColorMapType = newType; - colorMap->setColorInterval(Qt::black, Qt::white); - setBackgroundColor(Qwt3D::Qt2GL(Qt::blue)); - break; - } - case INTENSITY_COLOR_MAP_TYPE_BLACK_HOT:{ - _intensityColorMapType = newType; - colorMap->setColorInterval(Qt::white, Qt::black); - setBackgroundColor(Qwt3D::Qt2GL(Qt::blue)); - break; - } - case INTENSITY_COLOR_MAP_TYPE_INCANDESCENT:{ - _intensityColorMapType = newType; - colorMap->setColorInterval(Qt::black, Qt::white); - colorMap->addColorStop(0.5, Qt::darkRed); - setBackgroundColor(Qwt3D::Qt2GL(Qt::gray)); - break; - } - case INTENSITY_COLOR_MAP_TYPE_USER_DEFINED:{ - _userDefinedLowIntensityColor = lowColor; - _userDefinedHighIntensityColor = highColor; - _intensityColorMapType = newType; - colorMap->setColorInterval(_userDefinedLowIntensityColor, _userDefinedHighIntensityColor); - setBackgroundColor(Qwt3D::Qt2GL(Qt::white)); - break; - } - default: - colorMap->setColorInterval(Qt::black, Qt::white); - break; - } - - // Qwt3D takes over destruction of this object... - setDataColor(colorMap); - - if(!noReplotFlag){ - // Draw again - replot(); - - // Update the last replot timer - _lastReplot = get_highres_clock(); - } - } -} - -const QColor -Waterfall3DDisplayPlot::GetUserDefinedLowIntensityColor() const -{ - return _userDefinedLowIntensityColor; -} - -const QColor -Waterfall3DDisplayPlot::GetUserDefinedHighIntensityColor() const -{ - return _userDefinedHighIntensityColor; -} - -#endif /* WATERFALL_3D_DISPLAY_PLOT_C */ diff --git a/gr-qtgui/src/lib/Waterfall3DDisplayPlot.h b/gr-qtgui/src/lib/Waterfall3DDisplayPlot.h deleted file mode 100644 index 272bdf697..000000000 --- a/gr-qtgui/src/lib/Waterfall3DDisplayPlot.h +++ /dev/null @@ -1,206 +0,0 @@ -#ifndef WATERFALL_3D_DISPLAY_PLOT_HPP -#define WATERFALL_3D_DISPLAY_PLOT_HPP - -#include <cstdio> -#include <highResTimeFunctions.h> - -#include <waterfallGlobalData.h> -#include <qwt3d_surfaceplot.h> - -#include <qwt3d_color.h> -#include <qwt_color_map.h> - -class Waterfall3DColorMap: public Qwt3D::Color, public QwtLinearColorMap -{ -public: - Waterfall3DColorMap(); - virtual ~Waterfall3DColorMap(); - - virtual Qwt3D::RGBA operator()(double x, double y, double z)const; - virtual Qwt3D::ColorVector& createVector(Qwt3D::ColorVector& vec); - - virtual void SetInterval(const double minValue, const double maxValue); - -protected: - -private: - QwtDoubleInterval _interval; -}; - -class Waterfall3DDisplayPlot:public Qwt3D::SurfacePlot{ - Q_OBJECT - - protected: - class IntensityScale:public Qwt3D::LinearScale{ - - friend class Qwt3D::Axis; - friend class Qwt3D::qwt3d_ptr<Qwt3D::Scale>; - - private: - double _floor; - - public: - explicit IntensityScale(const double newFloor):_floor(newFloor){ } - virtual ~IntensityScale(){} - - virtual QString ticLabel(unsigned int idx) const{ - if (idx<majors_p.size()) - { - return QString("%1").arg( majors_p[idx] + GetFloorValue(), 0, 'f', 0 ); - } - return QString(""); - } - - virtual double GetFloorValue()const{ return _floor; } - virtual void SetFloorValue(const double newFloor){ _floor = newFloor; } - - //! Returns a new heap based object utilized from qwt3d_ptr - Scale* clone() const {return new IntensityScale(*this);} - }; - - class TimeScale:public Qwt3D::LinearScale{ - - friend class Qwt3D::Axis; - friend class Qwt3D::qwt3d_ptr<Qwt3D::Scale>; - friend class Waterfall3DDisplayPlot; - - private: - Waterfall3DDisplayPlot* _plot; - - public: - TimeScale(Waterfall3DDisplayPlot* plot ):_plot(plot){ - } - virtual ~TimeScale(){ - } - - virtual QString ticLabel(unsigned int idx) const{ - if (idx<majors_p.size()) - { - const timespec markerTime = timespec_add(_plot->_dataTimestamp, - -(_plot->_timePerFFT) * majors_p[idx]); - struct tm timeTm; - gmtime_r(&markerTime.tv_sec, &timeTm); - - char* timeBuffer = new char[128]; - snprintf(timeBuffer, 128, "%02d:%02d:%02d.%03ld", timeTm.tm_hour, - timeTm.tm_min, timeTm.tm_sec, (markerTime.tv_nsec / 1000000)); - QString returnBuffer(timeBuffer); - delete[] timeBuffer; - return returnBuffer; - } - return QString(""); - } - - //! Returns a new heap based object utilized from qwt3d_ptr - Scale* clone() const {return new TimeScale(*this);} - }; - - class FrequencyScale: public Qwt3D::LinearScale{ - - friend class Qwt3D::Axis; - friend class Qwt3D::qwt3d_ptr<Qwt3D::Scale>; - private: - double _centerFrequency; - bool _useCenterFrequencyFlag; - public: - FrequencyScale(bool useCenterFrequencyFlag, double centerFrequency) - : _centerFrequency(centerFrequency),_useCenterFrequencyFlag(useCenterFrequencyFlag) - {} - - virtual ~FrequencyScale(){} - - virtual QString ticLabel(unsigned int idx) const - { - if (idx<majors_p.size()) - { - if(!_useCenterFrequencyFlag){ - return QString("%1").arg( majors_p[idx], 0, 'f', 0 ); - - } - else{ - return QString("%1").arg( (majors_p[idx] + _centerFrequency)/1000.0, 0, 'f', 3 ); - } - } - return QString(""); - } - - //! Returns a new heap based object utilized from qwt3d_ptr - Scale* clone() const {return new FrequencyScale(*this);} - }; - -public: - Waterfall3DDisplayPlot(QWidget*); - virtual ~Waterfall3DDisplayPlot(); - - void Init(); - void Reset(); - - bool loadFromData(double** data, unsigned int columns, unsigned int rows - ,double minx, double maxx, double miny, double maxy); - - void SetFrequencyRange(const double, const double, - const double, const bool, - const double units, const std::string &strunits); - double GetStartFrequency()const; - double GetStopFrequency()const; - - void PlotNewData(const double* dataPoints, const int64_t numDataPoints, - const double timePerFFT, const timespec timestamp, - const int droppedFrames); - - void SetIntensityRange(const double minIntensity, const double maxIntensity); - - virtual void replot(void); - - int GetIntensityColorMapType()const; - void SetIntensityColorMapType( const int, const QColor, - const QColor, const bool forceFlag = false, - const bool noReplotFlag = false ); - const QColor GetUserDefinedLowIntensityColor()const; - const QColor GetUserDefinedHighIntensityColor()const; - - static const int INTENSITY_COLOR_MAP_TYPE_MULTI_COLOR = 0; - static const int INTENSITY_COLOR_MAP_TYPE_WHITE_HOT = 1; - static const int INTENSITY_COLOR_MAP_TYPE_BLACK_HOT = 2; - static const int INTENSITY_COLOR_MAP_TYPE_INCANDESCENT = 3; - static const int INTENSITY_COLOR_MAP_TYPE_USER_DEFINED = 4; - -public slots: - void resizeSlot( QSize *s ); - - -signals: - void UpdatedLowerIntensityLevel(const double); - void UpdatedUpperIntensityLevel(const double); - -protected: - - double _startFrequency; - double _stopFrequency; - - Waterfall3DData* _waterfallData; - - timespec _lastReplot; - - int64_t _numPoints; - - double _displayIntervalTime; - - int _intensityColorMapType; - QColor _userDefinedLowIntensityColor; - QColor _userDefinedHighIntensityColor; - - bool _useCenterFrequencyFlag; - double _centerFrequency; - - timespec _dataTimestamp; - double _timePerFFT; - bool _initialized; - - bool _createCoordinateSystemFlag; - -private: - -}; - -#endif /* WATERFALL_3D_DISPLAY_PLOT_HPP */ diff --git a/gr-qtgui/src/lib/WaterfallDisplayPlot.cc b/gr-qtgui/src/lib/WaterfallDisplayPlot.cc index e0804fa64..680c44756 100644 --- a/gr-qtgui/src/lib/WaterfallDisplayPlot.cc +++ b/gr-qtgui/src/lib/WaterfallDisplayPlot.cc @@ -186,6 +186,7 @@ public: } protected: + using QwtPlotZoomer::trackerText; virtual QwtText trackerText( const QwtDoublePoint& p ) const { QString yLabel(""); diff --git a/gr-qtgui/src/lib/qtgui_sink_c.cc b/gr-qtgui/src/lib/qtgui_sink_c.cc index f77045938..c12c451b0 100644 --- a/gr-qtgui/src/lib/qtgui_sink_c.cc +++ b/gr-qtgui/src/lib/qtgui_sink_c.cc @@ -64,10 +64,13 @@ qtgui_sink_c::qtgui_sink_c (int fftsize, int wintype, d_wintype((gr_firdes::win_type)(wintype)), d_center_freq(fc), d_bandwidth(bw), d_name(name), d_plotfreq(plotfreq), d_plotwaterfall(plotwaterfall), - d_plotwaterfall3d(plotwaterfall3d), d_plottime(plottime), - d_plotconst(plotconst), + d_plottime(plottime), d_plotconst(plotconst), d_parent(parent) { + if(plotwaterfall3d == true) { + fprintf(stderr, "Warning: plotting Waterfall3D has been removed; enabling plotwaterfall3d has no effect.\n"); + } + d_main_gui = NULL; pthread_mutex_init(&d_pmutex, NULL); lock(); @@ -141,8 +144,7 @@ qtgui_sink_c::initialize(const bool opengl) d_main_gui->OpenSpectrumWindow(d_parent, d_plotfreq, d_plotwaterfall, - d_plotwaterfall3d, d_plottime, - d_plotconst, + d_plottime, d_plotconst, opengl); // initialize update time to 10 times a second diff --git a/gr-qtgui/src/lib/qtgui_sink_c.h b/gr-qtgui/src/lib/qtgui_sink_c.h index 1f6c28473..9aee66503 100644 --- a/gr-qtgui/src/lib/qtgui_sink_c.h +++ b/gr-qtgui/src/lib/qtgui_sink_c.h @@ -23,12 +23,12 @@ #ifndef INCLUDED_QTGUI_SINK_C_H #define INCLUDED_QTGUI_SINK_C_H +#include <Python.h> #include <gr_block.h> #include <gr_firdes.h> #include <gri_fft.h> #include <qapplication.h> #include <qtgui.h> -#include <Python.h> #include "SpectrumGUIClass.h" class qtgui_sink_c; @@ -84,7 +84,7 @@ private: int d_index; gr_complex *d_residbuf; - bool d_plotfreq, d_plotwaterfall, d_plotwaterfall3d, d_plottime, d_plotconst; + bool d_plotfreq, d_plotwaterfall, d_plottime, d_plotconst; double d_update_time; diff --git a/gr-qtgui/src/lib/qtgui_sink_f.cc b/gr-qtgui/src/lib/qtgui_sink_f.cc index 976b1761b..ab4fd082d 100644 --- a/gr-qtgui/src/lib/qtgui_sink_f.cc +++ b/gr-qtgui/src/lib/qtgui_sink_f.cc @@ -64,10 +64,13 @@ qtgui_sink_f::qtgui_sink_f (int fftsize, int wintype, d_wintype((gr_firdes::win_type)(wintype)), d_center_freq(fc), d_bandwidth(bw), d_name(name), d_plotfreq(plotfreq), d_plotwaterfall(plotwaterfall), - d_plotwaterfall3d(plotwaterfall3d), d_plottime(plottime), - d_plotconst(plotconst), + d_plottime(plottime), d_plotconst(plotconst), d_parent(parent) { + if(plotwaterfall3d == true) { + fprintf(stderr, "Warning: plotting Waterfall3D has been removed; enabling plotwaterfall3d has no effect.\n"); + } + d_main_gui = NULL; pthread_mutex_init(&d_pmutex, NULL); lock(); @@ -136,8 +139,7 @@ qtgui_sink_f::initialize(const bool opengl) d_main_gui->OpenSpectrumWindow(d_parent, d_plotfreq, d_plotwaterfall, - d_plotwaterfall3d, d_plottime, - d_plotconst, + d_plottime, d_plotconst, opengl); // initialize update time to 10 times a second diff --git a/gr-qtgui/src/lib/qtgui_sink_f.h b/gr-qtgui/src/lib/qtgui_sink_f.h index f603da7b6..0cac35d90 100644 --- a/gr-qtgui/src/lib/qtgui_sink_f.h +++ b/gr-qtgui/src/lib/qtgui_sink_f.h @@ -23,12 +23,12 @@ #ifndef INCLUDED_QTGUI_SINK_F_H #define INCLUDED_QTGUI_SINK_F_H +#include <Python.h> #include <gr_block.h> #include <gr_firdes.h> #include <gri_fft.h> #include <qapplication.h> #include <qtgui.h> -#include <Python.h> #include "SpectrumGUIClass.h" class qtgui_sink_f; @@ -82,7 +82,7 @@ private: int d_index; float *d_residbuf; - bool d_plotfreq, d_plotwaterfall, d_plotwaterfall3d, d_plottime, d_plotconst; + bool d_plotfreq, d_plotwaterfall, d_plottime, d_plotconst; double d_update_time; diff --git a/gr-qtgui/src/lib/spectrumdisplayform.cc b/gr-qtgui/src/lib/spectrumdisplayform.cc index f52a63d1f..e0509a294 100644 --- a/gr-qtgui/src/lib/spectrumdisplayform.cc +++ b/gr-qtgui/src/lib/spectrumdisplayform.cc @@ -17,10 +17,6 @@ SpectrumDisplayForm::SpectrumDisplayForm(bool useOpenGL, QWidget* parent) _frequencyDisplayPlot = new FrequencyDisplayPlot(FrequencyPlotDisplayFrame); _waterfallDisplayPlot = new WaterfallDisplayPlot(WaterfallPlotDisplayFrame); - if((QGLFormat::hasOpenGL()) && (_useOpenGL)) { - //_waterfall3DDisplayPlot = new Waterfall3DDisplayPlot(Waterfall3DPlotDisplayFrame); - } - _timeDomainDisplayPlot = new TimeDomainDisplayPlot(TimeDomainDisplayFrame); _constellationDisplayPlot = new ConstellationDisplayPlot(ConstellationDisplayFrame); _numRealDataPoints = 1024; @@ -38,14 +34,6 @@ SpectrumDisplayForm::SpectrumDisplayForm(bool useOpenGL, QWidget* parent) WaterfallMinimumIntensityWheel->setTickCnt(50); WaterfallMinimumIntensityWheel->setValue(-200); - if((QGLFormat::hasOpenGL()) && (_useOpenGL)) { - Waterfall3DMaximumIntensityWheel->setRange(-200, 0); - Waterfall3DMaximumIntensityWheel->setTickCnt(50); - Waterfall3DMinimumIntensityWheel->setRange(-200, 0); - Waterfall3DMinimumIntensityWheel->setTickCnt(50); - Waterfall3DMinimumIntensityWheel->setValue(-200); - } - _peakFrequency = 0; _peakAmplitude = -HUGE_VAL; @@ -68,7 +56,6 @@ SpectrumDisplayForm::SpectrumDisplayForm(bool useOpenGL, QWidget* parent) ToggleTabFrequency(false); ToggleTabWaterfall(false); - ToggleTabWaterfall3D(false); ToggleTabTime(false); ToggleTabConstellation(false); @@ -134,11 +121,11 @@ SpectrumDisplayForm::newFrequencyData( const SpectrumUpdateEvent* spectrumUpdate const std::complex<float>* complexDataPointsPtr = complexDataPoints+numFFTDataPoints/2; double* realFFTDataPointsPtr = _realFFTDataPoints; - double sumMean, localPeakAmplitude, localPeakFrequency; + double sumMean = 0.0; + double localPeakAmplitude = -HUGE_VAL; + double localPeakFrequency = 0.0; const double fftBinSize = (_stopFrequency-_startFrequency) / static_cast<double>(numFFTDataPoints); - localPeakAmplitude = -HUGE_VAL; - sumMean = 0.0; // Run this twice to perform the fftshift operation on the data here as well std::complex<float> scaleFactor = std::complex<float>((float)numFFTDataPoints); @@ -229,15 +216,6 @@ SpectrumDisplayForm::newFrequencyData( const SpectrumUpdateEvent* spectrumUpdate d_update_time, dataTimestamp, spectrumUpdateEvent->getDroppedFFTFrames()); } - /* - if((QGLFormat::hasOpenGL()) && (_useOpenGL)) { - if( _openGLWaterfall3DFlag == 1 && (tabindex == d_plot_waterfall3d)) { - _waterfall3DDisplayPlot->PlotNewData(_realFFTDataPoints, numFFTDataPoints, - d_update_time, dataTimestamp, - spectrumUpdateEvent->getDroppedFFTFrames()); - } - } - */ } @@ -265,12 +243,6 @@ SpectrumDisplayForm::resizeEvent( QResizeEvent *e ) s.setHeight(WaterfallPlotDisplayFrame->height()); emit _waterfallDisplayPlot->resizeSlot(&s); - if((QGLFormat::hasOpenGL()) && (_useOpenGL)) { - s.setWidth(Waterfall3DPlotDisplayFrame->width()); - s.setHeight(Waterfall3DPlotDisplayFrame->height()); - //emit _waterfall3DDisplayPlot->resizeSlot(&s); - } - s.setWidth(ConstellationDisplayFrame->width()); s.setHeight(ConstellationDisplayFrame->height()); emit _constellationDisplayPlot->resizeSlot(&s); @@ -289,32 +261,6 @@ SpectrumDisplayForm::customEvent( QEvent * e) waterfallMinimumIntensityChangedCB(WaterfallMinimumIntensityWheel->value()); waterfallMaximumIntensityChangedCB(WaterfallMaximumIntensityWheel->value()); - // If the video card doesn't support OpenGL then don't display the 3D Waterfall - if((QGLFormat::hasOpenGL()) && (_useOpenGL)) { - waterfall3DMinimumIntensityChangedCB(Waterfall3DMinimumIntensityWheel->value()); - waterfall3DMaximumIntensityChangedCB(Waterfall3DMaximumIntensityWheel->value()); - - // Check for Hardware Acceleration of the OpenGL - /* - if(!_waterfall3DDisplayPlot->format().directRendering()){ - // Only ask this once while the program is running... - if(_openGLWaterfall3DFlag == -1){ - _openGLWaterfall3DFlag = 0; - if(QMessageBox::warning(this, "OpenGL Direct Rendering NOT Supported", "<center>The system's video card hardware or current drivers do not support direct hardware rendering of the OpenGL modules.</center><br><center>Software rendering is VERY processor intensive.</center><br><center>Do you want to use software rendering?</center>", QMessageBox::Yes, QMessageBox::No | QMessageBox::Default | QMessageBox::Escape) == QMessageBox::Yes){ - _openGLWaterfall3DFlag = 1; - } - } - } - else{ - _openGLWaterfall3DFlag = 1; - } - */ - } - - if(_openGLWaterfall3DFlag != 1){ - ToggleTabWaterfall3D(false); - } - // Clear any previous display Reset(); } @@ -347,8 +293,6 @@ SpectrumDisplayForm::UpdateGuiTimer() // all of the plots. _frequencyDisplayPlot->canvas()->update(); _waterfallDisplayPlot->canvas()->update(); - //if((QGLFormat::hasOpenGL()) && (_useOpenGL)) - //_waterfall3DDisplayPlot->canvas()->update(); _timeDomainDisplayPlot->canvas()->update(); _constellationDisplayPlot->canvas()->update(); } @@ -437,15 +381,6 @@ SpectrumDisplayForm::SetFrequencyRange(const double newCenterFrequency, _centerFrequency, UseRFFrequenciesCheckBox->isChecked(), units, strunits[iunit]); - if((QGLFormat::hasOpenGL()) && (_useOpenGL)) { - /* - _waterfall3DDisplayPlot->SetFrequencyRange(_startFrequency, - _stopFrequency, - _centerFrequency, - UseRFFrequenciesCheckBox->isChecked(), - units, strunits[iunit]); - */ - } _timeDomainDisplayPlot->SetSampleRate(_stopFrequency - _startFrequency, units, strtime[iunit]); } @@ -536,9 +471,6 @@ SpectrumDisplayForm::Reset() AverageDataReset(); _waterfallDisplayPlot->Reset(); - if((QGLFormat::hasOpenGL()) && (_useOpenGL)) { - //_waterfall3DDisplayPlot->Reset(); - } } @@ -614,44 +546,6 @@ SpectrumDisplayForm::waterfallMinimumIntensityChangedCB( double newValue ) } void -SpectrumDisplayForm::waterfall3DMaximumIntensityChangedCB( double newValue ) -{ - if((QGLFormat::hasOpenGL()) && (_useOpenGL)) { - if(newValue > Waterfall3DMinimumIntensityWheel->value()){ - Waterfall3DMaximumIntensityLabel->setText(QString("%1 dB").arg(newValue, 0, 'f', 0)); - } - else{ - Waterfall3DMaximumIntensityWheel->setValue(Waterfall3DMinimumIntensityWheel->value()); - } - - /* - _waterfall3DDisplayPlot->SetIntensityRange(Waterfall3DMinimumIntensityWheel->value(), - Waterfall3DMaximumIntensityWheel->value()); - */ - } -} - - -void -SpectrumDisplayForm::waterfall3DMinimumIntensityChangedCB( double newValue ) -{ - if((QGLFormat::hasOpenGL()) && (_useOpenGL)) { - if(newValue < Waterfall3DMaximumIntensityWheel->value()){ - Waterfall3DMinimumIntensityLabel->setText(QString("%1 dB").arg(newValue, 0, 'f', 0)); - } - else{ - Waterfall3DMinimumIntensityWheel->setValue(Waterfall3DMaximumIntensityWheel->value()); - } - - /* - _waterfall3DDisplayPlot->SetIntensityRange(Waterfall3DMinimumIntensityWheel->value(), - Waterfall3DMaximumIntensityWheel->value()); - */ - } -} - - -void SpectrumDisplayForm::FFTComboBoxSelectedCB( const QString &fftSizeString ) { if(_systemSpecifiedFlag){ @@ -677,24 +571,6 @@ SpectrumDisplayForm::WaterfallAutoScaleBtnCB() } void -SpectrumDisplayForm::Waterfall3DAutoScaleBtnCB() -{ - if((QGLFormat::hasOpenGL()) && (_useOpenGL)) { - double minimumIntensity = _noiseFloorAmplitude - 5; - if(minimumIntensity < Waterfall3DMinimumIntensityWheel->minValue()){ - minimumIntensity = Waterfall3DMinimumIntensityWheel->minValue(); - } - Waterfall3DMinimumIntensityWheel->setValue(minimumIntensity); - double maximumIntensity = _peakAmplitude + 10; - if(maximumIntensity > Waterfall3DMaximumIntensityWheel->maxValue()){ - maximumIntensity = Waterfall3DMaximumIntensityWheel->maxValue(); - } - Waterfall3DMaximumIntensityWheel->setValue(maximumIntensity); - waterfallMaximumIntensityChangedCB(maximumIntensity); - } -} - -void SpectrumDisplayForm::WaterfallIntensityColorTypeChanged( int newType ) { QColor lowIntensityColor; @@ -721,37 +597,6 @@ SpectrumDisplayForm::WaterfallIntensityColorTypeChanged( int newType ) } void -SpectrumDisplayForm::Waterfall3DIntensityColorTypeChanged( int newType ) -{ - if((QGLFormat::hasOpenGL()) && (_useOpenGL)) { - QColor lowIntensityColor; - QColor highIntensityColor; - if(newType == Waterfall3DDisplayPlot::INTENSITY_COLOR_MAP_TYPE_USER_DEFINED){ - // Select the Low Intensity Color - lowIntensityColor = _waterfallDisplayPlot->GetUserDefinedLowIntensityColor(); - if(!lowIntensityColor.isValid()){ - lowIntensityColor = Qt::black; - } - QMessageBox::information(this, "Low Intensity Color Selection", "In the next window, select the low intensity color for the waterfall display", QMessageBox::Ok); - lowIntensityColor = QColorDialog::getColor(lowIntensityColor, this); - - // Select the High Intensity Color - highIntensityColor = _waterfallDisplayPlot->GetUserDefinedHighIntensityColor(); - if(!highIntensityColor.isValid()){ - highIntensityColor = Qt::white; - } - QMessageBox::information(this, "High Intensity Color Selection", "In the next window, select the high intensity color for the waterfall display", QMessageBox::Ok); - highIntensityColor = QColorDialog::getColor(highIntensityColor, this); - } - /* - _waterfall3DDisplayPlot->SetIntensityColorMapType(newType, lowIntensityColor, - highIntensityColor); - */ - } -} - - -void SpectrumDisplayForm::ToggleTabFrequency(const bool state) { if(state == true) { @@ -782,28 +627,6 @@ SpectrumDisplayForm::ToggleTabWaterfall(const bool state) } void -SpectrumDisplayForm::ToggleTabWaterfall3D(const bool state) -{ - if(state == true) { - /* - if((QGLFormat::hasOpenGL()) && (_useOpenGL)) { - if(d_plot_waterfall3d == -1) { - SpectrumTypeTab->addTab(Waterfall3DPage, "3D Waterfall Display"); - d_plot_waterfall3d = SpectrumTypeTab->count()-1; - } - } - */ - SpectrumTypeTab->removeTab(SpectrumTypeTab->indexOf(Waterfall3DPage)); - d_plot_waterfall3d = -1; - fprintf(stderr, "\nWARNING: The Waterfall3D plot has been disabled until we get it working.\n\n"); - } - else { - SpectrumTypeTab->removeTab(SpectrumTypeTab->indexOf(Waterfall3DPage)); - d_plot_waterfall3d = -1; - } -} - -void SpectrumDisplayForm::ToggleTabTime(const bool state) { if(state == true) { diff --git a/gr-qtgui/src/lib/spectrumdisplayform.h b/gr-qtgui/src/lib/spectrumdisplayform.h index bf2af7033..fbd08349b 100644 --- a/gr-qtgui/src/lib/spectrumdisplayform.h +++ b/gr-qtgui/src/lib/spectrumdisplayform.h @@ -1,7 +1,7 @@ #ifndef SPECTRUM_DISPLAY_FORM_H #define SPECTRUM_DISPLAY_FORM_H -#include "spectrumdisplayform_ui.h" +#include "spectrumdisplayform.ui.h" class SpectrumGUIClass; #include <SpectrumGUIClass.h> @@ -9,7 +9,6 @@ class SpectrumGUIClass; #include <SpectrumGUIClass.h> #include <FrequencyDisplayPlot.h> #include <WaterfallDisplayPlot.h> -#include <Waterfall3DDisplayPlot.h> #include <TimeDomainDisplayPlot.h> #include <ConstellationDisplayPlot.h> #include <QValidator> @@ -54,15 +53,10 @@ public slots: void waterfallMinimumIntensityChangedCB(double); void WaterfallIntensityColorTypeChanged(int); void WaterfallAutoScaleBtnCB(); - void waterfall3DMaximumIntensityChangedCB(double); - void waterfall3DMinimumIntensityChangedCB(double); - void Waterfall3DIntensityColorTypeChanged(int); - void Waterfall3DAutoScaleBtnCB(); void FFTComboBoxSelectedCB(const QString&); void ToggleTabFrequency(const bool state); void ToggleTabWaterfall(const bool state); - void ToggleTabWaterfall3D(const bool state); void ToggleTabTime(const bool state); void ToggleTabConstellation(const bool state); @@ -92,7 +86,6 @@ private: QIntValidator* _intValidator; FrequencyDisplayPlot* _frequencyDisplayPlot; WaterfallDisplayPlot* _waterfallDisplayPlot; - Waterfall3DDisplayPlot* _waterfall3DDisplayPlot; TimeDomainDisplayPlot* _timeDomainDisplayPlot; ConstellationDisplayPlot* _constellationDisplayPlot; SpectrumGUIClass* _system; diff --git a/gr-qtgui/src/lib/spectrumdisplayform.ui b/gr-qtgui/src/lib/spectrumdisplayform.ui index 0e652d833..5a23bc8a9 100644 --- a/gr-qtgui/src/lib/spectrumdisplayform.ui +++ b/gr-qtgui/src/lib/spectrumdisplayform.ui @@ -467,190 +467,6 @@ </item> </layout> </widget> - <widget class="QWidget" name="Waterfall3DPage"> - <attribute name="title"> - <string>3D Waterfall Display</string> - </attribute> - <layout class="QGridLayout" name="gridLayout_6"> - <item row="0" column="0"> - <widget class="QLabel" name="textLabel1_2"> - <property name="minimumSize"> - <size> - <width>0</width> - <height>0</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>100</width> - <height>16777215</height> - </size> - </property> - <property name="text"> - <string>Intensity Display:</string> - </property> - <property name="wordWrap"> - <bool>false</bool> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QComboBox" name="Waterfall3DIntensityComboBox"> - <property name="maximumSize"> - <size> - <width>100</width> - <height>16777215</height> - </size> - </property> - <item> - <property name="text"> - <string>Color</string> - </property> - </item> - <item> - <property name="text"> - <string>White Hot</string> - </property> - </item> - <item> - <property name="text"> - <string>Black Hot</string> - </property> - </item> - <item> - <property name="text"> - <string>Incandescent</string> - </property> - </item> - <item> - <property name="text"> - <string>User Defined</string> - </property> - </item> - </widget> - </item> - <item row="0" column="2"> - <widget class="QwtWheel" name="Waterfall3DMaximumIntensityWheel"> - <property name="minimumSize"> - <size> - <width>200</width> - <height>0</height> - </size> - </property> - <property name="mouseTracking"> - <bool>true</bool> - </property> - <property name="focusPolicy"> - <enum>Qt::WheelFocus</enum> - </property> - <property name="valid"> - <bool>true</bool> - </property> - <property name="totalAngle"> - <double>200.000000000000000</double> - </property> - <property name="viewAngle"> - <double>20.000000000000000</double> - </property> - <property name="mass"> - <double>0.000000000000000</double> - </property> - </widget> - </item> - <item row="0" column="3"> - <widget class="QLabel" name="Waterfall3DMaximumIntensityLabel"> - <property name="maximumSize"> - <size> - <width>100</width> - <height>16777215</height> - </size> - </property> - <property name="text"> - <string>100 dB</string> - </property> - <property name="wordWrap"> - <bool>false</bool> - </property> - </widget> - </item> - <item row="1" column="0" colspan="4"> - <widget class="QFrame" name="Waterfall3DPlotDisplayFrame"> - <property name="frameShape"> - <enum>QFrame::NoFrame</enum> - </property> - <property name="frameShadow"> - <enum>QFrame::Plain</enum> - </property> - </widget> - </item> - <item row="2" column="0" colspan="2"> - <widget class="QPushButton" name="Waterfall3DAutoScaleBtn"> - <property name="minimumSize"> - <size> - <width>0</width> - <height>0</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>80</width> - <height>16777215</height> - </size> - </property> - <property name="sizeIncrement"> - <size> - <width>0</width> - <height>0</height> - </size> - </property> - <property name="toolTip"> - <string>Scales the Intensity to the current data extremes.</string> - </property> - <property name="text"> - <string>Auto Scale</string> - </property> - </widget> - </item> - <item row="2" column="2"> - <widget class="QwtWheel" name="Waterfall3DMinimumIntensityWheel"> - <property name="minimumSize"> - <size> - <width>200</width> - <height>0</height> - </size> - </property> - <property name="valid"> - <bool>true</bool> - </property> - <property name="totalAngle"> - <double>200.000000000000000</double> - </property> - <property name="viewAngle"> - <double>20.000000000000000</double> - </property> - <property name="mass"> - <double>0.000000000000000</double> - </property> - </widget> - </item> - <item row="2" column="3"> - <widget class="QLabel" name="Waterfall3DMinimumIntensityLabel"> - <property name="maximumSize"> - <size> - <width>100</width> - <height>16777215</height> - </size> - </property> - <property name="text"> - <string>-100 dB</string> - </property> - <property name="wordWrap"> - <bool>false</bool> - </property> - </widget> - </item> - </layout> - </widget> <widget class="QWidget" name="TimeDomainPage"> <attribute name="title"> <string>Time Domain Display</string> @@ -721,7 +537,6 @@ <include location="global">SpectrumGUIClass.h</include> <include location="global">FrequencyDisplayPlot.h</include> <include location="global">WaterfallDisplayPlot.h</include> - <include location="global">Waterfall3DDisplayPlot.h</include> <include location="global">TimeDomainDisplayPlot.h</include> <include location="global">qvalidator.h</include> <include location="global">vector</include> @@ -858,38 +673,6 @@ </hints> </connection> <connection> - <sender>Waterfall3DMaximumIntensityWheel</sender> - <signal>valueChanged(double)</signal> - <receiver>SpectrumDisplayForm</receiver> - <slot>waterfall3DMaximumIntensityChangedCB(double)</slot> - <hints> - <hint type="sourcelabel"> - <x>217</x> - <y>44</y> - </hint> - <hint type="destinationlabel"> - <x>20</x> - <y>20</y> - </hint> - </hints> - </connection> - <connection> - <sender>Waterfall3DMinimumIntensityWheel</sender> - <signal>valueChanged(double)</signal> - <receiver>SpectrumDisplayForm</receiver> - <slot>waterfall3DMinimumIntensityChangedCB(double)</slot> - <hints> - <hint type="sourcelabel"> - <x>217</x> - <y>349</y> - </hint> - <hint type="destinationlabel"> - <x>20</x> - <y>20</y> - </hint> - </hints> - </connection> - <connection> <sender>FFTSizeComboBox</sender> <signal>activated(QString)</signal> <receiver>SpectrumDisplayForm</receiver> diff --git a/gr-qtgui/src/lib/waterfallGlobalData.cc b/gr-qtgui/src/lib/waterfallGlobalData.cc index 0cbef4ec3..1ba153f0d 100644 --- a/gr-qtgui/src/lib/waterfallGlobalData.cc +++ b/gr-qtgui/src/lib/waterfallGlobalData.cc @@ -3,11 +3,13 @@ #include <waterfallGlobalData.h> -#include <Waterfall3DDisplayPlot.h> - -WaterfallData::WaterfallData(const double minimumFrequency, const double maximumFrequency, const uint64_t fftPoints, const unsigned int historyExtent): - QwtRasterData(QwtDoubleRect(minimumFrequency /* X START */, 0 /* Y START */, maximumFrequency - minimumFrequency /* WIDTH */, static_cast<double>(historyExtent)/* HEIGHT */)) - +WaterfallData::WaterfallData(const double minimumFrequency, + const double maximumFrequency, + const uint64_t fftPoints, + const unsigned int historyExtent) + : QwtRasterData(QwtDoubleRect(minimumFrequency /* X START */, 0 /* Y START */, + maximumFrequency - minimumFrequency /* WIDTH */, + static_cast<double>(historyExtent)/* HEIGHT */)) { _intensityRange = QwtDoubleInterval(-200.0, 0.0); @@ -19,17 +21,20 @@ WaterfallData::WaterfallData(const double minimumFrequency, const double maximum Reset(); } -WaterfallData::~WaterfallData(){ +WaterfallData::~WaterfallData() +{ delete[] _spectrumData; } -void WaterfallData::Reset(){ +void WaterfallData::Reset() +{ memset(_spectrumData, 0x0, _fftPoints*_historyLength*sizeof(double)); _numLinesToUpdate = -1; } -void WaterfallData::Copy(const WaterfallData* rhs){ +void WaterfallData::Copy(const WaterfallData* rhs) +{ if((_fftPoints != rhs->GetNumFFTPoints()) || (boundingRect() != rhs->boundingRect()) ){ _fftPoints = rhs->GetNumFFTPoints(); @@ -43,7 +48,10 @@ void WaterfallData::Copy(const WaterfallData* rhs){ setRange(rhs->range()); } -void WaterfallData::ResizeData(const double startFreq, const double stopFreq, const uint64_t fftPoints){ +void WaterfallData::ResizeData(const double startFreq, + const double stopFreq, + const uint64_t fftPoints) +{ if((fftPoints != GetNumFFTPoints()) || (boundingRect().width() != (stopFreq - startFreq)) || (boundingRect().left() != startFreq)){ @@ -57,21 +65,27 @@ void WaterfallData::ResizeData(const double startFreq, const double stopFreq, co Reset(); } -QwtRasterData *WaterfallData::copy() const{ - WaterfallData* returnData = new WaterfallData(boundingRect().left(), boundingRect().right(), _fftPoints, _historyLength); +QwtRasterData *WaterfallData::copy() const +{ + WaterfallData* returnData = new WaterfallData(boundingRect().left(), + boundingRect().right(), + _fftPoints, _historyLength); returnData->Copy(this); return returnData; } -QwtDoubleInterval WaterfallData::range() const{ +QwtDoubleInterval WaterfallData::range() const +{ return _intensityRange; } -void WaterfallData::setRange(const QwtDoubleInterval& newRange){ +void WaterfallData::setRange(const QwtDoubleInterval& newRange) +{ _intensityRange = newRange; } -double WaterfallData::value(double x, double y) const{ +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())) * @@ -87,11 +101,14 @@ double WaterfallData::value(double x, double y) const{ return returnValue; } -uint64_t WaterfallData::GetNumFFTPoints()const{ +uint64_t WaterfallData::GetNumFFTPoints() const +{ return _fftPoints; } -void WaterfallData::addFFTData(const double* fftData, const uint64_t fftDataSize, const int droppedFrames){ +void WaterfallData::addFFTData(const double* fftData, + const uint64_t fftDataSize, + const int droppedFrames){ if(fftDataSize == _fftPoints){ int64_t heightOffset = _historyLength - 1 - droppedFrames; uint64_t drawingDroppedFrames = droppedFrames; @@ -104,155 +121,44 @@ void WaterfallData::addFFTData(const double* fftData, const uint64_t fftDataSize // Copy the old data over if any available if(heightOffset > 0){ - memmove( _spectrumData, &_spectrumData[(drawingDroppedFrames+1) * _fftPoints], heightOffset * _fftPoints * sizeof(double)) ; + memmove( _spectrumData, &_spectrumData[(drawingDroppedFrames+1) * _fftPoints], + heightOffset * _fftPoints * sizeof(double)) ; } if(drawingDroppedFrames > 0){ // Fill in zeros data for dropped data - memset(&_spectrumData[heightOffset * _fftPoints], 0x00, static_cast<int64_t>(drawingDroppedFrames) * _fftPoints * sizeof(double)); + memset(&_spectrumData[heightOffset * _fftPoints], 0x00, + static_cast<int64_t>(drawingDroppedFrames) * _fftPoints * sizeof(double)); } // add the new buffer memcpy(&_spectrumData[(_historyLength - 1) * _fftPoints], fftData, _fftPoints*sizeof(double)); - } } -double* WaterfallData::GetSpectrumDataBuffer()const{ +double* WaterfallData::GetSpectrumDataBuffer() const +{ return _spectrumData; } -void WaterfallData::SetSpectrumDataBuffer(const double* newData){ +void WaterfallData::SetSpectrumDataBuffer(const double* newData) +{ memcpy(_spectrumData, newData, _fftPoints * _historyLength * sizeof(double)); } -int WaterfallData::GetNumLinesToUpdate()const{ +int WaterfallData::GetNumLinesToUpdate() const +{ return _numLinesToUpdate; } -void WaterfallData::SetNumLinesToUpdate(const int newNum){ +void WaterfallData::SetNumLinesToUpdate(const int newNum) +{ _numLinesToUpdate = newNum; } -void WaterfallData::IncrementNumLinesToUpdate(){ - _numLinesToUpdate++; -} - -Waterfall3DData::Waterfall3DData(const double minimumFrequency, const double maximumFrequency, const uint64_t fftPoints, const unsigned int historyExtent): - WaterfallData(minimumFrequency, maximumFrequency, fftPoints, historyExtent), Qwt3D::Function(){ - - _floorValue = 0.0; - setMinZ(0.0); - setMaxZ(200.0); - - // Create the dummy mesh data until _ResizeMesh is called - data = new double*[1]; - data[0] = new double[1]; - Qwt3D::Function::setMesh(1,1); - - _ResizeMesh(); -} - -Waterfall3DData::~Waterfall3DData(){ - for ( unsigned i = 0; i < umesh_p; i++){ - delete[] data[i]; - } - delete[] data; - -} - -void Waterfall3DData::ResizeData(const double startFreq, const double stopFreq, const uint64_t fftPoints){ - if((fftPoints != GetNumFFTPoints()) || - (boundingRect().width() != (stopFreq - startFreq)) || - (boundingRect().left() != startFreq)){ - WaterfallData::ResizeData(startFreq, stopFreq, fftPoints); - _ResizeMesh(); - } - - Reset(); -} - -bool Waterfall3DData::create() +void WaterfallData::IncrementNumLinesToUpdate() { - if ((umesh_p<=2) || (vmesh_p<=2) || !plotwidget_p) - return false; - - // Almost the same as the old create, except that here we store our own data buffer in the class rather than re-creating it each time... - - unsigned i,j; - - /* get the data */ - double dx = (maxu_p - minu_p) / (umesh_p - 1); - double dy = (maxv_p - minv_p) / (vmesh_p - 1); - - for (i = 0; i < umesh_p; ++i) - { - for (j = 0; j < vmesh_p; ++j) - { - data[i][j] = operator()(minu_p + i*dx, minv_p + j*dy); - - if (data[i][j] > range_p.maxVertex.z) - data[i][j] = range_p.maxVertex.z; - else if (data[i][j] < range_p.minVertex.z) - data[i][j] = range_p.minVertex.z; - } - } - - Q_ASSERT(plotwidget_p); - if (!plotwidget_p) - { - fprintf(stderr,"Function: no valid Plot3D Widget assigned"); - } - else - { - ((Waterfall3DDisplayPlot*)plotwidget_p)->loadFromData(data, umesh_p, vmesh_p, minu_p, maxu_p, minv_p, maxv_p); - } - - return true; -} - -double Waterfall3DData::operator()(double x, double y){ - return value(x,y) - _floorValue; -} - -double Waterfall3DData::GetFloorValue()const{ - return _floorValue; -} - -void Waterfall3DData::SetFloorValue(const double newValue){ - _floorValue = newValue; -} - -double Waterfall3DData::minZ()const{ - return range_p.minVertex.z; -} - -double Waterfall3DData::maxZ()const{ - return range_p.maxVertex.z; -} - -void Waterfall3DData::setMesh(unsigned int, unsigned int){ - // Do Nothing - printf("Should Not Reach this Function\n"); -} - -void Waterfall3DData::_ResizeMesh(){ - // Clear out the old mesh - for ( unsigned i = 0; i < umesh_p; i++){ - delete[] data[i]; - } - delete[] data; - - Qwt3D::Function::setMesh(static_cast<int>(boundingRect().width()/20.0), _historyLength); - setDomain( boundingRect().left(), static_cast<int>(boundingRect().right()), 0, _historyLength); - - /* allocate some space for the mesh */ - unsigned i; - data = new double* [umesh_p] ; - for ( i = 0; i < umesh_p; i++) - { - data[i] = new double [vmesh_p]; - } + _numLinesToUpdate++; } #endif /* WATERFALL_GLOBAL_DATA_CPP */ diff --git a/gr-qtgui/src/lib/waterfallGlobalData.h b/gr-qtgui/src/lib/waterfallGlobalData.h index 247e0ae91..51f65064c 100644 --- a/gr-qtgui/src/lib/waterfallGlobalData.h +++ b/gr-qtgui/src/lib/waterfallGlobalData.h @@ -2,10 +2,8 @@ #define WATERFALL_GLOBAL_DATA_HPP #include <qwt_raster_data.h> -#include <qwt3d_function.h> #include <inttypes.h> -class Waterfall3DDisplayPlot; class WaterfallData: public QwtRasterData { @@ -46,34 +44,4 @@ private: }; -class Waterfall3DData: public WaterfallData, public Qwt3D::Function -{ -public: - Waterfall3DData(const double, const double, const uint64_t, const unsigned int); - virtual ~Waterfall3DData(); - - virtual void ResizeData(const double, const double, const uint64_t); - - virtual bool create(); - virtual void setMesh(unsigned int columns, unsigned int rows); //!< Sets number of rows and columns. - - virtual double operator()(double x, double y); - - virtual double GetFloorValue()const; - virtual void SetFloorValue(const double); - - virtual double minZ()const; - virtual double maxZ()const; - -protected: - void _ResizeMesh(); - - double** data; - double _floorValue; - -private: - -}; - - #endif /* WATERFALL_GLOBAL_DATA_HPP */ |