[chronojump] neuromuscular Profile with "ec" done



commit 2e9c2ac7e879028632a36bb6258e4ba04f658ca4
Author: Xavier de Blas <xaviblas gmail com>
Date:   Tue Jul 29 18:48:25 2014 +0200

    neuromuscular Profile with "ec" done

 encoder/graph.R                |   19 ++----
 encoder/neuromuscularProfile.R |   32 +++++++--
 src/constants.cs               |    6 +-
 src/encoder.cs                 |    5 +-
 src/gui/encoder.cs             |  139 +++++++++++++++++++++-------------------
 src/gui/encoderTreeviews.cs    |    3 +-
 src/sqlite/encoder.cs          |   11 ++-
 src/sqlite/main.cs             |    4 +-
 src/sqlite/personSession.cs    |   15 +++-
 src/sqlite/session.cs          |   15 +++-
 10 files changed, 146 insertions(+), 103 deletions(-)
---
diff --git a/encoder/graph.R b/encoder/graph.R
index 7245579..8c5d089 100644
--- a/encoder/graph.R
+++ b/encoder/graph.R
@@ -2858,21 +2858,13 @@ doProcess <- function(options) {
                else if(Analysis == "neuromuscularProfile") {
                        #only signal, it's a jump, use mass of the body (100%) + mass Extra if any
 
-                       if(n < 24) {
-                               plot(0,0,type="n",axes=F,xlab="",ylab="")
-                               text(x=0,y=0,paste(translate("Not enough data."), "\n",
-                                                  translate("Need 6 jumps and 4 phases for each jump")," 
(ecc,con,ecc,con)."),cex=1.5)
-                               dev.off()
-                               write("", OutputData1)
-                               quit()
-                       }
-                       npj <- neuromuscularProfileGetData(displacement, curves, (MassBody + MassExtra), 
SmoothingOneC)
+                       npj <- neuromuscularProfileGetData(singleFile, displacement, curves, (MassBody + 
MassExtra), SmoothingOneC)
 
                        if(is.double(npj) && npj == -1) {
                                plot(0,0,type="n",axes=F,xlab="",ylab="")
                                text(x=0,y=0,paste(translate("Not enough data."), "\n",
-                                                  translate("Need at least three jumps executed on the odd 
concentric phases"),
-                                                  " (1 con, 3 con, 5 con, ...)."), cex=1.5)
+                                                  translate("Need at least three jumps")),
+                                                  cex=1.5)
                                dev.off()
                                write("", OutputData1)
                                quit()
@@ -2899,10 +2891,13 @@ doProcess <- function(options) {
                        neuromuscularProfilePlotBars(Title, np.bar.load, np.bar.explode, np.bar.drive)
                        
                        par(mar=c(4,4,1,4))
+
                        neuromuscularProfilePlotOther(
                                                      displacement, #curves,
                                                      list(npj[[1]]$l.context, npj[[2]]$l.context, 
npj[[3]]$l.context),
-                                                     (MassBody + MassExtra), SmoothingOneC)
+                                                     list(npj[[1]]$mass, npj[[2]]$mass, npj[[3]]$mass),
+                                                     SmoothingOneC)
+
                        #TODO: calcular un SmothingOneECE i passar-lo a PlotOther enlloc del SmoothingOneC
                        par(mfrow=c(1,1))
 
diff --git a/encoder/neuromuscularProfile.R b/encoder/neuromuscularProfile.R
index 1eaad80..9e2ab4e 100644
--- a/encoder/neuromuscularProfile.R
+++ b/encoder/neuromuscularProfile.R
@@ -34,7 +34,7 @@ neuromuscularProfileJump <- function(l.context, e1, c, mass, smoothingC)
        # e1\  /
        #    \/
        
-       weight <- mass * g
+       #weight <- mass * g
 
 
        #----------------
@@ -169,13 +169,13 @@ neuromuscularProfileJump <- function(l.context, e1, c, mass, smoothingC)
                       cl.p.avg = cl.p.avg, cl.p.max = cl.p.max
                       )
 
-       return (list(l.context = l.context, e1 = e1.list, c = c.list))
+       return (list(l.context = l.context, e1 = e1.list, c = c.list, mass = mass))
 }
 
 #Manuel Lapuente analysis of 6 separate ABKs (e1, c, e2)
-neuromuscularProfileGetData <- function(displacement, curves, mass, smoothingC)
+neuromuscularProfileGetData <- function(singleFile, displacement, curves, mass, smoothingC)
 {
-       weight=mass*g
+       #weight=mass*g
 
        #get the maxheight of the jumps
        #sequence is e,c for every jump. Need the c of every jump
@@ -189,8 +189,16 @@ neuromuscularProfileGetData <- function(displacement, curves, mass, smoothingC)
                accel = getAcceleration(speed) 
                #speed comes in mm/ms when derivate to accel its mm/ms^2 to convert it to m/s^2 need to *1000 
because it's quadratic
                accel$y <- accel$y * 1000
+       
                
-               force <- mass * (accel$y + g)
+               myMass = mass   
+               if(! singleFile) {
+                       myMassBody = curves[i,5]
+                       myMassExtra = curves[i,6]
+                       myMass = myMassBody + myMassExtra
+               }
+
+               force <- myMass * (accel$y + g)
 
                position = cumsum(d)
 
@@ -245,11 +253,19 @@ neuromuscularProfileGetData <- function(displacement, curves, mass, smoothingC)
                                  start.c  = curves[i,1],       #start of c
                                  end.c    = curves[i,2]        #end of c
                                  )
+               
+               myMass = mass   
+               if(! singleFile) {
+                       myMassBody = curves[i,5]
+                       myMassExtra = curves[i,6]
+                       myMass = myMassBody + myMassExtra
+               }
+
                npj[[count]] <- neuromuscularProfileJump(
                                                         l.context,
                                                         displacement[curves[(i-1),1]:curves[(i-1),2]], #e1
                                                         displacement[curves[(i),1]:curves[(i),2]],     #c
-                                                        mass, smoothingC)
+                                                        myMass, smoothingC)
                count = count +1
                
        }
@@ -321,7 +337,7 @@ neuromuscularProfilePlotBars <- function(title, load, explode, drive)
        #show small text related to graph result and how to train
 }
 
-neuromuscularProfilePlotOther <- function(displacement, l.context, mass, smoothingC)
+neuromuscularProfilePlotOther <- function(displacement, l.context, l.mass, smoothingC)
 {
        #plot
        #curve e1,c distance,speed,force /time of best jump
@@ -344,7 +360,9 @@ neuromuscularProfilePlotOther <- function(displacement, l.context, mass, smoothi
                #speed comes in mm/ms when derivate to accel its mm/ms^2 to convert it to m/s^2 need to *1000 
because it's quadratic
                accel$y <- accel$y * 1000
 
+               mass <- l.mass[[i]]
                force <- mass * (accel$y + g)
+
                if(i == 1)
                        forceFirst <- force
                else if(i == 2)
diff --git a/src/constants.cs b/src/constants.cs
index ebc0a92..b746f03 100644
--- a/src/constants.cs
+++ b/src/constants.cs
@@ -797,8 +797,7 @@ public class Constants
                "Adapted from",
                "Mean speed in concentric propulsive phase",
                "Sorry, no repetitions matched your criteria.",
-               "Need 6 jumps and 4 phases for each jump",
-               "Need at least three jumps executed on the odd concentric phases",
+               "Need at least three jumps",
                "Starting R",
                "Loading libraries",
                "Starting process",
@@ -843,8 +842,7 @@ public class Constants
                Catalog.GetString("Adapted from"),
                Catalog.GetString("Mean speed in concentric propulsive phase"),
                Catalog.GetString("Sorry, no repetitions matched your criteria."),
-               Catalog.GetString("Need 6 jumps and 4 phases for each jump"),
-               Catalog.GetString("Need at least three jumps executed on the odd concentric phases"),
+               Catalog.GetString("Need at least three jumps"),
                Catalog.GetString("Starting R"),
                Catalog.GetString("Loading libraries"),
                Catalog.GetString("Starting process"),
diff --git a/src/encoder.cs b/src/encoder.cs
index 4c2f97e..b255200 100644
--- a/src/encoder.cs
+++ b/src/encoder.cs
@@ -550,7 +550,10 @@ public class EncoderSQL
                else
                        ecconLong = Catalog.GetString("Concentric-eccentric");
        }
-       
+
+       //used on encoder table
+       public enum Eccons { ALL, ecS, ceS, c } 
+
        public string GetDate(bool pretty) {
                int pointPos = filename.LastIndexOf('.');
                int dateLength = 19; //YYYY-MM-DD_hh-mm-ss
diff --git a/src/gui/encoder.cs b/src/gui/encoder.cs
index efc046e..6811647 100644
--- a/src/gui/encoder.cs
+++ b/src/gui/encoder.cs
@@ -295,8 +295,6 @@ public partial class ChronoJumpWindow
 
                captureCurvesBarsData = new ArrayList(0);
                
-               update_neuromuscular_profile_sensitiveness();
-       
                RInitialized = Constants.Status.UNSTARTED;
        }
 
@@ -755,7 +753,8 @@ public partial class ChronoJumpWindow
        void on_button_encoder_analyze_data_select_curves_clicked (object o, EventArgs args) 
        {
                ArrayList data = SqliteEncoder.Select(
-                               false, -1, currentPerson.UniqueID, currentSession.UniqueID, "curve", 
+                               false, -1, currentPerson.UniqueID, currentSession.UniqueID, 
+                               "curve", EncoderSQL.Eccons.ALL, 
                                false, true);
 
                ArrayList dataPrint = new ArrayList();
@@ -851,7 +850,8 @@ public partial class ChronoJumpWindow
                string [] checkboxes = genericWin.GetCheckboxesStatus(1, false);
 
                ArrayList data = SqliteEncoder.Select(
-                               false, -1, currentPerson.UniqueID, currentSession.UniqueID, "curve", 
+                               false, -1, currentPerson.UniqueID, currentSession.UniqueID, 
+                               "curve", EncoderSQL.Eccons.ALL, 
                                false, true);
 
                //update on database the curves that have been selected/deselected
@@ -896,7 +896,10 @@ public partial class ChronoJumpWindow
                Log.WriteLine("row edit apply at show curves");
 
                int curveID = genericWin.TreeviewSelectedUniqueID;
-               EncoderSQL eSQL = (EncoderSQL) SqliteEncoder.Select(false, curveID, 0, 0, "", false, true)[0];
+               EncoderSQL eSQL = (EncoderSQL) SqliteEncoder.Select(
+                               false, curveID, 0, 0, 
+                               "", EncoderSQL.Eccons.ALL, 
+                               false, true)[0];
 
                //if changed comment, update SQL, and update treeview
                //first remove conflictive characters
@@ -943,7 +946,7 @@ public partial class ChronoJumpWindow
        void delete_encoder_curve(int uniqueID) {
                Log.WriteLine(uniqueID.ToString());
 
-               EncoderSQL eSQL = (EncoderSQL) SqliteEncoder.Select(false, uniqueID, 0, 0, "", false, 
true)[0];
+               EncoderSQL eSQL = (EncoderSQL) SqliteEncoder.Select(false, uniqueID, 0, 0, "", 
EncoderSQL.Eccons.ALL, false, true)[0];
                //remove the file
                bool deletedOk = Util.FileDelete(eSQL.GetFullURL(false));       //don't convertPathToR
                if(deletedOk)  {
@@ -987,7 +990,8 @@ public partial class ChronoJumpWindow
                foreach(Person p in dataPre) {
                        if(p.UniqueID != currentPerson.UniqueID) {
                                ArrayList eSQLarray = SqliteEncoder.Select(
-                                               false, -1, p.UniqueID, currentSession.UniqueID, "curve", 
+                                               false, -1, p.UniqueID, currentSession.UniqueID, 
+                                               "curve", EncoderSQL.Eccons.ALL, 
                                                false, true);
                                string [] s = { p.UniqueID.ToString(), "", p.Name,
                                        getActiveCurvesNum(eSQLarray).ToString(), eSQLarray.Count.ToString()
@@ -1174,7 +1178,8 @@ public partial class ChronoJumpWindow
        void on_button_encoder_load_signal_clicked (object o, EventArgs args) 
        {
                ArrayList data = SqliteEncoder.Select(
-                               false, -1, currentPerson.UniqueID, currentSession.UniqueID, "signal", 
+                               false, -1, currentPerson.UniqueID, currentSession.UniqueID, 
+                               "signal", EncoderSQL.Eccons.ALL, 
                                false, true);
 
                ArrayList dataPrint = new ArrayList();
@@ -1245,7 +1250,8 @@ public partial class ChronoJumpWindow
                genericWin.HideAndNull();
 
                ArrayList data = SqliteEncoder.Select(
-                               false, uniqueID, currentPerson.UniqueID, currentSession.UniqueID, "signal", 
+                               false, uniqueID, currentPerson.UniqueID, currentSession.UniqueID, 
+                               "signal", EncoderSQL.Eccons.ALL, 
                                false, true);
 
                bool success = false;
@@ -1292,7 +1298,7 @@ public partial class ChronoJumpWindow
                Log.WriteLine("row edit apply at load signal");
                        
                int curveID = genericWin.TreeviewSelectedUniqueID;
-               EncoderSQL eSQL = (EncoderSQL) SqliteEncoder.Select(false, curveID, 0, 0, "", false, true)[0];
+               EncoderSQL eSQL = (EncoderSQL) SqliteEncoder.Select(false, curveID, 0, 0, "", 
EncoderSQL.Eccons.ALL, false, true)[0];
                
                //if changed comment, update SQL, and update treeview
                //first remove conflictive characters
@@ -1336,7 +1342,7 @@ public partial class ChronoJumpWindow
                        on_button_encoder_delete_signal_accepted (o, args);
                else {
                        EncoderSQL eSQL = (EncoderSQL) SqliteEncoder.Select(
-                                       false, signalID, 0, 0, "signal", false, true)[0];
+                                       false, signalID, 0, 0, "signal", EncoderSQL.Eccons.ALL, false, 
true)[0];
                
                        //delete signal and related curves (both from SQL and files)
                        encoderSignalDelete(eSQL.GetFullURL(false), signalID);  //don't convertPathToR
@@ -1364,7 +1370,7 @@ public partial class ChronoJumpWindow
                {
                        //select related curves to find URL
                        EncoderSQL eSQL = (EncoderSQL) SqliteEncoder.Select(
-                                       false, esc.curveID, -1, -1, "curve", false, true)[0];
+                                       false, esc.curveID, -1, -1, "curve", EncoderSQL.Eccons.ALL, false, 
true)[0];
                        
                        //delete file
                        Util.FileDelete(eSQL.GetFullURL(false));        //don't convertPathToR
@@ -1561,7 +1567,7 @@ public partial class ChronoJumpWindow
        void on_button_encoder_delete_signal_accepted (object o, EventArgs args) 
        {
                EncoderSQL eSQL = (EncoderSQL) SqliteEncoder.Select(
-                               false, Convert.ToInt32(encoderSignalUniqueID), 0, 0, "signal", false, 
true)[0];
+                               false, Convert.ToInt32(encoderSignalUniqueID), 0, 0, "signal", 
EncoderSQL.Eccons.ALL, false, true)[0];
 
                //delete signal and related curves (both from SQL and files)
                encoderSignalDelete(eSQL.GetFullURL(false), Convert.ToInt32(encoderSignalUniqueID));
@@ -1586,7 +1592,8 @@ public partial class ChronoJumpWindow
 
        private void updateUserCurvesLabelsAndCombo() {
                ArrayList data = SqliteEncoder.Select(
-                               false, -1, currentPerson.UniqueID, currentSession.UniqueID, "curve", 
+                               false, -1, currentPerson.UniqueID, currentSession.UniqueID, 
+                               "curve", EncoderSQL.Eccons.ALL, 
                                false, true);
                int activeCurvesNum = getActiveCurvesNum(data);
                label_encoder_user_curves_active_num.Text = activeCurvesNum.ToString();
@@ -1798,8 +1805,10 @@ public partial class ChronoJumpWindow
                if( ! check_encoder_analyze_signal_or_curves.Active)    //saved curves
                {
                        ArrayList data = SqliteEncoder.Select(
-                                       false, -1, currentPerson.UniqueID, currentSession.UniqueID, "curve", 
+                                       false, -1, currentPerson.UniqueID, currentSession.UniqueID, 
+                                       "curve", EncoderSQL.Eccons.ALL, 
                                        false, true);
+
                        if(data.Count == 0) {
                                new DialogMessage(Constants.MessageTypes.WARNING, 
                                                Catalog.GetString("Sorry, no repetitions selected."));
@@ -2179,6 +2188,11 @@ public partial class ChronoJumpWindow
                        
                        dataFileName = UtilEncoder.GetEncoderGraphInputMulti();
 
+                       //neuromuscularProfile works only with ec, do not use c curves
+                       EncoderSQL.Eccons ecconSelect = EncoderSQL.Eccons.ALL;  
+                       if(encoderAnalysis == "neuromuscularProfile") {
+                               ecconSelect = EncoderSQL.Eccons.ecS;    
+                       }
 
                        //double bodyMass = Convert.ToDouble(currentPersonSession.Weight);
 
@@ -2189,35 +2203,42 @@ public partial class ChronoJumpWindow
                        //onlyActive is false to have all the curves
                        //this is a need for "single" to select on display correct curve
                        data = SqliteEncoder.Select(
-                               false, -1, currentPerson.UniqueID, currentSession.UniqueID, "curve", 
+                               false, -1, currentPerson.UniqueID, currentSession.UniqueID, 
+                               "curve", ecconSelect, 
                                false, true);
-                       
-                       //if compare persons, select curves for other persons and add
-                       
if(Util.FindOnArray(':',1,0,UtilGtk.ComboGetActive(combo_encoder_analyze_data_compare),
-                                       encoderDataCompareTranslation) == "Between persons") {
-                               ArrayList dataPre = new ArrayList();
-                               for (int i=0 ; i < encoderCompareInterperson.Count ; i ++) {
-                                       dataPre = SqliteEncoder.Select(
-                                               false, -1, 
-                                               Util.FetchID(encoderCompareInterperson[i].ToString()),
-                                               currentSession.UniqueID, "curve", 
-                                               true, true);
-                                       //this curves are added to data, data included currentPerson, 
currentSession
-                                       foreach(EncoderSQL eSQL in dataPre) 
-                                               data.Add(eSQL);
-                               }
-                       } else 
if(Util.FindOnArray(':',1,0,UtilGtk.ComboGetActive(combo_encoder_analyze_data_compare),
-                                       encoderDataCompareTranslation) == "Between sessions") {
-                               ArrayList dataPre = new ArrayList();
-                               for (int i=0 ; i < encoderCompareIntersession.Count ; i ++) {
-                                       dataPre = SqliteEncoder.Select(
-                                               false, -1,
-                                               currentPerson.UniqueID, 
-                                               Util.FetchID(encoderCompareIntersession[i].ToString()),
-                                               "curve", true, true);
-                                       //this curves are added to data, data included currentPerson, 
currentSession
-                                       foreach(EncoderSQL eSQL in dataPre) 
-                                               data.Add(eSQL);
+
+                       //neuromuscularProfile cannot be inerperson or intersession
+                       if(encoderAnalysis != "neuromuscularProfile") 
+                       {       
+                               //if compare persons, select curves for other persons and add
+                               
if(Util.FindOnArray(':',1,0,UtilGtk.ComboGetActive(combo_encoder_analyze_data_compare),
+                                                       encoderDataCompareTranslation) == "Between persons") {
+                                       ArrayList dataPre = new ArrayList();
+                                       for (int i=0 ; i < encoderCompareInterperson.Count ; i ++) {
+                                               dataPre = SqliteEncoder.Select(
+                                                               false, -1, 
+                                                               
Util.FetchID(encoderCompareInterperson[i].ToString()),
+                                                               currentSession.UniqueID,
+                                                               "curve", EncoderSQL.Eccons.ALL, 
+                                                               true, true);
+                                               //this curves are added to data, data included currentPerson, 
currentSession
+                                               foreach(EncoderSQL eSQL in dataPre) 
+                                                       data.Add(eSQL);
+                                       }
+                               } else 
if(Util.FindOnArray(':',1,0,UtilGtk.ComboGetActive(combo_encoder_analyze_data_compare),
+                                                       encoderDataCompareTranslation) == "Between sessions") 
{
+                                       ArrayList dataPre = new ArrayList();
+                                       for (int i=0 ; i < encoderCompareIntersession.Count ; i ++) {
+                                               dataPre = SqliteEncoder.Select(
+                                                               false, -1,
+                                                               currentPerson.UniqueID, 
+                                                               
Util.FetchID(encoderCompareIntersession[i].ToString()),
+                                                               "curve", EncoderSQL.Eccons.ALL,
+                                                               true, true);
+                                               //this curves are added to data, data included currentPerson, 
currentSession
+                                               foreach(EncoderSQL eSQL in dataPre) 
+                                                       data.Add(eSQL);
+                                       }
                                }
                        }
 
@@ -2447,13 +2468,13 @@ public partial class ChronoJumpWindow
                        radiobutton_encoder_analyze_powerbars.Sensitive = true;
                        radiobutton_encoder_analyze_single.Sensitive = true;
                        radiobutton_encoder_analyze_side.Sensitive = true;
-                       update_neuromuscular_profile_sensitiveness();
                } 
                else {
                        if(currentPerson != null) {
                                ArrayList data = SqliteEncoder.Select(
                                                false, -1, currentPerson.UniqueID, currentSession.UniqueID, 
-                                               "curve", false, true);
+                                               "curve", EncoderSQL.Eccons.ALL,
+                                               false, true);
                                int activeCurvesNum = getActiveCurvesNum(data);
                                updateComboEncoderAnalyzeCurveNum(data, activeCurvesNum);       
                        }
@@ -2463,7 +2484,6 @@ public partial class ChronoJumpWindow
                        radiobutton_encoder_analyze_powerbars.Sensitive = true;
                        radiobutton_encoder_analyze_single.Sensitive = true;
                        radiobutton_encoder_analyze_side.Sensitive = true;
-                       update_neuromuscular_profile_sensitiveness();
                }
                        
                button_encoder_analyze_sensitiveness();
@@ -2645,20 +2665,6 @@ public partial class ChronoJumpWindow
                button_encoder_analyze_sensitiveness();
        }
        
-       private void update_neuromuscular_profile_sensitiveness() {
-               //neuromuscular only sensitive on signal and ecc/con
-               if(check_encoder_analyze_signal_or_curves.Active &&     //current signal
-                               Util.FindOnArray(':',1,0,UtilGtk.ComboGetActive(combo_encoder_eccon),
-                                       encoderEcconTranslation) == Constants.EccentricConcentric
-                 )
-                       radiobutton_encoder_analyze_neuromuscular_profile.Sensitive = true;
-               else {
-                       radiobutton_encoder_analyze_neuromuscular_profile.Sensitive = false;
-                       if(radiobutton_encoder_analyze_neuromuscular_profile.Active)
-                               radiobutton_encoder_analyze_powerbars.Active = true;
-               }
-       }
-               
        //end of encoder analysis modes
 
        private void on_check_encoder_analyze_eccon_together_toggled (object obj, EventArgs args) {
@@ -2916,7 +2922,6 @@ public partial class ChronoJumpWindow
 
        void on_combo_encoder_eccon_changed (object o, EventArgs args) 
        {
-               update_neuromuscular_profile_sensitiveness();
        }
 
        void on_button_encoder_capture_curves_all_clicked (object o, EventArgs args) {
@@ -3287,7 +3292,8 @@ public partial class ChronoJumpWindow
        //called when a person changes
        private void encoderPersonChanged() {
                ArrayList data = SqliteEncoder.Select(
-                               false, -1, currentPerson.UniqueID, currentSession.UniqueID, "curve", 
+                               false, -1, currentPerson.UniqueID, currentSession.UniqueID, 
+                               "curve", EncoderSQL.Eccons.ALL, 
                                false, true);
                
                int activeCurvesNum = getActiveCurvesNum(data);
@@ -4609,12 +4615,15 @@ public partial class ChronoJumpWindow
                                         * (5) update analyze labels and combos
                                         */
                                        bool deletedUserCurves = false;
-                                       EncoderSQL currentSignalSQL = (EncoderSQL) 
SqliteEncoder.Select(false, 
-                                                       Convert.ToInt32(encoderSignalUniqueID), 0, 0, "", 
false, true)[0];
+                                       EncoderSQL currentSignalSQL = (EncoderSQL) SqliteEncoder.Select(
+                                                       false, Convert.ToInt32(encoderSignalUniqueID), 0, 0, 
+                                                       "", EncoderSQL.Eccons.ALL, 
+                                                       false, true)[0];
 
 
                                        ArrayList data = SqliteEncoder.Select(
-                                                       false, -1, currentPerson.UniqueID, 
currentSession.UniqueID, "curve", 
+                                                       false, -1, currentPerson.UniqueID, 
currentSession.UniqueID, 
+                                                       "curve", EncoderSQL.Eccons.ALL,  
                                                        false, true);
                                        foreach(EncoderSQL eSQL in data) {
                                                if(
diff --git a/src/gui/encoderTreeviews.cs b/src/gui/encoderTreeviews.cs
index 70731ad..77092d7 100644
--- a/src/gui/encoderTreeviews.cs
+++ b/src/gui/encoderTreeviews.cs
@@ -461,7 +461,8 @@ public partial class ChronoJumpWindow
                } else {                                                //user curves
                        curvesData = SqliteEncoder.Select(
                                        false, -1, currentPerson.UniqueID, currentSession.UniqueID, 
-                                       "curve", true, true);
+                                       "curve", EncoderSQL.Eccons.ALL, 
+                                       true, true);
                }
 
                string line;
diff --git a/src/sqlite/encoder.cs b/src/sqlite/encoder.cs
index 7a877e3..b039d9e 100644
--- a/src/sqlite/encoder.cs
+++ b/src/sqlite/encoder.cs
@@ -140,7 +140,7 @@ class SqliteEncoder : Sqlite
        }
        
        //pass uniqueID value and then will return one record. do like this:
-       //EncoderSQL eSQL = (EncoderSQL) SqliteEncoder.Select(false, myUniqueID, 0, 0, "", false, true)[0];
+       //EncoderSQL eSQL = (EncoderSQL) SqliteEncoder.Select(false, myUniqueID, 0, 0, "", 
EncoderSQL.Eccons.ALL, false, true)[0];
        //don't care for the 0, 0 , because selection will be based on the myUniqueID and only one row will 
be returned
        //or
        //pass uniqueID==-1 and personID, sessionID, signalOrCurve values, and will return some records
@@ -151,8 +151,9 @@ class SqliteEncoder : Sqlite
        //orderIDascendent is good for all the situations except when we want to convert from 1.05 to 1.06
        //in that conversion, we want first the last ones, and later the previous
        //      (to delete them if they are old copies)
-       public static ArrayList Select (bool dbconOpened, 
-                       int uniqueID, int personID, int sessionID, string signalOrCurve, 
+       public static ArrayList Select (
+                       bool dbconOpened, int uniqueID, int personID, int sessionID, 
+                       string signalOrCurve, EncoderSQL.Eccons ecconSelect,    
                        bool onlyActive, bool orderIDascendent)
        {
                if(! dbconOpened)
@@ -174,7 +175,11 @@ class SqliteEncoder : Sqlite
                                selectStr = personIDStr + sessionIDStr;
                        else
                                selectStr = personIDStr + sessionIDStr + " signalOrCurve = '" + signalOrCurve 
+ "'";
+               
+                       if(ecconSelect != EncoderSQL.Eccons.ALL)
+                               selectStr += " AND " + Constants.EncoderTable + ".eccon = '" + 
EncoderSQL.Eccons.ecS.ToString() + "'";
                }
+                       
 
                string andString = "";
                if(selectStr != "")
diff --git a/src/sqlite/main.cs b/src/sqlite/main.cs
index f80f04a..24f53a1 100644
--- a/src/sqlite/main.cs
+++ b/src/sqlite/main.cs
@@ -1499,8 +1499,8 @@ class Sqlite
                
                                SqliteEncoder.createTableEncoderSignalCurve();
 
-                               ArrayList signals = SqliteEncoder.Select(true, -1, -1, -1, "signal", false, 
false);
-                               ArrayList curves = SqliteEncoder.Select(true, -1, -1, -1, "curve", false, 
false);
+                               ArrayList signals = SqliteEncoder.Select(true, -1, -1, -1, "signal", 
EncoderSQL.Eccons.ALL, false, false);
+                               ArrayList curves = SqliteEncoder.Select(true, -1, -1, -1, "curve", 
EncoderSQL.Eccons.ALL, false, false);
                                int signalID;
                                conversionRateTotal = signals.Count;
                                conversionRate = 1;
diff --git a/src/sqlite/personSession.cs b/src/sqlite/personSession.cs
index 0d7390f..059c7a6 100644
--- a/src/sqlite/personSession.cs
+++ b/src/sqlite/personSession.cs
@@ -423,16 +423,23 @@ class SqlitePersonSession : Sqlite
                
 
                //delete encoder signal and curves (and it's videos)
-               ArrayList encoderArray = SqliteEncoder.Select(true, -1, 
-                               Convert.ToInt32(personID), Convert.ToInt32(sessionID), "signal", false, true);
+               ArrayList encoderArray = SqliteEncoder.Select(
+                               true, -1, Convert.ToInt32(personID), Convert.ToInt32(sessionID), 
+                               "signal", EncoderSQL.Eccons.ALL,
+                               false, true);
+
                foreach(EncoderSQL eSQL in encoderArray) {
                        Util.FileDelete(eSQL.GetFullURL(false));        //signal, don't convertPathToR
                        if(eSQL.future2 != "")
                                Util.FileDelete(eSQL.future2);          //video
                        Sqlite.Delete(true, Constants.EncoderTable, Convert.ToInt32(eSQL.uniqueID));
                }
-               encoderArray = SqliteEncoder.Select(true, -1, 
-                               Convert.ToInt32(personID), Convert.ToInt32(sessionID), "curve", false, true);
+
+               encoderArray = SqliteEncoder.Select(
+                               true, -1, Convert.ToInt32(personID), Convert.ToInt32(sessionID), 
+                               "curve", EncoderSQL.Eccons.ALL, 
+                               false, true);
+               
                foreach(EncoderSQL eSQL in encoderArray) {
                        Util.FileDelete(eSQL.GetFullURL(false));        //don't convertPathToR
                        /* commented: curve has no video
diff --git a/src/sqlite/session.cs b/src/sqlite/session.cs
index 0d3a9c8..56be195 100644
--- a/src/sqlite/session.cs
+++ b/src/sqlite/session.cs
@@ -629,16 +629,23 @@ class SqliteSession : Sqlite
                
 
                //delete encoder signal and curves (and it's videos)
-               ArrayList encoderArray = SqliteEncoder.Select(true, -1, -1, 
-                               Convert.ToInt32(uniqueID), "signal", false, true);
+               ArrayList encoderArray = SqliteEncoder.Select(
+                               true, -1, -1, Convert.ToInt32(uniqueID), 
+                               "signal", EncoderSQL.Eccons.ALL,
+                               false, true);
+               
                foreach(EncoderSQL eSQL in encoderArray) {
                        Util.FileDelete(eSQL.GetFullURL(false));        //signal, don't convertPathToR
                        if(eSQL.future2 != "")
                                Util.FileDelete(eSQL.future2);          //video
                        Sqlite.Delete(true, Constants.EncoderTable, Convert.ToInt32(eSQL.uniqueID));
                }
-               encoderArray = SqliteEncoder.Select(true, -1, -1, 
-                               Convert.ToInt32(uniqueID), "curve", false, true);
+               
+               encoderArray = SqliteEncoder.Select(
+                               true, -1, -1, Convert.ToInt32(uniqueID), 
+                               "curve",  EncoderSQL.Eccons.ALL,
+                               false, true);
+               
                foreach(EncoderSQL eSQL in encoderArray) {
                        Util.FileDelete(eSQL.GetFullURL(false));        //don't convertPathToR
                        /* commented: curve has no video


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