Example #1
0
    private static void GetContour(
        DependencyViewerNode node,
        int depth,
        DependencyViewerNode.NodeInputSide childrenSide,
        Func <float, float, float> getContourCallback,
        float modSum,
        ref Dictionary <int /* depth */, float /* minY */> values)
    {
        if (!values.ContainsKey(depth))
        {
            values.Add(depth, node.Position.y + modSum);
        }
        else
        {
            values[depth] = getContourCallback(values[depth], node.Position.y + modSum);
        }

        modSum += node.Mod;

        var children = node.GetInputNodesFromSide(childrenSide);

        foreach (var child in children)
        {
            GetContour(child, depth + 1, childrenSide, getContourCallback, modSum, ref values);
        }
    }
Example #2
0
    private static void ForeachNode_PostOrderTraversal(
        DependencyViewerNode parentNode,
        DependencyViewerNode rootNode,
        DependencyViewerNode.NodeInputSide side,
        Action <PostOrderTraversalData> callback, int childIdx, int depth)
    {
        List <DependencyViewerNode> children = rootNode.GetInputNodesFromSide(side);

        for (int i = 0; i < children.Count; ++i)
        {
            ForeachNode_PostOrderTraversal(rootNode, children[i], side, callback, i, depth + 1);
        }

        PostOrderTraversalData data = new PostOrderTraversalData(side)
        {
            childIdx    = childIdx,
            currentNode = rootNode,
            parentNode  = parentNode,
            depth       = depth
        };

        callback(data);
    }