private void RotateClick(object sender, RoutedEventArgs e) { Button button = (Button)sender; if ((string)button.Content == "+X") { PerspectiveView.editableHull.Rotate(5, 0, 0); } else if ((string)button.Content == "-X") { PerspectiveView.editableHull.Rotate(-5, 0, 0); } else if ((string)button.Content == "+Y") { PerspectiveView.editableHull.Rotate(0, 5, 0); } else if ((string)button.Content == "-Y") { PerspectiveView.editableHull.Rotate(0, -5, 0); } else if ((string)button.Content == "+Z") { PerspectiveView.editableHull.Rotate(0, 0, 5); } else if ((string)button.Content == "-Z") { PerspectiveView.editableHull.Rotate(0, 0, -5); } PerspectiveView.perspective = HullControl.PerspectiveType.PERSPECTIVE; PerspectiveView.InvalidateVisual(); }
private void UpdateViews() { TopView.Perspective = HullControl.PerspectiveType.TOP; SideView.Perspective = HullControl.PerspectiveType.SIDE; FrontView.Perspective = HullControl.PerspectiveType.FRONT; // Need to invoke the setter to regenerate the hull. PerspectiveView.Perspective = PerspectiveView.Perspective; TopView.InvalidateVisual(); FrontView.InvalidateVisual(); SideView.InvalidateVisual(); PerspectiveView.InvalidateVisual(); }
private void UpdateViews() { EditableHull topView = new EditableHull(myHull); topView.Rotate(0, 90, 90); TopView.editableHull = topView; TopView.perspective = HullControl.PerspectiveType.TOP; EditableHull sideView = new EditableHull(myHull); sideView.Rotate(0, 90, 180); SideView.editableHull = sideView; SideView.perspective = HullControl.PerspectiveType.SIDE; EditableHull frontView = new EditableHull(myHull); frontView.Rotate(0, 0, 180); FrontView.editableHull = frontView; FrontView.perspective = HullControl.PerspectiveType.FRONT; EditableHull perspectiveView = new EditableHull(myHull); switch (PerspectiveView.perspective) { case HullControl.PerspectiveType.FRONT: perspectiveView.Rotate(0, 0, 180); break; case HullControl.PerspectiveType.TOP: perspectiveView.Rotate(0, 90, 90); break; case HullControl.PerspectiveType.SIDE: perspectiveView.Rotate(0, 90, 180); break; case HullControl.PerspectiveType.PERSPECTIVE: perspectiveView.Rotate(10, 30, 190); break; } PerspectiveView.editableHull = perspectiveView; TopView.InvalidateVisual(); FrontView.InvalidateVisual(); SideView.InvalidateVisual(); PerspectiveView.InvalidateVisual(); }
private void HullMouseDoubleClick(object sender, MouseButtonEventArgs e) { PerspectiveView.IsEditable = false; if (sender == FrontView) { PerspectiveView.perspective = HullControl.PerspectiveType.FRONT; } else if (sender == TopView) { PerspectiveView.perspective = HullControl.PerspectiveType.TOP; } else if (sender == SideView) { PerspectiveView.perspective = HullControl.PerspectiveType.SIDE; } UpdateViews(); PerspectiveView.IsEditable = true; PerspectiveView.InvalidateVisual(); }
private void HullMouseMove(object sender, MouseEventArgs e) { if (e.MiddleButton == MouseButtonState.Pressed || (e.RightButton == MouseButtonState.Pressed && (shifted || ctrl))) { Point currentPos = e.GetPosition(PerspectiveView); if (!movementStopped) { Vector diff = prevPos - currentPos; if (shifted || e.MiddleButton == MouseButtonState.Pressed) { PerspectiveView.editableHull.Rotate(-diff.Y, diff.X, 0); } else if (ctrl) { PerspectiveView.editableHull.Rotate(0, 0, diff.X); } PerspectiveView.InvalidateVisual(); } prevPos = currentPos; movementStopped = false; } }