private void LoadData1_Click(object sender, RoutedEventArgs e) { OpenFileDialog dlg = new OpenFileDialog(); dlg.DefaultExt = ".XML"; dlg.Title = "Select associated data file.."; dlg.InitialDirectory = "c:\\"; dlg.Filter = "XML Files|*.XML|All Files|*.*"; dlg.RestoreDirectory = true; if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK) { string selectedFileName = dlg.FileName; datadirectory1.Content = selectedFileName; xmlreader1 = new XMLReader(selectedFileName); System.Console.WriteLine("finish reading"); V1Name.Text = xmlreader1.Fileproperty.Filename; //System.Console.WriteLine("reader.Jointsdata[1].Hipangle = "+reader.Jointsdata[1].HipAngle); //mediaElement1.Play(); //initialiseDrawing(ellipses1, sCanvas1); //initialiseDrawing(ellipses1, sCanvas1, true); initialiseDrawing(ellipses1, sCanvas1_window, true); initialiseDrawing(ellipses1_side, sCanvas1, false); InitialiseLines1(sCanvas1); } }
private void drawSkeletons1_side(int framenumber, Ellipse[] ellipses1_side, XMLReader reader) { for (int i = 0; i < ellipses1_side.Length; i++) { //ellipses[i] = new Ellipse { Width = 20, Height = 20, Fill = System.Windows.Media.Brushes.SandyBrown }; ////skeletonCanvas in the UI //sCanvas1.Children.Add(ellipses[i]); switch (i) { case 0: Canvas.SetLeft(ellipses1_side[i], coordinateCovert_side1(reader.Jointsdata[framenumber].headZabs / 2, true, sCanvas1) - ellipses1_side[i].Width / 2); //System.Console.WriteLine("headY = " + coordinateCovert_side1(reader.Jointsdata[framenumber].headZabs / 2, true) ); Canvas.SetTop(ellipses1_side[i], coordinateCovert_side1(reader.Jointsdata[framenumber].headYabs / 2, false, sCanvas1) - ellipses1_side[i].Width / 2); break; case 1: Canvas.SetLeft(ellipses1_side[i], coordinateCovert_side1(reader.Jointsdata[framenumber].leftHandZabs / 2, true, sCanvas1) - ellipses1_side[i].Width / 2); //System.Console.WriteLine("headY = " + reader.Jointsdata[framenumber].headY / 2); Canvas.SetTop(ellipses1_side[i], coordinateCovert_side1(reader.Jointsdata[framenumber].leftHandYabs / 2, false, sCanvas1) - ellipses1_side[i].Width / 2); break; case 2: Canvas.SetLeft(ellipses1_side[i], coordinateCovert_side1(reader.Jointsdata[framenumber].leftshoulderZabs / 2, true, sCanvas1) - ellipses1_side[i].Width / 2); //System.Console.WriteLine("headY = " + reader.Jointsdata[framenumber].headY / 2); Canvas.SetTop(ellipses1_side[i], coordinateCovert_side1(reader.Jointsdata[framenumber].leftshoulderYabs / 2, false, sCanvas1) - ellipses1_side[i].Width / 2); break; case 3: Canvas.SetLeft(ellipses1_side[i], coordinateCovert_side1(reader.Jointsdata[framenumber].hipZabs / 2, true, sCanvas1) - ellipses1_side[i].Width / 2); //System.Console.WriteLine("headY = " + reader.Jointsdata[framenumber].headY / 2); Canvas.SetTop(ellipses1_side[i], coordinateCovert_side1(reader.Jointsdata[framenumber].hipYabs / 2, false, sCanvas1) - ellipses1_side[i].Width / 2); break; case 4: Canvas.SetLeft(ellipses1_side[i], coordinateCovert_side1(reader.Jointsdata[framenumber].leftKneeZabs / 2, true, sCanvas1) - ellipses1_side[i].Width / 2); //System.Console.WriteLine("headY = " + reader.Jointsdata[framenumber].headY / 2); Canvas.SetTop(ellipses1_side[i], coordinateCovert_side1(reader.Jointsdata[framenumber].leftKneeYabs / 2, false, sCanvas1) - ellipses1_side[i].Width / 2); break; case 5: Canvas.SetLeft(ellipses1_side[i], coordinateCovert_side1(reader.Jointsdata[framenumber].leftFootZabs / 2, true, sCanvas1) - ellipses1_side[i].Width / 2); //System.Console.WriteLine("headY = " + reader.Jointsdata[framenumber].headY / 2); Canvas.SetTop(ellipses1_side[i], coordinateCovert_side1(reader.Jointsdata[framenumber].leftFootYabs / 2, false, sCanvas1) - ellipses1_side[i].Width / 2); break; } } }
private void ResetLines2(int framenumber, XMLReader reader) { Shoulder_Hip2.X1 = (coordinateCovert_side1(reader.Jointsdata[framenumber].leftshoulderZabs / 2, true, sCanvas2)); Shoulder_Hip2.Y1 = (coordinateCovert_side1(reader.Jointsdata[framenumber].leftshoulderYabs / 2, false, sCanvas2)); Shoulder_Hip2.X2 = (coordinateCovert_side1(reader.Jointsdata[framenumber].hipZabs / 2, true, sCanvas2)); Shoulder_Hip2.Y2 = (coordinateCovert_side1(reader.Jointsdata[framenumber].hipYabs / 2, false, sCanvas2)); Shoulder_Hand2.X1 = (coordinateCovert_side1(reader.Jointsdata[framenumber].leftshoulderZabs / 2, true, sCanvas2)); Shoulder_Hand2.Y1 = (coordinateCovert_side1(reader.Jointsdata[framenumber].leftshoulderYabs / 2, false, sCanvas2)); Shoulder_Hand2.X2 = (coordinateCovert_side1(reader.Jointsdata[framenumber].leftHandZabs / 2, true, sCanvas2)); Shoulder_Hand2.Y2 = (coordinateCovert_side1(reader.Jointsdata[framenumber].leftHandYabs / 2, false, sCanvas2)); Hip_Knee2.X1 = (coordinateCovert_side1(reader.Jointsdata[framenumber].hipZabs / 2, true, sCanvas2)); Hip_Knee2.Y1 = (coordinateCovert_side1(reader.Jointsdata[framenumber].hipYabs / 2, false, sCanvas2)); Hip_Knee2.X2 = (coordinateCovert_side1(reader.Jointsdata[framenumber].leftKneeZabs / 2, true, sCanvas2)); Hip_Knee2.Y2 = (coordinateCovert_side1(reader.Jointsdata[framenumber].leftKneeYabs / 2, false, sCanvas2)); Knee_Foot2.X1 = (coordinateCovert_side1(reader.Jointsdata[framenumber].leftKneeZabs / 2, true, sCanvas2)); Knee_Foot2.Y1 = (coordinateCovert_side1(reader.Jointsdata[framenumber].leftKneeYabs / 2, false, sCanvas2)); Knee_Foot2.X2 = (coordinateCovert_side1(reader.Jointsdata[framenumber].leftFootZabs / 2, true, sCanvas2)); Knee_Foot2.Y2 = (coordinateCovert_side1(reader.Jointsdata[framenumber].leftFootYabs / 2, false, sCanvas2)); }
private void drawSkeletons1(int framenumber, Ellipse[] ellipses, XMLReader reader) { double shiftX = -20; double shiftY = -20; for (int i = 0; i < ellipses.Length; i++) { //ellipses[i] = new Ellipse { Width = 20, Height = 20, Fill = System.Windows.Media.Brushes.SandyBrown }; ////skeletonCanvas in the UI //sCanvas1.Children.Add(ellipses[i]); switch (i) { case 0: Canvas.SetLeft(ellipses[i], reader.Jointsdata[framenumber].headX * 0.75 - ellipses[i].Width / 2 + shiftX); //System.Console.WriteLine("headY = " + reader.Jointsdata[framenumber].headY * 0.75); Canvas.SetTop(ellipses[i], reader.Jointsdata[framenumber].headY * 0.75 - ellipses[i].Height / 2 + shiftY); break; case 1: Canvas.SetLeft(ellipses[i], reader.Jointsdata[framenumber].leftHandX * 0.75 - ellipses[i].Width / 2 + shiftX); Canvas.SetTop(ellipses[i], reader.Jointsdata[framenumber].leftHandY * 0.75 - ellipses[i].Height / 2 + shiftY); break; case 2: Canvas.SetLeft(ellipses[i], reader.Jointsdata[framenumber].rightHandX * 0.75 - ellipses[i].Width / 2 + shiftX); Canvas.SetTop(ellipses[i], reader.Jointsdata[framenumber].rightHandY * 0.75 - ellipses[i].Height / 2 + shiftY); break; case 3: Canvas.SetLeft(ellipses[i], reader.Jointsdata[framenumber].leftshoulderX * 0.75 - ellipses[i].Width / 2 + shiftX); Canvas.SetTop(ellipses[i], reader.Jointsdata[framenumber].leftshoulderY * 0.75 - ellipses[i].Height / 2 + shiftY); break; case 4: Canvas.SetLeft(ellipses[i], reader.Jointsdata[framenumber].rightshoulderX * 0.75 - ellipses[i].Width / 2 + shiftX); Canvas.SetTop(ellipses[i], reader.Jointsdata[framenumber].rightshoulderY * 0.75 - ellipses[i].Height / 2 + shiftY); break; case 5: Canvas.SetLeft(ellipses[i], reader.Jointsdata[framenumber].hipX * 0.75 - ellipses[i].Width / 2 + shiftX); Canvas.SetTop(ellipses[i], reader.Jointsdata[framenumber].hipY * 0.75 - ellipses[i].Height / 2 + shiftY); break; case 6: Canvas.SetLeft(ellipses[i], reader.Jointsdata[framenumber].leftKneeX * 0.75 - ellipses[i].Width / 2 + shiftX); Canvas.SetTop(ellipses[i], reader.Jointsdata[framenumber].leftKneeY * 0.75 - ellipses[i].Height / 2 + shiftY); break; case 7: Canvas.SetLeft(ellipses[i], reader.Jointsdata[framenumber].rightKneeX * 0.75 - ellipses[i].Width / 2 + shiftX); Canvas.SetTop(ellipses[i], reader.Jointsdata[framenumber].rightKneeY * 0.75 - ellipses[i].Height / 2 + shiftY); break; case 8: Canvas.SetLeft(ellipses[i], reader.Jointsdata[framenumber].leftFootX * 0.75 - ellipses[i].Width / 2 + shiftX); Canvas.SetTop(ellipses[i], reader.Jointsdata[framenumber].leftFootY * 0.75 - ellipses[i].Height / 2 + shiftY); break; case 9: Canvas.SetLeft(ellipses[i], reader.Jointsdata[framenumber].rightFootX * 0.75 - ellipses[i].Width / 2 + shiftX); Canvas.SetTop(ellipses[i], reader.Jointsdata[framenumber].rightFootY * 0.75 - ellipses[i].Height / 2 + shiftY); break; } } }
private void LoadData2_Click(object sender, RoutedEventArgs e) { OpenFileDialog dlg = new OpenFileDialog(); dlg.DefaultExt = ".XML"; dlg.Title = "Select associated data file.."; dlg.InitialDirectory = "c:\\"; dlg.Filter = "XML Files|*.XML|All Files|*.*"; dlg.RestoreDirectory = true; if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK) { string selectedFileName = dlg.FileName; datadirectory2.Content = selectedFileName; xmlreader2 = new XMLReader(selectedFileName); V2Name.Text = xmlreader2.Fileproperty.Filename; //System.Console.WriteLine("xmlreader2.Jointsdata[0].Hipangle =" + xmlreader2.Jointsdata[0].HipAngle); //System.Console.WriteLine("xmlreader2.Jointsdata[1].Hipangle = " + xmlreader2.Jointsdata[1].HipAngle); //mediaElement1.Play(); initialiseDrawing(ellipses2, sCanvas2_window, true); initialiseDrawing(ellipses2_side, sCanvas2, false); InitialiseLines2(sCanvas2); } }