//IList<int> allDepts = new List<int>(); public void _CalculateDept(ColumnTreeNode node, int depth) { if (node.Children == null) { AllPathDepths.Add(currentPathIndex, depth); currentPathIndex += 1; return; } foreach (var c in node.Children) { _CalculateDept(c, depth + 1); } }
private int GetHeight(ColumnTreeNode node) { var maxDepth = AllPathDepths[currentRetangleIndex]; int height = 1; if (maxDepth < bigRetangleHeight) { if (node.CanSpanRows) { height = bigRetangleHeight - maxDepth + 1; } } return(height); }
public void _CalculateLeaesCount(ColumnTreeNode child, ref int count) { if (child.Children == null) { count += 1; } else { foreach (var cc in child.Children) { _CalculateLeaesCount(cc, ref count); } } }
public void _CalculateLeaves(ColumnTreeNode treeNode, IList <ColumnTreeNode> leaves) { if (treeNode.Children == null) { leaves.Add(treeNode); } else { foreach (var c in treeNode.Children) { _CalculateLeaves(c, leaves); } } }
public void _CalculateRetangle(ColumnTreeNode node, int initialX, int initialY) { int height = GetHeight(node); int width = node.CalculateLeaesCount(); int currentX = initialX; retangles.Add(new MergedCellRetangle(new RetanglePosition(initialX, initialY), new RetangleSize(width, height) , node.Title, node.Format )); if (node.Children != null) { initialY += height; foreach (var c in node.Children) { _CalculateRetangle(c, currentX, initialY); currentX += c.CalculateLeaesCount(); } } }