本文整理汇总了Java中prefuse.visual.VisualItem.getBounds方法的典型用法代码示例。如果您正苦于以下问题:Java VisualItem.getBounds方法的具体用法?Java VisualItem.getBounds怎么用?Java VisualItem.getBounds使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类prefuse.visual.VisualItem
的用法示例。
在下文中一共展示了VisualItem.getBounds方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: run
import prefuse.visual.VisualItem; //导入方法依赖的package包/类
@Override
public void run( double frac )
{
Iterator<?> iter = m_vis.items( m_group );
while ( iter.hasNext() ) {
DecoratorItem decorator = (DecoratorItem)iter.next();
VisualItem decoratedItem = decorator.getDecoratedItem();
Rectangle2D bounds = decoratedItem.getBounds();
double x = bounds.getCenterX();
double y = bounds.getCenterY();
setX( decorator, null, x );
setY( decorator, null, y );
}
}
示例2: run
import prefuse.visual.VisualItem; //导入方法依赖的package包/类
public void run(double frac) {
Iterator iter = m_vis.items(m_group);
int count = 0;
while ( iter.hasNext() ) {
DecoratorItem item = (DecoratorItem)iter.next();
VisualItem node = item.getDecoratedItem();
if (node.isVisible()) {
item.setVisible(true);
count++;
Rectangle2D bounds = node.getBounds();
setX(item, null, bounds.getCenterX());
setY(item, null, bounds.getCenterY());
} else {
item.setVisible(false);
}
}
}
示例3: run
import prefuse.visual.VisualItem; //导入方法依赖的package包/类
public void run(double frac) {
Iterator iter = m_vis.items(m_group);
while ( iter.hasNext() ) {
DecoratorItem decorator = (DecoratorItem)iter.next();
VisualItem decoratedItem = decorator.getDecoratedItem();
Rectangle2D bounds = decoratedItem.getBounds();
double x = bounds.getCenterX();
double y = bounds.getCenterY();
/* modification to move edge labels more to the arrow head
double x2 = 0, y2 = 0;
if (decoratedItem instanceof EdgeItem){
VisualItem dest = ((EdgeItem)decoratedItem).getTargetItem();
x2 = dest.getX();
y2 = dest.getY();
x = (x + x2) / 2;
y = (y + y2) / 2;
}
*/
setX(decorator, null, x);
setY(decorator, null, y);
}
}
示例4: editText
import prefuse.visual.VisualItem; //导入方法依赖的package包/类
/**
* Edit text for the given VisualItem and attribute. Presents a text editing widget spaning the item's bounding box. Use stopEditing() to hide the text widget. When stopEditing() is called, the
* data field will automatically be updated with the VisualItem.
*
* @param item
* the VisualItem to edit
* @param attribute
* the attribute to edit
*/
public void editText(VisualItem item, String attribute)
{
if (m_editing)
{
stopEditing();
}
Rectangle2D b = item.getBounds();
Rectangle r = m_transform.createTransformedShape(b).getBounds();
// Font f = getFont();
// int size = (int) Math.round(f.getSize() * m_transform.getScaleX());
// Font nf = new Font(f.getFontName(), f.getStyle(), size);
// m_editor.setFont(nf);
editText(item, attribute, r);
}
示例5: run
import prefuse.visual.VisualItem; //导入方法依赖的package包/类
@Override
public void run(double frac) {
Iterator<?> iter = m_vis.items(m_group);
while ( iter.hasNext() ) {
DecoratorItem item = (DecoratorItem)iter.next();
VisualItem node = item.getDecoratedItem();
//Dbg.printMsg("--> " + node, LogLvl.Normal);
Rectangle2D bounds = node.getBounds();
setX(item, null, bounds.getCenterX());
setY(item, null, bounds.getCenterY());
if (((String)node.get(m_group)).equals("FAKE")) {
item.setTextColor(ColorLib.alpha(0));
}
else if (((String)node.get(m_group)).equals("LBUB")) {
item.setTextColor(ColorLib.alpha(0));
}
}
}
示例6: run
import prefuse.visual.VisualItem; //导入方法依赖的package包/类
@Override
public void run( double frac )
{
Iterator iter = m_vis.items( m_group );
while( iter.hasNext() )
{
DecoratorItem item = (DecoratorItem) iter.next();
VisualItem node = item.getDecoratedItem();
Rectangle2D bounds = node.getBounds();
setX( item, node, bounds.getX() + StackedLayout.INSET );
setY( item, node, bounds.getY() + StackedLayout.INSET + 12 );
}
}
示例7: run
import prefuse.visual.VisualItem; //导入方法依赖的package包/类
public void run(double frac) {
Iterator iter = m_vis.items(m_group);
while ( iter.hasNext() ) {
DecoratorItem item = (DecoratorItem)iter.next();
VisualItem node = item.getDecoratedItem();
Rectangle2D bounds = node.getBounds();
setX(item, null, bounds.getCenterX());
setY(item, null, bounds.getCenterY());
}
}
示例8: addPoint
import prefuse.visual.VisualItem; //导入方法依赖的package包/类
private static void addPoint(double[] pts, int idx,
VisualItem item, int growth)
{
Rectangle2D b = item.getBounds();
double minX = (b.getMinX())-growth, minY = (b.getMinY())-growth;
double maxX = (b.getMaxX())+growth, maxY = (b.getMaxY())+growth;
pts[idx] = minX; pts[idx+1] = minY;
pts[idx+2] = minX; pts[idx+3] = maxY;
pts[idx+4] = maxX; pts[idx+5] = minY;
pts[idx+6] = maxX; pts[idx+7] = maxY;
}
示例9: addPoint
import prefuse.visual.VisualItem; //导入方法依赖的package包/类
private static void addPoint(double[] pts, int idx,
VisualItem item, int growth)
{
Rectangle2D b = item.getBounds();
double minX = (b.getMinX())-growth, minY = (b.getMinY())-growth;
double maxX = (b.getMaxX())+growth, maxY = (b.getMaxY())+growth;
pts[idx] = minX; pts[idx+1] = minY;
pts[idx+2] = minX; pts[idx+3] = maxY;
pts[idx+4] = maxX; pts[idx+5] = minY;
pts[idx+6] = maxX; pts[idx+7] = maxY;
}
示例10: 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());
}
}
}
}
示例11: addPoint
import prefuse.visual.VisualItem; //导入方法依赖的package包/类
private static void addPoint(double[] pts, int idx,
VisualItem item, int growth)
{
Rectangle2D b = item.getBounds();
double minX = (b.getMinX())-growth, minY = (b.getMinY())-growth;
double maxX = (b.getMaxX())+growth, maxY = (b.getMaxY())+growth;
pts[idx] = minX; pts[idx+1] = minY;
pts[idx+2] = minX; pts[idx+3] = maxY;
pts[idx+4] = maxX; pts[idx+5] = minY;
pts[idx+6] = maxX; pts[idx+7] = maxY;
}
示例12: updateNodePositions
import prefuse.visual.VisualItem; //导入方法依赖的package包/类
private void updateNodePositions() {
Rectangle2D bounds = getLayoutBounds();
double x1=0, x2=0, y1=0, y2=0;
if ( bounds != null ) {
x1 = bounds.getMinX(); y1 = bounds.getMinY();
x2 = bounds.getMaxX(); y2 = bounds.getMaxY();
}
// 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;
if ( y-hh < y1 ) y = y1+hh;
}
// set the actual position
setX(item, referrer, x);
setY(item, referrer, y);
}
}
示例13: updateNodePositions
import prefuse.visual.VisualItem; //导入方法依赖的package包/类
private void updateNodePositions() {
Rectangle2D bounds = getLayoutBounds();
double x1=0, x2=0, y1=0, y2=0;
if ( bounds != null ) {
x1 = bounds.getMinX(); y1 = bounds.getMinY();
x2 = bounds.getMaxX(); y2 = bounds.getMaxY();
}
// update positions
TupleSet ts = m_vis.getGroup(m_nodeGroup);
Iterator<?> iter;
if (m_filter == null)
iter = ts.tuples();
else
iter = ts.tuples(m_filter);
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;
if ( y-hh < y1 ) y = y1+hh;
}
// set the actual position
setX(item, referrer, x);
setY(item, referrer, y);
}
}