private void DrawInputsNodesRecursively(List <DependencyViewerNode> nodes, NodeInputSide inputSide) { for (int i = 0; i < nodes.Count; ++i) { DrawNode(nodes[i]); DrawInputsNodesRecursively(inputSide == NodeInputSide.Left ? nodes[i].LeftInputs : nodes[i].RightInputs, inputSide); } }
private void ForeachChildrenRecursively(NodeInputSide treeSide, DependencyViewerNode node, Action <DependencyViewerNode> onEachNodeCallback) { var children = node.GetChildren(treeSide); for (int i = 0; i < children.Count; ++i) { ForeachChildrenRecursively(treeSide, children[i], onEachNodeCallback); } onEachNodeCallback(node); }
public DependencyViewerNode GetLastSibling(NodeInputSide treeSide) { var parent = GetParent(treeSide); if (parent == null) { return(this); } var childNodes = parent.GetChildren(treeSide); return(childNodes.Count > 0 ? childNodes[childNodes.Count - 1] : null); }
public DependencyViewerNode GetNextSibling(NodeInputSide treeSide) { var parent = GetParent(treeSide); if (parent == null) { return(null); } var childNodes = parent.GetChildren(treeSide); int childIdx = GetSiblingIndex(treeSide); return(childIdx + 1 < childNodes.Count ? childNodes[childIdx + 1] : null); }
public int GetSiblingIndex(NodeInputSide treeSide) { var parentNode = GetParent(treeSide); if (parentNode == null) { return(0); } var siblings = parentNode.GetChildren(treeSide); for (int siblingIdx = 0; siblingIdx < siblings.Count; ++siblingIdx) { if (siblings[siblingIdx] == this) { return(siblingIdx); } } return(-1); }
public void ForeachChildrenRecursively(NodeInputSide treeSide, Action <DependencyViewerNode> onEachNodeCallback) { ForeachChildrenRecursively(treeSide, this, onEachNodeCallback); }
public int GetNumChildren(NodeInputSide treeSide) { return(GetChildren(treeSide).Count); }
public bool IsFirstSibling(NodeInputSide treeSide) { return(GetSiblingIndex(treeSide) == 0); }
public bool IsLeaf(NodeInputSide treeSide) { return(GetNumChildren(treeSide) == 0); }
public DependencyViewerNode GetLastChild(NodeInputSide treeSide) { var childNodes = GetChildren(treeSide); return(childNodes.Count > 0 ? childNodes[childNodes.Count - 1] : null); }
public List <DependencyViewerNode> GetChildren(NodeInputSide treeSide) { return(GetInputNodesFromSide(treeSide)); }
public DependencyViewerNode GetParent(NodeInputSide treeSide) { var parentList = (treeSide == NodeInputSide.Left ? _rightInputs : _leftInputs); return(parentList.Count > 0 ? parentList[0] : null); }
public List <DependencyViewerNode> GetInputNodesFromSide(NodeInputSide side) { return(side == NodeInputSide.Left ? _leftInputs : _rightInputs); }
private void DrawNodeLinks(DependencyViewerNode node, List <DependencyViewerNode> inputs, NodeInputSide inputSide) { for (int i = 0; i < inputs.Count; ++i) { DependencyViewerNode inputNode = inputs[i]; DependencyViewerNode leftNode = (inputSide == NodeInputSide.Left ? node : inputNode); DependencyViewerNode rightNode = (inputSide == NodeInputSide.Right ? node : inputNode); Vector2 start = GetRelativePosition(leftNode.GetLeftInputAnchorPosition()); Vector2 end = GetRelativePosition(rightNode.GetRightInputAnchorPosition()); Drawing.DrawLine(start, end, LinkColor, LinkWidth); DrawNodeLinks( inputNode, inputSide == NodeInputSide.Left ? inputNode.LeftInputs : inputNode.RightInputs, inputSide); } }