summaryrefslogtreecommitdiff
path: root/gr-qtgui/src
diff options
context:
space:
mode:
Diffstat (limited to 'gr-qtgui/src')
-rw-r--r--gr-qtgui/src/lib/WaterfallDisplayPlot.cc56
-rw-r--r--gr-qtgui/src/lib/WaterfallDisplayPlot.h2
2 files changed, 40 insertions, 18 deletions
diff --git a/gr-qtgui/src/lib/WaterfallDisplayPlot.cc b/gr-qtgui/src/lib/WaterfallDisplayPlot.cc
index f6d0cc0ba..b23612524 100644
--- a/gr-qtgui/src/lib/WaterfallDisplayPlot.cc
+++ b/gr-qtgui/src/lib/WaterfallDisplayPlot.cc
@@ -66,8 +66,7 @@ public:
QwtText label(double value) const
{
- return QString("%1").arg((value + GetCenterFrequency()) / ((GetFrequencyPrecision() == 0) ? 1.0 : 1000.0),
- 0, 'f', GetFrequencyPrecision());
+ return QString("%1").arg(value, 0, 'f', GetFrequencyPrecision());
}
virtual void initiateUpdate()
@@ -180,6 +179,11 @@ public:
updateDisplay();
}
+ void SetUnitType(const std::string &type)
+ {
+ _unitType = type;
+ }
+
protected:
virtual QwtText trackerText( const QwtDoublePoint& p ) const
{
@@ -193,10 +197,14 @@ protected:
timeTm.tm_mday, timeTm.tm_hour, timeTm.tm_min,
timeTm.tm_sec, lineTime.tv_nsec/1000000));
- QwtText t(QString("%1 %2, %3").arg((p.x() + GetCenterFrequency()) / ((GetFrequencyPrecision() == 0) ? 1.0 : 1000.0), 0, 'f', GetFrequencyPrecision()).arg( (GetFrequencyPrecision() == 0) ? "Hz" : "kHz").arg(yLabel));
+ QwtText t(QString("%1 %2, %3").arg(p.x(), 0, 'f',
+ GetFrequencyPrecision()).arg(_unitType.c_str()).arg(yLabel));
return t;
}
+
+private:
+ std::string _unitType;
};
@@ -310,27 +318,39 @@ WaterfallDisplayPlot::SetFrequencyRange(const double constStartFreq,
double stopFreq = constStopFreq / units;
double centerFreq = constCenterFreq / units;
- if(stopFreq > startFreq) {
- _startFrequency = 1000*startFreq;
- _stopFrequency = 1000*stopFreq;
+ _useCenterFrequencyFlag = useCenterFrequencyFlag;
+
+ if(_useCenterFrequencyFlag){
+ startFreq = (startFreq + centerFreq);
+ stopFreq = (stopFreq + centerFreq);
+ }
+
+ bool reset = false;
+ if((startFreq != _startFrequency) || (stopFreq != _stopFrequency))
+ reset = true;
- setAxisScale(QwtPlot::xBottom, _startFrequency, _stopFrequency);
+ if(stopFreq > startFreq) {
+ _startFrequency = startFreq;
+ _stopFrequency = stopFreq;
+
if((axisScaleDraw(QwtPlot::xBottom) != NULL) && (_zoomer != NULL)){
- WaterfallFreqDisplayScaleDraw* freqScale = ((WaterfallFreqDisplayScaleDraw*)axisScaleDraw(QwtPlot::xBottom));
- freqScale->SetCenterFrequency(centerFreq);
- ((WaterfallZoomer*)_zoomer)->SetCenterFrequency(centerFreq);
+ double display_units = ceil(log10(units)/2.0);
+ setAxisScale(QwtPlot::xBottom, _startFrequency, _stopFrequency);
+ setAxisScaleDraw(QwtPlot::xBottom, new WaterfallFreqDisplayScaleDraw(display_units));
- freqScale->SetFrequencyPrecision( 2 );
- ((WaterfallZoomer*)_zoomer)->SetFrequencyPrecision( 2 );
- setAxisTitle(QwtPlot::xBottom, QString("Frequency (%1)").arg(strunits.c_str()));
- }
+ if(reset) {
+ Reset();
+ }
- Reset();
+ ((WaterfallZoomer*)_zoomer)->SetFrequencyPrecision(display_units);
+ ((WaterfallZoomer*)_zoomer)->SetUnitType(strunits);
- // Only replot if screen is visible
- if(isVisible()){
- replot();
+ // Load up the new base zoom settings
+ _zoomer->setZoomBase();
+
+ // Zooms back to the base and clears any other zoom levels
+ _zoomer->zoom(0);
}
}
}
diff --git a/gr-qtgui/src/lib/WaterfallDisplayPlot.h b/gr-qtgui/src/lib/WaterfallDisplayPlot.h
index bb87fb09f..18e10aae9 100644
--- a/gr-qtgui/src/lib/WaterfallDisplayPlot.h
+++ b/gr-qtgui/src/lib/WaterfallDisplayPlot.h
@@ -69,6 +69,8 @@ private:
timespec _lastReplot;
+ bool _useCenterFrequencyFlag;
+
int64_t _numPoints;
double _displayIntervalTime;