Package prefuse.visual

Examples of prefuse.visual.VisualItem


   
    /**
     * @see prefuse.action.Action#run(double)
     */
    public void run(double frac) {
        VisualItem lastItem = null;
       
        Rectangle2D bounds = getLayoutBounds();
        float floor = (float)
            (m_horiz ? (m_top?bounds.getMaxX():bounds.getMinX())
                     : (m_top?bounds.getMinY():bounds.getMaxY()));
        int bias = (m_horiz ? 0 : 1);
       
        // TODO: generalize this -- we want tuplesReversed available for general sets
        Iterator iter = ((Table)m_vis.getGroup(m_group)).tuplesReversed();
        while ( iter.hasNext() ) {
            VisualItem item = (VisualItem)iter.next();
            boolean prev = item.isStartVisible();
            boolean cur = item.isVisible();
           
            if ( !prev && cur ) {
                // newly visible, update contour
                float[] f = (float[])item.get(m_polyField);
                if ( f == null ) continue;
               
                if ( lastItem == null ) {
                    // no previous items, smash values to the floor
                    for ( int i=0; i<f.length; i+=2 )
View Full Code Here


        double x, y;
        double w = b.getWidth();
        double h = b.getHeight();
        Iterator iter = getVisualization().visibleItems(m_group);
        while ( iter.hasNext() ) {
            VisualItem item = (VisualItem)iter.next();
            x = (int)(b.getX() + r.nextDouble()*w);
            y = (int)(b.getY() + r.nextDouble()*h);
            setX(item,null,x);
            setY(item,null,y);
        }
View Full Code Here

        }
       
        Iterator iter = ts.tuples();
        // layout grid contents
        for ( int i=0; iter.hasNext() && i < m*n; ++i ) {
            VisualItem item = (VisualItem)iter.next();
            item.setVisible(true);
            double x = bx + w*((i%n)/(double)(n-1));
            double y = by + h*((i/n)/(double)(m-1));
            setX(item,null,x);
            setY(item,null,y);
        }
        // set left-overs invisible
        while ( iter.hasNext() ) {
            VisualItem item = (VisualItem)iter.next();
            item.setVisible(false);
        }
    }
View Full Code Here

            radius = 0.45 * (height < width ? height : width);
        }

        Iterator items = ts.tuples();
        for (int i=0; items.hasNext(); i++) {
            VisualItem n = (VisualItem)items.next();
            double angle = (2*Math.PI*i) / nn;
            double x = Math.cos(angle)*radius + cx;
            double y = Math.sin(angle)*radius + cy;
            setX(n, null, x);
            setY(n, null, y);
View Full Code Here

        double worst = Double.MAX_VALUE, nworst;
        int len;
       
        while ( (len=c.size()) > 0 ) {
            // add item to the row list, ignore if negative area
            VisualItem item = (VisualItem) c.get(len-1);
            double a = item.getDouble(AREA);
            if (a <= 0.0) {
                c.remove(len-1);
                continue;
            }
            row.add(item);
View Full Code Here

   
    /**
     * @see prefuse.data.expression.Expression#get(prefuse.data.Tuple)
     */
    public Object get(Tuple t) {
        VisualItem item = (VisualItem)t;
        Visualization vis = item.getVisualization();
        String group = getGroup(t);
        SearchTupleSet sts = (SearchTupleSet)vis.getGroup(group);
        return sts.getQuery();
    }
View Full Code Here

        Iterator iter, double margin, Rectangle2D b)
    {
        b.setFrame(Double.NaN,Double.NaN,Double.NaN,Double.NaN);
        // TODO: synchronization?
        if ( iter.hasNext() ) {
            VisualItem item = (VisualItem)iter.next();
            Rectangle2D nb = item.getBounds();
            b.setFrame(nb);
        }
        while ( iter.hasNext() ) {  
            VisualItem item = (VisualItem)iter.next();
            Rectangle2D nb = item.getBounds();
            double x1 = (nb.getMinX()<b.getMinX() ? nb.getMinX() : b.getMinX());
            double x2 = (nb.getMaxX()>b.getMaxX() ? nb.getMaxX() : b.getMaxX());
            double y1 = (nb.getMinY()<b.getMinY() ? nb.getMinY() : b.getMinY());
            double y2 = (nb.getMaxY()>b.getMaxY() ? nb.getMaxY() : b.getMaxY());
            b.setFrame(x1,y1,x2-x1,y2-y1);
View Full Code Here

    public static Point2D getCentroid(Iterator iter, Point2D p) {
        double cx = 0, cy = 0;
        int count = 0;
       
        while ( iter.hasNext() ) {
            VisualItem item = (VisualItem)iter.next();
            double x = item.getX(), y = item.getY();
            if ( !(Double.isInfinite(x) || Double.isNaN(x)) &&
                 !(Double.isInfinite(y) || Double.isNaN(y)) )
            {
                cx += x;
                cy += y;
View Full Code Here

        // run-continuously layout
        if ( m_runonce ) {
            Point2D anchor = getLayoutAnchor();
            Iterator iter = m_vis.visibleItems(m_nodeGroup);
            while ( iter.hasNext() ) {
                VisualItem  item = (NodeItem)iter.next();
                item.setX(anchor.getX());
                item.setY(anchor.getY());
            }
            m_fsim.clear();
            long timestep = 1000L;
            initSimulator(m_fsim);
            for ( int i = 0; i < m_iterations; i++ ) {
View Full Code Here

        }
       
        // update positions
        Iterator iter = m_vis.visibleItems(m_nodeGroup);
        while ( iter.hasNext() ) {
            VisualItem item = (VisualItem)iter.next();
            ForceItem fitem = (ForceItem)item.get(FORCEITEM);
           
            if ( item.isFixed() ) {
                // clear any force computations
                fitem.force[0] = 0.0f;
                fitem.force[1] = 0.0f;
                fitem.velocity[0] = 0.0f;
                fitem.velocity[1] = 0.0f;
               
                if ( Double.isNaN(item.getX()) ) {
                    setX(item, referrer, 0.0);
                    setY(item, referrer, 0.0);
                }
                continue;
            }
           
            double x = fitem.location[0];
            double y = fitem.location[1];
           
            if ( m_enforceBounds && bounds != null) {
                Rectangle2D b = item.getBounds();
                double hw = b.getWidth()/2;
                double hh = b.getHeight()/2;
                if ( x+hw > x2 ) x = x2-hw;
                if ( x-hw < x1 ) x = x1+hw;
                if ( y+hh > y2 ) y = y2-hh;
View Full Code Here

TOP

Related Classes of prefuse.visual.VisualItem

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.