[chronojump] Encoder fixed export on grav/inertial since diameter and eq mass
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] Encoder fixed export on grav/inertial since diameter and eq mass
- Date: Mon, 16 Nov 2020 10:49:28 +0000 (UTC)
commit 59663450599f05ff2cb504f1c803a5e2e8e7da36
Author: Xavier de Blas <xaviblas gmail com>
Date: Mon Nov 16 11:49:01 2020 +0100
Encoder fixed export on grav/inertial since diameter and eq mass
src/encoder.cs | 3 ++-
src/gui/app1/encoder.cs | 4 ++--
src/gui/encoderTreeviews.cs | 38 ++++++++++++++++++++++++++++++--------
3 files changed, 34 insertions(+), 11 deletions(-)
---
diff --git a/src/encoder.cs b/src/encoder.cs
index 7a375865..b8234141 100644
--- a/src/encoder.cs
+++ b/src/encoder.cs
@@ -424,7 +424,8 @@ public class EncoderCurve
//ecChar adds an 'e', 'c' or nothing to N
//if e or c then N will be /2
- public string ToCSV (bool captureOrAnalyze, string decimalSeparator, bool useWorkKcal, string ecChar)
+ public string ToCSV (bool captureOrAnalyze, Constants.Menuitem_modes currentMode,
+ string decimalSeparator, bool useWorkKcal, string ecChar)
{
//latin: 2,3 ; 2,5
//non-latin: 2.3 , 2.5
diff --git a/src/gui/app1/encoder.cs b/src/gui/app1/encoder.cs
index c4b550a7..b0b579ee 100644
--- a/src/gui/app1/encoder.cs
+++ b/src/gui/app1/encoder.cs
@@ -4541,7 +4541,7 @@ public partial class ChronoJumpWindow
} else {
//write header
writer.WriteLine(Util.RemoveNewLine(Util.StringArrayToString(
- GetTreeviewEncoderAnalyzeHeaders(false), sep),
false));
+ GetTreeviewEncoderAnalyzeHeaders(false,
current_menuitem_mode), sep), false));
//write curves rows
ArrayList array = getTreeViewCurves(encoderAnalyzeListStore);
@@ -4555,7 +4555,7 @@ public partial class ChronoJumpWindow
phase = "c";
}
- writer.WriteLine(ec.ToCSV(false,
preferences.CSVExportDecimalSeparator, preferences.encoderWorkKcal, phase));
+ writer.WriteLine(ec.ToCSV(false, current_menuitem_mode,
preferences.CSVExportDecimalSeparator, preferences.encoderWorkKcal, phase));
}
}
diff --git a/src/gui/encoderTreeviews.cs b/src/gui/encoderTreeviews.cs
index e54895ff..89200d2c 100644
--- a/src/gui/encoderTreeviews.cs
+++ b/src/gui/encoderTreeviews.cs
@@ -589,7 +589,7 @@ public partial class ChronoJumpWindow
//on screen shown on s but export is in ms
- public string [] GetTreeviewEncoderAnalyzeHeaders(bool screenOrCSV)
+ public string [] GetTreeviewEncoderAnalyzeHeaders(bool screenOrCSV, Constants.Menuitem_modes
encoderMode)
{
string timeUnits = "(s)";
string distanceUnits = "(cm)";
@@ -605,16 +605,22 @@ public partial class ChronoJumpWindow
else
workString += "\n (J)";
- string [] treeviewEncoderAnalyzeHeaders = {
+ string [] startArray = {
Catalog.GetString("Repetition") + "\n",
Catalog.GetString("Series") + "\n",
Catalog.GetString("Exercise") + "\n",
Catalog.GetString("Laterality") + "\n",
Catalog.GetString("Extra weight") + "\n(Kg)",
- Catalog.GetString("Total weight") + "\n(Kg)",
+ Catalog.GetString("Total weight") + "\n(Kg)"
+ };
+
+ string [] inertiaArray = {
Catalog.GetString("Inertia M.") + "\n(Kg*cm^2)", //inertial
Catalog.GetString("Diameter") + "\n(cm)", //inertial
- Catalog.GetString("Equivalent mass") + "\n(Kg)", //inertial
+ Catalog.GetString("Equivalent mass") + "\n(Kg)" //inertial
+ };
+
+ string [] endArray = {
Catalog.GetString("Start") + "\n" + timeUnits,
Catalog.GetString("Duration") + "\n" + timeUnits,
Catalog.GetString("Distance") + "\n" + distanceUnits,
@@ -632,14 +638,30 @@ public partial class ChronoJumpWindow
workString,
Catalog.GetString("Impulse") + "\n (N*s)"
};
- return treeviewEncoderAnalyzeHeaders;
+
+ if(encoderMode == Constants.Menuitem_modes.POWERGRAVITATORY)
+ {
+ string [] headers = new string[startArray.Length + endArray.Length];
+ startArray.CopyTo(headers, 0);
+ endArray.CopyTo(headers, startArray.Length);
+ return headers;
+ } else {
+ string [] headers = new string[startArray.Length + inertiaArray.Length +
endArray.Length];
+ startArray.CopyTo(headers, 0);
+ inertiaArray.CopyTo(headers, startArray.Length);
+ endArray.CopyTo(headers, startArray.Length + inertiaArray.Length);
+ return headers;
+ }
}
bool lastTreeviewEncoderAnalyzeIsNeuromuscular = false;
private int createTreeViewEncoderAnalyze(string contents, Constants.Menuitem_modes encoderMode)
{
- string [] columnsString = GetTreeviewEncoderAnalyzeHeaders(true); //screen
+ //note we pass powerinertial because we want here all columns but only relevant will shown
+ //on the other hand, on_button_encoder_save_table_file_selected will need to show the
relevant columns
+ string [] columnsString = GetTreeviewEncoderAnalyzeHeaders(true, //screen
+ Constants.Menuitem_modes.POWERINERTIAL);
ArrayList encoderAnalyzeCurves = new ArrayList ();
@@ -1031,7 +1053,7 @@ public partial class ChronoJumpWindow
//Check if it's number
if(! curve.IsNumberN()) {
(cell as Gtk.CellRendererText).Text = "";
- LogB.Error("Curve is not number at RenderN:" + curve.ToCSV(true, "COMMA",
preferences.encoderWorkKcal, ""));
+ LogB.Error("Curve is not number at RenderN:" + curve.ToCSV(true,
current_menuitem_mode, "COMMA", preferences.encoderWorkKcal, ""));
return;
}
@@ -1068,7 +1090,7 @@ public partial class ChronoJumpWindow
//Check if it's valid
if(! curve.IsValidN()) {
(cell as Gtk.CellRendererText).Text = "";
- LogB.Error("Curve is not valid at RenderNAnalyze:" + curve.ToCSV(false, "COMMA",
preferences.encoderWorkKcal, ""));
+ LogB.Error("Curve is not valid at RenderNAnalyze:" + curve.ToCSV(false,
current_menuitem_mode, "COMMA", preferences.encoderWorkKcal, ""));
return;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]