/** * Set the position of the given node, given in polar co-ordinates. * @param n the NodeItem to set the position * @param p the referrer parent NodeItem * @param r the radius * @param t the angle theta */ protected void setPolarLocation(NodeItem n, NodeItem p, double r, double t) { setX(n, p, m_origin.getX() + r*Math.cos(t)); setY(n, p, m_origin.getY() + r*Math.sin(t)); }
/** * @see prefuse.action.Action#run(double) */ public void run(double frac) { Graph g = (Graph)m_vis.getGroup(m_group); initSchema(g.getNodes()); m_origin = getLayoutAnchor(); NodeItem n = getLayoutRoot(); Params np = (Params)n.get(PARAMS); g.getSpanningTree(n); // calc relative widths and maximum tree depth // performs one pass over the tree m_maxDepth = 0; calcAngularWidth(n, 0); if ( m_autoScale ) setScale(getLayoutBounds()); if ( !m_setTheta ) calcAngularBounds(n); // perform the layout if ( m_maxDepth > 0 ) layout(n, m_radiusInc, m_theta1, m_theta2); // update properties of the root node setX(n, null, m_origin.getX()); setY(n, null, m_origin.getY()); np.angle = m_theta2-m_theta1; }