/// <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; }
/// <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; }