Ejemplo n.º 1
0
        private StringBuilder BuildXxltWithFunclet(Funclet 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.FunctionName);
                }
                else
                {
                    strBuilder.AppendFormat(",{0}(", fnc.FunctionName);
                }

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

                string mappedValue = fnc.NodeType != NodeType.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.FunctionName, mappedValue, mappedKey);
            }
            return strBuilder;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Builds the funclet string.
        /// </summary>
        /// <param name="funcCurrent">The func current.</param>
        /// <returns></returns>
        private string BuildFuncletString(Funclet funcCurrent)
        {
            string strResult = string.Empty;

            if (funcCurrent is Function)
            {
                foreach (Funclet func in ((Function)funcCurrent).InputFunclets)
                {
                    strResult += BuildFuncletString(func) + ", ";
                }

                strResult = string.Format("{0}({1})", funcCurrent.FunctionType == FunctionType.Default ? funcCurrent.FunctionName : string.Empty, strResult.Trim().TrimEnd(','));
            }
            else if (funcCurrent is GraphNode)
            {
                var grpNode = funcCurrent as GraphNode;
                if (grpNode.NodeType != NodeType.Constant)
                {
                    strResult = "//" + ((GraphNode)funcCurrent).NodePath.Replace("\\", "/").TrimStart('/');
                }
                else
                {
                    strResult = grpNode.FunctionName;
                }
            }

            return strResult;
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Port"/> class.
 /// </summary>
 /// <param name="parentFunclet">The parent funclet.</param>
 /// <param name="x">The x.</param>
 /// <param name="y">The y.</param>
 /// <param name="pType">Type of the p.</param>
 /// Created by khoaht at 11:00 AM on 11/28/2011
 public Port(Funclet parentFunclet, int x, int y, PortType pType)
 {
     area = new Rectangle(x, y, Config.PORT_WIDTH, Config.PORT_HEIGHT);
     this.pType = pType;
     this.parentFunclet = parentFunclet;
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Adds the funclet link.
        /// </summary>
        /// <param name="subParent">The sub parent.</param>
        /// <param name="parentPort">The parent port.</param>
        /// <param name="subChild">The sub child.</param>
        /// <param name="childPort">The child port.</param>
        /// <param name="linetype">The linetype.</param>
        private void AddFuncletLink(Funclet subParent, long parentPort, Funclet subChild, long childPort,
            ConnectionType linetype)
        {
            if ((subParent == null) || (subChild == null))
            {
                return;
            }

            int nPoints = (linetype == ConnectionType.StraightLine) ? 2 : 3;

            Port pPort = subParent.GetPort(parentPort);
            Port cPort = subChild.GetPort(childPort);
            // lstFuncsLink.Add(new LinkDot(GetPointArray(nPoints, pPort, cPort), penLinks, false));

            if (subParent is Function)
            {
                Function graphConcatTmp = (Function)subParent;

                if (graphConcatTmp != null)
                {
                    for (int i = 0; i < graphConcatTmp.InputFunclets.Count; i++)
                    {
                        AddFuncletLink(graphConcatTmp.InputFunclets[i], 0, subParent, i + 1, ConnectionType.Polyline);
                    }
                }
            }

            if (subParent.InputFunclets.Count == 1)
            {
                AddFuncletLink(subParent.InputFunclets[0], 0, subParent, 0, ConnectionType.Polyline);
            }
        }
Ejemplo n.º 5
0
 /// <summary>
 /// Updates the link node design.
 /// </summary>
 /// <param name="delFunclet">The del funclet.</param>
 private void UpdateLinkDot(Funclet delFunclet)
 {
     // Link from source
     List<LinkDot> slst = new List<LinkDot>();
     foreach (LinkDot _item in lstFuncsLink)
     {
         if (!delFunclet.ListPort.Exists(t => t.ID == _item.StartPort.ID || t.ID == _item.EndPort.ID))
         {
             slst.Add(_item);
         }
     }
     lstFuncsLink = slst;
 }
Ejemplo n.º 6
0
        /// <summary>
        /// Adds the link.
        /// </summary>
        /// <param name="graphNodeSrc">The graph node SRC.</param>
        /// <param name="tmpFunc">The TMP func.</param>
        private LinkDot CreateLink(Funclet Node, Funclet function, Pen pen, int nPoints)
        {
            LinkDot ret = null;
            Port startPort = Node.ListPort[0];
            if (startPort.PortType == PortType.Input)
            {
                Port endPort = function.ListPort.Find(p => p.IsConnected == false && p.PortType == PortType.Output);
                ret = new LinkDot(endPort, startPort, pen, nPoints);
                function.MarkPortConnected(endPort);
            }
            else
            {
                Port port = function.ListPort.Find(t => t.PortType == PortType.Input && !t.IsConnected);
                ret = new LinkDot(startPort, port, pen, nPoints);
                function.MarkPortConnected(port);
            }

            return ret;
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Builds the funclet string.
        /// </summary>
        /// <param name="funcCurrent">The func current.</param>
        /// <returns></returns>
        private string BuildFuncletString(Funclet funcCurrent)
        {
            string strResult = string.Empty;

            if (funcCurrent is GraphConcat)
            {
                foreach (Funclet func in ((GraphConcat)funcCurrent).InputFunclets)
                {
                    strResult += BuildFuncletString(func) + ", ";
                }

                strResult = string.Format("concat({0})", strResult.Trim().TrimEnd(','));
            }
            else if (funcCurrent is GraphNode)
            {
                strResult = "//" + ((GraphNode)funcCurrent).NodePath.Replace("\\", "/").TrimStart('/');
            }

            return strResult;
        }
Ejemplo n.º 8
0
        private void AddFuncletLink(Funclet subParent, int iLineParent, Funclet subChild, int iLineChild,
            ConnectionType linetype, int dis_turn)
        {
            if ((subParent == null) || (subChild == null))
            {
                return;
            }

            int iLink = lstFuncsLink.Count;
            int nPoints = (linetype == ConnectionType.StraightLine) ? 2 : 3;
            Point[] pts = new Point[nPoints];

            pts[0] = subParent.OutPoint(iLineParent);
            pts[nPoints - 1] = subChild.InPoint(iLineChild);
            if (nPoints == 3)
            {
                pts[1] = new Point(pts[2].X - dis_turn, pts[2].Y);
            }
            lstFuncsLink.Add(new LinkDot(pts, penLinks, false));
            subParent.OutConnectionOrder(iLineParent, iLink);
            subChild.InConnectionOrder(iLineChild, iLink);

            if (subParent is GraphConcat)
            {
                GraphConcat graphConcatTmp = (GraphConcat)subParent;

                if (graphConcatTmp != null)
                {
                    for (int i = 0; i < graphConcatTmp.InputFunclets.Count; i++)
                    {
                        AddFuncletLink(graphConcatTmp.InputFunclets[i], 0, subParent, i + 1, ConnectionType.Polyline, LinkDot.DISTURN);
                    }
                }
            }

            if (subParent.InputFunclets.Count == 1)
            {
                AddFuncletLink(subParent.InputFunclets[0], 0, subParent, 0, ConnectionType.Polyline, LinkDot.DISTURN);
            }
        }