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


Java VisualItem.getX方法代码示例

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


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

示例1: getAlignedPoint

import prefuse.visual.VisualItem; //导入方法依赖的package包/类
/**
 * Helper method, which calculates the top-left co-ordinate of an item
 * given the item's alignment.
 */
protected static void getAlignedPoint(
	Point2D p, VisualItem item,
	double w, double h, int xAlign, int yAlign )
{
	double x = item.getX(), y = item.getY();
	if ( Double.isNaN( x ) || Double.isInfinite( x ) )
		x = 0; // safety check
	if ( Double.isNaN( y ) || Double.isInfinite( y ) )
		y = 0; // safety check

	if ( xAlign == Constants.CENTER ) {
		x = x - ( w / 2 );
	}
	else if ( xAlign == Constants.RIGHT ) {
		x = x - w;
	}
	if ( yAlign == Constants.CENTER ) {
		y = y - ( h / 2 );
	}
	else if ( yAlign == Constants.BOTTOM ) {
		y = y - h;
	}
	p.setLocation( x, y );
}
 
开发者ID:kartoFlane,项目名称:hiervis,代码行数:29,代码来源:StringRenderer.java

示例2: getAlignedPoint

import prefuse.visual.VisualItem; //导入方法依赖的package包/类
/**
 * Helper method, which calculates the top-left co-ordinate of an item
 * given the item's alignment.
 */
protected static void getAlignedPoint(Point2D p, VisualItem item, 
        double w, double h, int xAlign, int yAlign)
{
    double x = item.getX(), y = item.getY();
    if ( Double.isNaN(x) || Double.isInfinite(x) )
        x = 0; // safety check
    if ( Double.isNaN(y) || Double.isInfinite(y) )
        y = 0; // safety check
    
    if ( xAlign == Constants.CENTER ) {
        x = x-(w/2);
    } else if ( xAlign == Constants.RIGHT ) {
        x = x-w;
    }
    if ( yAlign == Constants.CENTER ) {
        y = y-(h/2);
    } else if ( yAlign == Constants.BOTTOM ) {
        y = y-h;
    }
    p.setLocation(x,y);
}
 
开发者ID:P15,项目名称:jailer,代码行数:26,代码来源:TableRenderer.java

示例3: getCentroid

import prefuse.visual.VisualItem; //导入方法依赖的package包/类
/**
 * Return the centroid (averaged location) of a group of items.
 * @param iter an iterator of VisualItems
 * @param p a Point2D instance in which to store the result
 * @return the centroid point. This is the same object as the
 * parameter <code>p</code>.
 */
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;
            count++;
        }
    }
    if ( count > 0 ) {
        cx /= count;
        cy /= count;
    }
    p.setLocation(cx, cy);
    return p;
}
 
开发者ID:dritanlatifi,项目名称:AndroidPrefuse,代码行数:30,代码来源:DisplayLib.java

示例4: move

import prefuse.visual.VisualItem; //导入方法依赖的package包/类
protected static void move(VisualItem item, double dx, double dy) {
    if ( item instanceof AggregateItem ) {
        Iterator items = ((AggregateItem)item).items();
        while ( items.hasNext() ) {
            move((VisualItem)items.next(), dx, dy);
        }
    } else {
        double x = item.getX();
        double y = item.getY();
        item.setStartX(x);  item.setStartY(y);
        item.setX(x+dx);    item.setY(y+dy);
        item.setEndX(x+dx); item.setEndY(y+dy);
    }
}
 
开发者ID:santiontanon,项目名称:RHOG,代码行数:15,代码来源:DLGVisualizer.java

示例5: move

import prefuse.visual.VisualItem; //导入方法依赖的package包/类
protected static void move(VisualItem item, double dx, double dy) {
    if ( item instanceof AggregateItem ) {
        Iterator<?> items = ((AggregateItem)item).items();
        while ( items.hasNext() ) {
            move((VisualItem)items.next(), dx, dy);
        }
    } else {
        double x = item.getX();
        double y = item.getY();
        item.setStartX(x);  item.setStartY(y);
        item.setX(x+dx);    item.setY(y+dy);
        item.setEndX(x+dx); item.setEndY(y+dy);
    }
}
 
开发者ID:codydunne,项目名称:netgrok,代码行数:15,代码来源:AggregateDemo.java

示例6: move

import prefuse.visual.VisualItem; //导入方法依赖的package包/类
protected static void move(VisualItem item, double dx, double dy) {
	if ( item instanceof AggregateItem ) {
		Iterator<?> items = ((AggregateItem)item).items();
		while ( items.hasNext() ) {
			move((VisualItem)items.next(), dx, dy);
		}
	} else {
		double x = item.getX();
		double y = item.getY();
		item.setStartX(x);  item.setStartY(y);
		item.setX(x+dx);    item.setY(y+dy);
		item.setEndX(x+dx); item.setEndY(y+dy);
	}
}
 
开发者ID:codydunne,项目名称:netgrok,代码行数:15,代码来源:CodyTestWindow.java

示例7: getRawShape

import prefuse.visual.VisualItem; //导入方法依赖的package包/类
/**
 * @see prefuse.render.AbstractShapeRenderer#getRawShape(prefuse.visual.VisualItem)
 */
protected Shape getRawShape(VisualItem item) {
    float[] poly = (float[])item.get(m_polyfield);
    if ( poly == null ) { return null; }
    
    float x = (float)item.getX();
    float y = (float)item.getY();
    
    // initialize the path
    m_path.reset();
    m_path.moveTo(x+poly[0],y+poly[1]);
    
    if ( m_polyType == Constants.POLY_TYPE_LINE )
    {
        // create a polygon
        for ( int i=2; i<poly.length; i+=2 ) {
            if ( Float.isNaN(poly[i]) ) break;
            m_path.lineTo(x+poly[i],y+poly[i+1]);
        }
    }
    else if ( m_polyType == Constants.POLY_TYPE_CURVE )
    {
        // interpolate the polygon points with a cardinal spline
        return GraphicsLib.cardinalSpline(m_path, poly, 
                m_slack, m_closed, x, y);
    }
    else if ( m_polyType == Constants.POLY_TYPE_STACK )
    {
        // used curved lines, except for non-sloping segments
        return GraphicsLib.stackSpline(m_path, poly, 
                m_epsilon, m_slack, m_closed, x, y);
    }
    if ( m_closed ) m_path.closePath();
    return m_path;
}
 
开发者ID:dritanlatifi,项目名称:AndroidPrefuse,代码行数:38,代码来源:PolygonRenderer.java

示例8: run

import prefuse.visual.VisualItem; //导入方法依赖的package包/类
/**
 * @see prefuse.action.Action#run(double)
 */
public void run(double frac) {
    Rectangle2D bounds = getLayoutBounds();
    Point2D anchor = correct(m_anchor, bounds);
    
    final Iterator iter = getVisualization().visibleItems(m_group);
    
    while ( iter.hasNext() ) {
        VisualItem item = (VisualItem)iter.next();
        if ( item.isFixed() ) continue;
        
        // reset distorted values
        // TODO - make this play nice with animation?
        item.setX(item.getEndX());
        item.setY(item.getEndY());
        item.setSize(item.getEndSize());
        
        // compute distortion if we have a distortion focus
        if ( anchor != null ) {
            Rectangle2D bbox = item.getBounds();
            double x = item.getX();
            double y = item.getY();
            
            // position distortion
            if ( m_distortX )
                item.setX(x=distortX(x, anchor, bounds));
            if ( m_distortY )
                item.setY(y=distortY(y, anchor, bounds));
            
            // size distortion
            if ( m_distortSize ) {
                double sz = distortSize(bbox, x, y, anchor, bounds);
                item.setSize(sz*item.getSize());
            }
        }
    }
}
 
开发者ID:dritanlatifi,项目名称:AndroidPrefuse,代码行数:40,代码来源:Distortion.java

示例9: getRawShape

import prefuse.visual.VisualItem; //导入方法依赖的package包/类
protected Shape getRawShape( VisualItem item )
{
	double width, height;

	double x = item.getX();
	if ( Double.isNaN( x ) || Double.isInfinite( x ) )
		x = 0;
	double y = item.getY();
	if ( Double.isNaN( y ) || Double.isInfinite( y ) )
		y = 0;

	if ( m_isVertical ) {
		// @@@ what is the getSize for?
		width = m_barWidth * item.getSize();
		if ( m_orientation == Constants.ORIENT_BOTTOM_TOP ) {
			height = m_bounds.getMaxY() - y;
		}
		else {
			height = y;
			y = m_bounds.getMinY();
		}

		// Center the bar around the x-location
		if ( width > 1 ) {
			x = x - width / 2;
		}
	}
	else {
		height = m_barWidth * item.getSize();
		if ( m_orientation == Constants.ORIENT_LEFT_RIGHT ) {
			width = x;
			x = m_bounds.getMinX();
		}
		else {
			width = m_bounds.getMaxX() - x;
		}

		// Center the bar around the y-location
		if ( height > 1 ) {
			y = y - height / 2;
		}
	}

	m_rect.setFrame( x, y, width, height );
	return m_rect;
}
 
开发者ID:kartoFlane,项目名称:hiervis,代码行数:47,代码来源:BarRenderer.java

示例10: getRawShape

import prefuse.visual.VisualItem; //导入方法依赖的package包/类
/**
 * @see prefuse.render.AbstractShapeRenderer#getRawShape(prefuse.visual.VisualItem)
 */
protected Shape getRawShape(VisualItem item) {
    int stype = item.getShape();
    double x = item.getX();
    if ( Double.isNaN(x) || Double.isInfinite(x) )
        x = 0;
    double y = item.getY();
    if ( Double.isNaN(y) || Double.isInfinite(y) )
        y = 0;
    double width = m_baseSize*item.getSize();
    double height = m_baseSize*item.getSizeY();
    
    // Center the shape around the specified x and y
    if ( width > 1 ) {
        x = x-width/2;
        if (Double.isNaN(height))
        	y = y-width/2;
        else
        	y = y-height/2;
    }
    
    if (Double.isNaN(height)) {
    	switch ( stype ) {
    	case Constants.SHAPE_NONE:
    		return null;
    	case Constants.SHAPE_RECTANGLE:
    		return rectangle(x, y, width, width);
    	case Constants.SHAPE_ELLIPSE:
    		return ellipse(x, y, width, width);
    	case Constants.SHAPE_TRIANGLE_UP:
    		return triangle_up((float)x, (float)y, (float)width);
    	case Constants.SHAPE_TRIANGLE_DOWN:
    		return triangle_down((float)x, (float)y, (float)width);
    	case Constants.SHAPE_TRIANGLE_LEFT:
    		return triangle_left((float)x, (float)y, (float)width);
    	case Constants.SHAPE_TRIANGLE_RIGHT:
    		return triangle_right((float)x, (float)y, (float)width);
    	case Constants.SHAPE_CROSS:
    		return cross((float)x, (float)y, (float)width);
    	case Constants.SHAPE_STAR:
    		return star((float)x, (float)y, (float)width);
    	case Constants.SHAPE_HEXAGON:
    		return hexagon((float)x, (float)y, (float)width);
    	case Constants.SHAPE_DIAMOND:
    		return diamond((float)x, (float)y, (float)width);
    	default:
    		return extendedShape(stype,x,y,width,width);
    	}
    } else {
    	switch ( stype ) {
    	case Constants.SHAPE_NONE:
    		return null;
    	case Constants.SHAPE_RECTANGLE:
    		return rectangle(x, y, width, height);
    	case Constants.SHAPE_ELLIPSE:
    		return ellipse(x, y, width, height);
    	case Constants.SHAPE_TRIANGLE_UP:
    		throw new IllegalStateException("Shape cannot be scaled vertically: "+stype);
    	case Constants.SHAPE_TRIANGLE_DOWN:
    		throw new IllegalStateException("Shape cannot be scaled vertically: "+stype);
    	case Constants.SHAPE_TRIANGLE_LEFT:
    		throw new IllegalStateException("Shape cannot be scaled vertically: "+stype);
    	case Constants.SHAPE_TRIANGLE_RIGHT:
    		throw new IllegalStateException("Shape cannot be scaled vertically: "+stype);
    	case Constants.SHAPE_CROSS:
    		throw new IllegalStateException("Shape cannot be scaled vertically: "+stype);
    	case Constants.SHAPE_STAR:
    		throw new IllegalStateException("Shape cannot be scaled vertically: "+stype);
    	case Constants.SHAPE_HEXAGON:
    		throw new IllegalStateException("Shape cannot be scaled vertically: "+stype);
    	case Constants.SHAPE_DIAMOND:
    		throw new IllegalStateException("Shape cannot be scaled vertically: "+stype);
    	default:
    		return extendedShape(stype,x,y,width,height);
    	}
    }
}
 
开发者ID:dritanlatifi,项目名称:AndroidPrefuse,代码行数:80,代码来源:ShapeRenderer.java

示例11: setX

import prefuse.visual.VisualItem; //导入方法依赖的package包/类
/**
 * Update the x-coordinate of an item. The current x value will become the
 * new starting x value, while the given value will become the new current
 * x and ending x values. This method also supports an optional referrer
 * item, whose x coordinate will become the new starting x coordinate
 * of item if item's current x value is NaN.
 * @param item the VisualItem to update
 * @param referrer an optional referrer VisualItem
 * @param x the x value to set
 */
public static void setX(VisualItem item, VisualItem referrer, double x) {
    double sx = item.getX();
    if ( Double.isNaN(sx) )
        sx = (referrer != null ? referrer.getX() : x);
    
    item.setStartX(sx);
    item.setEndX(x);
    item.setX(x);
}
 
开发者ID:dritanlatifi,项目名称:AndroidPrefuse,代码行数:20,代码来源:PrefuseLib.java

示例12: distance

import prefuse.visual.VisualItem; //导入方法依赖的package包/类
/**
 * Get the distance between the x,y points of two VisualItems.
 * @param vi1 the first VisualItem
 * @param vi2 the second VisualItem
 * @return the distance between the items' x,y coordinates
 */
public static double distance(VisualItem vi1, VisualItem vi2) {
    double dx = vi1.getX() - vi2.getX();
    double dy = vi1.getY() - vi2.getY();
    return Math.sqrt(dx*dx + dy*dy);
}
 
开发者ID:dritanlatifi,项目名称:AndroidPrefuse,代码行数:12,代码来源:PrefuseLib.java


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