[chronojump] JumpsDjOptimalFall with jump type selection. Almost done all!
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] JumpsDjOptimalFall with jump type selection. Almost done all!
- Date: Fri, 27 Dec 2019 17:23:36 +0000 (UTC)
commit f13081b29efd847579e3c79d7382978e2e14c038
Author: Xavier de Blas <xaviblas gmail com>
Date: Fri Dec 27 18:23:13 2019 +0100
JumpsDjOptimalFall with jump type selection. Almost done all!
glade/app1.glade | 73 ++++++++++++++++++++++------
src/gui/app1/chronojump.cs | 4 +-
src/gui/app1/chronojumpJumpsDjOptimalFall.cs | 38 +++++++++++++--
src/gui/chronojumpImporter.cs | 2 +
src/gui/cjCombo.cs | 11 ++++-
src/gui/jumpsDjOptimalFall.cs | 21 ++++----
src/jumpsDjOptimalFall.cs | 4 +-
src/sqlite/jump.cs | 6 +--
8 files changed, 123 insertions(+), 36 deletions(-)
---
diff --git a/glade/app1.glade b/glade/app1.glade
index 68daa48d..137f6c80 100644
--- a/glade/app1.glade
+++ b/glade/app1.glade
@@ -5145,7 +5145,7 @@ EncoderInertialCapture</property>
<widget class="GtkLabel"
id="label_mode_contacts_jumps_profile2">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="label">Dja optimal
fall</property>
+ <property name="label">Dj optimal fall</property>
<property name="justify">center</property>
</widget>
<packing>
@@ -18672,6 +18672,45 @@ Concentric</property>
<widget class="GtkVBox" id="vbox_jumps_dj_optimal_fall">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="spacing">2</property>
+ <child>
+ <widget class="GtkHBox" id="hbox172">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">12</property>
+ <child>
+ <widget class="GtkLabel" id="label402">
+ <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_dj_optimal_fall">
+ <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="hbox323">
<property name="visible">True</property>
@@ -18750,7 +18789,7 @@ Concentric</property>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
- <property name="position">0</property>
+ <property name="position">1</property>
</packing>
</child>
</widget>
@@ -22324,6 +22363,9 @@ Concentric</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
<property name="expand">False</property>
@@ -24571,18 +24613,6 @@ 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>
@@ -24619,6 +24649,18 @@ 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>
@@ -31833,6 +31875,9 @@ then click this button.</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
<property name="expand">False</property>
diff --git a/src/gui/app1/chronojump.cs b/src/gui/app1/chronojump.cs
index d8a87701..8c1d9e5b 100644
--- a/src/gui/app1/chronojump.cs
+++ b/src/gui/app1/chronojump.cs
@@ -591,6 +591,7 @@ public partial class ChronoJumpWindow
createComboSelectJumps(true);
+ createComboSelectJumpsDjOptimalFall(true);
createComboSelectJumpsRj(true);
createComboSelectRuns(true);
createComboSelectRunsInterval(true);
@@ -1884,7 +1885,7 @@ public partial class ChronoJumpWindow
{
if(create)
{
- comboSelectJumps = new CjComboSelectJumps(combo_select_jumps,
hbox_combo_select_jumps);
+ comboSelectJumps = new CjComboSelectJumps(combo_select_jumps,
hbox_combo_select_jumps, false);
combo_select_jumps = comboSelectJumps.Combo;
combo_select_jumps.Changed += new EventHandler (on_combo_select_jumps_changed);
} else {
@@ -6240,6 +6241,7 @@ LogB.Debug("mc finished 5");
LogB.Information("ACCEPTED Add new jump type");
if(jumpTypeAddWin.InsertedSimple) {
createComboSelectJumps(false);
+ createComboSelectJumpsDjOptimalFall(false);
UtilGtk.ComboUpdate(combo_result_jumps,
SqliteJumpType.SelectJumpTypes(false, Constants.AllJumpsNameStr(),
"", true), ""); //without filter, only select name
diff --git a/src/gui/app1/chronojumpJumpsDjOptimalFall.cs b/src/gui/app1/chronojumpJumpsDjOptimalFall.cs
index 6518e7ff..ca530353 100644
--- a/src/gui/app1/chronojumpJumpsDjOptimalFall.cs
+++ b/src/gui/app1/chronojumpJumpsDjOptimalFall.cs
@@ -29,8 +29,35 @@ public partial class ChronoJumpWindow
[Widget] Gtk.DrawingArea drawingarea_jumps_dj_optimal_fall;
[Widget] Gtk.Image image_tab_jumps_dj_optimal_fall;
[Widget] Gtk.Image image_jumps_dj_optimal_fall_save;
+ [Widget] Gtk.HBox hbox_combo_select_jumps_dj_optimal_fall;
+ [Widget] Gtk.ComboBox combo_select_jumps_dj_optimal_fall;
JumpsDjOptimalFall jumpsDjOptimalFall;
+ CjComboSelectJumps comboSelectJumpsDjOptimalFall;
+
+ // combo (start)
+ private void createComboSelectJumpsDjOptimalFall(bool create)
+ {
+ if(create)
+ {
+ comboSelectJumpsDjOptimalFall = new
CjComboSelectJumps(combo_select_jumps_dj_optimal_fall, hbox_combo_select_jumps_dj_optimal_fall, true);
+ combo_select_jumps_dj_optimal_fall = comboSelectJumpsDjOptimalFall.Combo;
+ combo_select_jumps_dj_optimal_fall.Changed += new EventHandler
(on_combo_select_jumps_dj_optimal_fall_changed);
+ } else {
+ comboSelectJumpsDjOptimalFall.Fill();
+ combo_select_jumps_dj_optimal_fall = comboSelectJumpsDjOptimalFall.Combo;
+ }
+ combo_select_jumps_dj_optimal_fall.Sensitive = true;
+ }
+ private void on_combo_select_jumps_dj_optimal_fall_changed(object o, EventArgs args)
+ {
+ ComboBox combo = o as ComboBox;
+ if (o == null)
+ return;
+
+ jumpsDjOptimalFallDo(true);
+ }
+ // combo (end)
private void jumpsDjOptimalFallDo (bool calculateData)
{
@@ -42,15 +69,16 @@ public partial class ChronoJumpWindow
calculateData = true;
}
+ string jumpType = UtilGtk.ComboGetActive(combo_select_jumps_dj_optimal_fall);
+
if(calculateData)
- jumpsDjOptimalFall.Calculate(currentPerson.UniqueID, currentSession.UniqueID);
+ jumpsDjOptimalFall.Calculate(currentPerson.UniqueID, currentSession.UniqueID,
jumpType);
if(jumpsDjOptimalFall.Point_l.Count == 0)
{
//constructor for showing blank screen with a message
- new JumpsDjOptimalFallGraph(
- drawingarea_jumps_dj_optimal_fall,
- currentPerson.Name, currentSession.DateShort);
+ new JumpsDjOptimalFallGraph(drawingarea_jumps_dj_optimal_fall);
+ //currentPerson.Name, jumpType, currentSession.DateShort);
} else {
//regular constructor
JumpsDjOptimalFallGraph jdofg = new JumpsDjOptimalFallGraph(
@@ -60,7 +88,7 @@ public partial class ChronoJumpWindow
jumpsDjOptimalFall.XatMaxY, //model
jumpsDjOptimalFall.GetMaxValue(),
drawingarea_jumps_dj_optimal_fall,
- currentPerson.Name, currentSession.DateShort);
+ currentPerson.Name, jumpType, currentSession.DateShort);
jdofg.Do();
}
}
diff --git a/src/gui/chronojumpImporter.cs b/src/gui/chronojumpImporter.cs
index 8a6cb7ef..43b74d05 100644
--- a/src/gui/chronojumpImporter.cs
+++ b/src/gui/chronojumpImporter.cs
@@ -143,6 +143,8 @@ public partial class ChronoJumpWindow
combo_select_jumps.Active = 0;
combo_result_jumps.Active = 0;
+ createComboSelectJumpsDjOptimalFall(false);
+
//2) reactive jump
createComboSelectJumpsRj(false);
UtilGtk.ComboUpdate(combo_result_jumps_rj,
diff --git a/src/gui/cjCombo.cs b/src/gui/cjCombo.cs
index 473b982c..759d0974 100644
--- a/src/gui/cjCombo.cs
+++ b/src/gui/cjCombo.cs
@@ -160,14 +160,18 @@ public class CjCombo
}
}
+
//------------ jumps -------------
public class CjComboSelectJumps : CjCombo
{
- public CjComboSelectJumps(Gtk.ComboBox combo_select_jumps, Gtk.HBox hbox_combo_select_jumps)
+ private bool onlyFallingJumps;
+
+ public CjComboSelectJumps(Gtk.ComboBox combo_select_jumps, Gtk.HBox hbox_combo_select_jumps, bool
onlyFallingJumps)
{
this.combo = combo_select_jumps;
this.hbox = hbox_combo_select_jumps;
+ this.onlyFallingJumps = onlyFallingJumps;
create();
Fill();
@@ -176,7 +180,10 @@ public class CjComboSelectJumps : CjCombo
protected override void select()
{
- l_types = (List<object>) SqliteJumpType.SelectJumpTypesNew(false, "", "", false); //without
alljumpsname, without filter, not only name
+ if(onlyFallingJumps)
+ l_types = (List<object>) SqliteJumpType.SelectJumpTypesNew(false, "", "TC", false);
//without alljumpsname, not startIn, not only name
+ else
+ l_types = (List<object>) SqliteJumpType.SelectJumpTypesNew(false, "", "", false);
//without alljumpsname, without filter, not only name
}
}
diff --git a/src/gui/jumpsDjOptimalFall.cs b/src/gui/jumpsDjOptimalFall.cs
index af03cb1a..79710531 100644
--- a/src/gui/jumpsDjOptimalFall.cs
+++ b/src/gui/jumpsDjOptimalFall.cs
@@ -33,6 +33,7 @@ public class JumpsDjOptimalFallGraph
double pointsMaxValue;
DrawingArea area;
string title;
+ string jumpType;
string date;
Cairo.Context g;
@@ -55,7 +56,7 @@ public class JumpsDjOptimalFallGraph
const int textHeight = 12;
//constructor when there are no points
- public JumpsDjOptimalFallGraph (DrawingArea area, string title, string date)
+ public JumpsDjOptimalFallGraph (DrawingArea area)//, string title, string jumpType, string date)
{
this.area = area;
@@ -72,7 +73,8 @@ public class JumpsDjOptimalFallGraph
List<Point> point_l, double[] coefs,
LeastSquares.ParaboleTypes paraboleType,
double xAtMMaxY, //x at Model MaxY
- double pointsMaxValue, DrawingArea area, string title, string date)
+ double pointsMaxValue, DrawingArea area,
+ string title, string jumpType, string date)
{
this.point_l = point_l;
this.coefs = coefs;
@@ -80,8 +82,9 @@ public class JumpsDjOptimalFallGraph
this.xAtMMaxY = xAtMMaxY;
this.pointsMaxValue = pointsMaxValue;
this.area = area;
- this.title = title; //TODO: use this
- this.date = date; //TODO: use this
+ this.title = title;
+ this.jumpType = jumpType;
+ this.date = date;
}
public void Do()
@@ -295,16 +298,16 @@ public class JumpsDjOptimalFallGraph
private void writeTitle()
{
- writeTextAtRight(-4, title, true);
- writeTextAtRight(-3, "Optimal fall", false);
+ writeTextAtRight(-5, title, true);
+ writeTextAtRight(-4, "Optimal fall height", false);
+ writeTextAtRight(-3, "Jumptype: " + jumpType, false);
writeTextAtRight(-2, date, false);
}
private void writeTextPredictedPoint()
{
- writeTextAtRight(0, "Optimal values:", false);
- writeTextAtRight(1, "Fall: " + Util.TrimDecimals(xAtMMaxY, 2) + " cm", false);
- writeTextAtRight(2, "Jump height: " + Util.TrimDecimals(yAtMMaxY, 2) + " cm", false);
+ writeTextAtRight(0, "Fall: " + Util.TrimDecimals(xAtMMaxY, 2) + " cm", false);
+ writeTextAtRight(1, "Jump height: " + Util.TrimDecimals(yAtMMaxY, 2) + " cm", false);
}
private void writeTextConcaveParabole()
diff --git a/src/jumpsDjOptimalFall.cs b/src/jumpsDjOptimalFall.cs
index d71baede..fe192fc0 100644
--- a/src/jumpsDjOptimalFall.cs
+++ b/src/jumpsDjOptimalFall.cs
@@ -31,10 +31,10 @@ public class JumpsDjOptimalFall
{
}
- public void Calculate (int personID, int sessionID)
+ public void Calculate (int personID, int sessionID, string jumpType)
{
//1 get data
- List<Jump> jump_l = SqliteJump.SelectDJa (personID, sessionID, true);
+ List<Jump> jump_l = SqliteJump.SelectDJ (personID, sessionID, jumpType, true);
//2 convert to list of Point
//List<Point> point_l = new List<Point>();
diff --git a/src/sqlite/jump.cs b/src/sqlite/jump.cs
index 5dc177fe..5cff7c97 100644
--- a/src/sqlite/jump.cs
+++ b/src/sqlite/jump.cs
@@ -333,8 +333,8 @@ class SqliteJump : Sqlite
return jmp_l;
}
- //last boolean: on JumpsDja analyze graph, only show the higher of values of the same fall
- public static List<Jump> SelectDJa (int pID, int sID, bool onlyHigherOfSameFall)
+ //last boolean: on JumpsDj analyze graph, only show the higher of values of the same fall
+ public static List<Jump> SelectDJ (int pID, int sID, string jumpType, bool onlyHigherOfSameFall)
{
string personID = pID.ToString();
string sessionID = sID.ToString();
@@ -343,7 +343,7 @@ class SqliteJump : Sqlite
// Selecciona les dades de tots els salts
dbcmd.CommandText = "SELECT * FROM jump WHERE personID = " + personID +
- " AND sessionID = " + sessionID + " AND jump.type = \"DJa\" ";
+ " AND sessionID = " + sessionID + " AND jump.type = \"" + jumpType + "\"";
if(onlyHigherOfSameFall)
dbcmd.CommandText += " ORDER BY fall DESC, tv DESC";
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]