public override void ArrangeChildrenPosition() { var head = ChildrenNode.FirstOrDefault(i => i.IsHead()); int index = 0; double step = 0; while (head != null) { head.X = X + 16; head.Y = MiddleUpperY + step; step += head.Height + 8.8; head = head.Next; } }
public override void UpdateMiddleSpace() { if (State == Observer.State.ShapeState.Expand) { State = Observer.State.ShapeState.Balance; } if (ChildrenNode.Count == 0) { MiddleSpace = 20; Parent?.UpdateMiddleSpace(); return; } var head = ChildrenNode.FirstOrDefault(i => i.IsHead()); if (head != null) { MiddleSpace = head.VirtualHeight + 8.8 * head.Count - 8.8; } // ReSharper disable once PossibleInvalidOperationException }
public int MaxDepth(ChildrenNode root) { if (root == null) { return(0); } int maxDepth = 1; for (int i = 0; i < root.children.Count; i++) { int depth = 1 + MaxDepth(root.children[i]); if (depth > maxDepth) { maxDepth = depth; } } return(maxDepth); }
public override void Visit(ChildrenNode node) { Indent++; VisitAndIdentAlways(node); Indent--; WriteIndent(); }
public virtual void Visit(ChildrenNode node) { foreach(var children in node) Visit(children); }