[chronojump] cairo jump graphs show better messages if need data



commit b92acb02329b2508cde0131da13cf01e103edaec
Author: Xavier de Blas <xaviblas gmail com>
Date:   Tue Jan 7 16:10:00 2020 +0100

    cairo jump graphs show better messages if need data

 src/gui/app1/jumpsDjOptimalFall.cs    |  2 +-
 src/gui/cairo/jumpsDjOptimalFall.cs   |  4 ++--
 src/gui/cairo/jumpsWeightFVProfile.cs | 19 ++++++++++++++-----
 src/jumpsWeightFVProfile.cs           |  4 ++--
 src/sqlite/jump.cs                    |  4 ++--
 5 files changed, 21 insertions(+), 12 deletions(-)
---
diff --git a/src/gui/app1/jumpsDjOptimalFall.cs b/src/gui/app1/jumpsDjOptimalFall.cs
index ca530353..0c28a019 100644
--- a/src/gui/app1/jumpsDjOptimalFall.cs
+++ b/src/gui/app1/jumpsDjOptimalFall.cs
@@ -77,7 +77,7 @@ public partial class ChronoJumpWindow
                if(jumpsDjOptimalFall.Point_l.Count == 0)
                {
                        //constructor for showing blank screen with a message
-                       new JumpsDjOptimalFallGraph(drawingarea_jumps_dj_optimal_fall);
+                       new JumpsDjOptimalFallGraph(drawingarea_jumps_dj_optimal_fall, jumpType);
                                        //currentPerson.Name, jumpType, currentSession.DateShort);
                } else {
                        //regular constructor
diff --git a/src/gui/cairo/jumpsDjOptimalFall.cs b/src/gui/cairo/jumpsDjOptimalFall.cs
index 65269bc9..1aaef30c 100644
--- a/src/gui/cairo/jumpsDjOptimalFall.cs
+++ b/src/gui/cairo/jumpsDjOptimalFall.cs
@@ -29,14 +29,14 @@ using Cairo;
 public class JumpsDjOptimalFallGraph : CairoXY
 {
        //constructor when there are no points
-       public JumpsDjOptimalFallGraph (DrawingArea area)//, string title, string jumpType, string date)
+       public JumpsDjOptimalFallGraph (DrawingArea area, string jumpType)//, 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", g, true);
+               printText(area.Allocation.Width /2, area.Allocation.Height /2, 24, textHeight, "Need to 
execute jumps: " + jumpType, g, true);
 
                endGraph();
        }
diff --git a/src/gui/cairo/jumpsWeightFVProfile.cs b/src/gui/cairo/jumpsWeightFVProfile.cs
index 4e46796a..e80f9682 100644
--- a/src/gui/cairo/jumpsWeightFVProfile.cs
+++ b/src/gui/cairo/jumpsWeightFVProfile.cs
@@ -28,15 +28,23 @@ using Cairo;
 
 public class JumpsWeightFVProfileGraph : CairoXY
 {
+       public enum ErrorAtStart { NEEDPERSONLEGPARAMS, NEEDJUMPS }
+
        //constructor when there are no points
-       public JumpsWeightFVProfileGraph (DrawingArea area)//, string title, string jumpType, string date)
+       public JumpsWeightFVProfileGraph (DrawingArea area, ErrorAtStart error)//, string title, string 
jumpType, string date)
        {
                this.area = area;
 
                initGraph();
 
+               string message = "";
+               if(error == ErrorAtStart.NEEDPERSONLEGPARAMS)
+                       message = "Need to fill person's leg parameters";
+               else //if(error == ErrorAtStart.NEEDJUMPS)
+                       message = "Need to execute jumps SJl and/or SJ";
+
                g.SetFontSize(16);
-               printText(area.Allocation.Width /2, area.Allocation.Height /2, 24, textHeight, "Need to 
execute jumps weightFV", g, true);
+               printText(area.Allocation.Width /2, area.Allocation.Height /2, 24, textHeight, message, g, 
true);
 
                endGraph();
        }
@@ -48,7 +56,8 @@ public class JumpsWeightFVProfileGraph : CairoXY
                        //double xAtMMaxY, //x at Model MaxY
                        //double pointsMaxValue,
                        DrawingArea area,
-                       string title, string jumpType, string date)
+                       string title, //string jumpType,
+                       string date)
        {
                this.point_l = point_l;
                this.coefs = coefs;
@@ -59,10 +68,10 @@ public class JumpsWeightFVProfileGraph : CairoXY
                */
                this.area = area;
                this.title = title;
-               this.jumpType = jumpType;
+               //this.jumpType = jumpType;
                this.date = date;
 
-               axisRightLabel = "Weight (%)";
+               axisRightLabel = "Speed (m/s)";
        }
 
        public override void Do()
diff --git a/src/jumpsWeightFVProfile.cs b/src/jumpsWeightFVProfile.cs
index cc763f7d..f815a069 100644
--- a/src/jumpsWeightFVProfile.cs
+++ b/src/jumpsWeightFVProfile.cs
@@ -31,10 +31,10 @@ public class JumpsWeightFVProfile
        {
        }
        
-       public void Calculate (int personID, int sessionID, string jumpType)
+       public void Calculate (int personID, int sessionID) //, string jumpType)
        {
                //1 get data
-                List<Jump> jump_l = SqliteJump.SelectWeightJumps (personID, sessionID, jumpType, false); 
//TODO:true);
+                List<Jump> jump_l = SqliteJump.SelectJumpsWeightFVProfile (personID, sessionID, false); 
//TODO: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 db70321e..83ef081b 100644
--- a/src/sqlite/jump.cs
+++ b/src/sqlite/jump.cs
@@ -378,7 +378,7 @@ class SqliteJump : Sqlite
 
        //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)
+       public static List<Jump> SelectJumpsWeightFVProfile (int pID, int sID, bool onlyHigherOfSameWeight)
        {
          string personID = pID.ToString();
          string sessionID = sID.ToString();
@@ -387,7 +387,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 = \"" + jumpType + "\"";
+         " AND sessionID = " + sessionID  +  " AND (jump.type = \"SJ\" OR jump.type = \"SJl\")";
 
          if(onlyHigherOfSameWeight)
                  dbcmd.CommandText += " ORDER BY weight DESC, tv DESC";


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]