Esempio n. 1
0
        // distance oriented
        private void plotMarks()
        {
            if (currentScene == UserSelections.ScenePractice)
            {
                return;
            }

            SimulatedVehicle top    = new SimulatedVehicle();
            SimulatedVehicle bottom = new SimulatedVehicle();

            int            count = 0;
            int            index;
            ExperienceUnit unit = null;

            foreach (int mode in UserSelections.ModeList)
            {
                index = user.Index[UserSelections.getIndex(currentScene, mode)];
                if (index != -1)
                {
                    unit = user.Experiences[index];
                    foreach (PropertyInfo p in top.GetType().GetProperties())
                    {
                        if ((float)p.GetValue(unit.Top) > (float)p.GetValue(top))
                        {
                            p.SetValue(top, (float)p.GetValue(unit.Top));
                        }

                        if ((float)p.GetValue(unit.Bottom) < (float)p.GetValue(bottom))
                        {
                            p.SetValue(bottom, (float)p.GetValue(unit.Bottom));
                        }
                    }
                    ++count;
                }
            }


            if (count != 0)
            {
                foreach (DistractMark mark in unit.Marks)
                {
                    float start = mark.Start.TotalDistance;
                    float end   = mark.End.TotalDistance;

                    SpeedChart.AddAMarker(new List <Point>()
                    {
                        new Point(start, top.Speed),
                        new Point(start, bottom.Speed), new Point(end, bottom.Speed), new Point(end, top.Speed), new Point(start, top.Speed)
                    });
                    OffsetChart.AddAMarker(new List <Point>()
                    {
                        new Point(start, top.Offset),
                        new Point(start, bottom.Offset), new Point(end, bottom.Offset), new Point(end, top.Offset), new Point(start, top.Offset)
                    });
                    AccelerationChart.AddAMarker(new List <Point>()
                    {
                        new Point(start, top.Acceleration),
                        new Point(start, bottom.Acceleration), new Point(end, bottom.Acceleration), new Point(end, top.Acceleration), new Point(start, top.Acceleration)
                    });
                    BrakeChart.AddAMarker(new List <Point>()
                    {
                        new Point(start, top.BrakePedal),
                        new Point(start, bottom.BrakePedal), new Point(end, bottom.BrakePedal), new Point(end, top.BrakePedal), new Point(start, top.BrakePedal)
                    });
                    FollowChart.AddAMarker(new List <Point>()
                    {
                        new Point(start, top.DistanceToNext),
                        new Point(start, bottom.DistanceToNext), new Point(end, bottom.DistanceToNext), new Point(end, top.DistanceToNext), new Point(start, top.DistanceToNext)
                    });
                }
            }

            if (showMark && axis == 1)
            {
                showMarkers();
            }
            else
            {
                hideMarkers();
            }
        }