void draw_smoothed_mean_cycle_chart(registrator_cls registrator, OxyPlot.Wpf.PlotView plotview, PlotModel aux_plotmodel) { LineSeries mean_graph = new LineSeries(); mean_graph.Color = OxyColor.FromRgb(255, 0, 0); double value, old_value; old_value = registrator.get_filtered_mean_cycle_data(0); for (int i = 0; i < registrator.base_length_value; i++) { // draw stroke of mean cycle graph value = registrator.get_smoothed_cycle_data(i); if (!Double.IsNaN(value)) { mean_graph.Points.Add(new DataPoint(i * 0.025, value)); } else { mean_graph.Points.Add(new DataPoint(i * 0.025, old_value)); } } aux_plotmodel.Series.Add(mean_graph); plotview.Model = aux_plotmodel; plotview.UpdateLayout(); }
private void draw_charts_of_smoothed_elementary_cycles(registrator_cls registrator, OxyPlot.Wpf.PlotView plotview, PlotModel aux_plotmodel) { int counter = 0; LineSeries[] smoothed_graphs = new LineSeries[registrator.list_of_cycles.Count]; foreach (registrator_cls.single_cycle_cls item in registrator.list_of_cycles) { smoothed_graphs[counter] = new LineSeries(); smoothed_graphs[counter].Color = OxyColor.FromRgb(0, 0, 0); if (Math.Abs(item.length - registrator.Base_length_value) <= 1) { for (int i = 0; i < registrator.base_length_value; i++) { // draw stroke of cycle double value; if ((item.length < registrator.Base_length_value) && (i >= item.length)) { value = registrator.Storage.get_data(item.start_index + item.length - 1); } else { value = registrator.Storage.get_smoothed_data(item.start_index + i); } smoothed_graphs[counter].Points.Add(new DataPoint(i * 0.025, value)); } aux_plotmodel.Series.Add(smoothed_graphs[counter]); counter++; } } //plotview.Model = aux_plotmodel; //plotview.UpdateLayout(); }
// constructor public MainWindow() { InitializeComponent(); string Host = System.Net.Dns.GetHostName(); debug_info_panel.Content += "my host -> " + Host + "\r\n"; string IP1 = System.Net.Dns.GetHostByName(Host).AddressList[0].ToString(); debug_info_panel.Content += "my ip -> " + IP1 + "\r\n"; //local_kinematics_endpoint.Address = IPAddress.Parse("192.168.1.1"); local_kinematics_endpoint.Address = IPAddress.Parse(IP1); local_kinematics_endpoint.Port = 112; kinematics_listener = new UdpClient(); try { kinematics_listener.Client.Bind(local_kinematics_endpoint); } catch (Exception e) { } raw_data = new raw_kinematics_data_cls(); model = new model_cls(raw_data); // fill model model.add_channel(new angle_cls(model.Segments[1], model.Segments[2])); model.add_channel(new angle_cls(model.Segments[1], model.Segments[3])); model.add_channel(new angle_cls(model.Segments[1], model.Segments[4])); model.add_channel(new angle_cls(model.Segments[2], model.Segments[3])); model.add_channel(new angle_cls(model.Segments[2], model.Segments[4])); model.add_channel(new angle_cls(model.Segments[3], model.Segments[4])); histogram = new histogram_cls(160, 13, 40); // object just to run tests //metronomeThread = new Thread(new ThreadStart(this.metronome_thread_method)); //metronomeThread.IsBackground = true; stop_metronome_button.IsEnabled = false; //metronomeThread.Start(); angle_chart0 = new angle_graph_cls(angle_0_graph_canvas, chart0_legend_label); angle_chart1 = new angle_graph_cls(angle_1_graph_canvas, chart1_legend_label); angle_chart2 = new angle_graph_cls(angle_2_graph_canvas, chart2_legend_label); //mean_cycle_chart0 = new mean_cycle_graph_cls(channel_0_mean_graph_canvas); //mean_cycle_chart1 = new mean_cycle_graph_cls(channel_1_mean_graph_canvas); //mean_cycle_chart2 = new mean_cycle_graph_cls(channel_2_mean_graph_canvas); registrator0 = new registrator_cls(storage0, metronom); registrator1 = new registrator_cls(storage1, metronom); registrator2 = new registrator_cls(storage2, metronom); //windowsFormsHost.Child = userControl_unity3d; //MyPSI = new ProcessStartInfo(unity_game_path); //unity_game_process = new Process(); //unity_game_process.StartInfo = MyPSI; //unity_game_process.Start(); //System.IntPtr handle1 = unity_game_process.MainWindowHandle; //System.IntPtr handle2 = userControl_unity3d.Handle; //SetParent(handle1, handle2); //(windowsFormsHost.Child as System.Windows.Forms.WebBrowser).Navigate("file:///C:/workspace/unity_workspace/skeleton/skeleton_00_01/skeleton_00_01/web_play/web_play.html"); }// end constructor