[chronojump] Force sensor capture with feedback rectangle
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] Force sensor capture with feedback rectangle
- Date: Mon, 27 May 2019 03:47:04 +0000 (UTC)
commit 06a30f8d440e955f7e759012b53a61f602f5e1ee
Author: Xavier de Blas <xaviblas gmail com>
Date: Mon May 27 00:45:52 2019 -0300
Force sensor capture with feedback rectangle
glade/app1.glade | 107 +++++++++++++++++++++++++++++++++++++++++++++++--
src/gui/chronojump.cs | 3 ++
src/gui/forceSensor.cs | 28 ++++++++++++-
3 files changed, 134 insertions(+), 4 deletions(-)
---
diff --git a/glade/app1.glade b/glade/app1.glade
index 088c9810..9f8b5d2e 100644
--- a/glade/app1.glade
+++ b/glade/app1.glade
@@ -1905,6 +1905,12 @@
<placeholder/>
</child>
<child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
<widget class="GtkLabel"
id="label_start_selector_jumps">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -10497,17 +10503,100 @@ EncoderInertialCapture</property>
</packing>
</child>
<child>
- <widget class="GtkHBox" id="hbox_video_capture">
- <property name="width_request">125</property>
+ <widget class="GtkVBox"
id="vbox_force_capture_feedback">
+ <property name="can_focus">False</property>
+ <child>
+ <widget class="GtkHBox" id="hbox324">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="spacing">4</property>
<child>
- <placeholder/>
+ <widget class="GtkLabel" id="label395">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label">Feedback at</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
</child>
+ <child>
+ <widget class="GtkSpinButton"
id="spin_force_sensor_capture_feedback_at">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">●</property>
+ <property
name="invisible_char_set">True</property>
+ <property
name="primary_icon_activatable">False</property>
+ <property
name="secondary_icon_activatable">False</property>
+ <property
name="primary_icon_sensitive">True</property>
+ <property
name="secondary_icon_sensitive">True</property>
+ <property name="adjustment">200 0 9999 1 10
0</property>
+ <property name="climb_rate">1</property>
+ <property name="numeric">True</property>
</widget>
<packing>
<property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
<property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hbox323">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">4</property>
+ <child>
+ <widget class="GtkLabel" id="label396">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label">Feedback range</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkSpinButton"
id="spin_force_sensor_capture_feedback_range">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">●</property>
+ <property
name="invisible_char_set">True</property>
+ <property
name="primary_icon_activatable">False</property>
+ <property
name="secondary_icon_activatable">False</property>
+ <property
name="primary_icon_sensitive">True</property>
+ <property
name="secondary_icon_sensitive">True</property>
+ <property name="adjustment">50 0 2000 1 10
0</property>
+ <property name="climb_rate">1</property>
+ <property name="numeric">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
@@ -20771,6 +20860,12 @@ Concentric</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
<property name="expand">False</property>
@@ -29412,6 +29507,12 @@ then click this button.</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
<property name="expand">False</property>
diff --git a/src/gui/chronojump.cs b/src/gui/chronojump.cs
index 57080e43..155d013f 100644
--- a/src/gui/chronojump.cs
+++ b/src/gui/chronojump.cs
@@ -3183,6 +3183,7 @@ public partial class ChronoJumpWindow
radio_mode_contacts_sprint.Visible = false;
notebook_analyze.CurrentPage = Convert.ToInt32(notebook_analyze_pages.STATISTICS);
button_inspect_last_test.Visible = false;
+ vbox_force_capture_feedback.Visible = false;
//on OSX R is not installed by default. Check if it's installed. Needed for encoder and force
sensor
if(
@@ -3385,6 +3386,8 @@ public partial class ChronoJumpWindow
//on force sensor only show table
notebook_capture_graph_table.CurrentPage = 1; //"Show table"
notebook_capture_graph_table.ShowTabs = false;
+
+ vbox_force_capture_feedback.Visible = true;
}
else if(m == Constants.Menuitem_modes.RUNSENCODER)
{
diff --git a/src/gui/forceSensor.cs b/src/gui/forceSensor.cs
index eda7693a..c1755e90 100644
--- a/src/gui/forceSensor.cs
+++ b/src/gui/forceSensor.cs
@@ -84,8 +84,11 @@ public partial class ChronoJumpWindow
[Widget] Gtk.SpinButton spin_force_sensor_calibration_kg_value;
[Widget] Gtk.Button button_force_sensor_image_save_signal;
[Widget] Gtk.DrawingArea force_capture_drawingarea;
- Gdk.Pixmap force_capture_pixmap = null;
+ [Widget] Gtk.VBox vbox_force_capture_feedback;
+ [Widget] Gtk.SpinButton spin_force_sensor_capture_feedback_at;
+ [Widget] Gtk.SpinButton spin_force_sensor_capture_feedback_range;
+ Gdk.Pixmap force_capture_pixmap = null;
Thread forceCaptureThread;
static bool forceProcessFinish;
@@ -125,6 +128,7 @@ public partial class ChronoJumpWindow
Gdk.GC pen_black_force_capture;
Gdk.GC pen_red_force_capture;
+ Gdk.GC pen_yellow_force_capture;
Gdk.GC pen_gray_force_capture;
Gdk.GC pen_gray_force_capture_discont;
Pango.Layout layout_force_text;
@@ -151,6 +155,7 @@ public partial class ChronoJumpWindow
colormapForce.AllocColor (ref UtilGtk.BLACK,true,true);
colormapForce.AllocColor (ref UtilGtk.GRAY,true,true);
colormapForce.AllocColor (ref UtilGtk.RED_PLOTS,true,true);
+ colormapForce.AllocColor (ref UtilGtk.YELLOW,true,true);
pen_black_force_capture = new Gdk.GC(force_capture_drawingarea.GdkWindow);
pen_black_force_capture.Foreground = UtilGtk.BLACK;
@@ -162,6 +167,10 @@ public partial class ChronoJumpWindow
pen_red_force_capture.Foreground = UtilGtk.RED_PLOTS;
pen_red_force_capture.SetLineAttributes (2, Gdk.LineStyle.Solid, Gdk.CapStyle.NotLast,
Gdk.JoinStyle.Miter);
+ pen_yellow_force_capture = new Gdk.GC(force_capture_drawingarea.GdkWindow);
+ pen_yellow_force_capture.Foreground = UtilGtk.YELLOW;
+ pen_yellow_force_capture.SetLineAttributes (2, Gdk.LineStyle.Solid, Gdk.CapStyle.NotLast,
Gdk.JoinStyle.Miter);
+
pen_gray_force_capture_discont = new Gdk.GC(force_capture_drawingarea.GdkWindow);
pen_gray_force_capture_discont.Foreground = UtilGtk.GRAY;
pen_gray_force_capture_discont.SetLineAttributes (1, Gdk.LineStyle.OnOffDash,
Gdk.CapStyle.NotLast, Gdk.JoinStyle.Miter);
@@ -1283,6 +1292,23 @@ LogB.Information(" re R ");
if(fscPoints.OutsideGraph(forceSensorValues.TimeLast, forceSensorValues.ForceMax,
forceSensorValues.ForceMin))
fscPoints.Redo();
+ //draw horizontal rectangle of feedback
+ int fbkNValue = Convert.ToInt32(spin_force_sensor_capture_feedback_at.Value); //feedback
Newtons value
+ int fbkNRange = Convert.ToInt32(spin_force_sensor_capture_feedback_range.Value); //feedback
Newtons range (height of the rectangle)
+
+ if(fbkNValue > 0 && fbkNRange > 0)
+ {
+ //int fbkGraphCenter = fscPoints.GetForceInPx(fbkNValue);
+ int fbkGraphRectHeight = fscPoints.GetForceInPx(0) -
fscPoints.GetForceInPx(fbkNRange);
+ int fbkGraphRectHalfHeight = Convert.ToInt32( fbkGraphRectHeight /2);
+ int fbkGraphTop = fscPoints.GetForceInPx(fbkNValue) - fbkGraphRectHalfHeight;
+
+ Rectangle rect = new Rectangle(fscPoints.GetTimeInPx(0), fbkGraphTop,
+ force_capture_drawingarea.Allocation.Width -1, fbkGraphRectHeight);
+ force_capture_pixmap.DrawRectangle(pen_yellow_force_capture, true, rect);
+ }
+
+
forcePaintHVLines(ForceSensorGraphs.CAPTURE, forceSensorValues.ForceMax,
forceSensorValues.ForceMin, forceSensorValues.TimeLast);
Gdk.Point [] paintPoints = new Gdk.Point[fscPoints.Points.Count];
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]