예제 #1
0
        void InitControls()
        {
            //this.showToolBarMenuItem.Image = ZoneFiveSoftware.Common.Visuals.CommonResources.Images.Yeild16;
            this.speedPaceToolStripMenuItem.Image = ZoneFiveSoftware.Common.Visuals.CommonResources.Images.TrackGPS16;
            this.speedToolStripMenuItem.Image     = ZoneFiveSoftware.Common.Visuals.CommonResources.Images.TrackGPS16;
            this.paceToolStripMenuItem.Image      = ZoneFiveSoftware.Common.Visuals.CommonResources.Images.TrackGPS16;
            this.heartRateToolStripMenuItem.Image = ZoneFiveSoftware.Common.Visuals.CommonResources.Images.TrackHeartRate16;
            this.cadenceToolStripMenuItem.Image   = ZoneFiveSoftware.Common.Visuals.CommonResources.Images.TrackCadence16;
            this.elevationToolStripMenuItem.Image = ZoneFiveSoftware.Common.Visuals.CommonResources.Images.TrackElevation16;
            this.gradeStripMenuItem.Image         = ZoneFiveSoftware.Common.Visuals.CommonResources.Images.TrackElevation16;
            this.powerToolStripMenuItem.Image     = ZoneFiveSoftware.Common.Visuals.CommonResources.Images.TrackPower16;

            this.diffDistTimeToolStripMenuItem.Image = Properties.Resources.delta;
            this.deviceDiffToolStripMenuItem.Image   = Properties.Resources.delta;
            //this.diffTimeToolStripMenuItem.Image = Properties.Resources.delta;
            //this.diffDistToolStripMenuItem.Image = Properties.Resources.delta;
            //disable, only show diffDistTime
            this.diffTimeToolStripMenuItem.Visible = false;
            this.diffDistToolStripMenuItem.Visible = false;
            //this.deviceToolStripMenuItem.Image = ZoneFiveSoftware.Common.Visuals.CommonResources.Images.
            this.deviceSpeedPaceToolStripMenuItem.Image = ZoneFiveSoftware.Common.Visuals.CommonResources.Images.TrackGPS16;
            this.deviceElevationToolStripMenuItem.Image = ZoneFiveSoftware.Common.Visuals.CommonResources.Images.TrackElevation16;

            this.PowerBalanceToolStripMenuItem.Image = ZoneFiveSoftware.Common.Visuals.CommonResources.Images.TrackPower16;

            //this.distanceToolStripMenuItem.Image = ZoneFiveSoftware.Common.Visuals.CommonResources.Images.TrackGPS16;
            //this.timeToolStripMenuItem.Image = ZoneFiveSoftware.Common.Visuals.CommonResources.Images.Calendar16;
            this.showToolBarMenuItem.Image = Properties.Resources.ChartTools;

            this.adjustResyncDiffAtTrailPointsToolStripMenuItem.Visible = false;

            //The panels and charts should probably be created manually instead
            m_lineCharts = new List <TrailLineChart>();
            foreach (Control t in this.ChartPanel.Controls)
            {
                if (t is TrailLineChart)
                {
                    TrailLineChart lChart = (TrailLineChart)t;
                    m_lineCharts.Add(lChart);
                    if (lChart.MultipleCharts)
                    {
                        m_multiChart = lChart;
                    }
                }
            }
            //speedChart.YAxisReferential = LineChartTypes.Speed;
            //paceChart.YAxisReferential = LineChartTypes.Pace;
            //heartrateChart.YAxisReferential = LineChartTypes.HeartRateBPM;
            //gradeChart.YAxisReferential = LineChartTypes.Grade;
            //elevationChart.YAxisReferential = LineChartTypes.Elevation;
            //cadenceChart.YAxisReferential = LineChartTypes.Cadence;
            //diffTime.YAxisReferential = LineChartTypes.diffTime;
            //diffDist.YAxisReferential = LineChartTypes.diffDist;
            this.Expanded = m_expanded;
            this.Resize  += new System.EventHandler(TrailLineChart_Resize);
#if !chartsInDropDownMenu
            //old style select in drop down menu
            paceToolStripMenuItem.Visible              = false;
            speedPaceToolStripMenuItem.Visible         = false;
            speedToolStripMenuItem.Visible             = false;
            gradeStripMenuItem.Visible                 = false;
            elevationToolStripMenuItem.Visible         = false;
            heartRateToolStripMenuItem.Visible         = false;
            cadenceToolStripMenuItem.Visible           = false;
            powerToolStripMenuItem.Visible             = false;
            this.diffDistTimeToolStripMenuItem.Visible = false;

            this.deviceToolStripMenuItem.Visible                  = false;
            PowerBalanceToolStripMenuItem.Visible                 = false;
            TemperatureToolStripMenuItem.Visible                  = false;
            GroundContactTimeToolStripMenuItem.Visible            = false;
            VerticalOscillationToolStripMenuItem.Visible          = false;
            SaturatedHemoglobinToolStripMenuItem.Visible          = false;
            TotalHemoglobinConcentrationToolStripMenuItem.Visible = false;
            deviceDiffToolStripMenuItem.Visible      = false;
            deviceSpeedPaceToolStripMenuItem.Visible = false;
            deviceElevationToolStripMenuItem.Visible = false;
#endif
        }
예제 #2
0
        public void RefreshChart()
        {
            if (m_showPage && this.ChartVisible)
            {
                LineChartTypes speedPaceChart       = LineChartTypes.Speed;
                LineChartTypes deviceSpeedPaceChart = LineChartTypes.DeviceSpeed;
                if (Controller.TrailController.Instance.ReferenceActivity != null &&
                    Controller.TrailController.Instance.ReferenceActivity.Category.SpeedUnits.Equals(Speed.Units.Pace))
                {
                    speedPaceChart       = LineChartTypes.Pace;
                    deviceSpeedPaceChart = LineChartTypes.DevicePace;
                }
                LineChartTypes diffChart = LineChartTypes.DiffDist;
                if (Data.Settings.XAxisValue == XAxisValue.Distance)
                {
                    diffChart = LineChartTypes.DiffTime;
                }

                bool isData = Controller.TrailController.Instance.CurrentActivityTrailIsSelected;

                IList <Data.TrailResult> selectedPresentableResults =
                    TrailResultWrapper.TrailResults(Controller.TrailController.Instance.SelectedResults);
                if (selectedPresentableResults.Count > Data.Settings.MaxChartResults)
                {
                    //Move summary first, so it is not truncated
                    for (int i = 0; i < selectedPresentableResults.Count; i++)
                    {
                        TrailResult t = selectedPresentableResults[i];
                        if (t is SummaryTrailResult)
                        {
                            selectedPresentableResults.RemoveAt(i);
                            selectedPresentableResults.Insert(0, t);
                            break;
                        }
                    }

                    ((List <Data.TrailResult>)selectedPresentableResults).RemoveRange(Data.Settings.MaxChartResults,
                                                                                      selectedPresentableResults.Count - Data.Settings.MaxChartResults);
                }

                m_multiChart.ChartTypes = new List <LineChartTypes>();
                multiChart.ShowPage     = false;
                //TODO: Temporary handling. Cleanup and decide multiple graphs and charts
                TrailLineChart updateChart = m_multiChart;
                if (!m_expanded)
                {
                    foreach (TrailLineChart chart in m_lineCharts)
                    {
                        chart.ShowPage = false;
                    }
                    m_multiChart.BeginUpdate();
                    m_multiChart.XAxisReferential = Data.Settings.XAxisValue;
                    m_multiChart.TrailResults     = selectedPresentableResults;
                    foreach (LineChartTypes t in Data.Settings.MultiChartType)
                    {
                        LineChartTypes t2 = t;
                        if (t2 == LineChartTypes.SpeedPace)
                        {
                            t2 = speedPaceChart;
                        }
                        else if (t2 == LineChartTypes.DeviceSpeedPace)
                        {
                            t2 = deviceSpeedPaceChart;
                        }
                        else if (t2 == LineChartTypes.DiffDistTime)
                        {
                            t2 = diffChart;
                        }
                        if (!m_multiChart.ChartTypes.Contains(t2) &&
                            m_multiChart.HasValues(t2))
                        {
                            m_multiChart.ChartTypes.Add(t2);
                        }
                    }
                    m_multiChart.ShowPage = true;

                    if (!m_multiChart.AnyData())
                    {
                        m_multiChart.ShowPage      = false;
                        m_multiChart.LeftChartType = speedPaceChart;
                        m_multiChart.ShowPage      = true;
                    }
                    this.ChartBanner.Text = LineChartUtil.ChartTypeString(m_multiChart.LeftChartType) + " / " +
                                            LineChartUtil.XAxisValueString(m_multiChart.XAxisReferential);
                    m_multiChart.EndUpdate(true);
                }
                else
                {
                    foreach (TrailLineChart chart in m_lineCharts)
                    {
                        bool visible = false;

                        if (m_expanded &&
                            (Data.Settings.MultiGraphType.Contains(chart.LeftChartType) ||
                             chart.LeftChartType == speedPaceChart &&
                             (Data.Settings.MultiGraphType.Contains(LineChartTypes.SpeedPace) || Data.Settings.MultiGraphType.Contains(LineChartTypes.DeviceSpeedPace)) ||
                             chart.LeftChartType == diffChart &&
                             (Data.Settings.MultiGraphType.Contains(LineChartTypes.DiffDistTime) || Data.Settings.MultiGraphType.Contains(LineChartTypes.DeviceDiffDist))) ||

                            !m_expanded &&
                            (chart.LeftChartType == Data.Settings.ChartType ||
                             chart.LeftChartType == speedPaceChart &&
                             (LineChartTypes.SpeedPace == Data.Settings.ChartType || LineChartTypes.DeviceSpeedPace == Data.Settings.ChartType) ||
                             chart.LeftChartType == diffChart &&
                             (LineChartTypes.DiffDistTime == Data.Settings.ChartType || LineChartTypes.DiffDistTime == Data.Settings.ChartType)))
                        {
                            visible = true;
                        }

                        updateChart = chart;
                        updateChart.BeginUpdate();
                        chart.ShowPage = false;
                        if (visible && isData)
                        {
                            updateChart.XAxisReferential = Data.Settings.XAxisValue;
                            updateChart.TrailResults     = selectedPresentableResults;
                            if (!m_expanded && updateChart.ChartTypes.Count == 1)
                            {
                                this.ChartBanner.Text = LineChartUtil.ChartTypeString(chart.LeftChartType) + " / " +
                                                        LineChartUtil.XAxisValueString(chart.XAxisReferential);
                            }
                            if (updateChart.HasValues(chart.LeftChartType))
                            {
                                updateChart.ShowPage = visible;
                            }
                            else
                            {
                                if (visible && !updateChart.HasValues(chart.LeftChartType))
                                {
                                    chart.ShowPage = false;
                                    //Replace empty chart
                                    if (!m_expanded && chart.LeftChartType != speedPaceChart)
                                    {
                                        foreach (TrailLineChart replaceChart in m_lineCharts)
                                        {
                                            if (replaceChart.LeftChartType == speedPaceChart)
                                            {
                                                replaceChart.BeginUpdate();
                                                replaceChart.ShowPage         = false;
                                                replaceChart.XAxisReferential = Data.Settings.XAxisValue;
                                                replaceChart.TrailResults     = selectedPresentableResults;
                                                if (!m_expanded)
                                                {
                                                    this.ChartBanner.Text = LineChartUtil.ChartTypeString(replaceChart.LeftChartType) + " / " +
                                                                            LineChartUtil.XAxisValueString(replaceChart.XAxisReferential);
                                                }
                                                replaceChart.ShowPage = visible;
                                                replaceChart.EndUpdate(true);
                                            }
                                        }
                                    }
                                }
                            }
                        }
                        updateChart.EndUpdate(true);
                    }
                }
                RefreshRows();
                RefreshChartMenu();
            }
        }