|
From: | Tom Rondeau |
Subject: | Re: [Discuss-gnuradio] [GRC] Print samples when saving screenshot |
Date: | Thu, 14 Apr 2016 10:04:02 -0400 |
Hi all,
GRC is very handy and so is the screenshot function. It's much faster to take a screenshot than to record all data and plot it afterwards. However I found myself taking a lot of screenshots twice because e.g. the label was wrong. Also the plots did not meet my requirements for printing, so I had to go for the record-everything-method anyway.
I think GRC could print out the samples when saving a screenshot. You'll then have 1. a fast tool to snapshot your signals and 2. accurate data in case you need further analysis or different plot style.
I hacked this into the gr-qtgui code, see below. Any comments on this? I'm pretty sure it's not done right.
What do you think of this feature? Does this already exist and I did not find it?
--Merlin Chlosta
---
commit 5df55a2ec563002161d43cca53aad119a32a38f2
Author: Merlin Chlosta <address@hidden>
Date: Tue Apr 12 22:41:37 2016 +0200
DisplayForm: Print samples when saving screenshot
diff --git a/gr-qtgui/include/gnuradio/qtgui/DisplayPlot.h b/gr-qtgui/include/gnuradio/qtgui/DisplayPlot.h
index eba12e2..1e946f8 100644
--- a/gr-qtgui/include/gnuradio/qtgui/DisplayPlot.h
+++ b/gr-qtgui/include/gnuradio/qtgui/DisplayPlot.h
@@ -127,6 +127,8 @@ public:
virtual void replot() = 0;
+ std::vector<QwtPlotCurve*> d_plot_curve;
+
const QColor getLineColor1 () const;
const QColor getLineColor2 () const;
const QColor getLineColor3 () const;
@@ -284,7 +286,6 @@ protected slots:
protected:
int d_nplots;
- std::vector<QwtPlotCurve*> d_plot_curve;
QwtPlotPanner* d_panner;
QwtPlotZoomer* d_zoomer;
diff --git a/gr-qtgui/include/gnuradio/qtgui/displayform.h b/gr-qtgui/include/gnuradio/qtgui/displayform.h
index 1da1383..c23067a 100644
--- a/gr-qtgui/include/gnuradio/qtgui/displayform.h
+++ b/gr-qtgui/include/gnuradio/qtgui/displayform.h
@@ -30,6 +30,7 @@
#include <qwt_plot_grid.h>
#include <qwt_plot_layout.h>
+#include <qwt_plot_curve.h>
#include <gnuradio/qtgui/DisplayPlot.h>
#include <gnuradio/qtgui/form_menus.h>
diff --git a/gr-qtgui/lib/displayform.cc b/gr-qtgui/lib/displayform.cc
index 13c2d8a..3f78502 100644
--- a/gr-qtgui/lib/displayform.cc
+++ b/gr-qtgui/lib/displayform.cc
@@ -359,6 +359,17 @@ DisplayForm::saveFigure()
{
QPixmap qpix = QPixmap::grabWidget(this);
+ std::vector<QwtPlotCurve*> plot_curve = getPlot()->d_plot_curve;
+
+ std::cout << "Screenshot:" << std::endl;
+ for (int plot = 0; plot < plot_curve.size(); plot++) {
+ std::cout << "Plot curve #" << plot << std::endl;
+ for (int i = 0; i < plot_curve[plot]->dataSize(); i++) {
+ std::cout << plot_curve[plot]->y(i) << ", ";
+ }
+ std::cout << std::endl;
+ }
+
QString types = QString(tr("JPEG file (*.jpg);;Portable Network Graphics file (*.png);;Bitmap file (*.bmp);;TIFF file (*.tiff)"));
QString filename, filetype;
[Prev in Thread] | Current Thread | [Next in Thread] |