Package prefuse.visual

Examples of prefuse.visual.NodeItem


        if( object == null )
        {
            return;
        }

        NodeItem item = null;

        Iterator iter = m_vis.items( GRAPH_NODES );
        while( iter.hasNext() )
        {
            NodeItem tItem = (NodeItem) iter.next();
            Object tObj = tItem.get( USER_OBJECT );
            if( tObj.equals( object ) )
            {
                item = tItem;
                break;
            }
View Full Code Here


        {
            if( !( item instanceof NodeItem ) )
            {
                return 0;
            }
            NodeItem nItem = (NodeItem) item;
            if( m_vis.isInGroup( nItem, Visualization.FOCUS_ITEMS ) )
            {
                return OUTLINE_FOCUS_COLOR;
            }
View Full Code Here

        @Override
        public int getColor( VisualItem item )
        {
            if( item instanceof NodeItem )
            {
                NodeItem nItem = (NodeItem) item;
                if( m_vis.isInGroup( nItem, Visualization.FOCUS_ITEMS ) )
                {
                    int c = CMAP.getColor( nItem.getDepth() );
                    return ColorLib.darker( c );
                }
                return CMAP.getColor( nItem.getDepth() );
            }
            else
            {
                return CMAP.getColor( 0 );
            }
View Full Code Here

    @Override
    public void run( double frac )
    {
        // setup
        NodeItem root = getLayoutRoot();
        layout( root, 0, 0 );

        Rectangle2D bounds = root.getBounds();
        Display display = this.getVisualization().getDisplay( 0 );
        Dimension size = new Dimension( (int) bounds.getWidth(), (int) bounds.getHeight() );
        display.setSize( size );

        if( !display.isValid() )
View Full Code Here

        boolean hasChild = false;
        for( int i = 0; i < node.getChildCount(); i++ )
        {
            hasChild = true;
            NodeItem child = (NodeItem) node.getChild( i );

            layout( child, cx, cy );
            area.add( new Area( child.getBounds() ) );

            // shifting location calculation
            Rectangle2D nodeRect = child.getBounds();
            if( depth == 0 )
            {
                // layer
                cy = cy + ( INSET * 2 ) + nodeRect.getHeight();
            }
View Full Code Here

    private void arrangeChildVertically( NodeItem parent )
    {
        double maxW = 0;
        for( int i = 0; i < parent.getChildCount(); i++ )
        {
            NodeItem node = (NodeItem) parent.getChild( i );
            Rectangle2D bounds = node.getBounds();
            maxW = Math.max( maxW, bounds.getWidth() );
        }

        for( int i = 0; i < parent.getChildCount(); i++ )
        {
            NodeItem node = (NodeItem) parent.getChild( i );
            Rectangle2D bounds = node.getBounds();
            node.setBounds( bounds.getX(), bounds.getY(), maxW, bounds.getHeight() );
        }
    }
View Full Code Here

    private void arrangeChildHorizontally( NodeItem parent )
    {
        double maxH = 0;
        for( int i = 0; i < parent.getChildCount(); i++ )
        {
            NodeItem node = (NodeItem) parent.getChild( i );
            Rectangle2D bounds = node.getBounds();
            maxH = Math.max( maxH, bounds.getHeight() );
        }

        for( int i = 0; i < parent.getChildCount(); i++ )
        {
            NodeItem node = (NodeItem) parent.getChild( i );
            Rectangle2D bounds = node.getBounds();
            node.setBounds( bounds.getX(), bounds.getY(), bounds.getWidth(), maxH );
        }
    }
View Full Code Here

    public void run(double frac) {
        Graph g = (Graph)m_vis.getGroup(m_group);
        initSchema(g.getNodes());
       
        Point2D anchor = getLayoutAnchor();
        NodeItem n = getLayoutRoot();
        layout(n,anchor.getX(),anchor.getY());
    }
View Full Code Here

        Params np = getParams(n);
        np.d = 0;
        double s = 0;
        Iterator childIter = n.children();
        while ( childIter.hasNext() ) {
            NodeItem c = (NodeItem)childIter.next();
            if ( !c.isVisible() ) continue;
            firstWalk(c);
            Params cp = getParams(c);
            np.d = Math.max(np.d,cp.r);
            cp.a = Math.atan(((double)cp.r)/(np.d+cp.r));
            s += cp.a;
View Full Code Here

       
        Params np = getParams(n);
        int numChildren = 0;
        Iterator childIter = n.children();
        while ( childIter.hasNext() ) {
            NodeItem c = (NodeItem)childIter.next();
            if ( c.isVisible() ) ++numChildren;
        }
        double dd = l*np.d;
        double p  = t + Math.PI;
        double fs = (numChildren==0 ? 0 : np.f/numChildren);
        double pr = 0;
        childIter = n.children();
        while ( childIter.hasNext() ) {
            NodeItem c = (NodeItem)childIter.next();
            if ( !c.isVisible() ) continue;
            Params cp = getParams(c);
            double aa = np.c * cp.a;
            double rr = np.d * Math.tan(aa)/(1-Math.tan(aa));
            p += pr + aa + fs;
            double xx = (l*rr+dd)*Math.cos(p);
 
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.