[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] [gnuradio] 02/05: qtgui: Added a 'vector sink'.
From: |
git |
Subject: |
[Commit-gnuradio] [gnuradio] 02/05: qtgui: Added a 'vector sink'. |
Date: |
Tue, 26 Aug 2014 18:02:40 +0000 (UTC) |
This is an automated email from the git hooks/post-receive script.
jcorgan pushed a commit to branch master
in repository gnuradio.
commit 5b992d4ccc9ae9c3c2b3c7b82540f48f1d50627c
Author: Martin Braun <address@hidden>
Date: Sun Aug 3 16:23:02 2014 +0200
qtgui: Added a 'vector sink'.
This is a sink similar to the freq sink, which takes vectors as input
and plots them as-is.
---
gr-qtgui/examples/alt.qss | 17 +
gr-qtgui/examples/dark.qss | 11 +
gr-qtgui/examples/qtgui_vector_sink_example.grc | 706 +++++++++++++++++++++
gr-qtgui/grc/qtgui_block_tree.xml | 1 +
gr-qtgui/grc/qtgui_vector_sink_f.xml | 603 ++++++++++++++++++
gr-qtgui/include/gnuradio/qtgui/CMakeLists.txt | 3 +
.../include/gnuradio/qtgui/VectorDisplayPlot.h | 153 +++++
gr-qtgui/include/gnuradio/qtgui/form_menus.h | 22 +-
gr-qtgui/include/gnuradio/qtgui/vector_sink_f.h | 144 +++++
.../include/gnuradio/qtgui/vectordisplayform.h | 94 +++
gr-qtgui/lib/CMakeLists.txt | 5 +
gr-qtgui/lib/VectorDisplayPlot.cc | 629 ++++++++++++++++++
gr-qtgui/lib/vector_sink_f_impl.cc | 437 +++++++++++++
gr-qtgui/lib/vector_sink_f_impl.h | 142 +++++
gr-qtgui/lib/vectordisplayform.cc | 235 +++++++
gr-qtgui/swig/qtgui_swig.i | 3 +
16 files changed, 3199 insertions(+), 6 deletions(-)
diff --git a/gr-qtgui/examples/alt.qss b/gr-qtgui/examples/alt.qss
index c310b80..ba46242 100644
--- a/gr-qtgui/examples/alt.qss
+++ b/gr-qtgui/examples/alt.qss
@@ -51,6 +51,23 @@ FrequencyDisplayPlot {
qproperty-marker_noise_floor_amplitude_visible: false;
}
+VectorDisplayPlot {
+ qproperty-line_color1: cyan;
+ qproperty-line_color2: magenta;
+ qproperty-line_color3: purple;
+ qproperty-line_style1: SolidLine;
+ qproperty-line_style2: DashLine;
+ qproperty-line_style3: DotLine;
+ qproperty-max_vec_color: palegreen;
+ qproperty-min_vec_color: darkblue;
+ qproperty-marker_lower_intensity_color: white;
+ qproperty-marker_upper_intensity_color: red;
+ qproperty-marker_lower_intensity_visible: false;
+ qproperty-marker_upper_intensity_visible: false;
+ qproperty-marker_ref_level_color: red;
+ qproperty-marker_ref_level_visible: false;
+}
+
QwtPlotCanvas
{
border: 1px solid White;
diff --git a/gr-qtgui/examples/dark.qss b/gr-qtgui/examples/dark.qss
index 9bbe00b..8999bda 100644
--- a/gr-qtgui/examples/dark.qss
+++ b/gr-qtgui/examples/dark.qss
@@ -38,6 +38,17 @@ FrequencyDisplayPlot {
qproperty-marker_noise_floor_amplitude_visible: false;
}
+VectorDisplayPlot {
+ qproperty-max_vec_color: palegreen;
+ qproperty-min_vec_color: palegreen;
+ qproperty-marker_lower_intensity_color: white;
+ qproperty-marker_upper_intensity_color: red;
+ qproperty-marker_lower_intensity_visible: false;
+ qproperty-marker_upper_intensity_visible: false;
+ qproperty-marker_ref_level_amplitude_color: red;
+ qproperty-marker_ref_level_amplitude_visible: false;
+}
+
QwtPlotCanvas
{
border: 1px solid White;
diff --git a/gr-qtgui/examples/qtgui_vector_sink_example.grc
b/gr-qtgui/examples/qtgui_vector_sink_example.grc
new file mode 100644
index 0000000..4ad897d
--- /dev/null
+++ b/gr-qtgui/examples/qtgui_vector_sink_example.grc
@@ -0,0 +1,706 @@
+<?xml version='1.0' encoding='ASCII'?>
+<flow_graph>
+ <timestamp>Sun Aug 17 18:43:15 2014</timestamp>
+ <block>
+ <key>options</key>
+ <param>
+ <key>id</key>
+ <value>qt_example_vector_sink</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>title</key>
+ <value>QT GUI Vector Sink Example</value>
+ </param>
+ <param>
+ <key>author</key>
+ <value></value>
+ </param>
+ <param>
+ <key>description</key>
+ <value></value>
+ </param>
+ <param>
+ <key>window_size</key>
+ <value>1280, 1024</value>
+ </param>
+ <param>
+ <key>generate_options</key>
+ <value>qt_gui</value>
+ </param>
+ <param>
+ <key>category</key>
+ <value>Custom</value>
+ </param>
+ <param>
+ <key>run_options</key>
+ <value>prompt</value>
+ </param>
+ <param>
+ <key>run</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>max_nouts</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>realtime_scheduling</key>
+ <value></value>
+ </param>
+ <param>
+ <key>alias</key>
+ <value></value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(-1, 0)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>variable</key>
+ <param>
+ <key>id</key>
+ <value>veclen</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>value</key>
+ <value>512</value>
+ </param>
+ <param>
+ <key>alias</key>
+ <value></value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(183, 0)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>variable</key>
+ <param>
+ <key>id</key>
+ <value>samp_rate</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>value</key>
+ <value>32000</value>
+ </param>
+ <param>
+ <key>alias</key>
+ <value></value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(-1, 87)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>blocks_throttle</key>
+ <param>
+ <key>id</key>
+ <value>blocks_throttle_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>float</value>
+ </param>
+ <param>
+ <key>samples_per_second</key>
+ <value>samp_rate</value>
+ </param>
+ <param>
+ <key>vlen</key>
+ <value>veclen</value>
+ </param>
+ <param>
+ <key>ignoretag</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>alias</key>
+ <value></value>
+ </param>
+ <param>
+ <key>affinity</key>
+ <value></value>
+ </param>
+ <param>
+ <key>minoutbuf</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>maxoutbuf</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(199, 180)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>blocks_add_xx</key>
+ <param>
+ <key>id</key>
+ <value>blocks_add_xx_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>float</value>
+ </param>
+ <param>
+ <key>num_inputs</key>
+ <value>2</value>
+ </param>
+ <param>
+ <key>vlen</key>
+ <value>veclen</value>
+ </param>
+ <param>
+ <key>alias</key>
+ <value></value>
+ </param>
+ <param>
+ <key>affinity</key>
+ <value></value>
+ </param>
+ <param>
+ <key>minoutbuf</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>maxoutbuf</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(382, 186)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>blocks_vector_source_x</key>
+ <param>
+ <key>id</key>
+ <value>blocks_vector_source_x_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>float</value>
+ </param>
+ <param>
+ <key>vector</key>
+ <value>range(veclen)</value>
+ </param>
+ <param>
+ <key>tags</key>
+ <value>[]</value>
+ </param>
+ <param>
+ <key>repeat</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>vlen</key>
+ <value>veclen</value>
+ </param>
+ <param>
+ <key>alias</key>
+ <value></value>
+ </param>
+ <param>
+ <key>affinity</key>
+ <value></value>
+ </param>
+ <param>
+ <key>minoutbuf</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>maxoutbuf</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(-1, 165)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>analog_fastnoise_source_x</key>
+ <param>
+ <key>id</key>
+ <value>analog_fastnoise_source_x_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>float</value>
+ </param>
+ <param>
+ <key>noise_type</key>
+ <value>analog.GR_GAUSSIAN</value>
+ </param>
+ <param>
+ <key>amp</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>seed</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>samples</key>
+ <value>8192</value>
+ </param>
+ <param>
+ <key>alias</key>
+ <value></value>
+ </param>
+ <param>
+ <key>affinity</key>
+ <value></value>
+ </param>
+ <param>
+ <key>minoutbuf</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>maxoutbuf</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(-1, 293)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>blocks_stream_to_vector</key>
+ <param>
+ <key>id</key>
+ <value>blocks_stream_to_vector_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>float</value>
+ </param>
+ <param>
+ <key>num_items</key>
+ <value>veclen</value>
+ </param>
+ <param>
+ <key>vlen</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>alias</key>
+ <value></value>
+ </param>
+ <param>
+ <key>affinity</key>
+ <value></value>
+ </param>
+ <param>
+ <key>minoutbuf</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>maxoutbuf</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(197, 316)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>qtgui_vector_sink_x</key>
+ <param>
+ <key>id</key>
+ <value>qtgui_vector_sink_x_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>name</key>
+ <value>"A noisy line"</value>
+ </param>
+ <param>
+ <key>vlen</key>
+ <value>veclen</value>
+ </param>
+ <param>
+ <key>x_start</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>x_step</key>
+ <value>1.0/veclen</value>
+ </param>
+ <param>
+ <key>x_axis_label</key>
+ <value>"x-Axis"</value>
+ </param>
+ <param>
+ <key>y_axis_label</key>
+ <value>"y-Axis"</value>
+ </param>
+ <param>
+ <key>x_units</key>
+ <value>"x"</value>
+ </param>
+ <param>
+ <key>y_units</key>
+ <value>"y"</value>
+ </param>
+ <param>
+ <key>ref_level</key>
+ <value>.5*veclen</value>
+ </param>
+ <param>
+ <key>grid</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>autoscale</key>
+ <value>False</value>
+ </param>
+ <param>
+ <key>average</key>
+ <value>1.0</value>
+ </param>
+ <param>
+ <key>ymin</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>ymax</key>
+ <value>veclen</value>
+ </param>
+ <param>
+ <key>nconnections</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>update_time</key>
+ <value>0.10</value>
+ </param>
+ <param>
+ <key>gui_hint</key>
+ <value></value>
+ </param>
+ <param>
+ <key>showports</key>
+ <value>False</value>
+ </param>
+ <param>
+ <key>label1</key>
+ <value>Up</value>
+ </param>
+ <param>
+ <key>width1</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>color1</key>
+ <value>"blue"</value>
+ </param>
+ <param>
+ <key>alpha1</key>
+ <value>1.0</value>
+ </param>
+ <param>
+ <key>label2</key>
+ <value></value>
+ </param>
+ <param>
+ <key>width2</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>color2</key>
+ <value>"red"</value>
+ </param>
+ <param>
+ <key>alpha2</key>
+ <value>1.0</value>
+ </param>
+ <param>
+ <key>label3</key>
+ <value></value>
+ </param>
+ <param>
+ <key>width3</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>color3</key>
+ <value>"green"</value>
+ </param>
+ <param>
+ <key>alpha3</key>
+ <value>1.0</value>
+ </param>
+ <param>
+ <key>label4</key>
+ <value></value>
+ </param>
+ <param>
+ <key>width4</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>color4</key>
+ <value>"black"</value>
+ </param>
+ <param>
+ <key>alpha4</key>
+ <value>1.0</value>
+ </param>
+ <param>
+ <key>label5</key>
+ <value></value>
+ </param>
+ <param>
+ <key>width5</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>color5</key>
+ <value>"cyan"</value>
+ </param>
+ <param>
+ <key>alpha5</key>
+ <value>1.0</value>
+ </param>
+ <param>
+ <key>label6</key>
+ <value></value>
+ </param>
+ <param>
+ <key>width6</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>color6</key>
+ <value>"magenta"</value>
+ </param>
+ <param>
+ <key>alpha6</key>
+ <value>1.0</value>
+ </param>
+ <param>
+ <key>label7</key>
+ <value></value>
+ </param>
+ <param>
+ <key>width7</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>color7</key>
+ <value>"yellow"</value>
+ </param>
+ <param>
+ <key>alpha7</key>
+ <value>1.0</value>
+ </param>
+ <param>
+ <key>label8</key>
+ <value></value>
+ </param>
+ <param>
+ <key>width8</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>color8</key>
+ <value>"dark red"</value>
+ </param>
+ <param>
+ <key>alpha8</key>
+ <value>1.0</value>
+ </param>
+ <param>
+ <key>label9</key>
+ <value></value>
+ </param>
+ <param>
+ <key>width9</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>color9</key>
+ <value>"dark green"</value>
+ </param>
+ <param>
+ <key>alpha9</key>
+ <value>1.0</value>
+ </param>
+ <param>
+ <key>label10</key>
+ <value></value>
+ </param>
+ <param>
+ <key>width10</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>color10</key>
+ <value>"dark blue"</value>
+ </param>
+ <param>
+ <key>alpha10</key>
+ <value>1.0</value>
+ </param>
+ <param>
+ <key>alias</key>
+ <value></value>
+ </param>
+ <param>
+ <key>affinity</key>
+ <value></value>
+ </param>
+ <param>
+ <key>minoutbuf</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>maxoutbuf</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(566, 136)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>blocks_message_debug</key>
+ <param>
+ <key>id</key>
+ <value>blocks_message_debug_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>alias</key>
+ <value></value>
+ </param>
+ <param>
+ <key>affinity</key>
+ <value></value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(871, 204)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <connection>
+ <source_block_id>blocks_throttle_0</source_block_id>
+ <sink_block_id>blocks_add_xx_0</sink_block_id>
+ <source_key>0</source_key>
+ <sink_key>0</sink_key>
+ </connection>
+ <connection>
+ <source_block_id>blocks_vector_source_x_0</source_block_id>
+ <sink_block_id>blocks_throttle_0</sink_block_id>
+ <source_key>0</source_key>
+ <sink_key>0</sink_key>
+ </connection>
+ <connection>
+ <source_block_id>analog_fastnoise_source_x_0</source_block_id>
+ <sink_block_id>blocks_stream_to_vector_0</sink_block_id>
+ <source_key>0</source_key>
+ <sink_key>0</sink_key>
+ </connection>
+ <connection>
+ <source_block_id>blocks_stream_to_vector_0</source_block_id>
+ <sink_block_id>blocks_add_xx_0</sink_block_id>
+ <source_key>0</source_key>
+ <sink_key>1</sink_key>
+ </connection>
+ <connection>
+ <source_block_id>blocks_add_xx_0</source_block_id>
+ <sink_block_id>qtgui_vector_sink_x_0</sink_block_id>
+ <source_key>0</source_key>
+ <sink_key>0</sink_key>
+ </connection>
+ <connection>
+ <source_block_id>qtgui_vector_sink_x_0</source_block_id>
+ <sink_block_id>blocks_message_debug_0</sink_block_id>
+ <source_key>xval</source_key>
+ <sink_key>print</sink_key>
+ </connection>
+</flow_graph>
diff --git a/gr-qtgui/grc/qtgui_block_tree.xml
b/gr-qtgui/grc/qtgui_block_tree.xml
index 4461f82..e6eeff6 100644
--- a/gr-qtgui/grc/qtgui_block_tree.xml
+++ b/gr-qtgui/grc/qtgui_block_tree.xml
@@ -40,6 +40,7 @@
<block>qtgui_bercurve_sink</block>
<block>qtgui_histogram_sink_x</block>
<block>qtgui_number_sink</block>
+ <block>qtgui_vector_sink</block>
<block>qtgui_sink_x</block>
</cat>
</cat>
diff --git a/gr-qtgui/grc/qtgui_vector_sink_f.xml
b/gr-qtgui/grc/qtgui_vector_sink_f.xml
new file mode 100644
index 0000000..7a22c37
--- /dev/null
+++ b/gr-qtgui/grc/qtgui_vector_sink_f.xml
@@ -0,0 +1,603 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##QT GUI Sink
+###################################################
+ -->
+<block>
+ <name>QT GUI Vector Sink</name>
+ <key>qtgui_vector_sink_x</key>
+ <import>from PyQt4 import Qt</import>
+ <import>from gnuradio import qtgui</import>
+ <import>import sip</import>
+ <make>#set $win = 'self._%s_win'%$id
+qtgui.vector_sink_f(
+ $vlen,
+ $x_start,
+ $x_step,
+ $x_axis_label,
+ $y_axis_label,
+ $name,
+ $nconnections \# Number of inputs
+)
+self.$(id).set_update_time($update_time)
+self.$(id).set_y_axis($ymin, $ymax)
+self.$(id).enable_autoscale($autoscale)
+self.$(id).enable_grid($grid)
+self.$(id).set_x_axis_units($x_units)
+self.$(id).set_y_axis_units($y_units)
+self.$(id).set_ref_level($ref_level)
+
+labels = [$label1, $label2, $label3, $label4, $label5,
+ $label6, $label7, $label8, $label9, $label10]
+widths = [$width1, $width2, $width3, $width4, $width5,
+ $width6, $width7, $width8, $width9, $width10]
+colors = [$color1, $color2, $color3, $color4, $color5,
+ $color6, $color7, $color8, $color9, $color10]
+alphas = [$alpha1, $alpha2, $alpha3, $alpha4, $alpha5,
+ $alpha6, $alpha7, $alpha8, $alpha9, $alpha10]
+for i in xrange($nconnections):
+ if len(labels[i]) == 0:
+ self.$(id).set_line_label(i, "Data {0}".format(i))
+ else:
+ self.$(id).set_line_label(i, labels[i])
+ self.$(id).set_line_width(i, widths[i])
+ self.$(id).set_line_color(i, colors[i])
+ self.$(id).set_line_alpha(i, alphas[i])
+
+self._$(id)_win = sip.wrapinstance(self.$(id).pyqwidget(), Qt.QWidget)
+$(gui_hint()($win))</make>
+ <callback>set_update_time($update_time)</callback>
+ <callback>set_title($title)</callback>
+ <callback>set_color($which, $color)</callback>
+ <callback>set_x_axis($x_start, $x_step)</callback>
+ <callback>set_y_axis($ymin, $ymax)</callback>
+ <callback>set_ref_level($ref_level)</callback>
+ <callback>set_x_axis_units($x_units)</callback>
+ <callback>set_y_axis_units($y_units)</callback>
+
+ <param_tab_order>
+ <tab>General</tab>
+ <tab>Config</tab>
+ </param_tab_order>
+
+ <param>
+ <name>Name</name>
+ <key>name</key>
+ <value>""</value>
+ <type>string</type>
+ <hide>#if len($name()) > 0 then 'none' else 'part'#</hide>
+ </param>
+
+ <param>
+ <name>Vector Size</name>
+ <key>vlen</key>
+ <value>1024</value>
+ <type>int</type>
+ </param>
+
+ <param>
+ <name>X-Axis Start Value</name>
+ <key>x_start</key>
+ <value>0</value>
+ <type>real</type>
+ </param>
+
+ <param>
+ <name>X-Axis Step Value</name>
+ <key>x_step</key>
+ <value>1.0</value>
+ <type>real</type>
+ </param>
+
+ <param>
+ <name>X-Axis Label</name>
+ <key>x_axis_label</key>
+ <value>"x-Axis"</value>
+ <type>string</type>
+ <hide>#if (len($x_axis_label()) > 0 and $x_axis_label != "x-Axis") then
'none' else 'part'#</hide>
+ </param>
+
+ <param>
+ <name>Y-Axis Label</name>
+ <key>y_axis_label</key>
+ <value>"y-Axis"</value>
+ <type>string</type>
+ <hide>#if (len($y_axis_label()) > 0 and $y_axis_label != "y-Axis") then
'none' else 'part'#</hide>
+ </param>
+
+ <param>
+ <name>X-Axis Units</name>
+ <key>x_units</key>
+ <value>""</value>
+ <type>string</type>
+ <hide>'part'</hide>
+ </param>
+
+ <param>
+ <name>Y-Axis Units</name>
+ <key>y_units</key>
+ <value>""</value>
+ <type>string</type>
+ <hide>'part'</hide>
+ </param>
+
+ <param>
+ <name>Ref Level</name>
+ <key>ref_level</key>
+ <value>0</value>
+ <type>real</type>
+ </param>
+
+ <param>
+ <name>Grid</name>
+ <key>grid</key>
+ <value>False</value>
+ <type>enum</type>
+ <hide>part</hide>
+ <option>
+ <name>Yes</name>
+ <key>True</key>
+ </option>
+ <option>
+ <name>No</name>
+ <key>False</key>
+ </option>
+ </param>
+
+ <param>
+ <name>Autoscale</name>
+ <key>autoscale</key>
+ <value>False</value>
+ <type>enum</type>
+ <hide>part</hide>
+ <option>
+ <name>Yes</name>
+ <key>True</key>
+ </option>
+ <option>
+ <name>No</name>
+ <key>False</key>
+ </option>
+ </param>
+
+ <param>
+ <name>Average</name>
+ <key>average</key>
+ <value>False</value>
+ <type>enum</type>
+ <hide>part</hide>
+ <option>
+ <name>None</name>
+ <key>1.0</key>
+ </option>
+ <option>
+ <name>Low</name>
+ <key>0.2</key>
+ </option>
+ <option>
+ <name>Medium</name>
+ <key>0.1</key>
+ </option>
+ <option>
+ <name>High</name>
+ <key>0.05</key>
+ </option>
+ </param>
+
+ <param>
+ <name>Y min</name>
+ <key>ymin</key>
+ <value>-140</value>
+ <type>real</type>
+ <hide>part</hide>
+ </param>
+ <param>
+ <name>Y max</name>
+ <key>ymax</key>
+ <value>10</value>
+ <type>real</type>
+ <hide>part</hide>
+ </param>
+ <param>
+ <name>Number of Inputs</name>
+ <key>nconnections</key>
+ <value>1</value>
+ <type>int</type>
+ <hide>part</hide>
+ </param>
+ <param>
+ <name>Update Period</name>
+ <key>update_time</key>
+ <value>0.10</value>
+ <type>real</type>
+ <hide>part</hide>
+ </param>
+ <param>
+ <name>GUI Hint</name>
+ <key>gui_hint</key>
+ <value></value>
+ <type>gui_hint</type>
+ <hide>part</hide>
+ </param>
+
+ <param>
+ <name>Show Msg Ports</name>
+ <key>showports</key>
+ <value>True</value>
+ <type>enum</type>
+ <hide>part</hide>
+ <option>
+ <name>Yes</name>
+ <key>False</key>
+ </option>
+ <option>
+ <name>No</name>
+ <key>True</key>
+ </option>
+ </param>
+
+ <param>
+ <name>Line 1 Label</name>
+ <key>label1</key>
+ <type>string</type>
+ <hide>#if int($nconnections()) >= 1 then 'part' else 'all'#</hide>
+ <tab>Config</tab>
+ </param>
+
+ <param>
+ <name>Line 1 Width</name>
+ <key>width1</key>
+ <value>1</value>
+ <type>int</type>
+ <hide>#if int($nconnections()) >= 1 then 'part' else 'all'#</hide>
+ <tab>Config</tab>
+ </param>
+
+ <param>
+ <name>Line 1 Color</name>
+ <key>color1</key>
+ <type>enum</type>
+ <hide>#if int($nconnections()) >= 1 then 'part' else 'all'#</hide>
+ <option>
+ <name>Blue</name>
+ <key>"blue"</key>
+ </option>
+ <option>
+ <name>Red</name>
+ <key>"red"</key>
+ </option>
+ <option>
+ <name>Green</name>
+ <key>"green"</key>
+ </option>
+ <option>
+ <name>Black</name>
+ <key>"black"</key>
+ </option>
+ <option>
+ <name>Cyan</name>
+ <key>"cyan"</key>
+ </option>
+ <option>
+ <name>Magenta</name>
+ <key>"magenta"</key>
+ </option>
+ <option>
+ <name>Yellow</name>
+ <key>"yellow"</key>
+ </option>
+ <option>
+ <name>Dark Red</name>
+ <key>"dark red"</key>
+ </option>
+ <option>
+ <name>Dark Green</name>
+ <key>"dark green"</key>
+ </option>
+ <option>
+ <name>Dark Blue</name>
+ <key>"dark blue"</key>
+ </option>
+ <tab>Config</tab>
+ </param>
+
+ <param>
+ <name>Line 1 Alpha</name>
+ <key>alpha1</key>
+ <value>1.0</value>
+ <type>float</type>
+ <hide>#if int($nconnections()) >= 1 then 'part' else 'all'#</hide>
+ <tab>Config</tab>
+ </param>
+
+
+ <param>
+ <base_key>label1</base_key>
+ <name>Line 2 Label</name>
+ <key>label2</key>
+ <hide>#if int($nconnections()) >= 2 then 'part' else 'all'#</hide>
+ </param>
+
+ <param>
+ <base_key>width1</base_key>
+ <name>Line 2 Width</name>
+ <key>width2</key>
+ <hide>#if int($nconnections()) >= 2 then 'part' else 'all'#</hide>
+ </param>
+
+ <param>
+ <base_key>color1</base_key>
+ <name>Line 2 Color</name>
+ <key>color2</key>
+ <value>"red"</value>
+ <hide>#if int($nconnections()) >= 2 then 'part' else 'all'#</hide>
+ </param>
+
+ <param>
+ <base_key>alpha1</base_key>
+ <name>Line 2 Alpha</name>
+ <key>alpha2</key>
+ <hide>#if int($nconnections()) >= 2 then 'part' else 'all'#</hide>
+ </param>
+
+
+ <param>
+ <base_key>label1</base_key>
+ <name>Line 3 Label</name>
+ <key>label3</key>
+ <hide>#if int($nconnections()) >= 3 then 'part' else 'all'#</hide>
+ </param>
+
+ <param>
+ <base_key>width1</base_key>
+ <name>Line 3 Width</name>
+ <key>width3</key>
+ <hide>#if int($nconnections()) >= 3 then 'part' else 'all'#</hide>
+ </param>
+
+ <param>
+ <base_key>color1</base_key>
+ <name>Line 3 Color</name>
+ <key>color3</key>
+ <value>"green"</value>
+ <hide>#if int($nconnections()) >= 3 then 'part' else 'all'#</hide>
+ </param>
+
+ <param>
+ <base_key>alpha1</base_key>
+ <name>Line 3 Alpha</name>
+ <key>alpha3</key>
+ <hide>#if int($nconnections()) >= 3 then 'part' else 'all'#</hide>
+ </param>
+
+
+ <param>
+ <base_key>label1</base_key>
+ <name>Line 4 Label</name>
+ <key>label4</key>
+ <hide>#if int($nconnections()) >= 4 then 'part' else 'all'#</hide>
+ </param>
+
+ <param>
+ <base_key>width1</base_key>
+ <name>Line 4 Width</name>
+ <key>width4</key>
+ <hide>#if int($nconnections()) >= 4 then 'part' else 'all'#</hide>
+ </param>
+
+ <param>
+ <base_key>color1</base_key>
+ <name>Line 4 Color</name>
+ <key>color4</key>
+ <value>"black"</value>
+ <hide>#if int($nconnections()) >= 4 then 'part' else 'all'#</hide>
+ </param>
+
+ <param>
+ <base_key>alpha1</base_key>
+ <name>Line 4 Alpha</name>
+ <key>alpha4</key>
+ <hide>#if int($nconnections()) >= 4 then 'part' else 'all'#</hide>
+ </param>
+
+
+ <param>
+ <base_key>label1</base_key>
+ <name>Line 5 Label</name>
+ <key>label5</key>
+ <hide>#if int($nconnections()) >= 5 then 'part' else 'all'#</hide>
+ </param>
+
+ <param>
+ <base_key>width1</base_key>
+ <name>Line 5 Width</name>
+ <key>width5</key>
+ <hide>#if int($nconnections()) >= 5 then 'part' else 'all'#</hide>
+ </param>
+
+ <param>
+ <base_key>color1</base_key>
+ <name>Line 5 Color</name>
+ <key>color5</key>
+ <value>"cyan"</value>
+ <hide>#if int($nconnections()) >= 5 then 'part' else 'all'#</hide>
+ </param>
+
+ <param>
+ <base_key>alpha1</base_key>
+ <name>Line 5 Alpha</name>
+ <key>alpha5</key>
+ <hide>#if int($nconnections()) >= 5 then 'part' else 'all'#</hide>
+ </param>
+
+
+ <param>
+ <base_key>label1</base_key>
+ <name>Line 6 Label</name>
+ <key>label6</key>
+ <hide>#if int($nconnections()) >= 6 then 'part' else 'all'#</hide>
+ </param>
+
+ <param>
+ <base_key>width1</base_key>
+ <name>Line 6 Width</name>
+ <key>width6</key>
+ <hide>#if int($nconnections()) >= 6 then 'part' else 'all'#</hide>
+ </param>
+
+ <param>
+ <base_key>color1</base_key>
+ <name>Line 6 Color</name>
+ <key>color6</key>
+ <value>"magenta"</value>
+ <hide>#if int($nconnections()) >= 6 then 'part' else 'all'#</hide>
+ </param>
+
+ <param>
+ <base_key>alpha1</base_key>
+ <name>Line 6 Alpha</name>
+ <key>alpha6</key>
+ <hide>#if int($nconnections()) >= 6 then 'part' else 'all'#</hide>
+ </param>
+
+
+ <param>
+ <base_key>label1</base_key>
+ <name>Line 7 Label</name>
+ <key>label7</key>
+ <hide>#if int($nconnections()) >= 7 then 'part' else 'all'#</hide>
+ </param>
+
+ <param>
+ <base_key>width1</base_key>
+ <name>Line 7 Width</name>
+ <key>width7</key>
+ <hide>#if int($nconnections()) >= 7 then 'part' else 'all'#</hide>
+ </param>
+
+ <param>
+ <base_key>color1</base_key>
+ <name>Line 7 Color</name>
+ <key>color7</key>
+ <value>"yellow"</value>
+ <hide>#if int($nconnections()) >= 7 then 'part' else 'all'#</hide>
+ </param>
+
+ <param>
+ <base_key>alpha1</base_key>
+ <name>Line 7 Alpha</name>
+ <key>alpha7</key>
+ <hide>#if int($nconnections()) >= 7 then 'part' else 'all'#</hide>
+ </param>
+
+
+ <param>
+ <base_key>label1</base_key>
+ <name>Line 8 Label</name>
+ <key>label8</key>
+ <hide>#if int($nconnections()) >= 8 then 'part' else 'all'#</hide>
+ </param>
+
+ <param>
+ <base_key>width1</base_key>
+ <name>Line 8 Width</name>
+ <key>width8</key>
+ <hide>#if int($nconnections()) >= 8 then 'part' else 'all'#</hide>
+ </param>
+
+ <param>
+ <base_key>color1</base_key>
+ <name>Line 8 Color</name>
+ <key>color8</key>
+ <value>"dark red"</value>
+ <hide>#if int($nconnections()) >= 8 then 'part' else 'all'#</hide>
+ </param>
+
+ <param>
+ <base_key>alpha1</base_key>
+ <name>Line 8 Alpha</name>
+ <key>alpha8</key>
+ <hide>#if int($nconnections()) >= 8 then 'part' else 'all'#</hide>
+ </param>
+
+
+ <param>
+ <base_key>label1</base_key>
+ <name>Line 9 Label</name>
+ <key>label9</key>
+ <hide>#if int($nconnections()) >= 9 then 'part' else 'all'#</hide>
+ </param>
+
+ <param>
+ <base_key>width1</base_key>
+ <name>Line 9 Width</name>
+ <key>width9</key>
+ <hide>#if int($nconnections()) >= 9 then 'part' else 'all'#</hide>
+ </param>
+
+ <param>
+ <base_key>color1</base_key>
+ <name>Line 9 Color</name>
+ <key>color9</key>
+ <value>"dark green"</value>
+ <hide>#if int($nconnections()) >= 9 then 'part' else 'all'#</hide>
+ </param>
+
+ <param>
+ <base_key>alpha1</base_key>
+ <name>Line 9 Alpha</name>
+ <key>alpha9</key>
+ <hide>#if int($nconnections()) >= 9 then 'part' else 'all'#</hide>
+ </param>
+
+
+ <param>
+ <base_key>label1</base_key>
+ <name>Line 10 Label</name>
+ <key>label10</key>
+ <hide>#if int($nconnections()) >= 10 then 'part' else 'all'#</hide>
+ </param>
+
+ <param>
+ <base_key>width1</base_key>
+ <name>Line 10 Width</name>
+ <key>width10</key>
+ <hide>#if int($nconnections()) >= 10 then 'part' else 'all'#</hide>
+ </param>
+
+ <param>
+ <base_key>color1</base_key>
+ <name>Line 10 Color</name>
+ <key>color10</key>
+ <value>"dark blue"</value>
+ <hide>#if int($nconnections()) >= 10 then 'part' else 'all'#</hide>
+ </param>
+
+ <param>
+ <base_key>alpha1</base_key>
+ <name>Line 10 Alpha</name>
+ <key>alpha10</key>
+ <hide>#if int($nconnections()) >= 10 then 'part' else 'all'#</hide>
+ </param>
+
+ <sink>
+ <name>in</name>
+ <type>float</type>
+ <vlen>$vlen</vlen>
+ <nports>$nconnections</nports>
+ </sink>
+
+ <source>
+ <name>xval</name>
+ <type>message</type>
+ <optional>1</optional>
+ <hide>$showports</hide>
+ </source>
+
+ <doc>
+The GUI hint can be used to position the widget within the application. \
+The hint is of the form address@hidden: [row, col, row_span, col_span]. \
+Both the tab specification and the grid position are optional.
+ </doc>
+</block>
diff --git a/gr-qtgui/include/gnuradio/qtgui/CMakeLists.txt
b/gr-qtgui/include/gnuradio/qtgui/CMakeLists.txt
index e7a4701..43cee2f 100644
--- a/gr-qtgui/include/gnuradio/qtgui/CMakeLists.txt
+++ b/gr-qtgui/include/gnuradio/qtgui/CMakeLists.txt
@@ -63,6 +63,9 @@ install(FILES
waterfallGlobalData.h
waterfall_sink_c.h
waterfall_sink_f.h
+ vectordisplayform.h
+ VectorDisplayPlot.h
+ vector_sink_f.h
DESTINATION ${GR_INCLUDE_DIR}/gnuradio/qtgui
COMPONENT "qtgui_devel"
)
diff --git a/gr-qtgui/include/gnuradio/qtgui/VectorDisplayPlot.h
b/gr-qtgui/include/gnuradio/qtgui/VectorDisplayPlot.h
new file mode 100644
index 0000000..11373f8
--- /dev/null
+++ b/gr-qtgui/include/gnuradio/qtgui/VectorDisplayPlot.h
@@ -0,0 +1,153 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2014 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef VECTOR_DISPLAY_PLOT_HPP
+#define VECTOR_DISPLAY_PLOT_HPP
+
+#include <stdint.h>
+#include <cstdio>
+#include <vector>
+#include <gnuradio/qtgui/DisplayPlot.h>
+
+/*!
+ * \brief QWidget for displaying 1D-vector plots.
+ * \ingroup qtgui_blk
+ */
+class VectorDisplayPlot: public DisplayPlot
+{
+ Q_OBJECT
+
+ Q_PROPERTY ( QColor min_vec_color READ getMinVecColor WRITE setMinVecColor )
+ Q_PROPERTY ( QColor max_vec_color READ getMaxVecColor WRITE setMaxVecColor )
+ Q_PROPERTY ( bool min_vec_visible READ getMinVecVisible WRITE
setMinVecVisible )
+ Q_PROPERTY ( bool max_vec_visible READ getMaxVecVisible WRITE
setMaxVecVisible )
+ 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_ref_level_color READ
getMarkerRefLevelAmplitudeColor WRITE setMarkerRefLevelAmplitudeColor )
+ Q_PROPERTY ( bool marker_ref_level_visible READ
getMarkerRefLevelAmplitudeVisible WRITE setMarkerRefLevelAmplitudeVisible )
+
+public:
+ VectorDisplayPlot(int nplots, QWidget*);
+ virtual ~VectorDisplayPlot();
+
+ void setXAxisValues(const double start, const double step = 1.0);
+
+ void plotNewData(
+ const std::vector<double*> dataPoints,
+ const int64_t numDataPoints,
+ const double refLevel,
+ const double timeInterval
+ );
+
+ void clearMaxData();
+ void clearMinData();
+
+ void replot();
+
+ void setYaxis(double min, double max);
+ double getYMin() const;
+ double getYMax() const;
+
+ void setXAxisLabel(const QString &label);
+ void setYAxisLabel(const QString &label);
+
+ void setXAxisUnit(const QString &unit);
+ void setYAxisUnit(const QString &unit);
+
+ void setTraceColour (QColor);
+ void setBGColour (QColor c);
+
+ const bool getMaxVecVisible() const;
+ const bool getMinVecVisible() const;
+ const QColor getMinVecColor() const;
+ const QColor getMaxVecColor() const;
+ const QColor getMarkerLowerIntensityColor () const;
+ const bool getMarkerLowerIntensityVisible () const;
+ const QColor getMarkerUpperIntensityColor () const;
+ const bool getMarkerUpperIntensityVisible () const;
+ const bool getMarkerRefLevelAmplitudeVisible () const;
+ const QColor getMarkerRefLevelAmplitudeColor () const;
+
+public slots:
+ void setMaxVecVisible(const bool);
+ void setMinVecVisible(const bool);
+ void setMinVecColor (QColor c);
+ void setMaxVecColor (QColor c);
+ void setMarkerLowerIntensityColor (QColor c);
+ void setMarkerLowerIntensityVisible (bool visible);
+ void setMarkerUpperIntensityColor (QColor c);
+ void setMarkerUpperIntensityVisible (bool visible);
+ void setMarkerRefLevelAmplitudeVisible (bool visible);
+ void setMarkerRefLevelAmplitudeColor (QColor c);
+
+ void setLowerIntensityLevel(const double);
+ void setUpperIntensityLevel(const double);
+
+ void onPickerPointSelected(const QwtDoublePoint & p);
+ void onPickerPointSelected6(const QPointF & p);
+
+ void setAutoScale(bool state);
+
+private:
+ void _resetXAxisPoints();
+ void _autoScale(double bottom, double top);
+
+ std::vector<double*> d_ydata;
+
+ QwtPlotCurve* d_min_vec_plot_curve;
+ QwtPlotCurve* d_max_vec_plot_curve;
+ QColor d_min_vec_color;
+ bool d_min_vec_visible;
+ QColor d_max_vec_color;
+ bool d_max_vec_visible;
+ QColor d_marker_lower_intensity_color;
+ bool d_marker_lower_intensity_visible;
+ QColor d_marker_upper_intensity_color;
+ bool d_marker_upper_intensity_visible;
+ QColor d_marker_ref_level_color;
+ bool d_marker_ref_level_visible;
+
+ double d_x_axis_start;
+ double d_x_axis_step;
+
+ double d_ymax;
+ double d_ymin;
+
+ QwtPlotMarker* d_lower_intensity_marker;
+ QwtPlotMarker* d_upper_intensity_marker;
+
+ QwtPlotMarker *d_marker_ref_level;
+
+ double* d_xdata;
+
+ QString d_x_axis_label;
+ QString d_y_axis_label;
+
+ double* d_min_vec_data;
+ double* d_max_vec_data;
+
+ double d_ref_level;
+};
+
+#endif /* VECTOR_DISPLAY_PLOT_HPP */
diff --git a/gr-qtgui/include/gnuradio/qtgui/form_menus.h
b/gr-qtgui/include/gnuradio/qtgui/form_menus.h
index 7783406..f60c50e 100644
--- a/gr-qtgui/include/gnuradio/qtgui/form_menus.h
+++ b/gr-qtgui/include/gnuradio/qtgui/form_menus.h
@@ -740,17 +740,15 @@ private:
QActionGroup *d_grp;
};
-
/********************************************************************/
-
-class FFTAverageMenu: public QMenu
+class AverageMenu: public QMenu
{
Q_OBJECT
public:
- FFTAverageMenu(QWidget *parent)
- : QMenu("FFT Average", parent)
+ AverageMenu(const std::string &menuTitle, QWidget *parent)
+ : QMenu(menuTitle.c_str(), parent)
{
d_grp = new QActionGroup(this);
@@ -791,7 +789,7 @@ public:
}
}
- ~FFTAverageMenu()
+ ~AverageMenu()
{}
int getNumActions() const
@@ -861,6 +859,18 @@ private:
float d_off, d_high, d_medium, d_low;
};
+/********************************************************************/
+
+class FFTAverageMenu : public AverageMenu
+{
+public:
+ FFTAverageMenu(QWidget *parent) : AverageMenu("FFT Average", parent)
+ {
+ // nop
+ }
+
+ ~FFTAverageMenu() {}
+};
/********************************************************************/
diff --git a/gr-qtgui/include/gnuradio/qtgui/vector_sink_f.h
b/gr-qtgui/include/gnuradio/qtgui/vector_sink_f.h
new file mode 100644
index 0000000..b609752
--- /dev/null
+++ b/gr-qtgui/include/gnuradio/qtgui/vector_sink_f.h
@@ -0,0 +1,144 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2012,2014 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_QTGUI_VECTOR_SINK_F_H
+#define INCLUDED_QTGUI_VECTOR_SINK_F_H
+
+#ifdef ENABLE_PYTHON
+#include <Python.h>
+#endif
+
+#include <gnuradio/qtgui/api.h>
+#include <gnuradio/sync_block.h>
+#include <qapplication.h>
+
+namespace gr {
+ namespace qtgui {
+
+ /*!
+ * \brief A graphical sink to display multiple vector-based signals.
+ * \ingroup instrumentation_blk
+ * \ingroup qtgui_blk
+ *
+ * \details
+ * This is a QT-based graphical sink that plots vectors of data as-is.
+ * Each signal is plotted with a different color, and the set_title()
+ * and set_color() functions can be used to change the label and color
+ * for a given input number.
+ *
+ * To specify units for the x- and y-axes, use the set_x_axis_units()
+ * and set_y_axis_units() functions. This does not change the x- and
+ * y-labels, which are either specified during construction, or by
+ * calling the set_x_axis_label() and set_y_axis_label() methods.
+ */
+ class QTGUI_API vector_sink_f : virtual public sync_block
+ {
+ public:
+ // gr::qtgui::vector_sink_f::sptr
+ typedef boost::shared_ptr<vector_sink_f> sptr;
+
+ /*!
+ * \brief Build a vector plotting sink.
+ *
+ * \param vlen Vector length at input. This cannot be changed during
operations.
+ * \param x_start The x-Axis value of the first vector element
+ * \param x_step The step with which x-Axis values increment
+ * \param x_axis_label The X-Axis label
+ * \param y_axis_label The Y-Axis label
+ * \param name title for the plot
+ * \param nconnections number of signals connected to sink
+ * \param parent a QWidget parent object, if any
+ */
+ static sptr make(
+ int vlen,
+ double x_start,
+ double x_step,
+ const std::string &x_axis_label,
+ const std::string &y_axis_label,
+ const std::string &name,
+ int nconnections=1,
+ QWidget *parent=NULL
+ );
+
+ virtual void exec_() = 0;
+ virtual QWidget* qwidget() = 0;
+
+#ifdef ENABLE_PYTHON
+ virtual PyObject* pyqwidget() = 0;
+#else
+ virtual void* pyqwidget() = 0;
+#endif
+
+ virtual int vlen() const = 0;
+ virtual void set_vec_average(const float avg) = 0;
+ virtual float vec_average() const = 0;
+
+ //! Update the values on the x-Axis.
+ //
+ // \param start The value for the first vector element.
+ // \param step Increments per x-Axis value
+ virtual void set_x_axis(const double start, const double step) = 0;
+ virtual void set_y_axis(double min, double max) = 0;
+ //! The ref level is a reference line
+ virtual void set_ref_level(double ref_level) = 0;
+
+ virtual void set_x_axis_label(const std::string &label) = 0;
+ virtual void set_y_axis_label(const std::string &label) = 0;
+
+ //! Change the units string on the x-Axis (e.g. 'm' if x-Axis label was
'Distance')
+ virtual void set_x_axis_units(const std::string &units) = 0;
+ //! Change the units string on the y-Axis (e.g. 'V' if x-Axis label was
'Amplitude')
+ virtual void set_y_axis_units(const std::string &units) = 0;
+
+ virtual void set_update_time(double t) = 0;
+ virtual void set_title(const std::string &title) = 0;
+ virtual void set_line_label(int which, const std::string &label) = 0;
+ virtual void set_line_color(int which, const std::string &color) = 0;
+ virtual void set_line_width(int which, int width) = 0;
+ virtual void set_line_style(int which, int style) = 0;
+ virtual void set_line_marker(int which, int marker) = 0;
+ virtual void set_line_alpha(int which, double alpha) = 0;
+
+ virtual std::string title() = 0;
+ virtual std::string line_label(int which) = 0;
+ virtual std::string line_color(int which) = 0;
+ virtual int line_width(int which) = 0;
+ virtual int line_style(int which) = 0;
+ virtual int line_marker(int which) = 0;
+ virtual double line_alpha(int which) = 0;
+
+ virtual void set_size(int width, int height) = 0;
+
+ virtual void enable_menu(bool en=true) = 0;
+ virtual void enable_grid(bool en=true) = 0;
+ virtual void enable_autoscale(bool en=true) = 0;
+ virtual void clear_max_hold() = 0;
+ virtual void clear_min_hold() = 0;
+ virtual void reset() = 0;
+
+ QApplication *d_qApplication;
+ };
+
+ } /* namespace qtgui */
+} /* namespace gr */
+
+#endif /* INCLUDED_QTGUI_VECTOR_SINK_F_H */
diff --git a/gr-qtgui/include/gnuradio/qtgui/vectordisplayform.h
b/gr-qtgui/include/gnuradio/qtgui/vectordisplayform.h
new file mode 100644
index 0000000..942af84
--- /dev/null
+++ b/gr-qtgui/include/gnuradio/qtgui/vectordisplayform.h
@@ -0,0 +1,94 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2014 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef VECTOR_DISPLAY_FORM_H
+#define VECTOR_DISPLAY_FORM_H
+
+#include <gnuradio/qtgui/spectrumUpdateEvents.h>
+#include <gnuradio/qtgui/VectorDisplayPlot.h>
+#include <QtGui/QtGui>
+#include <vector>
+
+#include <gnuradio/qtgui/displayform.h>
+
+/*!
+ * \brief DisplayForm child for managing vector plots.
+ * \ingroup qtgui_blk
+ */
+class VectorDisplayForm : public DisplayForm
+{
+ Q_OBJECT
+
+public:
+ VectorDisplayForm(int nplots=1, QWidget* parent = 0);
+ ~VectorDisplayForm();
+
+ VectorDisplayPlot* getPlot();
+
+ int getVecSize() const;
+ float getVecAverage() const;
+
+ void setXAxisLabel(const QString &label);
+ void setYAxisLabel(const QString &label);
+ void setRefLevel(double refLevel);
+
+ // returns the x-Value that was last double-clicked on by the user
+ float getClickedXVal() const;
+
+ // checks if there was a double-click event; reset if there was
+ bool checkClicked();
+
+public slots:
+ void customEvent(QEvent *e);
+
+ void setVecSize(const int);
+ void setVecAverage(const float);
+
+ void setXaxis(double start, double step);
+ void setYaxis(double min, double max);
+ void setYMax(const QString &m);
+ void setYMin(const QString &m);
+ void autoScale(bool en);
+ void clearMaxHold();
+ void clearMinHold();
+
+private slots:
+ void newData(const QEvent *updateEvent);
+ void onPlotPointSelected(const QPointF p);
+
+private:
+ uint64_t d_num_real_data_points;
+ QIntValidator* d_int_validator;
+
+ int d_vecsize;
+ float d_vecavg;
+ double d_ref_level;
+
+ // TODO do I keep these?
+ bool d_clicked;
+ double d_clicked_x_level;
+
+ AverageMenu *d_avgmenu;
+ QAction *d_clearmin_act, *d_clearmax_act;
+};
+
+#endif /* VECTOR_DISPLAY_FORM_H */
diff --git a/gr-qtgui/lib/CMakeLists.txt b/gr-qtgui/lib/CMakeLists.txt
index 13a9bc6..57970b2 100644
--- a/gr-qtgui/lib/CMakeLists.txt
+++ b/gr-qtgui/lib/CMakeLists.txt
@@ -31,6 +31,7 @@ set(qtgui_moc_hdrs
${qtgui_mod_includedir}/waterfalldisplayform.h
${qtgui_mod_includedir}/histogramdisplayform.h
${qtgui_mod_includedir}/numberdisplayform.h
+ ${qtgui_mod_includedir}/vectordisplayform.h
${qtgui_mod_includedir}/form_menus.h
${qtgui_mod_includedir}/DisplayPlot.h
${qtgui_mod_includedir}/FrequencyDisplayPlot.h
@@ -39,6 +40,7 @@ set(qtgui_moc_hdrs
${qtgui_mod_includedir}/WaterfallDisplayPlot.h
${qtgui_mod_includedir}/ConstellationDisplayPlot.h
${qtgui_mod_includedir}/HistogramDisplayPlot.h
+ ${qtgui_mod_includedir}/VectorDisplayPlot.h
)
QT4_WRAP_CPP(qtgui_moc_sources ${qtgui_moc_hdrs})
QT4_WRAP_UI(qtgui_ui_hdrs spectrumdisplayform.ui)
@@ -62,6 +64,7 @@ set(qtgui_sources
waterfallGlobalData.cc
ConstellationDisplayPlot.cc
HistogramDisplayPlot.cc
+ VectorDisplayPlot.cc
spectrumdisplayform.cc
displayform.cc
timedisplayform.cc
@@ -90,6 +93,8 @@ set(qtgui_sources
number_sink_impl.cc
qtgui_util.cc
ber_sink_b_impl.cc
+ vectordisplayform.cc
+ vector_sink_f_impl.cc
)
#Add Windows DLL resource file if using MSVC
diff --git a/gr-qtgui/lib/VectorDisplayPlot.cc
b/gr-qtgui/lib/VectorDisplayPlot.cc
new file mode 100644
index 0000000..2babfea
--- /dev/null
+++ b/gr-qtgui/lib/VectorDisplayPlot.cc
@@ -0,0 +1,629 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2014 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef VECTOR_DISPLAY_PLOT
+#define VECTOR_DISPLAY_PLOT
+
+#include <gnuradio/qtgui/VectorDisplayPlot.h>
+
+#include <gnuradio/qtgui/qtgui_types.h>
+#include <qwt_scale_draw.h>
+#include <qwt_legend.h>
+#include <QColor>
+#include <iostream>
+
+#if QWT_VERSION < 0x060100
+#include <qwt_legend_item.h>
+#else /* QWT_VERSION < 0x060100 */
+#include <qwt_legend_data.h>
+#include <qwt_legend_label.h>
+#endif /* QWT_VERSION < 0x060100 */
+
+/***********************************************************************
+ * Widget to provide mouse pointer coordinate text
+ **********************************************************************/
+class VectorDisplayZoomer: public QwtPlotZoomer
+{
+public:
+#if QWT_VERSION < 0x060100
+ VectorDisplayZoomer(QwtPlotCanvas* canvas)
+#else /* QWT_VERSION < 0x060100 */
+ VectorDisplayZoomer(QWidget* canvas)
+#endif /* QWT_VERSION < 0x060100 */
+ : QwtPlotZoomer(canvas),
+ d_x_units(" "),
+ d_y_units(" ")
+ {
+ setTrackerMode(QwtPicker::AlwaysOn);
+ }
+
+ virtual void updateTrackerText()
+ {
+ updateDisplay();
+ }
+
+ void setXUnits(const QString &units)
+ {
+ d_x_units = units;
+ }
+
+ void setYUnits(const QString &units)
+ {
+ d_y_units = units;
+ }
+
+protected:
+ using QwtPlotZoomer::trackerText;
+ virtual QwtText trackerText(QPoint const &p) const
+ {
+ QwtDoublePoint dp = QwtPlotZoomer::invTransform(p);
+ QwtText t(QString("%1 %2, %3 %4")
+ .arg(dp.x(), 0, 'f', 2)
+ .arg(d_x_units)
+ .arg(dp.y(), 0, 'f', 2)
+ .arg(d_y_units)
+ );
+ return t;
+ }
+
+private:
+ QString d_x_units; //!< Units on x-Axis (e.g. Hz)
+ QString d_y_units; //!< Units on y-Axis (e.g. V)
+};
+
+
+/***********************************************************************
+ * Main frequency display plotter widget
+ **********************************************************************/
+VectorDisplayPlot::VectorDisplayPlot(int nplots, QWidget* parent)
+ : DisplayPlot(nplots, parent),
+ d_x_axis_label("x"),
+ d_y_axis_label("y")
+{
+ d_numPoints = 1024;
+ d_x_axis_start = 0;
+ d_x_axis_step = 1.0;
+ d_ymin = -10;
+ d_ymax = 10;
+
+ d_min_vec_data = new double[d_numPoints];
+ d_max_vec_data = new double[d_numPoints];
+ d_xdata = new double[d_numPoints];
+
+ setAxisTitle(QwtPlot::xBottom, d_x_axis_label);
+ setAxisScale(QwtPlot::xBottom, d_x_axis_start, d_numPoints-1);
+
+ setAxisScaleEngine(QwtPlot::yLeft, new QwtLinearScaleEngine);
+ setAxisScale(QwtPlot::yLeft, d_ymin, d_ymax);
+ setAxisTitle(QwtPlot::yLeft, d_y_axis_label);
+
+ QList<QColor> default_colors;
+ default_colors << QColor(Qt::blue) << QColor(Qt::red) << QColor(Qt::green)
+ << QColor(Qt::black) << QColor(Qt::cyan) << QColor(Qt::magenta)
+ << QColor(Qt::yellow) << QColor(Qt::gray) << QColor(Qt::darkRed)
+ << QColor(Qt::darkGreen) << QColor(Qt::darkBlue) <<
QColor(Qt::darkGray);
+
+ // Create a curve for each input
+ // Automatically deleted when parent is deleted
+ for(int i = 0; i < d_nplots; i++) {
+ d_ydata.push_back(new double[d_numPoints]);
+ memset(d_ydata[i], 0x0, d_numPoints*sizeof(double));
+
+ d_plot_curve.push_back(new QwtPlotCurve(QString("Data %1").arg(i)));
+ d_plot_curve[i]->attach(this);
+
+ QwtSymbol *symbol = new QwtSymbol(QwtSymbol::NoSymbol,
QBrush(default_colors[i]),
+ QPen(default_colors[i]), QSize(7,7));
+
+#if QWT_VERSION < 0x060000
+ d_plot_curve[i]->setRawData(d_xdata, d_ydata[i], d_numPoints);
+ d_plot_curve[i]->setSymbol(*symbol);
+#else
+ d_plot_curve[i]->setRawSamples(d_xdata, d_ydata[i], d_numPoints);
+ d_plot_curve[i]->setSymbol(symbol);
+#endif
+ setLineColor(i, default_colors[i]);
+ }
+
+ // Create min/max plotter curves
+ d_min_vec_plot_curve = new QwtPlotCurve("Min Hold");
+ d_min_vec_plot_curve->attach(this);
+ const QColor default_min_fft_color = Qt::magenta;
+ setMinVecColor(default_min_fft_color);
+#if QWT_VERSION < 0x060000
+ d_min_vec_plot_curve->setRawData(d_xdata, d_min_vec_data, d_numPoints);
+#else
+ d_min_vec_plot_curve->setRawSamples(d_xdata, d_min_vec_data, d_numPoints);
+#endif
+ d_min_vec_plot_curve->setVisible(false);
+ d_min_vec_plot_curve->setZ(0);
+
+ d_max_vec_plot_curve = new QwtPlotCurve("Max Hold");
+ d_max_vec_plot_curve->attach(this);
+ QColor default_max_fft_color = Qt::darkYellow;
+ setMaxVecColor(default_max_fft_color);
+#if QWT_VERSION < 0x060000
+ d_max_vec_plot_curve->setRawData(d_xdata, d_max_vec_data, d_numPoints);
+#else
+ d_max_vec_plot_curve->setRawSamples(d_xdata, d_max_vec_data, d_numPoints);
+#endif
+ d_max_vec_plot_curve->setVisible(false);
+ d_max_vec_plot_curve->setZ(0);
+
+ d_lower_intensity_marker= new QwtPlotMarker();
+ d_lower_intensity_marker->setLineStyle(QwtPlotMarker::HLine);
+ QColor default_marker_lower_intensity_color = Qt::cyan;
+ setMarkerLowerIntensityColor(default_marker_lower_intensity_color);
+ d_lower_intensity_marker->attach(this);
+
+ d_upper_intensity_marker = new QwtPlotMarker();
+ d_upper_intensity_marker->setLineStyle(QwtPlotMarker::HLine);
+ QColor default_marker_upper_intensity_color = Qt::green;
+ setMarkerUpperIntensityColor(default_marker_upper_intensity_color);
+ d_upper_intensity_marker->attach(this);
+
+ memset(d_xdata, 0x0, d_numPoints*sizeof(double));
+
+ for(int64_t number = 0; number < d_numPoints; number++){
+ d_min_vec_data[number] = 1e6;
+ d_max_vec_data[number] = -1e6;
+ }
+
+ d_marker_ref_level = new QwtPlotMarker();
+ d_marker_ref_level->setLineStyle(QwtPlotMarker::HLine);
+ QColor d_default_marker_ref_level_color = Qt::darkRed;
+ setMarkerRefLevelAmplitudeColor(d_default_marker_ref_level_color);
+ d_marker_ref_level->attach(this);
+
+ d_ref_level = -HUGE_VAL;
+
+ d_zoomer = new VectorDisplayZoomer(canvas());
+
+#if QWT_VERSION < 0x060000
+ d_zoomer->setSelectionFlags(QwtPicker::RectSelection |
QwtPicker::DragSelection);
+#endif
+
+ d_zoomer->setMousePattern(QwtEventPattern::MouseSelect2,
+ Qt::RightButton, Qt::ControlModifier);
+ d_zoomer->setMousePattern(QwtEventPattern::MouseSelect3,
+ Qt::RightButton);
+
+
+ const QColor default_zoomer_color(Qt::darkRed);
+ setZoomerColor(default_zoomer_color);
+
+ // Do this after the zoomer has been built
+ _resetXAxisPoints();
+
+ // Turn off min/max hold plots in legend
+#if QWT_VERSION < 0x060100
+ QWidget *w;
+ QwtLegend* legendDisplay = legend();
+ w = legendDisplay->find(d_min_vec_plot_curve);
+ ((QwtLegendItem*)w)->setChecked(true);
+ w = legendDisplay->find(d_max_vec_plot_curve);
+ ((QwtLegendItem*)w)->setChecked(true);
+#else /* QWT_VERSION < 0x060100 */
+ QWidget *w;
+ w = ((QwtLegend*)legend())->legendWidget(itemToInfo(d_min_vec_plot_curve));
+ ((QwtLegendLabel*)w)->setChecked(true);
+ w = ((QwtLegend*)legend())->legendWidget(itemToInfo(d_max_vec_plot_curve));
+ ((QwtLegendLabel*)w)->setChecked(true);
+#endif /* QWT_VERSION < 0x060100 */
+
+ replot();
+}
+
+VectorDisplayPlot::~VectorDisplayPlot()
+{
+ for(int i = 0; i < d_nplots; i++)
+ delete [] d_ydata[i];
+ delete[] d_max_vec_data;
+ delete[] d_min_vec_data;
+ delete[] d_xdata;
+}
+
+void
+VectorDisplayPlot::setYaxis(double min, double max)
+{
+ // Get the new max/min values for the plot
+ d_ymin = min;
+ d_ymax = max;
+
+ // Set the axis max/min to the new values
+ setAxisScale(QwtPlot::yLeft, d_ymin, d_ymax);
+
+ // Reset the base zoom level to the new axis scale set here.
+ // But don't do it if we set the axis due to auto scaling.
+ if(!d_autoscale_state)
+ d_zoomer->setZoomBase();
+}
+
+double
+VectorDisplayPlot::getYMin() const
+{
+ return d_ymin;
+}
+
+double
+VectorDisplayPlot::getYMax() const
+{
+ return d_ymax;
+}
+
+void VectorDisplayPlot::setXAxisLabel(const QString &label)
+{
+ d_x_axis_label = label;
+ setAxisTitle(QwtPlot::xBottom, label);
+}
+
+void VectorDisplayPlot::setYAxisLabel(const QString &label)
+{
+ d_y_axis_label = label;
+ setAxisTitle(QwtPlot::yLeft, label);
+}
+
+void VectorDisplayPlot::setXAxisUnit(const QString &unit)
+{
+ ((VectorDisplayZoomer*)d_zoomer)->setXUnits(unit);
+}
+
+void VectorDisplayPlot::setYAxisUnit(const QString &unit)
+{
+ ((VectorDisplayZoomer*)d_zoomer)->setYUnits(unit);
+}
+
+void
+VectorDisplayPlot::setXAxisValues(
+ const double start,
+ const double step
+) {
+ bool reset = false;
+ if((start != d_x_axis_start) || (step != d_x_axis_step))
+ reset = true;
+
+ d_x_axis_start = start;
+ d_x_axis_step = step;
+
+ if((axisScaleDraw(QwtPlot::xBottom) != NULL) && (d_zoomer != NULL)) {
+ setAxisTitle(QwtPlot::xBottom, d_x_axis_label);
+ if(reset) {
+ _resetXAxisPoints();
+ clearMaxData();
+ clearMinData();
+ }
+ }
+}
+
+void
+VectorDisplayPlot::replot()
+{
+ d_marker_ref_level->setYValue(d_ref_level);
+ QwtPlot::replot();
+}
+
+void
+VectorDisplayPlot::plotNewData(
+ const std::vector<double*> dataPoints,
+ const int64_t numDataPoints,
+ const double refLevel,
+ const double timeInterval
+) {
+ if(!d_stop) {
+ if(numDataPoints > 0) {
+ if(numDataPoints != d_numPoints) {
+ d_numPoints = numDataPoints;
+
+ delete[] d_min_vec_data;
+ delete[] d_max_vec_data;
+ delete[] d_xdata;
+ d_xdata = new double[d_numPoints];
+ d_min_vec_data = new double[d_numPoints];
+ d_max_vec_data = new double[d_numPoints];
+
+ for(int i = 0; i < d_nplots; i++) {
+ delete[] d_ydata[i];
+ d_ydata[i] = new double[d_numPoints];
+
+#if QWT_VERSION < 0x060000
+ d_plot_curve[i]->setRawData(d_xdata, d_ydata[i], d_numPoints);
+#else
+ d_plot_curve[i]->setRawSamples(d_xdata, d_ydata[i], d_numPoints);
+#endif
+ }
+#if QWT_VERSION < 0x060000
+ d_min_vec_plot_curve->setRawData(d_xdata, d_min_vec_data, d_numPoints);
+ d_max_vec_plot_curve->setRawData(d_xdata, d_max_vec_data, d_numPoints);
+#else
+ d_min_vec_plot_curve->setRawSamples(d_xdata, d_min_vec_data,
d_numPoints);
+ d_max_vec_plot_curve->setRawSamples(d_xdata, d_max_vec_data,
d_numPoints);
+#endif
+ _resetXAxisPoints();
+ clearMaxData();
+ clearMinData();
+ }
+
+ double bottom=1e20, top=-1e20;
+ for(int n = 0; n < d_nplots; n++) {
+
+ memcpy(d_ydata[n], dataPoints[n], numDataPoints*sizeof(double));
+
+ for(int64_t point = 0; point < numDataPoints; point++) {
+ if(dataPoints[n][point] < d_min_vec_data[point]) {
+ d_min_vec_data[point] = dataPoints[n][point];
+ }
+ if(dataPoints[n][point] > d_max_vec_data[point]) {
+ d_max_vec_data[point] = dataPoints[n][point];
+ }
+
+ // Find overall top and bottom values in plot.
+ // Used for autoscaling y-axis.
+ if(dataPoints[n][point] < bottom) {
+ bottom = dataPoints[n][point];
+ }
+ if(dataPoints[n][point] > top) {
+ top = dataPoints[n][point];
+ }
+ }
+ }
+
+ if(d_autoscale_state)
+ _autoScale(bottom, top);
+
+ d_ref_level = refLevel;
+
+ replot();
+ }
+ }
+}
+
+void
+VectorDisplayPlot::clearMaxData()
+{
+ for(int64_t number = 0; number < d_numPoints; number++) {
+ d_max_vec_data[number] = d_ymin;
+ }
+}
+
+void
+VectorDisplayPlot::clearMinData()
+{
+ for(int64_t number = 0; number < d_numPoints; number++) {
+ d_min_vec_data[number] = d_ymax;
+ }
+}
+
+void
+VectorDisplayPlot::_autoScale(double bottom, double top)
+{
+ // Auto scale the y-axis with a margin of 10 dB on either side.
+ d_ymin = bottom-10;
+ d_ymax = top+10;
+ setYaxis(d_ymin, d_ymax);
+}
+
+void
+VectorDisplayPlot::setAutoScale(bool state)
+{
+ d_autoscale_state = state;
+}
+
+void
+VectorDisplayPlot::setMaxVecVisible(const bool visibleFlag)
+{
+ d_max_vec_visible = visibleFlag;
+ d_max_vec_plot_curve->setVisible(visibleFlag);
+}
+
+const bool
+VectorDisplayPlot::getMaxVecVisible() const
+{
+ return d_max_vec_visible;
+}
+
+void
+VectorDisplayPlot::setMinVecVisible(const bool visibleFlag)
+{
+ d_min_vec_visible = visibleFlag;
+ d_min_vec_plot_curve->setVisible(visibleFlag);
+}
+
+const bool
+VectorDisplayPlot::getMinVecVisible() const
+{
+ return d_min_vec_visible;
+}
+
+void
+VectorDisplayPlot::_resetXAxisPoints()
+{
+ double xValue = d_x_axis_start;
+ for(int64_t loc = 0; loc < d_numPoints; loc++) {
+ d_xdata[loc] = xValue;
+ xValue += d_x_axis_step;
+ }
+
+ setAxisScale(QwtPlot::xBottom, d_xdata[0], d_xdata[d_numPoints-1]);
+
+ // Set up zoomer base for maximum unzoom x-axis
+ // and reset to maximum unzoom level
+ QwtDoubleRect zbase = d_zoomer->zoomBase();
+ d_zoomer->zoom(zbase);
+ d_zoomer->setZoomBase(zbase);
+ d_zoomer->setZoomBase(true);
+ d_zoomer->zoom(0);
+}
+
+void
+VectorDisplayPlot::setLowerIntensityLevel(const double lowerIntensityLevel)
+{
+ d_lower_intensity_marker->setYValue(lowerIntensityLevel);
+}
+
+void
+VectorDisplayPlot::setUpperIntensityLevel(const double upperIntensityLevel)
+{
+ d_upper_intensity_marker->setYValue(upperIntensityLevel);
+}
+
+void
+VectorDisplayPlot::setTraceColour(QColor c)
+{
+ d_plot_curve[0]->setPen(QPen(c));
+}
+
+void
+VectorDisplayPlot::setBGColour(QColor c)
+{
+ QPalette palette;
+ palette.setColor(canvas()->backgroundRole(), c);
+ canvas()->setPalette(palette);
+}
+
+void
+VectorDisplayPlot::onPickerPointSelected(const QwtDoublePoint & p)
+{
+ QPointF point = p;
+ point.setX(point.x());
+ emit plotPointSelected(point);
+}
+
+void
+VectorDisplayPlot::onPickerPointSelected6(const QPointF & p)
+{
+ QPointF point = p;
+ point.setX(point.x());
+ emit plotPointSelected(point);
+}
+
+void
+VectorDisplayPlot::setMinVecColor (QColor c)
+{
+ d_min_vec_color = c;
+ d_min_vec_plot_curve->setPen(QPen(c));
+}
+
+const QColor
+VectorDisplayPlot::getMinVecColor() const
+{
+ return d_min_vec_color;
+}
+
+void
+VectorDisplayPlot::setMaxVecColor (QColor c)
+{
+ d_max_vec_color = c;
+ d_max_vec_plot_curve->setPen(QPen(c));
+}
+
+const QColor
+VectorDisplayPlot::getMaxVecColor() const
+{
+ return d_max_vec_color;
+}
+
+void
+VectorDisplayPlot::setMarkerLowerIntensityColor (QColor c)
+{
+ d_marker_lower_intensity_color = c;
+ d_lower_intensity_marker->setLinePen(QPen(c));
+}
+const QColor
+VectorDisplayPlot::getMarkerLowerIntensityColor () const
+{
+ return d_marker_lower_intensity_color;
+}
+
+void
+VectorDisplayPlot::setMarkerLowerIntensityVisible (bool visible)
+{
+ d_marker_lower_intensity_visible = visible;
+ if(visible)
+ d_lower_intensity_marker->setLineStyle(QwtPlotMarker::HLine);
+ else
+ d_lower_intensity_marker->setLineStyle(QwtPlotMarker::NoLine);
+}
+const bool
+VectorDisplayPlot::getMarkerLowerIntensityVisible() const
+{
+ return d_marker_lower_intensity_visible;
+}
+
+void
+VectorDisplayPlot::setMarkerUpperIntensityColor(QColor c)
+{
+ d_marker_upper_intensity_color = c;
+ d_upper_intensity_marker->setLinePen(QPen(c, 0, Qt::DotLine));
+}
+
+const QColor
+VectorDisplayPlot::getMarkerUpperIntensityColor() const
+{
+ return d_marker_upper_intensity_color;
+}
+
+void
+VectorDisplayPlot::setMarkerUpperIntensityVisible(bool visible)
+{
+ d_marker_upper_intensity_visible = visible;
+ if(visible)
+ d_upper_intensity_marker->setLineStyle(QwtPlotMarker::HLine);
+ else
+ d_upper_intensity_marker->setLineStyle(QwtPlotMarker::NoLine);
+}
+
+const bool
+VectorDisplayPlot::getMarkerUpperIntensityVisible() const
+{
+ return d_marker_upper_intensity_visible;
+}
+
+void
+VectorDisplayPlot::setMarkerRefLevelAmplitudeColor(QColor c)
+{
+ d_marker_ref_level_color = c;
+ d_marker_ref_level->setLinePen(QPen(c, 0, Qt::DotLine));
+}
+
+const QColor
+VectorDisplayPlot::getMarkerRefLevelAmplitudeColor() const
+{
+ return d_marker_ref_level_color;
+}
+
+void
+VectorDisplayPlot::setMarkerRefLevelAmplitudeVisible(bool visible)
+{
+ d_marker_ref_level_visible = visible;
+ if(visible)
+ d_marker_ref_level->setLineStyle(QwtPlotMarker::HLine);
+ else
+ d_marker_ref_level->setLineStyle(QwtPlotMarker::NoLine);
+}
+
+const bool
+VectorDisplayPlot::getMarkerRefLevelAmplitudeVisible() const
+{
+ return d_marker_ref_level_visible;
+}
+
+#endif /* VECTOR_DISPLAY_PLOT */
diff --git a/gr-qtgui/lib/vector_sink_f_impl.cc
b/gr-qtgui/lib/vector_sink_f_impl.cc
new file mode 100644
index 0000000..0644071
--- /dev/null
+++ b/gr-qtgui/lib/vector_sink_f_impl.cc
@@ -0,0 +1,437 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2012,2014 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "vector_sink_f_impl.h"
+#include <gnuradio/io_signature.h>
+#include <gnuradio/prefs.h>
+#include <string.h>
+#include <volk/volk.h>
+#include <qwt_symbol.h>
+
+namespace gr {
+ namespace qtgui {
+
+ static const std::string MSG_PORT_OUT_XVAL = "xval";
+
+ vector_sink_f::sptr
+ vector_sink_f::make(
+ int vlen,
+ double x_start,
+ double x_step,
+ const std::string &x_axis_label,
+ const std::string &y_axis_label,
+ const std::string &name,
+ int nconnections,
+ QWidget *parent
+ ) {
+ return gnuradio::get_initial_sptr (
+ new vector_sink_f_impl(
+ vlen,
+ x_start,
+ x_step,
+ x_axis_label,
+ y_axis_label,
+ name,
+ nconnections,
+ parent
+ )
+ );
+ }
+
+ vector_sink_f_impl::vector_sink_f_impl(
+ int vlen,
+ double x_start,
+ double x_step,
+ const std::string &x_axis_label,
+ const std::string &y_axis_label,
+ const std::string &name,
+ int nconnections,
+ QWidget *parent
+ ) : sync_block("vector_sink_f",
+ io_signature::make(1, -1, sizeof(float) * vlen),
+ io_signature::make(0, 0, 0)),
+ d_vlen(vlen),
+ d_vecavg(1.0),
+ d_name(name),
+ d_nconnections(nconnections),
+ d_msg_key("x"),
+ d_parent(parent)
+ {
+ // Required now for Qt; argc must be greater than 0 and argv
+ // must have at least one valid character. Must be valid through
+ // life of the qApplication:
+ // http://harmattan-dev.nokia.com/docs/library/html/qt4/qapplication.html
+ d_argc = 1;
+ d_argv = new char;
+ d_argv[0] = '\0';
+
+ // setup output message port to post frequency when display is
+ // double-clicked
+ message_port_register_out(pmt::mp(MSG_PORT_OUT_XVAL));
+
+ d_main_gui = NULL;
+
+ for(int i = 0; i < d_nconnections; i++) {
+ d_magbufs.push_back((double*)volk_malloc(d_vlen*sizeof(double),
volk_get_alignment()));
+ memset(d_magbufs[i], 0, d_vlen*sizeof(double));
+ }
+
+ initialize(
+ name,
+ x_axis_label,
+ y_axis_label,
+ x_start,
+ x_step
+ );
+ }
+
+ vector_sink_f_impl::~vector_sink_f_impl()
+ {
+ if (!d_main_gui->isClosed()) {
+ d_main_gui->close();
+ }
+
+ for(int i = 0; i < d_nconnections; i++) {
+ volk_free(d_magbufs[i]);
+ }
+
+ delete d_argv;
+ }
+
+ bool
+ vector_sink_f_impl::check_topology(int ninputs, int noutputs)
+ {
+ return ninputs == d_nconnections;
+ }
+
+ void
+ vector_sink_f_impl::initialize(
+ const std::string &name,
+ const std::string &x_axis_label,
+ const std::string &y_axis_label,
+ double x_start,
+ double x_step
+ ) {
+ if(qApp != NULL) {
+ d_qApplication = qApp;
+ }
+ else {
+#if QT_VERSION >= 0x040500
+ std::string style = prefs::singleton()->get_string("qtgui", "style",
"raster");
+ QApplication::setGraphicsSystem(QString(style.c_str()));
+#endif
+ d_qApplication = new QApplication(d_argc, &d_argv);
+ }
+
+ // If a style sheet is set in the prefs file, enable it here.
+ std::string qssfile = prefs::singleton()->get_string("qtgui","qss","");
+ if(qssfile.size() > 0) {
+ QString sstext = get_qt_style_sheet(QString(qssfile.c_str()));
+ d_qApplication->setStyleSheet(sstext);
+ }
+
+ d_main_gui = new VectorDisplayForm(d_nconnections, d_parent);
+ d_main_gui->setVecSize(d_vlen);
+ set_x_axis(x_start, x_step);
+
+ if(not name.empty())
+ set_title(name);
+ set_x_axis_label(x_axis_label);
+ set_y_axis_label(y_axis_label);
+
+ // initialize update time to 10 times a second
+ set_update_time(0.1);
+ }
+
+ void
+ vector_sink_f_impl::exec_()
+ {
+ d_qApplication->exec();
+ }
+
+ QWidget*
+ vector_sink_f_impl::qwidget()
+ {
+ return d_main_gui;
+ }
+
+#ifdef ENABLE_PYTHON
+ PyObject*
+ vector_sink_f_impl::pyqwidget()
+ {
+ PyObject *w = PyLong_FromVoidPtr((void*)d_main_gui);
+ PyObject *retarg = Py_BuildValue("N", w);
+ return retarg;
+ }
+#else
+ void *
+ vector_sink_f_impl::pyqwidget()
+ {
+ return NULL;
+ }
+#endif
+
+ int
+ vector_sink_f_impl::vlen() const
+ {
+ return d_vlen;
+ }
+
+ void
+ vector_sink_f_impl::set_vec_average(const float avg)
+ {
+ if (avg < 0 or avg > 1.0) {
+ GR_LOG_ALERT(d_logger, "Invalid average value received in
set_vec_average(), must be within [0, 1].");
+ return;
+ }
+ d_main_gui->setVecAverage(avg);
+ d_vecavg = avg;
+ }
+
+ float
+ vector_sink_f_impl::vec_average() const
+ {
+ return d_vecavg;
+ }
+
+ void
+ vector_sink_f_impl::set_x_axis(const double start, const double step)
+ {
+ d_main_gui->setXaxis(start, step);
+ }
+
+ void
+ vector_sink_f_impl::set_y_axis(double min, double max)
+ {
+ d_main_gui->setYaxis(min, max);
+ }
+
+ void
+ vector_sink_f_impl::set_ref_level(double ref_level)
+ {
+ d_main_gui->setRefLevel(ref_level);
+ }
+
+ void
+ vector_sink_f_impl::set_x_axis_label(const std::string &label)
+ {
+ d_main_gui->setXAxisLabel(label.c_str());
+ }
+
+ void
+ vector_sink_f_impl::set_y_axis_label(const std::string &label)
+ {
+ d_main_gui->setYAxisLabel(label.c_str());
+ }
+
+ void
+ vector_sink_f_impl::set_x_axis_units(const std::string &units)
+ {
+ d_main_gui->getPlot()->setXAxisUnit(units.c_str());
+ }
+
+ void
+ vector_sink_f_impl::set_y_axis_units(const std::string &units)
+ {
+ d_main_gui->getPlot()->setYAxisUnit(units.c_str());
+ }
+
+ void
+ vector_sink_f_impl::set_update_time(double t)
+ {
+ //convert update time to ticks
+ gr::high_res_timer_type tps = gr::high_res_timer_tps();
+ d_update_time = t * tps;
+ d_main_gui->setUpdateTime(t);
+ d_last_time = 0;
+ }
+
+ void
+ vector_sink_f_impl::set_title(const std::string &title)
+ {
+ d_main_gui->setTitle(title.c_str());
+ }
+
+ void
+ vector_sink_f_impl::set_line_label(int which, const std::string &label)
+ {
+ d_main_gui->setLineLabel(which, label.c_str());
+ }
+
+ void
+ vector_sink_f_impl::set_line_color(int which, const std::string &color)
+ {
+ d_main_gui->setLineColor(which, color.c_str());
+ }
+
+ void
+ vector_sink_f_impl::set_line_width(int which, int width)
+ {
+ d_main_gui->setLineWidth(which, width);
+ }
+
+ void
+ vector_sink_f_impl::set_line_style(int which, int style)
+ {
+ d_main_gui->setLineStyle(which, (Qt::PenStyle)style);
+ }
+
+ void
+ vector_sink_f_impl::set_line_marker(int which, int marker)
+ {
+ d_main_gui->setLineMarker(which, (QwtSymbol::Style)marker);
+ }
+
+ void
+ vector_sink_f_impl::set_line_alpha(int which, double alpha)
+ {
+ d_main_gui->setMarkerAlpha(which, (int)(255.0*alpha));
+ }
+
+ void
+ vector_sink_f_impl::set_size(int width, int height)
+ {
+ d_main_gui->resize(QSize(width, height));
+ }
+
+ std::string
+ vector_sink_f_impl::title()
+ {
+ return d_main_gui->title().toStdString();
+ }
+
+ std::string
+ vector_sink_f_impl::line_label(int which)
+ {
+ return d_main_gui->lineLabel(which).toStdString();
+ }
+
+ std::string
+ vector_sink_f_impl::line_color(int which)
+ {
+ return d_main_gui->lineColor(which).toStdString();
+ }
+
+ int
+ vector_sink_f_impl::line_width(int which)
+ {
+ return d_main_gui->lineWidth(which);
+ }
+
+ int
+ vector_sink_f_impl::line_style(int which)
+ {
+ return d_main_gui->lineStyle(which);
+ }
+
+ int
+ vector_sink_f_impl::line_marker(int which)
+ {
+ return d_main_gui->lineMarker(which);
+ }
+
+ double
+ vector_sink_f_impl::line_alpha(int which)
+ {
+ return (double)(d_main_gui->markerAlpha(which))/255.0;
+ }
+
+ void
+ vector_sink_f_impl::enable_menu(bool en)
+ {
+ d_main_gui->enableMenu(en);
+ }
+
+ void
+ vector_sink_f_impl::enable_grid(bool en)
+ {
+ d_main_gui->setGrid(en);
+ }
+
+ void
+ vector_sink_f_impl::enable_autoscale(bool en)
+ {
+ d_main_gui->autoScale(en);
+ }
+
+ void
+ vector_sink_f_impl::clear_max_hold()
+ {
+ d_main_gui->clearMaxHold();
+ }
+
+ void
+ vector_sink_f_impl::clear_min_hold()
+ {
+ d_main_gui->clearMinHold();
+ }
+
+ void
+ vector_sink_f_impl::reset()
+ {
+ // nop
+ }
+
+ void
+ vector_sink_f_impl::check_clicked()
+ {
+ if(d_main_gui->checkClicked()) {
+ double xval = d_main_gui->getClickedXVal();
+ message_port_pub(
+ pmt::mp(MSG_PORT_OUT_XVAL),
+ pmt::cons(pmt::mp(d_msg_key), pmt::from_double(xval))
+ );
+ }
+ }
+
+ int
+ vector_sink_f_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items
+ ) {
+ const float *in = (const float*) input_items[0];
+
+ // See if we generate a message
+ check_clicked();
+
+ for(int i = 0; i < noutput_items; i++) {
+ if(gr::high_res_timer_now() - d_last_time > d_update_time) {
+ for(int n = 0; n < d_nconnections; n++) {
+ in = ((const float*)input_items[n]) + d_vlen;
+ for(int x = 0; x < d_vlen; x++) {
+ d_magbufs[n][x] = (double)((1.0-d_vecavg)*d_magbufs[n][x] +
(d_vecavg)*in[x]);
+ }
+ }
+ d_last_time = gr::high_res_timer_now();
+ d_qApplication->postEvent(d_main_gui, new
FreqUpdateEvent(d_magbufs, d_vlen));
+ }
+ }
+
+ return noutput_items;
+ }
+
+ } /* namespace qtgui */
+} /* namespace gr */
diff --git a/gr-qtgui/lib/vector_sink_f_impl.h
b/gr-qtgui/lib/vector_sink_f_impl.h
new file mode 100644
index 0000000..12cf362
--- /dev/null
+++ b/gr-qtgui/lib/vector_sink_f_impl.h
@@ -0,0 +1,142 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_QTGUI_VECTOR_SINK_F_IMPL_H
+#define INCLUDED_QTGUI_VECTOR_SINK_F_IMPL_H
+
+#include <gnuradio/qtgui/vector_sink_f.h>
+#include <gnuradio/high_res_timer.h>
+#include <gnuradio/qtgui/vectordisplayform.h>
+
+namespace gr {
+ namespace qtgui {
+
+ class QTGUI_API vector_sink_f_impl : public vector_sink_f
+ {
+ private:
+ void initialize(
+ const std::string &name,
+ const std::string &x_axis_label,
+ const std::string &y_axis_label,
+ double x_start,
+ double x_step
+ );
+
+ const int d_vlen; //!< Vector length at input
+ float d_vecavg;
+
+ std::string d_name; //!< Initial title of the plot
+ int d_nconnections; //!< Number of connected streaming ports on input
+ std::string d_msg_key; //!< Key of outgoing messages
+
+ std::vector<double*> d_magbufs;
+
+
+ int d_argc;
+ char *d_argv;
+ QWidget *d_parent;
+ VectorDisplayForm *d_main_gui;
+
+ gr::high_res_timer_type d_update_time;
+ gr::high_res_timer_type d_last_time;
+
+ // TODO remove this?
+ void check_clicked();
+
+ // Handles message input port for setting new center frequency.
+ // The message is a PMT pair (intern('freq'), double(frequency)).
+ void handle_set_freq(pmt::pmt_t msg);
+
+ public:
+ vector_sink_f_impl(
+ int vlen,
+ double x_start,
+ double x_step,
+ const std::string &x_axis_label,
+ const std::string &y_axis_label,
+ const std::string &name,
+ int nconnections,
+ QWidget *parent=NULL
+ );
+ ~vector_sink_f_impl();
+
+ bool check_topology(int ninputs, int noutputs);
+
+ void exec_();
+ QWidget* qwidget();
+
+#ifdef ENABLE_PYTHON
+ PyObject* pyqwidget();
+#else
+ void* pyqwidget();
+#endif
+
+ int vlen() const;
+ void set_vec_average(const float avg);
+ float vec_average() const;
+
+ void set_frequency_range(const double centerfreq, const double
bandwidth);
+ void set_x_axis(const double start, const double step);
+ void set_y_axis(double min, double max);
+ void set_ref_level(double ref_level);
+
+ void set_x_axis_label(const std::string &label);
+ void set_y_axis_label(const std::string &label);
+
+ void set_x_axis_units(const std::string &units);
+ void set_y_axis_units(const std::string &units);
+
+ void set_update_time(double t);
+ void set_title(const std::string &title);
+ void set_line_label(int which, const std::string &label);
+ void set_line_color(int which, const std::string &color);
+ void set_line_width(int which, int width);
+ void set_line_style(int which, int style);
+ void set_line_marker(int which, int marker);
+ void set_line_alpha(int which, double alpha);
+
+ std::string title();
+ std::string line_label(int which);
+ std::string line_color(int which);
+ int line_width(int which);
+ int line_style(int which);
+ int line_marker(int which);
+ double line_alpha(int which);
+
+ void set_size(int width, int height);
+
+ void enable_menu(bool en);
+ void enable_grid(bool en);
+ void enable_autoscale(bool en);
+ void clear_max_hold();
+ void clear_min_hold();
+ void reset();
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace qtgui */
+} /* namespace gr */
+
+#endif /* INCLUDED_QTGUI_VECTOR_SINK_F_IMPL_H */
diff --git a/gr-qtgui/lib/vectordisplayform.cc
b/gr-qtgui/lib/vectordisplayform.cc
new file mode 100644
index 0000000..7eb5c45
--- /dev/null
+++ b/gr-qtgui/lib/vectordisplayform.cc
@@ -0,0 +1,235 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2014 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <cmath>
+#include <QMessageBox>
+#include <gnuradio/qtgui/vectordisplayform.h>
+#include <iostream>
+
+VectorDisplayForm::VectorDisplayForm(int nplots, QWidget* parent)
+ : DisplayForm(nplots, parent)
+{
+ d_int_validator = new QIntValidator(this);
+ d_int_validator->setBottom(0);
+
+ d_layout = new QGridLayout(this);
+ d_display_plot = new VectorDisplayPlot(nplots, this);
+ d_layout->addWidget(d_display_plot, 0, 0);
+ setLayout(d_layout);
+
+ d_num_real_data_points = 1024;
+ d_vecsize = 1024;
+ d_vecavg = 1.0;
+ d_ref_level = 0.0;
+ d_clicked = false;
+ d_clicked_x_level = 0;
+
+ d_avgmenu = new AverageMenu("Average", this);
+ d_menu->addMenu(d_avgmenu);
+ connect(d_avgmenu, SIGNAL(whichTrigger(float)),
+ this, SLOT(setVecAverage(const float)));
+
+ PopupMenu *maxymenu = new PopupMenu("Y Max", this);
+ d_menu->addAction(maxymenu);
+ connect(maxymenu, SIGNAL(whichTrigger(QString)),
+ this, SLOT(setYMax(QString)));
+
+ PopupMenu *minymenu = new PopupMenu("Y Min", this);
+ d_menu->addAction(minymenu);
+ connect(minymenu, SIGNAL(whichTrigger(QString)),
+ this, SLOT(setYMin(QString)));
+
+ d_clearmax_act = new QAction("Clear Max", this);
+ d_menu->addAction(d_clearmax_act);
+ connect(d_clearmax_act, SIGNAL(triggered()),
+ this, SLOT(clearMaxHold()));
+ d_clearmin_act = new QAction("Clear Min", this);
+ d_menu->addAction(d_clearmin_act);
+ connect(d_clearmin_act, SIGNAL(triggered()),
+ this, SLOT(clearMinHold()));
+
+ Reset();
+
+ connect(d_display_plot, SIGNAL(plotPointSelected(const QPointF)),
+ this, SLOT(onPlotPointSelected(const QPointF)));
+}
+
+VectorDisplayForm::~VectorDisplayForm()
+{
+ // Qt deletes children when parent is deleted
+
+ // Don't worry about deleting Display Plots - they are deleted when parents
are deleted
+ delete d_int_validator;
+}
+
+VectorDisplayPlot*
+VectorDisplayForm::getPlot()
+{
+ return ((VectorDisplayPlot*)d_display_plot);
+}
+
+void
+VectorDisplayForm::newData(const QEvent *updateEvent)
+{
+ FreqUpdateEvent *fevent = (FreqUpdateEvent*)updateEvent;
+ const std::vector<double*> dataPoints = fevent->getPoints();
+ const uint64_t numDataPoints = fevent->getNumDataPoints();
+
+ getPlot()->plotNewData(
+ dataPoints,
+ numDataPoints,
+ d_ref_level,
+ d_update_time
+ );
+}
+
+void
+VectorDisplayForm::customEvent( QEvent * e)
+{
+ // We just re-use FreqUpdateEvent as long as that works
+ if(e->type() == FreqUpdateEvent::Type()) {
+ newData(e);
+ }
+}
+
+int
+VectorDisplayForm::getVecSize() const
+{
+ return d_vecsize;
+}
+
+float
+VectorDisplayForm::getVecAverage() const
+{
+ return d_vecavg;
+}
+
+void VectorDisplayForm::setXAxisLabel(const QString &label)
+{
+ getPlot()->setXAxisLabel(label);
+}
+
+void VectorDisplayForm::setYAxisLabel(const QString &label)
+{
+ getPlot()->setYAxisLabel(label);
+}
+
+void VectorDisplayForm::setRefLevel(double refLevel)
+{
+ d_ref_level = refLevel;
+}
+
+void
+VectorDisplayForm::setVecSize(const int newsize)
+{
+ d_vecsize = newsize;
+ getPlot()->replot();
+}
+
+void
+VectorDisplayForm::setVecAverage(const float newavg)
+{
+ d_vecavg = newavg;
+ d_avgmenu->getActionFromAvg(newavg)->setChecked(true);
+ getPlot()->replot();
+}
+
+void VectorDisplayForm::setXaxis(double start, double step)
+{
+ getPlot()->setXAxisValues(start, step);
+}
+
+void
+VectorDisplayForm::setYaxis(double min, double max)
+{
+ getPlot()->setYaxis(min, max);
+}
+
+void
+VectorDisplayForm::setYMax(const QString &m)
+{
+ double new_max = m.toDouble();
+ double cur_ymin = getPlot()->getYMin();
+ if(new_max > cur_ymin)
+ setYaxis(cur_ymin, new_max);
+}
+
+void
+VectorDisplayForm::setYMin(const QString &m)
+{
+ double new_min = m.toDouble();
+ double cur_ymax = getPlot()->getYMax();
+ if(new_min < cur_ymax)
+ setYaxis(new_min, cur_ymax);
+}
+
+void
+VectorDisplayForm::autoScale(bool en)
+{
+ if(en) {
+ d_autoscale_state = true;
+ }
+ else {
+ d_autoscale_state = false;
+ }
+
+ d_autoscale_act->setChecked(en);
+ getPlot()->setAutoScale(d_autoscale_state);
+ getPlot()->replot();
+}
+
+void
+VectorDisplayForm::clearMaxHold()
+{
+ getPlot()->clearMaxData();
+}
+
+void
+VectorDisplayForm::clearMinHold()
+{
+ getPlot()->clearMinData();
+}
+
+void
+VectorDisplayForm::onPlotPointSelected(const QPointF p)
+{
+ d_clicked = true;
+ d_clicked_x_level = p.x();
+}
+
+bool
+VectorDisplayForm::checkClicked()
+{
+ if(d_clicked) {
+ d_clicked = false;
+ return true;
+ }
+ else {
+ return false;
+ }
+}
+
+float
+VectorDisplayForm::getClickedXVal() const
+{
+ return d_clicked_x_level;
+}
diff --git a/gr-qtgui/swig/qtgui_swig.i b/gr-qtgui/swig/qtgui_swig.i
index 4859df1..9664a71 100644
--- a/gr-qtgui/swig/qtgui_swig.i
+++ b/gr-qtgui/swig/qtgui_swig.i
@@ -74,6 +74,7 @@ enum{
#include "gnuradio/qtgui/histogram_sink_f.h"
#include "gnuradio/qtgui/number_sink.h"
#include "gnuradio/qtgui/ber_sink_b.h"
+#include "gnuradio/qtgui/vector_sink_f.h"
%}
%include "gnuradio/qtgui/sink_c.h"
@@ -90,6 +91,7 @@ enum{
%include "gnuradio/qtgui/histogram_sink_f.h"
%include "gnuradio/qtgui/number_sink.h"
%include "gnuradio/qtgui/ber_sink_b.h"
+%include "gnuradio/qtgui/vector_sink_f.h"
GR_SWIG_BLOCK_MAGIC2(qtgui, sink_c);
GR_SWIG_BLOCK_MAGIC2(qtgui, sink_f);
@@ -105,3 +107,4 @@ GR_SWIG_BLOCK_MAGIC2(qtgui, waterfall_sink_f);
GR_SWIG_BLOCK_MAGIC2(qtgui, histogram_sink_f);
GR_SWIG_BLOCK_MAGIC2(qtgui, number_sink);
GR_SWIG_BLOCK_MAGIC2(qtgui, ber_sink_b);
+GR_SWIG_BLOCK_MAGIC2(qtgui, vector_sink_f);
- [Commit-gnuradio] [gnuradio] branch master updated (df693a9 -> 99e0c0a), git, 2014/08/26
- [Commit-gnuradio] [gnuradio] 01/05: cmake: fix FindUHD.cmake to work with UHDConfig*.cmake, not FindUHD.cmake, since that's what UHD will be installing. UHDConfig* is a more robust way to find packages, and works with default CMake internal paths., git, 2014/08/26
- [Commit-gnuradio] [gnuradio] 05/05: Merge branch 'maint', git, 2014/08/26
- [Commit-gnuradio] [gnuradio] 04/05: Merge remote-tracking branch 'michaelld/refix_findUHD', git, 2014/08/26
- [Commit-gnuradio] [gnuradio] 03/05: qtgui: fixup GRC XML for new QT Vector Sink, git, 2014/08/26
- [Commit-gnuradio] [gnuradio] 02/05: qtgui: Added a 'vector sink'.,
git <=