Ejemplo n.º 1
0
        public ClassDesigner(UMLClass cls)
        {
            ContentName = GettextCatalog.GetString ("Class Diagram");
            IsViewOnly = true;
            mhdEditor = new MonoHotDraw.SteticComponent();
            mhdEditor.ShowAll();

            ILayout algorithm = new TreeLayout();
            foreach(var figure in algorithm.GetFigures(cls))
            {
                mhdEditor.View.Drawing.Add(figure);
            }
        }
Ejemplo n.º 2
0
        public ClassDesignerView()
        {
            ContentName = GettextCatalog.GetString ("Class Diagram");
            IsViewOnly = true;

            mhdEditor = new SteticComponent();
            mhdEditor.ShowAll();

            // CODE DOM TEST:
            // THIS IS TEMPORAL

            Project project = IdeApp.ProjectOperations.CurrentSelectedProject;
            ProjectDom dom = ProjectDomService.GetProjectDom(project);
            figures = new List<TypeFigure>();
            foreach (IType type in dom.Types) {
                if (type.ClassType == ClassType.Class) {
                    System.Console.WriteLine("Adding Class");
                    figures.Add(new ClassFigure(type));
                }

                if (type.ClassType == ClassType.Enum) {
                    System.Console.WriteLine("Adding Enum");
                    figures.Add(new EnumFigure(type));
                }
            }

            double x = 50.0;
            double y = 50.0;

            foreach (TypeFigure figure in figures)  {
                mhdEditor.View.Drawing.Add(figure);
                figure.MoveTo(x, y);
                x += figure.DisplayBox.Width + 50.0;
                if (x > 1000.0) {
                    x = 50.0;
                    y += figure.DisplayBox.Height + 100.0;
                }
            }

            foreach (IType type in dom.Types) {
                if (type.ClassType == ClassType.Class) {
                    ClassFigure subclass = GetFigure(type.Name);
                    ClassFigure superclass = GetFigure(type.BaseType.Name);

                    if (subclass != null && superclass != null) {
                        InheritanceConnectionFigure connection = new InheritanceConnectionFigure(subclass, superclass);
                        mhdEditor.View.Drawing.Add(connection);
                    }
                }
            }
        }