[chronojump] show all person events includes encoder



commit bf2536130bf78daa5c251d08ad459866b68546c9
Author: Xavier de Blas <xaviblas gmail com>
Date:   Thu Apr 18 19:45:55 2013 +0200

    show all person events includes encoder

 src/gui/person.cs    | 10 ++++++---
 src/sqlite/person.cs | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++--
 2 files changed, 62 insertions(+), 5 deletions(-)
---
diff --git a/src/gui/person.cs b/src/gui/person.cs
index b7acfd2..d13050e 100644
--- a/src/gui/person.cs
+++ b/src/gui/person.cs
@@ -2059,7 +2059,8 @@ public class PersonShowAllEventsWindow {
                createComboPersons(sessionID, currentPerson.UniqueID.ToString(), currentPerson.Name);
                createTreeView(treeview_person_show_all_events);
                store = new TreeStore( typeof (string), typeof (string), typeof (string), typeof (string), 
-                               typeof (string), typeof(string), typeof(string), typeof(string), 
typeof(string), typeof(string) );
+                               typeof (string), typeof(string), typeof(string), typeof(string), 
typeof(string), typeof(string),
+                               typeof (string), typeof(string));
                treeview_person_show_all_events.Model = store;
                fillTreeView(treeview_person_show_all_events,store, currentPerson.UniqueID);
        }
@@ -2104,7 +2105,8 @@ public class PersonShowAllEventsWindow {
                string myText = UtilGtk.ComboGetActive(combo_persons);
                if(myText != "") {
                        store = new TreeStore( typeof (string), typeof (string), typeof (string), typeof 
(string), 
-                                       typeof (string), typeof(string), typeof(string), typeof(string), 
typeof(string), typeof(string) );
+                                       typeof (string), typeof(string), typeof(string), typeof(string), 
typeof(string), typeof(string),
+                                       typeof (string), typeof(string));
                        treeview_person_show_all_events.Model = store;
                        
                        string [] myStringFull = myText.Split(new char[] {':'});
@@ -2136,6 +2138,8 @@ public class PersonShowAllEventsWindow {
                tv.AppendColumn ( Catalog.GetString ("Reaction\ntime"), new CellRendererText(), "text", 
count++);
                tv.AppendColumn ( Catalog.GetString ("Pulses"), new CellRendererText(), "text", count++);
                tv.AppendColumn ( Catalog.GetString ("MultiChronopic"), new CellRendererText(), "text", 
count++);
+               tv.AppendColumn ( Catalog.GetString ("Encoder signals"), new CellRendererText(), "text", 
count++);
+               tv.AppendColumn ( Catalog.GetString ("Encoder curves"), new CellRendererText(), "text", 
count++);
        }
        
        protected void fillTreeView (Gtk.TreeView tv, TreeStore store, int personID) {
@@ -2146,7 +2150,7 @@ public class PersonShowAllEventsWindow {
                        string [] myStr = myEvent.Split(new char[] {':'});
 
                        store.AppendValues (myStr[0], myStr[1], myStr[2], myStr[3], myStr[4], myStr[5], 
-                                       myStr[6], myStr[7], myStr[8], myStr[9]);
+                                       myStr[6], myStr[7], myStr[8], myStr[9], myStr[10], myStr[11]);
                }
        }
        
diff --git a/src/sqlite/person.cs b/src/sqlite/person.cs
index 476f7ee..a80105c 100644
--- a/src/sqlite/person.cs
+++ b/src/sqlite/person.cs
@@ -268,6 +268,8 @@ finishForeach:
                ArrayList arrayRTs = new ArrayList(2);
                ArrayList arrayPulses = new ArrayList(2);
                ArrayList arrayMCs = new ArrayList(2);
+               ArrayList arrayEncS = new ArrayList(2);
+               ArrayList arrayEncC = new ArrayList(2);
                
                string tps = Constants.PersonSessionTable;
        
@@ -356,7 +358,7 @@ finishForeach:
                }
                reader.Close();
        
-               //pulses
+               //MC
                dbcmd.CommandText = "SELECT sessionID, count(*) FROM multiChronopic WHERE personID = " + 
personID +
                        " GROUP BY sessionID ORDER BY sessionID";
                Log.WriteLine(dbcmd.CommandText.ToString());
@@ -367,7 +369,34 @@ finishForeach:
                }
                reader.Close();
        
+               //EncS (encoder signal)
+               dbcmd.CommandText = "SELECT sessionID, count(*) FROM " + Constants.EncoderTable + 
+                      " WHERE personID == " + personID +
+                      " AND signalOrCurve == 'signal' " +
+                       " GROUP BY sessionID ORDER BY sessionID";
+               Log.WriteLine(dbcmd.CommandText.ToString());
+               
+               reader = dbcmd.ExecuteReader();
+               while(reader.Read()) {
+                       arrayEncS.Add ( reader[0].ToString() + ":" + reader[1].ToString() );
+               }
+               reader.Close();
+       
+               //EncC (encoder curve)
+               dbcmd.CommandText = "SELECT sessionID, count(*) FROM " + Constants.EncoderTable + 
+                      " WHERE personID == " + personID +
+                      " AND signalOrCurve == 'curve' " +
+                       " GROUP BY sessionID ORDER BY sessionID";
+               Log.WriteLine(dbcmd.CommandText.ToString());
+               
+               reader = dbcmd.ExecuteReader();
+               while(reader.Read()) {
+                       arrayEncC.Add ( reader[0].ToString() + ":" + reader[1].ToString() );
+               }
+               reader.Close();
        
+
+
                dbcon.Close();
                
        
@@ -379,6 +408,8 @@ finishForeach:
                string tempRTs;
                string tempPulses;
                string tempMCs;
+               string tempEncS;
+               string tempEncC;
                bool found;     //using found because a person can be loaded in a session 
                                //but whithout having done any event yet
 
@@ -392,6 +423,8 @@ finishForeach:
                        tempRTs = "";
                        tempPulses = "";
                        tempMCs = "";
+                       tempEncS = "";
+                       tempEncC = "";
                        found = false;
                        
                        foreach (string myJumps in arrayJumps) {
@@ -457,6 +490,24 @@ finishForeach:
                                }
                        }
 
+                       foreach (string myEncS in arrayEncS) {
+                               string [] myStr = myEncS.Split(new char[] {':'});
+                               if(myStrSession[0] == myStr[0]) {
+                                       tempEncS = myStr[1];
+                                       found = true;
+                                       break;
+                               }
+                       }
+
+                       foreach (string myEncC in arrayEncC) {
+                               string [] myStr = myEncC.Split(new char[] {':'});
+                               if(myStrSession[0] == myStr[0]) {
+                                       tempEncC = myStr[1];
+                                       found = true;
+                                       break;
+                               }
+                       }
+
 
                        //if has events, write it's data
                        if (found) {
@@ -464,7 +515,9 @@ finishForeach:
                                                myStrSession[3] + ":" + tempJumps + ":" +       
//sessionDate, jumps
                                                tempJumpsRj + ":" + tempRuns + ":" +            //jumpsRj, 
Runs
                                                tempRunsInterval + ":" + tempRTs + ":" +        
//runsInterval, Reaction times
-                                               tempPulses + ":" + tempMCs);                    //pulses, 
MultiChronopic
+                                               tempPulses + ":" + tempMCs + ":" +              //pulses, 
MultiChronopic
+                                               tempEncS + ":" + tempEncC                       //encoder 
signal, encoder curve
+                                               );
                        }
                }
 


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