Beispiel #1
0
        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;
            }
        }
Beispiel #2
0
        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
        }
Beispiel #3
0
            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);
            }
Beispiel #4
0
        public override void Visit(ChildrenNode node)
        {
            Indent++;

            VisitAndIdentAlways(node);

            Indent--;

            WriteIndent();
        }
Beispiel #5
0
 public virtual void Visit(ChildrenNode node)
 {
     foreach(var children in node)
         Visit(children);
 }