/** * @see prefuse.action.Action#run(double) */ public void run(double frac) { Graph g = (Graph)m_vis.getGroup(m_group); initSchema(g.getNodes()); Arrays.fill(m_depths, 0); m_maxDepth = 0; Point2D a = getLayoutAnchor(); m_ax = a.getX(); m_ay = a.getY(); NodeItem root = getLayoutRoot(); Params rp = getParams(root); g.getSpanningTree(root); // do first pass - compute breadth information, collect depth info firstWalk(root, 0, 1); // sum up the depth info determineDepths(); // do second pass - assign layout positions secondWalk(root, null, -rp.prelim, 0); }
private void secondWalk(NodeItem n, NodeItem p, double m, int depth) { Params np = getParams(n); setBreadth(n, p, np.prelim + m); setDepth(n, p, m_depths[depth]); if ( n.isExpanded() ) { depth += 1; for ( NodeItem c = (NodeItem)n.getFirstChild(); c != null; c = (NodeItem)c.getNextSibling() ) { secondWalk(c, n, m + np.mod, depth); } } np.clear(); }