Ejemplo n.º 1
0
        public void StartDoc(ExportUmlOptions options)
        {
            if (options != null)
            {
                _options = options;
            }

            Doc = new XmlDocument();

            XmlSchema schema = new XmlSchema();

            schema.Namespaces.Add(UMLNS.Item1, UMLNS.Item2);
            Doc.Schemas.Add(schema);

            AddNamespace(UMLNS.Item1, UMLNS.Item2);
            AddNamespace(XMINS.Item1, XMINS.Item2);

            var decl = Doc.CreateXmlDeclaration("1.0", "windows-1252", null);

            Doc.AppendChild(decl);

            var root = Doc.CreateElement(XMINS.Item1, "XMI", XMINS.Item2);

            Doc.AppendChild(root);
            root.SetAttribute("version", XMINS.Item2, "2.1");
            root.SetAttribute("xmlns:" + UMLNS.Item1, UMLNS.Item2);
            root.SetAttribute("xmlns:" + XMINS.Item1, XMINS.Item2);

            // Note: if the info below is altered, then EA will NOT import type tags of the attributes!
            CreateAppendElement(root, XMINS, "Documentation",
                                new[] {
                "exporter", "Enterprise Architect",
                "exporterVersion", "6.5"
            });

            var model = CreateAppendElement(root, UMLNS, "Model",
                                            new[] {
                "xmi:type", "uml:Model",
                "name", "AAS_Model",
                "visibility", "public"
            });

            var pack1 = CreateAppendElement(model, "packagedElement",
                                            new[] {
                "xmi:type", "uml:Package",
                "xmi:id", RegisterObject("AAS Model"),
                "name", "AAS Model",
                "visibility", "public"
            });

            Package = CreateAppendElement(pack1, "packagedElement",
                                          new[] {
                "xmi:type", "uml:Package",
                "xmi:id", RegisterObject("Package1"),
                "name", "Package1",
                "visibility", "public"
            });
        }
Ejemplo n.º 2
0
        public void StartDoc(ExportUmlOptions options)
        {
            if (options != null)
            {
                _options = options;
            }

            Doc = new XmlDocument();

            XmlSchema schema = new XmlSchema();

            schema.Namespaces.Add(UMLNS.Item1, UMLNS.Item2);
            Doc.Schemas.Add(schema);

            var decl = Doc.CreateXmlDeclaration("1.0", "windows-1252", null);

            Doc.AppendChild(decl);

            var root = Doc.CreateElement("XMI");

            Doc.AppendChild(root);
            root.SetAttribute("xmi.version", "1.1");
            root.SetAttribute("xmlns:" + UMLNS.Item1, UMLNS.Item2);
            root.SetAttribute("timestamp", DateTime.UtcNow.ToString("yyyy'-'MM'-'dd' 'HH':'mm':'ss"));

            var xmicontent = CreateAppendElement(root, "XMI.content");

            root.AppendChild(xmicontent);

            var model = CreateAppendElement(xmicontent, UMLNS, "Model",
                                            new[] {
                "name", "EA Model",
                "xmi.id", GenerateId("MX_EAID_")
            });

            var modeloe = CreateAppendElement(model, UMLNS, "Namespace.ownedElement");

            var pack = CreateAppendElement(modeloe, UMLNS, "Package",
                                           new[] {
                "name", "Package1",
                "xmi.id", GenerateId("EAPK_"),
                "isRoot", "false",
                "isLeaf", "false",
                "isAbstract", "false",
                "visibility", "public"
            });

            Package = CreateAppendElement(pack, UMLNS, "Namespace.ownedElement2");
        }
Ejemplo n.º 3
0
        public void StartDoc(ExportUmlOptions options)
        {
            if (options != null)
            {
                _options = options;
            }

            Writeln("@startuml");

            Writeln("!theme plain");
            Writeln("left to right direction");
            Writeln("hide class circle");
            Writeln("hide class methods");
            Writeln("skinparam classAttributeIconSize 0");
            Writeln("' skinparam linetype polyline");
            Writeln("skinparam linetype ortho");

            Writeln("");
        }
Ejemplo n.º 4
0
        public static void ExportUmlToFile(
            AdminShell.AdministrationShellEnv env,
            AdminShell.Submodel submodel,
            ExportUmlOptions options,
            string fn)
        {
            // access
            if (options == null | !fn.HasContent())
            {
                return;
            }

            // which writer?
            IBaseWriter writer = null;

            if (options.Format == ExportUmlOptions.ExportFormat.Xmi11)
            {
                writer = new Xmi11Writer();
            }
            if (options.Format == ExportUmlOptions.ExportFormat.Xmi21)
            {
                writer = new Xmi21Writer();
            }
            if (options.Format == ExportUmlOptions.ExportFormat.PlantUml)
            {
                writer = new PlantUmlWriter();
            }

            if (writer != null)
            {
                writer.StartDoc(options);
                writer.ProcessSubmodel(submodel);
                writer.ProcessPost();
                writer.SaveDoc(fn);
            }
        }