[chronojump] RunSimple/Interval Inspector shows the photocell (on Wichro)



commit 8b9de43b634105a5495c3fd12c6e8b4b8bffbacf
Author: Xavier de Blas <xaviblas gmail com>
Date:   Mon Nov 15 16:56:22 2021 +0100

    RunSimple/Interval Inspector shows the photocell (on Wichro)

 src/execute/event.cs               |  4 ++++
 src/execute/runObjects.cs          | 31 ++++++++++++++++++++++++++-----
 src/gui/cairo/runDoubleContacts.cs | 29 +++++++++++++++++------------
 3 files changed, 47 insertions(+), 17 deletions(-)
---
diff --git a/src/execute/event.cs b/src/execute/event.cs
index 5a21707f3..a47614de1 100644
--- a/src/execute/event.cs
+++ b/src/execute/event.cs
@@ -654,6 +654,10 @@ public class PhaseTime
                return "\n" + Math.Round(UtilAll.DivideSafe(duration, 1000.0), 3) + photocellStr + " - " + 
strMode;
        }
 
+       public int Photocell
+       {
+               get { return photocell; }
+       }
        public bool IsContact
        {
                get { return contactIn; }
diff --git a/src/execute/runObjects.cs b/src/execute/runObjects.cs
index 50680873f..377a34d86 100644
--- a/src/execute/runObjects.cs
+++ b/src/execute/runObjects.cs
@@ -564,6 +564,8 @@ public class RunPhaseTimeList
                List<RunPhaseTimeListObject> list_in = new List<RunPhaseTimeListObject>();
                int currentMS = 0;
                int startInMS = -1;
+               int startInPhotocell = -1;
+               int currentPhotocell = -1;
 
                // 1) create a copy of listPhaseTime in order to do foreach without problems with other 
thread that adds records
                //This is problematic (Collection was modified; enumeration operation may not execute) if 
other thread is changing it:
@@ -603,8 +605,10 @@ public class RunPhaseTimeList
                                LogB.Information("InListForPainting negativeValues = " + 
negativeValues.ToString());
                        }
 
-                       if(pt.IsContact)
+                       if(pt.IsContact) {
                                startInMS = currentMS;
+                               startInPhotocell = pt.Photocell;
+                       }
                        else if(startInMS >= 0)
                        {
                                //see if previous has ended to mark as END or STARTEND
@@ -638,10 +642,13 @@ public class RunPhaseTimeList
                                rptloToAdd = new RunPhaseTimeListObject(
                                                currentPhase,
                                                startInMS/1000.0,
-                                               currentMS/1000.0);
+                                               currentMS/1000.0,
+                                               startInPhotocell,
+                                               pt.Photocell);
                        }
 
                        currentMS += Convert.ToInt32(pt.Duration);
+                       currentPhotocell = pt.Photocell;
 
                        LogB.Information(string.Format("End of iteration: {0}, pt.IsContact: {1}, startInMS: 
{2}, currentMS: {3}",
                                                count, pt.IsContact, startInMS, currentMS));
@@ -667,7 +674,8 @@ public class RunPhaseTimeList
                        RunPhaseTimeListObject rptloLast = new RunPhaseTimeListObject(
                                                RunPhaseTimeListObject.Phases.STARTANDEND,
                                                startInMS/1000.0,
-                                               (startInMS + ptLast.Duration)/1000.0);
+                                               (startInMS + ptLast.Duration)/1000.0,
+                                               startInPhotocell, ptLast.Photocell);
 
                        if(rptloToAdd.phase == RunPhaseTimeListObject.Phases.START ||
                                        rptloToAdd.phase == RunPhaseTimeListObject.Phases.MIDDLE)
@@ -705,6 +713,11 @@ public class RunPhaseTimeList
                return str;
        }
 
+       public List<PhaseTime> ListPhaseTime
+       {
+               get { return listPhaseTime; }
+       }
+
 }
 
 public class RunPhaseTimeListObject
@@ -715,23 +728,31 @@ public class RunPhaseTimeListObject
        public Phases phase;
        public double tcStart;
        public double tcEnd;
+       public int photocellStart;
+       public int photocellEnd;
+
 
        public RunPhaseTimeListObject ()
        {
        }
 
-       public RunPhaseTimeListObject (Phases phase, double tcStart, double tcEnd)
+       public RunPhaseTimeListObject (Phases phase,
+                       double tcStart, double tcEnd, int photocellStart, int photocellEnd)
        {
                this.phase = phase;
                this.tcStart = tcStart;
                this.tcEnd = tcEnd;
+               this.photocellStart = photocellStart;
+               this.photocellEnd = photocellEnd;
        }
 
        public override string ToString()
        {
                return phase.ToString() + ":" +
                        Math.Round(tcStart, 3).ToString() + ":" +
-                       Math.Round(tcEnd, 3).ToString();
+                       Math.Round(tcEnd, 3).ToString() + ":" +
+                       photocellStart.ToString() + ":" +
+                       photocellEnd.ToString();
        }
 }
 
diff --git a/src/gui/cairo/runDoubleContacts.cs b/src/gui/cairo/runDoubleContacts.cs
index 819c6036b..1d9d34154 100644
--- a/src/gui/cairo/runDoubleContacts.cs
+++ b/src/gui/cairo/runDoubleContacts.cs
@@ -81,7 +81,8 @@ public class CairoRunDoubleContacts : CairoGeneric
                g.Color = black;
        }
 
-       public void GraphDo (List<RunPhaseTimeListObject> runPTLInListForPainting,
+       public void GraphDo (
+                       List<RunPhaseTimeListObject> runPTLInListForPainting,
                        double timeTotal,
                        double timeTotalWithExtraPTL, double negativePTLTime)
        {
@@ -98,30 +99,34 @@ public class CairoRunDoubleContacts : CairoGeneric
                                        (inPTL.tcEnd + negativePTLTime) / timeTotalWithExtraPTL;
 
                        g.Color = colorBackground;
-                       g.Rectangle(xStart, graphHeight-bottomMargin-4, xEnd-xStart, 4);
+                       g.Rectangle(xStart, 22, xEnd-xStart, 4);
                        g.Fill();
 
+                       if(inPTL.photocellStart >= 0)
+                               printText(xStart, 30, 0, 10, inPTL.photocellStart.ToString(), g, 
alignTypes.CENTER);
+                       if(inPTL.photocellEnd >= 0)
+                               printText(xEnd, 30, 0, 10, inPTL.photocellEnd.ToString(), g, 
alignTypes.CENTER);
 
                        g.Color = black;
                        //manage chunks indications
                        if(inPTL.phase == RunPhaseTimeListObject.Phases.START)
                        {
                                //draw the vertical start line
-                               g.MoveTo (xStart - chunkMargins, graphHeight-bottomMargin -4);
-                               g.LineTo (xStart - chunkMargins, graphHeight-bottomMargin -(4 + 
chunkMargins));
+                               g.MoveTo (xStart - chunkMargins, 32);
+                               g.LineTo (xStart - chunkMargins, 40);
                                g.Stroke();
                                lastChunkStart = xStart;
                        }
                        else if(inPTL.phase == RunPhaseTimeListObject.Phases.END)
                        {
                                //draw the vertical end line
-                               g.MoveTo(xEnd + chunkMargins, graphHeight-bottomMargin -4);
-                               g.LineTo(xEnd + chunkMargins, graphHeight-bottomMargin -(4 + chunkMargins));
+                               g.MoveTo(xEnd + chunkMargins, 32);
+                               g.LineTo(xEnd + chunkMargins, 40);
                                g.Stroke();
 
                                //draw the horizontal start-end line
-                               g.MoveTo(lastChunkStart - chunkMargins, graphHeight-bottomMargin -(4 + 
chunkMargins));
-                               g.LineTo(xEnd + chunkMargins, graphHeight-bottomMargin -(4 + chunkMargins));
+                               g.MoveTo(lastChunkStart - chunkMargins, 40);
+                               g.LineTo(xEnd + chunkMargins, 40);
                                g.Stroke();
                        }
                }
@@ -155,10 +160,10 @@ public class CairoRunDoubleContacts : CairoGeneric
 
                //on runInterval, this 3 lines will be done also above
                g.MoveTo (xStart2 +1, 10);
-               g.LineTo (xStart2 +1, graphHeight-bottomMargin-4);
+               g.LineTo (xStart2 +1, 25);
                g.Stroke();
 
-               printText(xStart2, 4, 0, 10, "Start", g, alignTypes.CENTER);
+               printText(xStart2, 4, 0, 10, "Start", g, alignTypes.RIGHT);
 
                // 2) drawEnd
                //paint end vertical line
@@ -167,10 +172,10 @@ public class CairoRunDoubleContacts : CairoGeneric
 
                //on runInterval, this 3 lines will be done also above
                g.MoveTo (xEnd2, 10);
-               g.LineTo (xEnd2, graphHeight-bottomMargin-4);
+               g.LineTo (xEnd2, 25);
                g.Stroke();
 
-               printText(xEnd2, 4, 0, 10, "End", g, alignTypes.CENTER);
+               printText(xEnd2, 4, 0, 10, "End", g, alignTypes.LEFT);
        }
 }
 


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