[chronojump] CairoRadial can create blank graph and also SpeedMax graph



commit 6e66b6f8b745b4672739a56a9534d6d81c50361a
Author: Xavier de Blas <xaviblas gmail com>
Date:   Tue Apr 6 19:11:10 2021 +0200

    CairoRadial can create blank graph and also SpeedMax graph

 src/gui/cairo/radial.cs | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)
---
diff --git a/src/gui/cairo/radial.cs b/src/gui/cairo/radial.cs
index 9fc2552d..9ae0f04e 100644
--- a/src/gui/cairo/radial.cs
+++ b/src/gui/cairo/radial.cs
@@ -43,7 +43,10 @@ public class CairoRadial : CairoGeneric
        {
                this.area = area;
                this.font = font;
+       }
 
+       public void GraphBlank()
+       {
                initGraph();
                endGraphDisposing(g);
        }
@@ -122,6 +125,7 @@ public class CairoRadial : CairoGeneric
                speedMax = 0;
        }
 
+       //used while capturing
        public void GraphSpeedAndDistance(double speed, double distance)
        {
                if(speed > speedMax)
@@ -150,6 +154,30 @@ public class CairoRadial : CairoGeneric
                endGraphDisposing(g);
        }
 
+       //used at end or capture or at load
+       public void GraphSpeedMaxAndDistance(double speedMax, double distance)
+       {
+               initGraph();
+
+               //g.SetSourceRGB(0.5, 0.5, 0.5);
+
+               g.LineWidth = 2;
+               printText(Convert.ToInt32(margin + graphWidth/2),
+                               Convert.ToInt32(margin + (.66 * graphHeight)),
+                               0, textHeight,
+                               "Max Speed: " + Util.TrimDecimals(speedMax, 1) + " m/s",
+                               g, alignTypes.CENTER);
+               printText(Convert.ToInt32(margin + graphWidth/2),
+                               Convert.ToInt32(margin + (.66 * graphHeight)) + 20,
+                               0, textHeight,
+                               "Distance: " + Util.TrimDecimals(distance, 3) + " m",
+                               g, alignTypes.CENTER);
+
+               graphLineFromCenter(speedMax, gray);
+
+               endGraphDisposing(g);
+       }
+
        private void graphLineFromCenter(double toValue, Cairo.Color color)
        {
                //double arc = (2*Math.PI / maxPossibleValue) * toValue;


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