summaryrefslogtreecommitdiff
path: root/gr-qtgui
diff options
context:
space:
mode:
authorTom Rondeau2010-05-09 13:06:20 -0400
committerTom Rondeau2010-05-09 13:06:20 -0400
commit19550b1be84c96eb92b24c88847e1b0d024b366c (patch)
tree05768fd8af3ae06b09676d1c9dcf56ea30f32360 /gr-qtgui
parent7488244b24a52e6b1a51bcbdb0077e70554c6731 (diff)
downloadgnuradio-19550b1be84c96eb92b24c88847e1b0d024b366c.tar.gz
gnuradio-19550b1be84c96eb92b24c88847e1b0d024b366c.tar.bz2
gnuradio-19550b1be84c96eb92b24c88847e1b0d024b366c.zip
Updating zoom and axis across plots for consistent zoom levels and behavior.
Diffstat (limited to 'gr-qtgui')
-rw-r--r--gr-qtgui/src/lib/ConstellationDisplayPlot.cc2
-rw-r--r--gr-qtgui/src/lib/FrequencyDisplayPlot.cc52
-rw-r--r--gr-qtgui/src/lib/TimeDomainDisplayPlot.cc32
-rw-r--r--gr-qtgui/src/lib/WaterfallDisplayPlot.cc11
4 files changed, 58 insertions, 39 deletions
diff --git a/gr-qtgui/src/lib/ConstellationDisplayPlot.cc b/gr-qtgui/src/lib/ConstellationDisplayPlot.cc
index 9d2cb385d..e8e6288f5 100644
--- a/gr-qtgui/src/lib/ConstellationDisplayPlot.cc
+++ b/gr-qtgui/src/lib/ConstellationDisplayPlot.cc
@@ -56,12 +56,10 @@ ConstellationDisplayPlot::ConstellationDisplayPlot(QWidget* parent)
canvas()->setPalette(palette);
setAxisScaleEngine(QwtPlot::xBottom, new QwtLinearScaleEngine);
- //setAxisScale(QwtPlot::xBottom, -1.0, 1.0);
set_xaxis(-2.0, 2.0);
setAxisTitle(QwtPlot::xBottom, "In-phase");
setAxisScaleEngine(QwtPlot::yLeft, new QwtLinearScaleEngine);
- //setAxisScale(QwtPlot::yLeft, -1.0, 1.0);
set_yaxis(-2.0, 2.0);
setAxisTitle(QwtPlot::yLeft, "Quadrature");
diff --git a/gr-qtgui/src/lib/FrequencyDisplayPlot.cc b/gr-qtgui/src/lib/FrequencyDisplayPlot.cc
index af705fb96..f2cde322e 100644
--- a/gr-qtgui/src/lib/FrequencyDisplayPlot.cc
+++ b/gr-qtgui/src/lib/FrequencyDisplayPlot.cc
@@ -120,9 +120,8 @@ FrequencyDisplayPlot::FrequencyDisplayPlot(QWidget* parent)
palette.setColor(canvas()->backgroundRole(), QColor("white"));
canvas()->setPalette(palette);
- setAxisScaleDraw(QwtPlot::xBottom, new FreqDisplayScaleDraw(0));
- setAxisScale(QwtPlot::xBottom, _startFrequency, _stopFrequency);
setAxisTitle(QwtPlot::xBottom, "Frequency (Hz)");
+ setAxisScaleDraw(QwtPlot::xBottom, new FreqDisplayScaleDraw(0));
_minYAxis = -120;
_maxYAxis = 10;
@@ -166,9 +165,6 @@ FrequencyDisplayPlot::FrequencyDisplayPlot(QWidget* parent)
_maxFFTPoints[number] = -280.0;
}
- _resetXAxisPoints();
-
-
// set up peak marker
QwtSymbol symbol;
@@ -218,6 +214,9 @@ FrequencyDisplayPlot::FrequencyDisplayPlot(QWidget* parent)
const QColor c(Qt::darkRed);
_zoomer->setRubberBandPen(c);
_zoomer->setTrackerPen(c);
+
+ // Do this after the zoomer has been built
+ _resetXAxisPoints();
}
FrequencyDisplayPlot::~FrequencyDisplayPlot()
@@ -263,22 +262,26 @@ FrequencyDisplayPlot::SetFrequencyRange(const double constStartFreq,
stopFreq = (stopFreq + centerFreq);
}
- _startFrequency = startFreq;
- _stopFrequency = stopFreq;
- _resetXAxisPoints();
+ bool reset = false;
+ if((startFreq != _startFrequency) || (stopFreq != _stopFrequency))
+ reset = true;
- double display_units = ceil(log10(units)/2.0);
- setAxisScale(QwtPlot::xBottom, _startFrequency, _stopFrequency);
- setAxisScaleDraw(QwtPlot::xBottom, new FreqDisplayScaleDraw(display_units));
- setAxisTitle(QwtPlot::xBottom, QString("Frequency (%1)").arg(strunits.c_str()));
- ((FreqDisplayZoomer*)_zoomer)->SetFrequencyPrecision(display_units);
- ((FreqDisplayZoomer*)_zoomer)->SetUnitType(strunits);
+ if(stopFreq > startFreq) {
+ _startFrequency = startFreq;
+ _stopFrequency = stopFreq;
+
+ 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()));
- // Load up the new base zoom settings
- _zoomer->setZoomBase();
-
- // Zooms back to the base and clears any other zoom levels
- _zoomer->zoom(0);
+ if(reset)
+ _resetXAxisPoints();
+
+ ((FreqDisplayZoomer*)_zoomer)->SetFrequencyPrecision(display_units);
+ ((FreqDisplayZoomer*)_zoomer)->SetUnitType(strunits);
+ }
+ }
}
@@ -406,6 +409,17 @@ FrequencyDisplayPlot::_resetXAxisPoints()
_xAxisPoints[loc] = freqValue;
freqValue += fft_bin_size;
}
+
+ setAxisScale(QwtPlot::xBottom, _startFrequency, _stopFrequency);
+
+ // Set up zoomer base for maximum unzoom x-axis
+ // and reset to maximum unzoom level
+ QwtDoubleRect zbase = _zoomer->zoomBase();
+ zbase.setLeft(_startFrequency);
+ zbase.setRight(_stopFrequency);
+ _zoomer->zoom(zbase);
+ _zoomer->setZoomBase(zbase);
+ _zoomer->zoom(0);
}
void
diff --git a/gr-qtgui/src/lib/TimeDomainDisplayPlot.cc b/gr-qtgui/src/lib/TimeDomainDisplayPlot.cc
index e6f6581d2..c299f83a4 100644
--- a/gr-qtgui/src/lib/TimeDomainDisplayPlot.cc
+++ b/gr-qtgui/src/lib/TimeDomainDisplayPlot.cc
@@ -237,6 +237,15 @@ void TimeDomainDisplayPlot::_resetXAxisPoints()
_xAxisPoints[loc] = loc*delt;
}
setAxisScale(QwtPlot::xBottom, 0, _numPoints*delt);
+
+ // Set up zoomer base for maximum unzoom x-axis
+ // and reset to maximum unzoom level
+ QwtDoubleRect zbase = _zoomer->zoomBase();
+ zbase.setLeft(0);
+ zbase.setRight(_numPoints*delt);
+ _zoomer->zoom(zbase);
+ _zoomer->setZoomBase(zbase);
+ _zoomer->zoom(0);
}
void TimeDomainDisplayPlot::LegendEntryChecked(QwtPlotItem* plotItem, bool on)
@@ -248,16 +257,19 @@ void
TimeDomainDisplayPlot::SetSampleRate(double sr, double units,
const std::string &strunits)
{
- _sampleRate = sr/units;
- _resetXAxisPoints();
-
- // While we could change the displayed sigfigs based on the unit being
- // displayed, I think it looks better by just setting it to 4 regardless.
- //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);
+ double newsr = sr/units;
+ if(newsr != _sampleRate) {
+ _sampleRate = sr/units;
+ _resetXAxisPoints();
+
+ // While we could change the displayed sigfigs based on the unit being
+ // displayed, I think it looks better by just setting it to 4 regardless.
+ //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);
+ }
}
#endif /* TIME_DOMAIN_DISPLAY_PLOT_C */
diff --git a/gr-qtgui/src/lib/WaterfallDisplayPlot.cc b/gr-qtgui/src/lib/WaterfallDisplayPlot.cc
index 298eaffe9..e0804fa64 100644
--- a/gr-qtgui/src/lib/WaterfallDisplayPlot.cc
+++ b/gr-qtgui/src/lib/WaterfallDisplayPlot.cc
@@ -298,6 +298,8 @@ WaterfallDisplayPlot::Reset()
_waterfallData->ResizeData(_startFrequency, _stopFrequency, _numPoints);
_waterfallData->Reset();
+ setAxisScale(QwtPlot::xBottom, _startFrequency, _stopFrequency);
+
// Load up the new base zoom settings
QwtDoubleRect newSize = _zoomer->zoomBase();
newSize.setLeft(_startFrequency);
@@ -332,12 +334,11 @@ WaterfallDisplayPlot::SetFrequencyRange(const double constStartFreq,
if(stopFreq > startFreq) {
_startFrequency = startFreq;
_stopFrequency = stopFreq;
-
if((axisScaleDraw(QwtPlot::xBottom) != NULL) && (_zoomer != NULL)){
double display_units = ceil(log10(units)/2.0);
- setAxisScale(QwtPlot::xBottom, _startFrequency, _stopFrequency);
setAxisScaleDraw(QwtPlot::xBottom, new WaterfallFreqDisplayScaleDraw(display_units));
+ setAxisTitle(QwtPlot::xBottom, QString("Frequency (%1)").arg(strunits.c_str()));
if(reset) {
Reset();
@@ -345,12 +346,6 @@ WaterfallDisplayPlot::SetFrequencyRange(const double constStartFreq,
((WaterfallZoomer*)_zoomer)->SetFrequencyPrecision(display_units);
((WaterfallZoomer*)_zoomer)->SetUnitType(strunits);
-
- // Load up the new base zoom settings
- _zoomer->setZoomBase();
-
- // Zooms back to the base and clears any other zoom levels
- _zoomer->zoom(0);
}
}
}