[chronojump] JumpsDjOptimalFall Cairo graph WIP



commit 0908928a65c1b55a92a4b88103af141b1e4ddf4c
Author: Xavier de Blas <xaviblas gmail com>
Date:   Fri Dec 13 18:45:17 2019 +0100

    JumpsDjOptimalFall Cairo graph WIP

 glade/app1.glade                             |  1 +
 src/Makefile.am                              |  1 +
 src/gui/app1/chronojump.cs                   |  8 ++++++--
 src/gui/app1/chronojumpJumpsDjOptimalFall.cs |  8 +++++---
 src/jumpsDjOptimalFall.cs                    | 22 +++++++++++++++++++---
 5 files changed, 32 insertions(+), 8 deletions(-)
---
diff --git a/glade/app1.glade b/glade/app1.glade
index aa863811..c275f206 100644
--- a/glade/app1.glade
+++ b/glade/app1.glade
@@ -18681,6 +18681,7 @@ Concentric</property>
                                                           <widget class="GtkDrawingArea" 
id="drawingarea_jumps_dj_optimal_fall">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
+                                                            <signal name="expose_event" 
handler="on_drawingarea_jumps_dj_optimal_fall_expose_event" swapped="no"/>
                                                           </widget>
                                                           <packing>
                                                             <property name="expand">True</property>
diff --git a/src/Makefile.am b/src/Makefile.am
index 93ae5561..f9efa963 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -38,6 +38,7 @@ SOURCES = \
        gui/guiTests.cs\
        gui/jump.cs\
        gui/jumpsProfile.cs\
+       gui/jumpsDjOptimalFall.cs\
        gui/jumpType.cs\
        gui/restTime.cs\
        gui/run.cs\
diff --git a/src/gui/app1/chronojump.cs b/src/gui/app1/chronojump.cs
index d9d10565..d8a87701 100644
--- a/src/gui/app1/chronojump.cs
+++ b/src/gui/app1/chronojump.cs
@@ -1080,6 +1080,8 @@ public partial class ChronoJumpWindow
 
                        if(notebook_analyze.CurrentPage == 
Convert.ToInt32(notebook_analyze_pages.JUMPSPROFILE))
                                jumpsProfileDo(true); //calculate data
+                       else if(notebook_analyze.CurrentPage == 
Convert.ToInt32(notebook_analyze_pages.JUMPSDJOPTIMALFALL))
+                               jumpsDjOptimalFallDo(true); //calculate data
                }
                else if(current_menuitem_mode == Constants.Menuitem_modes.JUMPSREACTIVE)
                {
@@ -6857,11 +6859,13 @@ LogB.Debug("mc finished 5");
        
        private void on_button_carles_clicked (object o, EventArgs args)
        {
+               /*
                if (currentPerson == null || currentSession == null)
                        return;
 
                JumpsDjOptimalFall jdof = new JumpsDjOptimalFall();
                jdof.Calculate(currentPerson.UniqueID, currentSession.UniqueID);
+               */
 
 
                /*
@@ -7061,7 +7065,7 @@ LogB.Debug("mc finished 5");
                                if(radio_mode_contacts_jumps_dj_optimal_fall.Active)
                                {
                                        notebook_analyze.CurrentPage = 
Convert.ToInt32(notebook_analyze_pages.JUMPSDJOPTIMALFALL);
-                                       //jumpsDjOptimalFallDo(true);
+                                       jumpsDjOptimalFallDo(true);
                                }
                        }
                        else if(current_menuitem_mode == Constants.Menuitem_modes.RUNSINTERVALLIC)
@@ -7095,7 +7099,7 @@ LogB.Debug("mc finished 5");
                if(radio_mode_contacts_jumps_dj_optimal_fall.Active)
                {
                        notebook_analyze.CurrentPage = 
Convert.ToInt32(notebook_analyze_pages.JUMPSDJOPTIMALFALL);
-                       //jumpsDjOptimalFallDo(true);
+                       jumpsDjOptimalFallDo(true);
                }
        }
        private void on_radio_mode_contacts_sprint_toggled (object o, EventArgs args)
diff --git a/src/gui/app1/chronojumpJumpsDjOptimalFall.cs b/src/gui/app1/chronojumpJumpsDjOptimalFall.cs
index c486dff2..b69d8b6e 100644
--- a/src/gui/app1/chronojumpJumpsDjOptimalFall.cs
+++ b/src/gui/app1/chronojumpJumpsDjOptimalFall.cs
@@ -21,7 +21,6 @@
 
 using System;
 using Gtk;
-//using Gdk;
 using Glade;
 using Mono.Unix;
 
@@ -46,8 +45,11 @@ public partial class ChronoJumpWindow
                if(calculateData)
                        jumpsDjOptimalFall.Calculate(currentPerson.UniqueID, currentSession.UniqueID);
 
-               //JumpsProfileGraph.Do(jumpsProfile.GetIndexes(), drawingarea_jumps_dj_optimal_fall,
-               //              currentPerson.Name, currentSession.DateShort);
+               JumpsDjOptimalFallGraph.Do(
+                               jumpsDjOptimalFall.Point_l,
+                               jumpsDjOptimalFall.GetMaxY(),
+                               drawingarea_jumps_dj_optimal_fall,
+                               currentPerson.Name, currentSession.DateShort);
        }
        private void on_drawingarea_jumps_dj_optimal_fall_expose_event (object o, ExposeEventArgs args) 
        {
diff --git a/src/jumpsDjOptimalFall.cs b/src/jumpsDjOptimalFall.cs
index ecb20c22..1455963e 100644
--- a/src/jumpsDjOptimalFall.cs
+++ b/src/jumpsDjOptimalFall.cs
@@ -23,6 +23,8 @@ using System.Collections.Generic; //List
 
 public class JumpsDjOptimalFall
 {
+       private List<Point> point_l;
+
        //constructor
        public JumpsDjOptimalFall()
        {
@@ -30,12 +32,12 @@ public class JumpsDjOptimalFall
        
        public void Calculate (int personID, int sessionID)
        {
-               /*
                //1 get data
                 List<Jump> jump_l = SqliteJump.SelectDJa (personID, sessionID);
 
                //2 convert to list of Point
-               List<Point> point_l = new List<Point>();
+               //List<Point> point_l = new List<Point>();
+               point_l = new List<Point>();
                 foreach(Jump j in jump_l)
                        point_l.Add(new Point(
                                                j.Fall,
@@ -53,6 +55,20 @@ public class JumpsDjOptimalFall
 
                if(ls.CalculatedMaxY)
                        LogB.Information(string.Format("MaxY = {0}", ls.MaxY));
-               */
+       }
+
+       public double GetMaxY()
+       {
+               double maxY = 0;
+                foreach(Point p in point_l)
+                       if(p.Y > maxY)
+                               maxY = p.Y;
+
+               return maxY;
+       }
+
+       public List<Point> Point_l
+       {
+               get { return point_l; }
        }
 }


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