本文整理汇总了Java中prefuse.visual.VisualItem.isFixed方法的典型用法代码示例。如果您正苦于以下问题:Java VisualItem.isFixed方法的具体用法?Java VisualItem.isFixed怎么用?Java VisualItem.isFixed使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类prefuse.visual.VisualItem
的用法示例。
在下文中一共展示了VisualItem.isFixed方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: itemPressed
import prefuse.visual.VisualItem; //导入方法依赖的package包/类
/**
* @see Control#itemPressed(VisualItem, MouseEvent)
*/
public void itemPressed( VisualItem item, MouseEvent e )
{
if ( !UILib.isButtonPressed( e, button ) )
return;
if ( !( item instanceof NodeItem ) )
return;
Display d = (Display)e.getComponent();
down = d.getAbsoluteCoordinate( e.getPoint(), down );
wasFixed = item.isFixed();
item.setFixed( true );
}
示例2: updateNodePositions
import prefuse.visual.VisualItem; //导入方法依赖的package包/类
private void updateNodePositions() {
// update positions
Iterator<?> iter = m_vis.items(m_nodeGroup, 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];
// adam rules!
double xy_r = Math.sqrt((x - circle_x)*(x - circle_x) + (y-circle_y)*(y-circle_y));
if(xy_r > circle_r) {
x *= circle_r / xy_r;
y *= circle_r / xy_r;
}
// set the actual position
setX(item, referrer, x);
setY(item, referrer, y);
}
}
示例3: 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());
}
}
}
}
示例4: 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);
}
}
示例5: 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);
}
}