[chronojump] CairoGraphRaceAnalyzer mainVariable (N, F, a) according to new RaceAnalyzer feedback tab (on feedback
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] CairoGraphRaceAnalyzer mainVariable (N, F, a) according to new RaceAnalyzer feedback tab (on feedback
- Date: Tue, 10 May 2022 15:23:05 +0000 (UTC)
commit 7431c5c8f4d1b8d2a7fcdb37fcb83445e26d3d50
Author: Xavier de Blas <xaviblas gmail com>
Date: Tue May 10 17:22:08 2022 +0200
CairoGraphRaceAnalyzer mainVariable (N,F,a) according to new RaceAnalyzer feedback tab (on feedback win)
glade/feedback.glade | 129 ++++++++++++++++++++++++++++++++++++++++++
src/constants.cs | 2 +-
src/gui/app1/chronojump.cs | 14 ++++-
src/gui/app1/runEncoder.cs | 18 ++++--
src/gui/cairo/raceAnalyzer.cs | 50 ++++++++++++----
src/gui/cairo/xy.cs | 1 +
src/gui/feedback.cs | 23 ++++++++
7 files changed, 219 insertions(+), 18 deletions(-)
---
diff --git a/glade/feedback.glade b/glade/feedback.glade
index d11645075..d3d17f136 100644
--- a/glade/feedback.glade
+++ b/glade/feedback.glade
@@ -5526,6 +5526,135 @@
<property name="type">tab</property>
</packing>
</child>
+ <child>
+ <widget class="GtkVBox" id="vbox_race_analyzer">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="border_width">14</property>
+ <child>
+ <widget class="GtkVBox" id="vbox22">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">12</property>
+ <child>
+ <widget class="GtkLabel" id="label77">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Main variable on speed/time
graph</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hbox60">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">25</property>
+ <child>
+ <widget class="GtkVSeparator" id="vseparator4">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkVBox" id="vbox23">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">12</property>
+ <child>
+ <widget class="GtkRadioButton" id="radio_run_encoder_power">
+ <property name="label" translatable="yes">Power</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkRadioButton" id="radio_run_encoder_force">
+ <property name="label" translatable="yes">Force</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">radio_run_encoder_power</property>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkRadioButton" id="radio_run_encoder_accel">
+ <property name="label" translatable="yes">Acceleration</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">radio_run_encoder_power</property>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">6</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label76">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label">raceAnalyzer</property>
+ </widget>
+ <packing>
+ <property name="position">6</property>
+ <property name="tab_fill">False</property>
+ <property name="type">tab</property>
+ </packing>
+ </child>
</widget>
</child>
</widget>
diff --git a/src/constants.cs b/src/constants.cs
index c45d875e7..0ae2e7973 100644
--- a/src/constants.cs
+++ b/src/constants.cs
@@ -1039,7 +1039,7 @@ public class Constants
}
public enum BellModes {
- JUMPS, RUNS, ENCODERGRAVITATORY, ENCODERINERTIAL, FORCESENSOR
+ JUMPS, RUNS, ENCODERGRAVITATORY, ENCODERINERTIAL, FORCESENSOR, RUNSENCODER
}
public enum Modes {
diff --git a/src/gui/app1/chronojump.cs b/src/gui/app1/chronojump.cs
index 8099e4389..8e6a743fc 100644
--- a/src/gui/app1/chronojump.cs
+++ b/src/gui/app1/chronojump.cs
@@ -689,6 +689,7 @@ public partial class ChronoJumpWindow
//to have objects ok to be able to be readed before viewing the feedbackWin
feedbackWin.View(Constants.BellModes.ENCODERGRAVITATORY, preferences, encoderRhythm, false);
//not viewWindow
feedbackWin.View(Constants.BellModes.FORCESENSOR, preferences, encoderRhythm, false); //not
viewWindow
+ feedbackWin.View(Constants.BellModes.RUNSENCODER, preferences, encoderRhythm, false); //not
viewWindow
feedbackWin.FakeButtonClose.Clicked += new EventHandler(on_feedback_closed);
on_extra_window_multichronopic_test_changed(new object(), new EventArgs());
@@ -3925,6 +3926,8 @@ public partial class ChronoJumpWindow
button_contacts_capture_load.Sensitive = myTreeViewPersons.IsThereAnyRecord();
button_contacts_capture_session_overview.Sensitive =
myTreeViewPersons.IsThereAnyRecord();
+ button_contacts_bells.Sensitive = true;
+
//notebook_capture_analyze.ShowTabs = false; //only capture tab is shown (only valid
for "OTHER" tests)
hbox_contacts_sup_capture_analyze_two_buttons.Visible = true;
alignment_button_threshold.Visible = false;
@@ -4836,6 +4839,8 @@ public partial class ChronoJumpWindow
return Constants.BellModes.ENCODERINERTIAL;
else if(m == Constants.Modes.FORCESENSOR)
return Constants.BellModes.FORCESENSOR;
+ else if(m == Constants.Modes.RUNSENCODER)
+ return Constants.BellModes.RUNSENCODER;
//default to JUMPSREACTIVE
return Constants.BellModes.JUMPS;
@@ -4846,7 +4851,8 @@ public partial class ChronoJumpWindow
Constants.Modes m = current_mode;
if(m != Constants.Modes.JUMPSREACTIVE &&
m != Constants.Modes.RUNSINTERVALLIC &&
- m != Constants.Modes.FORCESENSOR)
+ m != Constants.Modes.FORCESENSOR &&
+ m != Constants.Modes.RUNSENCODER)
return;
feedbackWin.View(getBellMode(m), preferences, encoderRhythm, true);
@@ -7978,6 +7984,12 @@ LogB.Debug("mc finished 5");
}
}
}
+ else if(m == Constants.Modes.RUNSENCODER)
+ {
+ updateRaceAnalyzerCapturePositionTime(true);
+ updateRaceAnalyzerCaptureSpeedTime(true);
+ updateRaceAnalyzerCaptureAccelTime(true);
+ }
}
private void on_radio_mode_contacts_capture_toggled (object o, EventArgs args)
diff --git a/src/gui/app1/runEncoder.cs b/src/gui/app1/runEncoder.cs
index 283cc632a..9897e4940 100644
--- a/src/gui/app1/runEncoder.cs
+++ b/src/gui/app1/runEncoder.cs
@@ -2312,12 +2312,14 @@ public partial class ChronoJumpWindow
reCGSD != null && reCGSD.SegmentCalcs != null)
segmentCalcs = reCGSD.SegmentCalcs;
- if(cairoGraphRaceAnalyzer_dt == null)
+ if(cairoGraphRaceAnalyzer_dt == null || forceRedraw)
cairoGraphRaceAnalyzer_dt = new CairoGraphRaceAnalyzer(
drawingarea_race_analyzer_capture_position_time, "title",
Catalog.GetString("Distance"), "m",
isSprint, false,
- segmentCalcs, false, true);
+ segmentCalcs,
+ false, feedbackWin.GetRunsEncoderMainVariable (),
+ true);
cairoGraphRaceAnalyzer_dt.DoSendingList (preferences.fontType.ToString(),
cairoGraphRaceAnalyzerPoints_dt_l, triggerListRunEncoder,
@@ -2335,12 +2337,14 @@ public partial class ChronoJumpWindow
reCGSD != null && reCGSD.SegmentCalcs != null)
segmentCalcs = reCGSD.SegmentCalcs;
- if(cairoGraphRaceAnalyzer_st == null)
+ if(cairoGraphRaceAnalyzer_st == null || forceRedraw)
cairoGraphRaceAnalyzer_st = new CairoGraphRaceAnalyzer(
drawingarea_race_analyzer_capture_speed_time, "title",
Catalog.GetString("Speed"), "m/s",
isSprint, true,
- segmentCalcs, true, false);
+ segmentCalcs,
+ true, feedbackWin.GetRunsEncoderMainVariable (),
+ false);
cairoGraphRaceAnalyzer_st.DoSendingList (preferences.fontType.ToString(),
cairoGraphRaceAnalyzerPoints_st_l, triggerListRunEncoder,
@@ -2361,12 +2365,14 @@ public partial class ChronoJumpWindow
reCGSD != null && reCGSD.SegmentCalcs != null)
segmentCalcs = reCGSD.SegmentCalcs;
- if(cairoGraphRaceAnalyzer_at == null)
+ if(cairoGraphRaceAnalyzer_at == null || forceRedraw)
cairoGraphRaceAnalyzer_at = new CairoGraphRaceAnalyzer(
drawingarea_race_analyzer_capture_accel_time, "title",
Catalog.GetString("Accel"), "m/s^2",
isSprint, false,
- segmentCalcs, false, false);
+ segmentCalcs,
+ false, feedbackWin.GetRunsEncoderMainVariable (),
+ false);
cairoGraphRaceAnalyzer_at.DoSendingList (preferences.fontType.ToString(),
cairoGraphRaceAnalyzerPoints_at_l, triggerListRunEncoder,
diff --git a/src/gui/cairo/raceAnalyzer.cs b/src/gui/cairo/raceAnalyzer.cs
index e65e27a42..4e4100a3f 100644
--- a/src/gui/cairo/raceAnalyzer.cs
+++ b/src/gui/cairo/raceAnalyzer.cs
@@ -31,7 +31,11 @@ public class CairoGraphRaceAnalyzer : CairoXY
private bool isSprint;
private bool plotMaxMark;
private RunEncoderSegmentCalcs segmentCalcs;
- private bool plotPowerBars;
+
+ //plotSegmentBars will plot power, force or accel according to mainVariable
+ private bool plotSegmentBars;
+ private FeedbackWindow.RunsEncoderMainVariableTypes mainVariable;
+
private bool useListOfDoublesOnY;
//to avoid to have new data on PassData while the for is working on plotRealPoints
@@ -42,7 +46,7 @@ public class CairoGraphRaceAnalyzer : CairoXY
string yVariable, string yUnits,
bool isSprint, bool plotMaxMark,
RunEncoderSegmentCalcs segmentCalcs,
- bool plotPowerBars,
+ bool plotSegmentBars, FeedbackWindow.RunsEncoderMainVariableTypes mainVariable,
bool useListOfDoublesOnY) //for pos/time graph
{
this.area = area;
@@ -56,7 +60,8 @@ public class CairoGraphRaceAnalyzer : CairoXY
this.isSprint = isSprint;
this.plotMaxMark = plotMaxMark;
this.segmentCalcs = segmentCalcs;
- this.plotPowerBars = plotPowerBars;
+ this.plotSegmentBars = plotSegmentBars;
+ this.mainVariable = mainVariable;
this.useListOfDoublesOnY = useListOfDoublesOnY;
// doing = false;
@@ -167,18 +172,42 @@ public class CairoGraphRaceAnalyzer : CairoXY
//graph the segmentCalcs
LogB.Information("dist ; time(s) ; speedCont ; accels ; forces ;
powers");
- if(plotPowerBars)
+ if(plotSegmentBars)
{
+ List<double> data_l = new List<double> ();
+ string mainVariableStr;
+ string unitsStr;
+ if(mainVariable ==
FeedbackWindow.RunsEncoderMainVariableTypes.POWER)
+ {
+ data_l = segmentCalcs.Power_l;
+ mainVariableStr = powerStr;
+ unitsStr = "W";
+ }
+ else if(mainVariable ==
FeedbackWindow.RunsEncoderMainVariableTypes.FORCE)
+ {
+ data_l = segmentCalcs.Force_l;
+ mainVariableStr = forceStr;
+ unitsStr = "N";
+ } else //if(mainVariable ==
FeedbackWindow.RunsEncoderMainVariableTypes.ACCELERATION)
+ {
+ data_l = segmentCalcs.Accel_l;
+ mainVariableStr = accelStr;
+ unitsStr = "m/s^2";
+ }
+
g.SetSourceColor (colorFromRGB (190,190,190));
- double powerPropAt0 = MathUtil.GetProportion (0,
segmentCalcs.Power_l);
+ double powerPropAt0 = MathUtil.GetProportion (0, data_l);
//draw Y0 line
+ g.SetSourceColor (colorFromRGB (66,66,66));
g.MoveTo (outerMargin, calculatePaintYProportion
(powerPropAt0));
g.LineTo (calculatePaintX (points_list[points_list.Count
-1].X), calculatePaintYProportion (powerPropAt0));
g.Stroke ();
g.SetSourceColor (black);
- printText(calculatePaintX (points_list[points_list.Count
-1].X), calculatePaintYProportion (powerPropAt0),
- 0, textHeight-3, " 0 " + powerStr, g,
alignTypes.LEFT);
+ printText(calculatePaintX (points_list[points_list.Count
-1].X), calculatePaintYProportion (powerPropAt0) - .66*textHeight,
+ 0, textHeight-3, mainVariableStr, g,
alignTypes.LEFT);
+ printText(calculatePaintX (points_list[points_list.Count
-1].X), calculatePaintYProportion (powerPropAt0) + .66*textHeight,
+ 0, textHeight-3, "0 " + unitsStr, g,
alignTypes.LEFT);
for(int i = 0 ; i < segmentCalcs.Count ; i ++)
{
@@ -187,7 +216,7 @@ public class CairoGraphRaceAnalyzer : CairoXY
segmentCalcs.SpeedCont_l[i],
segmentCalcs.Accel_l[i], segmentCalcs.Force_l[i], segmentCalcs.Power_l[i] ));
*/
- double powerProp = MathUtil.GetProportion
(segmentCalcs.Power_l[i], segmentCalcs.Power_l);
+ double powerProp = MathUtil.GetProportion (data_l[i],
data_l);
double xStart = calculatePaintX (points_list[0].X);
if(i > 0)
xStart = calculatePaintX
(segmentCalcs.Time_l[i-1]/1000000.0);
@@ -204,12 +233,13 @@ public class CairoGraphRaceAnalyzer : CairoXY
g.Stroke(); //rectangle border
int textPadding = 1;
- if(segmentCalcs.Power_l[i] < 0)
+ if(data_l[i] < 0)
textPadding = -1;
g.SetSourceColor (black);
printText((xStart + xEnd) / 2,
calculatePaintYProportion (powerProp) - (textHeight) * textPadding,
- 0, textHeight-3,
Math.Round(segmentCalcs.Power_l[i],1).ToString() + " W", g, alignTypes.CENTER);
+ 0, textHeight-3,
Math.Round(data_l[i],1).ToString()// + " " + unitsStr
+ , g, alignTypes.CENTER);
}
}
g.Stroke ();
diff --git a/src/gui/cairo/xy.cs b/src/gui/cairo/xy.cs
index 7831c039c..7355faed0 100644
--- a/src/gui/cairo/xy.cs
+++ b/src/gui/cairo/xy.cs
@@ -91,6 +91,7 @@ public abstract class CairoXY : CairoGeneric
protected string extraWeightStr = Catalog.GetString("Extra weight");
protected string fallStr = Catalog.GetString("Fall");
protected string speedStr = Catalog.GetString("Speed");
+ protected string accelStr = Catalog.GetString("Acceleration");
protected string forceStr = Catalog.GetString("Force");
protected string powerStr = Catalog.GetString("Power");
protected string dateStr = Catalog.GetString("Date");
diff --git a/src/gui/feedback.cs b/src/gui/feedback.cs
index 61a7a84a5..0a5786c4c 100644
--- a/src/gui/feedback.cs
+++ b/src/gui/feedback.cs
@@ -195,12 +195,19 @@ public class FeedbackWindow
[Widget] Gtk.SpinButton spin_force_sensor_capture_feedback_path_line_width; //N
[Widget] Gtk.Label label_force_sensor_path_recommended;
+ //runsEncoder
+ [Widget] Gtk.RadioButton radio_run_encoder_power;
+ [Widget] Gtk.RadioButton radio_run_encoder_force;
+ //[Widget] Gtk.RadioButton radio_run_encoder_accel;
+
+
const int JUMPSRUNSPAGE = 0;
const int ENCODERAUTOPAGE = 1;
const int ENCODERMANUALPAGE = 2;
const int ENCODERRHYTHMPAGE = 3;
const int FORCESENSORPAGE = 4;
const int TESTBELLSPAGE = 5;
+ const int RUNSENCODERPAGE = 6;
public Gtk.Button FakeButtonClose;
@@ -330,6 +337,7 @@ public class FeedbackWindow
notebook_main.GetNthPage(ENCODERRHYTHMPAGE).Hide();
notebook_main.GetNthPage(FORCESENSORPAGE).Hide();
notebook_main.GetNthPage(TESTBELLSPAGE).Hide();
+ notebook_main.GetNthPage(RUNSENCODERPAGE).Hide();
notebook_main.ShowTabs = false;
if(bellMode == Constants.BellModes.JUMPS || bellMode == Constants.BellModes.RUNS)
@@ -451,6 +459,10 @@ public class FeedbackWindow
notebook_main.GetNthPage(FORCESENSORPAGE).Show();
}
+ else if(bellMode == Constants.BellModes.RUNSENCODER)
+ {
+ notebook_main.GetNthPage(RUNSENCODERPAGE).Show();
+ }
label_test_sound_result.Text = "";
}
@@ -622,6 +634,17 @@ public class FeedbackWindow
return false;
}
+ public enum RunsEncoderMainVariableTypes { POWER, FORCE, ACCELERATION };
+ public RunsEncoderMainVariableTypes GetRunsEncoderMainVariable ()
+ {
+ if(radio_run_encoder_power.Active)
+ return RunsEncoderMainVariableTypes.POWER;
+ else if(radio_run_encoder_force.Active)
+ return RunsEncoderMainVariableTypes.FORCE;
+ else // if(radio_run_encoder_accel.Active)
+ return RunsEncoderMainVariableTypes.ACCELERATION;
+ }
+
public bool VolumeOn {
set { volumeOn = value; }
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]