[chronojump] RunInterval: Wichro photocell previous to biggest contact is displayed on cairo barchart
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] RunInterval: Wichro photocell previous to biggest contact is displayed on cairo barchart
- Date: Thu, 14 Apr 2022 10:57:11 +0000 (UTC)
commit ce28c0f0c9841f271617e15863a2f0e1cf0f66e0
Author: Xavier de Blas <xaviblas gmail com>
Date: Thu Apr 14 12:56:09 2022 +0200
RunInterval: Wichro photocell previous to biggest contact is displayed on cairo barchart
src/execute/run.cs | 21 +++++++++++++++++----
src/gui/app1/chronojump.cs | 2 +-
src/gui/cairo/bars.cs | 15 +++++++++++++++
src/gui/eventExecute.cs | 17 +++++++++++++----
src/gui/usefulObjects.cs | 5 ++++-
5 files changed, 50 insertions(+), 10 deletions(-)
---
diff --git a/src/execute/run.cs b/src/execute/run.cs
index 857c9007a..59fd056c6 100644
--- a/src/execute/run.cs
+++ b/src/execute/run.cs
@@ -72,6 +72,7 @@ public class RunExecute : EventExecute
protected static RunChangeImage runChangeImage;
protected static bool success;
protected RunExecuteInspector.Types runEIType;
+ protected static List<int> photocell_l; //for Wichro
protected Gtk.Image image_run_execute_running;
protected Gtk.Image image_run_execute_photocell_icon;
@@ -141,6 +142,7 @@ public class RunExecute : EventExecute
needCallTrackDone = false;
needCheckIfTrackEnded = false;
runEIType = RunExecuteInspector.Types.RUN_SIMPLE;
+ photocell_l = new List<int>();
//initialize eventDone as a Run
eventDone = new Run();
@@ -349,7 +351,14 @@ LogB.Information("going to call photocellWirelessCapture.CaptureStart ()");
LogB.Information("waitEvent 3");
PhotocellWirelessEvent pwe =
photocellWirelessCapture.PhotocellWirelessCaptureReadNext();
LogB.Information("wait_event pwe: " + pwe.ToString());
+
photocell = pwe.photocell;
+
+ //to debug photocell assignement on Wichro.
+ Random randDelete = new Random();
+ photocell = randDelete.Next(0,10);
+
+
timestamp = pwe.timeMs - timestampAccumulated; //photocell does not
send splittime, sends absolute time
timestampAccumulated += timestamp;
@@ -691,7 +700,9 @@ LogB.Information("going to call photocellWirelessCapture.CaptureStart ()");
}
trackTime = runDC.GetTrackTimeInSecondsAndUpdateStartPos(); //will come in seconds
- LogB.Information("WWWWW photocell is: " + runDC.GetPhotocellAtStartPos());
+ LogB.Information("Wichro photocell is: " + runDC.GetPhotocellAtStartPos());
+ photocell_l.Add(runDC.GetPhotocellAtStartPos());
+
runDC.FirstTrackDone = true;
}
else {
@@ -843,7 +854,7 @@ LogB.Information("going to call photocellWirelessCapture.CaptureStart ()");
!startIn, //initialSpeed true if not startIn
datetime
);
-
+
//define the created object
eventDone = new Run(uniqueID, personID, sessionID, type, distance, trackTime, description,
Util.BoolToNegativeInt(simulated), !startIn, datetime);
@@ -1009,6 +1020,8 @@ public class RunIntervalExecute : RunExecute
//countForSavingTempTable = 0;
finishByTimeReturnedTrueAtThisCapture = false;
+ photocell_l = new List<int>();
+
//initialize eventDone as a RunInterval
eventDone = new RunInterval();
}
@@ -1133,7 +1146,7 @@ public class RunIntervalExecute : RunExecute
//update graph
PrepareEventGraphRunIntervalRealtimeCaptureObject = new
PrepareEventGraphRunIntervalRealtimeCapture (
type, distanceIntervalFixed, trackTime, intervalTimesString,
- distanceTotal, distancesString, startIn, success);
+ distanceTotal, distancesString, photocell_l, startIn, success);
needUpdateGraphType = eventType.RUNINTERVAL;
needUpdateGraph = true;
@@ -1376,7 +1389,7 @@ public class RunIntervalExecute : RunExecute
PrepareEventGraphRunIntervalRealtimeCaptureObject = new
PrepareEventGraphRunIntervalRealtimeCapture (
type, distanceIntervalFixed, trackTime, intervalTimesString,
- distanceTotal, distancesString, startIn, true);
+ distanceTotal, distancesString, photocell_l, startIn, true);
needUpdateGraphType = eventType.RUNINTERVAL;
needUpdateGraph = true;
diff --git a/src/gui/app1/chronojump.cs b/src/gui/app1/chronojump.cs
index 0cdddc073..4f874035f 100644
--- a/src/gui/app1/chronojump.cs
+++ b/src/gui/app1/chronojump.cs
@@ -1897,11 +1897,11 @@ public partial class ChronoJumpWindow
}
blankRunIntervalRealtimeCaptureGraph ();
- //PrepareRunIntervalRealtimeCaptureGraph (double distance, double lastTime, string
timesString, double distanceTotal, string distancesString, string type)
PrepareRunIntervalRealtimeCaptureGraph (
selectedRunInterval.DistanceTotal, //TODO: take care, maybe is not this
distance (maybe use selectedRunIntervalType)
selectedRunInterval.TimeLast, selectedRunInterval.IntervalTimesString,
selectedRunInterval.DistanceTotal, selectedRunIntervalType.DistancesString,
+ new List<int>(), //photocell_l (only at realtime graph)
selectedRunInterval.Type, selectedRunInterval.Description); //Description is
personName
}
diff --git a/src/gui/cairo/bars.cs b/src/gui/cairo/bars.cs
index f3ed143c0..6f3316476 100644
--- a/src/gui/cairo/bars.cs
+++ b/src/gui/cairo/bars.cs
@@ -94,6 +94,7 @@ public abstract class CairoBars : CairoGeneric
protected string yVariable = "Height";
protected string xUnits = "";
protected string yUnits = "cm";
+ protected List<int> inBarNums_l; //used on Wichro to identify photocells
//used when there are two series (for legend)
protected string variableSerieA = "";
@@ -111,6 +112,7 @@ public abstract class CairoBars : CairoGeneric
initGraph(font, 1); //.8 if writeTextAtRight
barsXCenter_l = new List<double>();
resultOnBars_l = new List<Point3F>();
+ inBarNums_l = new List<int>();
encoderTitle = false;
}
@@ -1036,6 +1038,10 @@ public abstract class CairoBars : CairoGeneric
set { yUnits = value; }
}
+ public List<int> InBarNums_l {
+ set { inBarNums_l = value; }
+ }
+
//for CairoBarsNHSeries (legend)
public string VariableSerieA {
set { variableSerieA = value; }
@@ -1173,6 +1179,11 @@ public class CairoBars1Series : CairoBars
resultFontHeight = getBarsResultFontHeight (barWidth*1.20); //*1.2 because there is space at
left and right
LogB.Information("resultFontHeight: " + resultFontHeight.ToString());
+ //debug
+ LogB.Information("inBarNums_l:");
+ for(int j=0; j < inBarNums_l.Count; j ++)
+ LogB.Information(inBarNums_l[j].ToString());
+
for(int i = 0; i < barMain_l.Count; i ++)
{
PointF p = barMain_l[i];
@@ -1192,6 +1203,10 @@ public class CairoBars1Series : CairoBars
resultOnBars_l.Add(new Point3F(x + barWidth/2, y, p.Y));
mouseLimits.AddInPos (i, x, x+barWidth);
+ if (inBarNums_l.Count > 0 && inBarNums_l.Count > i)
+ printTextInBar(x +barWidth/2, graphHeight -bottomMargin -10,
+ 0, textHeight+2, inBarNums_l[i].ToString(), g, true);
+
//print the type at bottom
//printTextMultiline (x + barWidth/2, graphHeight -bottomMargin +
fontHeightForBottomNames/2, 0, fontHeightForBottomNames,
printTextMultiline (x + barWidth/2,
diff --git a/src/gui/eventExecute.cs b/src/gui/eventExecute.cs
index 19cf2d784..057d1287e 100644
--- a/src/gui/eventExecute.cs
+++ b/src/gui/eventExecute.cs
@@ -518,6 +518,7 @@ public partial class ChronoJumpWindow
currentEventExecute.PrepareEventGraphRunIntervalRealtimeCaptureObject.timesString,
currentEventExecute.PrepareEventGraphRunIntervalRealtimeCaptureObject.distanceTotal,
currentEventExecute.PrepareEventGraphRunIntervalRealtimeCaptureObject.distancesString,
+
currentEventExecute.PrepareEventGraphRunIntervalRealtimeCaptureObject.photocell_l,
currentEventExecute.PrepareEventGraphRunIntervalRealtimeCaptureObject.type,
currentPerson.Name);
}
@@ -526,6 +527,8 @@ public partial class ChronoJumpWindow
selectedRunInterval.DistanceTotal, //TODO: take care, maybe
is not this distance (maybe use selectedRunIntervalType)
selectedRunInterval.TimeLast,
selectedRunInterval.IntervalTimesString,
selectedRunInterval.DistanceTotal,
selectedRunIntervalType.DistancesString,
+ new List<int>(), //photocell_l (only at realtime graph)
+ //new List<int> {2,2,3,4}, //photocell_l (only at realtime
graph)
selectedRunInterval.Type, selectedRunInterval.Description);
//Description is person.Name
}
}
@@ -799,7 +802,7 @@ public partial class ChronoJumpWindow
}
public void PrepareRunIntervalRealtimeCaptureGraph (double lastDistance, double lastTime, string
timesString, double distanceTotal,
- string distancesString, string type, string personName)
+ string distancesString, List<int> photocell_l, string type, string personName)
{
if(currentPerson == null)
return;
@@ -816,7 +819,7 @@ public partial class ChronoJumpWindow
personName, type, preferences.digitsNumber,// preferences.heightPreferred,
check_runI_realtime_rel_abs.Active, lastDistance,
//lastTime,
- timesString, distancesString, isLastCaptured);
+ timesString, distancesString, photocell_l, isLastCaptured);
// B) Paint cairo graph
//cairoPaintBarsPreRealTime.UseHeights = useHeights;
@@ -1870,7 +1873,7 @@ public partial class ChronoJumpWindow
break;
case EventType.Types.RUN:
if(thisRunIsSimple)
-
PrepareRunSimpleGraph(currentEventExecute.PrepareEventGraphRunSimpleObject, animate);
+
PrepareRunSimpleGraph(currentEventExecute.PrepareEventGraphRunSimpleObject, animate); //add here the
photocells string on wichro (-1 strings on ! wichro)
else {
/*
bool volumeOnHere = preferences.volumeOn;
@@ -1885,6 +1888,7 @@ public partial class ChronoJumpWindow
currentEventExecute.PrepareEventGraphRunIntervalRealtimeCaptureObject.timesString,
currentEventExecute.PrepareEventGraphRunIntervalRealtimeCaptureObject.distanceTotal,
currentEventExecute.PrepareEventGraphRunIntervalRealtimeCaptureObject.distancesString,
+
currentEventExecute.PrepareEventGraphRunIntervalRealtimeCaptureObject.photocell_l,
currentEventExecute.PrepareEventGraphRunIntervalRealtimeCaptureObject.type,
currentPerson.Name);
}
@@ -3151,6 +3155,7 @@ public class CairoPaintBarsPreRunIntervalRealtimeCapture : CairoPaintBarsPre
private List<double> distance_l;
private List<double> time_l;
private List<double> speed_l;
+ private List<int> photocell_l;
//just blank the screen
public CairoPaintBarsPreRunIntervalRealtimeCapture (DrawingArea darea, string fontStr)
@@ -3162,7 +3167,8 @@ public class CairoPaintBarsPreRunIntervalRealtimeCapture : CairoPaintBarsPre
Constants.Modes mode, string personName, string testName, int pDN,// bool
heightPreferred,
bool isRelative,
double lastDistance,
- string timesString, string distancesString, bool isLastCaptured)
+ string timesString, string distancesString,
+ List<int> photocell_l, bool isLastCaptured)
{
initialize (darea, fontStr, mode, personName, testName, pDN);
if(isLastCaptured)
@@ -3175,6 +3181,7 @@ public class CairoPaintBarsPreRunIntervalRealtimeCapture : CairoPaintBarsPre
distance_l = new List<double>();
time_l = new List<double>();
speed_l = new List<double>();
+ this.photocell_l = photocell_l;
string [] timeFull = timesString.Split(new char[] {'='});
int count = 0;
@@ -3305,6 +3312,8 @@ public class CairoPaintBarsPreRunIntervalRealtimeCapture : CairoPaintBarsPre
max,
sum / speed_l.Count,
min));
+ if(photocell_l.Count > 0)
+ cb.InBarNums_l = photocell_l;
cb.PassData1Serie (point_l,
new List<Cairo.Color>(), names_l,
diff --git a/src/gui/usefulObjects.cs b/src/gui/usefulObjects.cs
index 63b822e31..46aa4b438 100644
--- a/src/gui/usefulObjects.cs
+++ b/src/gui/usefulObjects.cs
@@ -363,6 +363,7 @@ public class PrepareEventGraphRunIntervalRealtimeCapture
public string timesString;
public double distanceTotal; //we pass this because it's dificult to calculate in runs with variable
distances
public string distancesString; //we pass this because it's dificult to calculate in runs with
variable distances
+ public List<int> photocell_l; //for Wichro
public bool startIn;
public bool finished;
@@ -370,7 +371,8 @@ public class PrepareEventGraphRunIntervalRealtimeCapture
}
public PrepareEventGraphRunIntervalRealtimeCapture (string type, double distance, double lastTime,
string timesString,
- double distanceTotal, string distancesString, bool startIn, bool finished)
+ double distanceTotal, string distancesString, List<int> photocell_l,
+ bool startIn, bool finished)
{
this.type = type;
this.distance = distance;
@@ -378,6 +380,7 @@ public class PrepareEventGraphRunIntervalRealtimeCapture
this.timesString = timesString;
this.distanceTotal = distanceTotal;
this.distancesString = distancesString;
+ this.photocell_l = photocell_l;
this.startIn = startIn;
this.finished = finished;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]