Esempio n. 1
0
        private void plotExperienceLine(int _mode, int indexOfSelection)
        {
            Dispatcher              dispatcher = PageList.Main.Dispatcher;
            ExperienceUnit          unit       = user.Experiences[user.Index[indexOfSelection]];
            List <SimulatedVehicle> list       = unit.Vehicles;

            SpeedChart.Init.AppendAsync(dispatcher, new Point(0, unit.Top.Speed));
            OffsetChart.Init.AppendAsync(dispatcher, new Point(0, unit.Top.Offset));
            AccelerationChart.Init.AppendAsync(dispatcher, new Point(0, unit.Top.Acceleration));
            BrakeChart.Init.AppendAsync(dispatcher, new Point(0, unit.Top.BrakePedal));
            FollowChart.Init.AppendAsync(dispatcher, new Point(0, unit.Top.DistanceToNext));

            SpeedChart.Init.AppendAsync(dispatcher, new Point(0, unit.Bottom.Speed));
            OffsetChart.Init.AppendAsync(dispatcher, new Point(0, unit.Bottom.Offset));
            AccelerationChart.Init.AppendAsync(dispatcher, new Point(0, unit.Bottom.Acceleration));
            BrakeChart.Init.AppendAsync(dispatcher, new Point(0, unit.Bottom.BrakePedal));
            FollowChart.Init.AppendAsync(dispatcher, new Point(0, unit.Bottom.DistanceToNext));

            switch (axis)
            {
            case 0:
                SpeedChart.Init.AppendAsync(dispatcher, new Point(unit.Right.SimulationTime, 0));
                OffsetChart.Init.AppendAsync(dispatcher, new Point(unit.Right.SimulationTime, 0));
                AccelerationChart.Init.AppendAsync(dispatcher, new Point(unit.Right.SimulationTime, 0));
                BrakeChart.Init.AppendAsync(dispatcher, new Point(unit.Right.SimulationTime, 0));
                FollowChart.Init.AppendAsync(dispatcher, new Point(unit.Right.SimulationTime, 0));
                break;

            case 1:
                SpeedChart.Init.AppendAsync(dispatcher, new Point(unit.Right.TotalDistance, 0));
                OffsetChart.Init.AppendAsync(dispatcher, new Point(unit.Right.TotalDistance, 0));
                AccelerationChart.Init.AppendAsync(dispatcher, new Point(unit.Right.TotalDistance, 0));
                BrakeChart.Init.AppendAsync(dispatcher, new Point(unit.Right.TotalDistance, 0));
                FollowChart.Init.AppendAsync(dispatcher, new Point(unit.Right.TotalDistance, 0));
                break;

            default:
                return;
            }


            foreach (SimulatedVehicle vehicle in list)
            {
                float x;

                switch (axis)
                {
                case 0:
                    x = vehicle.SimulationTime;
                    break;

                case 1:
                    x = vehicle.TotalDistance;
                    break;

                default:
                    return;
                }

                SpeedChart.addRealTimePoint(_mode, new Point(x, vehicle.Speed));
                OffsetChart.addRealTimePoint(_mode, new Point(x, vehicle.Offset));
                AccelerationChart.addRealTimePoint(_mode, new Point(x, vehicle.Acceleration));
                BrakeChart.addRealTimePoint(_mode, new Point(x, vehicle.BrakePedal));
                FollowChart.addRealTimePoint(_mode, new Point(x, vehicle.DistanceToNext));
            }
        }