예제 #1
0
        /// <summary>
        /// Set Diagram styles:
        /// HideQuals=1 HideQualifiers:
        /// OpParams=2  Show full Operation Parameter
        /// ScalePI=1   Scale to fit page
        /// </summary>
        /// <param name="rep"></param>
        /// <param name="dia"></param>
        /// <param name="par">par[0] contains the values as a semicolon separated list</param>
        // ReSharper disable once UnusedMember.Global
        public static void SetDiagramStyle(EA.Repository rep, EA.Diagram dia, string[] par)
        {
            string[] styleEx          = par[0].Split(';');
            string   diaStyle         = dia.StyleEx;
            string   diaExtendedStyle = dia.ExtendedStyle.Trim();

            // no distinguishing between StyleEx and ExtendedStayle, may cause of trouble
            if (dia.StyleEx == "")
            {
                diaStyle = par[0] + ";";
            }
            if (dia.ExtendedStyle == "")
            {
                diaExtendedStyle = par[0] + ";";
            }

            Regex rx = new Regex(@"([^=]*)=.*");

            rep.SaveDiagram(dia.DiagramID);
            foreach (string style in styleEx)
            {
                Match  match       = rx.Match(style);
                string patternFind = $@"{match.Groups[1].Value}=[^;]*;";
                diaStyle         = Regex.Replace(diaStyle, patternFind, $@"{style};");
                diaExtendedStyle = Regex.Replace(diaExtendedStyle, patternFind, $@"{style};");
            }
            dia.ExtendedStyle = diaExtendedStyle;
            dia.StyleEx       = diaStyle;
            dia.Update();
            rep.ReloadDiagram(dia.DiagramID);
        }
예제 #2
0
        private static readonly bool ActivityIsSimple = true; // Create Activity from function in the simple form

        // ReSharper disable once UnusedMethodReturnValue.Local
        private static bool CreateDefaultElementsForActivity(EA.Repository rep,
                                                             EA.Diagram dia, EA.Element act)
        {
            // create init node
            CreateInitFinalNode(rep, dia, act, 100, "l=350;r=370;t=70;b=90;");
            act.Elements.Refresh();
            dia.DiagramObjects.Refresh();
            dia.Update();
            rep.ReloadDiagram(dia.DiagramID);

            return(true);
        }
        /// <summary>
        /// Update all DiagramLinks of diagram
        /// - liParameter[0] = type;
        /// - liParameter[1] = style;</summary>
        /// - liParameter[2] = property;
        /// <param name="rep"></param>
        /// <param name="dia"></param>
        /// <param name="liParameter"></param>
        private static void SetDiagramLinkStyle(EA.Repository rep, EA.Diagram dia, string[] liParameter)
        {
            rep.SaveDiagram(dia.DiagramID);

            string types      = liParameter[0];
            string styles     = liParameter[1];
            string properties = liParameter[2];

            foreach (EA.DiagramLink link in dia.DiagramLinks)
            {
                var linkStyle = new DiagramLinkStyle(rep, link, types, styles, properties);
                if (linkStyle.IsToProcess())
                {
                    linkStyle.UpdateStyles();
                    linkStyle.SetProperties();
                    linkStyle.SetEaLayoutStyles();
                }
            }
            rep.ReloadDiagram(dia.DiagramID);
        }
        /// <summary>
        /// Update all DiagramObjects of diagram
        /// - liParameter[0] = type;
        /// - liParameter[1] = style;
        /// - liParameter[2] = property;
        /// </summary>
        /// <param name="rep"></param>
        /// <param name="dia"></param>
        /// <param name="liParameter"></param>
        private static void SetDiagramObjectStyle(EA.Repository rep, EA.Diagram dia, string[] liParameter)
        {
            rep.SaveDiagram(dia.DiagramID);

            string types      = liParameter[0];
            string styles     = liParameter[1];
            string properties = liParameter[2];

            foreach (EA.DiagramObject obj in dia.DiagramObjects)
            {
                var objStyle = new DiagramObjectStyle(rep, obj, types, styles, properties);
                if (objStyle.IsToProcess())
                {
                    objStyle.UpdateStyles();
                    objStyle.SetProperties();
                    objStyle.SetEaLayoutStyles();
                    objStyle.SetCompleteNessMarker();
                }
            }
            rep.ReloadDiagram(dia.DiagramID);
        }