public void CreateDefaultGraphs()
 {
     List<SelectedStatisticCell> boats = new List<SelectedStatisticCell>();
     for(int i=0;i<_replay.Boats.Count;i++)
     {
         SelectedStatisticCell ssc = new SelectedStatisticCell();
         ssc.BoatIndex = i;
         boats.Add(ssc);
     }
     GraphForm gf = new GraphForm(_replay, "Speed", boats, SelectedUnitType);
     gf.Show(this.Pane, DockAlignment.Right, 0.5);
 }
        public void CreateDefaultGraphs()
        {
            List <SelectedStatisticCell> boats = new List <SelectedStatisticCell>();

            for (int i = 0; i < _replay.Boats.Count; i++)
            {
                SelectedStatisticCell ssc = new SelectedStatisticCell();
                ssc.BoatIndex = i;
                boats.Add(ssc);
            }
            GraphForm gf = new GraphForm(_replay, "Speed", boats, SelectedUnitType);

            gf.Show(this.Pane, DockAlignment.Right, 0.5);
        }
Exemple #3
0
        private string GetSelectionLabel(SelectedStatisticCell ssc)
        {
            string boatName  = _replay.Boats[ssc.BoatIndex.Value].Name;
            string curveName = "";

            if (_type == StatisticGroupType.Tack)
            {
                string tackName = (_replay.Boats[ssc.BoatIndex.Value].Tacks[ssc.TackIndex.Value].IndexOnLeg + 1).ToString() + " (" + _replay.Boats[ssc.BoatIndex.Value].Tacks[ssc.TackIndex.Value].Direction.ToString() + ")";
                string legName  = ssc.LegIndex.ToString() + " (" + _replay.Race.Course.Route[ssc.LegIndex.Value].Name + ")";
                curveName = boatName + ", " + legName + ", " + tackName;
            }
            else if (_type == StatisticGroupType.Leg)
            {
                string legName = ssc.LegIndex.ToString() + " (" + _replay.Race.Course.Route[ssc.LegIndex.Value].Name + ")";
                curveName = boatName + ", " + legName;
            }
            else
            {
                curveName = boatName;
            }
            return(curveName);
        }
Exemple #4
0
 private string GetSelectionLabel(SelectedStatisticCell ssc)
 {
     string boatName = _replay.Boats[ssc.BoatIndex.Value].Name;
     string curveName = "";
     if (_type == StatisticGroupType.Tack)
     {
         string tackName = (_replay.Boats[ssc.BoatIndex.Value].Tacks[ssc.TackIndex.Value].IndexOnLeg + 1).ToString() + " (" + _replay.Boats[ssc.BoatIndex.Value].Tacks[ssc.TackIndex.Value].Direction.ToString() + ")";
         string legName = ssc.LegIndex.ToString() + " (" + _replay.Race.Course.Route[ssc.LegIndex.Value].Name + ")";
         curveName = boatName + ", " + legName + ", " + tackName;
     }
     else if (_type == StatisticGroupType.Leg)
     {
         string legName = ssc.LegIndex.ToString() + " (" + _replay.Race.Course.Route[ssc.LegIndex.Value].Name + ")";
         curveName = boatName + ", " + legName;
     }
     else
     {
         curveName = boatName;
     }
     return curveName;
 }
        private void selectedColumnsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            bool graphedAnything = false;
            //loop through each column (stat), starting with the 3rd column
            //so that we skip "name" and "color", since those can't really be graphed
            for (int columnIndex = 2; columnIndex < statsTGV.Columns.Count; columnIndex++)
            {
                List<SelectedStatisticCell> boats = new List<SelectedStatisticCell>();
                List<SelectedStatisticCell> legs = new List<SelectedStatisticCell>();
                List<SelectedStatisticCell> tacks = new List<SelectedStatisticCell>();
                string statName = statsTGV.Columns[columnIndex].Name;

                //loop through the top level nodes AKA "boat nodes"
                for (int boatIndex = 0; boatIndex < statsTGV.Nodes.Count; boatIndex++)
                {
                    //look for "boat level" cells that are selected
                    if (statsTGV.Nodes[boatIndex].Cells[columnIndex].Selected)
                    {
                        if (boats.Count == 0)
                        {
                            for (int bi = 0; bi < _replay.Boats.Count; bi++)
                            {
                                SelectedStatisticCell ssc = new SelectedStatisticCell();
                                ssc.BoatIndex = bi;
                                ssc.Statistic = statName;
                                boats.Add(ssc);
                            }
                        }
                    }

                    //loop through the 2nd level nodes AKA "leg nodes"
                    for (int legIndex = 0; legIndex < statsTGV.Nodes[boatIndex].Nodes.Count; legIndex++)
                    {
                        if (statsTGV.Nodes[boatIndex].Nodes[legIndex].Cells[columnIndex].Selected)
                        {
                            if (boatIndex < _replay.Boats.Count && legIndex < _replay.Race.Course.Route.Count)
                            {
                                if (legs.Count == 0)
                                {
                                    for (int bi = 0; bi < _replay.Boats.Count; bi++)
                                    {
                                        if (legIndex < _replay.Boats[bi].LegStatistics.Count)
                                        {
                                            SelectedStatisticCell ssc = new SelectedStatisticCell();
                                            ssc.BoatIndex = bi;
                                            ssc.LegIndex = legIndex;
                                            ssc.Statistic = statName;
                                            legs.Add(ssc);
                                        }
                                    }
                                }
                            }
                        }

                        //loop through the 3rd level nodes AKA "tack nodes"
                        for (int tackIndex = 0; tackIndex < statsTGV.Nodes[boatIndex].Nodes[legIndex].Nodes.Count; tackIndex++)
                        {
                            if (statsTGV.Nodes[boatIndex].Nodes[legIndex].Nodes[tackIndex].Cells[columnIndex].Selected)
                            {
                                if (boatIndex < _replay.Boats.Count && legIndex < _replay.Race.Course.Route.Count)
                                {
                                    if (tacks.Count == 0)
                                    {
                                        for (int bi = 0; bi < _replay.Boats.Count; bi++)
                                        {
                                            if(tackIndex<_replay.Boats[bi].TackStatistics.Count)
                                            {
                                                SelectedStatisticCell ssc = new SelectedStatisticCell();
                                                ssc.BoatIndex = bi;
                                                ssc.LegIndex = _replay.Boats[bi].Tacks[tackIndex].LegIndex;
                                                ssc.TackIndex = tackIndex;
                                                ssc.Statistic = statName;
                                                tacks.Add(ssc);
                                            }
                                        }
                                    }
                                    
                                }
                            }
                        }
                    }
                }

                //open graphs for each group type
                if (boats.Count > 0)
                {
                    GraphForm gp = new GraphForm(Replay, statName, boats, SelectedUnitType);
                    gp.Show(this.DockPanel, UIHelper.FindCenteredPosition(this.DockPanel, this));
                    graphedAnything = true;
                }
                if (legs.Count > 0)
                {
                    GraphForm gp = new GraphForm(Replay, statName, legs, SelectedUnitType);
                    gp.Show(this.DockPanel, UIHelper.FindCenteredPosition(this.DockPanel, this));
                    graphedAnything = true;
                }
                if (tacks.Count > 0)
                {
                    GraphForm gp = new GraphForm(Replay, statName, tacks, SelectedUnitType);
                    gp.Show(this.DockPanel, UIHelper.FindCenteredPosition(this.DockPanel, this));
                    graphedAnything = true;
                }
            }
            if (!graphedAnything)
            {
                MessageBox.Show("Select one or more cells first.");
            }
        }
        private void selectedColumnsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            bool graphedAnything = false;

            //loop through each column (stat), starting with the 3rd column
            //so that we skip "name" and "color", since those can't really be graphed
            for (int columnIndex = 2; columnIndex < statsTGV.Columns.Count; columnIndex++)
            {
                List <SelectedStatisticCell> boats = new List <SelectedStatisticCell>();
                List <SelectedStatisticCell> legs  = new List <SelectedStatisticCell>();
                List <SelectedStatisticCell> tacks = new List <SelectedStatisticCell>();
                string statName = statsTGV.Columns[columnIndex].Name;

                //loop through the top level nodes AKA "boat nodes"
                for (int boatIndex = 0; boatIndex < statsTGV.Nodes.Count; boatIndex++)
                {
                    //look for "boat level" cells that are selected
                    if (statsTGV.Nodes[boatIndex].Cells[columnIndex].Selected)
                    {
                        if (boats.Count == 0)
                        {
                            for (int bi = 0; bi < _replay.Boats.Count; bi++)
                            {
                                SelectedStatisticCell ssc = new SelectedStatisticCell();
                                ssc.BoatIndex = bi;
                                ssc.Statistic = statName;
                                boats.Add(ssc);
                            }
                        }
                    }

                    //loop through the 2nd level nodes AKA "leg nodes"
                    for (int legIndex = 0; legIndex < statsTGV.Nodes[boatIndex].Nodes.Count; legIndex++)
                    {
                        if (statsTGV.Nodes[boatIndex].Nodes[legIndex].Cells[columnIndex].Selected)
                        {
                            if (boatIndex < _replay.Boats.Count && legIndex < _replay.Race.Course.Route.Count)
                            {
                                if (legs.Count == 0)
                                {
                                    for (int bi = 0; bi < _replay.Boats.Count; bi++)
                                    {
                                        if (legIndex < _replay.Boats[bi].LegStatistics.Count)
                                        {
                                            SelectedStatisticCell ssc = new SelectedStatisticCell();
                                            ssc.BoatIndex = bi;
                                            ssc.LegIndex  = legIndex;
                                            ssc.Statistic = statName;
                                            legs.Add(ssc);
                                        }
                                    }
                                }
                            }
                        }

                        //loop through the 3rd level nodes AKA "tack nodes"
                        for (int tackIndex = 0; tackIndex < statsTGV.Nodes[boatIndex].Nodes[legIndex].Nodes.Count; tackIndex++)
                        {
                            if (statsTGV.Nodes[boatIndex].Nodes[legIndex].Nodes[tackIndex].Cells[columnIndex].Selected)
                            {
                                if (boatIndex < _replay.Boats.Count && legIndex < _replay.Race.Course.Route.Count)
                                {
                                    if (tacks.Count == 0)
                                    {
                                        for (int bi = 0; bi < _replay.Boats.Count; bi++)
                                        {
                                            if (tackIndex < _replay.Boats[bi].TackStatistics.Count)
                                            {
                                                SelectedStatisticCell ssc = new SelectedStatisticCell();
                                                ssc.BoatIndex = bi;
                                                ssc.LegIndex  = _replay.Boats[bi].Tacks[tackIndex].LegIndex;
                                                ssc.TackIndex = tackIndex;
                                                ssc.Statistic = statName;
                                                tacks.Add(ssc);
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }

                //open graphs for each group type
                if (boats.Count > 0)
                {
                    GraphForm gp = new GraphForm(Replay, statName, boats, SelectedUnitType);
                    gp.Show(this.DockPanel, UIHelper.FindCenteredPosition(this.DockPanel, this));
                    graphedAnything = true;
                }
                if (legs.Count > 0)
                {
                    GraphForm gp = new GraphForm(Replay, statName, legs, SelectedUnitType);
                    gp.Show(this.DockPanel, UIHelper.FindCenteredPosition(this.DockPanel, this));
                    graphedAnything = true;
                }
                if (tacks.Count > 0)
                {
                    GraphForm gp = new GraphForm(Replay, statName, tacks, SelectedUnitType);
                    gp.Show(this.DockPanel, UIHelper.FindCenteredPosition(this.DockPanel, this));
                    graphedAnything = true;
                }
            }
            if (!graphedAnything)
            {
                MessageBox.Show("Select one or more cells first.");
            }
        }