本文整理汇总了Java中prefuse.visual.NodeItem.getEndY方法的典型用法代码示例。如果您正苦于以下问题:Java NodeItem.getEndY方法的具体用法?Java NodeItem.getEndY怎么用?Java NodeItem.getEndY使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类prefuse.visual.NodeItem
的用法示例。
在下文中一共展示了NodeItem.getEndY方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getPoint
import prefuse.visual.NodeItem; //导入方法依赖的package包/类
private Point2D getPoint(NodeItem n, boolean start) {
// find the visible ancestor
NodeItem p = (NodeItem)n.getParent();
if ( start )
for (; p!=null && !p.isStartVisible(); p=(NodeItem)p.getParent());
else
for (; p!=null && !p.isEndVisible(); p=(NodeItem)p.getParent());
if ( p == null ) {
m_point.setLocation(n.getX(), n.getY());
return m_point;
}
// get the vanishing/appearing point
double x = start ? p.getStartX() : p.getEndX();
double y = start ? p.getStartY() : p.getEndY();
Rectangle2D b = p.getBounds();
switch ( m_orientation ) {
case Constants.ORIENT_LEFT_RIGHT:
m_point.setLocation(x+b.getWidth(), y);
break;
case Constants.ORIENT_RIGHT_LEFT:
m_point.setLocation(x-b.getWidth(), y);
break;
case Constants.ORIENT_TOP_BOTTOM:
m_point.setLocation(x, y+b.getHeight());
break;
case Constants.ORIENT_BOTTOM_TOP:
m_point.setLocation(x, y-b.getHeight());
break;
case Constants.ORIENT_CENTER:
m_point.setLocation(x, y);
break;
}
return m_point;
}
示例2: initSimulator
import prefuse.visual.NodeItem; //导入方法依赖的package包/类
protected void initSimulator(ForceSimulator fsim) {
// make sure we have force items to work with
TupleSet ts = m_vis.getGroup(m_nodeGroup);
if ( ts == null ) return;
try {
ts.addColumns(FORCEITEM_SCHEMA);
} catch ( IllegalArgumentException iae ) { /* ignored */ }
float startX = (referrer == null ? 0f : (float)referrer.getX());
float startY = (referrer == null ? 0f : (float)referrer.getY());
startX = Float.isNaN(startX) ? 0f : startX;
startY = Float.isNaN(startY) ? 0f : startY;
ArrayList<EdgeItem> edges = new ArrayList<EdgeItem>();
Iterator<?> iter = m_vis.items(m_nodeGroup, m_filter);
while ( iter.hasNext() ) {
NodeItem item = (NodeItem)iter.next();
ForceItem fitem = (ForceItem)item.get(FORCEITEM);
fitem.mass = getMassValue(item);
double x = item.getEndX();
double y = item.getEndY();
fitem.location[0] = (Double.isNaN(x) ? startX : (float)x);
fitem.location[1] = (Double.isNaN(y) ? startY : (float)y);
fsim.addItem(fitem);
for (Iterator<?> it=item.outEdges(); it.hasNext();) {
EdgeItem edge = (EdgeItem) it.next();
NodeItem adjacent = edge.getAdjacentItem(item);
if (adjacent.getBoolean("is_local"))
edges.add(edge);
}
}
iter = edges.iterator();
while ( iter.hasNext() ) {
EdgeItem e = (EdgeItem)iter.next();
NodeItem n1 = e.getSourceItem();
ForceItem f1 = (ForceItem)n1.get(FORCEITEM);
NodeItem n2 = e.getTargetItem();
ForceItem f2 = (ForceItem)n2.get(FORCEITEM);
float coeff = getSpringCoefficient(e);
float slen = getSpringLength(e);
fsim.addSpring(f1, f2, (coeff>=0?coeff:-1.f), (slen>=0?slen:-1.f));
}
}