[chronojump] Trigger to R can export ON and OFF triggers



commit 356bae4357859bf954120cae46ecb65712a3973f
Author: Xavier de Blas <xaviblas gmail com>
Date:   Wed Feb 5 21:22:11 2020 +0100

    Trigger to R can export ON and OFF triggers

 src/encoderRProc.cs | 12 ++++++------
 src/trigger.cs      | 14 ++++++++++++--
 2 files changed, 18 insertions(+), 8 deletions(-)
---
diff --git a/src/encoderRProc.cs b/src/encoderRProc.cs
index 3dfc0941..c8cce810 100644
--- a/src/encoderRProc.cs
+++ b/src/encoderRProc.cs
@@ -69,7 +69,7 @@ public abstract class EncoderRProc
        {
        }
 
-       protected virtual string printTriggers()
+       protected virtual string printTriggers(TriggerList.Type3 type3)
        {
                return TriggerList.TriggersNotFoundString;
        }
@@ -258,7 +258,7 @@ public class EncoderRProcCapture : EncoderRProc
                                Debug,
                                false,  //crossValidate (unactive on capture at the moment)
                                (CutByTriggers != Preferences.TriggerTypes.NO_TRIGGERS),
-                               printTriggers(),
+                               printTriggers(TriggerList.Type3.ON),
                                false,  //separateSessionInDays (false at capture)
                                EncoderGraphROptions.AnalysisModes.CAPTURE).ToString();
 
@@ -269,7 +269,7 @@ public class EncoderRProcCapture : EncoderRProc
                ((IDisposable)writer).Dispose();
        }
 
-       protected override string printTriggers()
+       protected override string printTriggers(TriggerList.Type3 type3)
        {
                //just use triggeres tp cut sets into repetitions, or not.
                //Cut is done in C# but this will change minHeight behaviour and reduceCurveBySpeed
@@ -518,7 +518,7 @@ public class EncoderRProcAnalyze : EncoderRProc
                                Debug,
                                CrossValidate,
                                cutByTriggers,
-                               printTriggers(),
+                               printTriggers(TriggerList.Type3.ON),
                                SeparateSessionInDays,
                                analysisMode
                                ).ToString();
@@ -530,9 +530,9 @@ public class EncoderRProcAnalyze : EncoderRProc
                ((IDisposable)writer).Dispose();
        }
 
-       protected override string printTriggers()
+       protected override string printTriggers(TriggerList.Type3 type3)
        {
-               return triggerList.ToRCurvesString();
+               return triggerList.ToRCurvesString(type3);
        }
                
        private void deleteFile(string filename)
diff --git a/src/trigger.cs b/src/trigger.cs
index bdf274ef..cee16845 100644
--- a/src/trigger.cs
+++ b/src/trigger.cs
@@ -165,7 +165,11 @@ public class TriggerList
                return s;
        }
 
-       public string ToRCurvesString()
+       //to print for R,
+       //best is call here with an ON to print a triggersOnList
+       //then call here with an OFF
+       //note on encoder we only use ON, but on runEncoder, we use ON and then OFF
+       public string ToRCurvesString(Type3 type3)
        {
                if(l.Count == 0)
                        return TriggersNotFoundString;
@@ -174,7 +178,13 @@ public class TriggerList
                string sep = "";
                foreach(Trigger trigger in l)
                {
-                       if(trigger.InOut) {
+                       if(trigger.InOut && type3 != Type3.OFF)
+                       {
+                               s += sep + trigger.Ms.ToString();
+                               sep = ";";
+                       }
+                       if(! trigger.InOut && type3 != Type3.ON)
+                       {
                                s += sep + trigger.Ms.ToString();
                                sep = ";";
                        }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]