[chronojump] Started sending/receiving logic for sprint export
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] Started sending/receiving logic for sprint export
- Date: Tue, 16 Mar 2021 09:59:40 +0000 (UTC)
commit 64f4a5c37a5246ca6c38591e8ea16c1eeca9115c
Author: Xavier de Blas <xaviblas gmail com>
Date: Tue Mar 16 10:58:41 2021 +0100
Started sending/receiving logic for sprint export
r-scripts/sprintPhotocells.R | 40 ++++++++++++++++++++++++++++------------
src/gui/sprint.cs | 3 ++-
src/runEncoder.cs | 2 +-
src/sprint.cs | 21 ++++++++++++++-------
src/utilEncoder.cs | 3 +++
5 files changed, 48 insertions(+), 21 deletions(-)
---
diff --git a/r-scripts/sprintPhotocells.R b/r-scripts/sprintPhotocells.R
index 29610526..0ef62276 100644
--- a/r-scripts/sprintPhotocells.R
+++ b/r-scripts/sprintPhotocells.R
@@ -38,15 +38,18 @@ source(paste(options[1], "/sprintUtil.R", sep=""))
assignOptions <- function(options) {
return(list(
scriptsPath = options[1],
- positions = as.numeric(unlist(strsplit(options[2], "\\;"))),
- splitTimes = as.numeric(unlist(strsplit(options[3], "\\;"))),
- mass = as.numeric(options[4]),
- personHeight = as.numeric(options[5]),
- tempC = as.numeric(options[6]),
- os = options[7],
- graphWidth = as.numeric(options[8]),
- graphHeight = as.numeric(options[9]),
- personName = options[10]
+ os = options[2],
+ graphWidth = as.numeric(options[3]),
+ graphHeight = as.numeric(options[4]),
+ positions = as.numeric(unlist(strsplit(options[5], "\\;"))),
+ splitTimes = as.numeric(unlist(strsplit(options[6], "\\;"))),
+ mass = as.numeric(options[7]),
+ personHeight = as.numeric(options[8]),
+ personName = options[9],
+ tempC = as.numeric(options[10]),
+ singleOrMultiple = options[11],
+ decimalCharAtExport = options[12],
+ includeImagesOnExport = options[13]
))
}
@@ -280,10 +283,23 @@ testPhotocellsCJ <- function(positions, splitTimes, mass, personHeight, tempC, p
#----- execute code
-prepareGraph(op$os, pngFile, op$graphWidth, op$graphHeight)
-testPhotocellsCJ(op$positions, op$splitTimes, op$mass, op$personHeight, op$tempC, op$personName)
-endGraph()
+start <- function(op)
+{
+ if(op$singleOrMultiple == "TRUE")
+ {
+ prepareGraph(op$os, pngFile, op$graphWidth, op$graphHeight)
+ testPhotocellsCJ(op$positions, op$splitTimes, op$mass, op$personHeight, op$tempC,
op$personName)
+ endGraph()
+ return()
+ }
+
+ # ------------------ op$singleOrMultiple == "FALSE" ------------------------->
+
+ #2) read the csv
+ #dataFiles = read.csv(file = paste(tempPath, "/sprintInputMulti.csv", sep=""), sep=";",
stringsAsFactors=F)
+}
+start(op)
#Examples of use
diff --git a/src/gui/sprint.cs b/src/gui/sprint.cs
index ee41590b..34c560c9 100644
--- a/src/gui/sprint.cs
+++ b/src/gui/sprint.cs
@@ -281,7 +281,8 @@ public partial class ChronoJumpWindow
bool success = sprint.CallR(
viewport_sprint.Allocation.Width -5,
viewport_sprint.Allocation.Height -5,
- currentPerson.Name);
+ currentPerson.Name,
+ true); //singleOrMultiple
if(! success)
{
diff --git a/src/runEncoder.cs b/src/runEncoder.cs
index 46efe149..08df286e 100644
--- a/src/runEncoder.cs
+++ b/src/runEncoder.cs
@@ -543,7 +543,7 @@ public class RunEncoderGraph
plotRawPower, plotFittedPower,
triggerList);
- this.exportDecimalSeparator = '.'; //TODO
+ this.exportDecimalSeparator = '.';
this.includeImagesOnExport = false;
}
diff --git a/src/sprint.cs b/src/sprint.cs
index 3d0f18d0..908f643c 100644
--- a/src/sprint.cs
+++ b/src/sprint.cs
@@ -58,14 +58,14 @@ public class Sprint
}
*/
- public bool CallR(int graphWidth, int graphHeight, string personName)
+ public bool CallR(int graphWidth, int graphHeight, string personName, bool singleOrMultiple)
{
LogB.Information("\nsprint CallR ----->");
- writeOptionsFile(graphWidth, graphHeight, personName);
+ writeOptionsFile(graphWidth, graphHeight, personName, singleOrMultiple);
return ExecuteProcess.CallR(UtilEncoder.GetSprintPhotocellsScript());
}
- private void writeOptionsFile(int graphWidth, int graphHeight, string personName)
+ private void writeOptionsFile(int graphWidth, int graphHeight, string personName, bool
singleOrMultiple)
{
/*
string scriptOptions =
@@ -79,17 +79,24 @@ public class Sprint
if(UtilAll.IsWindows())
scriptsPath = scriptsPath.Replace("\\","/");
+string exportDecimalSeparator = ".";
+bool includeImagesOnExport = false;
+
string scriptOptions =
"#scriptsPath\n" + scriptsPath + "\n" +
+ "#os\n" + UtilEncoder.OperatingSystemForRGraphs() + "\n" +
+ "#graphWidth\n" + graphWidth.ToString() + "\n" +
+ "#graphHeight\n" + graphHeight.ToString() + "\n" +
+ //all the following are unused on multiple
"#positions\n" + positions + "\n" +
"#splitTimes\n" + splitTimes + "\n" +
"#mass\n" + Util.ConvertToPoint(mass) + "\n" +
"#personHeight\n" + Util.ConvertToPoint(personHeight / 100.0) + "\n" + //send it
in meters
+ "#personName\n" + personName + "\n" +
"#tempC\n" + tempC + "\n" +
- "#os\n" + UtilEncoder.OperatingSystemForRGraphs() + "\n" +
- "#graphWidth\n" + graphWidth.ToString() + "\n" +
- "#graphHeight\n" + graphHeight.ToString() + "\n" +
- "#personName\n" + personName + "\n";
+ "#singleOrMultiple\n" + Util.BoolToRBool(singleOrMultiple) + "\n" +
+ "#decimalCharAtExport\n" + exportDecimalSeparator + "\n" +
+ "#includeImagesOnExport\n" + Util.BoolToRBool(includeImagesOnExport) + "\n";
TextWriter writer = File.CreateText(Path.GetTempPath() + "Roptions.txt");
writer.Write(scriptOptions);
diff --git a/src/utilEncoder.cs b/src/utilEncoder.cs
index 34fd2afb..f14e5ec0 100644
--- a/src/utilEncoder.cs
+++ b/src/utilEncoder.cs
@@ -242,6 +242,9 @@ public class UtilEncoder
public static string GetSprintPhotocellsScript() {
return System.IO.Path.Combine(GetSprintPath(), "sprintPhotocells.R");
}
+ public static string GetSprintCSVInputMulti() {
+ return Path.Combine(Path.GetTempPath(), "sprintInputMulti.csv");
+ }
public static string GetSprintImage() {
return System.IO.Path.Combine(Path.GetTempPath(), "sprintGraph.png");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]