コード例 #1
0
 /// <summary>
 /// Remove the specified lap from the plotter. Compare with the chart.Tag property
 /// </summary>
 /// <param name="lap"></param>
 void removeLapFromPlotter(LapInfo lap)
 {
     foreach (LineChart chart in getLineCharts(lap))
     {
         //chart.RemoveFromPlotter();
         chart.Visibility = System.Windows.Visibility.Hidden;
     }
 }
コード例 #2
0
 /// <summary>
 /// This method can return at most one chart meeting both the specified criteria.
 /// </summary>
 /// <param name="lap"></param>
 /// <param name="option"></param>
 /// <returns>The LineChart of the chart matching criteria. If one is not found, return null</returns>
 LineChart getLineCharts(LapInfo lap, ChartOptions option)
 {
     switch (option)
     {
         case ChartOptions.ALTITUDE:
             foreach (IPlotterElement child in innerAltitudePlotter.Children)
             {
                 if (typeof(LineChart) == child.GetType())
                 {
                     LineChart chart = child as LineChart;
                     if (lap.Equals((LapInfo)chart.Tag)) // find the chart that matches the lap object
                     {
                         return chart;
                     }
                 }
             }
             break;
         case ChartOptions.SPEED:
             foreach (IPlotterElement child in innerSpeedPlotter.Children)
             {
                 if (typeof(LineChart) == child.GetType())
                 {
                     LineChart chart = child as LineChart;
                     if (lap.Equals((LapInfo)chart.Tag)) // find the chart that matches the lap object
                     {
                         return chart;
                     }
                 }
             }
             break;
     }
     return null;
 }
コード例 #3
0
 /// <summary>
 /// Adds the specified lap to the chart plotter control.
 /// Color will be determined by the currently selected LapColor
 /// Altitude is dashed and speed is a solid line
 /// plotter plots Altitude while innerPlotter plots Speed/Velocity
 /// </summary>
 /// <param name="lap"></param>
 void addLapToPlotter(LapInfo lap)
 {
     double[] xPoints = new double[lap.Altitude.Count];
     for (int i = 0; i < lap.Altitude.Count; i++)
     {
         xPoints[i] = i;
     }
     Brush lapColor = new SolidColorBrush(lap.LapColor);
     // look at checkboxes to see if user wants altitude, speed
     if (checkBoxAltitude.IsChecked == true)
     {
         var altitudeDS = DataSource.Create(xPoints, lap.Altitude);
         LineChart chart = new LineChart();
         chart.DataSource = altitudeDS;
         chart.Stroke = lapColor;
         chart.StrokeThickness = 2;
         chart.Description = "Altitude";
         chart.StrokeDashArray = new DoubleCollection(new double[] { 1, 1 });
         chart.Tag = lap;    // chart tag holds the corresponding lap object. used for chart removal
         innerAltitudePlotter.AddChild(chart);
     }
     if (checkBoxSpeed.IsChecked == true)
     {
         var speedDS = DataSource.Create(xPoints, lap.Velocity);
         LineChart chart = new LineChart();
         chart.DataSource = speedDS;
         chart.Stroke = lapColor;
         chart.StrokeThickness = 2;
         chart.Description = "Velocity";
         chart.Tag = lap;    // chart tag holds the corresponding lap object. used for chart removal
         innerSpeedPlotter.Children.Add(chart);
     }
 }
コード例 #4
0
 /// <summary>
 /// Gets the charts that are specific to a lap
 /// </summary>
 /// <param name="lap"></param>
 /// <returns></returns>
 List<LineChart> getLineCharts(LapInfo lap)
 {
     List<LineChart> charts = new List<LineChart>();
     foreach (IPlotterElement child in plotter.Children)
     {
         if (typeof(LineChart) == child.GetType())
         {
             LineChart chart = child as LineChart;
             if (lap.Equals((LapInfo)chart.Tag)) // find the chart that matches the lap object
             {
                 charts.Add(chart);
             }
         }
     }
     return charts;
 }
コード例 #5
0
        public Record(TraqpaqDevice traqpaq, TraqpaqDevice.RecordTableReader.RecordTable recordTable)
        {
            // get the track name
            trackName = traqpaq.trackList[recordTable.TrackID].trackName;
            //TODO need to convert to readable date format
            DateStamp = recordTable.DateStamp.ToLongDateString();
            // get the data at the record
            //TODO separate laps for now assume 1 lap
            TraqpaqDevice.RecordDataReader dataReader = new TraqpaqDevice.RecordDataReader(traqpaq, recordTable);
            dataReader.readRecordData();

            List<double> longitudes = new List<double>();
            List<double> latitutes = new List<double>();
            List<double> altitudes = new List<double>();
            List<double> velocities = new List<double>();

            foreach (var page in dataReader.recordDataPages)
            {
                foreach (var data in page.RecordData)
                {
                    longitudes.Add(data.Longitude);
                    latitutes.Add(data.Latitude);
                    altitudes.Add(data.Altitude);
                    velocities.Add(data.Speed);
                }
            }
            LapInfo lap = new LapInfo();
            lap.Latitudes = latitutes;
            lap.Longitudes = longitudes;
            lap.LapColor = Colors.Red;
            lap.LapNo = "1";
            lap.LapTime = "1:20";
            lap.Track = trackName;
            Laps.Add(lap);
        }