Beispiel #1
0
 public Port(ComponentBase parentFunclet, int x, int y, PortType pType)
 {
     area = new Rectangle(x, y, Config.PORT_D, Config.PORT_D);
     this.pType = pType;
     this.parentComponent = parentFunclet;
     this.ComponentType = ComponentType.Port;
 }
Beispiel #2
0
        /// <summary>
        /// Doc tai lieu "Ve Port.docx"
        /// </summary>
        /// <param name="parent"></param>
        /// <param name="pType"></param>
        public Port(ComponentBase parent, PortType pType)
        {
            this.ParentComponent = parent;

            Dictionary<string, Point> getPoint = GetPointFromParent(parent);
            if (pType == PortType.Input)
                area = new Rectangle(getPoint["2c"].X, getPoint["2c"].Y, Config.PORT_D, Config.PORT_D);
            else
                area = new Rectangle(getPoint["1c"].X, getPoint["1c"].Y, Config.PORT_D, Config.PORT_D);

            this.pType = pType;
            this.parentComponent = parent;
            this.ComponentType = ComponentType.Port;
        }
 public FrmEditComponentName(ComponentBase cmp)
 {
     InitializeComponent();
     this.cmp = cmp;
 }
Beispiel #4
0
        private StringBuilder BuildXxltWithFunclet(ComponentBase fnc, string mappedKey)
        {
            if (fnc is Function)
            {
                string str = strBuilder.ToString();
                int len = str.LastIndexOf('(');
                bool isFclosed = str.Length - len == 1;
                if (isFclosed)
                {
                    strBuilder.AppendFormat("{0}(", fnc.Name);
                }
                else
                {
                    strBuilder.AppendFormat(",{0}(", fnc.Name);
                }

                foreach (ComponentBase item in fnc.InputComponents)
                {
                    if (item is ComponentBase)
                    {
                        BuildXxltWithFunclet(item, mappedKey);
                    }
                }
                strBuilder.AppendFormat("{0}", ")");
            }
            else if (fnc is GraphNode)
            {
                string str = strBuilder.ToString();
                int indexC = str.LastIndexOf('(');

                string mappedValue = fnc.ComponentType != ComponentType.Constant ? string.Format("//{0}", fnc.NodePath.Replace("\\", "/")) : fnc.NodePath;
                bool addC = str.Length - indexC == 1;
                if (addC)
                {
                    strBuilder.AppendFormat("{0}", mappedValue);
                }
                else
                {
                    strBuilder.AppendFormat(",{0}", mappedValue);
                }

                //// Update Node Incon on treeview
                //UpdateTreeNodeLinkByDesign(fnc.Name, mappedValue, mappedKey);
            }
            return strBuilder;
        }
Beispiel #5
0
 /// <summary>
 /// Doc tai lieu "Ve Port.docx"
 /// </summary>
 /// <param name="parent"></param>
 /// <param name="pType"></param>
 public Port(ComponentBase parent, PortType pType, long id)
     : this(parent, pType)
 {
     base.ID = id;
 }
Beispiel #6
0
        /// <summary>
        /// Read document "Ve Port.docx"
        /// </summary>
        /// <param name="parent"></param>
        /// <returns></returns>
        private Dictionary<string, Point> GetPointFromParent(ComponentBase parent)
        {
            Dictionary<string, Point> returnValue = new Dictionary<string, Point>();
            returnValue["1a"] = new Point(
                                            parent.X + parent.Width,
                                            parent.Y + parent.Height / 2
                                        );
            returnValue["1b"] = new Point(
                                           parent.X + parent.Width + Config.PORT_DELTA,
                                           parent.Y + parent.Height / 2
                                        );
            returnValue["1c"] = new Point(
                                           parent.X + parent.Width + Config.PORT_DELTA,
                                           parent.Y + parent.Height / 2 - Config.PORT_D / 2
                                        );

            returnValue["2a"] = new Point(
                                            parent.X,
                                            parent.Y + parent.Height / 2
                                        );
            returnValue["2b"] = new Point(
                                           parent.X - Config.PORT_DELTA,
                                           parent.Y + parent.Height / 2
                                        );
            returnValue["2c"] = new Point(
                                           parent.X - Config.PORT_DELTA - Config.PORT_D,
                                           parent.Y + parent.Height / 2 - Config.PORT_D / 2
                                        );

            return returnValue;
        }
 /// <summary>
 /// Adds the graphics.
 /// </summary>
 /// <param name="ld">The ld.</param>
 /// Created by SMK
 private void AddTreeGraphics(ComponentBase ld)
 {
     pnlTree.AddObjectGraphic(ld);
     AddFuncletGraphics(ld);
 }
        /// <summary>
        /// Finds the tree nodes.
        /// </summary>
        /// <param name="currObj">The curr obj.</param>
        /// <returns></returns>
        /// Created by SMK
        private List<TreeNode> FindTreeNodes(TreeView treeView, ComponentBase currObj,ComponentType compType)
        {
            List<TreeNode> lst = new List<TreeNode>();
            List<ComponentBase> lstTmp = new List<ComponentBase>();
            if (currObj != null)
            {
                var lstGraphicNodes = currObj.GetComponents(lstTmp,currObj, compType);

                foreach (ComponentBase item in lstGraphicNodes)
                {
                    TreeNode sTreeNode = FindNode(treeView.Nodes[0], item.Name);
                    if (sTreeNode != null)
                        lst.Add(sTreeNode);

                }
            }
            return lst;
        }
        /// <summary>
        /// Gets the list component.
        /// </summary>
        /// <param name="type">The type.</param>
        /// <returns></returns>
        /// Created by SMK
        public List<ComponentBase> GetComponents(List<ComponentBase> lstComponent,ComponentBase comp, ComponentType type)
        {
            if (comp.ComponentType == type)
            {
                lstComponent.Add(comp);
            }
            List<ComponentBase> lst = FindParent(comp);
            if (lst == null)
            {
                return lstComponent;
            }
            foreach (ComponentBase item in lst)
            {
                GetComponents(lstComponent,item, type);
            }

            return lstComponent;
        }
Beispiel #10
0
        /// <summary>
        /// Finds the parent.
        /// </summary>
        /// <param name="comp">The comp.</param>
        /// <returns></returns>
        /// Created by SMK
        public List<ComponentBase> FindParent(ComponentBase comp)
        {
            List<ComponentBase> lst = new List<ComponentBase>();
            if (comp is Port)
            {
                lst.Add(((Port)comp).ParentComponent);
            }
            else if (comp is LinkDot)
            {
                Port startPort = ((LinkDot)comp).StartPort;
                lst.Add(((Port)startPort).ParentComponent);
            }
            else if (comp is Function)
            {

                if (comp.InputComponents != null)
                {
                    foreach (ComponentBase item in comp.InputComponents)
                    {
                        if (item is GraphNode)
                        {
                            lst.Add(item);
                        }
                        else if (item is Function)
                        {
                            FindParent(item);
                        }
                    }

                }
            }

            return lst;
        }