[chronojump] Encoder analyze graph interperson working
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] Encoder analyze graph interperson working
- Date: Wed, 6 Mar 2013 21:57:38 +0000 (UTC)
commit ec7f8543fc65dc95ec7cdc0be75a8e876f618022
Author: Xavier de Blas <xaviblas gmail com>
Date: Wed Mar 6 22:56:57 2013 +0100
Encoder analyze graph interperson working
encoder/graph.R | 140 ++++++++++++++++++++---------
src/encoder.cs | 4 +-
src/gui/encoder.cs | 226 +++++++++++++++++++++++++++++++++-------------
src/gui/genericWindow.cs | 27 +++++--
src/util.cs | 11 ++-
5 files changed, 294 insertions(+), 114 deletions(-)
---
diff --git a/encoder/graph.R b/encoder/graph.R
index dd1b4b1..3c98ec1 100644
--- a/encoder/graph.R
+++ b/encoder/graph.R
@@ -788,51 +788,95 @@ findPosInPaf <- function(var, option) {
}
#option: mean or max
-paintCrossVariables <- function (paf, varX, varY, option, isAlone, title, singleFile, Eccon) {
+paintCrossVariables <- function (paf, varX, varY, option, isAlone, title, singleFile, Eccon, seriesName) {
x = (paf[,findPosInPaf(varX, option)])
y = (paf[,findPosInPaf(varY, option)])
- myNums = rownames(paf)
- if(Eccon=="ecS") {
- if(singleFile) {
- myEc=c("c","e")
- myNums = as.numeric(rownames(paf))
- myNums = paste(trunc((myNums+1)/2),myEc[((myNums%%2)+1)],sep="")
+ print("seriesName")
+ print(seriesName)
+
+ colBalls = NULL
+ bgBalls = NULL
+
+ #if only one series
+ if(length(unique(seriesName)) == 1) {
+ myNums = rownames(paf)
+ if(Eccon=="ecS") {
+ if(singleFile) {
+ myEc=c("c","e")
+ myNums = as.numeric(rownames(paf))
+ myNums = paste(trunc((myNums+1)/2),myEc[((myNums%%2)+1)],sep="")
+ }
}
- }
- #problem with balls is that two values two close looks bad
- #suboption="balls"
- suboption="side"
- if(suboption == "balls") {
- cexBalls = 3
- cexNums = 1
- adjHor = 0.5
- nums=myNums
- } else if (suboption == "side") {
- cexBalls = 1.8
- cexNums = 1
- adjHor = 0
- nums=paste(" ", myNums)
- }
+ #problem with balls is that two values two close looks bad
+ #suboption="balls"
+ suboption="side"
+ if(suboption == "balls") {
+ cexBalls = 3
+ cexNums = 1
+ adjHor = 0.5
+ nums=myNums
+ } else if (suboption == "side") {
+ cexBalls = 1.8
+ cexNums = 1
+ adjHor = 0
+ nums=paste(" ", myNums)
+ }
+
+ colBalls="blue"
+ bgBalls="lightBlue"
+ if(isAlone == "RIGHT") {
+ colBalls="red"
+ bgBalls="pink"
+ }
+ plot(x,y, xlab=varX, ylab="", pch=21,col=colBalls,bg=bgBalls,cex=cexBalls,axes=F)
- colBalls="blue"
- bgBalls="lightBlue"
- if(isAlone == "RIGHT") {
- colBalls="red"
- bgBalls="pink"
- }
+ #x vector should contain at least 4 different values
+ if(length(unique(x)) >= 4)
+ lines(smooth.spline(x,y,df=4),col=colBalls,lwd=2)
+
+ title(title, cex.main=1, font.main=2)
+ text(x,y,nums,adj=c(adjHor,.5),cex=cexNums)
- plot(x,y, xlab=varX, ylab="", pch=21,col=colBalls,bg=bgBalls,cex=cexBalls,axes=F)
- title(title, cex.main=1, font.main=2)
- text(x,y,nums,adj=c(adjHor,.5),cex=cexNums)
+ } else { #more than one series
+ #colBalls = "black"
+ uniqueColors=topo.colors(length(unique(seriesName)))
- #lines(smooth.spline(x,y,spar=.5),col="darkblue")
-
- #x vector should contain at least 4 different values
- if(length(unique(x)) >= 4)
- lines(smooth.spline(x,y,df=4),col=colBalls)
+ #in x axis move a little every series to right in order to compare
+ seqX = seq(0,length(unique(seriesName))-1,by=1)-(length(unique(seriesName))-1)/2
+ for(i in 1:length(seriesName)) {
+ thisSerie = which(seriesName == unique(seriesName)[i])
+ colBalls[thisSerie] = uniqueColors[i]
+ #in x axis move a little every series to right in order to compare
+ x[thisSerie] = x[thisSerie] + seqX[i]
+ }
+
+ plot(x,y, xlab=varX, ylab="", pch=19, col=colBalls, cex=1.8, axes=F)
+
+ for(i in 1:length(seriesName)) {
+ thisSerie = which(seriesName == unique(seriesName)[i])
+ if(length(unique(x[thisSerie])) >= 4)
+ lines(smooth.spline(x[thisSerie],y[thisSerie],df=4),col=uniqueColors[i],lwd=2)
+ }
+
+ #difficult to create a title in series graphs
+ title(paste(varX,"/",varY), cex.main=1, font.main=2)
+
+ #plot legend on top exactly out
+ #http://stackoverflow.com/a/7322792
+ rng=par("usr")
+ lg = legend(rng[1],rng[2],
+ legend=unique(seriesName), lty=1, lwd=2, col=uniqueColors,
+ cex=1, bg="white", ncol=length(unique(seriesName)), bty="n",
+ plot=F)
+ legend(rng[1],rng[4]+1.25*lg$rect$h,
+ legend=unique(seriesName), lty=1, lwd=2, col=uniqueColors,
+ cex=1, bg="white", ncol=6, bty="n",
+ plot=T, xpd=NA)
+ }
+
if(isAlone == "ALONE") {
axis(1)
axis(2)
@@ -847,6 +891,7 @@ paintCrossVariables <- function (paf, varX, varY, option, isAlone, title, single
axis(4,col=colBalls)
mtext(varY, side=4, line=3, col=colBalls)
}
+
}
#propulsive!!!!
@@ -1018,6 +1063,7 @@ doProcess <- function(options) {
start = NULL; end = NULL; startH = NULL
status = NULL; id = NULL; exerciseName = NULL; mass = NULL; smooth = NULL
dateTime = NULL; myEccon = NULL; curvesHeight = NULL
+ seriesName = NULL
newLines=0;
countLines=1; #useful to know the correct ids of active curves
@@ -1029,7 +1075,7 @@ doProcess <- function(options) {
countLines=countLines+1;
next;
}
-
+
dataTempFile=scan(file=as.vector(inputMultiData$fullURL[i]),sep=",")
#if curves file ends with comma. Last character will be an NA. remove it
@@ -1085,6 +1131,8 @@ doProcess <- function(options) {
myEccon[(i+newLines)] = "ec"
countLines = countLines + 1
}
+
+ seriesName[(i+newLines)] = as.vector(inputMultiData$seriesName[i])
count = count + length(dataTempPhase)
}
@@ -1101,10 +1149,10 @@ doProcess <- function(options) {
#solution:
if(length(id)==1) {
curves = data.frame(start,end,startH,exerciseName,mass,smooth,
- dateTime,myEccon,stringsAsFactors=F,row.names=id)
+ dateTime,myEccon,seriesName,stringsAsFactors=F,row.names=id)
} else {
curves = data.frame(id,start,end,startH,exerciseName,mass,smooth,
- dateTime,myEccon,stringsAsFactors=F,row.names=1)
+ dateTime,myEccon,seriesName,stringsAsFactors=F,row.names=1)
}
n=length(curves[,1])
@@ -1331,20 +1379,24 @@ doProcess <- function(options) {
rawdata.cumsum[curves[,2]]-curves[,3], n) #height
}
else if(analysisCross[1] == "cross") {
+ mySeries = "1"
+ if(! singleFile)
+ mySeries = curves[,9]
+
if(analysisCross[2] == "Speed,Power") {
par(mar=c(5,4,4,5))
analysisCrossVertVars = unlist(strsplit(analysisCross[2], "\\,"))
paintCrossVariables(paf, analysisCross[3], analysisCrossVertVars[1],
analysisCross[4], "LEFT", Title,
- singleFile,Eccon)
+ singleFile,Eccon,mySeries)
par(new=T)
paintCrossVariables(paf, analysisCross[3], analysisCrossVertVars[2],
analysisCross[4], "RIGHT", "",
- singleFile,Eccon)
+ singleFile,Eccon,mySeries)
} else
paintCrossVariables(paf, analysisCross[3], analysisCross[2],
analysisCross[4], "ALONE", Title,
- singleFile,Eccon)
+ singleFile,Eccon,mySeries)
}
else if(Analysis == "1RMBadillo2010") {
paint1RMBadillo2010(paf, Title)
@@ -1353,6 +1405,7 @@ doProcess <- function(options) {
if(Analysis == "curves" || writeCurves) {
if(singleFile)
paf=cbind(
+ "1", #seriesName
"exerciseName",
Mass,
curves[,1],
@@ -1362,13 +1415,14 @@ doProcess <- function(options) {
curvesHeight = curvesHeight[-discardedCurves]
paf=cbind(
+ curves[,9], #seriesName
curves[,4], #exerciseName
curves[,5], #mass
curves[,1],
curves[,2]-curves[,1],curvesHeight,paf)
}
- colnames(paf)=c("exercise","mass",
+ colnames(paf)=c("series","exercise","mass",
"start","width","height",
"meanSpeed","maxSpeed","maxSpeedT",
"meanPower","peakPower","peakPowerT",
diff --git a/src/encoder.cs b/src/encoder.cs
index 33022c1..902068d 100644
--- a/src/encoder.cs
+++ b/src/encoder.cs
@@ -184,13 +184,14 @@ public class EncoderCurve
}
//used on TreeView analyze
- public EncoderCurve (string n, string exercise, double extraWeight,
+ public EncoderCurve (string n, string series, string exercise, double extraWeight,
string start, string duration, string height,
string meanSpeed, string maxSpeed, string maxSpeedT,
string meanPower, string peakPower, string peakPowerT,
string PP_PPT)
{
this.N = n;
+ this.Series = series;
this.Exercise = exercise;
this.ExtraWeight = extraWeight;
this.Start = start;
@@ -206,6 +207,7 @@ public class EncoderCurve
}
public string N;
+ public string Series;
public string Exercise;
public double ExtraWeight;
public string Start;
diff --git a/src/gui/encoder.cs b/src/gui/encoder.cs
index b0ca6c7..453ea84 100644
--- a/src/gui/encoder.cs
+++ b/src/gui/encoder.cs
@@ -121,6 +121,8 @@ public partial class ChronoJumpWindow
private string encoderTimeStamp;
private string encoderSignalUniqueID;
+ private ArrayList encoderComparePersons;
+
private static int encoderCaptureCountdown;
private static Gdk.Point [] encoderCapturePoints; //stored to be realtime displayed
private static int encoderCapturePointsCaptured; //stored to be realtime displayed
@@ -455,8 +457,8 @@ public partial class ChronoJumpWindow
genericWin.Button_accept.Clicked -= new EventHandler(on_encoder_show_curves_done);
//get selected/deselected rows
- string [] checkboxes = genericWin.GetCheckboxesStatus();
- Log.WriteLine(Util.StringArrayToString(checkboxes,";"));
+ string [] checkboxes = genericWin.GetCheckboxesStatus(0, false);
+ //Log.WriteLine(Util.StringArrayToString(checkboxes,";"));
ArrayList data = SqliteEncoder.Select(
false, -1, currentPerson.UniqueID, currentSession.UniqueID, "curve", false);
@@ -477,7 +479,7 @@ public partial class ChronoJumpWindow
int activeCurvesNum = getActiveCurvesNum(data);
label_encoder_user_curves_active_num.Text = activeCurvesNum.ToString();
- string [] activeCurvesList = getActiveCurvesList(checkboxes, activeCurvesNum);
+ string [] activeCurvesList = getActiveCheckboxesList(checkboxes, activeCurvesNum);
UtilGtk.ComboUpdate(combo_encoder_analyze_curve_num_combo, activeCurvesList, "");
combo_encoder_analyze_curve_num_combo.Active =
UtilGtk.ComboMakeActive(combo_encoder_analyze_curve_num_combo, activeCurvesList[0]);
@@ -499,7 +501,7 @@ public partial class ChronoJumpWindow
if(p.UniqueID != currentPerson.UniqueID) {
ArrayList eSQLarray = SqliteEncoder.Select(
false, -1, p.UniqueID, currentSession.UniqueID, "curve",
false);
- string [] s = { p.UniqueID.ToString(), p.Name,
+ string [] s = { "", p.UniqueID.ToString(), p.Name,
getActiveCurvesNum(eSQLarray).ToString(), eSQLarray.Count.ToString()
};
data.Add(s);
@@ -509,10 +511,24 @@ public partial class ChronoJumpWindow
}
i ++;
}
-
+
+ //prepare checkboxes to be marked
string [] checkboxes = new string[data.Count]; //to store active or inactive status
-
+ int count = 0;
+ foreach(string [] sPersons in data) {
+ bool found = false;
+ foreach(string s2 in encoderComparePersons)
+ if(Util.FetchID(s2).ToString() == sPersons[1])
+ found = true;
+
+ if(found)
+ checkboxes[count++] = "active";
+ else
+ checkboxes[count++] = "inactive";
+ }
+
string [] columnsString = {
+ Catalog.GetString("hiddennothing"),
Catalog.GetString("ID"),
Catalog.GetString("Name"),
Catalog.GetString("Selected\ncurves"),
@@ -536,8 +552,6 @@ public partial class ChronoJumpWindow
genericWin.CreateComboAllNoneSelected();
genericWin.SetTreeview(columnsString, true, data, nonSensitiveRows);
-
-
genericWin.MarkActiveCurves(checkboxes);
genericWin.ShowButtonCancel(false);
genericWin.SetButtonAcceptSensitive(true);
@@ -554,17 +568,21 @@ public partial class ChronoJumpWindow
void on_encoder_analyze_data_compare_done (object o, EventArgs args) {
genericWin.Button_accept.Clicked -= new EventHandler(on_encoder_analyze_data_compare_done);
-
+
+ encoderComparePersons = new ArrayList ();
+ string [] selectedID = genericWin.GetCheckboxesStatus(1,true);
+ string [] selectedName = genericWin.GetCheckboxesStatus(2,true);
+
+ for (int i=0 ; i < selectedID.Length ; i ++)
+ encoderComparePersons.Add(Convert.ToInt32(selectedID[i]) + ":" + selectedName[i]);
+ //encoderComparePersons.Add(currentPerson.UniqueID + ":" + currentPerson.Name);
+
genericWin.HideAndNull();
Log.WriteLine("done");
}
-
-
-
-
void on_button_encoder_load_signal_clicked (object o, EventArgs args)
{
ArrayList data = SqliteEncoder.Select(
@@ -833,7 +851,7 @@ public partial class ChronoJumpWindow
return countActiveCurves;
}
- private string [] getActiveCurvesList(string [] checkboxes, int activeCurvesNum) {
+ private string [] getActiveCheckboxesList(string [] checkboxes, int activeCurvesNum) {
if(activeCurvesNum == 0)
return Util.StringToStringArray("");
@@ -854,7 +872,7 @@ public partial class ChronoJumpWindow
foreach(EncoderSQL es in data) {
checkboxes[count++] = es.future1;
}
- string [] activeCurvesList = getActiveCurvesList(checkboxes, activeCurvesNum);
+ string [] activeCurvesList = getActiveCheckboxesList(checkboxes, activeCurvesNum);
UtilGtk.ComboUpdate(combo_encoder_analyze_curve_num_combo, activeCurvesList, "");
combo_encoder_analyze_curve_num_combo.Active =
UtilGtk.ComboMakeActive(combo_encoder_analyze_curve_num_combo, activeCurvesList[0]);
@@ -972,10 +990,35 @@ public partial class ChronoJumpWindow
if(radiobutton_encoder_analyze_data_user_curves.Active) {
ArrayList data = SqliteEncoder.Select(
false, -1, currentPerson.UniqueID, currentSession.UniqueID, "curve",
false);
- if(data.Count == 0)
+ if(data.Count == 0) {
+ new DialogMessage(Constants.MessageTypes.WARNING,
+ Catalog.GetString("Sorry, no curves selected."));
return;
- //TODO: in the future plot a "no curves" message,
- //or beter done allow to analyze if there's no curves
+ }
+
+ //check on unsupported graph
+ string crossNameTemp =
+ Util.FindOnArray(':',1,0,UtilGtk.ComboGetActive(combo_encoder_analyze_cross),
+ encoderAnalyzeCrossTranslation);
+
if(Util.FindOnArray(':',1,0,UtilGtk.ComboGetActive(combo_encoder_analyze_data_compare),
+ encoderDataCompareTranslation) != "No compare" &&
+ encoderAnalysis == "cross" &&
+ (
+ crossNameTemp == "Speed,Power / Load" ||
+ crossNameTemp == Catalog.GetString("Speed,Power / Load") ||
+ crossNameTemp == "1RM Prediction" ||
+ crossNameTemp == Catalog.GetString("1RM Prediction")
+ )) {
+ new DialogMessage(Constants.MessageTypes.WARNING,
+ Catalog.GetString("Sorry, this graph is not supported yet.") +
+ "\n\nUser curves - compare - cross variables" +
+ "\n- Speed,Power / Load" +
+ "\n- 1RM Prediction"
+ );
+
+ return;
+ }
+
}
encoderThreadStart(encoderModes.ANALYZE);
@@ -1165,13 +1208,32 @@ public partial class ChronoJumpWindow
dataFileName = Util.GetEncoderGraphInputMulti();
- //create dataFileName
+
double bodyMass = Convert.ToDouble(currentPersonSession.Weight);
- ArrayList data = SqliteEncoder.Select(
- false, -1, currentPerson.UniqueID, currentSession.UniqueID,
"curve",false);
+ //select curves for this person
+ ArrayList data = new ArrayList();
+
+ data = SqliteEncoder.Select(
+ false, -1, currentPerson.UniqueID, currentSession.UniqueID, "curve", true);
+
+ //if compare, select curves for other persons and add
+
if(Util.FindOnArray(':',1,0,UtilGtk.ComboGetActive(combo_encoder_analyze_data_compare),
+ encoderDataCompareTranslation) != "No compare") {
+ ArrayList dataPre = new ArrayList();
+ for (int i=0 ; i < encoderComparePersons.Count ; i ++) {
+ dataPre = SqliteEncoder.Select(
+ false, -1, Util.FetchID(encoderComparePersons[i].ToString()),
+ currentSession.UniqueID, "curve", true);
+ foreach(EncoderSQL es in dataPre)
+ data.Add(es);
+ }
+ }
+
+
+ //create dataFileName
TextWriter writer = File.CreateText(dataFileName);
- writer.WriteLine("status,exerciseName,mass,smoothingOne,dateTime,fullURL,eccon");
+
writer.WriteLine("status,seriesName,exerciseName,mass,smoothingOne,dateTime,fullURL,eccon");
Sqlite.Open();
ArrayList eeArray =
@@ -1189,7 +1251,20 @@ public partial class ChronoJumpWindow
// SqliteEncoder.SelectEncoderExercises(true, eSQL.exerciseID, false)[0];
mass += bodyMass * ex.percentBodyWeight / 100.0;
- writer.WriteLine(eSQL.future1 + "," + ex.name + "," +
+ //personName
+ string personName = "";
+ if(Util.FindOnArray(':',1,0,
+
UtilGtk.ComboGetActive(combo_encoder_analyze_data_compare),
+ encoderDataCompareTranslation) != "No compare")
+ {
+ foreach(string str in encoderComparePersons)
+ if(Util.FetchID(str) == eSQL.personID)
+ personName = Util.FetchName(str);
+ }
+ if(personName == "")
+ personName = currentPerson.Name;
+
+ writer.WriteLine(eSQL.future1 + "," + personName + "," + ex.name + "," +
Util.ConvertToPoint(mass).ToString() + "," +
Util.ConvertToPoint(eSQL.smooth) + "," + eSQL.GetDate(true) +
"," +
eSQL.GetFullURL(true) + "," + //convertPathToR
@@ -1564,9 +1639,23 @@ public partial class ChronoJumpWindow
radiobutton_encoder_analyze_side.Sensitive = false;
radiobutton_encoder_analyze_cross.Active = true;
button_encoder_analyze_data_compare.Visible = true;
+
+ //put some data just in case user doesn't click on compare button
+ encoderComparePersonsInitialize();
}
}
+ //put some data just in case user doesn't click on compare button
+ private void encoderComparePersonsInitialize() {
+ if(encoderComparePersons == null)
+ encoderComparePersons = new ArrayList ();
+ /*
+ string myPerson = currentPerson.UniqueID + ":" + currentPerson.Name;
+ if(! Util.FoundInArrayList(encoderComparePersons, myPerson))
+ encoderComparePersons.Add(myPerson);
+ */
+ }
+
void on_combo_encoder_analyze_cross_changed (object o, EventArgs args)
{
if(Util.FindOnArray(':',1,0,UtilGtk.ComboGetActive(combo_encoder_analyze_cross),
@@ -1731,12 +1820,13 @@ public partial class ChronoJumpWindow
encoderCaptureCurves.Add (new EncoderCurve (
cells[0], //id
- //cells[1], //exerciseName
- //cells[2], //mass
- cells[3], cells[4], cells[5],
- cells[6], cells[7], cells[8],
- cells[9], cells[10], cells[11],
- cells[12]
+ //cells[1], //seriesName
+ //cells[2], //exerciseName
+ //cells[3], //mass
+ cells[4], cells[5], cells[6],
+ cells[7], cells[8], cells[9],
+ cells[10], cells[11], cells[12],
+ cells[13]
));
} while(true);
@@ -1809,6 +1899,7 @@ public partial class ChronoJumpWindow
private int createTreeViewEncoderAnalyze(string contents) {
string [] columnsString = {
Catalog.GetString("Curve") + "\n",
+ Catalog.GetString("Series") + "\n",
Catalog.GetString("Exercise") + "\n",
Catalog.GetString("Extra weight") + "\n (Kg)",
Catalog.GetString("Start") + "\n (s)",
@@ -1839,20 +1930,20 @@ public partial class ChronoJumpWindow
string line;
int curvesCount = 0;
-Log.WriteLine("a");
+Log.Write("a");
using (StringReader reader = new StringReader (contents)) {
-Log.WriteLine("b");
+Log.Write("b");
line = reader.ReadLine (); //headers
Log.WriteLine(line);
-Log.WriteLine("c");
+Log.Write("c");
do {
-Log.WriteLine("d");
+Log.Write("d");
line = reader.ReadLine ();
Log.WriteLine(line);
if (line == null)
break;
-Log.WriteLine("e");
+Log.Write("e");
curvesCount ++;
@@ -1866,26 +1957,27 @@ Log.WriteLine("e");
exerciseName = eSQL.exerciseName;
mass = eSQL.extraWeight;
*/
- exerciseName = cells[1];
- mass = cells[2];
+ exerciseName = cells[2];
+ mass = cells[3];
}
-Log.WriteLine("f");
+Log.Write("f");
encoderAnalyzeCurves.Add (new EncoderCurve (
cells[0],
+ cells[1], //seriesName
exerciseName,
Convert.ToDouble(mass),
- cells[3], cells[4], cells[5],
- cells[6], cells[7], cells[8],
- cells[9], cells[10], cells[11],
- cells[12]
+ cells[4], cells[5], cells[6],
+ cells[7], cells[8], cells[9],
+ cells[10], cells[11], cells[12],
+ cells[13]
));
-Log.WriteLine("g");
+Log.Write("g");
} while(true);
-Log.WriteLine("h");
+Log.Write("h");
}
-Log.WriteLine("i");
+Log.Write("i");
encoderAnalyzeListStore = new Gtk.ListStore (typeof (EncoderCurve));
foreach (EncoderCurve curve in encoderAnalyzeCurves)
@@ -1898,7 +1990,7 @@ Log.WriteLine("i");
treeview_encoder_analyze_curves.HeadersVisible=true;
-Log.WriteLine("j");
+Log.Write("j");
int i=0;
foreach(string myCol in columnsString) {
Gtk.TreeViewColumn aColumn = new Gtk.TreeViewColumn ();
@@ -1910,45 +2002,48 @@ Log.WriteLine("j");
//crt1.Background = "blue";
-Log.WriteLine("k");
+Log.Write("k");
switch(i){
case 0:
aColumn.SetCellDataFunc (aCell, new Gtk.TreeCellDataFunc
(RenderNAnalyze));
break;
case 1:
- aColumn.SetCellDataFunc (aCell, new Gtk.TreeCellDataFunc
(RenderExercise));
+ aColumn.SetCellDataFunc (aCell, new Gtk.TreeCellDataFunc
(RenderSeries));
break;
case 2:
- aColumn.SetCellDataFunc (aCell, new Gtk.TreeCellDataFunc
(RenderExtraWeight));
+ aColumn.SetCellDataFunc (aCell, new Gtk.TreeCellDataFunc
(RenderExercise));
break;
case 3:
- aColumn.SetCellDataFunc (aCell, new Gtk.TreeCellDataFunc
(RenderStart));
+ aColumn.SetCellDataFunc (aCell, new Gtk.TreeCellDataFunc
(RenderExtraWeight));
break;
case 4:
- aColumn.SetCellDataFunc (aCell, new Gtk.TreeCellDataFunc
(RenderDuration));
+ aColumn.SetCellDataFunc (aCell, new Gtk.TreeCellDataFunc
(RenderStart));
break;
case 5:
- aColumn.SetCellDataFunc (aCell, new Gtk.TreeCellDataFunc
(RenderHeight));
+ aColumn.SetCellDataFunc (aCell, new Gtk.TreeCellDataFunc
(RenderDuration));
break;
case 6:
- aColumn.SetCellDataFunc (aCell, new Gtk.TreeCellDataFunc
(RenderMeanSpeed));
+ aColumn.SetCellDataFunc (aCell, new Gtk.TreeCellDataFunc
(RenderHeight));
break;
case 7:
- aColumn.SetCellDataFunc (aCell, new Gtk.TreeCellDataFunc
(RenderMaxSpeed));
+ aColumn.SetCellDataFunc (aCell, new Gtk.TreeCellDataFunc
(RenderMeanSpeed));
break;
case 8:
- aColumn.SetCellDataFunc (aCell, new Gtk.TreeCellDataFunc
(RenderMaxSpeedT));
+ aColumn.SetCellDataFunc (aCell, new Gtk.TreeCellDataFunc
(RenderMaxSpeed));
break;
case 9:
- aColumn.SetCellDataFunc (aCell, new Gtk.TreeCellDataFunc
(RenderMeanPower));
+ aColumn.SetCellDataFunc (aCell, new Gtk.TreeCellDataFunc
(RenderMaxSpeedT));
break;
case 10:
- aColumn.SetCellDataFunc (aCell, new Gtk.TreeCellDataFunc
(RenderPeakPower));
+ aColumn.SetCellDataFunc (aCell, new Gtk.TreeCellDataFunc
(RenderMeanPower));
break;
case 11:
- aColumn.SetCellDataFunc (aCell, new Gtk.TreeCellDataFunc
(RenderPeakPowerT));
+ aColumn.SetCellDataFunc (aCell, new Gtk.TreeCellDataFunc
(RenderPeakPower));
break;
case 12:
+ aColumn.SetCellDataFunc (aCell, new Gtk.TreeCellDataFunc
(RenderPeakPowerT));
+ break;
+ case 13:
aColumn.SetCellDataFunc (aCell, new Gtk.TreeCellDataFunc
(RenderPP_PPT));
break;
}
@@ -1957,7 +2052,7 @@ Log.WriteLine("k");
i++;
}
return curvesCount;
-Log.WriteLine("l");
+Log.Write("l");
}
/* rendering columns */
@@ -2018,6 +2113,12 @@ Log.WriteLine("l");
(cell as Gtk.CellRendererText).Text = curve.N;
}
+ private void RenderSeries (Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model,
Gtk.TreeIter iter)
+ {
+ EncoderCurve curve = (EncoderCurve) model.GetValue (iter, 0);
+ (cell as Gtk.CellRendererText).Text = curve.Series;
+ }
+
private void RenderExercise (Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model,
Gtk.TreeIter iter)
{
EncoderCurve curve = (EncoderCurve) model.GetValue (iter, 0);
@@ -2168,15 +2269,15 @@ Log.WriteLine("l");
private string [] fixDecimals(string [] cells) {
//start, width, height
- for(int i=3; i <= 5; i++)
+ for(int i=4; i <= 6; i++)
cells[i] =
Util.TrimDecimals(Convert.ToDouble(Util.ChangeDecimalSeparator(cells[i])),1);
//meanSpeed,maxSpeed,maxSpeedT, meanPower,peakPower,peakPowerT
- for(int i=6; i <= 11; i++)
+ for(int i=7; i <= 12; i++)
cells[i] =
Util.TrimDecimals(Convert.ToDouble(Util.ChangeDecimalSeparator(cells[i])),3);
//pp/ppt
- cells[12] = Util.TrimDecimals(Convert.ToDouble(Util.ChangeDecimalSeparator(cells[12])),1);
+ cells[13] = Util.TrimDecimals(Convert.ToDouble(Util.ChangeDecimalSeparator(cells[13])),1);
return cells;
}
@@ -2304,6 +2405,9 @@ Log.WriteLine("l");
image_encoder_capture.Sensitive = false;
image_encoder_analyze.Sensitive = false;
treeview_encoder_analyze_curves.Sensitive = false;
+
+ //put some data just in case user doesn't click on compare button
+ encoderComparePersonsInitialize();
}
private void encoderButtonsSensitive(encoderSensEnum option) {
diff --git a/src/gui/genericWindow.cs b/src/gui/genericWindow.cs
index 866f92e..c17f0ac 100644
--- a/src/gui/genericWindow.cs
+++ b/src/gui/genericWindow.cs
@@ -397,22 +397,37 @@ public class GenericWindow
tv.InsertColumn (column, 0);
}
- public string [] GetCheckboxesStatus() {
- string [] checkboxes = new string[UtilGtk.CountRows(store)]; //to store active or inactive
status of curves
+ //if column == 0 returns checkboxes column. If is 1 returns column 1...
+ public string [] GetCheckboxesStatus(int column, bool onlyActive)
+ {
+ //to store active or inactive status of curves
+ string [] checkboxes = new string[UtilGtk.CountRows(store)];
int count = 0;
Gtk.TreeIter iter;
bool okIter = store.GetIterFirst(out iter);
if(okIter) {
do {
- if((bool) store.GetValue (iter, 0))
- checkboxes[count++] = "active";
+ if(column == 0) {
+ if((bool) store.GetValue (iter, 0))
+ checkboxes[count++] = "active";
+ else
+ checkboxes[count++] = "inactive";
+ }
else
- checkboxes[count++] = "inactive";
+ if((bool) store.GetValue (iter, 0) || ! onlyActive)
+ checkboxes[count++] = ((string) store.GetValue (iter,
column));
} while ( store.IterNext(ref iter) );
}
- return checkboxes;
+ if(column == 0)
+ return checkboxes;
+ else {
+ string [] checkboxesWithoutGaps = new string[count];
+ for(int i=0; i < count; i ++)
+ checkboxesWithoutGaps[i] = checkboxes[i];
+ return checkboxesWithoutGaps;
+ }
}
protected void ItemToggled(object o, ToggledArgs args) {
diff --git a/src/util.cs b/src/util.cs
index 60e1c18..2000d15 100644
--- a/src/util.cs
+++ b/src/util.cs
@@ -1226,8 +1226,14 @@ public class Util
//Wait until this to update encoder gui (if don't wait then treeview will be outdated)
if(es.Ep.Analysis == "curves" || es.Ep.Analysis == "exportCSV")
outputFileCheck = es.OutputData1;
- else
- outputFileCheck = es.OutputGraph;
+ else {
+ //outputFileCheck = es.OutputGraph;
+ //
+ //OutputData1 because since Chronojump 1.3.6,
+ //encoder analyze has a treeview that can show the curves
+ //when a graph analysis is done, curves file has to be written
+ outputFileCheck = es.OutputData1;
+ }
pinfo.FileName=pBin;
@@ -1510,7 +1516,6 @@ public class Util
return false;
}
-
/*
//delete a row of and arraylist of string[] if the string[0] is the value coming from startsWith
public static ArrayList DeleteFromArrayList(ArrayList firstArrayList, string startsWith, char
delimited) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]