Esempio n. 1
0
        internal void centerAnatomy(AnatomyContextWindow requestingWindow)
        {
            AxisAlignedBox  boundingBox = requestingWindow.Anatomy.WorldBoundingBox;
            SceneViewWindow window      = sceneViewController.ActiveWindow;

            if (window != null)
            {
                CameraPosition undoPosition = window.createCameraPosition();

                Vector3 center = boundingBox.Center;

                float nearPlane   = window.Camera.getNearClipDistance();
                float theta       = window.Camera.getFOVy();
                float aspectRatio = window.Camera.getAspectRatio();
                if (aspectRatio < 1.0f)
                {
                    theta *= aspectRatio;
                }

                Vector3 translation = center;
                Vector3 direction   = (window.Translation - window.LookAt).normalized();
                translation += direction * boundingBox.DiagonalDistance / (float)Math.Tan(theta);
                CameraPosition cameraPosition = new CameraPosition()
                {
                    Translation = translation,
                    LookAt      = center
                };

                window.setPosition(cameraPosition, MedicalConfig.CameraTransitionTime);

                window.pushUndoState(undoPosition);
            }
        }
Esempio n. 2
0
 public CommandButton(Widget parentWidget, AnatomyContextWindow window)
 {
     //Note that the height on this button is weird and must be set 3 pixels larger than the actual desired size, the cause of this is unknown
     button = (Button)parentWidget.createWidgetT("Button", "Medical.AnatomyContextWindowCommandButton", 0, 0, parentWidget.Width, ScaleHelper.Scaled(29), Align.Default, "");
     button.MouseButtonClick         += button_MouseButtonClick;
     button.ForwardMouseWheelToParent = true;
     this.window = window;
 }
Esempio n. 3
0
 public void Dispose()
 {
     if (currentAnatomyWindow != null)
     {
         currentAnatomyWindow.Dispose();
         currentAnatomyWindow = null;
     }
     liveThumbnailController.Dispose();
 }
Esempio n. 4
0
 public void sceneUnloading()
 {
     foreach (AnatomyContextWindow window in pinnedWindows)
     {
         window.Dispose();
     }
     pinnedWindows.Clear();
     if (currentAnatomyWindow != null)
     {
         currentAnatomyWindow.Dispose();
         currentAnatomyWindow = null;
     }
 }
Esempio n. 5
0
        public AnatomyContextWindow showWindow(Anatomy anatomy, IntVector2 position, IntCoord deadZone)
        {
            if (currentAnatomyWindow == null)
            {
                currentAnatomyWindow            = new AnatomyContextWindow(this, layerController);
                currentAnatomyWindow.SmoothShow = true;
            }
            currentAnatomyWindow.Anatomy = anatomy;
            currentAnatomyWindow.Visible = true;

            IntCoord windowCoord = new IntCoord(position.x, position.y, currentAnatomyWindow.Width, currentAnatomyWindow.Height);

            currentAnatomyWindow.Position = calculateChildPosition(anatomyFinder.DeadZone, windowCoord, anatomyFinder.TriggeredSelection);

            currentAnatomyWindow.ensureVisible();
            currentAnatomyWindow.bringToFront();

            return(currentAnatomyWindow);
        }
Esempio n. 6
0
 /// <summary>
 /// Callback from a context dialog to show the anatomy finder if its show button was pressed.
 /// </summary>
 /// <param name="x"></param>
 /// <param name="y"></param>
 internal void showAnatomyFinderFromContextDialog(AnatomyContextWindow window)
 {
     if (anatomyFinder.AllowAutoPosition)
     {
         IntCoord deadzone           = new IntCoord(window.AbsoluteLeft, window.AbsoluteTop, window.Width, window.Height);
         IntCoord anatomyFinderCoord = new IntCoord(deadzone.Right, deadzone.top, anatomyFinder.Width, anatomyFinder.Height);
         bool     eitherSide         = false;
         if (anatomyFinder.Visible)
         {
             if (anatomyFinder.Left < deadzone.left)
             {
                 anatomyFinderCoord.left = anatomyFinder.AbsoluteLeft;
             }
             eitherSide = true;
         }
         anatomyFinder.Position = calculateChildPosition(deadzone, anatomyFinderCoord, eitherSide);
     }
     anatomyFinder.ensureVisible();
     anatomyFinder.Visible = true;
     anatomyFinder.bringToFront();
 }
Esempio n. 7
0
        internal AnatomyContextWindowLiveThumbHost getThumbnail(AnatomyContextWindow window)
        {
            Anatomy anatomy = window.Anatomy;
            Radian  theta   = sceneViewController.ActiveWindow.Camera.getFOVy();

            //Generate thumbnail
            AxisAlignedBox boundingBox = anatomy.WorldBoundingBox;
            Vector3        center      = boundingBox.Center;

            Vector3 translation = center;
            Vector3 direction   = anatomy.PreviewCameraDirection;

            translation += direction * boundingBox.DiagonalDistance / (float)Math.Tan(theta);

            LayerState layers = new LayerState(anatomy.TransparencyNames, 1.0f);

            //Create a new thumb host or update an existing one
            if (window.ThumbHost == null)
            {
                AnatomyContextWindowLiveThumbHost host = new AnatomyContextWindowLiveThumbHost(window)
                {
                    Layers      = layers,
                    Translation = translation,
                    LookAt      = center
                };
                liveThumbnailController.addThumbnailHost(host);
                liveThumbnailController.setVisibility(host, true);
                return(host);
            }
            else
            {
                window.ThumbHost.Translation = translation;
                window.ThumbHost.LookAt      = center;
                window.ThumbHost.Layers      = layers;
                liveThumbnailController.updateCameraAndLayers(window.ThumbHost);
                return(window.ThumbHost);
            }
        }
Esempio n. 8
0
 internal void alertWindowPinned(AnatomyContextWindow window)
 {
     currentAnatomyWindow = null;
     pinnedWindows.Add(window);
 }
Esempio n. 9
0
 internal void returnThumbnail(AnatomyContextWindow window)
 {
     liveThumbnailController.removeThumbnailHost(window.ThumbHost);
 }
Esempio n. 10
0
 internal void alertPinnedWindowClosed(AnatomyContextWindow window)
 {
     pinnedWindows.Remove(window);
 }
 public AnatomyContextWindowLiveThumbHost(AnatomyContextWindow window)
 {
     this.window = window;
 }