Example #1
0
        /// <summary>
        /// 初始化数据
        /// 确定交易流程节点集合
        /// 确定线条集合
        /// 确定节点位置
        /// </summary>
        internal void LayOut(List <Tx_Node> flowList)
        {
            _layOutCount = 0; //初始化界面层级数
            //确定所有连线
            foreach (var item in flowList)
            {
                var _s = item.Sub_Code.Split(',').ToList();
                _s.RemoveAll(x => x.Length == 0);
                _s.ForEach(k =>
                {
                    Tx_Entry entry = new Tx_Entry(item.Code, k, item.Conditions);
                    _allEntrys.Add(entry);
                });
                _nodes.Add(item);
            }
            //尾结点与结束的连线
            var lstNode = FindLastNode(flowList);

            if (lstNode.Count > 0)
            {
                lstNode.ForEach(x =>
                {
                    _allEntrys.Add(new Tx_Entry(x.Code, endNode, "")); //添加结束节点的连线
                    x.Sub_Code += "," + _nodes[1].Code;                //给尾节点的子节点属性赋值
                });
            }
            //排序
            if (_nodes.Count < 1)
            {
                return;
            }
            var nodes = from n in _nodes
                        orderby int.Parse(n.Code) ascending
                        select n;

            //头结点与开始的连线
            var firstNode = FindFirstNode(flowList);

            if (firstNode.Count > 0)
            {
                firstNode.ForEach(x =>
                {
                    _allEntrys.Add(new Tx_Entry(startNode, x.Code, "")); //添加开始节点的连线
                    _nodes[0].Sub_Code += "," + x.Code;                  //给开始节点的子节点属性赋值
                });
            }
            //给开始结点确定位置
            _nodes[0].X = _startX;
            _nodes[0].Y = _startY;
            _layOutCount++;
            _countedNodes.Add(_nodes[0]);
            //递归计算子节点位置
            LayOut_NextNodes(_nodes[0]);
        }
 /// <summary>
 /// 初始化数据 
 /// 确定交易流程节点集合
 /// 确定线条集合
 /// 确定节点位置
 /// </summary>
 internal void LayOut(List<Tx_Node> flowList)
 {
     _layOutCount = 0; //初始化界面层级数
     //确定所有连线
     foreach (var item in flowList)
     {
         var _s = item.Sub_Code.Split(',').ToList();
         _s.RemoveAll(x => x.Length == 0);
         _s.ForEach(k =>
         {
             Tx_Entry entry = new Tx_Entry( item.Code,k, item.Conditions);
             _allEntrys.Add(entry);
         });
         _nodes.Add(item);
     }
     //尾结点与结束的连线
     var lstNode = FindLastNode(flowList);
     if (lstNode.Count > 0)
         lstNode.ForEach(x =>
         {
             _allEntrys.Add(new Tx_Entry(x.Code, endNode, ""));//添加结束节点的连线
             x.Sub_Code += "," + _nodes[1].Code;//给尾节点的子节点属性赋值
         });
     //排序
     if (_nodes.Count < 1) return;
     var nodes = from n in _nodes
                 orderby int.Parse(n.Code) ascending
                 select n;
     //头结点与开始的连线
     var firstNode = FindFirstNode(flowList);
     if (firstNode.Count > 0)
         firstNode.ForEach(x =>
         {
             _allEntrys.Add(new Tx_Entry(startNode, x.Code, ""));//添加开始节点的连线
             _nodes[0].Sub_Code += "," + x.Code;//给开始节点的子节点属性赋值
         });
     //给开始结点确定位置
     _nodes[0].X = _startX;
     _nodes[0].Y = _startY;
     _layOutCount++;
     _countedNodes.Add(_nodes[0]);
     //递归计算子节点位置
     LayOut_NextNodes(_nodes[0]);
 }