예제 #1
0
        /// <summary>
        /// creates a diagram based on the given EA.Diagram object
        /// </summary>
        /// <param name="diagramToWrap">the EA.Diagram object to wrap</param>
        /// <returns>a diagram wrapping the given EA.Diagram object</returns>
        public override UML.Diagrams.Diagram createDiagram(object diagramToWrap)
        {
            Diagram newDiagram = null;

            global::EA.Diagram eaDiagramToWrap = diagramToWrap as global::EA.Diagram;
            if (eaDiagramToWrap != null)
            {
                switch (eaDiagramToWrap.Type)
                {
                case "Sequence":
                    newDiagram = new SequenceDiagram(this.model as Model, eaDiagramToWrap);
                    break;

                case "Collaboration":
                    newDiagram = new CommunicationDiagram(this.model as Model, eaDiagramToWrap);
                    break;

                case "Activity":
                    newDiagram = new ActivityDiagram(this.model as Model, eaDiagramToWrap);
                    break;

                case "Logical":
                    newDiagram = new ClassDiagram(this.model as Model, eaDiagramToWrap);
                    break;

                case "Component":
                    newDiagram = new ComponentDiagram(this.model as Model, eaDiagramToWrap);
                    break;

                case "CompositeStructure":
                    newDiagram = new CompositeStructureDiagram(this.model as Model, eaDiagramToWrap);
                    break;

                case "Deployment":
                    newDiagram = new DeploymentDiagram(this.model as Model, eaDiagramToWrap);
                    break;

                case "InteractionOverview":
                    newDiagram = new InteractionOverviewDiagram(this.model as Model, eaDiagramToWrap);
                    break;

                case "Object":
                    newDiagram = new ObjectDiagram(this.model as Model, eaDiagramToWrap);
                    break;

                case "Package":
                    newDiagram = new PackageDiagram(this.model as Model, eaDiagramToWrap);
                    break;

                case "Statechart":
                    newDiagram = new StateMachineDiagram(this.model as Model, eaDiagramToWrap);
                    break;

                case "Timing":
                    newDiagram = new TimingDiagram(this.model as Model, eaDiagramToWrap);
                    break;

                case "Use Case":
                    newDiagram = new UseCaseDiagram(this.model as Model, eaDiagramToWrap);
                    break;

                // TODO add creation of profile diagram
                default:
                    newDiagram = new Diagram(this.model as Model, eaDiagramToWrap);
                    break;
                }
            }
            return(newDiagram);
        }