示例#1
0
        void showAllVisibleAnatomy()
        {
            AxisAlignedBox  boundingBox  = anatomyController.VisibleObjectsBoundingBox;
            SceneViewWindow activeWindow = sceneViewController.ActiveWindow;
            Vector3         center       = boundingBox.Center;

            float nearPlane   = activeWindow.Camera.getNearClipDistance();
            float theta       = activeWindow.Camera.getFOVy();
            float aspectRatio = activeWindow.Camera.getAspectRatio();

            if (aspectRatio < 1.0f)
            {
                theta *= aspectRatio;
            }

            Vector3 translation      = center;
            Vector3 direction        = (activeWindow.Translation - activeWindow.LookAt).normalized();
            float   diagonalDistance = boundingBox.DiagonalDistance;

            if (diagonalDistance > float.Epsilon)
            {
                translation += direction * diagonalDistance / (float)Math.Tan(theta);

                CameraPosition undoPosition = activeWindow.createCameraPosition();
                activeWindow.setPosition(new CameraPosition()
                {
                    Translation = translation,
                    LookAt      = center
                }, MedicalConfig.CameraTransitionTime);
                activeWindow.pushUndoState(undoPosition);
            }
        }
示例#2
0
 void window_RenderingEnded(SceneViewWindow window, bool currentCameraRender)
 {
     if (visible && currentCameraRender)
     {
         sceneNode.setVisible(false);
     }
 }
示例#3
0
        public EditorWrapper()
        {
            binaryLoader = new BinaryLoader_Wrapper();
            var r = binaryLoader.InitLoader("data.dat", LoaderMode.EDIT);

            if (r.IsError())
            {
                r.ShowError(MessageBoxButtons.OK, MessageBoxIcon.Warning, "File: data.dat");
            }
            resourceHandler = new ResourceHandler(binaryLoader);
            renderWindow    = new Forms.RenderWindow(this);

            managers.entityManager    = new EntityManager();
            managers.transformManager = new TransformManager(managers.entityManager);
            managers.sceneManager     = new SceneManager(managers.entityManager, managers.transformManager);

            fileRegisterWindow = new FileRegisterWindow(this);

            entityViewWindow = new EntityViewWindow(this);

            sceneViewWindow = new SceneViewWindow(this);

            resourceHandlerWindow = new ResourceHandlerWindow(this);

            resourceScriptWindow = new ResourceScriptWindow(this);

            SavedEvent();
        }
示例#4
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);
            }
        }
 private void SceneViewController_ActiveWindowChanged(SceneViewWindow window)
 {
     if (window != null)
     {
         fovyEdit.FloatValue = window.FovY.Degrees;
     }
 }
示例#6
0
 void window_RenderingStarted(SceneViewWindow window, bool currentCameraRender)
 {
     if (visible && currentCameraRender)
     {
         sceneNode.setVisible(true);
         sceneNode.setOrientation(window.Orientation);
     }
 }
        public void applyCameraPosition(CameraPosition cameraPosition, float duration)
        {
            SceneViewWindow window = standaloneController.SceneViewController.ActiveWindow;

            if (window != null)
            {
                window.setPosition(cameraPosition, duration);
            }
        }
示例#8
0
 void sceneViewController_WindowCreated(SceneViewWindow window)
 {
     if (!TransparencyController.hasTransparencyState(window.CurrentTransparencyState))
     {
         TransparencyController.createTransparencyState(window.CurrentTransparencyState);
     }
     window.RenderingStarted += window_RenderingStarted;
     window.MadeActive       += window_MadeActive;
 }
        public MyGUITextDisplay(MyGUITextDisplayFactory textFactory, SceneViewWindow sceneWindow)
            : base("Medical.GUI.Timeline.TextDisplay.MyGUITextDisplay.layout")
        {
            this.textFactory     = textFactory;
            this.sceneWindow     = sceneWindow;
            sceneWindow.Resized += sceneWindow_Resized;

            widget.Visible = false;
            textBox        = (EditBox)widget.findWidget("TextBox");
        }
示例#10
0
    static void Init()
    {
        // EditorWindow.GetWindow() will return the open instance of the specified window or create a new
        // instance if it can't find one. The second parameter is a flag for creating the window as a
        // Utility window; Utility windows cannot be docked like the Scene and Game view windows.

        SceneViewWindow window = EditorWindow.GetWindow(typeof(SceneViewWindow), false, "Scene View") as SceneViewWindow;

        window.position = new Rect(window.position.xMin + 100f, window.position.yMin + 100f, 200f, 400f);
    }
示例#11
0
        private Ray3 getCameraRay(int x, int y)
        {
            SceneViewWindow activeWindow = sceneViewController.ActiveWindow;

            if (activeWindow != null)
            {
                return(activeWindow.getCameraToViewportRayScreen(x, y));
            }
            return(new Ray3());
        }
示例#12
0
        private void PerformRemove()
        {
            // OnRemove virtual callback.
            OnRemove();

            // Remove all windows that hasn't been closed.
            SceneViewWindow.CloseAllWindows(this);

            // Clear visualized selections for this tool.
            ClearVisualizedSelection();

            // Remove all key handlers that hasn't been removed.
            var keyHandlerNames = m_keyHandlers.Keys.ToArray();

            foreach (var keyHandlerName in keyHandlerNames)
            {
                RemoveKeyHandler(keyHandlerName);
            }

            // Remove all visual primitives that hasn't been removed.
            var visualPrimitiveNames = m_visualPrimitives.Keys.ToArray();

            foreach (var visualPrimitiveName in visualPrimitiveNames)
            {
                RemoveVisualPrimitive(visualPrimitiveName);
            }

            // Remove all editors that hasn't been removed.
            var editorTargets = m_editors.Keys.ToArray();

            foreach (var editorTarget in editorTargets)
            {
                RemoveEditor(editorTarget);
            }

            // Remove us from our parent.
            if (m_parent != null)
            {
                m_parent.m_children.Remove(this);
            }
            m_parent = null;

            // Remove children.
            var children = m_children.ToArray();

            foreach (var child in children)
            {
                child.PerformRemove();
            }

            if (m_hideDefaultState != null)
            {
                m_hideDefaultState.OnRemove();
            }
        }
        void item_MouseButtonClick(Widget source, EventArgs e)
        {
            SceneViewWindow window = sceneViewController.ActiveWindow;

            if (window != null)
            {
                window.RenderingMode = (RenderingMode)source.UserObject;
            }
            modeMenu.setVisibleSmooth(false);
            fireItemClosed();
        }
        public MyGUIImageDisplay(MyGUIImageDisplayFactory displayFactory, SceneViewWindow sceneWindow)
            : base("Medical.GUI.Timeline.ImageDisplay.MyGUIImageDisplay.layout")
        {
            this.displayFactory  = displayFactory;
            this.sceneWindow     = sceneWindow;
            sceneWindow.Resized += sceneWindow_Resized;

            widget.Visible = false;
            imageBox       = widget.findWidget("ImageBox") as ImageBox;
            SuppressLayout = false;
        }
        public void applyBookmark(Bookmark bookmark)
        {
            SceneViewWindow window             = standaloneController.SceneViewController.ActiveWindow;
            LayerState      undoLayers         = LayerState.CreateAndCapture();
            CameraPosition  undoCameraPosition = window.createCameraPosition();

            window.setPosition(bookmark.CameraPosition, MedicalConfig.CameraTransitionTime);
            bookmark.Layers.timedApply(MedicalConfig.CameraTransitionTime);
            standaloneController.LayerController.pushUndoState(undoLayers);
            window.pushUndoState(undoCameraPosition);
        }
示例#16
0
        //void applyButton_MouseButtonClick(Widget source, EventArgs e)
        //{
        //    int numImagesToUpdate;
        //    if (int.TryParse(numToUpdateEdit.Caption, out numImagesToUpdate))
        //    {
        //        LiveThumbnailUpdater.NumImagesToUpdate = numImagesToUpdate;
        //    }
        //    double secondsToSleep;
        //    if (double.TryParse(secondsToSleepEdit.Caption, out secondsToSleep))
        //    {
        //        LiveThumbnailUpdater.SecondsToSleep = secondsToSleep;
        //    }
        //}

        void addButton_MouseButtonClick(Widget source, EventArgs e)
        {
            SceneViewWindow activeWindow = sceneViewController.ActiveWindow;
            LayerState      layers       = new LayerState();

            layers.captureState();

            ButtonGridItem item = buttonGrid.addItem("Main", count++.ToString());

            buttonGrid.resizeAndLayout(window.ClientWidget.Width);
            liveThumbHost.itemAdded(item, layers, activeWindow.Translation, activeWindow.LookAt);
        }
示例#17
0
 public override void editing()
 {
     if (TimelineController != null)
     {
         SceneViewWindow window = TimelineController.SceneViewController.ActiveWindow;
         if (window != null)
         {
             CameraPosition undo = window.createCameraPosition();
             window.setPosition(CameraPosition, MedicalConfig.CameraTransitionTime);
             window.pushUndoState(undo);
         }
     }
 }
示例#18
0
        public override void capture()
        {
            SceneViewWindow currentWindow = TimelineController.SceneViewController.ActiveWindow;

            CameraPosition.Translation = currentWindow.Translation;
            CameraPosition.LookAt      = currentWindow.LookAt;
            CameraName = currentWindow.Name;

            //Make the include point projected out to the lookat location
            currentWindow.calculateIncludePoint(CameraPosition);

            fireDataNeedsRefresh();
        }
        public CameraPosition getCurrentCameraPosition()
        {
            SceneViewWindow window = standaloneController.SceneViewController.ActiveWindow;

            if (window != null)
            {
                CameraPosition position = new CameraPosition();
                position.Translation = window.Translation;
                position.LookAt      = window.LookAt;
                return(position);
            }
            return(null);
        }
        public Bookmark createBookmark(String name)
        {
            LayerState layerState = new LayerState();

            layerState.captureState();
            SceneViewWindow window   = standaloneController.SceneViewController.ActiveWindow;
            Bookmark        bookmark = new Bookmark(name, window.Translation, window.LookAt, layerState);

            saveBookmark(bookmark, currentPath, bookmarksResourceProvider);

            fireBookmarkAdded(bookmark);

            return(bookmark);
        }
示例#21
0
        void renderButton_MouseButtonClick(Widget source, EventArgs e)
        {
            closeCurrentImage();
            SceneViewWindow drawingWindow = sceneViewController.ActiveWindow;

            if (drawingWindow != null)
            {
                ImageRendererProperties imageProperties = new ImageRendererProperties();
                imageProperties.Width  = RenderWidth;
                imageProperties.Height = RenderHeight;
                imageProperties.UseWindowBackgroundColor = true;
                imageProperties.AntiAliasingMode         = (int)aaCombo.SelectedIndex * 2;
                if (imageProperties.AntiAliasingMode == 0)
                {
                    imageProperties.AntiAliasingMode = 1;
                }
                imageProperties.ShowBackground        = showBackground.Checked;
                imageProperties.ShowWatermark         = showWatermark.Checked;
                imageProperties.TransparentBackground = transparent.Checked;
                imageRenderer.renderImageAsync(imageProperties, (product) =>
                {
                    currentImage = product;
                    if (currentImage != null)
                    {
                        int previewWidth  = previewMaxWidth;
                        int previewHeight = previewMaxHeight;
                        if (currentImage.Width > currentImage.Height)
                        {
                            float ratio   = (float)currentImage.Height / currentImage.Width;
                            previewHeight = (int)(previewWidth * ratio);
                        }
                        else
                        {
                            float ratio  = (float)currentImage.Width / currentImage.Height;
                            previewWidth = (int)(previewHeight * ratio);
                        }
                        if (previewWidth > currentImage.Width || previewHeight > currentImage.Height)
                        {
                            previewWidth  = currentImage.Width;
                            previewHeight = currentImage.Height;
                        }
                        imageAtlas      = new ImageAtlas("RendererPreview", new IntSize2(previewWidth, previewHeight));
                        String imageKey = imageAtlas.addImage("PreviewImage", currentImage);
                        previewImage.setSize(previewWidth, previewHeight);
                        previewImage.setItemResource(imageKey);
                    }
                    toggleRequireImagesWidgets();
                });
            }
        }
示例#22
0
        public IImageDisplay createImageDisplay(String cameraName)
        {
            SceneViewWindow sceneWindow = sceneViewController.findWindow(cameraName);

            if (sceneWindow == null)
            {
                sceneWindow = sceneViewController.ActiveWindow;
                Log.Warning("Could not find SceneViewWindow {0}. Using active window {1} instead.", cameraName, sceneWindow.Name);
            }
            MyGUIImageDisplay display = new MyGUIImageDisplay(this, sceneWindow);

            displays.Add(display);
            return(display);
        }
        void sceneViewController_WindowCreated(SceneViewWindow window)
        {
            MDISceneViewWindow mdiWindow = window as MDISceneViewWindow;

            if (mdiWindow != null)
            {
                LicenseDisplay licenseDisplay = new LicenseDisplay();
                activeLicenseDisplays.Add(licenseDisplay);
                mdiWindow.addChildContainer(licenseDisplay.LayoutContainer);
                mdiWindow.Disposed += (win) =>
                {
                    activeLicenseDisplays.Remove(licenseDisplay);
                    licenseDisplay.Dispose();
                };
            }
        }
示例#24
0
        public override void started(float timelineTime, Clock clock)
        {
            MDISceneViewWindow window = TimelineController.SceneViewController.findWindow(CameraName);

            if (window != null)
            {
                window.setPosition(CameraPosition, Duration);
            }
            else
            {
                SceneViewWindow sceneViewWindow = TimelineController.SceneViewController.ActiveWindow;
                if (sceneViewWindow != null)
                {
                    sceneViewWindow.setPosition(CameraPosition, Duration);
                }
            }
        }
示例#25
0
 void sceneViewController_ActiveWindowChanged(SceneViewWindow window)
 {
     if (activeWindow != null)
     {
         activeWindow.OnUndoRedoChanged -= setupUndoRedo;
         activeWindow.OnRedo            -= setupUndoRedo;
         activeWindow.OnUndo            -= setupUndoRedo;
     }
     this.activeWindow = window;
     if (activeWindow != null)
     {
         activeWindow.OnUndoRedoChanged += setupUndoRedo;
         activeWindow.OnRedo            += setupUndoRedo;
         activeWindow.OnUndo            += setupUndoRedo;
         setupUndoRedo(activeWindow);
     }
 }
        public override void OnSceneViewGUI(SceneView sceneView)
        {
            bool remove = (
                (RemoveOnKeyEscape && Manager.KeyEscapeDown) ||
                (RemoveOnCameraControl && Manager.IsCameraControl) ||
                (RemoveOnClickMiss && WindowIsActive && Manager.LeftMouseClick && !SceneViewWindow.GetWindowData(OnWindowGUI).Contains(Event.current.mousePosition))
                );

            if (remove)
            {
                PerformRemoveFromParent();
            }
            else if (m_selected != null)
            {
                OnSelect(m_selected.Object);
                PerformRemoveFromParent();
            }
        }
        private static void Init()
        {
            /*
             * var filePath = Application.dataPath + "/_MK/_MKGlowSystem/_Internal/Editor/_Image/MKGlowSystemSceneViewSettingsTitle.png";
             * if (System.IO.File.Exists(filePath))
             * {
             * var bytes = System.IO.File.ReadAllBytes(filePath);
             * if (m_SceneViewLabel == null)
             * {
             * m_SceneViewLabel = new Texture2D(128, 128);
             * m_SceneViewLabel.LoadImage(bytes);
             * }
             * }
             */
            SceneViewWindow.Show();
            SceneViewWindow.minSize = new Vector2(400, 275);
            SceneViewWindow.maxSize = new Vector2(400, 275);

            Load();
        }
示例#28
0
        public void applySceneStateToSlide(Slide slide)
        {
            CameraPosition cameraPos = new CameraPosition();

            if (sceneViewController.ActiveWindow != null)
            {
                SceneViewWindow window = sceneViewController.ActiveWindow;
                cameraPos.Translation = window.Translation;
                cameraPos.LookAt      = window.LookAt;
                window.calculateIncludePoint(cameraPos);
            }
            LayerState layers = new LayerState();

            layers.captureState();
            PresetState    medicalState   = medicalStateController.createPresetState("");
            MusclePosition musclePosition = new MusclePosition();

            musclePosition.captureState();
            slide.StartupAction = new SetupSceneAction("Show", cameraPos, layers, musclePosition, medicalState, true, TeethController.HighlightContacts);
        }
示例#29
0
        void setStraightAngleView(Vector3 lookAtMask, Vector3 translationMask)
        {
            SceneViewWindow activeWindow = sceneViewController.ActiveWindow;

            if (activeWindow != null)
            {
                Vector3 lookAt   = activeWindow.LookAt;
                float   length   = (activeWindow.Translation - lookAt).length();
                Vector3 newTrans = new Vector3(lookAt.x * lookAtMask.x + length * translationMask.x,
                                               lookAt.y * lookAtMask.y + length * translationMask.y,
                                               lookAt.z * lookAtMask.z + length * translationMask.z);

                CameraPosition undoPosition = activeWindow.createCameraPosition();
                activeWindow.setPosition(new CameraPosition()
                {
                    Translation = newTrans,
                    LookAt      = lookAt,
                }, MedicalConfig.CameraTransitionTime);
                activeWindow.pushUndoState(undoPosition);
            }
        }
示例#30
0
        void pickAnatomy_FirstFrameUpEvent(EventLayer eventLayer)
        {
            IntVector3 absMouse = eventLayer.Mouse.AbsolutePosition;

            if (eventLayer.EventProcessingAllowed && !travelTracker.TraveledOverLimit)
            {
                SceneViewWindow activeWindow = sceneViewController.ActiveWindow;
                DisplayHintLocation = new IntVector2(absMouse.x + MouseClickWindowOffset, absMouse.y + MouseClickWindowOffset);
                TriggeredSelection  = false;
                Ray3 cameraRay = activeWindow.getCameraToViewportRayScreen(absMouse.x, absMouse.y);

                AnatomyIdentifier     firstMatch;
                IEnumerable <Anatomy> matches = anatomyController.findAnatomy(cameraRay, out firstMatch);

                if (!clickedAnatomy.clickedSameAnatomy(firstMatch))
                {
                    if (matches != null)
                    {
                        clickedAnatomy.setNewResults(matches, firstMatch);
                        anatomyController.processSelection(clickedAnatomy.CurrentMatch, clickedAnatomy.PreviousMatch);
                        clickedAnatomy.moveNext();

                        searchBox.Caption   = "Picked";
                        clearButton.Visible = true;
                    }
                    else
                    {
                        clickedAnatomy.clear();
                        anatomyController.processSelection(null, null);
                        clearButton.Visible = false;
                        searchBox.Caption   = "";
                    }
                }
                else
                {
                    anatomyController.processSelection(clickedAnatomy.CurrentMatch, clickedAnatomy.PreviousMatch);
                    clickedAnatomy.moveNext();
                }
            }
        }