// Find the left most node(s) -- parent nodes. Perpare all the child nodes for finding the relationships between them private void Initialise(RealignStyle realignStyle = RealignStyle.Horizontal) { foreach (var nodeControl in _nodeControls) { var realignNode = new RealignNode(nodeControl); if (nodeControl.ParentNodes.Count == 0) { AddChild(realignNode); } else { _nodesNeedToBePlaced.Add(realignNode); } } //If no parent can be found, set the top left node to parent if (ChildNodes.Count == 0) { AddTopLeftNodeToParentNode(); } PlaceNodesToMap(realignStyle); ReCheckForIncorrectDepth(realignStyle); if (_isPartlyRealign) { var nodesToLoop = ChildNodes.ToList(); foreach (var realignNode in nodesToLoop) { if (!realignNode.HasChild) { ChildNodes.Remove(realignNode); } } } }
public void AddChild(RealignNode node) { ChildNodes.Add(node); }