Example #1
0
 /// <summary>
 /// Set the controller for the viewports
 /// </summary>
 /// <param name="controller"></param>
 public void SetController(IEditorController controller)
 {
     for (int i = 0; i < VIEWPORT_COUNT; i++)
     {
         viewports[i].SetController(controller);
     }
 }
Example #2
0
        public override void Initialize(IEditorController controller)
        {
            this.controller = controller;
            controller.CurrentSolidManipulationMode = SolidManipulationMode.Face;

            controller.RubberBand.ShowGrabhandles = false;
            controller.SetCursor(Cursors.Default);
        }
Example #3
0
 public SymbolInspectorPaneViewModel(IEditorController editorController)
 {
     Title = "Symbol Inspector";
     ContentId = "SymbolInspectorPaneViewModel";
     _editorController = editorController;
     IsTrackingCursor = false;
     _symbol = _nullSymbolViewModel;
 }
Example #4
0
	    public SourceDocument(IEditorController controller, ITextDocument document, Project.IProject proj)
	    {
	        _controller = controller;
	        _document = document;
            _project = proj;
            if(_project != null)
                _changeTracker = new DocChangeTracker(this, _project.Index);
	    }
Example #5
0
        public static EditorContext CreateEditor(string file)
        {
            IEditor           editor     = null;
            IModel            model      = null;
            IEditorController controller = null;

            var extension = Path.GetExtension(file);

            model = ModelManager.Instance().MakeSureModel(file);

            if (GlobalService.EditorContextManager.Contains(model.FileId))
            {
                return(GlobalService.EditorContextManager.Get(model.FileId));
            }

            if (extension == Dict.Extenstions.XmlModel_Extension)
            {
                editor     = new XmlModelEditor();
                model.File = file;
                controller = new XmlModelEditorController();
            }

            if (extension == Dict.Extenstions.DataModel_Extension)
            {
                editor     = new DataModelEditor();
                model.File = file;
                controller = new DataModelEditorController();
            }
            if (extension == Dict.Extenstions.DataView_Extension)
            {
                editor     = new DataViewEditor();
                model.File = file;
                controller = new DataViewEditorController();
            }
            if (extension == Dict.Extenstions.ViewModel_Extension)
            {
                editor     = new ViewModelEditor();
                model.File = file;
                controller = new ViewModelEditorController();
            }
            if (extension == Dict.Extenstions.WorkFlow_Extension)
            {
                editor     = new WorkFlowEditor();
                model.File = file;
                controller = new WorkFlowEditorController();
            }
            var context = new EditorContext();

            context.EditorContainer = editor;
            context.Model           = model;
            context.Controller      = controller;

            context.Controller.Bind(editor, model);

            GlobalService.EditorContextManager.Add(context);

            return(context);
        }
        public override void Initialize(IEditorController controller)
        {
            this.controller = controller;
            controller.CurrentSolidManipulationMode = SolidManipulationMode.Solid;
            currentAction = SolidToolActionType.None;
            controller.SetCursor(Cursors.Default);

            // when entering this mode, we select alle faces of selected solids again
            SetAllFacesSelected(true);
        }
Example #7
0
 public override void Initialize(IEditorController controller)
 {
     this.controller = controller;
     controller.CurrentSolidManipulationMode = SolidManipulationMode.Vertex;
     currentAction = VertexToolActionType.None;
     mouseHasMoved = false;
     newHandlesHit = new Dictionary <Solid, List <int> >();
     coverBlanket  = new AABB();
     coverBlanket.Grow(Vector3.Zero);
     controller.SetCursor(Cursors.Default);
 }
Example #8
0
    void InitViews(Scene scene, LoadSceneMode mode)
    {
        switch (scene.buildIndex)
        {
        case 0:
            var factory = new GeneralParameterViewFactory();
            var view    = factory.View;
            if (GeneralParameterController == null)
            {
                var model = GlobalSettingsModel.GeneralParameterModel;
                GeneralParameterController = new GeneralParameterController(model, view);
            }
            else
            {
                GeneralParameterController.SubscribeView(view);
                GeneralParameterController.ReloadView();
            }

            if (EditorController != null)
            {
                EditorController.UnsubscribeView();
            }
            if (EditorUIController != null)
            {
                EditorUIController.UnsubscribeView();
            }
            break;

        case 1:
            if (EditorUIController == null)
            {
                var editorUIViewFactory = new EditorUIViewFactory();
                EditorUIController = new EditorUIController(GlobalSettingsModel.EditorUIModel, editorUIViewFactory.View);
            }
            else
            {
                var editorUIViewFactory = new EditorUIViewFactory();
                EditorUIController.subscribeView(editorUIViewFactory.View);
            }

            if (EditorController == null)
            {
                var editorViewFactory = new EditorViewFactory();
                EditorController = new EditorController(GlobalSettingsModel.EditorModel, editorViewFactory.View);
                EditorController.OnDisplaySceneObjectParameter += EditorUIController.DisplaySceneObjectParameter;
                EditorController.OnHideSceneObjectParameter    += EditorUIController.HideSceneObjectParameter;
            }
            else
            {
                var editorViewFactory = new EditorViewFactory();
                EditorController.SubscribeView(editorViewFactory.View);
                EditorController.Init(!IsGeneratingImages);
            }

            if (IsGeneratingImages)
            {
                StartCoroutine(GenerateImages());
            }
            break;
        }
    }
Example #9
0
 public virtual void Initialize(IEditorController controller)
 {
 }
Example #10
0
 /// <summary>
 /// Sets the controller for this viewport
 /// </summary>
 /// <param name="controller"></param>
 public void SetController(IEditorController controller)
 {
     this.controller = controller;
     CapturedMouse   = false;
 }
        private void RenderOrthoSolid(Solid solid)
        {
            IEditorController controller = Viewport.Controller;
            Color             solidColor = solid.Selected ? Color.Red : solid.Color;

            switch (controller.CurrentSolidManipulationMode)
            {
            case SolidManipulationMode.Solid:
                switch (Viewport.RenderMode)
                {
                case BaseViewport.RenderModes.WIREFRAME:
                    Graphics.DrawWireframeSolid(solid, solidColor);
                    if (!solid.Selected)
                    {
                        DrawCornerPoints(Graphics, solid, Color.White);
                    }
                    break;

                case BaseViewport.RenderModes.SOLID:
                    DrawSolid(Graphics, solid, solidColor);
                    break;

                case BaseViewport.RenderModes.TEXTURED:
                    DrawSolid(Graphics, solid, solid.Selected ? Color.Red : Color.White, true);
                    break;
                }
                break;

            case SolidManipulationMode.Face:

                switch (Viewport.RenderMode)
                {
                case BaseViewport.RenderModes.WIREFRAME:
                    Graphics.DrawWireframeSolid(solid, solidColor);
                    //DrawCornerPoints(Renderer, solid, Color.White);
                    break;

                case BaseViewport.RenderModes.SOLID:
                    solid.Faces.ForEach((face) =>
                    {
                        SolidVertex[] positions = solid.GetVerticesForFace(face);
                        Graphics.DrawSolidPolygon(positions, face.Normal,
                                                  face.Selected ? Color.Red : solid.Color);
                    });
                    break;

                case BaseViewport.RenderModes.TEXTURED:
                    solid.Faces.ForEach((face) =>
                    {
                        SolidVertex[] positions = solid.GetVerticesForFace(face);
                        Graphics.DrawTexturedSolidPolygon(positions, face.Normal,
                                                          face.Selected ? Color.Red : Color.White, face.Texture);
                    });
                    break;
                }
                break;

            case SolidManipulationMode.Vertex:
                switch (Viewport.RenderMode)
                {
                case BaseViewport.RenderModes.WIREFRAME:
                    Graphics.DrawWireframeSolid(solid, solidColor);
                    break;

                case BaseViewport.RenderModes.SOLID:
                    DrawSolid(Graphics, solid, solidColor);
                    break;

                case BaseViewport.RenderModes.TEXTURED:
                    DrawSolid(Graphics, solid, solid.Selected ? Color.Red : Color.White, true);
                    break;
                }
                break;
            }

            //Color centerColor = controller.CurrentSolidManipulationMode == SolidManipulationMode.Face
            //    ? Viewport.RenderMode == BaseViewport.RenderModes.SOLID && solid.Selected ? Color.Red: solid.Color
            //    : solid.Selected ? Color.Red : solid.Color;
            DrawCenter(Graphics, solid, solidColor);
        }
        private void RenderPerspSolid(Solid solid)
        {
            Color             color      = solid.Selected ? Color.Red : solid.Color;
            IEditorController controller = Viewport.Controller;

            switch (controller.CurrentSolidManipulationMode)
            {
            case SolidManipulationMode.Solid:
                switch (Viewport.RenderMode)
                {
                case BaseViewport.RenderModes.WIREFRAME:
                    Graphics.DrawWireframeSolid(solid, color);
                    break;

                case BaseViewport.RenderModes.SOLID:
                    DrawSolid(Graphics, solid, color);
                    if (solid.Selected)
                    {
                        Graphics.DrawWireframeSolid(solid, Color.Yellow);
                    }
                    break;

                case BaseViewport.RenderModes.TEXTURED:
                    DrawSolid(Graphics, solid, solid.Selected ? Color.Red : Color.White, true);
                    if (solid.Selected)
                    {
                        Graphics.DrawWireframeSolid(solid, Color.Yellow);
                    }
                    break;
                }
                break;

            case SolidManipulationMode.Face:
                solid.Faces.ForEach((face) =>
                {
                    Color faceColor         = face.Selected ? Color.Red : solid.Color;
                    SolidVertex[] positions = solid.GetVerticesForFace(face);
                    switch (Viewport.RenderMode)
                    {
                    case BaseViewport.RenderModes.WIREFRAME:
                        Graphics.DrawWireframeSolidPolygon(positions, face.Normal, faceColor);
                        break;

                    case BaseViewport.RenderModes.SOLID:
                        Graphics.DrawSolidPolygon(positions, face.Normal, faceColor);
                        break;

                    case BaseViewport.RenderModes.TEXTURED:
                        Graphics.DrawTexturedSolidPolygon(positions, face.Normal, face.Selected ? Color.Red : Color.White, face.Texture);
                        break;
                    }
                });
                break;

            case SolidManipulationMode.Vertex:
                switch (Viewport.RenderMode)
                {
                case BaseViewport.RenderModes.WIREFRAME:
                    Graphics.DrawWireframeSolid(solid, Color.White);
                    break;

                case BaseViewport.RenderModes.SOLID:
                    DrawSolid(Graphics, solid, color);
                    break;

                case BaseViewport.RenderModes.TEXTURED:
                    DrawSolid(Graphics, solid, solid.Selected ? Color.Red : Color.White, true);
                    break;
                }
                break;
            }
        }