[chronojump] jumpsDjOptimalFall WIP



commit 8b1863d10e0caaca3bd594c1321d5d477a461146
Author: Xavier de Blas <xaviblas gmail com>
Date:   Fri Dec 13 13:19:36 2019 +0100

    jumpsDjOptimalFall WIP

 po/POTFILES.in                                     |  1 +
 src/Makefile.am                                    |  3 +-
 src/gui/app1/chronojump.cs                         |  8 +--
 src/gui/app1/chronojumpJumpsDjOptimalFall.cs       | 84 ++++++++++++++++++++++
 ...timalFallingHeight.cs => jumpsDjOptimalFall.cs} |  6 +-
 5 files changed, 93 insertions(+), 9 deletions(-)
---
diff --git a/po/POTFILES.in b/po/POTFILES.in
index cf3fb3ce..bc206d88 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -59,6 +59,7 @@ src/exportSession.cs
 src/forceSensor.cs
 src/gui/app1/chronojump.cs
 src/gui/app1/chronojumpJumpsProfile.cs
+src/gui/app1/chronojumpJumpsDjFallOptimalHeight.cs
 src/gui/app1/contactsExercise.cs
 src/gui/app1/forceSensor.cs
 src/gui/app1/jump.cs
diff --git a/src/Makefile.am b/src/Makefile.am
index ba7905ad..93ae5561 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -8,6 +8,7 @@ SOURCES = \
        gui/app1/chronojump.cs\
        gui/app1/chronojumpIcons.cs\
        gui/app1/chronojumpJumpsProfile.cs\
+       gui/app1/chronojumpJumpsDjOptimalFall.cs\
        gui/app1/contactsExercise.cs\
        gui/app1/forceSensor.cs\
        gui/app1/jump.cs\
@@ -175,7 +176,7 @@ SOURCES = \
        json/exhibitions.cs\
        jump.cs\
        jumpsProfile.cs\
-       jumpsDjOptimalFallingHeight.cs\
+       jumpsDjOptimalFall.cs\
        jumpType.cs\
        networks.cs\
        person.cs\
diff --git a/src/gui/app1/chronojump.cs b/src/gui/app1/chronojump.cs
index 993f8a2e..d9d10565 100644
--- a/src/gui/app1/chronojump.cs
+++ b/src/gui/app1/chronojump.cs
@@ -251,10 +251,6 @@ public partial class ChronoJumpWindow
        [Widget] Gtk.Button button_jumps_rj_result_help_power;
        [Widget] Gtk.Button button_jumps_rj_result_help_stiffness;
        
-       [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;
-
        //runs
        [Widget] Gtk.Button button_edit_selected_run;
        [Widget] Gtk.Button button_video_play_selected_run;
@@ -6864,8 +6860,8 @@ LogB.Debug("mc finished 5");
                if (currentPerson == null || currentSession == null)
                        return;
 
-               JumpsDjOptimalFallingHeight jdofh = new JumpsDjOptimalFallingHeight();
-               jdofh.Calculate(currentPerson.UniqueID, currentSession.UniqueID);
+               JumpsDjOptimalFall jdof = new JumpsDjOptimalFall();
+               jdof.Calculate(currentPerson.UniqueID, currentSession.UniqueID);
 
 
                /*
diff --git a/src/gui/app1/chronojumpJumpsDjOptimalFall.cs b/src/gui/app1/chronojumpJumpsDjOptimalFall.cs
new file mode 100644
index 00000000..c486dff2
--- /dev/null
+++ b/src/gui/app1/chronojumpJumpsDjOptimalFall.cs
@@ -0,0 +1,84 @@
+/*
+ * 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-2019   Xavier de Blas <xaviblas gmail com> 
+ */
+
+
+using System;
+using Gtk;
+//using Gdk;
+using Glade;
+using Mono.Unix;
+
+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;
+
+       JumpsDjOptimalFall jumpsDjOptimalFall;
+
+       private void jumpsDjOptimalFallDo (bool calculateData)
+       {
+               if(currentPerson == null || currentSession == null)
+                       return;
+               
+               if(jumpsDjOptimalFall == null) {
+                       jumpsDjOptimalFall = new JumpsDjOptimalFall();
+                       calculateData = true;
+               }
+
+               if(calculateData)
+                       jumpsDjOptimalFall.Calculate(currentPerson.UniqueID, currentSession.UniqueID);
+
+               //JumpsProfileGraph.Do(jumpsProfile.GetIndexes(), drawingarea_jumps_dj_optimal_fall,
+               //              currentPerson.Name, currentSession.DateShort);
+       }
+       private void on_drawingarea_jumps_dj_optimal_fall_expose_event (object o, ExposeEventArgs args) 
+       {
+               jumpsDjOptimalFallDo(false); //do not calculate data
+               //data is calculated on switch page (at notebook_capture_analyze) or on change person
+       }
+
+       private void on_button_jumps_dj_optimal_fall_save_image_clicked (object o, EventArgs args)
+       {
+               checkFile(Constants.CheckFileOp.JUMPS_PROFILE_SAVE_IMAGE);
+       }
+
+       private void on_button_jumps_dj_optimal_fall_save_image_selected (string destination)
+       {
+               if(drawingarea_jumps_dj_optimal_fall == null)
+                       return;
+
+               Gdk.Pixbuf pixbuf = Gdk.Pixbuf.FromDrawable(drawingarea_jumps_dj_optimal_fall.GdkWindow, 
Gdk.Colormap.System,
+                               0, 0, 0, 0,
+                               UtilGtk.WidgetWidth(drawingarea_jumps_dj_optimal_fall),
+                               UtilGtk.WidgetHeight(drawingarea_jumps_dj_optimal_fall) );
+
+               LogB.Information("Saving");
+               pixbuf.Save(destination,"png");
+       }
+       private void on_overwrite_file_jumps_dj_optimal_fall_save_image_accepted (object o, EventArgs args)
+       {
+               on_button_jumps_dj_optimal_fall_save_image_selected (exportFileName);
+
+               string myString = string.Format(Catalog.GetString("Saved to {0}"), exportFileName);
+               new DialogMessage(Constants.MessageTypes.INFO, myString);
+       }
+
+}
diff --git a/src/jumpsDjOptimalFallingHeight.cs b/src/jumpsDjOptimalFall.cs
similarity index 95%
rename from src/jumpsDjOptimalFallingHeight.cs
rename to src/jumpsDjOptimalFall.cs
index 1db75e60..ecb20c22 100644
--- a/src/jumpsDjOptimalFallingHeight.cs
+++ b/src/jumpsDjOptimalFall.cs
@@ -21,15 +21,16 @@
 using System;
 using System.Collections.Generic; //List
 
-public class JumpsDjOptimalFallingHeight
+public class JumpsDjOptimalFall
 {
        //constructor
-       public JumpsDjOptimalFallingHeight()
+       public JumpsDjOptimalFall()
        {
        }
        
        public void Calculate (int personID, int sessionID)
        {
+               /*
                //1 get data
                 List<Jump> jump_l = SqliteJump.SelectDJa (personID, sessionID);
 
@@ -52,5 +53,6 @@ public class JumpsDjOptimalFallingHeight
 
                if(ls.CalculatedMaxY)
                        LogB.Information(string.Format("MaxY = {0}", ls.MaxY));
+               */
        }
 }


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