Beispiel #1
0
        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();
        }
Beispiel #2
0
        private void NewCmdExecuted(object sender, ExecutedRoutedEventArgs e)
        {
            var view = new PerspectiveView(WorldView.WorldViewModel);

            // TODO: this is a bit spaghetti?
            WorldView.WorldViewModel.CurrentPerspective = view.Perspective;
            view.ShowAsDocument(dockManager);
            view.Focus();
        }
Beispiel #3
0
        public void ByEyePointAndTarget_BadArgs1()
        {
            var eye    = Point.ByCoordinates(100, 100, 100);
            var target = Point.ByCoordinates(0, 1, 2);
            var name   = "treeView";

            Assert.Throws(typeof(ArgumentException), () =>
            {
                PerspectiveView.ByEyePointAndTarget(eye, target, eye, name, false);
            });
        }
Beispiel #4
0
 public static View3D Wrap(Autodesk.Revit.DB.View3D view, bool isRevitOwned)
 {
     if (view.IsPerspective)
     {
         return(PerspectiveView.FromExisting(view, isRevitOwned));
     }
     else
     {
         return(AxonometricView.FromExisting(view, isRevitOwned));
     }
 }
Beispiel #5
0
        public static AbstractView3D Wrap(Autodesk.Revit.DB.View3D view, bool isRevitOwned)
        {
            if (view.IsTemplate)
            {
                return(Revit.Elements.Views.View3D.FromExisting(view, isRevitOwned));
            }
            if (view.IsPerspective)
            {
                return(PerspectiveView.FromExisting(view, isRevitOwned));
            }

            return(AxonometricView.FromExisting(view, isRevitOwned));
        }
Beispiel #6
0
        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();
        }
Beispiel #7
0
        public void ByEyePointTargetAndElement_BadArgs()
        {
            var eye    = Point.ByCoordinates(100, 100, 100);
            var target = Point.ByCoordinates(0, 1, 2);
            var name   = "treeView";

            var famSym  = FamilySymbol.ByName("Kousa Dogwood - 10'");
            var pt      = Point.ByCoordinates(0, 1, 2);
            var famInst = FamilyInstance.ByPoint(famSym, pt);

            Assert.Throws(typeof(ArgumentNullException), () => PerspectiveView.ByEyePointTargetAndElement(null, target, famInst, name, false));
            Assert.Throws(typeof(ArgumentNullException), () => PerspectiveView.ByEyePointTargetAndElement(eye, null, famInst, name, false));
            Assert.Throws(typeof(ArgumentNullException), () => PerspectiveView.ByEyePointTargetAndElement(eye, target, null, name, false));
            Assert.Throws(typeof(ArgumentNullException), () => PerspectiveView.ByEyePointTargetAndElement(eye, target, famInst, null, false));
        }
Beispiel #8
0
        public void ByEyePointTargetAndBoundingBox_ValidArgs()
        {
            var eye    = Point.ByCoordinates(100, 100, 100);
            var target = Point.ByCoordinates(0, 1, 2);
            var name   = "treeView";

            var famSym  = FamilySymbol.ByName("Kousa Dogwood - 10'");
            var pt      = Point.ByCoordinates(0, 1, 2);
            var famInst = FamilyInstance.ByPoint(famSym, pt);

            var view = PerspectiveView.ByEyePointTargetAndBoundingBox(eye, target, famInst.BoundingBox, name, false);

            Assert.NotNull(view);
            Assert.IsTrue(DocumentManager.Instance.ElementExistsInDocument(
                              new ElementUUID(view.InternalElement.UniqueId)));
        }
Beispiel #9
0
        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();
        }
Beispiel #10
0
        public void ByEyePointAndTarget_ValidAbstractElement()
        {
            var eye    = Point.ByCoordinates(100, 100, 100);
            var target = Point.ByCoordinates(0, 1, 2);
            var name   = "treeView";

            var famTyp  = FamilyType.ByName("Kousa Dogwood - 10'");
            var pt      = Point.ByCoordinates(0, 1, 2);
            var famInst = FamilyInstance.ByPoint(famTyp, pt);

            object element = famInst;
            var    view    = PerspectiveView.ByEyePointAndTarget(eye, target, element, name, false);

            Assert.NotNull(view);
            Assert.IsTrue(DocumentManager.Instance.ElementExistsInDocument(
                              new ElementUUID(view.InternalElement.UniqueId)));
        }
Beispiel #11
0
        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();
        }
Beispiel #12
0
        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;
            }
        }
Beispiel #13
0
 private void DeleteClick(object sender, RoutedEventArgs e)
 {
     PerspectiveView.DeleteSelectedBulkhead();
 }
Beispiel #14
0
        private void InsertClick(object sender, RoutedEventArgs e)
        {
            UI_Params values = (UI_Params)this.FindResource("Curr_UI_Params");

            PerspectiveView.InsertBulkhead(values.NewBulkheadLoc);
        }