[chronojump] meanPower is shown on curve selection



commit f6e42a038dec4c90ed6c95f699de47a6f44d2e2c
Author: Xavier de Blas <xaviblas gmail com>
Date:   Fri May 23 11:24:29 2014 +0200

    meanPower is shown on curve selection

 src/encoder.cs        |   10 ++++++++--
 src/gui/encoder.cs    |   21 ++++++++++++++-------
 src/sqlite/encoder.cs |    3 ++-
 3 files changed, 24 insertions(+), 10 deletions(-)
---
diff --git a/src/encoder.cs b/src/encoder.cs
index 7e391d7..bd0b0e4 100644
--- a/src/encoder.cs
+++ b/src/encoder.cs
@@ -522,7 +522,7 @@ public class EncoderSQL
                this.status = status;
                this.videoURL = videoURL;
                this.encoderConfiguration = encoderConfiguration;
-               this.future1 = future1;
+               this.future1 = future1; //on signals: meanPower
                this.future2 = future2;
                this.future3 = future3;
                this.exerciseName = exerciseName;
@@ -559,12 +559,15 @@ public class EncoderSQL
                return str;
        }
 
-       public string [] ToStringArray (int count, bool checkboxes, bool video, bool encoderConfigPretty) {
+       //showMeanPower is used in curves, but not in signal
+       public string [] ToStringArray (int count, bool checkboxes, bool video, bool encoderConfigPretty, 
bool showMeanPower) {
                int all = 9;
                if(checkboxes)
                        all ++;
                if(video)
                        all++;
+               if(showMeanPower)
+                       all++;
 
 
                string [] str = new String [all];
@@ -578,6 +581,9 @@ public class EncoderSQL
                str[i++] = exerciseName;
                str[i++] = laterality;
                str[i++] = extraWeight;
+               
+               if(showMeanPower)
+                       str[i++] = future1;
 
                if(encoderConfigPretty)
                        str[i++] = encoderConfiguration.ToStringPretty();
diff --git a/src/gui/encoder.cs b/src/gui/encoder.cs
index 1035a05..5f4be94 100644
--- a/src/gui/encoder.cs
+++ b/src/gui/encoder.cs
@@ -762,7 +762,7 @@ public partial class ChronoJumpWindow
                foreach(EncoderSQL es in data) {
                        checkboxes[count++] = es.status;
                        //Log.WriteLine(checkboxes[count-1]);
-                       dataPrint.Add(es.ToStringArray(count,true,false,true));
+                       dataPrint.Add(es.ToStringArray(count,true,false,true,true));
                }
        
                string [] columnsString = {
@@ -772,6 +772,7 @@ public partial class ChronoJumpWindow
                        Catalog.GetString("Exercise"),
                        "RL",
                        Catalog.GetString("Extra weight"),
+                       Catalog.GetString("Mean Power"),
                        Catalog.GetString("Encoder"),
                        Catalog.GetString("Contraction"),
                        Catalog.GetString("Date"),
@@ -1176,7 +1177,7 @@ public partial class ChronoJumpWindow
                ArrayList dataPrint = new ArrayList();
                int count = 1;
                foreach(EncoderSQL es in data) 
-                       dataPrint.Add(es.ToStringArray(count++,false,true,true));
+                       dataPrint.Add(es.ToStringArray(count++,false,true,true,false));
                
                string [] columnsString = {
                        Catalog.GetString("ID"),
@@ -1635,14 +1636,15 @@ public partial class ChronoJumpWindow
                        signalOrCurve = "signal";
                
                        //check if data is ok (maybe encoder was not connected, then don't save this signal)
-                       EncoderCurve curve = treeviewEncoderCaptureCurvesGetCurve(1, false);
-                       if(curve.N == null) 
+                       EncoderCurve curveExist = treeviewEncoderCaptureCurvesGetCurve(1, false);
+                       if(curveExist.N == null) 
                                return "";
                }
                
+               EncoderCurve curve = new EncoderCurve();
                string desc = "";
                if(mode == "curve") {
-                       EncoderCurve curve = treeviewEncoderCaptureCurvesGetCurve(selectedID,true);
+                       curve = treeviewEncoderCaptureCurvesGetCurve(selectedID,true);
 
                        //some start at ,5 because of the spline filtering
                        int curveStart = Convert.ToInt32(decimal.Truncate(Convert.ToDecimal(curve.Start)));
@@ -1690,12 +1692,15 @@ public partial class ChronoJumpWindow
 
                        Log.WriteLine(curveStart + "->" + duration);
                        int curveIDMax = Sqlite.Max(Constants.EncoderTable, "uniqueID", false);
+                       
+                       //save raw file to hard disk
                        fileSaved = UtilEncoder.EncoderSaveCurve(UtilEncoder.GetEncoderDataTempFileName(), 
                                        curveStart, duration,
                                        inertialCheckStart, inertialCheckDuration, (ecconLast == "c"), 
                                        currentSession.UniqueID, currentPerson.UniqueID, 
                                        currentPerson.Name, encoderTimeStamp, curveIDMax);
 
+                       //save it to SQL (encoderSignalCurve table)
                        SqliteEncoder.SignalCurveInsert(false, 
                                        Convert.ToInt32(encoderSignalUniqueID), curveIDMax +1,
                                        Convert.ToInt32(curveStart + (duration /2)));
@@ -1721,15 +1726,17 @@ public partial class ChronoJumpWindow
                eSQL.filename = fileSaved;
                eSQL.url = path;
                eSQL.description = desc;
-               if(mode == "curve")
+               if(mode == "curve") {
                        eSQL.status = "active";
+                       eSQL.future1 = curve.MeanPower;
+               }
 
                eSQL.encoderConfiguration = encoderConfigurationCurrent;
 
                
                //if is a signal that we just loaded, then don't insert, do an update
                //we know it because encoderUniqueID is != than "-1" if we loaded something from database
-               //on curves, always insert, because it can be done with different smoothing, different params
+               //This also saves curves
                if(myID == "-1") {
                        myID = SqliteEncoder.Insert(false, eSQL).ToString(); //Adding on SQL
                        if(mode == "signal") {
diff --git a/src/sqlite/encoder.cs b/src/sqlite/encoder.cs
index 4d67438..41324f0 100644
--- a/src/sqlite/encoder.cs
+++ b/src/sqlite/encoder.cs
@@ -56,7 +56,8 @@ class SqliteEncoder : Sqlite
                        "status TEXT, " +       //"active", "inactive"
                        "videoURL TEXT, " +     //URL of video of signals
                        "encoderConfiguration TEXT, " + //text separated by ':'
-                       "future1 TEXT, " + 
+                       "future1 TEXT, " +      //Since 1.4.4 (DB 1.06) this stores last meanPower detected 
on a curve 
+                                               //(as string with '.' because future1 was created as TEXT)
                        "future2 TEXT, " + 
                        "future3 TEXT )";
                dbcmd.ExecuteNonQuery();


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