[chronojump] Improvements on CairoRunDoubleContacts



commit e83844d01ae5a8778c5baa139c351be6c1fd123d
Author: Xavier de Blas <xaviblas gmail com>
Date:   Mon Nov 8 15:20:22 2021 -0300

    Improvements on CairoRunDoubleContacts

 glade/app1.glade                   |  2 +-
 src/gui/cairo/runDoubleContacts.cs | 84 +++++++++++++++++++++++---------------
 src/gui/eventExecute.cs            |  2 +-
 3 files changed, 54 insertions(+), 34 deletions(-)
---
diff --git a/glade/app1.glade b/glade/app1.glade
index ff6abf58f..91ff62c4d 100644
--- a/glade/app1.glade
+++ b/glade/app1.glade
@@ -15979,7 +15979,7 @@ Resisted race analyzer</property>
                                                             <property name="spacing">12</property>
                                                             <child>
                                                             <widget class="GtkDrawingArea" 
id="event_execute_drawingarea_run_simple_double_contacts">
-                                                            <property name="height_request">20</property>
+                                                            <property name="height_request">30</property>
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
                                                             <signal name="expose_event" 
handler="on_event_execute_drawingarea_run_simple_double_contacts_expose_event" swapped="no"/>
diff --git a/src/gui/cairo/runDoubleContacts.cs b/src/gui/cairo/runDoubleContacts.cs
index 1aca8686f..819c6036b 100644
--- a/src/gui/cairo/runDoubleContacts.cs
+++ b/src/gui/cairo/runDoubleContacts.cs
@@ -83,8 +83,7 @@ public class CairoRunDoubleContacts : CairoGeneric
 
        public void GraphDo (List<RunPhaseTimeListObject> runPTLInListForPainting,
                        double timeTotal,
-                       double timeTotalWithExtraPTL, double negativePTLTime,
-                       bool drawStart, bool drawEnd)
+                       double timeTotalWithExtraPTL, double negativePTLTime)
        {
                LogB.Information("CONTACT CHUNKS at Cairo");
                double lastChunkStart = 0;
@@ -127,41 +126,51 @@ public class CairoRunDoubleContacts : CairoGeneric
                        }
                }
 
-               drawTracks(timeTotalWithExtraPTL, negativePTLTime);
-
-               if(drawStart)
-               {
-                       //paint start vertical line
-                       double xStart2 = rightMargin + (graphWidth - 2*rightMargin) *
-                                       (negativePTLTime) / timeTotalWithExtraPTL -1;
+               drawTracks (timeTotal, timeTotalWithExtraPTL, negativePTLTime);
+               drawStartAndEnd (timeTotal, timeTotalWithExtraPTL, negativePTLTime);
+               endGraphDisposing(g);
+       }
 
-                       //on runInterval, this 3 lines will be done also above
-                       g.MoveTo (xStart2 +1, 10);
-                       g.LineTo (xStart2 +1, graphHeight-bottomMargin-4);
-                       g.Stroke();
+       protected virtual void drawTracks (double timeTotal, double timeTotalWithExtraPTL, double 
negativePTLTime)
+       {
+               plotArrowPassingGraphPoints (g, colorBackground,
+                               rightMargin + (graphWidth - 2*rightMargin) * (negativePTLTime) / 
timeTotalWithExtraPTL,
+                               15,
+                               rightMargin + (graphWidth - 2*rightMargin) * (timeTotal + negativePTLTime) / 
timeTotalWithExtraPTL,
+                               15,
+                               true, true, 1);
+
+               //draw track num
+               double xTrackNum = rightMargin + (graphWidth - 2*rightMargin) *
+                       (timeTotal/2 + negativePTLTime) / timeTotalWithExtraPTL;
+               printText(xTrackNum, 4, 0, 10, "1", g, alignTypes.CENTER);
+       }
 
-                       printText(xStart2, 4, 0, 10, "Start", g, alignTypes.CENTER);
-               }
+       protected void drawStartAndEnd (double timeTotal, double timeTotalWithExtraPTL, double 
negativePTLTime)
+       {
+               // 1) drawStart
+               //paint start vertical line
+               double xStart2 = rightMargin + (graphWidth - 2*rightMargin) *
+                       (negativePTLTime) / timeTotalWithExtraPTL -1;
 
-               if(drawEnd)
-               {
-                       //paint end vertical line
-                       double xEnd2 = rightMargin + (graphWidth - 2*rightMargin) *
-                                       (timeTotal + negativePTLTime) / timeTotalWithExtraPTL;
+               //on runInterval, this 3 lines will be done also above
+               g.MoveTo (xStart2 +1, 10);
+               g.LineTo (xStart2 +1, graphHeight-bottomMargin-4);
+               g.Stroke();
 
-                       //on runInterval, this 3 lines will be done also above
-                       g.MoveTo (xEnd2, 10);
-                       g.LineTo (xEnd2, graphHeight-bottomMargin-4);
-                       g.Stroke();
+               printText(xStart2, 4, 0, 10, "Start", g, alignTypes.CENTER);
 
-                       printText(xEnd2, 4, 0, 10, "End", g, alignTypes.CENTER);
-               }
+               // 2) drawEnd
+               //paint end vertical line
+               double xEnd2 = rightMargin + (graphWidth - 2*rightMargin) *
+                       (timeTotal + negativePTLTime) / timeTotalWithExtraPTL;
 
-               endGraphDisposing(g);
-       }
+               //on runInterval, this 3 lines will be done also above
+               g.MoveTo (xEnd2, 10);
+               g.LineTo (xEnd2, graphHeight-bottomMargin-4);
+               g.Stroke();
 
-       protected virtual void drawTracks (double timeTotalWithExtraPTL, double negativePTLTime)
-       {
+               printText(xEnd2, 4, 0, 10, "End", g, alignTypes.CENTER);
        }
 }
 
@@ -178,7 +187,7 @@ public class CairoRunIntervalDoubleContacts : CairoRunDoubleContacts
                initGraph();
        }
 
-       protected override void drawTracks (double timeTotalWithExtraPTL, double negativePTLTime)
+       protected override void drawTracks (double timeTotal, double timeTotalWithExtraPTL, double 
negativePTLTime)
        {
                LogB.Information("intervalTimesString is: " + intervalTimesString);
                string [] times = intervalTimesString.Split(new char[] {'='});
@@ -186,12 +195,23 @@ public class CairoRunIntervalDoubleContacts : CairoRunDoubleContacts
                int trackCount = 0;
                foreach(string time in times)
                {
+                       /*
+                       //vertical line at end of track
+
                        double xVert = rightMargin + (graphWidth - 2*rightMargin) *
                                (Convert.ToDouble(time) + accumulated + negativePTLTime) / 
timeTotalWithExtraPTL;
 
-                       g.MoveTo (xVert, 10);
+                       g.MoveTo (xVert, 5);
                        g.LineTo (xVert, graphHeight-bottomMargin-4);
                        g.Stroke();
+                       */
+
+                       plotArrowPassingGraphPoints (g, colorBackground,
+                               rightMargin + (graphWidth - 2*rightMargin) * (accumulated + negativePTLTime) 
/ timeTotalWithExtraPTL,
+                               15,
+                               rightMargin + (graphWidth - 2*rightMargin) * (Convert.ToDouble(time) + 
accumulated + negativePTLTime) / timeTotalWithExtraPTL,
+                               15,
+                               true, true, 1);
 
                        //draw track num
                        double xTrackNum = rightMargin + (graphWidth - 2*rightMargin) *
diff --git a/src/gui/eventExecute.cs b/src/gui/eventExecute.cs
index aac215017..66af3d96e 100644
--- a/src/gui/eventExecute.cs
+++ b/src/gui/eventExecute.cs
@@ -3258,7 +3258,7 @@ public class CairoManageRunDoubleContacts
                        crdc = new CairoRunIntervalDoubleContacts (darea, fontStr, intervalTimesString);
 
                crdc.GraphDo (runPTLInListForPainting,
-                               timeTotal, timeTotalWithExtraPTL, negativePTLTime, true, true);
+                               timeTotal, timeTotalWithExtraPTL, negativePTLTime);
        }
 
        private double getRunSRunINegativePTLTime (List<RunPhaseTimeListObject> runPTLInListForPainting)


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