[chronojump] RaceAnalyzer load sets where min accel is not reached shows a message



commit 35973ce93002d7cbc72115321e599ac09e6a0a4e
Author: Xavier de Blas <xaviblas gmail com>
Date:   Fri Aug 5 12:03:12 2022 +0200

    RaceAnalyzer load sets where min accel is not reached shows a message

 src/gui/app1/runEncoder.cs    |  3 +++
 src/gui/cairo/raceAnalyzer.cs | 23 +++++++++++++++++++++++
 2 files changed, 26 insertions(+)
---
diff --git a/src/gui/app1/runEncoder.cs b/src/gui/app1/runEncoder.cs
index 30c563e5a..99a28a747 100644
--- a/src/gui/app1/runEncoder.cs
+++ b/src/gui/app1/runEncoder.cs
@@ -2417,6 +2417,7 @@ public partial class ChronoJumpWindow
 
                if(cairoGraphRaceAnalyzer_dt == null || forceRedraw)
                        cairoGraphRaceAnalyzer_dt = new CairoGraphRaceAnalyzer(
+                                       (currentRunEncoder != null),
                                        drawingarea_race_analyzer_capture_position_time, "title",
                                        Catalog.GetString("Distance"), "m",
                                        isSprint, false,
@@ -2452,6 +2453,7 @@ public partial class ChronoJumpWindow
 
                if(cairoGraphRaceAnalyzer_st == null || forceRedraw)
                        cairoGraphRaceAnalyzer_st = new CairoGraphRaceAnalyzer(
+                                       (currentRunEncoder != null),
                                        drawingarea_race_analyzer_capture_speed_time, "title",
                                        Catalog.GetString("Speed"), "m/s",
                                        isSprint, true,
@@ -2490,6 +2492,7 @@ public partial class ChronoJumpWindow
 
                if(cairoGraphRaceAnalyzer_at == null || forceRedraw)
                        cairoGraphRaceAnalyzer_at = new CairoGraphRaceAnalyzer(
+                                       (currentRunEncoder != null),
                                        drawingarea_race_analyzer_capture_accel_time, "title",
                                        Catalog.GetString("Accel"), "m/s^2",
                                        isSprint, false,
diff --git a/src/gui/cairo/raceAnalyzer.cs b/src/gui/cairo/raceAnalyzer.cs
index dd175b85d..7a0f98015 100644
--- a/src/gui/cairo/raceAnalyzer.cs
+++ b/src/gui/cairo/raceAnalyzer.cs
@@ -27,6 +27,13 @@ using Cairo;
 
 public class CairoGraphRaceAnalyzer : CairoXY
 {
+       /*
+          at load if 1st value of triggerList is lower than minAccel,
+          shift points and triggerList to sample before of 1st trigger
+          */
+       private bool setExists;
+//     private bool load;
+
        int points_list_painted;
        private bool isSprint;
        private bool plotMaxMark;
@@ -42,6 +49,8 @@ public class CairoGraphRaceAnalyzer : CairoXY
 //     static bool doing;
        //regular constructor
        public CairoGraphRaceAnalyzer (
+//                     bool load,
+                       bool setExists, //if capture or load: setExists (currentRunEncoder != null)
                        DrawingArea area, string title,
                        string yVariable, string yUnits,
                        bool isSprint, bool plotMaxMark,
@@ -49,6 +58,8 @@ public class CairoGraphRaceAnalyzer : CairoXY
                        bool plotSegmentBars, FeedbackWindow.RunsEncoderMainVariableTypes mainVariable,
                        bool useListOfDoublesOnY) //for pos/time graph
        {
+               this.setExists = setExists;
+//             this.load = load;
                this.area = area;
                this.title = title;
                this.colorBackground = colorFromGdk(Config.ColorBackground); //but note if we are using 
system colors, this will not match
@@ -120,6 +131,18 @@ public class CairoGraphRaceAnalyzer : CairoXY
                        }
 
                        paintAxis();
+                       if (setExists && (points_list == null || points_list.Count == 0))
+                       {
+                               printText(graphWidth/2, graphHeight/2,
+                                               0, textHeight-3,
+                                               string.Format ("No data. Minimum acceleration is {0} m/s^2.", 
minAccel),
+                                               g, alignTypes.CENTER);
+                               printText(graphWidth/2, graphHeight/2 + 16,
+                                               0, textHeight-3,
+                                               "Maybe is too high. Change it on preferences.",
+                                               g, alignTypes.CENTER);
+                       }
+
                        return graphInited;
                }
 


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