/// <summary> /// Calculates layout for given <see cref="ObjectGraph" />. /// </summary> /// <param name="objectGraph"></param> /// <returns></returns> public PositionedGraph CalculateLayout(ObjectGraph objectGraph, LayoutDirection direction, Expanded expanded) { layoutDirection = direction; treeNodeFor = new Dictionary<ObjectGraphNode, PositionedGraphNode>(); seenNodes = new HashSet<PositionedGraphNode>(); //TreeGraphNode tree = buildTreeRecursive(objectGraph.Root, expandedNodes); // convert ObjectGraph to PositionedGraph with TreeEdges var resultGraph = buildTreeGraph(objectGraph, expanded); // first layout pass calculateSubtreeSizes((TreeGraphNode)resultGraph.Root); // second layout pass calculateNodePosRecursive((TreeGraphNode)resultGraph.Root, 0, 0); //var neatoRouter = new NeatoEdgeRouter(); //resultGraph = neatoRouter.CalculateEdges(resultGraph); resultGraph = new GraphEdgeRouter().RouteEdges(resultGraph); return resultGraph; }
/// <summary> /// Calculates layout for given <see cref="ObjectGraph" />. /// </summary> /// <param name="objectGraph"></param> /// <returns></returns> public PositionedGraph CalculateLayout(ObjectGraph objectGraph, LayoutDirection direction, Expanded expanded) { layoutDirection = direction; treeNodeFor = new Dictionary <ObjectGraphNode, PositionedGraphNode>(); seenNodes = new HashSet <PositionedGraphNode>(); //TreeGraphNode tree = buildTreeRecursive(objectGraph.Root, expandedNodes); // convert ObjectGraph to PositionedGraph with TreeEdges var resultGraph = buildTreeGraph(objectGraph, expanded); // first layout pass calculateSubtreeSizes((TreeGraphNode)resultGraph.Root); // second layout pass calculateNodePosRecursive((TreeGraphNode)resultGraph.Root, 0, 0); //var neatoRouter = new NeatoEdgeRouter(); //resultGraph = neatoRouter.CalculateEdges(resultGraph); resultGraph = new GraphEdgeRouter().RouteEdges(resultGraph); return(resultGraph); }