Ejemplo n.º 1
0
        private (int leftSpan, int rightSpan) BuildChildNodes([NotNull] TreeNode node, [NotNull] TreeUiNode internalNode)
        {
            if (node.IsInternalNode == false)
            {
                return(0, 0);
            }

            var left     = node.Left;
            var leftNode = TreeUiNode.Create(left, internalNode, columnOffset: -1);

            _controlNodes.Add(leftNode);

            var right     = node.Right;
            var rightNode = TreeUiNode.Create(right, internalNode, columnOffset: 1);

            _controlNodes.Add(rightNode);

            var leftEdge = TreeUiEdge.CreateEdge(internalNode, leftNode);

            _edges.Add(leftEdge);

            var rightEdge = TreeUiEdge.CreateEdge(internalNode, rightNode);

            _edges.Add(rightEdge);

            var leftSpan  = BuildChildNodes(left, leftNode);
            var rightSpan = BuildChildNodes(right, rightNode);

            return(AccomodateSpans(internalNode, leftNode, leftSpan, rightNode, rightSpan));
        }
Ejemplo n.º 2
0
        public static TreeUiEdge CreateEdge([NotNull] TreeUiNode upperNode, [NotNull] TreeUiNode lowerNode)
        {
            var edge = new TreeUiEdge();

            edge.UpperNode = upperNode;
            edge.LowerNode = lowerNode;
            return(edge);
        }