[chronojump] jumpsAsymmetry graph manages errors of same jump or need data
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] jumpsAsymmetry graph manages errors of same jump or need data
- Date: Tue, 27 Sep 2022 12:13:20 +0000 (UTC)
commit bc9a8a5793c5d76c1d1820687e584cba949ad974
Author: Xavier de Blas <xaviblas gmail com>
Date: Tue Sep 27 14:12:41 2022 +0200
jumpsAsymmetry graph manages errors of same jump or need data
src/constants.cs | 6 +++++-
src/gui/app1/jumpsAsymmetry.cs | 34 ++++++++++++++++++++++++----------
src/gui/cairo/jumpsRunsEvolution.cs | 14 ++++++++++----
src/gui/cairo/xy.cs | 1 +
4 files changed, 40 insertions(+), 15 deletions(-)
---
diff --git a/src/constants.cs b/src/constants.cs
index e8dcdf6f4..9daca5309 100644
--- a/src/constants.cs
+++ b/src/constants.cs
@@ -879,7 +879,11 @@ public class Constants
"Creating encoder widgets", //9
"Starting main window", //10
};
-
+
+ public static string NotEnoughDataStr ()
+ {
+ return Catalog.GetString ("Not enough data.");
+ }
public static string DatabaseNotFoundStr()
{
return Catalog.GetString("Error. Cannot find database.");
diff --git a/src/gui/app1/jumpsAsymmetry.cs b/src/gui/app1/jumpsAsymmetry.cs
index 64ae71729..73508a88b 100644
--- a/src/gui/app1/jumpsAsymmetry.cs
+++ b/src/gui/app1/jumpsAsymmetry.cs
@@ -129,21 +129,25 @@ public partial class ChronoJumpWindow
calculateData = true;
}
+ string jumpBilateral = UtilGtk.ComboGetActive (combo_select_jumps_asymmetry_bilateral);
+ string jumpAsymmetry1 = UtilGtk.ComboGetActive (combo_select_jumps_asymmetry_1);
+ string jumpAsymmetry2 = UtilGtk.ComboGetActive (combo_select_jumps_asymmetry_2);
+
if(calculateData)
jumpsAsymmetry.Calculate (
currentPerson.UniqueID, currentSession.UniqueID,
radio_jumps_asymmetry_bilateral.Active,
//TODO: max/avg
- UtilGtk.ComboGetActive (combo_select_jumps_asymmetry_bilateral),
- UtilGtk.ComboGetActive (combo_select_jumps_asymmetry_1),
- UtilGtk.ComboGetActive (combo_select_jumps_asymmetry_2)
+ jumpBilateral,
+ jumpAsymmetry1,
+ jumpAsymmetry2
);
string index = Catalog.GetString ("Bilateral deficit");
string formula = string.Format ("{0} - ({1} + {2})",
- UtilGtk.ComboGetActive (combo_select_jumps_asymmetry_bilateral),
- UtilGtk.ComboGetActive (combo_select_jumps_asymmetry_1),
- UtilGtk.ComboGetActive (combo_select_jumps_asymmetry_2));
+ jumpBilateral,
+ jumpAsymmetry1,
+ jumpAsymmetry2);
if (radio_jumps_asymmetry_asymmetry.Active)
{
@@ -152,8 +156,8 @@ public partial class ChronoJumpWindow
string lowerTranslated = Catalog.GetString ("lower");
formula = Catalog.GetString ("Find daily higher of jumps:") + "\n" +
string.Format ("{0}, {1}",
- UtilGtk.ComboGetActive (combo_select_jumps_asymmetry_1),
- UtilGtk.ComboGetActive (combo_select_jumps_asymmetry_2)) +
"\n" +
+ jumpAsymmetry1,
+ jumpAsymmetry2) + "\n" +
string.Format ("100 * ({0} - {1}) / {0}",
higherTranslated, lowerTranslated);
}
@@ -165,9 +169,19 @@ public partial class ChronoJumpWindow
//constructor for showing blank screen with a message
CairoBars cb = new CairoBars1Series (drawingarea_jumps_asymmetry,
CairoBars.Type.NORMAL, preferences.fontType.ToString(), "Need more data"); //TODO: change message
} else {
+
+ JumpsAsymmetryGraph.Error error = JumpsAsymmetryGraph.Error.NEEDJUMP;
+
+ if (radio_jumps_asymmetry_bilateral.Active &&
+ (jumpBilateral == jumpAsymmetry1 ||
+ jumpBilateral == jumpAsymmetry2 ||
+ jumpAsymmetry1 == jumpAsymmetry2))
+ error = JumpsAsymmetryGraph.Error.REPEATEDJUMPS;
+ else if (jumpAsymmetry1 == jumpAsymmetry2)
+ error = JumpsAsymmetryGraph.Error.REPEATEDJUMPS;
+
new JumpsAsymmetryGraph (drawingarea_jumps_asymmetry,
- //JumpsEvolutionGraph.Error.NEEDJUMP,
- index, preferences.fontType.ToString());
+ error, index, preferences.fontType.ToString());
}
button_jumps_asymmetry_save_image.Sensitive = false;
diff --git a/src/gui/cairo/jumpsRunsEvolution.cs b/src/gui/cairo/jumpsRunsEvolution.cs
index 9ae9a0a87..63cae6fd0 100644
--- a/src/gui/cairo/jumpsRunsEvolution.cs
+++ b/src/gui/cairo/jumpsRunsEvolution.cs
@@ -244,12 +244,14 @@ public class RunsEvolutionGraph : EvolutionGraph
public class JumpsAsymmetryGraph : EvolutionGraph //to inherit paintGridDatetime()
{
+ public enum Error { NEEDJUMP, REPEATEDJUMPS }
+
private string personName;
private string index;
private string formula;
//constructor when there are no points
- public JumpsAsymmetryGraph (DrawingArea area, string title, string font)
+ public JumpsAsymmetryGraph (DrawingArea area, Error error, string title, string font)
{
this.area = area;
this.title = "";
@@ -258,9 +260,13 @@ public class JumpsAsymmetryGraph : EvolutionGraph //to inherit paintGridDatetime
initGraph(font, .8);
g.SetFontSize(16);
- printText(area.Allocation.Width /2, area.Allocation.Height /2, 24, textHeight,
- needToExecuteJumpsStr //+ " " + jumpType + "."
- , g, alignTypes.CENTER);
+
+ if (error == Error.REPEATEDJUMPS)
+ printText(area.Allocation.Width /2, area.Allocation.Height /2, 24, textHeight,
+ repeatedJumpsStr, g, alignTypes.CENTER);
+ else
+ printText(area.Allocation.Width /2, area.Allocation.Height /2, 24, textHeight,
+ Constants.NotEnoughDataStr (), g, alignTypes.CENTER);
endGraphDisposing(g, surface, area.GdkWindow);
}
diff --git a/src/gui/cairo/xy.cs b/src/gui/cairo/xy.cs
index ef0d94354..1317f8ac4 100644
--- a/src/gui/cairo/xy.cs
+++ b/src/gui/cairo/xy.cs
@@ -89,6 +89,7 @@ public abstract class CairoXY : CairoGeneric
//but jumpsWeightFVProfile has many messages, so done also there, and also on radial
protected string needToExecuteJumpsStr = Catalog.GetString("Need to execute jumps:");
protected string needToExecuteRunsStr = Catalog.GetString("Need to execute races:");
+ protected string repeatedJumpsStr = Catalog.GetString("Jumps cannot be the same.");
protected string optimalFallHeightStr = Catalog.GetString("Optimal fall height");
protected string heightStr = Catalog.GetString("Height");
protected string extraWeightStr = Catalog.GetString("Extra weight");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]