コード例 #1
0
 private void groupWithChildren(ERDFormatterNode node)
 {
     for (int i = 0; i < node.ChildrenIndeces.Count; i++)
     {
         if (node.GroupNum >= 0)
         {
             if (Nodes[node.ChildrenIndeces[i]].GroupNum >= 0)
             {
                 mergeGroups(node.GroupNum, Nodes[node.ChildrenIndeces[i]].GroupNum);
             }
             else
             {
                 Nodes[node.ChildrenIndeces[i]].GroupNum = node.GroupNum;
                 _groups[node.GroupNum].Add(node.ChildrenIndeces[i]);
             }
         }
         else
         {
             if (Nodes[node.ChildrenIndeces[i]].GroupNum >= 0)
             {
                 node.GroupNum = Nodes[node.ChildrenIndeces[i]].GroupNum;
                 _groups[node.GroupNum].Add(node.Index);
             }
             else
             {
                 node.GroupNum = _groups.Count;
                 Nodes[node.ChildrenIndeces[i]].GroupNum = _groups.Count;
                 _groups.Add(new List <int>());
                 _groups[node.GroupNum].Add(node.Index);
                 _groups[node.GroupNum].Add(node.ChildrenIndeces[i]);
                 _numGroups++;
             }
         }
     }
 }
コード例 #2
0
        private void insertReturnsToNode(ERDFormatterNode node)
        {
            string startDir;
            string endDir;
            int    i;

            for (i = 0; i < node.ChildrenIndeces.Count; i++)
            {
                if (!Nodes[node.ChildrenIndeces[i]].TestExclusiveAdjacency())
                {
                    startDir = getNormalRelativeDirection(node.ChildrenIndeces[i], node.Index);
                    endDir   = getNormalRelativeDirection(node.Index, node.ChildrenIndeces[i]);
                    insertReturn((int)node.Node.ID, (int)Nodes[node.ChildrenIndeces[i]].Node.ID, startDir, endDir);
                }
            }
            for (i = 0; i < node.ExclusivelyAdjacentChildren.Count; i++)
            {
                if ((i & 0x1) == 0) //Exclusively adjacent children are staggered left and right
                {
                    startDir = SDON.Model.Directions.Left;
                    endDir   = SDON.Model.Directions.Right;
                }
                else
                {
                    startDir = SDON.Model.Directions.Right;
                    endDir   = SDON.Model.Directions.Left;
                }

                insertReturn((int)node.Node.ID, (int)Nodes[node.ExclusivelyAdjacentChildren[i]].Node.ID, startDir, endDir);
            }
        }