[chronojump] Refactorized cairo graphs
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] Refactorized cairo graphs
- Date: Thu, 2 Jan 2020 12:18:30 +0000 (UTC)
commit 1284a1be13976e7718b68205e89f30d47de3f711
Author: Xavier de Blas <xaviblas gmail com>
Date: Thu Jan 2 13:17:46 2020 +0100
Refactorized cairo graphs
glade/app1.glade | 231 +++++++++++++++++++++++--
src/Makefile.am | 6 +-
src/gui/app1/chronojump.cs | 31 +++-
src/gui/app1/chronojumpIcons.cs | 3 +
src/gui/cairo/jumpsDjOptimalFall.cs | 96 ++++++++++
src/gui/cairo/jumpsWeightFVProfile.cs | 102 +++++++++++
src/gui/{jumpsDjOptimalFall.cs => cairo/xy.cs} | 141 +++++----------
src/gui/chronojumpImporter.cs | 1 +
src/sqlite/jump.cs | 45 +++++
9 files changed, 538 insertions(+), 118 deletions(-)
---
diff --git a/glade/app1.glade b/glade/app1.glade
index 137f6c80..9488ffdf 100644
--- a/glade/app1.glade
+++ b/glade/app1.glade
@@ -5163,6 +5163,53 @@ EncoderInertialCapture</property>
<property name="position">5</property>
</packing>
</child>
+ <child>
+ <widget class="GtkRadioButton"
id="radio_mode_contacts_jumps_weight_fv_profile">
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="relief">none</property>
+ <property name="draw_indicator">False</property>
+ <property
name="group">radio_mode_contacts_general</property>
+ <signal name="toggled"
handler="on_radio_mode_contacts_jumps_weight_fv_profile_toggled" swapped="no"/>
+ <child>
+ <widget class="GtkHBox" id="hbox230">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">10</property>
+ <child>
+ <widget class="GtkImage"
id="image_tab_jumps_weight_fv_profile">
+ <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="GtkLabel"
id="label_mode_contacts_jumps_profile3">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">FV
Profile</property>
+ <property name="justify">center</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="position">6</property>
+ </packing>
+ </child>
<child>
<widget class="GtkRadioButton"
id="radio_mode_contacts_sprint">
<property name="can_focus">True</property>
@@ -5207,7 +5254,7 @@ EncoderInertialCapture</property>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
- <property name="position">6</property>
+ <property name="position">7</property>
</packing>
</child>
</widget>
@@ -18809,6 +18856,146 @@ Concentric</property>
<property name="type">tab</property>
</packing>
</child>
+ <child>
+ <widget class="GtkVBox" id="vbox_jumps_weight_fv_profile">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">2</property>
+ <child>
+ <widget class="GtkHBox" id="hbox236">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">12</property>
+ <child>
+ <widget class="GtkLabel" id="label410">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Jump
type</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox"
id="hbox_combo_select_jumps_weight_fv_profile">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <placeholder/>
+ </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">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hbox237">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">4</property>
+ <child>
+ <widget class="GtkDrawingArea"
id="drawingarea_jumps_weight_fv_profile">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <signal name="expose_event"
handler="on_drawingarea_jumps_weight_fv_profile_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="GtkVBox" id="vbox27">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <widget class="GtkButton"
id="button_jumps_weight_fv_profile_save_image">
+ <property name="visible">True</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="vbox162">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">4</property>
+ <child>
+ <widget class="GtkImage"
id="image_jumps_weight_fv_profile_save">
+ <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_save1">
+ <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">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="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label403">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label">jumps weight FV profile</property>
+ </widget>
+ <packing>
+ <property name="position">3</property>
+ <property name="tab_fill">False</property>
+ <property name="type">tab</property>
+ </packing>
+ </child>
<child>
<widget class="GtkAlignment" id="alignment_sprint">
<property name="visible">True</property>
@@ -19001,7 +19188,7 @@ Concentric</property>
</child>
</widget>
<packing>
- <property name="position">3</property>
+ <property name="position">4</property>
</packing>
</child>
<child>
@@ -19011,7 +19198,7 @@ Concentric</property>
<property name="label">Sprint</property>
</widget>
<packing>
- <property name="position">3</property>
+ <property name="position">4</property>
<property name="tab_fill">False</property>
<property name="type">tab</property>
</packing>
@@ -22366,6 +22553,9 @@ Concentric</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
<property name="expand">False</property>
@@ -22712,7 +22902,7 @@ Concentric</property>
</child>
</widget>
<packing>
- <property name="position">4</property>
+ <property name="position">5</property>
</packing>
</child>
<child>
@@ -22722,7 +22912,7 @@ Concentric</property>
<property name="label">force sensor</property>
</widget>
<packing>
- <property name="position">4</property>
+ <property name="position">5</property>
<property name="tab_fill">False</property>
<property name="type">tab</property>
</packing>
@@ -22772,7 +22962,7 @@ Concentric</property>
</child>
</widget>
<packing>
- <property name="position">5</property>
+ <property name="position">6</property>
</packing>
</child>
<child>
@@ -22782,7 +22972,7 @@ Concentric</property>
<property name="label">raceencoder</property>
</widget>
<packing>
- <property name="position">5</property>
+ <property name="position">6</property>
<property name="tab_fill">False</property>
<property name="type">tab</property>
</packing>
@@ -24613,6 +24803,18 @@ Concentric</property>
<property name="can_focus">False</property>
<property name="spacing">6</property>
<child>
+ <widget class="GtkLabel"
id="label_video_encoder_tests_will_be_filmed">
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Tests
will be filmed</property>
+ </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>
+ <child>
<widget class="GtkHBox"
id="hbox_video_encoder_capturing">
<property name="can_focus">False</property>
<property name="spacing">4</property>
@@ -24649,18 +24851,6 @@ Concentric</property>
</packing>
</child>
<child>
- <widget class="GtkLabel"
id="label_video_encoder_tests_will_be_filmed">
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Tests
will be filmed</property>
- </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>
- <child>
<widget class="GtkHBox"
id="hbox_video_encoder_no_capturing">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -31878,6 +32068,9 @@ then click this button.</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
<property name="expand">False</property>
diff --git a/src/Makefile.am b/src/Makefile.am
index 1968a96e..f8996215 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -9,12 +9,16 @@ SOURCES = \
gui/app1/chronojumpIcons.cs\
gui/app1/jumpsProfile.cs\
gui/app1/jumpsDjOptimalFall.cs\
+ gui/app1/jumpsWeightFVProfile.cs\
gui/app1/contactsExercise.cs\
gui/app1/forceSensor.cs\
gui/app1/jump.cs\
gui/app1/pulse.cs\
gui/app1/reactionTime.cs\
gui/app1/run.cs\
+ gui/cairo/xy.cs\
+ gui/cairo/jumpsDjOptimalFall.cs\
+ gui/cairo/jumpsWeightFVProfile.cs\
gui/chronojumpImporter.cs\
gui/chronojumpPersons.cs\
gui/chronopic.cs\
@@ -38,7 +42,6 @@ SOURCES = \
gui/guiTests.cs\
gui/jump.cs\
gui/jumpsProfile.cs\
- gui/jumpsDjOptimalFall.cs\
gui/jumpType.cs\
gui/restTime.cs\
gui/run.cs\
@@ -178,6 +181,7 @@ SOURCES = \
jump.cs\
jumpsProfile.cs\
jumpsDjOptimalFall.cs\
+ jumpsWeightFVProfile.cs\
jumpType.cs\
networks.cs\
person.cs\
diff --git a/src/gui/app1/chronojump.cs b/src/gui/app1/chronojump.cs
index 8c1d9e5b..2d3474a0 100644
--- a/src/gui/app1/chronojump.cs
+++ b/src/gui/app1/chronojump.cs
@@ -93,6 +93,7 @@ public partial class ChronoJumpWindow
[Widget] Gtk.RadioButton radio_mode_contacts_general;
[Widget] Gtk.RadioButton radio_mode_contacts_jumps_profile;
[Widget] Gtk.RadioButton radio_mode_contacts_jumps_dj_optimal_fall;
+ [Widget] Gtk.RadioButton radio_mode_contacts_jumps_weight_fv_profile;
[Widget] Gtk.RadioButton radio_mode_contacts_sprint;
[Widget] Gtk.Label label_sprint_person_name;
@@ -474,7 +475,7 @@ public partial class ChronoJumpWindow
private string progVersion;
private string progName;
- private enum notebook_analyze_pages { STATISTICS, JUMPSPROFILE, JUMPSDJOPTIMALFALL, SPRINT,
FORCESENSOR, RACEENCODER }
+ private enum notebook_analyze_pages { STATISTICS, JUMPSPROFILE, JUMPSDJOPTIMALFALL,
JUMPSWEIGHTFVPROFILE, SPRINT, FORCESENSOR, RACEENCODER }
private string runningFileName; //useful for knowing if there are two chronojump instances
@@ -592,6 +593,7 @@ public partial class ChronoJumpWindow
createComboSelectJumps(true);
createComboSelectJumpsDjOptimalFall(true);
+ createComboSelectJumpsWeightFVProfile(true);
createComboSelectJumpsRj(true);
createComboSelectRuns(true);
createComboSelectRunsInterval(true);
@@ -1083,6 +1085,8 @@ public partial class ChronoJumpWindow
jumpsProfileDo(true); //calculate data
else if(notebook_analyze.CurrentPage ==
Convert.ToInt32(notebook_analyze_pages.JUMPSDJOPTIMALFALL))
jumpsDjOptimalFallDo(true); //calculate data
+ else if(notebook_analyze.CurrentPage ==
Convert.ToInt32(notebook_analyze_pages.JUMPSWEIGHTFVPROFILE))
+ jumpsWeightFVProfileDo(true); //calculate data
}
else if(current_menuitem_mode == Constants.Menuitem_modes.JUMPSREACTIVE)
{
@@ -3106,6 +3110,7 @@ public partial class ChronoJumpWindow
radio_mode_contacts_general.Visible = false;
radio_mode_contacts_jumps_profile.Visible = false;
radio_mode_contacts_jumps_dj_optimal_fall.Visible = false;
+ radio_mode_contacts_jumps_weight_fv_profile.Visible = false;
radio_mode_contacts_sprint.Visible = false;
notebook_analyze.CurrentPage = Convert.ToInt32(notebook_analyze_pages.STATISTICS);
button_inspect_last_test_run_intervallic.Visible = false;
@@ -3151,6 +3156,7 @@ public partial class ChronoJumpWindow
radio_mode_contacts_general.Visible = true;
radio_mode_contacts_jumps_profile.Visible = true;
radio_mode_contacts_jumps_dj_optimal_fall.Visible = true;
+ radio_mode_contacts_jumps_weight_fv_profile.Visible = true;
}
} else {
notebooks_change(m);
@@ -3161,7 +3167,8 @@ public partial class ChronoJumpWindow
//used when return from other Menuitem_mode
radio_mode_contacts_jumps_profile.Hide();
radio_mode_contacts_jumps_dj_optimal_fall.Hide();
- if(radio_mode_contacts_jumps_profile.Active ||
radio_mode_contacts_jumps_dj_optimal_fall.Active)
+ radio_mode_contacts_jumps_weight_fv_profile.Hide();
+ if(radio_mode_contacts_jumps_profile.Active ||
radio_mode_contacts_jumps_dj_optimal_fall.Active || radio_mode_contacts_jumps_weight_fv_profile.Active)
radio_mode_contacts_capture.Active = true;
}
}
@@ -3199,6 +3206,7 @@ public partial class ChronoJumpWindow
//used when return from other Menuitem_mode
radio_mode_contacts_jumps_profile.Hide();
radio_mode_contacts_jumps_dj_optimal_fall.Hide();
+ radio_mode_contacts_jumps_weight_fv_profile.Hide();
if(radio_mode_contacts_sprint.Active)
radio_mode_contacts_capture.Active = true;
}
@@ -6242,6 +6250,7 @@ LogB.Debug("mc finished 5");
if(jumpTypeAddWin.InsertedSimple) {
createComboSelectJumps(false);
createComboSelectJumpsDjOptimalFall(false);
+ createComboSelectJumpsWeightFVProfile(false);
UtilGtk.ComboUpdate(combo_result_jumps,
SqliteJumpType.SelectJumpTypes(false, Constants.AllJumpsNameStr(),
"", true), ""); //without filter, only select name
@@ -7039,6 +7048,7 @@ LogB.Debug("mc finished 5");
radio_mode_contacts_general.Visible = false;
radio_mode_contacts_jumps_profile.Visible = false;
radio_mode_contacts_jumps_dj_optimal_fall.Visible = false;
+ radio_mode_contacts_jumps_weight_fv_profile.Visible = false;
radio_mode_contacts_sprint.Visible = false;
notebook_capture_analyze.CurrentPage = 0;
@@ -7069,6 +7079,13 @@ LogB.Debug("mc finished 5");
notebook_analyze.CurrentPage =
Convert.ToInt32(notebook_analyze_pages.JUMPSDJOPTIMALFALL);
jumpsDjOptimalFallDo(true);
}
+
+ radio_mode_contacts_jumps_weight_fv_profile.Visible = true;
+ if(radio_mode_contacts_jumps_weight_fv_profile.Active)
+ {
+ notebook_analyze.CurrentPage =
Convert.ToInt32(notebook_analyze_pages.JUMPSWEIGHTFVPROFILE);
+ jumpsWeightFVProfileDo(true);
+ }
}
else if(current_menuitem_mode == Constants.Menuitem_modes.RUNSINTERVALLIC)
radio_mode_contacts_sprint.Visible = true;
@@ -7104,6 +7121,14 @@ LogB.Debug("mc finished 5");
jumpsDjOptimalFallDo(true);
}
}
+ private void on_radio_mode_contacts_jumps_weight_fv_profile_toggled (object o, EventArgs args)
+ {
+ if(radio_mode_contacts_jumps_weight_fv_profile.Active)
+ {
+ notebook_analyze.CurrentPage =
Convert.ToInt32(notebook_analyze_pages.JUMPSWEIGHTFVPROFILE);
+ jumpsWeightFVProfileDo(true);
+ }
+ }
private void on_radio_mode_contacts_sprint_toggled (object o, EventArgs args)
{
if(radio_mode_contacts_sprint.Active)
@@ -7287,6 +7312,7 @@ LogB.Debug("mc finished 5");
{
radio_mode_contacts_jumps_profile.Hide();
radio_mode_contacts_jumps_dj_optimal_fall.Hide();
+ radio_mode_contacts_jumps_weight_fv_profile.Hide();
}
else if(current_menuitem_mode == Constants.Menuitem_modes.RUNSINTERVALLIC)
{
@@ -7528,6 +7554,7 @@ LogB.Debug("mc finished 5");
{
radio_mode_contacts_jumps_profile.Visible = ! start;
radio_mode_contacts_jumps_dj_optimal_fall.Visible = ! start;
+ radio_mode_contacts_jumps_weight_fv_profile.Visible = ! start;
} else if(current_menuitem_mode == Constants.Menuitem_modes.RUNSINTERVALLIC)
radio_mode_contacts_sprint.Visible = ! start;
diff --git a/src/gui/app1/chronojumpIcons.cs b/src/gui/app1/chronojumpIcons.cs
index cd5b8b7b..da3a0c03 100644
--- a/src/gui/app1/chronojumpIcons.cs
+++ b/src/gui/app1/chronojumpIcons.cs
@@ -211,6 +211,7 @@ public partial class ChronoJumpWindow
[Widget] Gtk.Image image_encoder_analyze_1RM_save_1;
[Widget] Gtk.Image image_encoder_analyze_image_save_2;
[Widget] Gtk.Image image_forcesensor_analyze_image_save;
+ [Widget] Gtk.Image image_forcesensor_analyze_image_save1;
[Widget] Gtk.Image image_forcesensor_analyze_image_save2;
[Widget] Gtk.Image image_forcesensor_analyze_image_save3;
[Widget] Gtk.Image image_forcesensor_analyze_image_save5;
@@ -675,6 +676,7 @@ public partial class ChronoJumpWindow
image_force_sensor_analyze_analyze.Pixbuf = pixbuf;
image_jumps_profile_save.Pixbuf = pixbuf;
image_jumps_dj_optimal_fall_save.Pixbuf = pixbuf;
+ image_jumps_weight_fv_profile_save.Pixbuf = pixbuf;
image_encoder_analyze_image_compujump_send_email_image.Pixbuf = pixbuf;
pixbuf = new Pixbuf (null, Util.GetImagePath(false) + "save.png");
@@ -684,6 +686,7 @@ public partial class ChronoJumpWindow
image_encoder_analyze_1RM_save_1.Pixbuf = pixbuf;
image_encoder_analyze_image_save_2.Pixbuf = pixbuf;
image_forcesensor_analyze_image_save.Pixbuf = pixbuf;
+ image_forcesensor_analyze_image_save1.Pixbuf = pixbuf;
image_forcesensor_analyze_image_save2.Pixbuf = pixbuf;
image_forcesensor_analyze_image_save3.Pixbuf = pixbuf;
image_forcesensor_analyze_image_save5.Pixbuf = pixbuf;
diff --git a/src/gui/cairo/jumpsDjOptimalFall.cs b/src/gui/cairo/jumpsDjOptimalFall.cs
new file mode 100644
index 00000000..8f5ec661
--- /dev/null
+++ b/src/gui/cairo/jumpsDjOptimalFall.cs
@@ -0,0 +1,96 @@
+
+/*
+ * This file is part of ChronoJump
+ *
+ * ChronoJump 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 2 of the License, or
+ * (at your option) any later version.
+ *
+ * ChronoJump 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 this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Copyright (C) 2004-2020 Xavier de Blas <xaviblas gmail com>
+ * Copyright (C) 2004-2020 Jordi Rodeiro <jordirodeiro gmail com>
+ */
+
+using System;
+using System.Collections.Generic; //List
+using Gtk;
+using Cairo;
+
+
+public class JumpsDjOptimalFallGraph : CairoXY
+{
+ //constructor when there are no points
+ public JumpsDjOptimalFallGraph (DrawingArea area)//, string title, string jumpType, string date)
+ {
+ this.area = area;
+
+ initGraph();
+
+ g.SetFontSize(16);
+ printText(area.Allocation.Width /2, area.Allocation.Height /2, 24, textHeight, "Need to
execute jumps DjOptimalFall BORRAR", g, true);
+
+ endGraph();
+ }
+
+ //regular constructor
+ public JumpsDjOptimalFallGraph (
+ List<Point> point_l, double[] coefs,
+ LeastSquares.ParaboleTypes paraboleType,
+ double xAtMMaxY, //x at Model MaxY
+ double pointsMaxValue,
+ DrawingArea area,
+ string title, string jumpType, string date)
+ {
+ this.point_l = point_l;
+ this.coefs = coefs;
+ this.paraboleType = paraboleType;
+ this.xAtMMaxY = xAtMMaxY;
+ this.pointsMaxValue = pointsMaxValue;
+ this.area = area;
+ this.title = title;
+ this.jumpType = jumpType;
+ this.date = date;
+ }
+
+ public override void Do()
+ {
+ LogB.Information("at JumpsDjOptimalFallGraph.Do");
+ initGraph();
+
+ findPointMaximums();
+ findAbsoluteMaximums();
+ paintAxisAndGrid();
+
+ LogB.Information(string.Format("coef length:{0}", coefs.Length));
+ if(coefs.Length == 3)
+ plotPredictedLine();
+
+ plotRealPoints();
+
+ if(coefs.Length == 3)
+ {
+ if(paraboleType == LeastSquares.ParaboleTypes.CONVEX)
+ {
+ plotPredictedMaxPoint();
+ writeTextPredictedPoint();
+ }
+ else
+ writeTextConcaveParabole();
+ } else {
+ writeTextNeed3PointsWithDifferentFall();
+ }
+ writeTitle();
+
+ endGraph();
+ }
+
+}
diff --git a/src/gui/cairo/jumpsWeightFVProfile.cs b/src/gui/cairo/jumpsWeightFVProfile.cs
new file mode 100644
index 00000000..f136dc20
--- /dev/null
+++ b/src/gui/cairo/jumpsWeightFVProfile.cs
@@ -0,0 +1,102 @@
+
+/*
+ * This file is part of ChronoJump
+ *
+ * ChronoJump 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 2 of the License, or
+ * (at your option) any later version.
+ *
+ * ChronoJump 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 this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Copyright (C) 2004-2020 Xavier de Blas <xaviblas gmail com>
+ * Copyright (C) 2004-2020 Jordi Rodeiro <jordirodeiro gmail com>
+ */
+
+using System;
+using System.Collections.Generic; //List
+using Gtk;
+using Cairo;
+
+
+public class JumpsWeightFVProfileGraph : CairoXY
+{
+ //constructor when there are no points
+ public JumpsWeightFVProfileGraph (DrawingArea area)//, string title, string jumpType, string date)
+ {
+ this.area = area;
+
+ initGraph();
+
+ g.SetFontSize(16);
+ printText(area.Allocation.Width /2, area.Allocation.Height /2, 24, textHeight, "Need to
execute jumps weightFV BORRAR", g, true);
+
+ endGraph();
+ }
+
+ //regular constructor
+ public JumpsWeightFVProfileGraph (
+ List<Point> point_l, double[] coefs,
+ //LeastSquares.ParaboleTypes paraboleType,
+ //double xAtMMaxY, //x at Model MaxY
+ //double pointsMaxValue,
+ DrawingArea area,
+ string title, string jumpType, string date)
+ {
+ this.point_l = point_l;
+ this.coefs = coefs;
+ /*
+ this.paraboleType = paraboleType;
+ this.xAtMMaxY = xAtMMaxY;
+ this.pointsMaxValue = pointsMaxValue;
+ */
+ this.area = area;
+ this.title = title;
+ this.jumpType = jumpType;
+ this.date = date;
+ }
+
+ public override void Do()
+ {
+ LogB.Information("at JumpsWeightFVProfileGraph.Do");
+ initGraph();
+
+ findPointMaximums();
+ //findAbsoluteMaximums();
+ paintAxisAndGrid();
+
+ /*
+ LogB.Information(string.Format("coef length:{0}", coefs.Length));
+ if(coefs.Length == 3)
+ plotPredictedLine();
+ */
+
+ plotRealPoints();
+
+ /*
+ if(coefs.Length == 3)
+ {
+ if(paraboleType == LeastSquares.ParaboleTypes.CONVEX)
+ {
+ plotPredictedMaxPoint();
+ writeTextPredictedPoint();
+ }
+ else
+ writeTextConcaveParabole();
+ } else {
+ writeTextNeed3PointsWithDifferentFall();
+ }
+ */
+ writeTitle();
+
+ endGraph();
+ }
+
+}
diff --git a/src/gui/jumpsDjOptimalFall.cs b/src/gui/cairo/xy.cs
similarity index 79%
rename from src/gui/jumpsDjOptimalFall.cs
rename to src/gui/cairo/xy.cs
index 79710531..c62ec711 100644
--- a/src/gui/jumpsDjOptimalFall.cs
+++ b/src/gui/cairo/xy.cs
@@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * Copyright (C) 2004-2019 Xavier de Blas <xaviblas gmail com>
+ * Copyright (C) 2004-2020 Xavier de Blas <xaviblas gmail com>
*/
using System;
@@ -24,19 +24,19 @@ using System.Collections.Generic; //List
using Gtk;
using Cairo;
-public class JumpsDjOptimalFallGraph
+public abstract class CairoXY
{
- List<Point> point_l;
- double[] coefs;
- LeastSquares.ParaboleTypes paraboleType;
- double xAtMMaxY;
- double pointsMaxValue;
- DrawingArea area;
- string title;
- string jumpType;
- string date;
-
- Cairo.Context g;
+ protected List<Point> point_l;
+ protected double[] coefs;
+ protected LeastSquares.ParaboleTypes paraboleType;
+ protected double xAtMMaxY;
+ protected double pointsMaxValue;
+ protected DrawingArea area;
+ protected string title;
+ protected string jumpType;
+ protected string date;
+
+ protected Cairo.Context g;
double minX = 1000000;
double maxX = 0;
double minY = 1000000;
@@ -53,72 +53,11 @@ public class JumpsDjOptimalFallGraph
const int outerMargins = 30; //blank space outside the axis
const int innerMargins = 30; //space between the axis and the real coordinates
const int totalMargins = outerMargins + innerMargins;
- const int textHeight = 12;
+ protected const int textHeight = 12;
- //constructor when there are no points
- public JumpsDjOptimalFallGraph (DrawingArea area)//, string title, string jumpType, string date)
- {
- this.area = area;
-
- initGraph();
+ public abstract void Do();
- g.SetFontSize(16);
- printText(area.Allocation.Width /2, area.Allocation.Height /2, 24, textHeight, "Need to
execute jumps", g, true);
-
- endGraph();
- }
-
- //regular constructor
- public JumpsDjOptimalFallGraph (
- List<Point> point_l, double[] coefs,
- LeastSquares.ParaboleTypes paraboleType,
- double xAtMMaxY, //x at Model MaxY
- double pointsMaxValue, DrawingArea area,
- string title, string jumpType, string date)
- {
- this.point_l = point_l;
- this.coefs = coefs;
- this.paraboleType = paraboleType;
- this.xAtMMaxY = xAtMMaxY;
- this.pointsMaxValue = pointsMaxValue;
- this.area = area;
- this.title = title;
- this.jumpType = jumpType;
- this.date = date;
- }
-
- public void Do()
- {
- LogB.Information("at JumpsDjOptimalFallGraph.Do");
- initGraph();
-
- findMaximums();
- paintAxisAndGrid();
-
- LogB.Information(string.Format("coef length:{0}", coefs.Length));
- if(coefs.Length == 3)
- plotPredictedLine();
-
- plotRealPoints();
-
- if(coefs.Length == 3)
- {
- if(paraboleType == LeastSquares.ParaboleTypes.CONVEX)
- {
- plotPredictedMaxPoint();
- writeTextPredictedPoint();
- }
- else
- writeTextConcaveParabole();
- } else {
- writeTextNeed3PointsWithDifferentFall();
- }
- writeTitle();
-
- endGraph();
- }
-
- private void initGraph()
+ protected void initGraph()
{
//1 create context
g = Gdk.CairoHelper.Create (area.GdkWindow);
@@ -141,7 +80,7 @@ public class JumpsDjOptimalFallGraph
blue = colorFromRGB(178, 223, 238); //lightblue
}
- private void findMaximums()
+ protected void findPointMaximums()
{
foreach(Point p in point_l)
{
@@ -167,6 +106,13 @@ public class JumpsDjOptimalFallGraph
maxY += .5 * maxY;
}
+ absoluteMaxX = maxX;
+ absoluteMaxY = maxY;
+ }
+
+ //includes point and model
+ protected void findAbsoluteMaximums()
+ {
if(coefs.Length == 3 && paraboleType == LeastSquares.ParaboleTypes.CONVEX)
{
//x
@@ -179,13 +125,10 @@ public class JumpsDjOptimalFallGraph
absoluteMaxY = yAtMMaxY;
if(maxY > absoluteMaxY)
absoluteMaxY = maxY;
- } else {
- absoluteMaxX = maxX;
- absoluteMaxY = maxY;
}
}
- private void paintAxisAndGrid()
+ protected void paintAxisAndGrid()
{
//1 paint axis
g.MoveTo(outerMargins, outerMargins);
@@ -200,7 +143,7 @@ public class JumpsDjOptimalFallGraph
paintGrid (minX, absoluteMaxX, 5, false);
}
- private void plotPredictedLine()
+ protected void plotPredictedLine()
{
bool firstValue = false;
double minMax50Percent = (minX + absoluteMaxX)/2;
@@ -245,7 +188,7 @@ public class JumpsDjOptimalFallGraph
g.Stroke ();
}
- private void plotRealPoints()
+ protected void plotRealPoints()
{
foreach(Point p in point_l)
{
@@ -272,7 +215,7 @@ public class JumpsDjOptimalFallGraph
}
}
- private void plotPredictedMaxPoint()
+ protected void plotPredictedMaxPoint()
{
double xgraph = calculatePaintX(xAtMMaxY, graphWidth, absoluteMaxX, minX, totalMargins,
totalMargins);
double ygraph = calculatePaintY(yAtMMaxY, graphHeight, absoluteMaxY, minY, totalMargins,
totalMargins);
@@ -296,7 +239,7 @@ public class JumpsDjOptimalFallGraph
g.Stroke ();
}
- private void writeTitle()
+ protected void writeTitle()
{
writeTextAtRight(-5, title, true);
writeTextAtRight(-4, "Optimal fall height", false);
@@ -304,26 +247,26 @@ public class JumpsDjOptimalFallGraph
writeTextAtRight(-2, date, false);
}
- private void writeTextPredictedPoint()
+ protected void writeTextPredictedPoint()
{
writeTextAtRight(0, "Fall: " + Util.TrimDecimals(xAtMMaxY, 2) + " cm", false);
writeTextAtRight(1, "Jump height: " + Util.TrimDecimals(yAtMMaxY, 2) + " cm", false);
}
- private void writeTextConcaveParabole()
+ protected void writeTextConcaveParabole()
{
writeTextAtRight(0, "Error:", false);
writeTextAtRight(1, "Parabole is concave", false);
}
- private void writeTextNeed3PointsWithDifferentFall()
+ protected void writeTextNeed3PointsWithDifferentFall()
{
writeTextAtRight(0, "Error:", false);
writeTextAtRight(1, "Need at least 3 points", false);
writeTextAtRight(2, "with different falling heights", false);
}
- private void writeTextAtRight(int line, string text, bool bold)
+ protected void writeTextAtRight(int line, string text, bool bold)
{
if(bold)
g.SelectFontFace("Helvetica", Cairo.FontSlant.Normal, Cairo.FontWeight.Bold);
@@ -334,15 +277,21 @@ public class JumpsDjOptimalFallGraph
g.SelectFontFace("Helvetica", Cairo.FontSlant.Normal, Cairo.FontWeight.Normal);
}
- private void endGraph()
+ protected void endGraph()
{
g.GetTarget().Dispose ();
g.Dispose ();
}
- private void paintGrid (double min, double max, int seps, bool horiz)
+ //TODO: fix if min == max (crashes)
+ protected void paintGrid (double min, double max, int seps, bool horiz)
{
LogB.Information(string.Format("paintGrid: {0}, {1}, {2}, {3}", min, max, seps, horiz));
+
+ //TODO: improve this
+ if(min == max)
+ return;
+
//show 5 steps positive, 5 negative (if possible)
int temp = Convert.ToInt32(Util.DivideSafe(max - min, seps));
int step = temp;
@@ -391,22 +340,22 @@ public class JumpsDjOptimalFallGraph
g.Restore();
}
- private double calculatePaintX(double currentValue, int ancho, double maxValue, double minValue, int
rightMargin, int leftMargin)
+ protected double calculatePaintX(double currentValue, int ancho, double maxValue, double minValue,
int rightMargin, int leftMargin)
{
return leftMargin + (currentValue - minValue) * (ancho - rightMargin - leftMargin) /
(maxValue - minValue);
}
- private double calculatePaintY(double currentValue, int alto, double maxValue, double minValue, int
topMargin, int bottomMargin)
+ protected double calculatePaintY(double currentValue, int alto, double maxValue, double minValue, int
topMargin, int bottomMargin)
{
return alto - bottomMargin - ((currentValue - minValue) * (alto - topMargin - bottomMargin)
/ (maxValue - minValue));
}
- private Cairo.Color colorFromRGB(int red, int green, int blue)
+ protected Cairo.Color colorFromRGB(int red, int green, int blue)
{
return new Cairo.Color(red/256.0, green/256.0, blue/256.0);
}
- private void printText (int x, int y, int height, int textHeight, string text, Cairo.Context g, bool
centered)
+ protected void printText (int x, int y, int height, int textHeight, string text, Cairo.Context g,
bool centered)
{
int moveToLeft = 0;
if(centered)
diff --git a/src/gui/chronojumpImporter.cs b/src/gui/chronojumpImporter.cs
index 43b74d05..507626b3 100644
--- a/src/gui/chronojumpImporter.cs
+++ b/src/gui/chronojumpImporter.cs
@@ -144,6 +144,7 @@ public partial class ChronoJumpWindow
combo_result_jumps.Active = 0;
createComboSelectJumpsDjOptimalFall(false);
+ createComboSelectJumpsWeightFVProfile(false);
//2) reactive jump
createComboSelectJumpsRj(false);
diff --git a/src/sqlite/jump.cs b/src/sqlite/jump.cs
index 35cc674c..db70321e 100644
--- a/src/sqlite/jump.cs
+++ b/src/sqlite/jump.cs
@@ -376,6 +376,51 @@ class SqliteJump : Sqlite
return jmp_l;
}
+ //TODO: too similar to above method, unify them
+ //TODO: note we do not want % weight, we want absolute weight so we need to select on personSession77
table
+ public static List<Jump> SelectWeightJumps (int pID, int sID, string jumpType, bool
onlyHigherOfSameWeight)
+ {
+ string personID = pID.ToString();
+ string sessionID = sID.ToString();
+
+ Sqlite.Open();
+
+ // Selecciona les dades de tots els salts
+ dbcmd.CommandText = "SELECT * FROM jump WHERE personID = " + personID +
+ " AND sessionID = " + sessionID + " AND jump.type = \"" + jumpType + "\"";
+
+ if(onlyHigherOfSameWeight)
+ dbcmd.CommandText += " ORDER BY weight DESC, tv DESC";
+
+ LogB.SQL(dbcmd.CommandText.ToString());
+ dbcmd.ExecuteNonQuery();
+
+ SqliteDataReader reader;
+ reader = dbcmd.ExecuteReader();
+
+ List<Jump> jmp_l = DataReaderToJump (reader);
+
+ reader.Close();
+ Sqlite.Close();
+
+ if(onlyHigherOfSameWeight)
+ {
+ LogB.Information("PPPP");
+ List<Jump> jmp_l_purged = new List<Jump>();
+ double lastWeight = 0;
+ foreach(Jump j in jmp_l)
+ {
+ if(j.Weight != lastWeight)
+ jmp_l_purged.Add(j);
+
+ lastWeight = j.Weight;
+ }
+ return jmp_l_purged;
+ }
+
+ return jmp_l;
+ }
+
public static void Update(int jumpID, string type, string tv, string tc, string fall, int personID,
double weight, string description, double angle)
{
Sqlite.Open();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]