本文整理汇总了Java中prefuse.visual.VisualItem.getEndY方法的典型用法代码示例。如果您正苦于以下问题:Java VisualItem.getEndY方法的具体用法?Java VisualItem.getEndY怎么用?Java VisualItem.getEndY使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类prefuse.visual.VisualItem
的用法示例。
在下文中一共展示了VisualItem.getEndY方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: reset
import prefuse.visual.VisualItem; //导入方法依赖的package包/类
/**
* Reset the force simulation state for all nodes processed
* by this layout.
*/
public void reset() {
Iterator iter = m_vis.visibleItems(m_nodeGroup);
while ( iter.hasNext() ) {
VisualItem item = (VisualItem)iter.next();
ForceItem fitem = (ForceItem)item.get(FORCEITEM);
if ( fitem != null ) {
fitem.location[0] = (float)item.getEndX();
fitem.location[1] = (float)item.getEndY();
fitem.force[0] = fitem.force[1] = 0;
fitem.velocity[0] = fitem.velocity[1] = 0;
}
}
m_lasttime = -1L;
}
示例2: initSimulator
import prefuse.visual.VisualItem; //导入方法依赖的package包/类
/**
* Loads the simulator with all relevant force items and springs.
* @param fsim the force simulator driving this layout
*/
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;
Iterator iter = m_vis.visibleItems(m_nodeGroup);
while ( iter.hasNext() ) {
VisualItem item = (VisualItem)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);
}
if ( m_edgeGroup != null ) {
iter = m_vis.visibleItems(m_edgeGroup);
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));
}
}
}
示例3: reset
import prefuse.visual.VisualItem; //导入方法依赖的package包/类
/**
* Reset the force simulation state for all nodes processed
* by this layout.
*/
public void reset() {
Iterator<?> iter = m_vis.visibleItems(m_nodeGroup);
while ( iter.hasNext() ) {
VisualItem item = (VisualItem)iter.next();
ForceItem fitem = (ForceItem)item.get(FORCEITEM);
if ( fitem != null ) {
fitem.location[0] = (float)item.getEndX();
fitem.location[1] = (float)item.getEndY();
fitem.force[0] = fitem.force[1] = 0;
fitem.velocity[0] = fitem.velocity[1] = 0;
}
}
m_lasttime = -1L;
}
示例4: reset
import prefuse.visual.VisualItem; //导入方法依赖的package包/类
public void reset() {
Iterator<?> iter = m_vis.items(m_nodeGroup, m_filter);
while ( iter.hasNext() ) {
VisualItem item = (VisualItem)iter.next();
ForceItem fitem = (ForceItem)item.get(FORCEITEM);
if ( fitem != null ) {
fitem.location[0] = (float)item.getEndX();
fitem.location[1] = (float)item.getEndY();
fitem.force[0] = fitem.force[1] = 0;
fitem.velocity[0] = fitem.velocity[1] = 0;
}
}
m_lasttime = -1L;
}
示例5: process
import prefuse.visual.VisualItem; //导入方法依赖的package包/类
/**
* @see prefuse.action.ItemAction#process(prefuse.visual.VisualItem, double)
*/
public void process(VisualItem item, double frac) {
if ( m_linear != null && item.isInGroup(m_linear) ) {
// perform linear interpolation instead
double s = item.getStartX();
item.setX(s + frac*(item.getEndX()-s));
s = item.getStartY();
item.setY(s + frac*(item.getEndY()-s));
return;
}
// otherwise, interpolate in polar coordinates
sx = item.getStartX() - ax;
sy = item.getStartY() - ay;
ex = item.getEndX() - ax;
ey = item.getEndY() - ay;
sr = Math.sqrt(sx*sx + sy*sy);
st = Math.atan2(sy,sx);
er = Math.sqrt(ex*ex + ey*ey);
et = Math.atan2(ey,ex);
stt = st < 0 ? st+MathLib.TWO_PI : st;
ett = et < 0 ? et+MathLib.TWO_PI : et;
dt1 = et - st;
dt2 = ett - stt;
if ( Math.abs(dt1) < Math.abs(dt2) ) {
t = st + frac * dt1;
} else {
t = stt + frac * dt2;
}
r = sr + frac * (er - sr);
x = Math.round(ax + r*Math.cos(t));
y = Math.round(ay + r*Math.sin(t));
item.setX(x);
item.setY(y);
}