[chronojump] Force sensor analyze manual mode. Read TODOs
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] Force sensor analyze manual mode. Read TODOs
- Date: Mon, 7 May 2018 11:51:32 +0000 (UTC)
commit 693b32bfe2850e6c40458cb0081d2e53d1b9a65e
Author: Xavier de Blas <xaviblas gmail com>
Date: Mon May 7 13:50:25 2018 +0200
Force sensor analyze manual mode. Read TODOs
glade/app1.glade | 1752 ++++++++++++++++++++++++++++++++++++++++-
src/encoder.cs | 1 +
src/forceSensor.cs | 294 +++++---
src/gui/forceSensor.cs | 10 +-
src/gui/forceSensorAnalyze.cs | 426 ++++++++++-
src/utilGtk.cs | 3 +-
6 files changed, 2372 insertions(+), 114 deletions(-)
---
diff --git a/glade/app1.glade b/glade/app1.glade
index d8a756b..e8685c5 100644
--- a/glade/app1.glade
+++ b/glade/app1.glade
@@ -1694,6 +1694,21 @@
<placeholder/>
</child>
<child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <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>
@@ -15805,7 +15820,7 @@ Concentric</property>
<widget class="GtkHBox" id="hbox182">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="spacing">20</property>
+ <property name="spacing">40</property>
<child>
<widget class="GtkButton"
id="button_force_sensor_analyze_load">
<property name="visible">True</property>
@@ -15851,7 +15866,69 @@ Concentric</property>
</packing>
</child>
<child>
- <widget class="GtkButton"
id="button_force_sensor_analyze_options">
+ <widget class="GtkHBox" id="hbox285">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">20</property>
+ <child>
+ <widget class="GtkLabel" id="label357">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label"
translatable="yes">Analysis:</property>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkRadioButton"
id="radiobutton_force_sensor_analyze_automatic">
+ <property name="label"
translatable="yes">Automatic</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property
name="receives_default">False</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
+ <signal name="toggled"
handler="on_radiobutton_force_sensor_analyze_automatic_toggled" swapped="no"/>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkRadioButton"
id="radiobutton_force_sensor_analyze_manual">
+ <property name="label"
translatable="yes">Manual</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property
name="receives_default">False</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
+ <property
name="group">radiobutton_force_sensor_analyze_automatic</property>
+ <signal name="toggled"
handler="on_radiobutton_force_sensor_analyze_manual_toggled" swapped="no"/>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox"
id="hbox_force_sensor_analyze_automatic_options">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">20</property>
+ <child>
+ <widget class="GtkButton"
id="button_force_sensor_analyze_options">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
@@ -15887,15 +15964,15 @@ Concentric</property>
</child>
</widget>
</child>
- </widget>
- <packing>
+ </widget>
+ <packing>
<property name="expand">False</property>
<property name="fill">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
- <widget class="GtkButton"
id="button_force_sensor_analyze_recalculate">
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkButton"
id="button_force_sensor_analyze_recalculate">
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can_focus">True</property>
@@ -15932,10 +16009,18 @@ Concentric</property>
</child>
</widget>
</child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
+ <property name="pack_type">end</property>
<property name="position">2</property>
</packing>
</child>
@@ -15947,11 +16032,17 @@ Concentric</property>
</packing>
</child>
<child>
- <widget class="GtkHBox" id="hbox_force_rfd">
+ <widget class="GtkNotebook"
id="notebook_force_sensor_analyze">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can_focus">True</property>
+ <property name="show_tabs">False</property>
+ <property name="show_border">False</property>
<child>
- <widget class="GtkVBox" id="vbox75">
+ <widget class="GtkHBox" id="hbox_force_rfd">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <widget class="GtkVBox" id="vbox75">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">12</property>
@@ -15968,9 +16059,9 @@ Concentric</property>
</packing>
</child>
<child>
- <widget class="GtkNotebook"
id="notebook_force_analyze">
+ <widget class="GtkNotebook"
id="notebook_force_analyze_automatic">
<property name="visible">True</property>
- <property name="can_focus">True</property>
+ <property name="can_focus">False</property>
<property name="show_tabs">False</property>
<property name="show_border">False</property>
<child>
@@ -17760,11 +17851,1629 @@ Concentric</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>
+ </widget>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label111">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label">automatic</property>
</widget>
<packing>
+ <property name="tab_fill">False</property>
+ <property name="type">tab</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hbox270">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">6</property>
+ <child>
+ <widget class="GtkScrolledWindow"
id="scrolledwindow8">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property
name="hscrollbar_policy">automatic</property>
+ <property
name="vscrollbar_policy">automatic</property>
+ <property name="shadow_type">in</property>
+ <child>
+ <widget class="GtkViewport"
id="viewport_force_sensor_ai_graph">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="shadow_type">none</property>
+ <child>
+ <widget class="GtkVBox" id="vbox123">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <widget class="GtkDrawingArea"
id="force_sensor_ai_drawingarea">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <signal name="configure_event"
handler="on_force_sensor_ai_drawingarea_configure_event" swapped="no"/>
+ <signal name="expose_event"
handler="on_force_sensor_ai_drawingarea_expose_event" swapped="no"/>
+ </widget>
+ <packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkTable"
id="label_force_sensor_ai">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="n_rows">6</property>
+ <property name="n_columns">3</property>
+ <property name="column_spacing">8</property>
+ <property name="row_spacing">4</property>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label356">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label"
translatable="yes">Force</property>
+ </widget>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="right_attach">3</property>
+ <property name="x_options"/>
+ <property name="y_options"/>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel"
id="label_force_sensor_ai_force_a">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="width_chars">8</property>
+ </widget>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="right_attach">3</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options"/>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel"
id="label_force_sensor_ai_force_b">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="width_chars">8</property>
+ </widget>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="right_attach">3</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options"/>
+ <property name="y_options"/>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label358">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label"
translatable="yes">Time</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="x_options"/>
+ <property name="y_options"/>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel"
id="label_force_sensor_ai_time_a">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options"/>
+ <property name="y_options"/>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel"
id="label_force_sensor_ai_time_b">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options"/>
+ <property name="y_options"/>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hbox273">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">4</property>
+ <child>
+ <widget class="GtkLabel" id="label359">
+ <property name="width_request">30</property>
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label360">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label">A</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHScale"
id="hscale_force_sensor_ai_a">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="adjustment">1 1 300 1 10
0</property>
+ <property name="digits">0</property>
+ <property name="draw_value">False</property>
+ <signal name="value_changed"
handler="on_hscale_force_sensor_ai_a_value_changed" swapped="no"/>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hbox277">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">4</property>
+ <child>
+ <widget class="GtkButton"
id="button_hscale_force_sensor_ai_a_pre">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <signal name="clicked"
handler="on_button_hscale_force_sensor_ai_a_pre_clicked" swapped="no"/>
+ <child>
+ <widget class="GtkImage" id="image1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="stock">gtk-go-back</property>
+ <property name="icon-size">1</property>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkButton"
id="button_hscale_force_sensor_ai_a_post">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <signal name="clicked"
handler="on_button_hscale_force_sensor_ai_a_post_clicked" swapped="no"/>
+ <child>
+ <widget class="GtkImage" id="image3">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="stock">gtk-go-forward</property>
+ <property name="icon-size">1</property>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="y_options"/>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hbox283">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">4</property>
+ <child>
+ <widget class="GtkCheckButton"
id="checkbutton_force_sensor_ai_b">
+ <property name="width_request">30</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property
name="receives_default">False</property>
+ <property name="xalign">1</property>
+ <property name="draw_indicator">True</property>
+ <signal name="toggled"
handler="on_checkbutton_force_sensor_ai_b_toggled" swapped="no"/>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label361">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label">B</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHScale"
id="hscale_force_sensor_ai_b">
+ <property name="can_focus">True</property>
+ <property name="adjustment">1 1 300 1 10
0</property>
+ <property name="digits">0</property>
+ <property name="draw_value">False</property>
+ <signal name="value_changed"
handler="on_hscale_force_sensor_ai_b_value_changed" swapped="no"/>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox"
id="hbox_buttons_scale_force_sensor_ai_b">
+ <property name="can_focus">False</property>
+ <property name="spacing">4</property>
+ <child>
+ <widget class="GtkButton"
id="button_hscale_force_sensor_ai_b_pre">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <signal name="clicked"
handler="on_button_hscale_force_sensor_ai_b_pre_clicked" swapped="no"/>
+ <child>
+ <widget class="GtkImage" id="image4">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="stock">gtk-go-back</property>
+ <property name="icon-size">1</property>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkButton"
id="button_hscale_force_sensor_ai_b_post">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <signal name="clicked"
handler="on_button_hscale_force_sensor_ai_b_post_clicked" swapped="no"/>
+ <child>
+ <widget class="GtkImage" id="image5">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="stock">gtk-go-forward</property>
+ <property name="icon-size">1</property>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="y_options"/>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel"
id="label_force_sensor_ai_force_average">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="width_chars">8</property>
+ </widget>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="right_attach">3</property>
+ <property name="top_attach">4</property>
+ <property name="bottom_attach">5</property>
+ <property name="x_options"/>
+ <property name="y_options"/>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel"
id="label_force_sensor_ai_force_max">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="width_chars">8</property>
+ </widget>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="right_attach">3</property>
+ <property name="top_attach">5</property>
+ <property name="bottom_attach">6</property>
+ <property name="x_options"/>
+ <property name="y_options"/>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel"
id="label_force_sensor_ai_force_diff">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="width_chars">8</property>
+ </widget>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="right_attach">3</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ <property name="x_options"/>
+ <property name="y_options"/>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel"
id="label_force_sensor_ai_diff">
+ <property name="can_focus">False</property>
+ <property name="xalign">1</property>
+ <property name="label"
translatable="yes">Difference</property>
+ </widget>
+ <packing>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"/>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel"
id="label_force_sensor_ai_average">
+ <property name="can_focus">False</property>
+ <property name="xalign">1</property>
+ <property name="label"
translatable="yes">Average</property>
+ </widget>
+ <packing>
+ <property name="top_attach">4</property>
+ <property name="bottom_attach">5</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"/>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel"
id="label_force_sensor_ai_max">
+ <property name="can_focus">False</property>
+ <property name="xalign">1</property>
+ <property name="label"
translatable="yes">Maximum</property>
+ </widget>
+ <packing>
+ <property name="top_attach">5</property>
+ <property name="bottom_attach">6</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"/>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel"
id="label_force_sensor_ai_time_diff">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="width_chars">8</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ <property name="x_options"/>
+ <property name="y_options"/>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkVBox" id="vbox124">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <widget class="GtkButton"
id="button_force_sensor_image_save_rfd1">
+ <property name="visible">True</property>
+ <property name="sensitive">False</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="tooltip" translatable="yes">Save
image</property>
+ <child>
+ <widget class="GtkVBox" id="vbox125">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">4</property>
+ <child>
+ <widget class="GtkImage"
id="image_forcesensor_analyze_image_save4">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property
name="stock">gtk-missing-image</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkImage"
id="image_forcesensor_analyze_image_save6">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="stock">gtk-save</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="pack_type">end</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label301">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label">manual</property>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ <property name="tab_fill">False</property>
+ <property name="type">tab</property>
</packing>
</child>
</widget>
@@ -25787,6 +27496,21 @@ then click this button.</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
<property name="expand">False</property>
diff --git a/src/encoder.cs b/src/encoder.cs
index abd204e..04500de 100644
--- a/src/encoder.cs
+++ b/src/encoder.cs
@@ -1968,6 +1968,7 @@ public class EncoderAnalyzeInstant
if(ini == end) {
listAVG = dlist[ini];
listMAX = dlist[ini];
+ return;
}
double sum = 0;
diff --git a/src/forceSensor.cs b/src/forceSensor.cs
index 8759b18..9c367f7 100644
--- a/src/forceSensor.cs
+++ b/src/forceSensor.cs
@@ -84,7 +84,7 @@ public class ForceSensorCapturePoints
public int GetTimeInPx(int time)
{
- //without 1.0 calculation is done as int producint very buggy value
+ //without 1.0 calculation is done as int producing very buggy value
return marginLeft + Convert.ToInt32(1.0 * (widthG -marginLeft -marginRight) * time /
RealWidthG);
}
@@ -116,6 +116,66 @@ public class ForceSensorCapturePoints
return Points[Points.Count -1];
}
+ // TODO: do all this in an inherited class
+ public int GetLength()
+ {
+ return times.Count;
+ }
+
+ public int GetLastTime()
+ {
+ return times[times.Count -1];
+ }
+
+ public double GetLastForce()
+ {
+ return forces[forces.Count -1];
+ }
+
+ public double GetTimeAtCount(int count)
+ {
+ return times[count];
+ }
+ public double GetForceAtCount(int count)
+ {
+ return forces[count];
+ }
+ public void GetAverageAndMaxForce(int countA, int countB, out double avg, out double max)
+ {
+ if(countA == countB) {
+ avg = forces[countA];
+ max = forces[countA];
+ return;
+ }
+
+ double sum = 0;
+ max = 0;
+ for(int i = countA; i <= countB; i ++) {
+ sum += forces[i];
+ if(forces[i] > max)
+ max = forces[i];
+ }
+
+ avg = sum / (countB - countA);
+ }
+ public double GetRFD(int countA, int countB)
+ {
+ double calc = (forces[countB] - forces[countA]) / (times[countB]/1000000.0 -
times[countA]/1000000.0); //microsec to sec
+ //LogB.Information(string.Format("GetRFD {0}, {1}, {2}, {3}, {4}, {5}, RFD: {6}",
+ // countA, countB, forces[countA], forces[countB], times[countA], times[countB], calc));
+ return calc;
+ }
+ public int MarginLeft
+ {
+ get { return marginLeft; }
+ }
+ public int MarginRight
+ {
+ get { return marginRight; }
+ }
+ // TODO: end of... do all this in an inherited class
+
+
// this is called while capturing, checks if last captured value is outside the graph
public bool OutsideGraph()
{
@@ -161,11 +221,7 @@ public class ForceSensorCapturePoints
public void Redo()
{
for(int i=0; i < NumCaptured; i ++)
- {
- //LogB.Information("RedoPRE X: " + Points[i].X.ToString() + "; Y: " +
Points[i].Y.ToString());
Points[i] = new Gdk.Point(GetTimeInPx(times[i]), GetForceInPx(forces[i]));
- //LogB.Information("RedoPOST X: " + Points[i].X.ToString() + "; Y: " +
Points[i].Y.ToString());
- }
}
public int WidthG
@@ -526,111 +582,161 @@ public class ForceSensorGraph
}
}
-/*
-public class ForceSensor
+public class ForceSensorAnalyzeInstant
{
- double averageLength;
- double percentChange;
- bool vlineT0;
- bool vline50fmax_raw;
- bool vline50fmax_fitted;
- bool hline50fmax_raw;
- bool hline50fmax_fitted;
- bool rfd0_fitted;
- bool rfd100_raw;
- bool rfd0_100_raw;
- bool rfd0_100_fitted;
- bool rfd200_raw;
- bool rfd0_200_raw;
- bool rfd0_200_fitted;
- bool rfd50fmax_raw;
- bool rfd50fmax_fitted;
-
- public ForceSensor()
- {
- averageLength = 0.1;
- percentChange = 5;
- vlineT0 = false;
- vline50fmax_raw = false;
- vline50fmax_fitted = false;
- hline50fmax_raw = false;
- hline50fmax_fitted = false;
- rfd0_fitted = false;
- rfd100_raw = false;
- rfd0_100_raw = false;
- rfd0_100_fitted = false;
- rfd200_raw = false;
- rfd0_200_raw = false;
- rfd0_200_fitted = false;
- rfd50fmax_raw = false;
- rfd50fmax_fitted = false;
+ public double ForceAVG;
+ public double ForceMAX;
+
+ private ForceSensorCapturePoints fscAIPoints; //Analyze Instant
+ private ForceSensorValues forceSensorValues;
+ private int graphWidth;
+ private int graphHeight;
+
+ public ForceSensorAnalyzeInstant(string file, int graphWidth, int graphHeight)
+ {
+ this.graphWidth = graphWidth;
+ this.graphHeight = graphHeight;
+
+ readFile(file);
+
+ //ensure points fit on display
+ if(fscAIPoints.OutsideGraph(forceSensorValues.TimeLast, forceSensorValues.ForceMax,
forceSensorValues.ForceMin))
+ fscAIPoints.Redo();
}
- public bool CallR(int graphWidth, int graphHeight)
+ private void readFile(string file)
{
- string executable = UtilEncoder.RProcessBinURL();
- List<string> parameters = new List<string>();
+ fscAIPoints = new ForceSensorCapturePoints(graphWidth, graphHeight);
- //A) mifcript
- string mifScript = UtilEncoder.GetmifScript();
- if(UtilAll.IsWindows())
- mifScript = mifScript.Replace("\\","/");
+//TODO: check file exists...
+ List<string> contents = Util.ReadFileAsStringList(file);
+ bool headersRow = true;
- parameters.Insert(0, "\"" + mifScript + "\"");
+ //initialize
+ forceSensorValues = new ForceSensorValues();
- //B) tempPath
- string tempPath = Path.GetTempPath();
- if(UtilAll.IsWindows())
- tempPath = tempPath.Replace("\\","/");
+ foreach(string str in contents)
+ {
+ if(headersRow)
+ headersRow = false;
+ else {
+ string [] strFull = str.Split(new char[] {';'});
+ if(strFull.Length != 2)
+ continue;
+
+ /*
+ * TODO: Make this work with decimals as comma and decimals as point
+ * to fix problems on importing data on different localised computer
+ */
+
+ if(Util.IsNumber(strFull[0], false) && Util.IsNumber(strFull[1], true))
+ {
+ int time = Convert.ToInt32(strFull[0]);
+ double force = Convert.ToDouble(strFull[1]);
+
+ fscAIPoints.Add(time, force);
+ fscAIPoints.NumCaptured ++;
+
+ forceSensorValues.TimeLast = time;
+ forceSensorValues.ForceLast = force;
+ forceSensorValues.SetMaxMinIfNeeded(force, time);
+ }
+ }
+ }
+ }
- parameters.Insert(1, "\"" + tempPath + "\"");
+ //gets an instant value
+ public double GetTimeMS(int count)
+ {
+ return fscAIPoints.GetTimeAtCount(count) / 1000.0; //microseconds to milliseconds
+ }
+ public double GetForce(int count)
+ {
+ return fscAIPoints.GetForceAtCount(count);
+ }
- //C) writeOptions
- writeOptionsFile(graphWidth, graphHeight);
+ public int GetLength()
+ {
+ LogB.Information("GetLength: " + fscAIPoints.GetLength());
+ return fscAIPoints.GetLength();
+ }
- LogB.Information("\nCalling mif R file ----->");
+ public int GetVerticalLinePosition(int currentPos, int totalPos)
+ {
+ LogB.Information(string.Format("currentPos: {0}, totalPos: {1}", currentPos, totalPos));
+ //this can be called on expose event before calculating needed parameters
+ if(graphWidth == 0)
+ return 0;
- //D) call process
- //ExecuteProcess.run (executable, parameters);
- ExecuteProcess.Result execute_result = ExecuteProcess.run (executable, parameters);
- //LogB.Information("Result = " + execute_result.stdout);
+ int leftMargin = fscAIPoints.MarginLeft;
+ int rightMargin = fscAIPoints.MarginRight;
- LogB.Information("\n<------ Done calling mif R file.");
- return execute_result.success;
+ // rule of three
+ double px = Util.DivideSafe(
+ (graphWidth - leftMargin - rightMargin) * currentPos,
+ totalPos);
+
+ // fix margin
+ //px = px + plt.x1 * graphWidth;
+ px = px + leftMargin;
+
+ return Convert.ToInt32(px);
}
- private void writeOptionsFile(int graphWidth, int graphHeight)
+ public int GetPxAtForce(double f)
{
- string scriptsPath = UtilEncoder.GetSprintPath();
- if(UtilAll.IsWindows())
- scriptsPath = scriptsPath.Replace("\\","/");
+ return fscAIPoints.GetForceInPx(f);
+ }
- string scriptOptions =
- "#os\n" + UtilEncoder.OperatingSystemForRGraphs() + "\n" +
- "#graphWidth\n" + graphWidth.ToString() + "\n" +
- "#graphHeight\n" + graphHeight.ToString() + "\n" +
- "#averageLength\n" + Util.ConvertToPoint(averageLength) + "\n" +
- "#percentChange\n" + Util.ConvertToPoint(percentChange) + "\n" +
- "#vlineT0\n" + Util.BoolToRBool(vlineT0) + "\n" +
- "#vline50fmax.raw\n" + Util.BoolToRBool(vline50fmax_raw) + "\n" +
- "#vline50fmax.fitted\n" + Util.BoolToRBool(vline50fmax_fitted) + "\n" +
- "#hline50fmax.raw\n" + Util.BoolToRBool(hline50fmax_raw) + "\n" +
- "#hline50fmax.fitted\n" + Util.BoolToRBool(hline50fmax_fitted) + "\n" +
- "#rfd0.fitted\n" + Util.BoolToRBool(rfd0_fitted) + "\n" +
- "#rfd100.raw\n" + Util.BoolToRBool(rfd100_raw) + "\n" +
- "#rfd0_100.raw\n" + Util.BoolToRBool(rfd0_100_raw) + "\n" +
- "#rfd0_100.fitted\n" + Util.BoolToRBool(rfd0_100_fitted) + "\n" +
- "#rfd200.raw\n" + Util.BoolToRBool(rfd200_raw) + "\n" +
- "#rfd0_200.raw\n" + Util.BoolToRBool(rfd0_200_raw) + "\n" +
- "#rfd0_200.fitted\n" + Util.BoolToRBool(rfd0_200_fitted) + "\n" +
- "#rfd50fmax.raw\n" + Util.BoolToRBool(rfd50fmax_raw) + "\n" +
- "#rfd50fmax.fitted\n" + Util.BoolToRBool(rfd50fmax_fitted);
+ //calculates from a range
+ public bool CalculateRangeParams(int countA, int countB)
+ {
+ //countA --; //converts from starting at 1 (graph) to starting at 0 (data)
+ //countB --; //converts from starting at 1 (graph) to starting at 0 (data)
- TextWriter writer = File.CreateText(Path.GetTempPath() + "Roptions.txt");
- writer.Write(scriptOptions);
- writer.Flush();
- writer.Close();
- ((IDisposable)writer).Dispose();
+ //countA will be the lowest and countB the highest to calcule Avg and max correctly no matter
if B is before A
+ if(countA > countB) {
+ int temp = countA;
+ countA = countB;
+ countB = temp;
+ }
+
+ fscAIPoints.GetAverageAndMaxForce(countA, countB, out ForceAVG, out ForceMAX);
+
+ return true;
+ }
+
+ public double CalculateRFD(int countA, int countB)
+ {
+ return fscAIPoints.GetRFD(countA, countB);
}
+
+ /*
+ * Calculates RFD in a point using previous and next point
+ */
+//TODO: fer que es vagi recordant el max en un rang determinat pq no s'hagi de tornar a calcular
+ public double CalculateMaxRFDInRange(int countA, int countB, out int countRFDMax)
+ {
+ double max = 0;
+ double current = 0;
+ countRFDMax = countA; //count where maxRFD is found
+
+ for(int i = countA; i < countB ; i ++)
+ {
+ current = fscAIPoints.GetRFD(i-1, i+1);
+ if(current > max)
+ {
+ max = current;
+ countRFDMax = i;
+ }
+ }
+
+ return max;
+ }
+
+ public ForceSensorCapturePoints FscAIPoints
+ {
+ get { return fscAIPoints; }
+ }
+
}
-*/
diff --git a/src/gui/forceSensor.cs b/src/gui/forceSensor.cs
index 872444a..a199097 100644
--- a/src/gui/forceSensor.cs
+++ b/src/gui/forceSensor.cs
@@ -711,6 +711,10 @@ LogB.Information(" fc C ");
fscPoints.InitRealWidthHeight();
forceSensorDoSignalGraphPlot();
forceSensorDoRFDGraph();
+
+ //if drawingarea has still not shown, don't paint graph because GC
screen is not defined
+ if(force_sensor_ai_drawingareaShown)
+ forceSensorDoGraphAI();
}
} else if(forceProcessCancel || forceProcessError)
{
@@ -889,7 +893,7 @@ LogB.Information(" fc R ");
bool force_capture_sizeChanged;
public void on_force_capture_drawingarea_configure_event(object o, ConfigureEventArgs args)
{
- if(force_capture_drawingarea == null)
+ if(force_capture_drawingarea == null)
return;
Gdk.EventConfigure ev = args.Event;
@@ -990,6 +994,10 @@ LogB.Information(" fc R ");
lastForceSensorFullPath = filechooser.Filename; //used on recalculate
forceSensorCopyTempAndDoGraphs();
+
+ //if drawingarea has still not shown, don't paint graph because GC screen is not
defined
+ if(force_sensor_ai_drawingareaShown)
+ forceSensorDoGraphAI();
}
filechooser.Destroy ();
}
diff --git a/src/gui/forceSensorAnalyze.cs b/src/gui/forceSensorAnalyze.cs
index 34747ff..b1a1731 100644
--- a/src/gui/forceSensorAnalyze.cs
+++ b/src/gui/forceSensorAnalyze.cs
@@ -42,7 +42,11 @@ public partial class ChronoJumpWindow
[Widget] Gtk.RadioButton radio_force_duration_seconds;
//analyze options
- [Widget] Gtk.Notebook notebook_force_analyze;
+ [Widget] Gtk.Notebook notebook_force_sensor_analyze; //decide between automatic and manual
+ [Widget] Gtk.RadioButton radiobutton_force_sensor_analyze_automatic;
+ [Widget] Gtk.RadioButton radiobutton_force_sensor_analyze_manual;
+ [Widget] Gtk.HBox hbox_force_sensor_analyze_automatic_options;
+ [Widget] Gtk.Notebook notebook_force_analyze_automatic;
[Widget] Gtk.Button button_force_sensor_analyze_options;
[Widget] Gtk.HBox hbox_force_1;
[Widget] Gtk.HBox hbox_force_2;
@@ -98,7 +102,6 @@ public partial class ChronoJumpWindow
[Widget] Gtk.SpinButton spinbutton_force_4_to;
[Widget] Gtk.SpinButton spinbutton_force_impulse_to;
-
/*
* analyze options -------------------------->
*/
@@ -124,7 +127,7 @@ public partial class ChronoJumpWindow
private void on_button_force_sensor_analyze_options_clicked (object o, EventArgs args)
{
- notebook_force_analyze.CurrentPage = 1;
+ notebook_force_analyze_automatic.CurrentPage = 1;
forceSensorAnalyzeOptionsSensitivity(false);
}
@@ -155,7 +158,7 @@ public partial class ChronoJumpWindow
// 2 change sensitivity of widgets
- notebook_force_analyze.CurrentPage = 0;
+ notebook_force_analyze_automatic.CurrentPage = 0;
forceSensorAnalyzeOptionsSensitivity(true);
}
@@ -460,4 +463,419 @@ public partial class ChronoJumpWindow
{
get { return impulse; }
}
+
+ [Widget] Gtk.DrawingArea force_sensor_ai_drawingarea;
+ [Widget] Gtk.HScale hscale_force_sensor_ai_a;
+ [Widget] Gtk.HScale hscale_force_sensor_ai_b;
+ [Widget] Gtk.CheckButton checkbutton_force_sensor_ai_b;
+ [Widget] Gtk.Label label_force_sensor_ai_time_a;
+ [Widget] Gtk.Label label_force_sensor_ai_force_a;
+ [Widget] Gtk.HBox hbox_buttons_scale_force_sensor_ai_b;
+ [Widget] Gtk.Label label_force_sensor_ai_diff;
+ [Widget] Gtk.Label label_force_sensor_ai_average;
+ [Widget] Gtk.Label label_force_sensor_ai_max;
+ [Widget] Gtk.Label label_force_sensor_ai_time_b;
+ [Widget] Gtk.Label label_force_sensor_ai_time_diff;
+ [Widget] Gtk.Label label_force_sensor_ai_force_b;
+ [Widget] Gtk.Label label_force_sensor_ai_force_diff;
+ [Widget] Gtk.Label label_force_sensor_ai_force_average;
+ [Widget] Gtk.Label label_force_sensor_ai_force_max;
+
+ ForceSensorAnalyzeInstant fsAI;
+
+ private void on_radiobutton_force_sensor_analyze_automatic_toggled (object o, EventArgs args)
+ {
+ if(! radiobutton_force_sensor_analyze_automatic.Active)
+ return;
+
+ hbox_force_sensor_analyze_automatic_options.Visible = true;
+ notebook_force_sensor_analyze.CurrentPage = 0;
+ }
+ bool force_sensor_ai_drawingareaShown = false;
+ private void on_radiobutton_force_sensor_analyze_manual_toggled (object o, EventArgs args)
+ {
+ if(! radiobutton_force_sensor_analyze_manual.Active)
+ return;
+
+ hbox_force_sensor_analyze_automatic_options.Visible = false;
+ notebook_force_sensor_analyze.CurrentPage = 1;
+ force_sensor_ai_drawingareaShown = true;
+ forceSensorDoGraphAI();
+ }
+
+ private void forceSensorDoGraphAI()
+ {
+ if(lastForceSensorFullPath == null || lastForceSensorFullPath == "")
+ return;
+
+ fsAI = new ForceSensorAnalyzeInstant(
+ lastForceSensorFullPath,
+ force_sensor_ai_drawingarea.Allocation.Width,
+ force_sensor_ai_drawingarea.Allocation.Height
+ );
+
+ forceSensorAIPlot();
+
+ //ranges should have max value the number of the lines of csv file minus the header
+ hscale_force_sensor_ai_a.SetRange(0, fsAI.GetLength() -1);
+ hscale_force_sensor_ai_b.SetRange(0, fsAI.GetLength() -1);
+
+ //to update values
+ on_hscale_force_sensor_ai_a_value_changed (new object (), new EventArgs ());
+ }
+
+ Gdk.Colormap colormapForceAI;// = Gdk.Colormap.System;
+ Gdk.Pixmap force_sensor_ai_pixmap = null;
+ Gdk.GC pen_black_force_ai; //signal
+ Gdk.GC pen_blue_force_ai; //RFD
+ Gdk.GC pen_red_force_ai; //RFD max
+ Gdk.GC pen_gray_discont_force_ai; //vertical lines
+ Gdk.GC pen_yellow_force_ai; //0 force
+
+ private void forceSensorAIPlot()
+ {
+ //UtilGtk.ErasePaint(force_sensor_ai_drawingarea, force_sensor_ai_pixmap);
+
+ LogB.Information(
+ "forceSensorAIPlot() " +
+ (pen_black_force_ai == null).ToString() +
+ (colormapForceAI == null).ToString() +
+ (force_sensor_ai_drawingarea == null).ToString() +
+ (force_sensor_ai_pixmap == null).ToString());
+
+ if(force_sensor_ai_pixmap == null || pen_black_force_ai == null)
+ force_ai_graphs_init();
+
+ forceSensorAIChanged = true; //to actually plot
+ force_sensor_ai_drawingarea.QueueDraw(); // -- refresh
+ }
+
+ Pango.Layout layout_force_ai_text;
+ private void force_ai_graphs_init()
+ {
+ colormapForceAI = Gdk.Colormap.System;
+ colormapForceAI.AllocColor (ref UtilGtk.BLACK,true,true);
+ colormapForceAI.AllocColor (ref UtilGtk.BLUE_PLOTS,true,true);
+ colormapForceAI.AllocColor (ref UtilGtk.RED_PLOTS,true,true);
+ colormapForceAI.AllocColor (ref UtilGtk.GRAY,true,true);
+ bool success = colormapForceAI.AllocColor (ref UtilGtk.YELLOW,true,true);
+ LogB.Information("Yellow success!: " + success.ToString()); //sempre dona success
+
+ pen_black_force_ai = new Gdk.GC(force_sensor_ai_drawingarea.GdkWindow);
+ //potser llegir els valors de la Gdk.GC
+ try{
+ LogB.Information("Gdk.GC screen: " + pen_black_force_ai.Screen.ToString());
+ } catch { LogB.Information("CATCHED at screen"); }
+
+ pen_blue_force_ai = new Gdk.GC(force_sensor_ai_drawingarea.GdkWindow);
+ pen_red_force_ai = new Gdk.GC(force_sensor_ai_drawingarea.GdkWindow);
+ pen_yellow_force_ai = new Gdk.GC(force_sensor_ai_drawingarea.GdkWindow);
+ pen_gray_discont_force_ai = new Gdk.GC(force_sensor_ai_drawingarea.GdkWindow);
+
+ pen_black_force_ai.Foreground = UtilGtk.BLACK;
+ pen_blue_force_ai.Foreground = UtilGtk.BLUE_PLOTS;
+ pen_red_force_ai.Foreground = UtilGtk.RED_PLOTS;
+ pen_yellow_force_ai.Foreground = UtilGtk.YELLOW;
+ pen_gray_discont_force_ai.Foreground = UtilGtk.GRAY;
+
+ //pen_black_force_ai.SetLineAttributes (2, Gdk.LineStyle.Solid, Gdk.CapStyle.NotLast,
Gdk.JoinStyle.Miter);
+ //this makes the lines less spiky:
+ pen_black_force_ai.SetLineAttributes (1, Gdk.LineStyle.Solid, Gdk.CapStyle.Round,
Gdk.JoinStyle.Round);
+ pen_blue_force_ai.SetLineAttributes (1, Gdk.LineStyle.Solid, Gdk.CapStyle.Round,
Gdk.JoinStyle.Round);
+ pen_red_force_ai.SetLineAttributes (1, Gdk.LineStyle.Solid, Gdk.CapStyle.Round,
Gdk.JoinStyle.Round);
+ pen_yellow_force_ai.SetLineAttributes (1, Gdk.LineStyle.Solid, Gdk.CapStyle.Round,
Gdk.JoinStyle.Round);
+ pen_gray_discont_force_ai.SetLineAttributes(1, Gdk.LineStyle.OnOffDash, Gdk.CapStyle.Butt,
Gdk.JoinStyle.Round);
+
+ layout_force_ai_text = new Pango.Layout (force_sensor_ai_drawingarea.PangoContext);
+ layout_force_ai_text.FontDescription = Pango.FontDescription.FromString ("Courier 10");
+ }
+
+ int force_sensor_ai_allocationXOld;
+ bool force_sensor_ai_sizeChanged;
+ public void on_force_sensor_ai_drawingarea_configure_event (object o, ConfigureEventArgs args)
+ {
+ LogB.Information("CONFIGURE force_sensor_ai_drawingarea_exposeai START");
+ if(force_sensor_ai_drawingarea == null)
+ return;
+
+ Gdk.EventConfigure ev = args.Event;
+ Gdk.Window window = ev.Window;
+
+ Gdk.Rectangle allocation = force_sensor_ai_drawingarea.Allocation;
+
+ if(force_sensor_ai_pixmap == null || force_sensor_ai_sizeChanged ||
+ allocation.Width != force_sensor_ai_allocationXOld)
+ {
+ force_sensor_ai_pixmap = new Gdk.Pixmap (window, allocation.Width, allocation.Height,
-1);
+
+ UtilGtk.ErasePaint(force_sensor_ai_drawingarea, force_sensor_ai_pixmap);
+
+ force_sensor_ai_sizeChanged = false;
+ }
+
+ force_sensor_ai_allocationXOld = allocation.Width;
+ LogB.Information("CONFIGURE force_sensor_ai_drawingarea_exposeai END");
+ }
+ public void on_force_sensor_ai_drawingarea_expose_event (object o, ExposeEventArgs args)
+ {
+ LogB.Information("EXPOSE force_sensor_ai_drawingarea_expose START");
+ if(force_sensor_ai_drawingarea == null)
+ return;
+
+ /* in some mono installations, configure_event is not called, but expose_event yes.
+ * Do here the initialization
+ */
+
+ Gdk.Rectangle allocation = force_sensor_ai_drawingarea.Allocation;
+ if(force_sensor_ai_pixmap == null || force_sensor_ai_sizeChanged ||
+ allocation.Width != force_sensor_ai_allocationXOld ||
+ forceSensorAIChanged)
+ {
+ if(forceSensorAIChanged)
+ forceSensorAIChanged = false;
+
+ force_sensor_ai_pixmap = new Gdk.Pixmap (force_sensor_ai_drawingarea.GdkWindow,
+ allocation.Width, allocation.Height, -1);
+
+ UtilGtk.ErasePaint(force_sensor_ai_drawingarea, force_sensor_ai_pixmap);
+ if(fsAI != null)
+ {
+ LogB.Information("EXPOSE 5");
+
+ // 1) create paintPoints
+ Gdk.Point [] paintPoints = new Gdk.Point[fsAI.FscAIPoints.Points.Count];
+ for(int i = 0; i < fsAI.FscAIPoints.Points.Count; i ++)
+ paintPoints[i] = fsAI.FscAIPoints.Points[i];
+
+ // 2) draw horizontal 0 line
+ force_sensor_ai_pixmap.DrawLine(pen_gray_discont_force_ai,
+ 0, fsAI.GetPxAtForce(0), allocation.Width,
fsAI.GetPxAtForce(0));
+ force_sensor_ai_pixmap.DrawLines(pen_black_force_ai, paintPoints);
+
+ // 3) create hscaleLower and higher values (A, B at the moment)
+ int hscaleLower = Convert.ToInt32(hscale_force_sensor_ai_a.Value);
+ int hscaleHigher = Convert.ToInt32(hscale_force_sensor_ai_b.Value);
+
+ // 4) paint vertical yellow lines A, B and write letter
+ int xposA = fsAI.GetVerticalLinePosition(hscaleLower, fsAI.GetLength());
+ force_sensor_ai_pixmap.DrawLine(pen_yellow_force_ai,
+ xposA, 20, xposA, allocation.Height);
+
+ layout_force_ai_text.SetMarkup("A");
+ int textWidth = 1;
+ int textHeight = 1;
+ layout_force_ai_text.GetPixelSize(out textWidth, out textHeight);
+ force_sensor_ai_pixmap.DrawLayout (pen_yellow_force_ai,
+ xposA - textWidth/2, 0,
+ layout_force_ai_text);
+
+ int xposB = 0;
+ if(checkbutton_force_sensor_ai_b.Active && hscaleLower != hscaleHigher)
+ {
+ xposB = fsAI.GetVerticalLinePosition(hscaleHigher, fsAI.GetLength());
+ force_sensor_ai_pixmap.DrawLine(pen_yellow_force_ai,
+ xposB, 20, xposB, allocation.Height);
+
+ layout_force_ai_text.SetMarkup("B");
+ textWidth = 1;
+ textHeight = 1;
+ layout_force_ai_text.GetPixelSize(out textWidth, out textHeight);
+ force_sensor_ai_pixmap.DrawLayout (pen_yellow_force_ai,
+ xposB - textWidth/2, 0,
+ layout_force_ai_text);
+ }
+
+ if(checkbutton_force_sensor_ai_b.Active)
+ {
+ /*
+ * 5) Invert AB if needed to paint correctly blue and red lines
+ * making it work also when B is higher than A
+ */
+ if(hscaleLower > hscaleHigher)
+ {
+ hscaleLower = Convert.ToInt32(hscale_force_sensor_ai_b.Value);
+ hscaleHigher =
Convert.ToInt32(hscale_force_sensor_ai_a.Value);
+ int temp = xposA;
+ xposA = xposB;
+ xposB = temp;
+ }
+
+ if(hscaleHigher != hscaleLower)
+ {
+ //6) calculate and paint RFD
+ double forceA = fsAI.GetForce(hscaleLower);
+ double forceB = fsAI.GetForce(hscaleHigher);
+
+ force_sensor_ai_pixmap.DrawLine(pen_blue_force_ai,
+ xposA, fsAI.GetPxAtForce(forceA),
+ xposB, fsAI.GetPxAtForce(forceB));
+
+ layout_force_ai_text.SetMarkup(string.Format("RFD A-B:
{0:0.#} N/s",
+
Math.Round(fsAI.CalculateRFD(hscaleLower, hscaleHigher), 1) ));
+ textWidth = 1;
+ textHeight = 1;
+ layout_force_ai_text.GetPixelSize(out textWidth, out
textHeight);
+ force_sensor_ai_pixmap.DrawLayout (pen_blue_force_ai,
+ allocation.Width -textWidth -10,
allocation.Height/2 -20,
+ layout_force_ai_text);
+
+ // 7) calculate and paint max RFD
+ //value of count that produce the max RFD (between the
previous and next value)
+ int countRFDMax = hscaleLower;
+ layout_force_ai_text.SetMarkup(string.Format("RFD Max:
{0:0.#} N/s",
+
Math.Round(fsAI.CalculateMaxRFDInRange(
+ hscaleLower+1,
hscaleHigher-1, //avoid having data out of possible
+ out countRFDMax), 1)
));
+
+ layout_force_ai_text.GetPixelSize(out textWidth, out
textHeight);
+ force_sensor_ai_pixmap.DrawLayout (pen_red_force_ai,
+ allocation.Width -textWidth -10,
allocation.Height/2,
+ layout_force_ai_text);
+
+
+ xposA = fsAI.GetVerticalLinePosition(countRFDMax -1,
fsAI.GetLength());
+ xposB = fsAI.GetVerticalLinePosition(countRFDMax +1,
fsAI.GetLength());
+
+ /*
+ * do not paint segment, it's too small
+ force_sensor_ai_pixmap.DrawLine(pen_red_force_ai,
+ xposA, fsAI.GetPxAtForce(fsAI.GetForce(hscaleLowerMax)),
+ xposB, fsAI.GetPxAtForce(fsAI.GetForce(hscaleHigherMax)) );
+ */
+
+ //calculate line (not segment)
+ int segXA = xposA;
+ int segXB = xposB;
+ int segYA = fsAI.GetPxAtForce(fsAI.GetForce(countRFDMax -1));
+ int segYB = fsAI.GetPxAtForce(fsAI.GetForce(countRFDMax +1));
+ double slope = Math.Abs(
+ Util.DivideSafe( segYB - segYA,
+ (1.0 * (segXB- segXA)) )
+ );
+ //LogB.Information(string.Format("segXA: {0}, segXB: {1},
segYA: {2}, segYB: {3}, slope: {4}",
+ // segXA, segXB, segYA, segYB, slope));
+
+
+ int lineXA = segXA - Convert.ToInt32(Util.DivideSafe(
+ (allocation.Height - segYA),
+ slope));
+ int lineXB = segXB + Convert.ToInt32(Util.DivideSafe(
+ (segYB - 0),
+ slope));
+ int lineYA = allocation.Height;
+ int lineYB = 0;
+
+ force_sensor_ai_pixmap.DrawLine(pen_red_force_ai,
+ lineXA, lineYA,
+ lineXB, lineYB);
+ }
+ }
+ LogB.Information("EXPOSE 6");
+ }
+
+ force_sensor_ai_sizeChanged = false;
+ }
+
+ Gdk.Rectangle area = args.Event.Area;
+
+ //sometimes this is called when paint is finished
+ //don't let this erase win
+ if(force_sensor_ai_pixmap != null) {
+ args.Event.Window.DrawDrawable(force_sensor_ai_drawingarea.Style.WhiteGC,
force_sensor_ai_pixmap,
+ area.X, area.Y,
+ area.X, area.Y,
+ area.Width, area.Height);
+ }
+
+ force_sensor_ai_allocationXOld = allocation.Width;
+ LogB.Information("EXPOSE END");
+ }
+
+ bool forceSensorAIChanged = false;
+ private void on_hscale_force_sensor_ai_a_value_changed (object o, EventArgs args)
+ {
+ if(fsAI == null)
+ return;
+
+ int count = Convert.ToInt32(hscale_force_sensor_ai_a.Value);
+ label_force_sensor_ai_time_a.Text = Math.Round(fsAI.GetTimeMS(count), 1).ToString();
+ label_force_sensor_ai_force_a.Text = Math.Round(fsAI.GetForce(count), 1).ToString();
+
+ if(checkbutton_force_sensor_ai_b.Active)
+ force_sensor_analyze_instant_calculate_params();
+
+ forceSensorAIChanged = true;
+ force_sensor_ai_drawingarea.QueueDraw(); //will fire ExposeEvent
+ }
+ private void on_hscale_force_sensor_ai_b_value_changed (object o, EventArgs args)
+ {
+ if(fsAI == null)
+ return;
+
+ int count = Convert.ToInt32(hscale_force_sensor_ai_b.Value);
+ label_force_sensor_ai_time_b.Text = Math.Round(fsAI.GetTimeMS(count), 1).ToString();
+ label_force_sensor_ai_force_b.Text = Math.Round(fsAI.GetForce(count), 1).ToString();
+
+ force_sensor_analyze_instant_calculate_params();
+
+ forceSensorAIChanged = true;
+ force_sensor_ai_drawingarea.QueueDraw(); //will fire ExposeEvent
+ }
+
+ private void on_button_hscale_force_sensor_ai_a_pre_clicked (object o, EventArgs args)
+ {
+ hscale_force_sensor_ai_a.Value -= 1;
+ }
+ private void on_button_hscale_force_sensor_ai_a_post_clicked (object o, EventArgs args)
+ {
+ hscale_force_sensor_ai_a.Value += 1;
+ }
+ private void on_button_hscale_force_sensor_ai_b_pre_clicked (object o, EventArgs args)
+ {
+ hscale_force_sensor_ai_b.Value -= 1;
+ }
+ private void on_button_hscale_force_sensor_ai_b_post_clicked (object o, EventArgs args)
+ {
+ hscale_force_sensor_ai_b.Value += 1;
+ }
+ private void on_checkbutton_force_sensor_ai_b_toggled (object o, EventArgs args)
+ {
+ bool visible = checkbutton_force_sensor_ai_b.Active;
+ hscale_force_sensor_ai_b.Visible = visible;
+ hbox_buttons_scale_force_sensor_ai_b.Visible = visible;
+
+ label_force_sensor_ai_diff.Visible = visible;
+ label_force_sensor_ai_average.Visible = visible;
+ label_force_sensor_ai_max.Visible = visible;
+ label_force_sensor_ai_time_b.Visible = visible;
+ label_force_sensor_ai_time_diff.Visible = visible;
+
+ label_force_sensor_ai_force_b.Visible = visible;
+ label_force_sensor_ai_force_diff.Visible = visible;
+ label_force_sensor_ai_force_average.Visible = visible;
+ label_force_sensor_ai_force_max.Visible = visible;
+
+ forceSensorAIChanged = true; //to actually plot
+ force_sensor_ai_drawingarea.QueueDraw(); // -- refresh
+ }
+
+ private void force_sensor_analyze_instant_calculate_params()
+ {
+ int countA = Convert.ToInt32(hscale_force_sensor_ai_a.Value);
+ int countB = Convert.ToInt32(hscale_force_sensor_ai_b.Value);
+
+ double timeA = fsAI.GetTimeMS(countA);
+ double timeB = fsAI.GetTimeMS(countB);
+ double forceA = fsAI.GetForce(countA);
+ double forceB = fsAI.GetForce(countB);
+ bool success = fsAI.CalculateRangeParams(countA, countB);
+ if(success) {
+ label_force_sensor_ai_time_diff.Text = Math.Round(timeB - timeA, 1).ToString();
+ label_force_sensor_ai_force_diff.Text = Math.Round(forceB - forceA, 1).ToString();
+ label_force_sensor_ai_force_average.Text = Math.Round(fsAI.ForceAVG, 1).ToString();
+ label_force_sensor_ai_force_max.Text = Math.Round(fsAI.ForceMAX, 1).ToString();
+ }
+ }
+
+
}
diff --git a/src/utilGtk.cs b/src/utilGtk.cs
index 9f24c27..a6e1ae6 100644
--- a/src/utilGtk.cs
+++ b/src/utilGtk.cs
@@ -665,7 +665,8 @@ public class UtilGtk
*/
- public static void ErasePaint(Gtk.DrawingArea da, Gdk.Pixmap px) {
+ public static void ErasePaint(Gtk.DrawingArea da, Gdk.Pixmap px)
+ {
px.DrawRectangle (da.Style.WhiteGC, true, 0, 0, da.Allocation.Width, da.Allocation.Height);
da.QueueDraw(); // -- refresh
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]