Examples of NodeItem


Examples of org.gephi.preview.plugin.items.NodeItem

        for (Item item : previewModel.getItems(Item.EDGE_LABEL)) {
            Edge edge = (Edge) item.getSource();
            Item edgeItem = previewModel.getItem(Item.EDGE, edge);

            EdgeColor edgeColor = (EdgeColor) properties.getValue(PreviewProperty.EDGE_COLOR);
            NodeItem sourceItem = (NodeItem) edgeItem.getData(EdgeRenderer.SOURCE);
            NodeItem targetItem = (NodeItem) edgeItem.getData(EdgeRenderer.TARGET);
            Color color = edgeColor.getColor((Color) item.getData(EdgeItem.COLOR),
                    (Color) sourceItem.getData(NodeItem.COLOR),
                    (Color) targetItem.getData(NodeItem.COLOR));
            item.setData(EDGE_COLOR, color);
            if (edge.isSelfLoop()) {
                //Middle
                Float x = sourceItem.getData(NodeItem.X);
                Float y = sourceItem.getData(NodeItem.Y);
                Float size = sourceItem.getData(NodeItem.SIZE);

                Vector v1 = new Vector(x, y);
                v1.add(size, -size);

                Vector v2 = new Vector(x, y);
                v2.add(size, size);

                Vector middle = bezierPoint(x, y, v1.x, v1.y, v2.x, v2.y, x, y, 0.5f);
                item.setData(LABEL_X, middle.x);
                item.setData(LABEL_Y, middle.y);

            } else if (properties.getBooleanValue(PreviewProperty.EDGE_CURVED)) {
                //Middle of the curve
                Float x1 = sourceItem.getData(NodeItem.X);
                Float x2 = targetItem.getData(NodeItem.X);
                Float y1 = sourceItem.getData(NodeItem.Y);
                Float y2 = targetItem.getData(NodeItem.Y);

                //Curved edgs
                Vector direction = new Vector(x2, y2);
                direction.sub(new Vector(x1, y1));
                float length = direction.mag();
                direction.normalize();

                float factor = properties.getFloatValue(EdgeRenderer.BEZIER_CURVENESS) * length;

                // normal vector to the edge
                Vector n = new Vector(direction.y, -direction.x);
                n.mult(factor);

                // first control point
                Vector v1 = new Vector(direction.x, direction.y);
                v1.mult(factor);
                v1.add(new Vector(x1, y1));
                v1.add(n);

                // second control point
                Vector v2 = new Vector(direction.x, direction.y);
                v2.mult(-factor);
                v2.add(new Vector(x2, y2));
                v2.add(n);

                Vector middle = bezierPoint(x1, y1, v1.x, v1.y, v2.x, v2.y, x2, y2, 0.5f);
                item.setData(LABEL_X, middle.x);
                item.setData(LABEL_Y, middle.y);
            } else {
                Float x = ((Float) sourceItem.getData(NodeItem.X) + (Float) targetItem.getData(NodeItem.X)) / 2f;
                Float y = ((Float) sourceItem.getData(NodeItem.Y) + (Float) targetItem.getData(NodeItem.Y)) / 2f;
                item.setData(LABEL_X, x);
                item.setData(LABEL_Y, y);
            }
        }

View Full Code Here

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

Examples of prefuse.visual.NodeItem

        {
            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

Examples of prefuse.visual.NodeItem

        @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

Examples of prefuse.visual.NodeItem

    @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

Examples of prefuse.visual.NodeItem

        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

Examples of prefuse.visual.NodeItem

    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

Examples of prefuse.visual.NodeItem

    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

Examples of prefuse.visual.NodeItem

    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

Examples of prefuse.visual.NodeItem

        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
TOP
Copyright © 2018 www.massapi.com. 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.