private void skeletonFittingCanvas_MouseDown(object sender, MouseEventArgs e) { SkeletonAnnotation an = GetEditingAnnotation(); if (an == null) { return; } PointF convLocation = InvertCoordinate(e.Location, skeletonFittingCanvasTransform); if (e.Button == System.Windows.Forms.MouseButtons.Left) { // joint if (jointAddRadioButton.Checked) { AssignJointAnnotation(an, new JointAnnotation(jointNameTextBox.Text, convLocation)); } if (jointSelectRadioButton.Checked) { JointAnnotation joint = an.GetNearestJoint(e.Location, 20, skeletonFittingCanvasTransform); SelectJointAnnotation(an, joint); if (joint != null) { jointNameTextBox.Text = joint.name; } } // bone if (boneAddRadioButton.Checked) { var joint = an.GetNearestJoint(e.Location, 20, skeletonFittingCanvasTransform); if (joint != null) { CreateOrCompleteEditingBone(an, joint); } else { DeleteEditingBone(); } } if (boneSelectRadioButton.Checked) { SelectBoneAnnotation(an, an.GetNearestBone(e.Location, 20, skeletonFittingCanvasTransform)); } skeletonFittingCanvas.Invalidate(); } // 画像をずらす if (e.Button == System.Windows.Forms.MouseButtons.Right) { if (tabControl.SelectedTab.Name == "tabSkeletonFitting") { skeletonFittingCanvasPrevMousePos = e.Location; } } }
private void pictureBox1_MouseDown(object sender, MouseEventArgs e) { if (addRadioButton.Checked) { AddJointAnnotation(new JointAnnotation(jointNameTextBox.Text, Form1.InvertCoordinate(e.Location, transform))); UpdateTreeView(); } if (selectRadioButton.Checked) { SelectJointAnnotation(an.GetNearestJoint(Form1.InvertCoordinate(e.Location, transform), 20, new Matrix())); if (selectJoint != null) { UpdateJointNameTextBox(selectJoint.name); } } if (an != null) { pictureBox1.Invalidate(); } }
private void skeletonFittingCanvas_MouseClick(object sender, MouseEventArgs e) { if (e.Button == System.Windows.Forms.MouseButtons.Right) { SkeletonAnnotation an = GetEditingAnnotation(); if (jointSelectRadioButton.Checked || jointAddRadioButton.Checked) { DeleteJointAnnotation(an, an.GetNearestJoint(e.Location, 20, skeletonFittingCanvasTransform)); } if (boneSelectRadioButton.Checked || boneAddRadioButton.Checked) { DeleteBoneAnnotation(an, an.GetNearestBone(e.Location, 20, skeletonFittingCanvasTransform)); } } }
private void skeletonFittingCanvas_MouseMove(object sender, MouseEventArgs e) { SkeletonAnnotation an = GetEditingAnnotation(); if (an == null) { return; } if (jointSelectRadioButton.Checked || jointAddRadioButton.Checked || boneAddRadioButton.Checked) { nearestJoint = an.GetNearestJoint(e.Location, 20, skeletonFittingCanvasTransform); } if (boneSelectRadioButton.Checked || boneAddRadioButton.Checked) { nearestBone = an.GetNearestBone(e.Location, 20, skeletonFittingCanvasTransform); } PointF convLocation = InvertCoordinate(e.Location, skeletonFittingCanvasTransform); if (addingBone != null) { UpdateEditingBone(an, new JointAnnotation("[dummy]", convLocation)); } skeletonFittingCanvas.Invalidate(); // 画像をずらす if (e.Button == System.Windows.Forms.MouseButtons.Right) { if (tabControl.SelectedTab.Name == "tabSkeletonFitting") { PointF pos = e.Location; skeletonFittingCanvasPan(pos.X - skeletonFittingCanvasPrevMousePos.X, pos.Y - skeletonFittingCanvasPrevMousePos.Y); skeletonFittingCanvasPrevMousePos = pos; } } }