[chronojump] Encoder barplot feedback historical shows date
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] Encoder barplot feedback historical shows date
- Date: Thu, 16 Jul 2020 09:14:24 +0000 (UTC)
commit 79db871e44b21a8a56a7fc5e7b431146f562ef91
Author: Xavier de Blas <xaviblas gmail com>
Date: Thu Jul 16 11:04:40 2020 +0200
Encoder barplot feedback historical shows date
src/encoder.cs | 18 +++++++++++----
src/gui/app1/encoder.cs | 51 +++++++++++++++++++++++++++++++++---------
src/gui/encoderGraphObjects.cs | 13 ++++++++++-
src/sqlite/main.cs | 2 +-
4 files changed, 68 insertions(+), 16 deletions(-)
---
diff --git a/src/encoder.cs b/src/encoder.cs
index e791c996..61826249 100644
--- a/src/encoder.cs
+++ b/src/encoder.cs
@@ -957,7 +957,8 @@ public class EncoderSQL
//used on encoder table
public enum Eccons { ALL, ecS, ceS, c }
- public string GetDate(bool pretty) {
+ public string GetDatetimeStr (bool pretty)
+ {
int pointPos = filename.LastIndexOf('.');
int dateLength = 19; //YYYY-MM-DD_hh-mm-ss
string date = filename.Substring(pointPos - dateLength, dateLength);
@@ -968,6 +969,15 @@ public class EncoderSQL
return date;
}
+ public string GetDateStr ()
+ {
+ int pointPos = filename.LastIndexOf('.');
+ int dateLength = 19; //YYYY-MM-DD_hh-mm-ss
+ string date = filename.Substring(pointPos - dateLength, dateLength);
+ string [] dateParts = date.Split(new char[] {'_'});
+ return dateParts[0];
+ }
+
public string GetFullURL(bool convertPathToR) {
string str = url + Path.DirectorySeparatorChar + filename;
/*
@@ -1027,7 +1037,7 @@ public class EncoderSQL
str[i++] = encoderConfiguration.code.ToString();
str[i++] = ecconLong;
- str[i++] = GetDate(true);
+ str[i++] = GetDatetimeStr (true);
if(video) {
if(videoURL != "")
@@ -1078,9 +1088,9 @@ public class EncoderSQL
*/
if(signalOrCurve == "curve")
- newFilename = newPersonID + "-" + newPersonName + "-" + uniqueID + "-" +
GetDate(false) + ".txt";
+ newFilename = newPersonID + "-" + newPersonName + "-" + uniqueID + "-" +
GetDatetimeStr (false) + ".txt";
else
- newFilename = newPersonID + "-" + newPersonName + "-" + GetDate(false) + ".txt";
+ newFilename = newPersonID + "-" + newPersonName + "-" + GetDatetimeStr (false) +
".txt";
bool success = false;
success = Util.FileMove(url, filename, newFilename);
diff --git a/src/gui/app1/encoder.cs b/src/gui/app1/encoder.cs
index 4596013b..4a9e9caf 100644
--- a/src/gui/app1/encoder.cs
+++ b/src/gui/app1/encoder.cs
@@ -369,6 +369,13 @@ public partial class ChronoJumpWindow
bool firstSetOfCont; //used to don't erase the screen on cont after first set
bool encoderInertialCalibratedFirstTime; //allow showing the recalibrate button
+ private double maxPowerIntersession;
+ private double maxSpeedIntersession;
+ private double maxForceIntersession;
+ private string maxPowerIntersessionDate;
+ private string maxSpeedIntersessionDate;
+ private string maxForceIntersessionDate;
+
/*
* this contains last EncoderSQL captured, recalculated or loaded
*
@@ -680,6 +687,10 @@ public partial class ChronoJumpWindow
maxPowerIntersession = 0;
maxSpeedIntersession = 0;
maxForceIntersession = 0;
+ maxPowerIntersessionDate = "";
+ maxSpeedIntersessionDate = "";
+ maxForceIntersessionDate = "";
+
if(encGI == Constants.EncoderGI.GRAVITATORY)
{
//TODO: do a regression to find maxPower with a value of extraWeight unused
@@ -689,11 +700,20 @@ public partial class ChronoJumpWindow
if(Util.SimilarDouble(Convert.ToDouble(Util.ChangeDecimalSeparator(es.extraWeight)), extraWeight))
{
if(Convert.ToDouble(es.future1) > maxPowerIntersession)
+ {
maxPowerIntersession = Convert.ToDouble(es.future1);
+ maxPowerIntersessionDate = es.GetDateStr();
+ }
if(Convert.ToDouble(es.future2) > maxSpeedIntersession)
+ {
maxSpeedIntersession = Convert.ToDouble(es.future2);
+ maxSpeedIntersessionDate = es.GetDateStr();
+ }
if(Convert.ToDouble(es.future3) > maxForceIntersession)
+ {
maxForceIntersession = Convert.ToDouble(es.future3);
+ maxForceIntersessionDate = es.GetDateStr();
+ }
}
}
}
@@ -903,9 +923,6 @@ public partial class ChronoJumpWindow
}
- double maxPowerIntersession;
- double maxSpeedIntersession;
- double maxForceIntersession;
//called from main GUI
void on_button_encoder_capture_clicked (object o, EventArgs args)
{
@@ -1715,7 +1732,7 @@ public partial class ChronoJumpWindow
//but check if more info have to be shown on this process
textview_encoder_signal_comment.Buffer.Text = eSQL.description;
- encoderTimeStamp = eSQL.GetDate(false);
+ encoderTimeStamp = eSQL.GetDatetimeStr(false);
encoderSignalUniqueID = eSQL.uniqueID;
//has to be done here, because if done in encoderThreadStart or in
finishPulsebar it crashes
@@ -3183,7 +3200,7 @@ public partial class ChronoJumpWindow
ex.name + "," +
Util.ConvertToPoint(iteratingMassBody).ToString() + "," +
Util.ConvertToPoint(Convert.ToDouble(eSQL.extraWeight)) + ","
+
- eSQL.GetDate(true) + "," +
+ eSQL.GetDatetimeStr(true) + "," +
fullURL + "," +
eSQL.eccon + "," + //this is the eccon of every curve
ex.percentBodyWeight.ToString() + "," +
@@ -5371,7 +5388,8 @@ public partial class ChronoJumpWindow
captureCurvesBarsData,
encoderCaptureListStore,
preferences.encoderCaptureMainVariableThisSetOrHistorical,
-
sendMaxPowerSpeedForceIntersession(preferences.encoderCaptureMainVariable));
+
sendMaxPowerSpeedForceIntersession(preferences.encoderCaptureMainVariable),
+
sendMaxPowerSpeedForceIntersessionDate(preferences.encoderCaptureMainVariable));
}
}
@@ -5528,6 +5546,17 @@ public partial class ChronoJumpWindow
return maxPowerIntersession; //default if any problem
}
+ private string sendMaxPowerSpeedForceIntersessionDate(Constants.EncoderVariablesCapture evc)
+ {
+ if(evc == Constants.EncoderVariablesCapture.MeanPower)
+ return maxPowerIntersessionDate;
+ else if(evc == Constants.EncoderVariablesCapture.MeanSpeed)
+ return maxSpeedIntersessionDate;
+ else if(evc == Constants.EncoderVariablesCapture.MeanForce)
+ return maxForceIntersessionDate;
+
+ return maxPowerIntersessionDate; //default if any problem
+ }
/*
@@ -6228,7 +6257,8 @@ public partial class ChronoJumpWindow
captureCurvesBarsData,
encoderCaptureListStore,
preferences.encoderCaptureMainVariableThisSetOrHistorical,
-
sendMaxPowerSpeedForceIntersession(preferences.encoderCaptureMainVariable));
+
sendMaxPowerSpeedForceIntersession(preferences.encoderCaptureMainVariable),
+
sendMaxPowerSpeedForceIntersessionDate(preferences.encoderCaptureMainVariable));
//}
needToRefreshTreeviewCapture = false;
@@ -6728,8 +6758,9 @@ public partial class ChronoJumpWindow
captureCurvesBarsData,
encoderCaptureListStore,
preferences.encoderCaptureMainVariableThisSetOrHistorical,
-
sendMaxPowerSpeedForceIntersession(preferences.encoderCaptureMainVariable));
-
+
sendMaxPowerSpeedForceIntersession(preferences.encoderCaptureMainVariable),
+
sendMaxPowerSpeedForceIntersessionDate(preferences.encoderCaptureMainVariable));
+
button_encoder_signal_save_comment.Label = Catalog.GetString("Save comment");
button_encoder_signal_save_comment.Sensitive = false;
@@ -7087,7 +7118,7 @@ public partial class ChronoJumpWindow
bool deletedUserCurves = false;
foreach(EncoderSQL eSQL in data)
{
- if(currentSignalSQL.GetDate(false) == eSQL.GetDate(false)) // (1)
+ if(currentSignalSQL.GetDatetimeStr(false) == eSQL.GetDatetimeStr(false))
// (1)
{
// (1a)
if(findEccon(true) != eSQL.eccon ||
diff --git a/src/gui/encoderGraphObjects.cs b/src/gui/encoderGraphObjects.cs
index 03293e33..69b6916e 100644
--- a/src/gui/encoderGraphObjects.cs
+++ b/src/gui/encoderGraphObjects.cs
@@ -47,6 +47,7 @@ public class EncoderGraphDoPlot
private Gtk.ListStore encoderCaptureListStore;
private bool relativeToSet;
private double maxPowerSpeedForceIntersession; //it will be one of these 3
+ private string maxPowerSpeedForceIntersessionDate;
private int discardFirstN;
private int showNRepetitions;
@@ -146,7 +147,7 @@ public class EncoderGraphDoPlot
bool hasInertia, bool playSoundsFromFile,
ArrayList data7Variables, Gtk.ListStore encoderCaptureListStore,
bool relativeToSet,
- double maxPowerSpeedForceIntersession)
+ double maxPowerSpeedForceIntersession, string maxPowerSpeedForceIntersessionDate)
{
this.mainVariable = mainVariable;
this.mainVariableHigher = mainVariableHigher;
@@ -161,6 +162,7 @@ public class EncoderGraphDoPlot
this.encoderCaptureListStore = encoderCaptureListStore;
this.relativeToSet = relativeToSet;
this.maxPowerSpeedForceIntersession = maxPowerSpeedForceIntersession;
+ this.maxPowerSpeedForceIntersessionDate = maxPowerSpeedForceIntersessionDate;
graphWidth = drawingarea.Allocation.Width;
graphHeight = drawingarea.Allocation.Height;
@@ -499,6 +501,15 @@ public class EncoderGraphDoPlot
graphWidth - right_margin, top_margin);
+ //write date
+ layout_encoder_capture_curves_bars_text.SetMarkup(maxPowerSpeedForceIntersessionDate);
+ layout_encoder_capture_curves_bars_text.GetPixelSize(out textWidth, out textHeight);
+ pixmap.DrawLayout (pen_black_encoder_capture,
+ graphWidth - (right_margin + textWidth),
+ top_margin - 2*textHeight,
+ layout_encoder_capture_curves_bars_text);
+
+ //write value
int decs = 0;
if(mainVariable == Constants.MeanPower)
units = " W";
diff --git a/src/sqlite/main.cs b/src/sqlite/main.cs
index 659ab1bb..cec536ce 100644
--- a/src/sqlite/main.cs
+++ b/src/sqlite/main.cs
@@ -1657,7 +1657,7 @@ class Sqlite
foreach(EncoderSQL c in curves) {
conversionSubRate ++;
- if(s.GetDate(false) == c.GetDate(false) && s.eccon ==
c.eccon) {
+ if(s.GetDatetimeStr (false) == c.GetDatetimeStr (false) &&
s.eccon == c.eccon) {
int msCentral = SqliteEncoder.FindCurveInSignal(
s.GetFullURL(false),
c.GetFullURL(false));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]