[chronojump/FS-TFT-Menu] repCriteria implemented on historic data on CairoBars encoder
- From: Xavier Padullés <xpadulles src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump/FS-TFT-Menu] repCriteria implemented on historic data on CairoBars encoder
- Date: Wed, 20 Apr 2022 11:59:23 +0000 (UTC)
commit 4186b4f0ba7e37f83301d38cd8c3cdd87db71747
Author: Xavier de Blas <xaviblas gmail com>
Date: Fri Apr 8 18:28:04 2022 +0200
repCriteria implemented on historic data on CairoBars encoder
src/gui/cairo/bars.cs | 59 +++++++++++++++++++++++++++++++++++++++++++++++++
src/gui/eventExecute.cs | 17 ++++++++++++--
src/preferences.cs | 7 ++++++
3 files changed, 81 insertions(+), 2 deletions(-)
---
diff --git a/src/gui/cairo/bars.cs b/src/gui/cairo/bars.cs
index d60e3b11c..64bb800f2 100644
--- a/src/gui/cairo/bars.cs
+++ b/src/gui/cairo/bars.cs
@@ -84,6 +84,10 @@ public abstract class CairoBars : CairoGeneric
protected List<CairoBarsArrow> eccOverload_l;
protected bool eccOverloadWriteValue;
protected List<int> saved_l;
+ protected double maxIntersession;
+ protected Preferences.EncoderRepetitionCriteria maxIntersessionEcconCriteria;
+ protected string maxIntersessionValueStr; //with correct decimals and units
+ protected string maxIntersessionDate;
// ---- values can be passed from outside via accessors ---->
protected string xVariable = "";
@@ -357,6 +361,9 @@ public abstract class CairoBars : CairoGeneric
eccOverload_l = new List<CairoBarsArrow>();
eccOverloadWriteValue = false;
saved_l = new List<int>();
+ maxIntersession = 0;
+ maxIntersessionValueStr = "";
+ maxIntersessionDate = "";
}
private void leftRightMarginsSet ()
@@ -920,6 +927,33 @@ public abstract class CairoBars : CairoGeneric
g.Restore();
}
+ //encoder !relativeToSet
+ protected void writePersonsBest ()
+ {
+ double y = calculatePaintY(maxIntersession);
+
+ // 1) line
+ g.Save();
+ g.LineWidth = 2;
+ g.SetDash(new double[]{2, 2}, 0);
+
+ g.MoveTo(0, y);
+ g.LineTo(graphWidth, y);
+ g.Stroke ();
+
+ g.Restore();
+
+ // 2) texts
+ printText(0, y -titleTextHeight, 0, titleTextHeight,
+ "Person's historical best:" + maxIntersessionEcconCriteria.ToString(),
+ g, alignTypes.LEFT);
+
+ if(maxIntersessionValueStr != "")
+ printText(graphWidth, y -titleTextHeight, 0, titleTextHeight,
+ maxIntersessionValueStr + " (" + maxIntersessionDate + ")",
+ g, alignTypes.RIGHT);
+ }
+
protected void writeMessageAtCenter(string message)
{
Cairo.TextExtents te;
@@ -1028,6 +1062,19 @@ public abstract class CairoBars : CairoGeneric
set { saved_l = value; }
}
+ public double MaxIntersession {
+ set { maxIntersession = value; }
+ }
+ public Preferences.EncoderRepetitionCriteria MaxIntersessionEcconCriteria {
+ set { maxIntersessionEcconCriteria = value; }
+ }
+ public string MaxIntersessionValueStr {
+ set { maxIntersessionValueStr = value; }
+ }
+ public string MaxIntersessionDate {
+ set { maxIntersessionDate = value; }
+ }
+
public int Decs {
set { decs = value; }
}
@@ -1084,6 +1131,9 @@ public class CairoBars1Series : CairoBars
if(cairoBarsGuideManage != null && cairoBarsGuideManage.GetMax() > maxY)
maxY = cairoBarsGuideManage.GetMax();
+ if(maxIntersession >= maxY)
+ maxY = maxIntersession;
+
//points X start at 1
minX = 0;
maxX = barMain_l.Count + 1;
@@ -1207,6 +1257,9 @@ public class CairoBars1Series : CairoBars
writeTitleAtTop ();
+ if(maxIntersession > 0)
+ writePersonsBest (); //encoder !relativeToSet
+
if(clickable)
{
if(type == Type.ENCODER)
@@ -1398,6 +1451,9 @@ public class CairoBarsNHSeries : CairoBars
if(cairoBarsGuideManage != null && cairoBarsGuideManage.GetMax() > maxY)
maxY = cairoBarsGuideManage.GetMax();
+ if(maxIntersession >= maxY)
+ maxY = maxIntersession;
+
//points X start at 1
minX = 0;
//maxX = barMain_l.Count + .5; //all barMain_l lists have same length
@@ -1660,6 +1716,9 @@ public class CairoBarsNHSeries : CairoBars
writeTitleAtTop ();
+ if(maxIntersession > 0)
+ writePersonsBest (); //encoder !relativeToSet
+
if(showLegend)
writeLegend ();
diff --git a/src/gui/eventExecute.cs b/src/gui/eventExecute.cs
index 9267a7cc9..ddf1695d4 100644
--- a/src/gui/eventExecute.cs
+++ b/src/gui/eventExecute.cs
@@ -3419,6 +3419,11 @@ public class CairoPaintBarplotPreEncoder : CairoPaintBarsPre
private List<int> saved_l; //saved repetitions
private List<CairoBarsArrow> eccOverload_l;
+ //used on encoder when !relativeToSet
+ private double maxAbsoluteForCalc;
+ private double maxThisSetForCalc;
+
+ private string units;
private string titleStr;
private string lossStr;
private string workStr;
@@ -3571,7 +3576,7 @@ public class CairoPaintBarplotPreEncoder : CairoPaintBarsPre
//Get max min avg values of this set
double maxThisSetForGraph = -100000;
- double maxThisSetForCalc = -100000;
+ maxThisSetForCalc = -100000;
double minThisSet = 100000;
/*
* if ! Preferences.EncoderPhasesEnum.BOTH, eg: ECC, we can graph max CON (that maybe is the
highest value) , but for calculations we want only the max ECC value, so:
@@ -3660,7 +3665,7 @@ public class CairoPaintBarplotPreEncoder : CairoPaintBarsPre
return;
}
- double maxAbsoluteForCalc = maxThisSetForCalc;
+ maxAbsoluteForCalc = maxThisSetForCalc;
//can be on meanPower, meanSpeed, meanForce
if(! pegbe.relativeToSet)
{
@@ -3960,6 +3965,14 @@ public class CairoPaintBarplotPreEncoder : CairoPaintBarsPre
if(saved_l.Count > 0)
cb.Saved_l = saved_l;
+ if(! pegbe.relativeToSet)
+ {
+ cb.MaxIntersession = pegbe.maxPowerSpeedForceIntersession;
+ cb.MaxIntersessionEcconCriteria = preferences.GetEncoderRepetitionCriteria
(pegbe.hasInertia);
+ cb.MaxIntersessionValueStr = Util.TrimDecimals(pegbe.maxPowerSpeedForceIntersession,
decs) + " " + units;
+ cb.MaxIntersessionDate = pegbe.maxPowerSpeedForceIntersessionDate;
+ }
+
//this should be passed before PassData1Serie && PassData2Series
cb.SetEncoderTitle (titleStr, lossStr, workStr, impulseStr);
diff --git a/src/preferences.cs b/src/preferences.cs
index 2d7956275..e5a5fceff 100644
--- a/src/preferences.cs
+++ b/src/preferences.cs
@@ -114,6 +114,13 @@ public class Preferences
else
return encoderRepetitionCriteriaGravitatory;
}
+ public EncoderRepetitionCriteria GetEncoderRepetitionCriteria (bool inertial)
+ {
+ if (inertial)
+ return encoderRepetitionCriteriaInertial;
+ else
+ return encoderRepetitionCriteriaGravitatory;
+ }
//encoder other
public bool encoderPropulsive;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]