[chronojump] cairoBars implementation finished for jumpSimple (just TV or height)
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] cairoBars implementation finished for jumpSimple (just TV or height)
- Date: Tue, 31 Aug 2021 11:18:12 +0000 (UTC)
commit 5715de113fa8eb12661d00bbd1f2adeb6a83fea6
Author: Xavier de Blas <xaviblas gmail com>
Date: Tue Aug 31 13:17:51 2021 +0200
cairoBars implementation finished for jumpSimple (just TV or height)
src/gui/eventExecute.cs | 104 +++++++++++++++++++++++++++++++++++------------
src/gui/usefulObjects.cs | 18 ++++++--
2 files changed, 93 insertions(+), 29 deletions(-)
---
diff --git a/src/gui/eventExecute.cs b/src/gui/eventExecute.cs
index 4ba3af02a..251959acc 100644
--- a/src/gui/eventExecute.cs
+++ b/src/gui/eventExecute.cs
@@ -3488,10 +3488,6 @@ public class CairoPaintBarsPreJumpSimple : CairoPaintBarsPre
protected override void paintSpecific()
{
- List<PointF> pointA_l = new List<PointF>();
- List<PointF> pointB_l = new List<PointF>();
- List<string> names_l = new List<string>();
-
/*
* check if one bar has to be shown or two
* this is important when we are showing multitests
@@ -3510,9 +3506,56 @@ public class CairoPaintBarsPreJumpSimple : CairoPaintBarsPre
break;
}
+ CairoBars cbjt;
+ if(showBarA && showBarB) //Dja, Djna
+ cbjt = new CairoBars2HSeries (darea);
+ else if (showBarA) //takeOff, takeOffWeight
+ cbjt = new CairoBars1Series (darea);
+ else //rest of the jumps: sj, cmj, ..
+ cbjt = new CairoBars1Series (darea);
+
+ if(UseHeights) {
+ cbjt.YVariable = Catalog.GetString("Height");
+ cbjt.YUnits = "cm";
+ } else {
+ cbjt.YVariable = Catalog.GetString("Time");
+ cbjt.YUnits = "s";
+ }
+
+ cbjt.GraphInit(fontStr, ! ShowPersonNames); //usePersonGuides
+
+ List<Event> events = Jump.JumpListToEventList(eventGraphJumpsStored.jumpsAtSQL);
+
+ //find if there is a simulated
+ bool thereIsASimulated = false;
+ for(int i=0 ; i < eventGraphJumpsStored.jumpsAtSQL.Count; i++)
+ {
+ if(eventGraphJumpsStored.jumpsAtSQL[i].Simulated == -1)
+ thereIsASimulated = true;
+
+ if(! ShowPersonNames)
+ eventGraphJumpsStored.jumpsAtSQL[i].Description = ""; //to avoid showing
description
+ }
+
+ //manage bottom text font/spacing of rows
+ string longestWord = findLongestWordCairo (events,
+ eventGraphJumpsStored.type == "", "(" + Catalog.GetString("Simulated") +
")"); // condition for "all runs"
+ int fontHeightForBottomNames = cbjt.GetFontForBottomNames (events, longestWord);
+
+ int maxRowsForText = calculateMaxRowsForTextCairo (events, longestWord.Length,
+ eventGraphJumpsStored.type == "", false); //also adds +1 if simulated
+ int bottomMargin = cbjt.GetBottomMarginForText (maxRowsForText, fontHeightForBottomNames);
+
+
+ List<PointF> pointA_l = new List<PointF>();
+ List<PointF> pointB_l = new List<PointF>();
+ List<string> names_l = new List<string>();
+
int countToDraw = eventGraphJumpsStored.jumpsAtSQL.Count;
foreach(Jump jump in eventGraphJumpsStored.jumpsAtSQL)
{
+ LogB.Information("jump: " + jump.ToString());
+ // 1) Add data
double valueA = jump.Fall;
double valueB = Util.GetHeightInCentimeters(jump.Tv); //jump height
if(! UseHeights) {
@@ -3524,32 +3567,41 @@ public class CairoPaintBarsPreJumpSimple : CairoPaintBarsPre
pointB_l.Add(new PointF(countToDraw, valueB));
countToDraw --;
- names_l.Add(Catalog.GetString(jump.Type));
- }
+ // 2) Add bottom names
+ //names_l.Add(Catalog.GetString(jump.Type));
+ string typeRowString = "";
+ if (eventGraphJumpsStored.type == "") //if "all runs" show run.Type
+ typeRowString = jump.Type;
- CairoBars cbjt;
- if(showBarA && showBarB) //Dja, Djna
- cbjt = new CairoBars2HSeries (darea);
- else if (showBarA) //takeOff, takeOffWeight
- cbjt = new CairoBars1Series (darea);
- else //rest of the jumps: sj, cmj, ..
- cbjt = new CairoBars1Series (darea);
+ string timeString = "";
- if(UseHeights) {
- cbjt.YVariable = Catalog.GetString("Height");
- cbjt.YUnits = "cm";
- } else {
- cbjt.YVariable = Catalog.GetString("Time");
- cbjt.YUnits = "s";
+ names_l.Add(createTextBelowBar(
+ "",
+ typeRowString,
+ jump.Description,
+ thereIsASimulated, (jump.Simulated == -1),
+ longestWord.Length, maxRowsForText));
}
- cbjt.GraphInit(fontStr, ! ShowPersonNames); //usePersonGuides
+ cbjt.PassGuidesData (new CairoBarsGuideManage(
+ ! ShowPersonNames, //usePersonGuides
+ eventGraphJumpsStored.sessionMAXAtSQL,
+ eventGraphJumpsStored.sessionAVGAtSQL,
+ eventGraphJumpsStored.sessionMINAtSQL,
+ eventGraphJumpsStored.personMAXAtSQLAllSessions,
+ eventGraphJumpsStored.personMAXAtSQL,
+ eventGraphJumpsStored.personAVGAtSQL,
+ eventGraphJumpsStored.personMINAtSQL));
+
if(showBarA && showBarB) //Dja, Djna
- cbjt.GraphDo (pointA_l, pointB_l, names_l, 14, 0, title);
+ cbjt.GraphDo (pointA_l, pointB_l, names_l,
+ fontHeightForBottomNames, bottomMargin, title);
else if (showBarA) //takeOff, takeOffWeight
- cbjt.GraphDo (pointA_l, new List<PointF>(), names_l, 14, 0, title);
+ cbjt.GraphDo (pointA_l, new List<PointF>(), names_l,
+ fontHeightForBottomNames, bottomMargin, title);
else //rest of the jumps: sj, cmj, ..
- cbjt.GraphDo (pointB_l, new List<PointF>(), names_l, 14, 0, title);
+ cbjt.GraphDo (pointB_l, new List<PointF>(), names_l,
+ fontHeightForBottomNames, bottomMargin, title);
}
}
@@ -3584,9 +3636,9 @@ public class CairoPaintBarsPreRunSimple : CairoPaintBarsPre
cbjt.GraphInit(fontStr, ! ShowPersonNames); //usePersonGuides
- //TODO: add in parent class?
List<Event> events = Run.RunListToEventList(eventGraphRunsStored.runsAtSQL);
+ //find if there is a simulated
bool thereIsASimulated = false;
for(int i=0 ; i < eventGraphRunsStored.runsAtSQL.Count; i++)
{
@@ -3597,6 +3649,7 @@ public class CairoPaintBarsPreRunSimple : CairoPaintBarsPre
eventGraphRunsStored.runsAtSQL[i].Description = ""; //to avoid showing
description
}
+ //manage bottom text font/spacing of rows
string longestWord = findLongestWordCairo (events,
eventGraphRunsStored.type == "", "(" + Catalog.GetString("Simulated") + ")");
// condition for "all runs"
int fontHeightForBottomNames = cbjt.GetFontForBottomNames (events, longestWord);
@@ -3643,6 +3696,7 @@ public class CairoPaintBarsPreRunSimple : CairoPaintBarsPre
eventGraphRunsStored.personAVGAtSQL,
eventGraphRunsStored.personMINAtSQL));
- cbjt.GraphDo(point_l, new List<PointF>(), names_l, fontHeightForBottomNames, bottomMargin,
title);
+ cbjt.GraphDo(point_l, new List<PointF>(), names_l,
+ fontHeightForBottomNames, bottomMargin, title);
}
}
diff --git a/src/gui/usefulObjects.cs b/src/gui/usefulObjects.cs
index 299159228..7c7a2359a 100644
--- a/src/gui/usefulObjects.cs
+++ b/src/gui/usefulObjects.cs
@@ -70,6 +70,9 @@ public class PrepareEventGraphJumpSimple
public double personAVGAtSQL;
public double sessionAVGAtSQL;
+ public double personMINAtSQL;
+ public double sessionMINAtSQL;
+
//current data
public double tv;
public double tc;
@@ -121,11 +124,18 @@ public class PrepareEventGraphJumpSimple
}
personMAXAtSQLAllSessions = SqliteSession.SelectMAXEventsOfAType(true, -1, personID, table,
type, sqlSelect);
- personMAXAtSQL = SqliteSession.SelectMAXEventsOfAType(true, sessionID, personID, table, type,
sqlSelect);
- sessionMAXAtSQL = SqliteSession.SelectMAXEventsOfAType(true, sessionID, -1, table, type,
sqlSelect);
- personAVGAtSQL = SqliteSession.SelectAVGEventsOfAType(true, sessionID, personID, table, type,
sqlSelect);
- sessionAVGAtSQL = SqliteSession.SelectAVGEventsOfAType(true, sessionID, -1, table, type,
sqlSelect);
+ List<double> personStats = SqliteSession.Select_MAX_AVG_MIN_EventsOfAType(
+ true, sessionID, personID, table, type, sqlSelect);
+ personMAXAtSQL = personStats[0];
+ personAVGAtSQL = personStats[1];
+ personMINAtSQL = personStats[2];
+
+ List<double> sessionStats = SqliteSession.Select_MAX_AVG_MIN_EventsOfAType(
+ true, sessionID, -1, table, type, sqlSelect);
+ sessionMAXAtSQL = sessionStats[0];
+ sessionAVGAtSQL = sessionStats[1];
+ sessionMINAtSQL = sessionStats[2];
//end of select data from SQL to update graph
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]