[chronojump] JumpsRj capture tab has realtime capture bars, and session result bars
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] JumpsRj capture tab has realtime capture bars, and session result bars
- Date: Mon, 6 Sep 2021 16:05:11 +0000 (UTC)
commit 9432d0b25322a8a1cf6a98f23e9739c2225b2f39
Author: Xavier de Blas <xaviblas gmail com>
Date: Mon Sep 6 18:04:44 2021 +0200
JumpsRj capture tab has realtime capture bars, and session result bars
glade/app1.glade | 31 ++++++----
src/gui/app1/chronojump.cs | 10 ++-
src/gui/app1/jump.cs | 24 ++++++-
src/gui/eventExecute.cs | 151 ++++++++++++++++++++++++++++++++++++++++-----
src/jump.cs | 69 ++++++++++++++++++++-
5 files changed, 254 insertions(+), 31 deletions(-)
---
diff --git a/glade/app1.glade b/glade/app1.glade
index 2f2a8bf8d..28b60cc28 100644
--- a/glade/app1.glade
+++ b/glade/app1.glade
@@ -8023,7 +8023,6 @@ EncoderInertialCapture</property>
</child>
<child>
<widget class="GtkCheckButton"
id="check_run_simple_show_time">
- <property name="visible">True</property>
<property name="can_focus">True</property>
<property
name="receives_default">False</property>
<property name="draw_indicator">False</property>
@@ -24993,6 +24992,9 @@ Concentric</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
<property name="expand">False</property>
@@ -31304,6 +31306,18 @@ Concentric</property>
<property name="can_focus">False</property>
<property name="spacing">6</property>
<child>
+ <widget class="GtkLabel"
id="label_video_encoder_tests_will_be_filmed">
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Tests
will be filmed</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="pack_type">end</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
<widget class="GtkHBox"
id="hbox_video_encoder_capturing">
<property name="can_focus">False</property>
<property name="spacing">4</property>
@@ -31340,18 +31354,6 @@ Concentric</property>
</packing>
</child>
<child>
- <widget class="GtkLabel"
id="label_video_encoder_tests_will_be_filmed">
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Tests
will be filmed</property>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="pack_type">end</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
<widget class="GtkHBox"
id="hbox_video_encoder_no_capturing">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -40665,6 +40667,9 @@ then click this button.</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
<property name="expand">False</property>
diff --git a/src/gui/app1/chronojump.cs b/src/gui/app1/chronojump.cs
index 542ea591e..b49183e46 100644
--- a/src/gui/app1/chronojump.cs
+++ b/src/gui/app1/chronojump.cs
@@ -3550,7 +3550,8 @@ public partial class ChronoJumpWindow
event_execute_drawingarea_realtime_capture_cairo.Visible = true;
event_graph_label_graph_test.Visible = false;
- vbox_contacts_simple_graph_controls.Visible = false;
+ vbox_contacts_simple_graph_controls.Visible = true;
+ check_run_simple_show_time.Visible = false;
//align_check_vbox_contacts_graph_legend.Visible = false;
//vbox_contacts_graph_legend.Visible = false;
@@ -5194,6 +5195,9 @@ public partial class ChronoJumpWindow
//delete the temp tables if exists
Sqlite.DeleteTempEvents("tempJumpRj");
+ //Cairo graph is not updated if window is not resized, so force update
+ updateGraphJumpsReactive();
+
//stop camera (storing value or not)
if(currentEventExecute.Cancel || currentJumpRj == null) {
//webcamEndTwoCams (Constants.TestTypes.JUMP_RJ, -1);
@@ -6238,6 +6242,8 @@ LogB.Debug("mc finished 5");
else
pre_fillTreeView_jumps_rj(false);
+ updateGraphJumpsReactive();
+
if(createdStatsWin)
stats_win_fillTreeView_stats(false, false);
}
@@ -6574,6 +6580,8 @@ LogB.Debug("mc finished 5");
//there's no currentJumpRj (no one jumped), then it crashed,
//but don't need to update widgets
}
+
+ updateGraphJumpsReactive();
}
private void on_delete_selected_run_clicked (object o, EventArgs args) {
diff --git a/src/gui/app1/jump.cs b/src/gui/app1/jump.cs
index a65a5f55a..9888a4ade 100644
--- a/src/gui/app1/jump.cs
+++ b/src/gui/app1/jump.cs
@@ -304,6 +304,7 @@ public partial class ChronoJumpWindow
}
private void updateGraphJumpsSimple ()
{
+ LogB.Information("Called updateGraphJumpsSimple");
if(currentPerson == null || currentSession == null)
return;
@@ -352,6 +353,7 @@ public partial class ChronoJumpWindow
}
private void updateGraphJumpsReactive ()
{
+ LogB.Information("Called updateGraphJumpsReactive");
if(currentPerson == null || currentSession == null)
return;
@@ -370,7 +372,27 @@ public partial class ChronoJumpWindow
Constants.JumpRjTable, //tableName
currentJumpRjType.Name
);
- //TODO paint graph of num of reactive jumps
+
+ string typeTemp = currentEventType.Name;
+ if(radio_contacts_graph_allTests.Active)
+ typeTemp = "";
+
+ PrepareEventGraphJumpReactive eventGraph = new PrepareEventGraphJumpReactive(
+ currentSession.UniqueID, currentPerson.UniqueID,
+ radio_contacts_graph_allPersons.Active,
+ Convert.ToInt32(spin_contacts_graph_last_limit.Value),
+ typeTemp);
+
+ string personStr = "";
+ if(! radio_contacts_graph_allPersons.Active)
+ personStr = currentPerson.Name;
+
+ cairoPaintBarsPre = new CairoPaintBarsPreJumpReactive (
+ event_execute_drawingarea_cairo, preferences.fontType.ToString(),
current_mode,
+ personStr, typeTemp, preferences.digitsNumber);
+
+ cairoPaintBarsPre.StoreEventGraphJumpsRj (eventGraph);
+ PrepareJumpReactiveGraph (cairoPaintBarsPre.eventGraphJumpsRjStored, false);
}
private void extra_window_jumps_rj_initialize(JumpType myJumpType)
diff --git a/src/gui/eventExecute.cs b/src/gui/eventExecute.cs
index 0677daf1f..0b9fa6a9e 100644
--- a/src/gui/eventExecute.cs
+++ b/src/gui/eventExecute.cs
@@ -1,6 +1,4 @@
/*
-posar un graph de contacts capture (per jumpsRj, runsSimple, runsInterval), que estigui dalt, i separat dels
resultats per un panel.
-salts Rj graph de sessiĆ³ podria ser 2H (num salts, totalheight)
curses trams graph de sessiĆ³ podria ser 2H (totaltime, maxSpeed)
*/
@@ -167,7 +165,10 @@ public partial class ChronoJumpWindow
//PrepareEventGraphJumpSimple eventGraphJumpsCairoStored;
//PrepareEventGraphRunSimple eventGraphRunsCairoStored;
//string cairoTitleStored;
+
+ //we need both working to be able to correctly expose_event on jumpRj, runI
CairoPaintBarsPre cairoPaintBarsPre;
+ CairoPaintBarsPre cairoPaintBarsPreRealTime;
private void event_execute_initializeVariables (
@@ -299,7 +300,8 @@ public partial class ChronoJumpWindow
private void showJumpReactiveLabels()
{
event_graph_label_graph_test.Visible = false;
- vbox_contacts_simple_graph_controls.Visible = false;
+ vbox_contacts_simple_graph_controls.Visible = true;
+ check_run_simple_show_time.Visible = false;
// align_check_vbox_contacts_graph_legend.Visible = false;
// vbox_contacts_graph_legend.Visible = false;
@@ -528,7 +530,7 @@ public partial class ChronoJumpWindow
if(currentEventExecute == null ||
currentEventExecute.PrepareEventGraphJumpReactiveRealtimeCaptureObject == null)
return;
- PrepareJumpReactiveGraph(
+ PrepareJumpReactiveRealtimeCaptureGraph (
currentEventExecute.PrepareEventGraphJumpReactiveRealtimeCaptureObject.lastTv,
currentEventExecute.PrepareEventGraphJumpReactiveRealtimeCaptureObject.lastTc,
currentEventExecute.PrepareEventGraphJumpReactiveRealtimeCaptureObject.tvString,
@@ -541,21 +543,27 @@ public partial class ChronoJumpWindow
//barplot of tests in session
public void on_event_execute_drawingarea_cairo_expose_event(object o, ExposeEventArgs args)
{
+ LogB.Information("on_event_execute_drawingarea_cairo_expose_event A");
//right now only for jumps/runs simple
if(current_mode != Constants.Modes.JUMPSSIMPLE &&
-// current_mode != Constants.Modes.JUMPSREACTIVE &&
+ current_mode != Constants.Modes.JUMPSREACTIVE &&
current_mode != Constants.Modes.RUNSSIMPLE)
return;
+ LogB.Information("on_event_execute_drawingarea_cairo_expose_event B");
//if object not defined or not defined fo this mode, return
if(cairoPaintBarsPre == null || ! cairoPaintBarsPre.ModeMatches (current_mode))
return;
+ LogB.Information("on_event_execute_drawingarea_cairo_expose_event C");
//cairoPaintBarsPre.Prepare();
if(current_mode == Constants.Modes.JUMPSSIMPLE)
- PrepareJumpSimpleGraph(cairoPaintBarsPre.eventGraphJumpsStored, false);
+ PrepareJumpSimpleGraph (cairoPaintBarsPre.eventGraphJumpsStored, false);
+ else if(current_mode == Constants.Modes.JUMPSREACTIVE)
+ PrepareJumpReactiveGraph (cairoPaintBarsPre.eventGraphJumpsRjStored, false);
else if (current_mode == Constants.Modes.RUNSSIMPLE)
- PrepareRunSimpleGraph(cairoPaintBarsPre.eventGraphRunsStored, false);
+ PrepareRunSimpleGraph (cairoPaintBarsPre.eventGraphRunsStored, false);
+ LogB.Information("on_event_execute_drawingarea_cairo_expose_event D");
}
@@ -681,19 +689,30 @@ public partial class ChronoJumpWindow
*/
}
+ public void PrepareJumpReactiveGraph (PrepareEventGraphJumpReactive eventGraph, bool animate)
+ {
+ // Paint cairo graph
+ cairoPaintBarsPre.ShowPersonNames = radio_contacts_graph_allPersons.Active;
+ //cairoPaintBarsPre.UseHeights = useHeights;
+
+ cairoPaintBarsPre.Paint();
+ }
+
// Reactive jump
- public void PrepareJumpReactiveGraph(double lastTv, double lastTc, string tvString, string tcString,
string type,
+ public void PrepareJumpReactiveRealtimeCaptureGraph (double lastTv, double lastTc, string tvString,
string tcString, string type,
bool volumeOn, Preferences.GstreamerTypes gstreamer, RepetitiveConditionsWindow
repetitiveConditionsWin)
{
- cairoPaintBarsPre = new CairoPaintBarsPreJumpReactiveCapture(
+ LogB.Information("PrepareJumpReactiveRealtimeCaptureGraph 0");
+ cairoPaintBarsPreRealTime = new CairoPaintBarsPreJumpReactiveRealtimeCapture(
event_execute_drawingarea_realtime_capture_cairo,
preferences.fontType.ToString(), current_mode,
currentPerson.Name, type, preferences.digitsNumber,//
preferences.heightPreferred,
lastTv, lastTc, tvString, tcString);
// B) Paint cairo graph
- //cairoPaintBarsPre.UseHeights = useHeights;
+ //cairoPaintBarsPreRealTime.UseHeights = useHeights;
- cairoPaintBarsPre.Paint();
+ cairoPaintBarsPreRealTime.Paint();
+ LogB.Information("PrepareJumpReactiveRealtimeCaptureGraph 1");
}
//identify which subjump is the best or the worst in tv/tc index
@@ -2111,6 +2130,8 @@ public partial class ChronoJumpWindow
{
if(current_mode == Constants.Modes.JUMPSSIMPLE)
updateGraphJumpsSimple ();
+ else if(current_mode == Constants.Modes.JUMPSREACTIVE)
+ updateGraphJumpsReactive ();
else if(current_mode == Constants.Modes.RUNSSIMPLE)
updateGraphRunsSimple ();
}
@@ -2124,6 +2145,7 @@ public partial class ChronoJumpWindow
}
else if(current_mode == Constants.Modes.JUMPSREACTIVE)
{
+ updateGraphJumpsReactive ();
pre_fillTreeView_jumps_rj(false);
}
else if(current_mode == Constants.Modes.RUNSSIMPLE)
@@ -2141,6 +2163,8 @@ public partial class ChronoJumpWindow
{
if(current_mode == Constants.Modes.JUMPSSIMPLE)
updateGraphJumpsSimple ();
+ else if(current_mode == Constants.Modes.JUMPSREACTIVE)
+ updateGraphJumpsReactive ();
else if(current_mode == Constants.Modes.RUNSSIMPLE)
updateGraphRunsSimple ();
}
@@ -2164,7 +2188,7 @@ public partial class ChronoJumpWindow
if(thisJumpIsSimple)
PrepareJumpSimpleGraph(currentEventExecute.PrepareEventGraphJumpSimpleObject, animate);
else {
- PrepareJumpReactiveGraph(
+ PrepareJumpReactiveRealtimeCaptureGraph(
currentEventExecute.PrepareEventGraphJumpReactiveRealtimeCaptureObject.lastTv,
currentEventExecute.PrepareEventGraphJumpReactiveRealtimeCaptureObject.lastTc,
currentEventExecute.PrepareEventGraphJumpReactiveRealtimeCaptureObject.tvString,
@@ -2435,6 +2459,9 @@ public abstract class CairoPaintBarsPre
public PrepareEventGraphJumpSimple eventGraphJumpsStored;
public bool UseHeights;
+ //jump reactive
+ public PrepareEventGraphJumpReactive eventGraphJumpsRjStored;
+
//run simple
public PrepareEventGraphRunSimple eventGraphRunsStored;
public bool RunsShowTime;
@@ -2462,6 +2489,9 @@ public abstract class CairoPaintBarsPre
public virtual void StoreEventGraphJumps (PrepareEventGraphJumpSimple eventGraph)
{
}
+ public virtual void StoreEventGraphJumpsRj (PrepareEventGraphJumpReactive eventGraph)
+ {
+ }
public virtual void StoreEventGraphRuns (PrepareEventGraphRunSimple eventGraph)
{
}
@@ -2897,6 +2927,97 @@ public class CairoPaintBarsPreJumpSimple : CairoPaintBarsPre
}
}
+public class CairoPaintBarsPreJumpReactive : CairoPaintBarsPre
+{
+ public CairoPaintBarsPreJumpReactive (DrawingArea darea, string fontStr, Constants.Modes mode, string
personName, string testName, int pDN)
+ {
+ initialize (darea, fontStr, mode, generateTitle(personName, testName), pDN);
+ }
+
+ public override void StoreEventGraphJumpsRj (PrepareEventGraphJumpReactive eventGraph)
+ {
+ this.eventGraphJumpsRjStored = eventGraph;
+ }
+
+ protected override bool storeCreated ()
+ {
+ return (eventGraphJumpsRjStored != null);
+ }
+
+ protected override bool haveDataToPlot()
+ {
+ return (eventGraphJumpsRjStored.jumpsAtSQL.Count > 0);
+ }
+
+ protected override void paintSpecific()
+ {
+ CairoBars cb = new CairoBars2HSeries (darea);
+
+ cb.YVariable = Catalog.GetString("Time");
+ cb.YUnits = "s";
+ cb.VariableSerieA = Catalog.GetString("Contact time") + " (" + Catalog.GetString("total") +
") ";
+ cb.VariableSerieB = Catalog.GetString("Flight time") + " (" + Catalog.GetString("total") + ")
";
+
+ cb.GraphInit(fontStr, ! ShowPersonNames, true); //usePersonGuides, useGroupGuides
+
+ List<Event> events = JumpRj.JumpListToEventList(eventGraphJumpsRjStored.jumpsAtSQL);
+
+ //find if there is a simulated
+ bool thereIsASimulated = false;
+ for(int i=0 ; i < eventGraphJumpsRjStored.jumpsAtSQL.Count; i++)
+ {
+ if(eventGraphJumpsRjStored.jumpsAtSQL[i].Simulated == -1)
+ thereIsASimulated = true;
+
+ if(! ShowPersonNames)
+ eventGraphJumpsRjStored.jumpsAtSQL[i].Description = ""; //to avoid showing
description
+ }
+
+ //manage bottom text font/spacing of rows
+ string longestWord = findLongestWordCairo (events,
+ eventGraphJumpsRjStored.type == "", "(" + Catalog.GetString("Simulated") +
")"); // condition for "all runs"
+ int fontHeightForBottomNames = cb.GetFontForBottomNames (events, longestWord);
+
+ int maxRowsForText = calculateMaxRowsForTextCairo (events, longestWord.Length,
+ eventGraphJumpsRjStored.type == "", false); //also adds +1 if simulated
+ int bottomMargin = cb.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 = eventGraphJumpsRjStored.jumpsAtSQL.Count;
+ foreach(JumpRj jump in eventGraphJumpsRjStored.jumpsAtSQL)
+ {
+ LogB.Information("jump: " + jump.ToString());
+ // 1) Add data
+ double valueA = jump.TcSum;
+ double valueB = jump.TvSum;
+
+ pointA_l.Add(new PointF(countToDraw, valueA));
+ pointB_l.Add(new PointF(countToDraw, valueB));
+ countToDraw --;
+
+ // 2) Add bottom names
+ //names_l.Add(Catalog.GetString(jump.Type));
+ string typeRowString = "";
+ if (eventGraphJumpsRjStored.type == "") //if "all runs" show run.Type
+ typeRowString = jump.Type;
+
+ names_l.Add(createTextBelowBar(
+ "",
+ typeRowString,
+ jump.Description,
+ thereIsASimulated, (jump.Simulated == -1),
+ longestWord.Length, maxRowsForText));
+ }
+
+ cb.GraphDo (pointA_l, pointB_l, names_l,
+ fontHeightForBottomNames, bottomMargin, title);
+ }
+}
+
public class CairoPaintBarsPreRunSimple : CairoPaintBarsPre
{
public CairoPaintBarsPreRunSimple (DrawingArea darea, string fontStr, Constants.Modes mode, string
personName, string testName, int pDN)
@@ -2994,18 +3115,18 @@ public class CairoPaintBarsPreRunSimple : CairoPaintBarsPre
}
//realtime jump reactive capture
-public class CairoPaintBarsPreJumpReactiveCapture : CairoPaintBarsPre
+public class CairoPaintBarsPreJumpReactiveRealtimeCapture : CairoPaintBarsPre
{
private double lastTv;
private double lastTc;
private List<double> tv_l;
private List<double> tc_l;
- public CairoPaintBarsPreJumpReactiveCapture (DrawingArea darea, string fontStr,
+ public CairoPaintBarsPreJumpReactiveRealtimeCapture (DrawingArea darea, string fontStr,
Constants.Modes mode, string personName, string testName, int pDN,// bool
heightPreferred,
double lastTv, double lastTc, string tvString, string tcString)
{
- initialize (darea, fontStr, mode, generateTitle(personName, testName), pDN);
+ initialize (darea, fontStr, mode, Catalog.GetString("Last test:") + " " +
generateTitle(personName, testName), pDN);
this.lastTv = lastTv;
this.lastTc = lastTc;
diff --git a/src/jump.cs b/src/jump.cs
index 609b7b347..b0a39f1f2 100644
--- a/src/jump.cs
+++ b/src/jump.cs
@@ -245,8 +245,15 @@ public class JumpRj : Jump
calculatedStats = false;
}
-
+ public static List<Event> JumpListToEventList(List<JumpRj> jumps)
+ {
+ List<Event> events = new List<Event>();
+ foreach(JumpRj jump in jumps)
+ events.Add((Event) jump);
+
+ return events;
+ }
public override int InsertAtDB (bool dbconOpened, string tableName) {
return SqliteJumpRj.Insert(dbconOpened, tableName,
@@ -349,6 +356,33 @@ public class JumpRj : Jump
}
}
+ private List<double> tvList
+ {
+ get {
+ List<double> l = new List<double>();
+ string [] strFull = TvString.Split(new char[] {'='});
+ foreach(string str in strFull)
+ {
+ if(Util.IsNumber(Util.ChangeDecimalSeparator(str), true))
+ l.Add(Convert.ToDouble(Util.ChangeDecimalSeparator(str)));
+ }
+ return l;
+ }
+ }
+ private List<double> tcList
+ {
+ get {
+ List<double> l = new List<double>();
+ string [] strFull = TcString.Split(new char[] {'='});
+ foreach(string str in strFull)
+ {
+ if(Util.IsNumber(Util.ChangeDecimalSeparator(str), true))
+ l.Add(Convert.ToDouble(Util.ChangeDecimalSeparator(str)));
+ }
+ return l;
+ }
+ }
+
public List<double> HeightList
{
get {
@@ -363,6 +397,39 @@ public class JumpRj : Jump
}
}
+ public double HeightTotal
+ {
+ get {
+ double total = 0;
+ foreach(double h in HeightList)
+ total += h;
+
+ return total;
+ }
+ }
+
+ public double TvSum
+ {
+ get {
+ double total = 0;
+ foreach(double d in tvList)
+ total += d;
+
+ return total;
+ }
+ }
+ public double TcSum
+ {
+ get {
+ double total = 0;
+ foreach(double d in tcList)
+ total += d;
+
+ return total;
+ }
+ }
+
+
public List<double> RSIList
{
get {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]