Package prefuse.visual

Examples of prefuse.visual.NodeItem


        }
        return a;
    }
   
    private NodeItem nextLeft(NodeItem n) {
        NodeItem c = null;
        if ( n.isExpanded() ) c = (NodeItem)n.getFirstChild();
        return ( c != null ? c : getParams(n).thread );
    }
View Full Code Here


        if ( n.isExpanded() ) c = (NodeItem)n.getFirstChild();
        return ( c != null ? c : getParams(n).thread );
    }
   
    private NodeItem nextRight(NodeItem n) {
        NodeItem c = null;
        if ( n.isExpanded() ) c = (NodeItem)n.getLastChild();
        return ( c != null ? c : getParams(n).thread );
    }
View Full Code Here

            shift += cp.shift + change;
        }
    }
   
    private NodeItem ancestor(NodeItem vim, NodeItem v, NodeItem a) {
        NodeItem p = (NodeItem)v.getParent();
        Params vimp = getParams(vim);
        if ( vimp.ancestor.getParent() == p ) {
            return vimp.ancestor;
        } else {
            return a;
View Full Code Here

    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
View Full Code Here

            m_prevRoot = r;
            return;
        }
       
        // try to find previous parent of root
        NodeItem p = m_prevRoot;
        while ( true ) {
            NodeItem pp = (NodeItem)p.getParent();
            if ( pp == r ) {
                break;
            } else if ( pp == null ) {
                m_prevRoot = r;
                return;
View Full Code Here

        double diameter = d==0 ? 0 : Math.sqrt(w*w+h*h) / d;
       
        if ( n.isExpanded() && n.getChildCount() > 0 ) {
            Iterator childIter = n.children();
            while ( childIter.hasNext() ) {
                NodeItem c = (NodeItem)childIter.next();
                aw += calcAngularWidth(c,d+1);
            }
            aw = Math.max(diameter, aw);
        } else {
            aw = diameter;
View Full Code Here

    }
   
    private Iterator sortedChildren(final NodeItem n) {
        double base = 0;
        // update base angle for node ordering
        NodeItem p = (NodeItem)n.getParent();
        if ( p != null ) {
            base = normalize(Math.atan2(p.getY()-n.getY(), p.getX()-n.getX()));
        }
        int cc = n.getChildCount();
        if ( cc == 0 ) return null;

        NodeItem c = (NodeItem)n.getFirstChild();
       
        // TODO: this is hacky and will break when filtering
        // how to know that a branch is newly expanded?
        // is there an alternative property we should check?
        if ( !c.isStartVisible() ) {
            // use natural ordering for previously invisible nodes
            return n.children();
        }
       
        double angle[] = new double[cc];
        final int idx[] = new int[cc];
        for ( int i=0; i<cc; ++i, c=(NodeItem)c.getNextSibling() ) {
            idx[i] = i;
            angle[i] = normalize(-base +
                Math.atan2(c.getY()-n.getY(), c.getX()-n.getX()));
        }
        ArrayLib.sort(angle, idx);
       
        // return iterator over sorted children
        return new Iterator() {
View Full Code Here

        double width = ((Params)n.get(PARAMS)).width;
        double cfrac, nfrac = 0.0;
       
        Iterator childIter = sortedChildren(n);
        while ( childIter != null && childIter.hasNext() ) {
            NodeItem c = (NodeItem)childIter.next();
            Params cp = (Params)c.get(PARAMS);
            cfrac = cp.width / width;
            if ( c.isExpanded() && c.getChildCount()>0 ) {
                layout(c, r+m_radiusInc, theta1 + nfrac*dtheta,
                                         theta1 + (nfrac+cfrac)*dtheta);
            }
            setPolarLocation(c, n, r, theta1 + nfrac*dtheta + cfrac*dtheta2);
            cp.angle = cfrac*dtheta;
 
View Full Code Here

     */
    protected void setNeighborHighlight(NodeItem n, boolean state) {
        Iterator iter = n.edges();
        while ( iter.hasNext() ) {
            EdgeItem eitem = (EdgeItem)iter.next();
            NodeItem nitem = eitem.getAdjacentItem(n);
            if (eitem.isVisible() || highlightWithInvisibleEdge) {
                eitem.setHighlighted(state);
                nitem.setHighlighted(state);
            }
        }
        if ( activity != null )
            n.getVisualization().run(activity);
    }
View Full Code Here

        split.setDividerLocation(530);
        split.setDividerLocation(800);
       
       
        // position and fix the default focus node
        NodeItem focus = (NodeItem)vg.getNode(0);
        PrefuseLib.setX(focus, null, 400);
        PrefuseLib.setY(focus, null, 250);
        focusGroup.setTuple(focus);

        // now we run our action list and return
View Full Code Here

TOP

Related Classes of prefuse.visual.NodeItem

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.