diff options
30 files changed, 615 insertions, 690 deletions
diff --git a/gr-qtgui/lib/ConstellationDisplayPlot.cc b/gr-qtgui/lib/ConstellationDisplayPlot.cc index 51000cab17..acd825bf48 100644 --- a/gr-qtgui/lib/ConstellationDisplayPlot.cc +++ b/gr-qtgui/lib/ConstellationDisplayPlot.cc @@ -172,7 +172,7 @@ ConstellationDisplayPlot::replot() void -ConstellationDisplayPlot::PlotNewData(const std::vector<double*> realDataPoints, +ConstellationDisplayPlot::plotNewData(const std::vector<double*> realDataPoints, const std::vector<double*> imagDataPoints, const int64_t numDataPoints, const double timeInterval) @@ -208,7 +208,7 @@ ConstellationDisplayPlot::PlotNewData(const std::vector<double*> realDataPoints, } void -ConstellationDisplayPlot::PlotNewData(const double* realDataPoints, +ConstellationDisplayPlot::plotNewData(const double* realDataPoints, const double* imagDataPoints, const int64_t numDataPoints, const double timeInterval) @@ -217,7 +217,7 @@ ConstellationDisplayPlot::PlotNewData(const double* realDataPoints, std::vector<double*> vecImagDataPoints; vecRealDataPoints.push_back((double*)realDataPoints); vecImagDataPoints.push_back((double*)imagDataPoints); - PlotNewData(vecRealDataPoints, vecImagDataPoints, + plotNewData(vecRealDataPoints, vecImagDataPoints, numDataPoints, timeInterval); } diff --git a/gr-qtgui/lib/ConstellationDisplayPlot.h b/gr-qtgui/lib/ConstellationDisplayPlot.h index f3cbeef1cb..06a98cb6c4 100644 --- a/gr-qtgui/lib/ConstellationDisplayPlot.h +++ b/gr-qtgui/lib/ConstellationDisplayPlot.h @@ -36,13 +36,13 @@ public: ConstellationDisplayPlot(int nplots, QWidget*); virtual ~ConstellationDisplayPlot(); - void PlotNewData(const std::vector<double*> realDataPoints, + void plotNewData(const std::vector<double*> realDataPoints, const std::vector<double*> imagDataPoints, const int64_t numDataPoints, const double timeInterval); // Old method to be removed - void PlotNewData(const double* realDataPoints, + void plotNewData(const double* realDataPoints, const double* imagDataPoints, const int64_t numDataPoints, const double timeInterval); diff --git a/gr-qtgui/lib/DisplayPlot.cc b/gr-qtgui/lib/DisplayPlot.cc index a91ac721f1..bf1c198897 100644 --- a/gr-qtgui/lib/DisplayPlot.cc +++ b/gr-qtgui/lib/DisplayPlot.cc @@ -60,11 +60,11 @@ DisplayPlot::DisplayPlot(int nplots, QWidget* parent) #if QWT_VERSION < 0x060000 connect(_picker, SIGNAL(selected(const QwtDoublePoint &)), - this, SLOT(OnPickerPointSelected(const QwtDoublePoint &))); + this, SLOT(onPickerPointSelected(const QwtDoublePoint &))); #else _picker->setStateMachine(new QwtPickerDblClickPointMachine()); connect(_picker, SIGNAL(selected(const QPointF &)), - this, SLOT(OnPickerPointSelected6(const QPointF &))); + this, SLOT(onPickerPointSelected6(const QPointF &))); #endif // Configure magnify on mouse wheel @@ -83,7 +83,7 @@ DisplayPlot::DisplayPlot(int nplots, QWidget* parent) insertLegend(legendDisplay); connect(this, SIGNAL(legendChecked(QwtPlotItem *, bool)), - this, SLOT(LegendEntryChecked(QwtPlotItem *, bool))); + this, SLOT(legendEntryChecked(QwtPlotItem *, bool))); } DisplayPlot::~DisplayPlot() @@ -390,24 +390,24 @@ DisplayPlot::resizeSlot( QSize *s ) resize(s->width()-10, s->height()-10); } -void DisplayPlot::LegendEntryChecked(QwtPlotItem* plotItem, bool on) +void DisplayPlot::legendEntryChecked(QwtPlotItem* plotItem, bool on) { plotItem->setVisible(!on); replot(); } void -DisplayPlot::OnPickerPointSelected(const QwtDoublePoint & p) +DisplayPlot::onPickerPointSelected(const QwtDoublePoint & p) { QPointF point = p; - //fprintf(stderr,"OnPickerPointSelected %f %f\n", point.x(), point.y()); + //fprintf(stderr,"onPickerPointSelected %f %f\n", point.x(), point.y()); emit plotPointSelected(point); } void -DisplayPlot::OnPickerPointSelected6(const QPointF & p) +DisplayPlot::onPickerPointSelected6(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()); emit plotPointSelected(point); } diff --git a/gr-qtgui/lib/DisplayPlot.h b/gr-qtgui/lib/DisplayPlot.h index 6a1e684169..26d9412344 100644 --- a/gr-qtgui/lib/DisplayPlot.h +++ b/gr-qtgui/lib/DisplayPlot.h @@ -257,14 +257,14 @@ public slots: // Because of the preprocessing of slots in QT, these are not // easily separated by the version check. Make one for each // version until it's worked out. - void OnPickerPointSelected(const QwtDoublePoint & p); - void OnPickerPointSelected6(const QPointF & p); + void onPickerPointSelected(const QwtDoublePoint & p); + void onPickerPointSelected6(const QPointF & p); signals: void plotPointSelected(const QPointF p); protected slots: - void LegendEntryChecked(QwtPlotItem *plotItem, bool on); + void legendEntryChecked(QwtPlotItem *plotItem, bool on); protected: int _nplots; diff --git a/gr-qtgui/lib/FrequencyDisplayPlot.cc b/gr-qtgui/lib/FrequencyDisplayPlot.cc index 88f5ec91c0..52ff335c32 100644 --- a/gr-qtgui/lib/FrequencyDisplayPlot.cc +++ b/gr-qtgui/lib/FrequencyDisplayPlot.cc @@ -50,7 +50,7 @@ public: updateDisplay(); } - void SetUnitType(const std::string &type) + void setUnitType(const std::string &type) { _unitType = type; } @@ -61,7 +61,7 @@ protected: { QwtDoublePoint dp = QwtPlotZoomer::invTransform(p); QwtText t(QString("%1 %2, %3 dB") - .arg(dp.x(), 0, 'f', GetFrequencyPrecision()) + .arg(dp.x(), 0, 'f', getFrequencyPrecision()) .arg(_unitType.c_str()).arg(dp.y(), 0, 'f', 2)); return t; } @@ -77,10 +77,8 @@ private: FrequencyDisplayPlot::FrequencyDisplayPlot(int nplots, QWidget* parent) : DisplayPlot(nplots, parent) { - _startFrequency = 0; - _stopFrequency = 4000; - - _useCenterFrequencyFlag = false; + _startFrequency = -1; + _stopFrequency = 1; _numPoints = 1024; _minFFTPoints = new double[_numPoints]; @@ -120,7 +118,7 @@ FrequencyDisplayPlot::FrequencyDisplayPlot(int nplots, QWidget* parent) _min_fft_plot_curve = new QwtPlotCurve("Minimum Power"); _min_fft_plot_curve->attach(this); const QColor _default_min_fft_color = Qt::magenta; - SetMinFFTColor(_default_min_fft_color); + setMinFFTColor(_default_min_fft_color); #if QWT_VERSION < 0x060000 _min_fft_plot_curve->setRawData(_xAxisPoints, _minFFTPoints, _numPoints); #else @@ -131,7 +129,7 @@ FrequencyDisplayPlot::FrequencyDisplayPlot(int nplots, QWidget* parent) _max_fft_plot_curve = new QwtPlotCurve("Maximum Power"); _max_fft_plot_curve->attach(this); QColor _default_max_fft_color = Qt::darkYellow; - SetMaxFFTColor(_default_max_fft_color); + setMaxFFTColor(_default_max_fft_color); #if QWT_VERSION < 0x060000 _max_fft_plot_curve->setRawData(_xAxisPoints, _maxFFTPoints, _numPoints); #else @@ -142,13 +140,13 @@ FrequencyDisplayPlot::FrequencyDisplayPlot(int nplots, QWidget* parent) _lower_intensity_marker= new QwtPlotMarker(); _lower_intensity_marker->setLineStyle(QwtPlotMarker::HLine); QColor _default_marker_lower_intensity_color = Qt::cyan; - SetMarkerLowerIntensityColor(_default_marker_lower_intensity_color); + setMarkerLowerIntensityColor(_default_marker_lower_intensity_color); _lower_intensity_marker->attach(this); _upper_intensity_marker = new QwtPlotMarker(); _upper_intensity_marker->setLineStyle(QwtPlotMarker::HLine); QColor _default_marker_upper_intensity_color = Qt::green; - SetMarkerUpperIntensityColor(_default_marker_upper_intensity_color); + setMarkerUpperIntensityColor(_default_marker_upper_intensity_color); _upper_intensity_marker->attach(this); memset(_xAxisPoints, 0x0, _numPoints*sizeof(double)); @@ -160,20 +158,20 @@ FrequencyDisplayPlot::FrequencyDisplayPlot(int nplots, QWidget* parent) _markerPeakAmplitude = new QwtPlotMarker(); QColor _default_marker_peak_amplitude_color = Qt::yellow; - SetMarkerPeakAmplitudeColor(_default_marker_peak_amplitude_color); + setMarkerPeakAmplitudeColor(_default_marker_peak_amplitude_color); /// THIS CAUSES A PROBLEM! //_markerPeakAmplitude->attach(this); _markerNoiseFloorAmplitude = new QwtPlotMarker(); _markerNoiseFloorAmplitude->setLineStyle(QwtPlotMarker::HLine); QColor _default_marker_noise_floor_amplitude_color = Qt::darkRed; - SetMarkerNoiseFloorAmplitudeColor(_default_marker_noise_floor_amplitude_color); + setMarkerNoiseFloorAmplitudeColor(_default_marker_noise_floor_amplitude_color); _markerNoiseFloorAmplitude->attach(this); _markerCF= new QwtPlotMarker(); _markerCF->setLineStyle(QwtPlotMarker::VLine); QColor _default_marker_CF_color = Qt::lightGray; - SetMarkerCFColor(_default_marker_CF_color); + setMarkerCFColor(_default_marker_CF_color); _markerCF->attach(this); _markerCF->hide(); @@ -235,23 +233,14 @@ FrequencyDisplayPlot::setYaxis(double min, double max) } void -FrequencyDisplayPlot::SetFrequencyRange(const double constStartFreq, - const double constStopFreq, - const double constCenterFreq, - const bool useCenterFrequencyFlag, +FrequencyDisplayPlot::setFrequencyRange(const double centerfreq, + const double bandwidth, const double units, const std::string &strunits) { - double startFreq = constStartFreq / units; - double stopFreq = constStopFreq / units; - double centerFreq = constCenterFreq / units; + double startFreq = (centerfreq - bandwidth/2.0f) / units; + double stopFreq = (centerfreq + bandwidth/2.0f) / units; _xAxisMultiplier = units; - _useCenterFrequencyFlag = useCenterFrequencyFlag; - - if(_useCenterFrequencyFlag){ - startFreq = (startFreq + centerFreq); - stopFreq = (stopFreq + centerFreq); - } bool reset = false; if((startFreq != _startFrequency) || (stopFreq != _stopFrequency)) @@ -261,7 +250,7 @@ FrequencyDisplayPlot::SetFrequencyRange(const double constStartFreq, _startFrequency = startFreq; _stopFrequency = stopFreq; - if((axisScaleDraw(QwtPlot::xBottom) != NULL) && (_zoomer != NULL)){ + if((axisScaleDraw(QwtPlot::xBottom) != NULL) && (_zoomer != NULL)) { double display_units = ceil(log10(units)/2.0); setAxisScaleDraw(QwtPlot::xBottom, new FreqDisplayScaleDraw(display_units)); setAxisTitle(QwtPlot::xBottom, QString("Frequency (%1)").arg(strunits.c_str())); @@ -269,21 +258,21 @@ FrequencyDisplayPlot::SetFrequencyRange(const double constStartFreq, if(reset) _resetXAxisPoints(); - ((FreqDisplayZoomer*)_zoomer)->SetFrequencyPrecision(display_units); - ((FreqDisplayZoomer*)_zoomer)->SetUnitType(strunits); + ((FreqDisplayZoomer*)_zoomer)->setFrequencyPrecision(display_units); + ((FreqDisplayZoomer*)_zoomer)->setUnitType(strunits); } } } double -FrequencyDisplayPlot::GetStartFrequency() const +FrequencyDisplayPlot::getStartFrequency() const { return _startFrequency; } double -FrequencyDisplayPlot::GetStopFrequency() const +FrequencyDisplayPlot::getStopFrequency() const { return _stopFrequency; } @@ -292,21 +281,22 @@ void FrequencyDisplayPlot::replot() { _markerNoiseFloorAmplitude->setYValue(_noiseFloorAmplitude); + _markerPeakAmplitude->setXValue(_peakFrequency + _startFrequency); // Make sure to take into account the start frequency - if(_useCenterFrequencyFlag){ - _markerPeakAmplitude->setXValue((_peakFrequency/1000.0) + _startFrequency); - } - else{ - _markerPeakAmplitude->setXValue(_peakFrequency + _startFrequency); - } +// if(_useCenterFrequencyFlag){ +// _markerPeakAmplitude->setXValue((_peakFrequency/1000.0) + _startFrequency); +// } +// else{ +// _markerPeakAmplitude->setXValue(_peakFrequency + _startFrequency); +// } _markerPeakAmplitude->setYValue(_peakAmplitude); QwtPlot::replot(); } void -FrequencyDisplayPlot::PlotNewData(const std::vector<double*> dataPoints, +FrequencyDisplayPlot::plotNewData(const std::vector<double*> dataPoints, const int64_t numDataPoints, const double noiseFloorAmplitude, const double peakFrequency, const double peakAmplitude, const double timeInterval) @@ -341,8 +331,8 @@ FrequencyDisplayPlot::PlotNewData(const std::vector<double*> dataPoints, _max_fft_plot_curve->setRawSamples(_xAxisPoints, _maxFFTPoints, _numPoints); #endif _resetXAxisPoints(); - ClearMaxData(); - ClearMinData(); + clearMaxData(); + clearMinData(); } for(int i = 0; i < _nplots; i++) { @@ -362,7 +352,7 @@ FrequencyDisplayPlot::PlotNewData(const std::vector<double*> dataPoints, _peakFrequency = peakFrequency; _peakAmplitude = peakAmplitude; - SetUpperIntensityLevel(_peakAmplitude); + setUpperIntensityLevel(_peakAmplitude); replot(); } @@ -370,19 +360,19 @@ FrequencyDisplayPlot::PlotNewData(const std::vector<double*> dataPoints, } void -FrequencyDisplayPlot::PlotNewData(const double* dataPoints, +FrequencyDisplayPlot::plotNewData(const double* dataPoints, const int64_t numDataPoints, const double noiseFloorAmplitude, const double peakFrequency, const double peakAmplitude, const double timeInterval) { std::vector<double*> vecDataPoints; vecDataPoints.push_back((double*)dataPoints); - PlotNewData(vecDataPoints, numDataPoints, noiseFloorAmplitude, + plotNewData(vecDataPoints, numDataPoints, noiseFloorAmplitude, peakFrequency, peakAmplitude, timeInterval); } void -FrequencyDisplayPlot::ClearMaxData() +FrequencyDisplayPlot::clearMaxData() { for(int64_t number = 0; number < _numPoints; number++) { _maxFFTPoints[number] = _minYAxis; @@ -390,7 +380,7 @@ FrequencyDisplayPlot::ClearMaxData() } void -FrequencyDisplayPlot::ClearMinData() +FrequencyDisplayPlot::clearMinData() { for(int64_t number = 0; number < _numPoints; number++) { _minFFTPoints[number] = _maxYAxis; @@ -398,23 +388,23 @@ FrequencyDisplayPlot::ClearMinData() } void -FrequencyDisplayPlot::SetMaxFFTVisible(const bool visibleFlag) +FrequencyDisplayPlot::setMaxFFTVisible(const bool visibleFlag) { _max_fft_visible = visibleFlag; _max_fft_plot_curve->setVisible(visibleFlag); } -const bool FrequencyDisplayPlot::GetMaxFFTVisible() const +const bool FrequencyDisplayPlot::getMaxFFTVisible() const { return _max_fft_visible; } void -FrequencyDisplayPlot::SetMinFFTVisible(const bool visibleFlag) +FrequencyDisplayPlot::setMinFFTVisible(const bool visibleFlag) { _min_fft_visible = visibleFlag; _min_fft_plot_curve->setVisible(visibleFlag); } -const bool FrequencyDisplayPlot::GetMinFFTVisible() const +const bool FrequencyDisplayPlot::getMinFFTVisible() const { return _min_fft_visible; } @@ -439,29 +429,30 @@ FrequencyDisplayPlot::_resetXAxisPoints() zbase.setRight(_stopFrequency); _zoomer->zoom(zbase); _zoomer->setZoomBase(zbase); + _zoomer->setZoomBase(true); _zoomer->zoom(0); } void -FrequencyDisplayPlot::SetLowerIntensityLevel(const double lowerIntensityLevel) +FrequencyDisplayPlot::setLowerIntensityLevel(const double lowerIntensityLevel) { _lower_intensity_marker->setYValue(lowerIntensityLevel); } void -FrequencyDisplayPlot::SetUpperIntensityLevel(const double upperIntensityLevel) +FrequencyDisplayPlot::setUpperIntensityLevel(const double upperIntensityLevel) { _upper_intensity_marker->setYValue(upperIntensityLevel); } void -FrequencyDisplayPlot::SetTraceColour(QColor c) +FrequencyDisplayPlot::setTraceColour(QColor c) { _plot_curve[0]->setPen(QPen(c)); } void -FrequencyDisplayPlot::SetBGColour(QColor c) +FrequencyDisplayPlot::setBGColour(QColor c) { QPalette palette; palette.setColor(canvas()->backgroundRole(), c); @@ -469,7 +460,7 @@ FrequencyDisplayPlot::SetBGColour(QColor c) } void -FrequencyDisplayPlot::ShowCFMarker(const bool show) +FrequencyDisplayPlot::showCFMarker(const bool show) { if (show) _markerCF->show(); @@ -479,51 +470,51 @@ FrequencyDisplayPlot::ShowCFMarker(const bool show) void -FrequencyDisplayPlot::OnPickerPointSelected(const QwtDoublePoint & p) +FrequencyDisplayPlot::onPickerPointSelected(const QwtDoublePoint & p) { QPointF point = p; - //fprintf(stderr,"OnPickerPointSelected %f %f %d\n", point.x(), point.y(), _xAxisMultiplier); + //fprintf(stderr,"onPickerPointSelected %f %f %d\n", point.x(), point.y(), _xAxisMultiplier); point.setX(point.x() * _xAxisMultiplier); emit plotPointSelected(point); } void -FrequencyDisplayPlot::OnPickerPointSelected6(const QPointF & p) +FrequencyDisplayPlot::onPickerPointSelected6(const QPointF & p) { QPointF point = p; - //fprintf(stderr,"OnPickerPointSelected %f %f %d\n", point.x(), point.y(), _xAxisMultiplier); + //fprintf(stderr,"onPickerPointSelected %f %f %d\n", point.x(), point.y(), _xAxisMultiplier); point.setX(point.x() * _xAxisMultiplier); emit plotPointSelected(point); } void -FrequencyDisplayPlot::SetMinFFTColor (QColor c) +FrequencyDisplayPlot::setMinFFTColor (QColor c) { _min_fft_color = c; _min_fft_plot_curve->setPen(QPen(c)); } const QColor -FrequencyDisplayPlot::GetMinFFTColor() const {return _min_fft_color;} +FrequencyDisplayPlot::getMinFFTColor() const {return _min_fft_color;} void -FrequencyDisplayPlot::SetMaxFFTColor (QColor c) +FrequencyDisplayPlot::setMaxFFTColor (QColor c) { _max_fft_color = c; _max_fft_plot_curve->setPen(QPen(c)); } const QColor -FrequencyDisplayPlot::GetMaxFFTColor() const {return _max_fft_color;} +FrequencyDisplayPlot::getMaxFFTColor() const {return _max_fft_color;} void -FrequencyDisplayPlot::SetMarkerLowerIntensityColor (QColor c) +FrequencyDisplayPlot::setMarkerLowerIntensityColor (QColor c) { _marker_lower_intensity_color = c; _lower_intensity_marker->setLinePen(QPen(c)); } const QColor -FrequencyDisplayPlot::GetMarkerLowerIntensityColor () const {return _marker_lower_intensity_color;} +FrequencyDisplayPlot::getMarkerLowerIntensityColor () const {return _marker_lower_intensity_color;} void -FrequencyDisplayPlot::SetMarkerLowerIntensityVisible (bool visible) +FrequencyDisplayPlot::setMarkerLowerIntensityVisible (bool visible) { _marker_lower_intensity_visible = visible; if (visible) @@ -532,18 +523,18 @@ FrequencyDisplayPlot::SetMarkerLowerIntensityVisible (bool visible) _lower_intensity_marker->setLineStyle(QwtPlotMarker::NoLine); } const bool -FrequencyDisplayPlot::GetMarkerLowerIntensityVisible () const {return _marker_lower_intensity_visible;} +FrequencyDisplayPlot::getMarkerLowerIntensityVisible () const {return _marker_lower_intensity_visible;} void -FrequencyDisplayPlot::SetMarkerUpperIntensityColor (QColor c) +FrequencyDisplayPlot::setMarkerUpperIntensityColor (QColor c) { _marker_upper_intensity_color = c; _upper_intensity_marker->setLinePen(QPen(c, 0, Qt::DotLine)); } const QColor -FrequencyDisplayPlot::GetMarkerUpperIntensityColor () const {return _marker_upper_intensity_color;} +FrequencyDisplayPlot::getMarkerUpperIntensityColor () const {return _marker_upper_intensity_color;} void -FrequencyDisplayPlot::SetMarkerUpperIntensityVisible (bool visible) +FrequencyDisplayPlot::setMarkerUpperIntensityVisible (bool visible) { _marker_upper_intensity_visible = visible; if (visible) @@ -552,10 +543,10 @@ FrequencyDisplayPlot::SetMarkerUpperIntensityVisible (bool visible) _upper_intensity_marker->setLineStyle(QwtPlotMarker::NoLine); } const bool -FrequencyDisplayPlot::GetMarkerUpperIntensityVisible () const {return _marker_upper_intensity_visible;} +FrequencyDisplayPlot::getMarkerUpperIntensityVisible () const {return _marker_upper_intensity_visible;} void -FrequencyDisplayPlot::SetMarkerPeakAmplitudeColor (QColor c) +FrequencyDisplayPlot::setMarkerPeakAmplitudeColor (QColor c) { _marker_peak_amplitude_color = c; _markerPeakAmplitude->setLinePen(QPen(c)); @@ -571,19 +562,19 @@ FrequencyDisplayPlot::SetMarkerPeakAmplitudeColor (QColor c) #endif } const QColor -FrequencyDisplayPlot::GetMarkerPeakAmplitudeColor () const {return _marker_peak_amplitude_color;} +FrequencyDisplayPlot::getMarkerPeakAmplitudeColor () const {return _marker_peak_amplitude_color;} void -FrequencyDisplayPlot::SetMarkerNoiseFloorAmplitudeColor (QColor c) +FrequencyDisplayPlot::setMarkerNoiseFloorAmplitudeColor (QColor c) { _marker_noise_floor_amplitude_color = c; _markerNoiseFloorAmplitude->setLinePen(QPen(c, 0, Qt::DotLine)); } const QColor -FrequencyDisplayPlot::GetMarkerNoiseFloorAmplitudeColor () const {return _marker_noise_floor_amplitude_color;} +FrequencyDisplayPlot::getMarkerNoiseFloorAmplitudeColor () const {return _marker_noise_floor_amplitude_color;} void -FrequencyDisplayPlot::SetMarkerNoiseFloorAmplitudeVisible (bool visible) +FrequencyDisplayPlot::setMarkerNoiseFloorAmplitudeVisible (bool visible) { _marker_noise_floor_amplitude_visible = visible; if (visible) @@ -592,15 +583,15 @@ FrequencyDisplayPlot::SetMarkerNoiseFloorAmplitudeVisible (bool visible) _markerNoiseFloorAmplitude->setLineStyle(QwtPlotMarker::NoLine); } const bool -FrequencyDisplayPlot::GetMarkerNoiseFloorAmplitudeVisible () const {return _marker_noise_floor_amplitude_visible;} +FrequencyDisplayPlot::getMarkerNoiseFloorAmplitudeVisible () const {return _marker_noise_floor_amplitude_visible;} void -FrequencyDisplayPlot::SetMarkerCFColor (QColor c) +FrequencyDisplayPlot::setMarkerCFColor (QColor c) { _marker_CF_color = c; _markerCF->setLinePen(QPen(c, 0, Qt::DotLine)); } const QColor -FrequencyDisplayPlot::GetMarkerCFColor () const {return _marker_CF_color;} +FrequencyDisplayPlot::getMarkerCFColor () const {return _marker_CF_color;} #endif /* FREQUENCY_DISPLAY_PLOT_C */ diff --git a/gr-qtgui/lib/FrequencyDisplayPlot.h b/gr-qtgui/lib/FrequencyDisplayPlot.h index 679ebf1cc4..15c2d4b5b3 100644 --- a/gr-qtgui/lib/FrequencyDisplayPlot.h +++ b/gr-qtgui/lib/FrequencyDisplayPlot.h @@ -32,84 +32,83 @@ class FrequencyDisplayPlot: public DisplayPlot { Q_OBJECT - Q_PROPERTY ( QColor min_fft_color READ GetMinFFTColor WRITE SetMinFFTColor ) - Q_PROPERTY ( QColor max_fft_color READ GetMaxFFTColor WRITE SetMaxFFTColor ) - Q_PROPERTY ( bool min_fft_visible READ GetMinFFTVisible WRITE SetMinFFTVisible ) - Q_PROPERTY ( bool max_fft_visible READ GetMaxFFTVisible WRITE SetMaxFFTVisible ) - Q_PROPERTY ( QColor marker_lower_intensity_color READ GetMarkerLowerIntensityColor WRITE SetMarkerLowerIntensityColor ) - Q_PROPERTY ( bool marker_lower_intensity_visible READ GetMarkerLowerIntensityVisible WRITE SetMarkerLowerIntensityVisible ) - Q_PROPERTY ( QColor marker_upper_intensity_color READ GetMarkerUpperIntensityColor WRITE SetMarkerUpperIntensityColor ) - Q_PROPERTY ( bool marker_upper_intensity_visible READ GetMarkerUpperIntensityVisible WRITE SetMarkerUpperIntensityVisible ) - Q_PROPERTY ( QColor marker_peak_amplitude_color READ GetMarkerPeakAmplitudeColor WRITE SetMarkerPeakAmplitudeColor ) - Q_PROPERTY ( QColor marker_noise_floor_amplitude_color READ GetMarkerNoiseFloorAmplitudeColor WRITE SetMarkerNoiseFloorAmplitudeColor ) - Q_PROPERTY ( bool marker_noise_floor_amplitude_visible READ GetMarkerNoiseFloorAmplitudeVisible WRITE SetMarkerNoiseFloorAmplitudeVisible ) - Q_PROPERTY ( QColor marker_CF_color READ GetMarkerCFColor WRITE SetMarkerCFColor ) + Q_PROPERTY ( QColor min_fft_color READ getMinFFTColor WRITE setMinFFTColor ) + Q_PROPERTY ( QColor max_fft_color READ getMaxFFTColor WRITE setMaxFFTColor ) + Q_PROPERTY ( bool min_fft_visible READ getMinFFTVisible WRITE setMinFFTVisible ) + Q_PROPERTY ( bool max_fft_visible READ getMaxFFTVisible WRITE setMaxFFTVisible ) + Q_PROPERTY ( QColor marker_lower_intensity_color READ getMarkerLowerIntensityColor WRITE setMarkerLowerIntensityColor ) + Q_PROPERTY ( bool marker_lower_intensity_visible READ getMarkerLowerIntensityVisible WRITE setMarkerLowerIntensityVisible ) + Q_PROPERTY ( QColor marker_upper_intensity_color READ getMarkerUpperIntensityColor WRITE setMarkerUpperIntensityColor ) + Q_PROPERTY ( bool marker_upper_intensity_visible READ getMarkerUpperIntensityVisible WRITE setMarkerUpperIntensityVisible ) + Q_PROPERTY ( QColor marker_peak_amplitude_color READ getMarkerPeakAmplitudeColor WRITE setMarkerPeakAmplitudeColor ) + Q_PROPERTY ( QColor marker_noise_floor_amplitude_color READ getMarkerNoiseFloorAmplitudeColor WRITE setMarkerNoiseFloorAmplitudeColor ) + Q_PROPERTY ( bool marker_noise_floor_amplitude_visible READ getMarkerNoiseFloorAmplitudeVisible WRITE setMarkerNoiseFloorAmplitudeVisible ) + Q_PROPERTY ( QColor marker_CF_color READ getMarkerCFColor WRITE setMarkerCFColor ) public: FrequencyDisplayPlot(int nplots, QWidget*); virtual ~FrequencyDisplayPlot(); - void SetFrequencyRange(const double, const double, - const double, const bool, + void setFrequencyRange(const double, const double, const double units=1000.0, const std::string &strunits = "kHz"); - double GetStartFrequency()const; - double GetStopFrequency()const; + double getStartFrequency()const; + double getStopFrequency()const; - void PlotNewData(const std::vector<double*> dataPoints, + void plotNewData(const std::vector<double*> dataPoints, const int64_t numDataPoints, const double noiseFloorAmplitude, const double peakFrequency, const double peakAmplitude, const double timeInterval); // Old method to be removed - void PlotNewData(const double* dataPoints, + void plotNewData(const double* dataPoints, const int64_t numDataPoints, const double noiseFloorAmplitude, const double peakFrequency, const double peakAmplitude, const double timeInterval); - void ClearMaxData(); - void ClearMinData(); + void clearMaxData(); + void clearMinData(); void replot(); void setYaxis(double min, double max); - void SetTraceColour (QColor); - void SetBGColour (QColor c); - void ShowCFMarker (const bool); - - const bool GetMaxFFTVisible() const; - const bool GetMinFFTVisible() const; - const QColor GetMinFFTColor() const; - const QColor GetMaxFFTColor() const; - const QColor GetMarkerLowerIntensityColor () const; - const bool GetMarkerLowerIntensityVisible () const; - const QColor GetMarkerUpperIntensityColor () const; - const bool GetMarkerUpperIntensityVisible () const; - const QColor GetMarkerPeakAmplitudeColor () const; - const bool GetMarkerNoiseFloorAmplitudeVisible () const; - const QColor GetMarkerNoiseFloorAmplitudeColor () const; - const QColor GetMarkerCFColor () const; + void setTraceColour (QColor); + void setBGColour (QColor c); + void showCFMarker (const bool); + + const bool getMaxFFTVisible() const; + const bool getMinFFTVisible() const; + const QColor getMinFFTColor() const; + const QColor getMaxFFTColor() const; + const QColor getMarkerLowerIntensityColor () const; + const bool getMarkerLowerIntensityVisible () const; + const QColor getMarkerUpperIntensityColor () const; + const bool getMarkerUpperIntensityVisible () const; + const QColor getMarkerPeakAmplitudeColor () const; + const bool getMarkerNoiseFloorAmplitudeVisible () const; + const QColor getMarkerNoiseFloorAmplitudeColor () const; + const QColor getMarkerCFColor () const; public slots: - void SetMaxFFTVisible(const bool); - void SetMinFFTVisible(const bool); - void SetMinFFTColor (QColor c); - void SetMaxFFTColor (QColor c); - void SetMarkerLowerIntensityColor (QColor c); - void SetMarkerLowerIntensityVisible (bool visible); - void SetMarkerUpperIntensityColor (QColor c); - void SetMarkerUpperIntensityVisible (bool visible); - void SetMarkerPeakAmplitudeColor (QColor c); - void SetMarkerNoiseFloorAmplitudeVisible (bool visible); - void SetMarkerNoiseFloorAmplitudeColor (QColor c); - void SetMarkerCFColor (QColor c); - - void SetLowerIntensityLevel(const double); - void SetUpperIntensityLevel(const double); - - void OnPickerPointSelected(const QwtDoublePoint & p); - void OnPickerPointSelected6(const QPointF & p); + void setMaxFFTVisible(const bool); + void setMinFFTVisible(const bool); + void setMinFFTColor (QColor c); + void setMaxFFTColor (QColor c); + void setMarkerLowerIntensityColor (QColor c); + void setMarkerLowerIntensityVisible (bool visible); + void setMarkerUpperIntensityColor (QColor c); + void setMarkerUpperIntensityVisible (bool visible); + void setMarkerPeakAmplitudeColor (QColor c); + void setMarkerNoiseFloorAmplitudeVisible (bool visible); + void setMarkerNoiseFloorAmplitudeColor (QColor c); + void setMarkerCFColor (QColor c); + + void setLowerIntensityLevel(const double); + void setUpperIntensityLevel(const double); + + void onPickerPointSelected(const QwtDoublePoint & p); + void onPickerPointSelected6(const QPointF & p); private: void _resetXAxisPoints(); @@ -153,8 +152,6 @@ private: double _peakAmplitude; double _noiseFloorAmplitude; - - bool _useCenterFrequencyFlag; }; #endif /* FREQUENCY_DISPLAY_PLOT_HPP */ diff --git a/gr-qtgui/lib/SpectrumGUIClass.cc b/gr-qtgui/lib/SpectrumGUIClass.cc index e73ee2d50c..1531914efc 100644 --- a/gr-qtgui/lib/SpectrumGUIClass.cc +++ b/gr-qtgui/lib/SpectrumGUIClass.cc @@ -68,7 +68,7 @@ SpectrumGUIClass::~SpectrumGUIClass() // We don't need to delete this since as a QWidget, it is supposed to be destroyed // with it's parent. Deleting it causes a segmentation fault, and not deleting it // does not leave any extra memory. - //if(GetWindowOpenFlag()){ + //if(getWindowOpenFlag()){ //delete _spectrumDisplayForm; //} @@ -80,15 +80,15 @@ SpectrumGUIClass::~SpectrumGUIClass() } void -SpectrumGUIClass::OpenSpectrumWindow(QWidget* parent, +SpectrumGUIClass::openSpectrumWindow(QWidget* parent, const bool frequency, const bool waterfall, const bool time, const bool constellation) { d_mutex.lock(); - if(!_windowOpennedFlag){ + if(!_windowOpennedFlag) { - if(!_fftBuffersCreatedFlag){ + if(!_fftBuffersCreatedFlag) { _fftPoints = new float[_dataPoints]; _realTimeDomainPoints = new double[_dataPoints]; _imagTimeDomainPoints = new double[_dataPoints]; @@ -103,10 +103,10 @@ SpectrumGUIClass::OpenSpectrumWindow(QWidget* parent, _spectrumDisplayForm = new SpectrumDisplayForm(parent); // Toggle Windows on/off - _spectrumDisplayForm->ToggleTabFrequency(frequency); - _spectrumDisplayForm->ToggleTabWaterfall(waterfall); - _spectrumDisplayForm->ToggleTabTime(time); - _spectrumDisplayForm->ToggleTabConstellation(constellation); + _spectrumDisplayForm->toggleTabFrequency(frequency); + _spectrumDisplayForm->toggleTabWaterfall(waterfall); + _spectrumDisplayForm->toggleTabTime(time); + _spectrumDisplayForm->toggleTabConstellation(constellation); _windowOpennedFlag = true; @@ -117,8 +117,8 @@ SpectrumGUIClass::OpenSpectrumWindow(QWidget* parent, d_mutex.unlock(); - SetDisplayTitle(_title); - Reset(); + setDisplayTitle(_title); + reset(); qApp->postEvent(_spectrumDisplayForm, new QEvent(QEvent::Type(QEvent::User+3))); @@ -126,19 +126,19 @@ SpectrumGUIClass::OpenSpectrumWindow(QWidget* parent, _lastGUIUpdateTime = 0; // Draw Blank Display - UpdateWindow(false, NULL, 0, NULL, 0, NULL, 0, gruel::high_res_timer_now(), true); + updateWindow(false, NULL, 0, NULL, 0, NULL, 0, gruel::high_res_timer_now(), true); // Set up the initial frequency axis settings - SetFrequencyRange(_centerFrequency, _startFrequency, _stopFrequency); + setFrequencyRange(_centerFrequency, _startFrequency, _stopFrequency); // GUI Thread only qApp->processEvents(); } void -SpectrumGUIClass::Reset() +SpectrumGUIClass::reset() { - if(GetWindowOpenFlag()) { + if(getWindowOpenFlag()) { qApp->postEvent(_spectrumDisplayForm, new SpectrumFrequencyRangeEvent(_centerFrequency, _startFrequency, @@ -151,18 +151,18 @@ SpectrumGUIClass::Reset() } void -SpectrumGUIClass::SetDisplayTitle(const std::string newString) +SpectrumGUIClass::setDisplayTitle(const std::string newString) { _title.assign(newString); - if(GetWindowOpenFlag()){ + if(getWindowOpenFlag()){ qApp->postEvent(_spectrumDisplayForm, new SpectrumWindowCaptionEvent(_title.c_str())); } } bool -SpectrumGUIClass::GetWindowOpenFlag() +SpectrumGUIClass::getWindowOpenFlag() { gruel::scoped_lock lock(d_mutex); bool returnFlag = false; @@ -172,14 +172,14 @@ SpectrumGUIClass::GetWindowOpenFlag() void -SpectrumGUIClass::SetWindowOpenFlag(const bool newFlag) +SpectrumGUIClass::setWindowOpenFlag(const bool newFlag) { gruel::scoped_lock lock(d_mutex); _windowOpennedFlag = newFlag; } void -SpectrumGUIClass::SetFrequencyRange(const double centerFreq, +SpectrumGUIClass::setFrequencyRange(const double centerFreq, const double startFreq, const double stopFreq) { @@ -188,13 +188,13 @@ SpectrumGUIClass::SetFrequencyRange(const double centerFreq, _startFrequency = startFreq; _stopFrequency = stopFreq; - _spectrumDisplayForm->SetFrequencyRange(_centerFrequency, + _spectrumDisplayForm->setFrequencyRange(_centerFrequency, _startFrequency, _stopFrequency); } double -SpectrumGUIClass::GetStartFrequency() +SpectrumGUIClass::getStartFrequency() { gruel::scoped_lock lock(d_mutex); double returnValue = 0.0; @@ -203,7 +203,7 @@ SpectrumGUIClass::GetStartFrequency() } double -SpectrumGUIClass::GetStopFrequency() +SpectrumGUIClass::getStopFrequency() { gruel::scoped_lock lock(d_mutex); double returnValue = 0.0; @@ -212,7 +212,7 @@ SpectrumGUIClass::GetStopFrequency() } double -SpectrumGUIClass::GetCenterFrequency() +SpectrumGUIClass::getCenterFrequency() { gruel::scoped_lock lock(d_mutex); double returnValue = 0.0; @@ -222,7 +222,7 @@ SpectrumGUIClass::GetCenterFrequency() void -SpectrumGUIClass::UpdateWindow(const bool updateDisplayFlag, +SpectrumGUIClass::updateWindow(const bool updateDisplayFlag, const float* fftBuffer, const uint64_t inputBufferSize, const float* realTimeDomainData, @@ -240,8 +240,8 @@ SpectrumGUIClass::UpdateWindow(const bool updateDisplayFlag, } int64_t timeDomainBufferSize = 0; - if(updateDisplayFlag){ - if((fftBuffer != NULL) && (bufferSize > 0)){ + if(updateDisplayFlag) { + if((fftBuffer != NULL) && (bufferSize > 0)) { memcpy(_fftPoints, fftBuffer, bufferSize * sizeof(float)); } @@ -260,7 +260,7 @@ SpectrumGUIClass::UpdateWindow(const bool updateDisplayFlag, } } - if((complexTimeDomainData != NULL) && (complexTimeDomainDataSize > 0)){ + if((complexTimeDomainData != NULL) && (complexTimeDomainDataSize > 0)) { volk_32fc_deinterleave_64f_x2_a(_realTimeDomainPoints, _imagTimeDomainPoints, (const lv_32fc_t *)complexTimeDomainData, @@ -270,26 +270,26 @@ SpectrumGUIClass::UpdateWindow(const bool updateDisplayFlag, } // If bufferSize is zero, then just update the display by sending over the old data - if(bufferSize < 1){ + if(bufferSize < 1) { bufferSize = _lastDataPointCount; repeatDataFlag = true; } - else{ + else { // Since there is data this time, update the count _lastDataPointCount = bufferSize; } const gruel::high_res_timer_type currentTime = gruel::high_res_timer_now(); - const gruel::high_res_timer_type lastUpdateGUITime = GetLastGUIUpdateTime(); + const gruel::high_res_timer_type lastUpdateGUITime = getLastGUIUpdateTime(); if((currentTime - lastUpdateGUITime > (4*_updateTime)*gruel::high_res_timer_tps()) && - (GetPendingGUIUpdateEvents() > 0) && lastUpdateGUITime != 0) { + (getPendingGUIUpdateEvents() > 0) && lastUpdateGUITime != 0) { // Do not update the display if too much data is pending to be displayed _droppedEntriesCount++; } - else{ + else { // Draw the Data - IncrementPendingGUIUpdateEvents(); + incrementPendingGUIUpdateEvents(); qApp->postEvent(_spectrumDisplayForm, new SpectrumUpdateEvent(_fftPoints, bufferSize, _realTimeDomainPoints, @@ -303,14 +303,14 @@ SpectrumGUIClass::UpdateWindow(const bool updateDisplayFlag, // Only reset the dropped entries counter if this is not // repeat data since repeat data is dropped by the display systems - if(!repeatDataFlag){ + if(!repeatDataFlag) { _droppedEntriesCount = 0; } } } float -SpectrumGUIClass::GetPowerValue() +SpectrumGUIClass::getPowerValue() { gruel::scoped_lock lock(d_mutex); float returnValue = 0; @@ -319,14 +319,14 @@ SpectrumGUIClass::GetPowerValue() } void -SpectrumGUIClass::SetPowerValue(const float value) +SpectrumGUIClass::setPowerValue(const float value) { gruel::scoped_lock lock(d_mutex); _powerValue = value; } int -SpectrumGUIClass::GetWindowType() +SpectrumGUIClass::getWindowType() { gruel::scoped_lock lock(d_mutex); int returnValue = 0; @@ -335,14 +335,14 @@ SpectrumGUIClass::GetWindowType() } void -SpectrumGUIClass::SetWindowType(const int newType) +SpectrumGUIClass::setWindowType(const int newType) { gruel::scoped_lock lock(d_mutex); _windowType = newType; } int -SpectrumGUIClass::GetFFTSize() +SpectrumGUIClass::getFFTSize() { int returnValue = 0; returnValue = _fftSize; @@ -350,10 +350,10 @@ SpectrumGUIClass::GetFFTSize() } int -SpectrumGUIClass::GetFFTSizeIndex() +SpectrumGUIClass::getFFTSizeIndex() { gruel::scoped_lock lock(d_mutex); - int fftsize = GetFFTSize(); + int fftsize = getFFTSize(); switch(fftsize) { case(1024): return 0; break; case(2048): return 1; break; @@ -366,14 +366,14 @@ SpectrumGUIClass::GetFFTSizeIndex() } void -SpectrumGUIClass::SetFFTSize(const int newSize) +SpectrumGUIClass::setFFTSize(const int newSize) { gruel::scoped_lock lock(d_mutex); _fftSize = newSize; } gruel::high_res_timer_type -SpectrumGUIClass::GetLastGUIUpdateTime() +SpectrumGUIClass::getLastGUIUpdateTime() { gruel::scoped_lock lock(d_mutex); gruel::high_res_timer_type returnValue; @@ -382,14 +382,14 @@ SpectrumGUIClass::GetLastGUIUpdateTime() } void -SpectrumGUIClass::SetLastGUIUpdateTime(const gruel::high_res_timer_type newTime) +SpectrumGUIClass::setLastGUIUpdateTime(const gruel::high_res_timer_type newTime) { gruel::scoped_lock lock(d_mutex); _lastGUIUpdateTime = newTime; } unsigned int -SpectrumGUIClass::GetPendingGUIUpdateEvents() +SpectrumGUIClass::getPendingGUIUpdateEvents() { gruel::scoped_lock lock(d_mutex); unsigned int returnValue = 0; @@ -398,14 +398,14 @@ SpectrumGUIClass::GetPendingGUIUpdateEvents() } void -SpectrumGUIClass::IncrementPendingGUIUpdateEvents() +SpectrumGUIClass::incrementPendingGUIUpdateEvents() { gruel::scoped_lock lock(d_mutex); _pendingGUIUpdateEventsCount++; } void -SpectrumGUIClass::DecrementPendingGUIUpdateEvents() +SpectrumGUIClass::decrementPendingGUIUpdateEvents() { gruel::scoped_lock lock(d_mutex); if(_pendingGUIUpdateEventsCount > 0){ @@ -414,7 +414,7 @@ SpectrumGUIClass::DecrementPendingGUIUpdateEvents() } void -SpectrumGUIClass::ResetPendingGUIUpdateEvents() +SpectrumGUIClass::resetPendingGUIUpdateEvents() { gruel::scoped_lock lock(d_mutex); _pendingGUIUpdateEventsCount = 0; @@ -429,41 +429,41 @@ SpectrumGUIClass::qwidget() } void -SpectrumGUIClass::SetTimeDomainAxis(double min, double max) +SpectrumGUIClass::setTimeDomainAxis(double min, double max) { gruel::scoped_lock lock(d_mutex); - _spectrumDisplayForm->SetTimeDomainAxis(min, max); + _spectrumDisplayForm->setTimeDomainAxis(min, max); } void -SpectrumGUIClass::SetConstellationAxis(double xmin, double xmax, +SpectrumGUIClass::setConstellationAxis(double xmin, double xmax, double ymin, double ymax) { gruel::scoped_lock lock(d_mutex); - _spectrumDisplayForm->SetConstellationAxis(xmin, xmax, ymin, ymax); + _spectrumDisplayForm->setConstellationAxis(xmin, xmax, ymin, ymax); } void -SpectrumGUIClass::SetConstellationPenSize(int size) +SpectrumGUIClass::setConstellationPenSize(int size) { gruel::scoped_lock lock(d_mutex); - _spectrumDisplayForm->SetConstellationPenSize(size); + _spectrumDisplayForm->setConstellationPenSize(size); } void -SpectrumGUIClass::SetFrequencyAxis(double min, double max) +SpectrumGUIClass::setFrequencyAxis(double min, double max) { gruel::scoped_lock lock(d_mutex); - _spectrumDisplayForm->SetFrequencyAxis(min, max); + _spectrumDisplayForm->setFrequencyAxis(min, max); } void -SpectrumGUIClass::SetUpdateTime(double t) +SpectrumGUIClass::setUpdateTime(double t) { gruel::scoped_lock lock(d_mutex); _updateTime = t; - _spectrumDisplayForm->SetUpdateTime(_updateTime); + _spectrumDisplayForm->setUpdateTime(_updateTime); } diff --git a/gr-qtgui/lib/SpectrumGUIClass.h b/gr-qtgui/lib/SpectrumGUIClass.h index a1150199b2..c76e437cb3 100644 --- a/gr-qtgui/lib/SpectrumGUIClass.h +++ b/gr-qtgui/lib/SpectrumGUIClass.h @@ -47,57 +47,57 @@ public: const double newStartFrequency, const double newStopFrequency); ~SpectrumGUIClass(); - void Reset(); + void reset(); - void OpenSpectrumWindow(QWidget*, + void openSpectrumWindow(QWidget*, const bool frequency=true, const bool waterfall=true, const bool time=true, const bool constellation=true); - void SetDisplayTitle(const std::string); + void setDisplayTitle(const std::string); - bool GetWindowOpenFlag(); - void SetWindowOpenFlag(const bool); + bool getWindowOpenFlag(); + void setWindowOpenFlag(const bool); - void SetFrequencyRange(const double, const double, const double); - double GetStartFrequency(); - double GetStopFrequency(); - double GetCenterFrequency(); + void setFrequencyRange(const double, const double, const double); + double getStartFrequency(); + double getStopFrequency(); + double getCenterFrequency(); - void UpdateWindow(const bool, const float*, + void updateWindow(const bool, const float*, const uint64_t, const float*, const uint64_t, const float*, const uint64_t, const gruel::high_res_timer_type, const bool); - float GetPowerValue(); - void SetPowerValue(const float); + float getPowerValue(); + void setPowerValue(const float); - int GetWindowType(); - void SetWindowType(const int); + int getWindowType(); + void setWindowType(const int); - int GetFFTSize(); - int GetFFTSizeIndex(); - void SetFFTSize(const int); + int getFFTSize(); + int getFFTSizeIndex(); + void setFFTSize(const int); - gruel::high_res_timer_type GetLastGUIUpdateTime(); - void SetLastGUIUpdateTime(const gruel::high_res_timer_type); + gruel::high_res_timer_type getLastGUIUpdateTime(); + void setLastGUIUpdateTime(const gruel::high_res_timer_type); - unsigned int GetPendingGUIUpdateEvents(); - void IncrementPendingGUIUpdateEvents(); - void DecrementPendingGUIUpdateEvents(); - void ResetPendingGUIUpdateEvents(); + unsigned int getPendingGUIUpdateEvents(); + void incrementPendingGUIUpdateEvents(); + void decrementPendingGUIUpdateEvents(); + void resetPendingGUIUpdateEvents(); static const long MAX_FFT_SIZE; static const long MIN_FFT_SIZE; QWidget* qwidget(); - void SetTimeDomainAxis(double min, double max); - void SetConstellationAxis(double xmin, double xmax, + void setTimeDomainAxis(double min, double max); + void setConstellationAxis(double xmin, double xmax, double ymin, double ymax); - void SetConstellationPenSize(int size); - void SetFrequencyAxis(double min, double max); + void setConstellationPenSize(int size); + void setFrequencyAxis(double min, double max); - void SetUpdateTime(double t); + void setUpdateTime(double t); protected: diff --git a/gr-qtgui/lib/TimeDomainDisplayPlot.cc b/gr-qtgui/lib/TimeDomainDisplayPlot.cc index a10418bddf..f3c3b4deb3 100644 --- a/gr-qtgui/lib/TimeDomainDisplayPlot.cc +++ b/gr-qtgui/lib/TimeDomainDisplayPlot.cc @@ -43,12 +43,12 @@ public: { } - virtual unsigned int GetTimePrecision() const + virtual unsigned int getTimePrecision() const { return _timePrecision; } - virtual void SetTimePrecision(const unsigned int newPrecision) + virtual void setTimePrecision(const unsigned int newPrecision) { _timePrecision = newPrecision; } @@ -74,7 +74,7 @@ public: updateDisplay(); } - void SetUnitType(const std::string &type) + void setUnitType(const std::string &type) { _unitType = type; } @@ -84,7 +84,7 @@ protected: virtual QwtText trackerText( const QPoint& p ) const { QwtDoublePoint dp = QwtPlotZoomer::invTransform(p); - QwtText t(QString("%1 %2, %3 V").arg(dp.x(), 0, 'f', GetTimePrecision()). + QwtText t(QString("%1 %2, %3 V").arg(dp.x(), 0, 'f', getTimePrecision()). arg(_unitType.c_str()). arg(dp.y(), 0, 'f', 4)); @@ -176,7 +176,7 @@ TimeDomainDisplayPlot::replot() } void -TimeDomainDisplayPlot::PlotNewData(const std::vector<double*> dataPoints, +TimeDomainDisplayPlot::plotNewData(const std::vector<double*> dataPoints, const int64_t numDataPoints, const double timeInterval) { @@ -231,7 +231,7 @@ void TimeDomainDisplayPlot::_resetXAxisPoints() } void -TimeDomainDisplayPlot::SetSampleRate(double sr, double units, +TimeDomainDisplayPlot::setSampleRate(double sr, double units, const std::string &strunits) { double newsr = sr/units; @@ -244,8 +244,8 @@ TimeDomainDisplayPlot::SetSampleRate(double sr, double units, //double display_units = ceil(log10(units)/2.0); double display_units = 4; setAxisTitle(QwtPlot::xBottom, QString("Time (%1)").arg(strunits.c_str())); - ((TimeDomainDisplayZoomer*)_zoomer)->SetTimePrecision(display_units); - ((TimeDomainDisplayZoomer*)_zoomer)->SetUnitType(strunits); + ((TimeDomainDisplayZoomer*)_zoomer)->setTimePrecision(display_units); + ((TimeDomainDisplayZoomer*)_zoomer)->setUnitType(strunits); } } diff --git a/gr-qtgui/lib/TimeDomainDisplayPlot.h b/gr-qtgui/lib/TimeDomainDisplayPlot.h index 9c07e96ba0..c7d5f27a5d 100644 --- a/gr-qtgui/lib/TimeDomainDisplayPlot.h +++ b/gr-qtgui/lib/TimeDomainDisplayPlot.h @@ -36,13 +36,13 @@ public: TimeDomainDisplayPlot(int nplots, QWidget*); virtual ~TimeDomainDisplayPlot(); - void PlotNewData(const std::vector<double*> dataPoints, + void plotNewData(const std::vector<double*> dataPoints, const int64_t numDataPoints, const double timeInterval); void replot(); public slots: - void SetSampleRate(double sr, double units, + void setSampleRate(double sr, double units, const std::string &strunits); private: diff --git a/gr-qtgui/lib/WaterfallDisplayPlot.cc b/gr-qtgui/lib/WaterfallDisplayPlot.cc index 356e10c4dc..be0cfc18a3 100644 --- a/gr-qtgui/lib/WaterfallDisplayPlot.cc +++ b/gr-qtgui/lib/WaterfallDisplayPlot.cc @@ -71,7 +71,7 @@ public: virtual QwtText label(double value) const { - double secs = double(value * GetSecondsPerLine()); + double secs = double(value * getSecondsPerLine()); return QwtText(QString("").sprintf("%.1f", secs)); } @@ -111,7 +111,7 @@ public: updateDisplay(); } - void SetUnitType(const std::string &type) + void setUnitType(const std::string &type) { _unitType = type; } @@ -121,9 +121,9 @@ protected: virtual QwtText trackerText( QPoint const &p ) const { QwtDoublePoint dp = QwtPlotZoomer::invTransform(p); - double secs = double(dp.y() * GetSecondsPerLine()); + double secs = double(dp.y() * getSecondsPerLine()); QwtText t(QString("%1 %2, %3 s") - .arg(dp.x(), 0, 'f', GetFrequencyPrecision()) + .arg(dp.x(), 0, 'f', getFrequencyPrecision()) .arg(_unitType.c_str()) .arg(secs, 0, 'f', 2)); return t; @@ -140,9 +140,8 @@ WaterfallDisplayPlot::WaterfallDisplayPlot(int nplots, QWidget* parent) : DisplayPlot(nplots, parent) { _zoomer = NULL; // need this for proper init - _startFrequency = 0; - _stopFrequency = 4000; - _useCenterFrequencyFlag = false; + _startFrequency = -1; + _stopFrequency = 1; resize(parent->width(), parent->height()); _numPoints = 1024; @@ -183,7 +182,7 @@ WaterfallDisplayPlot::WaterfallDisplayPlot(int nplots, QWidget* parent) d_spectrogram[i]->attach(this); _intensityColorMapType.push_back(colormaps[i%colormaps.size()]); - SetIntensityColorMapType(i, _intensityColorMapType[i], + setIntensityColorMapType(i, _intensityColorMapType[i], QColor("white"), QColor("white")); } @@ -204,7 +203,7 @@ WaterfallDisplayPlot::WaterfallDisplayPlot(int nplots, QWidget* parent) _zoomer->setRubberBandPen(c); _zoomer->setTrackerPen(c); - _UpdateIntensityRangeDisplay(); + _updateIntensityRangeDisplay(); _xAxisMultiplier = 1; } @@ -214,44 +213,35 @@ WaterfallDisplayPlot::~WaterfallDisplayPlot() } void -WaterfallDisplayPlot::Reset() +WaterfallDisplayPlot::resetAxis() { for(int i = 0; i < _nplots; i++) { - d_data[i]->ResizeData(_startFrequency, _stopFrequency, _numPoints); - d_data[i]->Reset(); + d_data[i]->resizeData(_startFrequency, _stopFrequency, _numPoints); + d_data[i]->reset(); } setAxisScale(QwtPlot::xBottom, _startFrequency, _stopFrequency); // Load up the new base zoom settings - QwtDoubleRect newSize = _zoomer->zoomBase(); - newSize.setLeft(_startFrequency); - newSize.setWidth(_stopFrequency-_startFrequency); - _zoomer->zoom(newSize); - _zoomer->setZoomBase(newSize); + QwtDoubleRect zbase = _zoomer->zoomBase(); + zbase.setLeft(_startFrequency); + zbase.setRight(_stopFrequency); + _zoomer->zoom(zbase); + _zoomer->setZoomBase(zbase); + _zoomer->setZoomBase(true); _zoomer->zoom(0); } void -WaterfallDisplayPlot::SetFrequencyRange(const double constStartFreq, - const double constStopFreq, - const double constCenterFreq, - const bool useCenterFrequencyFlag, +WaterfallDisplayPlot::setFrequencyRange(const double centerfreq, + const double bandwidth, const double units, const std::string &strunits) { - double startFreq = constStartFreq / units; - double stopFreq = constStopFreq / units; - double centerFreq = constCenterFreq / units; + double startFreq = (centerfreq - bandwidth/2.0f) / units; + double stopFreq = (centerfreq + bandwidth/2.0f) / units; _xAxisMultiplier = units; - _useCenterFrequencyFlag = useCenterFrequencyFlag; - - if(_useCenterFrequencyFlag) { - startFreq = (startFreq + centerFreq); - stopFreq = (stopFreq + centerFreq); - } - bool reset = false; if((startFreq != _startFrequency) || (stopFreq != _stopFrequency)) reset = true; @@ -266,30 +256,30 @@ WaterfallDisplayPlot::SetFrequencyRange(const double constStartFreq, setAxisTitle(QwtPlot::xBottom, QString("Frequency (%1)").arg(strunits.c_str())); if(reset) { - Reset(); + resetAxis(); } - ((WaterfallZoomer*)_zoomer)->SetFrequencyPrecision(display_units); - ((WaterfallZoomer*)_zoomer)->SetUnitType(strunits); + ((WaterfallZoomer*)_zoomer)->setFrequencyPrecision(display_units); + ((WaterfallZoomer*)_zoomer)->setUnitType(strunits); } } } double -WaterfallDisplayPlot::GetStartFrequency() const +WaterfallDisplayPlot::getStartFrequency() const { return _startFrequency; } double -WaterfallDisplayPlot::GetStopFrequency() const +WaterfallDisplayPlot::getStopFrequency() const { return _stopFrequency; } void -WaterfallDisplayPlot::PlotNewData(const std::vector<double*> dataPoints, +WaterfallDisplayPlot::plotNewData(const std::vector<double*> dataPoints, const int64_t numDataPoints, const double timePerFFT, const gruel::high_res_timer_type timestamp, @@ -300,7 +290,7 @@ WaterfallDisplayPlot::PlotNewData(const std::vector<double*> dataPoints, if(numDataPoints != _numPoints){ _numPoints = numDataPoints; - Reset(); + resetAxis(); for(int i = 0; i < _nplots; i++) { d_spectrogram[i]->invalidateCache(); @@ -316,15 +306,15 @@ WaterfallDisplayPlot::PlotNewData(const std::vector<double*> dataPoints, for(int i = 0; i < _nplots; i++) { d_data[i]->addFFTData(dataPoints[i], numDataPoints, droppedFrames); - d_data[i]->IncrementNumLinesToUpdate(); + d_data[i]->incrementNumLinesToUpdate(); } QwtTimeScaleDraw* timeScale = (QwtTimeScaleDraw*)axisScaleDraw(QwtPlot::yLeft); - timeScale->SetSecondsPerLine(timePerFFT); - timeScale->SetZeroTime(timestamp); + timeScale->setSecondsPerLine(timePerFFT); + timeScale->setZeroTime(timestamp); - ((WaterfallZoomer*)_zoomer)->SetSecondsPerLine(timePerFFT); - ((WaterfallZoomer*)_zoomer)->SetZeroTime(timestamp); + ((WaterfallZoomer*)_zoomer)->setSecondsPerLine(timePerFFT); + ((WaterfallZoomer*)_zoomer)->setZeroTime(timestamp); for(int i = 0; i < _nplots; i++) { d_spectrogram[i]->invalidateCache(); @@ -337,7 +327,7 @@ WaterfallDisplayPlot::PlotNewData(const std::vector<double*> dataPoints, } void -WaterfallDisplayPlot::PlotNewData(const double* dataPoints, +WaterfallDisplayPlot::plotNewData(const double* dataPoints, const int64_t numDataPoints, const double timePerFFT, const gruel::high_res_timer_type timestamp, @@ -345,12 +335,12 @@ WaterfallDisplayPlot::PlotNewData(const double* dataPoints, { std::vector<double*> vecDataPoints; vecDataPoints.push_back((double*)dataPoints); - PlotNewData(vecDataPoints, numDataPoints, timePerFFT, + plotNewData(vecDataPoints, numDataPoints, timePerFFT, timestamp, droppedFrames); } void -WaterfallDisplayPlot::SetIntensityRange(const double minIntensity, +WaterfallDisplayPlot::setIntensityRange(const double minIntensity, const double maxIntensity) { for(int i = 0; i < _nplots; i++) { @@ -360,10 +350,10 @@ WaterfallDisplayPlot::SetIntensityRange(const double minIntensity, d_data[i]->setInterval(Qt::ZAxis, QwtInterval(minIntensity, maxIntensity)); #endif - emit UpdatedLowerIntensityLevel(minIntensity); - emit UpdatedUpperIntensityLevel(maxIntensity); + emit updatedLowerIntensityLevel(minIntensity); + emit updatedUpperIntensityLevel(maxIntensity); - _UpdateIntensityRangeDisplay(); + _updateIntensityRangeDisplay(); } } @@ -395,13 +385,13 @@ WaterfallDisplayPlot::replot() } int -WaterfallDisplayPlot::GetIntensityColorMapType(int which) const +WaterfallDisplayPlot::getIntensityColorMapType(int which) const { return _intensityColorMapType[which]; } void -WaterfallDisplayPlot::SetIntensityColorMapType(const int which, +WaterfallDisplayPlot::setIntensityColorMapType(const int which, const int newType, const QColor lowColor, const QColor highColor) @@ -465,48 +455,48 @@ WaterfallDisplayPlot::SetIntensityColorMapType(const int which, default: break; } - _UpdateIntensityRangeDisplay(); + _updateIntensityRangeDisplay(); } } void -WaterfallDisplayPlot::SetIntensityColorMapType1(int newType) +WaterfallDisplayPlot::setIntensityColorMapType1(int newType) { - SetIntensityColorMapType(0, newType, _userDefinedLowIntensityColor, _userDefinedHighIntensityColor); + setIntensityColorMapType(0, newType, _userDefinedLowIntensityColor, _userDefinedHighIntensityColor); } int -WaterfallDisplayPlot::GetIntensityColorMapType1() const +WaterfallDisplayPlot::getIntensityColorMapType1() const { - return GetIntensityColorMapType(0); + return getIntensityColorMapType(0); } void -WaterfallDisplayPlot::SetUserDefinedLowIntensityColor(QColor c) +WaterfallDisplayPlot::setUserDefinedLowIntensityColor(QColor c) { _userDefinedLowIntensityColor = c; } const QColor -WaterfallDisplayPlot::GetUserDefinedLowIntensityColor() const +WaterfallDisplayPlot::getUserDefinedLowIntensityColor() const { return _userDefinedLowIntensityColor; } void -WaterfallDisplayPlot::SetUserDefinedHighIntensityColor(QColor c) +WaterfallDisplayPlot::setUserDefinedHighIntensityColor(QColor c) { _userDefinedHighIntensityColor = c; } const QColor -WaterfallDisplayPlot::GetUserDefinedHighIntensityColor() const +WaterfallDisplayPlot::getUserDefinedHighIntensityColor() const { return _userDefinedHighIntensityColor; } void -WaterfallDisplayPlot::_UpdateIntensityRangeDisplay() +WaterfallDisplayPlot::_updateIntensityRangeDisplay() { QwtScaleWidget *rightAxis = axisWidget(QwtPlot::yRight); rightAxis->setTitle("Intensity (dB)"); diff --git a/gr-qtgui/lib/WaterfallDisplayPlot.h b/gr-qtgui/lib/WaterfallDisplayPlot.h index fbb0131563..e962a6c881 100644 --- a/gr-qtgui/lib/WaterfallDisplayPlot.h +++ b/gr-qtgui/lib/WaterfallDisplayPlot.h @@ -41,58 +41,57 @@ class WaterfallDisplayPlot: public DisplayPlot { Q_OBJECT - Q_PROPERTY ( int intensity_color_map_type1 READ GetIntensityColorMapType1 WRITE SetIntensityColorMapType1 ) - Q_PROPERTY ( QColor low_intensity_color READ GetUserDefinedLowIntensityColor WRITE SetUserDefinedLowIntensityColor ) - Q_PROPERTY ( QColor high_intensity_color READ GetUserDefinedHighIntensityColor WRITE SetUserDefinedHighIntensityColor ) + Q_PROPERTY ( int intensity_color_map_type1 READ getIntensityColorMapType1 WRITE setIntensityColorMapType1 ) + Q_PROPERTY ( QColor low_intensity_color READ getUserDefinedLowIntensityColor WRITE setUserDefinedLowIntensityColor ) + Q_PROPERTY ( QColor high_intensity_color READ getUserDefinedHighIntensityColor WRITE setUserDefinedHighIntensityColor ) public: WaterfallDisplayPlot(int nplots, QWidget*); virtual ~WaterfallDisplayPlot(); - void Reset(); + void resetAxis(); - void SetFrequencyRange(const double, const double, - const double, const bool, + void setFrequencyRange(const double, const double, const double units=1000.0, const std::string &strunits = "kHz"); - double GetStartFrequency() const; - double GetStopFrequency() const; + double getStartFrequency() const; + double getStopFrequency() const; - void PlotNewData(const std::vector<double*> dataPoints, + void plotNewData(const std::vector<double*> dataPoints, const int64_t numDataPoints, const double timePerFFT, const gruel::high_res_timer_type timestamp, const int droppedFrames); // to be removed - void PlotNewData(const double* dataPoints, + void plotNewData(const double* dataPoints, const int64_t numDataPoints, const double timePerFFT, const gruel::high_res_timer_type timestamp, const int droppedFrames); - void SetIntensityRange(const double minIntensity, const double maxIntensity); + void setIntensityRange(const double minIntensity, const double maxIntensity); void replot(void); - int GetIntensityColorMapType(int) const; - int GetIntensityColorMapType1() const; - const QColor GetUserDefinedLowIntensityColor() const; - const QColor GetUserDefinedHighIntensityColor() const; + int getIntensityColorMapType(int) const; + int getIntensityColorMapType1() const; + const QColor getUserDefinedLowIntensityColor() const; + const QColor getUserDefinedHighIntensityColor() const; public slots: - void SetIntensityColorMapType(const int, const int, const QColor, const QColor); - void SetIntensityColorMapType1(int); - void SetUserDefinedLowIntensityColor(QColor); - void SetUserDefinedHighIntensityColor(QColor); + void setIntensityColorMapType(const int, const int, const QColor, const QColor); + void setIntensityColorMapType1(int); + void setUserDefinedLowIntensityColor(QColor); + void setUserDefinedHighIntensityColor(QColor); signals: - void UpdatedLowerIntensityLevel(const double); - void UpdatedUpperIntensityLevel(const double); + void updatedLowerIntensityLevel(const double); + void updatedUpperIntensityLevel(const double); private: - void _UpdateIntensityRangeDisplay(); + void _updateIntensityRangeDisplay(); double _startFrequency; double _stopFrequency; @@ -108,8 +107,6 @@ private: gruel::high_res_timer_type _lastReplot; - bool _useCenterFrequencyFlag; - std::vector<int> _intensityColorMapType; QColor _userDefinedLowIntensityColor; QColor _userDefinedHighIntensityColor; diff --git a/gr-qtgui/lib/constellationdisplayform.cc b/gr-qtgui/lib/constellationdisplayform.cc index 5f742de991..27c4704e0a 100644 --- a/gr-qtgui/lib/constellationdisplayform.cc +++ b/gr-qtgui/lib/constellationdisplayform.cc @@ -69,7 +69,7 @@ ConstellationDisplayForm::newData(const QEvent* updateEvent) const std::vector<double*> imagDataPoints = tevent->getImagPoints(); const uint64_t numDataPoints = tevent->getNumDataPoints(); - getPlot()->PlotNewData(realDataPoints, + getPlot()->plotNewData(realDataPoints, imagDataPoints, numDataPoints, d_update_time); diff --git a/gr-qtgui/lib/freq_sink_c_impl.cc b/gr-qtgui/lib/freq_sink_c_impl.cc index e1e0084870..2db5cf56bb 100644 --- a/gr-qtgui/lib/freq_sink_c_impl.cc +++ b/gr-qtgui/lib/freq_sink_c_impl.cc @@ -121,11 +121,10 @@ namespace gr { } d_main_gui = new FreqDisplayForm(d_nconnections, d_parent); - d_main_gui->setFFTSize(d_fftsize); d_main_gui->setFFTWindowType(d_wintype); - d_main_gui->setFrequencyRange(d_center_freq, - d_center_freq - d_bandwidth/2.0, - d_center_freq + d_bandwidth/2.0); + + set_fft_size(d_fftsize); + set_frequency_range(d_center_freq, d_bandwidth); // initialize update time to 10 times a second set_update_time(0.1); @@ -184,9 +183,7 @@ namespace gr { { d_center_freq = centerfreq; d_bandwidth = bandwidth; - d_main_gui->setFrequencyRange(d_center_freq, - -d_bandwidth/2.0, - d_bandwidth/2.0); + d_main_gui->setFrequencyRange(d_center_freq, d_bandwidth); } void diff --git a/gr-qtgui/lib/freq_sink_f_impl.cc b/gr-qtgui/lib/freq_sink_f_impl.cc index 087b198518..c0edf415a5 100644 --- a/gr-qtgui/lib/freq_sink_f_impl.cc +++ b/gr-qtgui/lib/freq_sink_f_impl.cc @@ -121,11 +121,9 @@ namespace gr { } d_main_gui = new FreqDisplayForm(d_nconnections, d_parent); - d_main_gui->setFFTSize(d_fftsize); d_main_gui->setFFTWindowType(d_wintype); - d_main_gui->setFrequencyRange(d_center_freq, - d_center_freq - d_bandwidth/2.0, - d_center_freq + d_bandwidth/2.0); + set_fft_size(d_fftsize); + set_frequency_range(d_center_freq, d_bandwidth/2.0); // initialize update time to 10 times a second set_update_time(0.1); @@ -184,9 +182,7 @@ namespace gr { { d_center_freq = centerfreq; d_bandwidth = bandwidth; - d_main_gui->setFrequencyRange(d_center_freq, - -d_bandwidth/2.0, - d_bandwidth/2.0); + d_main_gui->setFrequencyRange(d_center_freq, d_bandwidth); } void diff --git a/gr-qtgui/lib/freqdisplayform.cc b/gr-qtgui/lib/freqdisplayform.cc index 410bb4a048..4163acc826 100644 --- a/gr-qtgui/lib/freqdisplayform.cc +++ b/gr-qtgui/lib/freqdisplayform.cc @@ -80,7 +80,7 @@ FreqDisplayForm::newData(const QEvent *updateEvent) const std::vector<double*> dataPoints = fevent->getPoints(); const uint64_t numDataPoints = fevent->getNumDataPoints(); - getPlot()->PlotNewData(dataPoints, numDataPoints, + getPlot()->plotNewData(dataPoints, numDataPoints, 0, 0, 0, d_update_time); } @@ -130,29 +130,17 @@ FreqDisplayForm::setFFTWindowType(const gr::filter::firdes::win_type newwin) } void -FreqDisplayForm::setFrequencyRange(const double newCenterFrequency, - const double newStartFrequency, - const double newStopFrequency) +FreqDisplayForm::setFrequencyRange(const double centerfreq, + const double bandwidth) { - double fdiff = std::max(fabs(newStartFrequency), fabs(newStopFrequency)); - - if(fdiff > 0) { - std::string strunits[4] = {"Hz", "kHz", "MHz", "GHz"}; - double units10 = floor(log10(fdiff)); - double units3 = std::max(floor(units10 / 3.0), 0.0); - double units = pow(10, (units10-fmod(units10, 3.0))); - int iunit = static_cast<int>(units3); - - _startFrequency = newStartFrequency; - _stopFrequency = newStopFrequency; - double centerFrequency = newCenterFrequency; - - getPlot()->SetFrequencyRange(_startFrequency, - _stopFrequency, - centerFrequency, - true, - units, strunits[iunit]); - } + std::string strunits[4] = {"Hz", "kHz", "MHz", "GHz"}; + double units10 = floor(log10(bandwidth)); + double units3 = std::max(floor(units10 / 3.0), 0.0); + double units = pow(10, (units10-fmod(units10, 3.0))); + int iunit = static_cast<int>(units3); + + getPlot()->setFrequencyRange(centerfreq, bandwidth, + units, strunits[iunit]); } void diff --git a/gr-qtgui/lib/freqdisplayform.h b/gr-qtgui/lib/freqdisplayform.h index 4a7fc7d2e5..009637481c 100644 --- a/gr-qtgui/lib/freqdisplayform.h +++ b/gr-qtgui/lib/freqdisplayform.h @@ -52,9 +52,8 @@ public slots: void setFFTAverage(const float); void setFFTWindowType(const gr::filter::firdes::win_type); - void setFrequencyRange(const double newCenterFrequency, - const double newStartFrequency, - const double newStopFrequency); + void setFrequencyRange(const double centerfreq, + const double bandwidth); void setYaxis(double min, double max); private slots: @@ -64,9 +63,6 @@ private: uint64_t _numRealDataPoints; QIntValidator* _intValidator; - double _startFrequency; - double _stopFrequency; - int _fftsize; float _fftavg; gr::filter::firdes::win_type _fftwintype; diff --git a/gr-qtgui/lib/qtgui_types.h b/gr-qtgui/lib/qtgui_types.h index fd5dd6295f..f4b16dfef2 100644 --- a/gr-qtgui/lib/qtgui_types.h +++ b/gr-qtgui/lib/qtgui_types.h @@ -40,22 +40,22 @@ public: { } - virtual unsigned int GetFrequencyPrecision() const + virtual unsigned int getFrequencyPrecision() const { return _frequencyPrecision; } - virtual void SetFrequencyPrecision(const unsigned int newPrecision) + virtual void setFrequencyPrecision(const unsigned int newPrecision) { _frequencyPrecision = newPrecision; } - virtual double GetCenterFrequency() const + virtual double getCenterFrequency() const { return _centerFrequency; } - virtual void SetCenterFrequency(const double newFreq) + virtual void setCenterFrequency(const double newFreq) { _centerFrequency = newFreq; } @@ -80,22 +80,22 @@ public: { } - virtual gruel::high_res_timer_type GetZeroTime() const + virtual gruel::high_res_timer_type getZeroTime() const { return _zeroTime; } - virtual void SetZeroTime(const gruel::high_res_timer_type newTime) + virtual void setZeroTime(const gruel::high_res_timer_type newTime) { _zeroTime = newTime - gruel::high_res_timer_epoch(); } - virtual void SetSecondsPerLine(const double newTime) + virtual void setSecondsPerLine(const double newTime) { _secondsPerLine = newTime; } - virtual double GetSecondsPerLine() const + virtual double getSecondsPerLine() const { return _secondsPerLine; } @@ -122,7 +122,7 @@ public: virtual QwtText label(double value) const { - return QString("%1").arg(value, 0, 'f', GetFrequencyPrecision()); + return QString("%1").arg(value, 0, 'f', getFrequencyPrecision()); } virtual void initiateUpdate(void) diff --git a/gr-qtgui/lib/sink_c_impl.cc b/gr-qtgui/lib/sink_c_impl.cc index 2cc66872c4..a8a0526e77 100644 --- a/gr-qtgui/lib/sink_c_impl.cc +++ b/gr-qtgui/lib/sink_c_impl.cc @@ -126,11 +126,11 @@ namespace gr { -d_bandwidth/2.0, d_bandwidth/2.0); - d_main_gui->SetDisplayTitle(d_name); - d_main_gui->SetFFTSize(d_fftsize); - d_main_gui->SetWindowType((int)d_wintype); + d_main_gui->setDisplayTitle(d_name); + d_main_gui->setWindowType((int)d_wintype); + set_fft_size(d_fftsize); - d_main_gui->OpenSpectrumWindow(d_parent, + d_main_gui->openSpectrumWindow(d_parent, d_plotfreq, d_plotwaterfall, d_plottime, d_plotconst); @@ -165,7 +165,7 @@ namespace gr { sink_c_impl::set_fft_size(const int fftsize) { d_fftsize = fftsize; - d_main_gui->SetFFTSize(fftsize); + d_main_gui->setFFTSize(fftsize); } int @@ -180,7 +180,7 @@ namespace gr { { d_center_freq = centerfreq; d_bandwidth = bandwidth; - d_main_gui->SetFrequencyRange(d_center_freq, + d_main_gui->setFrequencyRange(d_center_freq, -d_bandwidth/2.0, d_bandwidth/2.0); } @@ -188,27 +188,27 @@ namespace gr { void sink_c_impl::set_fft_power_db(double min, double max) { - d_main_gui->SetFrequencyAxis(min, max); + d_main_gui->setFrequencyAxis(min, max); } /* void sink_c_impl::set_time_domain_axis(double min, double max) { - d_main_gui->SetTimeDomainAxis(min, max); + d_main_gui->setTimeDomainAxis(min, max); } void sink_c_impl::set_constellation_axis(double xmin, double xmax, double ymin, double ymax) { - d_main_gui->SetConstellationAxis(xmin, xmax, ymin, ymax); + d_main_gui->setConstellationAxis(xmin, xmax, ymin, ymax); } void sink_c_impl::set_constellation_pen_size(int size) { - d_main_gui->SetConstellationPenSize(size); + d_main_gui->setConstellationPenSize(size); } */ @@ -216,7 +216,7 @@ namespace gr { sink_c_impl::set_update_time(double t) { d_update_time = t * gruel::high_res_timer_tps(); - d_main_gui->SetUpdateTime(t); + d_main_gui->setUpdateTime(t); } void @@ -239,7 +239,7 @@ namespace gr { sink_c_impl::windowreset() { filter::firdes::win_type newwintype; - newwintype = (filter::firdes::win_type)d_main_gui->GetWindowType(); + newwintype = (filter::firdes::win_type)d_main_gui->getWindowType(); if(d_wintype != newwintype) { d_wintype = newwintype; buildwindow(); @@ -258,7 +258,7 @@ namespace gr { void sink_c_impl::fftresize() { - int newfftsize = d_main_gui->GetFFTSize(); + int newfftsize = d_main_gui->getFFTSize(); if(newfftsize != d_fftsize) { @@ -320,7 +320,7 @@ namespace gr { j += resid; fft(d_magbuf, d_residbuf, d_fftsize); - d_main_gui->UpdateWindow(true, d_magbuf, d_fftsize, + d_main_gui->updateWindow(true, d_magbuf, d_fftsize, NULL, 0, (float*)d_residbuf, d_fftsize, currentTime, true); d_update_active = false; diff --git a/gr-qtgui/lib/sink_f_impl.cc b/gr-qtgui/lib/sink_f_impl.cc index 4ef2fb644c..5cb14db672 100644 --- a/gr-qtgui/lib/sink_f_impl.cc +++ b/gr-qtgui/lib/sink_f_impl.cc @@ -121,11 +121,11 @@ namespace gr { d_center_freq, -d_bandwidth/2.0, d_bandwidth/2.0); - d_main_gui->SetDisplayTitle(d_name); - d_main_gui->SetFFTSize(d_fftsize); - d_main_gui->SetWindowType((int)d_wintype); + d_main_gui->setDisplayTitle(d_name); + d_main_gui->setWindowType((int)d_wintype); + set_fft_size(d_fftsize); - d_main_gui->OpenSpectrumWindow(d_parent, + d_main_gui->openSpectrumWindow(d_parent, d_plotfreq, d_plotwaterfall, d_plottime, d_plotconst); @@ -157,7 +157,7 @@ namespace gr { sink_f_impl::set_fft_size(const int fftsize) { d_fftsize = fftsize; - d_main_gui->SetFFTSize(fftsize); + d_main_gui->setFFTSize(fftsize); } int @@ -172,7 +172,7 @@ namespace gr { { d_center_freq = centerfreq; d_bandwidth = bandwidth; - d_main_gui->SetFrequencyRange(d_center_freq, + d_main_gui->setFrequencyRange(d_center_freq, -d_bandwidth/2.0, d_bandwidth/2.0); } @@ -180,27 +180,27 @@ namespace gr { void sink_f_impl::set_fft_power_db(double min, double max) { - d_main_gui->SetFrequencyAxis(min, max); + d_main_gui->setFrequencyAxis(min, max); } /* void sink_f_impl::set_time_domain_axis(double min, double max) { - d_main_gui->SetTimeDomainAxis(min, max); + d_main_gui->setTimeDomainAxis(min, max); } void sink_f_impl::set_constellation_axis(double xmin, double xmax, double ymin, double ymax) { - d_main_gui->SetConstellationAxis(xmin, xmax, ymin, ymax); + d_main_gui->setConstellationAxis(xmin, xmax, ymin, ymax); } void sink_f_impl::set_constellation_pen_size(int size) { - d_main_gui->SetConstellationPenSize(size); + d_main_gui->setConstellationPenSize(size); } */ @@ -208,7 +208,7 @@ namespace gr { sink_f_impl::set_update_time(double t) { d_update_time = t; - d_main_gui->SetUpdateTime(d_update_time); + d_main_gui->setUpdateTime(d_update_time); } void @@ -234,7 +234,7 @@ namespace gr { sink_f_impl::windowreset() { filter::firdes::win_type newwintype; - newwintype = (filter::firdes::win_type)d_main_gui->GetWindowType(); + newwintype = (filter::firdes::win_type)d_main_gui->getWindowType(); if(d_wintype != newwintype) { d_wintype = newwintype; buildwindow(); @@ -253,7 +253,7 @@ namespace gr { void sink_f_impl::fftresize() { - int newfftsize = d_main_gui->GetFFTSize(); + int newfftsize = d_main_gui->getFFTSize(); if(newfftsize != d_fftsize) { @@ -306,7 +306,7 @@ namespace gr { j += resid; fft(d_magbuf, d_residbuf, d_fftsize); - d_main_gui->UpdateWindow(true, d_magbuf, d_fftsize, + d_main_gui->updateWindow(true, d_magbuf, d_fftsize, (float*)d_residbuf, d_fftsize, NULL, 0, currentTime, true); } diff --git a/gr-qtgui/lib/spectrumdisplayform.cc b/gr-qtgui/lib/spectrumdisplayform.cc index 93853cead1..8d7caebda8 100644 --- a/gr-qtgui/lib/spectrumdisplayform.cc +++ b/gr-qtgui/lib/spectrumdisplayform.cc @@ -47,8 +47,8 @@ SpectrumDisplayForm::SpectrumDisplayForm(QWidget* parent) _timeDomainDisplayPlot->setLineLabel(1, "imag"); AvgLineEdit->setRange(0, 500); // Set range of Average box value from 0 to 500 - MinHoldCheckBox_toggled( false ); - MaxHoldCheckBox_toggled( false ); + minHoldCheckBox_toggled( false ); + maxHoldCheckBox_toggled( false ); WaterfallMaximumIntensitySlider->setRange(-200, 0); WaterfallMinimumIntensitySlider->setRange(-200, 0); @@ -59,32 +59,32 @@ SpectrumDisplayForm::SpectrumDisplayForm(QWidget* parent) _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); + _frequencyDisplayPlot->setLowerIntensityLevel(-200); + _frequencyDisplayPlot->setUpperIntensityLevel(-200); // Load up the acceptable FFT sizes... FFTSizeComboBox->clear(); for(long fftSize = SpectrumGUIClass::MIN_FFT_SIZE; fftSize <= SpectrumGUIClass::MAX_FFT_SIZE; fftSize *= 2){ FFTSizeComboBox->insertItem(FFTSizeComboBox->count(), QString("%1").arg(fftSize)); } - Reset(); + reset(); - ToggleTabFrequency(false); - ToggleTabWaterfall(false); - ToggleTabTime(false); - ToggleTabConstellation(false); + toggleTabFrequency(false); + toggleTabWaterfall(false); + toggleTabTime(false); + toggleTabConstellation(false); _historyEntry = 0; _historyEntryCount = 0; // Create a timer to update plots at the specified rate displayTimer = new QTimer(this); - connect(displayTimer, SIGNAL(timeout()), this, SLOT(UpdateGuiTimer())); + connect(displayTimer, SIGNAL(timeout()), this, SLOT(updateGuiTimer())); // Connect double click signals up connect(_frequencyDisplayPlot, SIGNAL(plotPointSelected(const QPointF)), @@ -121,17 +121,17 @@ SpectrumDisplayForm::~SpectrumDisplayForm() } void -SpectrumDisplayForm::setSystem( SpectrumGUIClass * newSystem, - const uint64_t numFFTDataPoints, - const uint64_t numTimeDomainDataPoints ) +SpectrumDisplayForm::setSystem(SpectrumGUIClass * newSystem, + const uint64_t numFFTDataPoints, + const uint64_t numTimeDomainDataPoints) { - ResizeBuffers(numFFTDataPoints, numTimeDomainDataPoints); + resizeBuffers(numFFTDataPoints, numTimeDomainDataPoints); - if(newSystem != NULL){ + if(newSystem != NULL) { _system = newSystem; _systemSpecifiedFlag = true; } - else{ + else { _systemSpecifiedFlag = false; } } @@ -143,7 +143,10 @@ SpectrumDisplayForm::setSystem( SpectrumGUIClass * newSystem, * Doing the "FFT shift" to put 0Hz at the center of the plot * I feel like this might want to be part of the sink block **********************************************************************/ -static void fftshift_and_sum(double *outFFT, const float *inFFT, uint64_t num_points, double &sum_mean, double &peak_ampl, int &peak_bin) { +static void fftshift_and_sum(double *outFFT, const float *inFFT, + uint64_t num_points, double &sum_mean, + double &peak_ampl, int &peak_bin) +{ const float* inptr = inFFT+num_points/2; double* outptr = outFFT; @@ -152,7 +155,7 @@ static void fftshift_and_sum(double *outFFT, const float *inFFT, uint64_t num_po peak_bin = 0; // Run this twice to perform the fftshift operation on the data here as well - for(uint64_t point = 0; point < num_points/2; point++){ + for(uint64_t point = 0; point < num_points/2; point++) { float pt = (*inptr); *outptr = pt; if(*outptr > peak_ampl) { @@ -168,7 +171,7 @@ static void fftshift_and_sum(double *outFFT, const float *inFFT, uint64_t num_po // This loop takes the first half of the input data and puts it in the // second half of the plotted data inptr = inFFT; - for(uint64_t point = 0; point < num_points/2; point++){ + for(uint64_t point = 0; point < num_points/2; point++) { float pt = (*inptr); *outptr = pt; if(*outptr > peak_ampl) { @@ -201,7 +204,7 @@ SpectrumDisplayForm::newFrequencyData( const SpectrumUpdateEvent* spectrumUpdate timeDomainDataPoints.push_back(imagTimeDomainDataPoints); // REMEMBER: The dataTimestamp is NOT valid when the repeat data flag is true... - ResizeBuffers(numFFTDataPoints, numTimeDomainDataPoints); + resizeBuffers(numFFTDataPoints, numTimeDomainDataPoints); const double fftBinSize = (_stopFrequency-_startFrequency) / static_cast<double>(numFFTDataPoints); @@ -214,7 +217,7 @@ SpectrumDisplayForm::newFrequencyData( const SpectrumUpdateEvent* spectrumUpdate // Don't update the averaging history if this is repeated data if(!repeatDataFlag){ - _AverageHistory(_realFFTDataPoints); + _averageHistory(_realFFTDataPoints); // Only use the local info if we are not repeating data _peakAmplitude = peak_ampl; @@ -244,17 +247,17 @@ SpectrumDisplayForm::newFrequencyData( const SpectrumUpdateEvent* spectrumUpdate if(lastOfMultipleUpdatesFlag){ int tabindex = SpectrumTypeTab->currentIndex(); if(tabindex == d_plot_fft) { - _frequencyDisplayPlot->PlotNewData(_averagedValues, numFFTDataPoints, + _frequencyDisplayPlot->plotNewData(_averagedValues, numFFTDataPoints, _noiseFloorAmplitude, _peakFrequency, _peakAmplitude, d_update_time); } if(tabindex == d_plot_time) { - _timeDomainDisplayPlot->PlotNewData(timeDomainDataPoints, + _timeDomainDisplayPlot->plotNewData(timeDomainDataPoints, numTimeDomainDataPoints, d_update_time); } if(tabindex == d_plot_constellation) { - _constellationDisplayPlot->PlotNewData(realTimeDomainDataPoints, + _constellationDisplayPlot->plotNewData(realTimeDomainDataPoints, imagTimeDomainDataPoints, numTimeDomainDataPoints, d_update_time); @@ -263,7 +266,7 @@ SpectrumDisplayForm::newFrequencyData( const SpectrumUpdateEvent* spectrumUpdate // Don't update the repeated data for the waterfall if(!repeatDataFlag){ if(tabindex == d_plot_waterfall) { - _waterfallDisplayPlot->PlotNewData(_realFFTDataPoints, numFFTDataPoints, + _waterfallDisplayPlot->plotNewData(_realFFTDataPoints, numFFTDataPoints, d_update_time, dataTimestamp, spectrumUpdateEvent->getDroppedFFTFrames()); } @@ -271,8 +274,8 @@ SpectrumDisplayForm::newFrequencyData( const SpectrumUpdateEvent* spectrumUpdate // Tell the system the GUI has been updated if(_systemSpecifiedFlag){ - _system->SetLastGUIUpdateTime(generatedTimestamp); - _system->DecrementPendingGUIUpdateEvents(); + _system->setLastGUIUpdateTime(generatedTimestamp); + _system->decrementPendingGUIUpdateEvents(); } } } @@ -303,40 +306,40 @@ SpectrumDisplayForm::customEvent( QEvent * e) { if(e->type() == QEvent::User+3){ if(_systemSpecifiedFlag){ - WindowComboBox->setCurrentIndex(_system->GetWindowType()); - FFTSizeComboBox->setCurrentIndex(_system->GetFFTSizeIndex()); + WindowComboBox->setCurrentIndex(_system->getWindowType()); + FFTSizeComboBox->setCurrentIndex(_system->getFFTSizeIndex()); } waterfallMinimumIntensityChangedCB(WaterfallMinimumIntensitySlider->value()); waterfallMaximumIntensityChangedCB(WaterfallMaximumIntensitySlider->value()); // Clear any previous display - Reset(); + reset(); } - else if(e->type() == SpectrumUpdateEventType){ + else if(e->type() == SpectrumUpdateEventType) { SpectrumUpdateEvent* spectrumUpdateEvent = (SpectrumUpdateEvent*)e; newFrequencyData(spectrumUpdateEvent); } - else if(e->type() == SpectrumWindowCaptionEventType){ + else if(e->type() == SpectrumWindowCaptionEventType) { setWindowTitle(((SpectrumWindowCaptionEvent*)e)->getLabel()); } - else if(e->type() == SpectrumWindowResetEventType){ - Reset(); + else if(e->type() == SpectrumWindowResetEventType) { + reset(); if(_systemSpecifiedFlag){ - _system->ResetPendingGUIUpdateEvents(); + _system->resetPendingGUIUpdateEvents(); } } - else if(e->type() == SpectrumFrequencyRangeEventType){ + else if(e->type() == SpectrumFrequencyRangeEventType) { _startFrequency = ((SpectrumFrequencyRangeEvent*)e)->GetStartFrequency(); _stopFrequency = ((SpectrumFrequencyRangeEvent*)e)->GetStopFrequency(); _centerFrequency = ((SpectrumFrequencyRangeEvent*)e)->GetCenterFrequency(); - UseRFFrequenciesCB(UseRFFrequenciesCheckBox->isChecked()); + useRFFrequenciesCB(UseRFFrequenciesCheckBox->isChecked()); } } void -SpectrumDisplayForm::UpdateGuiTimer() +SpectrumDisplayForm::updateGuiTimer() { // This is called by the displayTimer and redraws the canvases of // all of the plots. @@ -348,55 +351,55 @@ SpectrumDisplayForm::UpdateGuiTimer() void -SpectrumDisplayForm::AvgLineEdit_valueChanged( int value ) +SpectrumDisplayForm::avgLineEdit_valueChanged( int value ) { - SetAverageCount(value); + setAverageCount(value); } void -SpectrumDisplayForm::MaxHoldCheckBox_toggled( bool newState ) +SpectrumDisplayForm::maxHoldCheckBox_toggled( bool newState ) { MaxHoldResetBtn->setEnabled(newState); - _frequencyDisplayPlot->SetMaxFFTVisible(newState); - MaxHoldResetBtn_clicked(); + _frequencyDisplayPlot->setMaxFFTVisible(newState); + maxHoldResetBtn_clicked(); } void -SpectrumDisplayForm::MinHoldCheckBox_toggled( bool newState ) +SpectrumDisplayForm::minHoldCheckBox_toggled( bool newState ) { MinHoldResetBtn->setEnabled(newState); - _frequencyDisplayPlot->SetMinFFTVisible(newState); - MinHoldResetBtn_clicked(); + _frequencyDisplayPlot->setMinFFTVisible(newState); + minHoldResetBtn_clicked(); } void -SpectrumDisplayForm::MinHoldResetBtn_clicked() +SpectrumDisplayForm::minHoldResetBtn_clicked() { - _frequencyDisplayPlot->ClearMinData(); + _frequencyDisplayPlot->clearMinData(); _frequencyDisplayPlot->replot(); } void -SpectrumDisplayForm::MaxHoldResetBtn_clicked() +SpectrumDisplayForm::maxHoldResetBtn_clicked() { - _frequencyDisplayPlot->ClearMaxData(); + _frequencyDisplayPlot->clearMaxData(); _frequencyDisplayPlot->replot(); } void -SpectrumDisplayForm::TabChanged(int index) +SpectrumDisplayForm::tabChanged(int index) { // This might be dangerous to call this with NULL resizeEvent(NULL); } void -SpectrumDisplayForm::SetFrequencyRange(const double newCenterFrequency, +SpectrumDisplayForm::setFrequencyRange(const double newCenterFrequency, const double newStartFrequency, const double newStopFrequency) { @@ -420,58 +423,52 @@ SpectrumDisplayForm::SetFrequencyRange(const double newCenterFrequency, _stopFrequency = newStopFrequency; _centerFrequency = newCenterFrequency; - _frequencyDisplayPlot->SetFrequencyRange(_startFrequency, - _stopFrequency, - _centerFrequency, - UseRFFrequenciesCheckBox->isChecked(), + _frequencyDisplayPlot->setFrequencyRange(_centerFrequency, fdiff, units, strunits[iunit]); - _waterfallDisplayPlot->SetFrequencyRange(_startFrequency, - _stopFrequency, - _centerFrequency, - UseRFFrequenciesCheckBox->isChecked(), + _waterfallDisplayPlot->setFrequencyRange(_centerFrequency, fdiff, units, strunits[iunit]); - _timeDomainDisplayPlot->SetSampleRate(_stopFrequency - _startFrequency, + _timeDomainDisplayPlot->setSampleRate(_stopFrequency - _startFrequency, units, strtime[iunit]); } } int -SpectrumDisplayForm::GetAverageCount() +SpectrumDisplayForm::getAverageCount() { return _historyVector->size(); } void -SpectrumDisplayForm::SetAverageCount(const int newCount) +SpectrumDisplayForm::setAverageCount(const int newCount) { - if(newCount > -1){ - if(newCount != static_cast<int>(_historyVector->size())){ + if(newCount > -1) { + if(newCount != static_cast<int>(_historyVector->size())) { std::vector<double*>::iterator pos; - while(newCount < static_cast<int>(_historyVector->size())){ + while(newCount < static_cast<int>(_historyVector->size())) { pos = _historyVector->begin(); delete[] (*pos); _historyVector->erase(pos); } - while(newCount > static_cast<int>(_historyVector->size())){ + while(newCount > static_cast<int>(_historyVector->size())) { _historyVector->push_back(new double[_numRealDataPoints]); } - AverageDataReset(); + averageDataReset(); } } } void -SpectrumDisplayForm::_AverageHistory(const double* newBuffer) +SpectrumDisplayForm::_averageHistory(const double* newBuffer) { - if(_numRealDataPoints > 0){ - if(_historyVector->size() > 0){ + if(_numRealDataPoints > 0) { + if(_historyVector->size() > 0) { memcpy(_historyVector->operator[](_historyEntry), newBuffer, _numRealDataPoints*sizeof(double)); // Increment the next location to store data _historyEntryCount++; - if(_historyEntryCount > static_cast<int>(_historyVector->size())){ + if(_historyEntryCount > static_cast<int>(_historyVector->size())) { _historyEntryCount = _historyVector->size(); } _historyEntry += 1; @@ -479,26 +476,26 @@ SpectrumDisplayForm::_AverageHistory(const double* newBuffer) // Total up and then average the values double sum; - for(uint64_t location = 0; location < _numRealDataPoints; location++){ + for(uint64_t location = 0; location < _numRealDataPoints; location++) { sum = 0; - for(int number = 0; number < _historyEntryCount; number++){ + for(int number = 0; number < _historyEntryCount; number++) { sum += _historyVector->operator[](number)[location]; } _averagedValues[location] = sum/static_cast<double>(_historyEntryCount); } } - else{ + else { memcpy(_averagedValues, newBuffer, _numRealDataPoints*sizeof(double)); } } } void -SpectrumDisplayForm::ResizeBuffers( const uint64_t numFFTDataPoints, - const uint64_t /*numTimeDomainDataPoints*/ ) +SpectrumDisplayForm::resizeBuffers(const uint64_t numFFTDataPoints, + const uint64_t /*numTimeDomainDataPoints*/) { // Convert from Complex to Real for certain Displays - if(_numRealDataPoints != numFFTDataPoints){ + if(_numRealDataPoints != numFFTDataPoints) { _numRealDataPoints = numFFTDataPoints; delete[] _realFFTDataPoints; delete[] _averagedValues; @@ -508,40 +505,40 @@ SpectrumDisplayForm::ResizeBuffers( const uint64_t numFFTDataPoints, memset(_realFFTDataPoints, 0x0, _numRealDataPoints*sizeof(double)); const int historySize = _historyVector->size(); - SetAverageCount(0); // Clear the existing history - SetAverageCount(historySize); + setAverageCount(0); // Clear the existing history + setAverageCount(historySize); - Reset(); + reset(); } } void -SpectrumDisplayForm::Reset() +SpectrumDisplayForm::reset() { - AverageDataReset(); + averageDataReset(); - _waterfallDisplayPlot->Reset(); + _waterfallDisplayPlot->resetAxis(); } void -SpectrumDisplayForm::AverageDataReset() +SpectrumDisplayForm::averageDataReset() { _historyEntry = 0; _historyEntryCount = 0; memset(_averagedValues, 0x0, _numRealDataPoints*sizeof(double)); - MaxHoldResetBtn_clicked(); - MinHoldResetBtn_clicked(); + maxHoldResetBtn_clicked(); + minHoldResetBtn_clicked(); } void -SpectrumDisplayForm::closeEvent( QCloseEvent *e ) +SpectrumDisplayForm::closeEvent(QCloseEvent *e) { if(_systemSpecifiedFlag){ - _system->SetWindowOpenFlag(false); + _system->setWindowOpenFlag(false); } qApp->processEvents(); @@ -551,32 +548,32 @@ SpectrumDisplayForm::closeEvent( QCloseEvent *e ) void -SpectrumDisplayForm::WindowTypeChanged( int newItem ) +SpectrumDisplayForm::windowTypeChanged(int newItem) { - if(_systemSpecifiedFlag){ - _system->SetWindowType(newItem); + if(_systemSpecifiedFlag) { + _system->setWindowType(newItem); } } void -SpectrumDisplayForm::UseRFFrequenciesCB( bool useRFFlag ) +SpectrumDisplayForm::useRFFrequenciesCB(bool useRFFlag) { - SetFrequencyRange(_centerFrequency, _startFrequency, _stopFrequency); + setFrequencyRange(_centerFrequency, _startFrequency, _stopFrequency); } void -SpectrumDisplayForm::waterfallMaximumIntensityChangedCB( double newValue ) +SpectrumDisplayForm::waterfallMaximumIntensityChangedCB(double newValue) { - if(newValue > WaterfallMinimumIntensitySlider->value()){ + if(newValue > WaterfallMinimumIntensitySlider->value()) { WaterfallMaximumIntensityLabel->setText(QString("%1 dB").arg(newValue, 0, 'f', 0)); } else{ WaterfallMinimumIntensitySlider->setValue(newValue - 2); } - _waterfallDisplayPlot->SetIntensityRange(WaterfallMinimumIntensitySlider->value(), + _waterfallDisplayPlot->setIntensityRange(WaterfallMinimumIntensitySlider->value(), WaterfallMaximumIntensitySlider->value()); } @@ -591,21 +588,21 @@ SpectrumDisplayForm::waterfallMinimumIntensityChangedCB( double newValue ) WaterfallMaximumIntensitySlider->setValue(newValue + 2); } - _waterfallDisplayPlot->SetIntensityRange(WaterfallMinimumIntensitySlider->value(), + _waterfallDisplayPlot->setIntensityRange(WaterfallMinimumIntensitySlider->value(), WaterfallMaximumIntensitySlider->value()); } void -SpectrumDisplayForm::FFTComboBoxSelectedCB( const QString &fftSizeString ) +SpectrumDisplayForm::fftComboBoxSelectedCB(const QString &fftSizeString) { if(_systemSpecifiedFlag){ - _system->SetFFTSize(fftSizeString.toLong()); + _system->setFFTSize(fftSizeString.toLong()); } } void -SpectrumDisplayForm::WaterfallAutoScaleBtnCB() +SpectrumDisplayForm::waterfallAutoScaleBtnCB() { double minimumIntensity = _noiseFloorAmplitude - 5; if(minimumIntensity < WaterfallMinimumIntensitySlider->minValue()){ @@ -621,13 +618,13 @@ SpectrumDisplayForm::WaterfallAutoScaleBtnCB() } void -SpectrumDisplayForm::WaterfallIntensityColorTypeChanged( int newType ) +SpectrumDisplayForm::waterfallIntensityColorTypeChanged( int newType ) { QColor lowIntensityColor; QColor highIntensityColor; if(newType == INTENSITY_COLOR_MAP_TYPE_USER_DEFINED){ // Select the Low Intensity Color - lowIntensityColor = _waterfallDisplayPlot->GetUserDefinedLowIntensityColor(); + lowIntensityColor = _waterfallDisplayPlot->getUserDefinedLowIntensityColor(); if(!lowIntensityColor.isValid()){ lowIntensityColor = Qt::black; } @@ -635,7 +632,7 @@ SpectrumDisplayForm::WaterfallIntensityColorTypeChanged( int newType ) lowIntensityColor = QColorDialog::getColor(lowIntensityColor, this); // Select the High Intensity Color - highIntensityColor = _waterfallDisplayPlot->GetUserDefinedHighIntensityColor(); + highIntensityColor = _waterfallDisplayPlot->getUserDefinedHighIntensityColor(); if(!highIntensityColor.isValid()){ highIntensityColor = Qt::white; } @@ -643,11 +640,11 @@ SpectrumDisplayForm::WaterfallIntensityColorTypeChanged( int newType ) highIntensityColor = QColorDialog::getColor(highIntensityColor, this); } - _waterfallDisplayPlot->SetIntensityColorMapType(0, newType, lowIntensityColor, highIntensityColor); + _waterfallDisplayPlot->setIntensityColorMapType(0, newType, lowIntensityColor, highIntensityColor); } void -SpectrumDisplayForm::ToggleTabFrequency(const bool state) +SpectrumDisplayForm::toggleTabFrequency(const bool state) { if(state == true) { if(d_plot_fft == -1) { @@ -662,7 +659,7 @@ SpectrumDisplayForm::ToggleTabFrequency(const bool state) } void -SpectrumDisplayForm::ToggleTabWaterfall(const bool state) +SpectrumDisplayForm::toggleTabWaterfall(const bool state) { if(state == true) { if(d_plot_waterfall == -1) { @@ -677,7 +674,7 @@ SpectrumDisplayForm::ToggleTabWaterfall(const bool state) } void -SpectrumDisplayForm::ToggleTabTime(const bool state) +SpectrumDisplayForm::toggleTabTime(const bool state) { if(state == true) { if(d_plot_time == -1) { @@ -692,7 +689,7 @@ SpectrumDisplayForm::ToggleTabTime(const bool state) } void -SpectrumDisplayForm::ToggleTabConstellation(const bool state) +SpectrumDisplayForm::toggleTabConstellation(const bool state) { if(state == true) { if(d_plot_constellation == -1) { @@ -708,32 +705,32 @@ SpectrumDisplayForm::ToggleTabConstellation(const bool state) void -SpectrumDisplayForm::SetTimeDomainAxis(double min, double max) +SpectrumDisplayForm::setTimeDomainAxis(double min, double max) { _timeDomainDisplayPlot->setYaxis(min, max); } void -SpectrumDisplayForm::SetConstellationAxis(double xmin, double xmax, +SpectrumDisplayForm::setConstellationAxis(double xmin, double xmax, double ymin, double ymax) { _constellationDisplayPlot->set_axis(xmin, xmax, ymin, ymax); } void -SpectrumDisplayForm::SetConstellationPenSize(int size) +SpectrumDisplayForm::setConstellationPenSize(int size) { _constellationDisplayPlot->set_pen_size( size ); } void -SpectrumDisplayForm::SetFrequencyAxis(double min, double max) +SpectrumDisplayForm::setFrequencyAxis(double min, double max) { _frequencyDisplayPlot->setYaxis(min, max); } void -SpectrumDisplayForm::SetUpdateTime(double t) +SpectrumDisplayForm::setUpdateTime(double t) { d_update_time = t; // QTimer class takes millisecond input diff --git a/gr-qtgui/lib/spectrumdisplayform.h b/gr-qtgui/lib/spectrumdisplayform.h index 63dd304d52..cac2a5617d 100644 --- a/gr-qtgui/lib/spectrumdisplayform.h +++ b/gr-qtgui/lib/spectrumdisplayform.h @@ -45,53 +45,53 @@ class SpectrumDisplayForm : public QWidget, public Ui::SpectrumDisplayForm SpectrumDisplayForm(QWidget* parent = 0); ~SpectrumDisplayForm(); - void setSystem( SpectrumGUIClass * newSystem, const uint64_t numFFTDataPoints, - const uint64_t numTimeDomainDataPoints ); + void setSystem(SpectrumGUIClass * newSystem, const uint64_t numFFTDataPoints, + const uint64_t numTimeDomainDataPoints); - int GetAverageCount(); - void SetAverageCount( const int newCount ); - void Reset(); - void AverageDataReset(); - void ResizeBuffers( const uint64_t numFFTDataPoints, - const uint64_t numTimeDomainDataPoints ); + int getAverageCount(); + void setAverageCount(const int newCount); + void reset(); + void averageDataReset(); + void resizeBuffers(const uint64_t numFFTDataPoints, + const uint64_t numTimeDomainDataPoints); public slots: - void resizeEvent( QResizeEvent * e ); - void customEvent( QEvent * e ); - void AvgLineEdit_valueChanged( int valueString ); - void MaxHoldCheckBox_toggled( bool newState ); - void MinHoldCheckBox_toggled( bool newState ); - void MinHoldResetBtn_clicked(); - void MaxHoldResetBtn_clicked(); - void TabChanged(int index); - - void SetFrequencyRange( const double newCenterFrequency, - const double newStartFrequency, - const double newStopFrequency ); - void closeEvent( QCloseEvent * e ); - void WindowTypeChanged( int newItem ); - void UseRFFrequenciesCB( bool useRFFlag ); + void resizeEvent(QResizeEvent * e); + void customEvent(QEvent * e); + void avgLineEdit_valueChanged(int valueString); + void maxHoldCheckBox_toggled(bool newState); + void minHoldCheckBox_toggled(bool newState); + void minHoldResetBtn_clicked(); + void maxHoldResetBtn_clicked(); + void tabChanged(int index); + + void setFrequencyRange(const double newCenterFrequency, + const double newStartFrequency, + const double newStopFrequency); + void closeEvent(QCloseEvent * e); + void windowTypeChanged(int newItem); + void useRFFrequenciesCB(bool useRFFlag); void waterfallMaximumIntensityChangedCB(double); void waterfallMinimumIntensityChangedCB(double); - void WaterfallIntensityColorTypeChanged(int); - void WaterfallAutoScaleBtnCB(); - void FFTComboBoxSelectedCB(const QString&); + void waterfallIntensityColorTypeChanged(int); + void waterfallAutoScaleBtnCB(); + void fftComboBoxSelectedCB(const QString&); - void ToggleTabFrequency(const bool state); - void ToggleTabWaterfall(const bool state); - void ToggleTabTime(const bool state); - void ToggleTabConstellation(const bool state); + void toggleTabFrequency(const bool state); + void toggleTabWaterfall(const bool state); + void toggleTabTime(const bool state); + void toggleTabConstellation(const bool state); - void SetTimeDomainAxis(double min, double max); - void SetConstellationAxis(double xmin, double xmax, + void setTimeDomainAxis(double min, double max); + void setConstellationAxis(double xmin, double xmax, double ymin, double ymax); - void SetConstellationPenSize(int size); - void SetFrequencyAxis(double min, double max); - void SetUpdateTime(double t); + void setConstellationPenSize(int size); + void setFrequencyAxis(double min, double max); + void setUpdateTime(double t); private slots: - void newFrequencyData( const SpectrumUpdateEvent* ); - void UpdateGuiTimer(); + void newFrequencyData(const SpectrumUpdateEvent*); + void updateGuiTimer(); void onFFTPlotPointSelected(const QPointF p); void onWFallPlotPointSelected(const QPointF p); @@ -102,7 +102,7 @@ signals: void plotPointSelected(const QPointF p, int type); private: - void _AverageHistory( const double * newBuffer ); + void _averageHistory(const double * newBuffer); int _historyEntryCount; int _historyEntry; diff --git a/gr-qtgui/lib/spectrumdisplayform.ui b/gr-qtgui/lib/spectrumdisplayform.ui index 9b06f44f0d..f1e1f08f98 100644 --- a/gr-qtgui/lib/spectrumdisplayform.ui +++ b/gr-qtgui/lib/spectrumdisplayform.ui @@ -536,7 +536,7 @@ <sender>MaxHoldCheckBox</sender> <signal>toggled(bool)</signal> <receiver>SpectrumDisplayForm</receiver> - <slot>MaxHoldCheckBox_toggled(bool)</slot> + <slot>maxHoldCheckBox_toggled(bool)</slot> <hints> <hint type="sourcelabel"> <x>22</x> @@ -552,7 +552,7 @@ <sender>MaxHoldResetBtn</sender> <signal>clicked()</signal> <receiver>SpectrumDisplayForm</receiver> - <slot>MaxHoldResetBtn_clicked()</slot> + <slot>maxHoldResetBtn_clicked()</slot> <hints> <hint type="sourcelabel"> <x>107</x> @@ -568,7 +568,7 @@ <sender>MinHoldCheckBox</sender> <signal>toggled(bool)</signal> <receiver>SpectrumDisplayForm</receiver> - <slot>MinHoldCheckBox_toggled(bool)</slot> + <slot>minHoldCheckBox_toggled(bool)</slot> <hints> <hint type="sourcelabel"> <x>22</x> @@ -584,7 +584,7 @@ <sender>MinHoldResetBtn</sender> <signal>clicked()</signal> <receiver>SpectrumDisplayForm</receiver> - <slot>MinHoldResetBtn_clicked()</slot> + <slot>minHoldResetBtn_clicked()</slot> <hints> <hint type="sourcelabel"> <x>107</x> @@ -600,7 +600,7 @@ <sender>WindowComboBox</sender> <signal>activated(int)</signal> <receiver>SpectrumDisplayForm</receiver> - <slot>WindowTypeChanged(int)</slot> + <slot>windowTypeChanged(int)</slot> <hints> <hint type="sourcelabel"> <x>20</x> @@ -616,7 +616,7 @@ <sender>UseRFFrequenciesCheckBox</sender> <signal>toggled(bool)</signal> <receiver>SpectrumDisplayForm</receiver> - <slot>UseRFFrequenciesCB(bool)</slot> + <slot>useRFFrequenciesCB(bool)</slot> <hints> <hint type="sourcelabel"> <x>20</x> @@ -664,7 +664,7 @@ <sender>FFTSizeComboBox</sender> <signal>activated(QString)</signal> <receiver>SpectrumDisplayForm</receiver> - <slot>FFTComboBoxSelectedCB(QString)</slot> + <slot>fftComboBoxSelectedCB(QString)</slot> <hints> <hint type="sourcelabel"> <x>20</x> @@ -680,7 +680,7 @@ <sender>WaterfallAutoScaleBtn</sender> <signal>clicked()</signal> <receiver>SpectrumDisplayForm</receiver> - <slot>WaterfallAutoScaleBtnCB()</slot> + <slot>waterfallAutoScaleBtnCB()</slot> <hints> <hint type="sourcelabel"> <x>22</x> @@ -696,7 +696,7 @@ <sender>WaterfallIntensityComboBox</sender> <signal>activated(int)</signal> <receiver>SpectrumDisplayForm</receiver> - <slot>WaterfallIntensityColorTypeChanged(int)</slot> + <slot>waterfallIntensityColorTypeChanged(int)</slot> <hints> <hint type="sourcelabel"> <x>92</x> @@ -712,7 +712,7 @@ <sender>SpectrumTypeTab</sender> <signal>currentChanged(int)</signal> <receiver>SpectrumDisplayForm</receiver> - <slot>TabChanged(int)</slot> + <slot>tabChanged(int)</slot> <hints> <hint type="sourcelabel"> <x>314</x> @@ -728,7 +728,7 @@ <sender>AvgLineEdit</sender> <signal>valueChanged(int)</signal> <receiver>SpectrumDisplayForm</receiver> - <slot>AvgLineEdit_valueChanged(int)</slot> + <slot>avgLineEdit_valueChanged(int)</slot> <hints> <hint type="sourcelabel"> <x>604</x> diff --git a/gr-qtgui/lib/timedisplayform.cc b/gr-qtgui/lib/timedisplayform.cc index e3c7f8a60b..11ceefff3e 100644 --- a/gr-qtgui/lib/timedisplayform.cc +++ b/gr-qtgui/lib/timedisplayform.cc @@ -68,7 +68,7 @@ TimeDisplayForm::newData(const QEvent* updateEvent) const std::vector<double*> dataPoints = tevent->getTimeDomainPoints(); const uint64_t numDataPoints = tevent->getNumTimeDomainDataPoints(); - getPlot()->PlotNewData(dataPoints, + getPlot()->plotNewData(dataPoints, numDataPoints, d_update_time); } @@ -91,7 +91,7 @@ TimeDisplayForm::setSampleRate(const double samprate) double units = pow(10, (units10-fmod(units10, 3.0))); int iunit = static_cast<int>(units3); - getPlot()->SetSampleRate(samprate, units, strtime[iunit]); + getPlot()->setSampleRate(samprate, units, strtime[iunit]); } else { throw std::runtime_error("TimeDisplayForm: samprate must be > 0.\n"); diff --git a/gr-qtgui/lib/waterfallGlobalData.cc b/gr-qtgui/lib/waterfallGlobalData.cc index f64ed14f18..d0ae8bca4d 100644 --- a/gr-qtgui/lib/waterfallGlobalData.cc +++ b/gr-qtgui/lib/waterfallGlobalData.cc @@ -29,7 +29,7 @@ WaterfallData::WaterfallData(const double minimumFrequency, setInterval(Qt::ZAxis, QwtInterval(-200, 0.0)); #endif - Reset(); + reset(); } WaterfallData::~WaterfallData() @@ -37,34 +37,34 @@ 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 QWT_VERSION < 0x060000 - if((_fftPoints != rhs->GetNumFFTPoints()) || + if((_fftPoints != rhs->getNumFFTPoints()) || (boundingRect() != rhs->boundingRect()) ){ - _fftPoints = rhs->GetNumFFTPoints(); + _fftPoints = rhs->getNumFFTPoints(); setBoundingRect(rhs->boundingRect()); delete[] _spectrumData; _spectrumData = new double[_fftPoints * _historyLength]; } #else - if(_fftPoints != rhs->GetNumFFTPoints()) { - _fftPoints = rhs->GetNumFFTPoints(); + if(_fftPoints != rhs->getNumFFTPoints()) { + _fftPoints = rhs->getNumFFTPoints(); delete[] _spectrumData; _spectrumData = new double[_fftPoints * _historyLength]; } #endif - Reset(); - SetSpectrumDataBuffer(rhs->GetSpectrumDataBuffer()); - SetNumLinesToUpdate(rhs->GetNumLinesToUpdate()); + reset(); + setSpectrumDataBuffer(rhs->getSpectrumDataBuffer()); + setNumLinesToUpdate(rhs->getNumLinesToUpdate()); #if QWT_VERSION < 0x060000 setRange(rhs->range()); @@ -75,12 +75,12 @@ void WaterfallData::Copy(const WaterfallData* rhs) #endif } -void WaterfallData::ResizeData(const double startFreq, +void WaterfallData::resizeData(const double startFreq, const double stopFreq, const uint64_t fftPoints) { #if QWT_VERSION < 0x060000 - if((fftPoints != GetNumFFTPoints()) || + if((fftPoints != getNumFFTPoints()) || (boundingRect().width() != (stopFreq - startFreq)) || (boundingRect().left() != startFreq)){ @@ -93,7 +93,7 @@ void WaterfallData::ResizeData(const double startFreq, } #else - if((fftPoints != GetNumFFTPoints()) || + if((fftPoints != getNumFFTPoints()) || (interval(Qt::XAxis).width() != (stopFreq - startFreq)) || (interval(Qt::XAxis).minValue() != startFreq)){ @@ -105,7 +105,7 @@ void WaterfallData::ResizeData(const double startFreq, } #endif - Reset(); + reset(); } QwtRasterData *WaterfallData::copy() const @@ -120,7 +120,7 @@ QwtRasterData *WaterfallData::copy() const _fftPoints, _historyLength); #endif - returnData->Copy(this); + returnData->copy(this); return returnData; } @@ -166,7 +166,7 @@ double WaterfallData::value(double x, double y) const return returnValue; } -uint64_t WaterfallData::GetNumFFTPoints() const +uint64_t WaterfallData::getNumFFTPoints() const { return _fftPoints; } @@ -202,27 +202,27 @@ void WaterfallData::addFFTData(const double* fftData, } } -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() +void WaterfallData::incrementNumLinesToUpdate() { _numLinesToUpdate++; } diff --git a/gr-qtgui/lib/waterfallGlobalData.h b/gr-qtgui/lib/waterfallGlobalData.h index 928c3b1759..2b935fc0fb 100644 --- a/gr-qtgui/lib/waterfallGlobalData.h +++ b/gr-qtgui/lib/waterfallGlobalData.h @@ -15,10 +15,10 @@ public: WaterfallData(const double, const double, const uint64_t, const unsigned int); virtual ~WaterfallData(); - virtual void Reset(); - virtual void Copy(const WaterfallData*); + virtual void reset(); + virtual void copy(const WaterfallData*); - virtual void ResizeData(const double, const double, const uint64_t); + virtual void resizeData(const double, const double, const uint64_t); virtual QwtRasterData *copy() const; @@ -29,15 +29,15 @@ public: virtual double value(double x, double y) const; - virtual uint64_t GetNumFFTPoints()const; + virtual uint64_t getNumFFTPoints()const; virtual void addFFTData(const double*, const uint64_t, const int); - virtual double* GetSpectrumDataBuffer()const; - virtual void SetSpectrumDataBuffer(const double*); + virtual double* getSpectrumDataBuffer()const; + virtual void setSpectrumDataBuffer(const double*); - virtual int GetNumLinesToUpdate()const; - virtual void SetNumLinesToUpdate(const int); - virtual void IncrementNumLinesToUpdate(); + virtual int getNumLinesToUpdate()const; + virtual void setNumLinesToUpdate(const int); + virtual void incrementNumLinesToUpdate(); protected: diff --git a/gr-qtgui/lib/waterfall_sink_c_impl.cc b/gr-qtgui/lib/waterfall_sink_c_impl.cc index c8d4c02e8c..99a9d89dc9 100644 --- a/gr-qtgui/lib/waterfall_sink_c_impl.cc +++ b/gr-qtgui/lib/waterfall_sink_c_impl.cc @@ -117,11 +117,9 @@ namespace gr { } d_main_gui = new WaterfallDisplayForm(d_nconnections, d_parent); - d_main_gui->SetFFTSize(d_fftsize); - d_main_gui->SetFFTWindowType(d_wintype); - d_main_gui->SetFrequencyRange(d_center_freq, - d_center_freq - d_bandwidth/2.0, - d_center_freq + d_bandwidth/2.0); + d_main_gui->setFFTWindowType(d_wintype); + set_fft_size(d_fftsize); + set_frequency_range(d_center_freq, d_bandwidth); // initialize update time to 10 times a second set_update_time(0.1); @@ -152,7 +150,7 @@ namespace gr { waterfall_sink_c_impl::set_fft_size(const int fftsize) { d_fftsize = fftsize; - d_main_gui->SetFFTSize(fftsize); + d_main_gui->setFFTSize(fftsize); } int @@ -165,7 +163,7 @@ namespace gr { waterfall_sink_c_impl::set_fft_average(const float fftavg) { d_fftavg = fftavg; - d_main_gui->SetFFTAverage(fftavg); + d_main_gui->setFFTAverage(fftavg); } float @@ -180,9 +178,7 @@ namespace gr { { d_center_freq = centerfreq; d_bandwidth = bandwidth; - d_main_gui->SetFrequencyRange(d_center_freq, - -d_bandwidth/2.0, - d_bandwidth/2.0); + d_main_gui->setFrequencyRange(d_center_freq, d_bandwidth); } void @@ -264,7 +260,7 @@ namespace gr { waterfall_sink_c_impl::windowreset() { filter::firdes::win_type newwintype; - newwintype = d_main_gui->GetFFTWindowType(); + newwintype = d_main_gui->getFFTWindowType(); if(d_wintype != newwintype) { d_wintype = newwintype; buildwindow(); @@ -283,8 +279,8 @@ namespace gr { void waterfall_sink_c_impl::fftresize() { - int newfftsize = d_main_gui->GetFFTSize(); - d_fftavg = d_main_gui->GetFFTAverage(); + int newfftsize = d_main_gui->getFFTSize(); + d_fftavg = d_main_gui->getFFTAverage(); if(newfftsize != d_fftsize) { diff --git a/gr-qtgui/lib/waterfall_sink_f_impl.cc b/gr-qtgui/lib/waterfall_sink_f_impl.cc index c613c8c6a7..6d4888f5e7 100644 --- a/gr-qtgui/lib/waterfall_sink_f_impl.cc +++ b/gr-qtgui/lib/waterfall_sink_f_impl.cc @@ -117,11 +117,9 @@ namespace gr { } d_main_gui = new WaterfallDisplayForm(d_nconnections, d_parent); - d_main_gui->SetFFTSize(d_fftsize); - d_main_gui->SetFFTWindowType(d_wintype); - d_main_gui->SetFrequencyRange(d_center_freq, - d_center_freq - d_bandwidth/2.0, - d_center_freq + d_bandwidth/2.0); + d_main_gui->setFFTWindowType(d_wintype); + set_fft_size(d_fftsize); + set_frequency_range(d_center_freq, d_bandwidth); // initialize update time to 10 times a second set_update_time(0.1); @@ -152,7 +150,7 @@ namespace gr { waterfall_sink_f_impl::set_fft_size(const int fftsize) { d_fftsize = fftsize; - d_main_gui->SetFFTSize(fftsize); + d_main_gui->setFFTSize(fftsize); } int @@ -165,7 +163,7 @@ namespace gr { waterfall_sink_f_impl::set_fft_average(const float fftavg) { d_fftavg = fftavg; - d_main_gui->SetFFTAverage(fftavg); + d_main_gui->setFFTAverage(fftavg); } float @@ -180,9 +178,7 @@ namespace gr { { d_center_freq = centerfreq; d_bandwidth = bandwidth; - d_main_gui->SetFrequencyRange(d_center_freq, - -d_bandwidth/2.0, - d_bandwidth/2.0); + d_main_gui->setFrequencyRange(d_center_freq, d_bandwidth); } void @@ -267,7 +263,7 @@ namespace gr { waterfall_sink_f_impl::windowreset() { filter::firdes::win_type newwintype; - newwintype = d_main_gui->GetFFTWindowType(); + newwintype = d_main_gui->getFFTWindowType(); if(d_wintype != newwintype) { d_wintype = newwintype; buildwindow(); diff --git a/gr-qtgui/lib/waterfalldisplayform.cc b/gr-qtgui/lib/waterfalldisplayform.cc index 1a69e97d10..e8e78ea3de 100644 --- a/gr-qtgui/lib/waterfalldisplayform.cc +++ b/gr-qtgui/lib/waterfalldisplayform.cc @@ -46,7 +46,7 @@ WaterfallDisplayForm::WaterfallDisplayForm(int nplots, QWidget* parent) QAction *autoscale_act = new QAction("Auto Scale", this); autoscale_act->setStatusTip(tr("Autoscale intensity range")); - connect(autoscale_act, SIGNAL(triggered()), this, SLOT(AutoScale())); + connect(autoscale_act, SIGNAL(triggered()), this, SLOT(autoScale())); FFTSizeMenu *sizemenu = new FFTSizeMenu(this); FFTAverageMenu *avgmenu = new FFTAverageMenu(this); @@ -58,13 +58,13 @@ WaterfallDisplayForm::WaterfallDisplayForm(int nplots, QWidget* parent) _menu->addMenu(colormenu); _menu->addAction(autoscale_act); connect(sizemenu, SIGNAL(whichTrigger(int)), - this, SLOT(SetFFTSize(const int))); + this, SLOT(setFFTSize(const int))); connect(avgmenu, SIGNAL(whichTrigger(float)), - this, SLOT(SetFFTAverage(const float))); + this, SLOT(setFFTAverage(const float))); connect(winmenu, SIGNAL(whichTrigger(gr::filter::firdes::win_type)), - this, SLOT(SetFFTWindowType(const gr::filter::firdes::win_type))); + this, SLOT(setFFTWindowType(const gr::filter::firdes::win_type))); connect(colormenu, SIGNAL(whichTrigger(const int, const QColor&, const QColor&)), - this, SLOT(SetColorMap(const int, const QColor&, const QColor&))); + this, SLOT(setColorMap(const int, const QColor&, const QColor&))); Reset(); @@ -105,7 +105,7 @@ WaterfallDisplayForm::newData(const QEvent *updateEvent) _max_val = *max_val; } - getPlot()->PlotNewData(dataPoints, numDataPoints, + getPlot()->plotNewData(dataPoints, numDataPoints, d_update_time, dataTimestamp, 0); } @@ -118,88 +118,76 @@ WaterfallDisplayForm::customEvent( QEvent * e) } int -WaterfallDisplayForm::GetFFTSize() const +WaterfallDisplayForm::getFFTSize() const { return _fftsize; } float -WaterfallDisplayForm::GetFFTAverage() const +WaterfallDisplayForm::getFFTAverage() const { return _fftavg; } gr::filter::firdes::win_type -WaterfallDisplayForm::GetFFTWindowType() const +WaterfallDisplayForm::getFFTWindowType() const { return _fftwintype; } void -WaterfallDisplayForm::SetFFTSize(const int newsize) +WaterfallDisplayForm::setFFTSize(const int newsize) { _fftsize = newsize; } void -WaterfallDisplayForm::SetFFTAverage(const float newavg) +WaterfallDisplayForm::setFFTAverage(const float newavg) { _fftavg = newavg; } void -WaterfallDisplayForm::SetFFTWindowType(const gr::filter::firdes::win_type newwin) +WaterfallDisplayForm::setFFTWindowType(const gr::filter::firdes::win_type newwin) { _fftwintype = newwin; } void -WaterfallDisplayForm::SetFrequencyRange(const double newCenterFrequency, - const double newStartFrequency, - const double newStopFrequency) +WaterfallDisplayForm::setFrequencyRange(const double centerfreq, + const double bandwidth) { - double fdiff = std::max(fabs(newStartFrequency), fabs(newStopFrequency)); - - if(fdiff > 0) { - std::string strunits[4] = {"Hz", "kHz", "MHz", "GHz"}; - double units10 = floor(log10(fdiff)); - double units3 = std::max(floor(units10 / 3.0), 0.0); - double units = pow(10, (units10-fmod(units10, 3.0))); - int iunit = static_cast<int>(units3); - - _startFrequency = newStartFrequency; - _stopFrequency = newStopFrequency; - double centerFrequency = newCenterFrequency; - - getPlot()->SetFrequencyRange(_startFrequency, - _stopFrequency, - centerFrequency, - true, - units, strunits[iunit]); - } + std::string strunits[4] = {"Hz", "kHz", "MHz", "GHz"}; + double units10 = floor(log10(bandwidth)); + double units3 = std::max(floor(units10 / 3.0), 0.0); + double units = pow(10, (units10-fmod(units10, 3.0))); + int iunit = static_cast<int>(units3); + + getPlot()->setFrequencyRange(centerfreq, bandwidth, + units, strunits[iunit]); } void -WaterfallDisplayForm::SetColorMap(const int newType, +WaterfallDisplayForm::setColorMap(const int newType, const QColor lowColor, const QColor highColor) { - getPlot()->SetIntensityColorMapType(0, newType, + getPlot()->setIntensityColorMapType(0, newType, lowColor, highColor); } void -WaterfallDisplayForm::SetIntensityRange(const double minIntensity, +WaterfallDisplayForm::setIntensityRange(const double minIntensity, const double maxIntensity) { - getPlot()->SetIntensityRange(minIntensity, maxIntensity); + getPlot()->setIntensityRange(minIntensity, maxIntensity); } void -WaterfallDisplayForm::AutoScale() +WaterfallDisplayForm::autoScale() { double min_int = _min_val - 5; double max_int = _max_val + 10; - getPlot()->SetIntensityRange(min_int, max_int); + getPlot()->setIntensityRange(min_int, max_int); } diff --git a/gr-qtgui/lib/waterfalldisplayform.h b/gr-qtgui/lib/waterfalldisplayform.h index 46e0d815e0..e078aeb05a 100644 --- a/gr-qtgui/lib/waterfalldisplayform.h +++ b/gr-qtgui/lib/waterfalldisplayform.h @@ -41,29 +41,28 @@ class WaterfallDisplayForm : public DisplayForm WaterfallDisplayPlot* getPlot(); - int GetFFTSize() const; - float GetFFTAverage() const; - gr::filter::firdes::win_type GetFFTWindowType() const; + int getFFTSize() const; + float getFFTAverage() const; + gr::filter::firdes::win_type getFFTWindowType() const; public slots: void customEvent(QEvent *e); - void SetFFTSize(const int); - void SetFFTAverage(const float); - void SetFFTWindowType(const gr::filter::firdes::win_type); + void setFFTSize(const int); + void setFFTAverage(const float); + void setFFTWindowType(const gr::filter::firdes::win_type); - void SetFrequencyRange(const double newCenterFrequency, - const double newStartFrequency, - const double newStopFrequency); + void setFrequencyRange(const double centerfreq, + const double bandwidth); - void SetIntensityRange(const double minIntensity, + void setIntensityRange(const double minIntensity, const double maxIntensity); - void SetColorMap(const int newType, + void setColorMap(const int newType, const QColor lowColor, const QColor highColor); - void AutoScale(); + void autoScale(); private slots: void newData(const QEvent *updateEvent); @@ -72,9 +71,6 @@ private: uint64_t _numRealDataPoints; QIntValidator* _intValidator; - double _startFrequency; - double _stopFrequency; - int _fftsize; float _fftavg; gr::filter::firdes::win_type _fftwintype; |