当前位置: 首页>>代码示例>>Java>>正文


Java VisualItem.getDouble方法代码示例

本文整理汇总了Java中prefuse.visual.VisualItem.getDouble方法的典型用法代码示例。如果您正苦于以下问题:Java VisualItem.getDouble方法的具体用法?Java VisualItem.getDouble怎么用?Java VisualItem.getDouble使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在prefuse.visual.VisualItem的用法示例。


在下文中一共展示了VisualItem.getDouble方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getColor

import prefuse.visual.VisualItem; //导入方法依赖的package包/类
/**
 * @see prefuse.action.assignment.ColorAction#getColor(prefuse.visual.VisualItem)
 */
public int getColor(VisualItem item) {
    // check for any cascaded rules first
    Object o = lookup(item);
    if ( o != null ) {
        if ( o instanceof ColorAction ) {
            return ((ColorAction)o).getColor(item);
        } else if ( o instanceof Integer ) {
            return ((Integer)o).intValue();
        } else {
            Logger.getLogger(this.getClass().getName())
                .warning("Unrecognized Object from predicate chain.");
        }
    }
    
    // otherwise perform data-driven assignment
    switch ( m_type ) {
    case Constants.NUMERICAL:
        double v = item.getDouble(m_dataField);
        double f = MathLib.interp(m_scale, v, m_dist);
        return m_cmap.getColor(f);
    default:
        Integer idx = (Integer)m_omap.get(item.get(m_dataField));
        return m_cmap.getColor(idx.doubleValue());
    }
}
 
开发者ID:dritanlatifi,项目名称:AndroidPrefuse,代码行数:29,代码来源:DataColorAction.java

示例2: getSize

import prefuse.visual.VisualItem; //导入方法依赖的package包/类
/**
 * @see prefuse.action.assignment.SizeAction#getSize(prefuse.visual.VisualItem)
 */
public double getSize(VisualItem item) {
    // check for any cascaded rules first
    double size = super.getSize(item);
    if ( !Double.isNaN(size) ) {
        return size;
    }
    
    // otherwise perform data-driven assignment
    double v = item.getDouble(m_dataField);
    double f = MathLib.interp(m_scale, v, m_dist);
    if ( m_bins < 1 ) {
        // continuous scale
        v = m_minSize + f * m_sizeRange;
    } else {
        // binned sizes
        int bin = f < 1.0 ? (int)(f*m_bins) : m_bins-1;
        v = m_minSize + bin*(m_sizeRange/(m_bins-1));
    }
    // return the size value. if this action is configured to return
    // 2-dimensional sizes (ie area rather than length) then the
    // size value is appropriately scaled first
    return m_is2DArea ? PrefuseLib.getSize2D(v) : v;
}
 
开发者ID:dritanlatifi,项目名称:AndroidPrefuse,代码行数:27,代码来源:DataSizeAction.java

示例3: process

import prefuse.visual.VisualItem; //导入方法依赖的package包/类
/**
 * @see prefuse.action.ItemAction#process(prefuse.visual.VisualItem, double)
 */
public void process(VisualItem item, double frac) {
    double v = item.getStartX();
    item.setX(v + frac*(item.getEndX()-v));
    v = item.getStartY();
    item.setY(v + frac*(item.getEndY()-v));
    v = item.getDouble(VisualItem.STARTX2);
    v = v + frac*(item.getDouble(VisualItem.ENDX2)-v);
    item.setDouble(VisualItem.X2, v);
    v = item.getDouble(VisualItem.STARTY2);
    v = v + frac*(item.getDouble(VisualItem.ENDY2)-v);
    item.setDouble(VisualItem.Y2, v);
    
    int c = ColorLib.interp(item.getStartStrokeColor(),
            item.getEndStrokeColor(), frac);
    item.setStrokeColor(c);
    
    int tc = ColorLib.interp(item.getStartTextColor(),
            item.getEndTextColor(), frac);
    item.setTextColor(tc);
    
    int fc = ColorLib.interp(item.getStartFillColor(),
            item.getEndFillColor(), frac);
    item.setFillColor(fc);
}
 
开发者ID:dritanlatifi,项目名称:AndroidPrefuse,代码行数:28,代码来源:AxisLabelAnimator.java

示例4: squarify

import prefuse.visual.VisualItem; //导入方法依赖的package包/类
private void squarify(List c, List row, double w, Rectangle2D r) {
    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);
        
        nworst = worst(row, w);
        if ( nworst <= worst ) {
            c.remove(len-1);
            worst = nworst;
        } else {
            row.remove(row.size()-1); // remove the latest addition
            r = layoutRow(row, w, r); // layout the current row
            w = Math.min(r.getWidth(),r.getHeight()); // recompute w
            row.clear(); // clear the row
            worst = Double.MAX_VALUE;
        }
    }
    if ( row.size() > 0 ) {
        r = layoutRow(row, w, r); // layout the current row
        row.clear(); // clear the row
    }
}
 
开发者ID:codydunne,项目名称:netgrok,代码行数:32,代码来源:SquarifiedHostTreeMapLayout.java

示例5: getPeaks

import prefuse.visual.VisualItem; //导入方法依赖的package包/类
private double getPeaks() {
    double sum = 0;
    
    // first, compute max value of the current data
    Arrays.fill(peaks, 0);
    Iterator iter = m_vis.visibleItems(m_group);
    while ( iter.hasNext() ) {
        VisualItem item = (VisualItem)iter.next();
        for ( int i=0; i<columns.length; ++i ) {
            double val = item.getDouble(columns[i]); 
            peaks[i] += val;
            sum += val;
        }
    }
    double max = ArrayLib.max(peaks);
    
    // update peaks array as needed
    if ( !m_norm ) {
        Arrays.fill(peaks, max); 
    }
    
    // adjust peaks to include padding space
    if ( !m_norm ) {
        for ( int i=0; i<peaks.length; ++i ) {
            peaks[i] += m_padding * peaks[i];
        }
        max += m_padding*max;
    }
    
    // return max range value
    if ( m_norm ) {
        max = 1.0;
    }
    if ( Double.isNaN(max) )
        max = 0;
    return max;
}
 
开发者ID:dritanlatifi,项目名称:AndroidPrefuse,代码行数:38,代码来源:StackedAreaChart.java

示例6: getRawShape

import prefuse.visual.VisualItem; //导入方法依赖的package包/类
/**
 * @see prefuse.render.AbstractShapeRenderer#getRawShape(prefuse.visual.VisualItem)
 */
protected Shape getRawShape(VisualItem item) {
    double x1 = item.getDouble(VisualItem.X);
    double y1 = item.getDouble(VisualItem.Y);
    double x2 = item.getDouble(VisualItem.X2);
    double y2 = item.getDouble(VisualItem.Y2);
    m_line.setLine(x1,y1,x2,y2);
    
    if ( !item.canGetString(VisualItem.LABEL) )
        return m_line;
    
    String label = item.getString(VisualItem.LABEL);
    if ( label == null ) return m_line;
    
    AwtFontMetrics fm = new AwtFontMetrics( item.getFont()) ;
    m_ascent = fm.getAscent() + 1; // TODO for Dritan: check why is it necesary to add 1 pixel to the ascent?
    int h = fm.getHeight();
    int w = fm.stringWidth(label);
    double tx, ty;
    
    // get text x-coord
    switch ( m_xalign ) {
    case Constants.FAR_RIGHT:
        tx = x2 + 2;
        break;
    case Constants.FAR_LEFT:
        tx = x1 - w - 2;
        break;
    case Constants.CENTER:
        tx = x1 + (x2-x1)/2 - w/2;
        break;
    case Constants.RIGHT:
        tx = x2 - w;
        break;
    case Constants.LEFT:
    default:
        tx = x1;
    }
    // get text y-coord
    switch ( m_yalign ) {
    case Constants.FAR_TOP:
        ty = y1-h;
        break;
    case Constants.FAR_BOTTOM:
        ty = y2;
        break;
    case Constants.CENTER:
        ty = y1 + (y2-y1)/2 - h/2;
        break;
    case Constants.TOP:
        ty = y1;
        break;
    case Constants.BOTTOM:
    default:
        ty = y2-h; 
    }
    m_box.setFrame(tx,ty,w,h);
    return m_box;
}
 
开发者ID:dritanlatifi,项目名称:AndroidPrefuse,代码行数:62,代码来源:AxisRenderer.java

示例7: run

import prefuse.visual.VisualItem; //导入方法依赖的package包/类
/**
 * @see prefuse.action.Action#run(double)
 */
public void run(double frac) {
    bounds = getLayoutBounds();
    Arrays.fill(baseline, 0);
    
    // get the orientation specifics sorted out
    float min = (float)(m_horiz?bounds.getMaxY() :bounds.getMinX());
    float hgt = (float)(m_horiz?bounds.getWidth():bounds.getHeight());
    int xbias = (m_horiz ? 1 : 0);
    int ybias = (m_horiz ? 0 : 1);
    int mult = m_top ? 1 : -1;
    float inc = (float) (m_horiz ? (bounds.getMinY()-bounds.getMaxY())
                                 : (bounds.getMaxX()-bounds.getMinX()));
    inc /= columns.length-1;
    int len = columns.length;
    
    // perform first walk to compute max values
    double maxValue = getPeaks();
    float b = (float)(m_horiz ? (m_top?bounds.getMinX():bounds.getMaxX())
                              : (m_top?bounds.getMinY():bounds.getMaxY()));
    Arrays.fill(baseline, b);
    
    m_model.setValueRange(0, maxValue, 0, maxValue);
    
    // perform second walk to compute polygon layout
    Table t = (Table)m_vis.getGroup(m_group);
    Iterator iter = t.tuplesReversed();
    while ( iter.hasNext() ) {
        VisualItem item = (VisualItem)iter.next();
        if ( !item.isVisible() ) continue;
        
        float height = 0;
        
        for ( int i=len; --i >= 0; ) {
            poly[2*(len-1-i)+xbias] = min + i*inc;
            poly[2*(len-1-i)+ybias] = (float)baseline[i];
        }
        for ( int i=0; i<columns.length; ++i ) {
            int base = 2*(len+i);
            double value = item.getDouble(columns[i]);
            baseline[i] += mult * hgt * 
                             MathLib.linearInterp(value,0,peaks[i]);
            poly[base+xbias] = min + i*inc;
            poly[base+ybias] = (float)baseline[i];
            height = Math.max(height,
                    Math.abs(poly[2*(len-1-i)+ybias]-poly[base+ybias]));
        }
        if ( height < m_threshold ) {
            item.setVisible(false);
        }

        setX(item, null, 0);
        setY(item, null, 0);
        setPolygon(item, poly);
    }
}
 
开发者ID:dritanlatifi,项目名称:AndroidPrefuse,代码行数:59,代码来源:StackedAreaChart.java


注:本文中的prefuse.visual.VisualItem.getDouble方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。