コード例 #1
0
        private void plotExperienceLine(int scene, int mode, LinePlotter plotter, string variable, int xAxis)
        {
            int index = UserSelections.getIndex(scene, mode);

            if (user.Index[index] == -1)
            {
                return;
            }

            Dispatcher              dispatcher = PageList.Main.Dispatcher;
            ExperienceUnit          unit       = user.Experiences[user.Index[index]];
            List <SimulatedVehicle> list       = unit.Vehicles;

            plotter.Init.AppendAsync(dispatcher,
                                     new Point(0, (float)unit.Top.GetType().GetProperty(variable).GetValue(unit.Top)));
            plotter.Init.AppendAsync(dispatcher,
                                     new Point(0, (float)unit.Bottom.GetType().GetProperty(variable).GetValue(unit.Bottom)));

            switch (xAxis)
            {
            case 0:
                plotter.Init.AppendAsync(dispatcher, new Point(unit.Right.SimulationTime, 0));
                break;

            case 1:
                plotter.Init.AppendAsync(dispatcher, new Point(unit.Right.TotalDistance, 0));
                break;

            default:
                return;
            }


            foreach (SimulatedVehicle vehicle in list)
            {
                float x;

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

                case 1:
                    x = vehicle.TotalDistance;
                    break;

                default:
                    return;
                }

                plotter.addRealTimePoint(mode,
                                         new Point(x, (float)vehicle.GetType().GetProperty(variable).GetValue(vehicle)));
            }
        }
コード例 #2
0
        private float getBarChartValue(int scene, int mode, string dataName)
        {
            int   index = UserSelections.getIndex(scene, mode);
            float result;

            if (index != -1 && user.Index[index] != -1)
            {
                ExperienceUnit unit = user.Experiences[user.Index[index]];
                result = (float)unit.Evaluation.GetType().GetProperty(dataName).GetValue(unit.Evaluation);
            }
            else
            {
                result = 0;
            }

            return(result);
        }
コード例 #3
0
        private void plotLineChart()
        {
            if (axis == 1)
            {
                plotMarks();
            }

            int normalIndex = UserSelections.getIndex(currentScene, UserSelections.NormalMode);

            if (normalIndex != -1 && user.Index[normalIndex] != -1)
            {
                plotExperienceLine(UserSelections.NormalMode, normalIndex);
            }

            int distractAIndex = UserSelections.getIndex(currentScene, UserSelections.DistractAMode);

            if (distractAIndex != -1 && user.Index[distractAIndex] != -1)
            {
                plotExperienceLine(UserSelections.DistractAMode, distractAIndex);
            }

            int distractBIndex = UserSelections.getIndex(currentScene, UserSelections.DistractBMode);

            if (distractBIndex != -1 && user.Index[distractBIndex] != -1)
            {
                plotExperienceLine(UserSelections.DistractBMode, distractBIndex);
            }

            int distractCIndex = UserSelections.getIndex(currentScene, UserSelections.DistractCMode);

            if (distractCIndex != -1 && user.Index[distractCIndex] != -1)
            {
                plotExperienceLine(UserSelections.DistractCMode, distractCIndex);
            }

            int distractDIndex = UserSelections.getIndex(currentScene, UserSelections.DistractDMode);

            if (distractDIndex != -1 && user.Index[distractDIndex] != -1)
            {
                plotExperienceLine(UserSelections.DistractDMode, distractDIndex);
            }
        }
コード例 #4
0
        private void ConfirmDeleteDataBtn_Click(object sender, RoutedEventArgs e)
        {
            Scene selectedScene = SceneComboBox.SelectedItem as Scene;
            Mode  selectedMode  = ModeComboBox.SelectedItem as Mode;

            if (selectedScene.SceneValue == -1 || selectedMode.ModeValue == -1)
            {
                DeleteTip.Text = "请选择正确的场景和模式";
                return;
            }

            bool?confirmResult = CustomMessageBox.Show
                                     ("Confirmation", "确定删除该条数据吗? " + selectedScene.SceneName + " " + selectedMode.ModeName);

            if (confirmResult == true)
            {
                bool deleteResult =
                    deleteData(UserSelections.getIndex(selectedScene.SceneValue, selectedMode.ModeValue));
                DeleteTip.Text = deleteResult ? "记录已成功删除" : "没有该条记录";
                refreshData();
            }
        }
コード例 #5
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();
            }
        }
コード例 #6
0
        private string getCheck(int scene, int mode)
        {
            int index = UserSelections.getIndex(scene, mode);

            return(PageList.Main.User.Index[index] == -1 ? "" : "√");
        }