本文整理汇总了Java中prefuse.visual.VisualItem.get方法的典型用法代码示例。如果您正苦于以下问题:Java VisualItem.get方法的具体用法?Java VisualItem.get怎么用?Java VisualItem.get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类prefuse.visual.VisualItem
的用法示例。
在下文中一共展示了VisualItem.get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getShape
import prefuse.visual.VisualItem; //导入方法依赖的package包/类
/**
* @see prefuse.action.assignment.ShapeAction#getShape(prefuse.visual.VisualItem)
*/
public int getShape(VisualItem item) {
// check for any cascaded rules first
int shape = super.getShape(item);
if ( shape != NO_SHAPE ) {
return shape;
}
// otherwise perform data-driven assignment
Object v = item.get(m_dataField);
int idx = ((Integer)m_ordinalMap.get(v)).intValue();
if ( m_palette == null ) {
return idx % Constants.SHAPE_COUNT;
} else {
return m_palette[idx % m_palette.length];
}
}
示例2: itemClicked
import prefuse.visual.VisualItem; //导入方法依赖的package包/类
@Override
public void itemClicked(VisualItem item, MouseEvent e) {
// click on table opens pop-up menu
if (model.getTable(item.getString("label")) != null || item.get("association") != null) {
return;
}
super.itemClicked(item, e);
}
示例3: setBounds
import prefuse.visual.VisualItem; //导入方法依赖的package包/类
/**
* @see prefuse.render.Renderer#setBounds(prefuse.visual.VisualItem)
*/
public void setBounds(VisualItem item) {
super.setBounds(item);
if (starBounds != null ) {
Rectangle2D bbox = (Rectangle2D)item.get(VisualItem.BOUNDS);
Rectangle2D.union(bbox, starBounds, bbox);
}
}
示例4: itemClicked
import prefuse.visual.VisualItem; //导入方法依赖的package包/类
@Override
public final void itemClicked( VisualItem anItem, MouseEvent anEvent )
{
// update the display
anItem.getVisualization().repaint();
if( !anItem.canGet( USER_OBJECT, Object.class ) )
{
return;
}
Object object = anItem.get( USER_OBJECT );
LinkEvent evt = new LinkEvent( StackedGraphDisplay.this, object );
fireLinkActivated( evt );
}
示例5: 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;
}
示例6: itemClicked
import prefuse.visual.VisualItem; //导入方法依赖的package包/类
@Override
public final void itemClicked( VisualItem anItem, MouseEvent anEvent )
{
if( !anItem.canGet( USER_OBJECT, Object.class ) )
{
return;
}
Object object = anItem.get( USER_OBJECT );
LinkEvent evt = new LinkEvent( TreeGraphDisplay.this, object );
fireLinkActivated( evt );
}
示例7: getParams
import prefuse.visual.VisualItem; //导入方法依赖的package包/类
private Params getParams(VisualItem item) {
Params rp = (Params)item.get(PARAMS);
if ( rp == null ) {
rp = new Params();
item.set(PARAMS, rp);
}
return rp;
}
示例8: 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));
}
}
}
示例9: itemEntered
import prefuse.visual.VisualItem; //导入方法依赖的package包/类
public void itemEntered(VisualItem item, MouseEvent e) {
Display d = (Display) e.getSource();
d.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
activeItem = item;
setFixed(item, true);
int index = (Integer) item.get("id");
vis.selectedArgument = args.get(index);
}
示例10: itemPressed
import prefuse.visual.VisualItem; //导入方法依赖的package包/类
public void itemPressed(VisualItem item, MouseEvent e) {
if (SwingUtilities.isLeftMouseButton(e) && e.getClickCount() == 2 && !e.isConsumed()) {
e.consume();
// handle double click.
dragged = false;
Display d = (Display) e.getComponent();
d.getAbsoluteCoordinate(e.getPoint(), down);
// Display the pop up!!!
if (item != null) {
try {
int index = (Integer) item.get("id");
WeightedArgument a = args.get(index);
// JFrame frame;
// frame = FTVisualizer.newWindow("Argument Pattern", 640, 480, a.m_a.m_rule.pattern, dm, true,
// true);
// frame.setVisible(true);
ScrollableFrame f = new ScrollableFrame("Rule Argument", 1024, 480, new RulePanel(a.m_a.m_rule.pattern, a.m_a.m_rule.solution, dm));
f.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
} catch (Exception ex) {
ex.printStackTrace();
}
}
} else {
if (SwingUtilities.isRightMouseButton(e)) {
if (item != null) {
menuItem = item;
menu.show(e.getComponent(), e.getX(), e.getY());
}
}
}
}
示例11: run
import prefuse.visual.VisualItem; //导入方法依赖的package包/类
@Override
public void run(double frac) {
// TODO Auto-generated method stub
initialize();
TupleSet ts = m_vis.getGroup(m_group);
Iterator<?> iter;
if (m_filter != null)
iter = ts.tuples();
else
iter = ts.tuples(m_filter);
// layout grid contents
while ( iter.hasNext() ) {
VisualItem item = (VisualItem)iter.next();
// layout items only once
if(layedOutObjects.add(item) == false)
continue;
item.setVisible(true);
// TODO: find the ip address somewhere in the linked tuples
InetAddress ip_address = (InetAddress)item.get(Data.ADDRESS);
//System.out.println(ip_address);
//int ip_hash = ip_address.hashCode();
//double distance = (double) ip_hash / (double)Integer.MAX_VALUE * total_length;
double distance = hashIP(ip_address.getHostAddress());
double y = getY(distance);
double x = getX(distance,y);
//System.out.println("Distance, X, Y: "+distance+", "+x+", "+y);
setX(item,null,x);
setY(item,null,y);
}
}
示例12: getPolygon
import prefuse.visual.VisualItem; //导入方法依赖的package包/类
/**
* Get the polygon values for a visual item.
*/
private float[] getPolygon(VisualItem item, String field) {
float[] poly = (float[])item.get(field);
if ( poly == null || poly.length < 4*columns.length ) {
// get oriented
int len = columns.length;
float inc = (float) (m_horiz?(bounds.getMinY()-bounds.getMaxY())
:(bounds.getMaxX()-bounds.getMinX()));
inc /= len-1;
float max = (float)
(m_horiz ? (m_top?bounds.getMaxX():bounds.getMinX())
: (m_top?bounds.getMinY():bounds.getMaxY()));
float min = (float)(m_horiz?bounds.getMaxY():bounds.getMinX());
int bias = (m_horiz ? 1 : 0);
// create polygon, populate default values
poly = new float[4*len];
Arrays.fill(poly, max);
for ( int i=0; i<len; ++i ) {
float x = i*inc + min;
poly[2*(len+i) +bias] = x;
poly[2*(len-1-i)+bias] = x;
}
item.set(field, poly);
}
return poly;
}
示例13: setBounds
import prefuse.visual.VisualItem; //导入方法依赖的package包/类
/**
* @see prefuse.render.Renderer#setBounds(prefuse.visual.VisualItem)
*/
public void setBounds(VisualItem item) {
if ( !m_manageBounds ) return;
Shape shape = getShape(item);
if ( shape == null ) {
item.setBounds(item.getX(), item.getY(), 0, 0);
return;
}
GraphicsLib.setBounds(item, shape, getStroke(item));
if ( m_curArrow != null ) {
Rectangle2D bbox = (Rectangle2D)item.get(VisualItem.BOUNDS);
Rectangle2D.union(bbox, m_curArrow.getBounds2D(), bbox);
}
}
示例14: render
import prefuse.visual.VisualItem; //导入方法依赖的package包/类
/**
* Renders an {@link Association}.
*
* @param g the 2D graphics
* @param item visual item for the association
* @param isSelected <code>true</code> for selected association
*/
public void render(Graphics2D g, VisualItem item, boolean isSelected) {
Association association = (Association) item.get("association");
item.setSize(isSelected? 3 : 1);
int color;
if (!Boolean.TRUE.equals(item.get("full"))) {
if (!full) {
return;
}
color = associationColor(association);
} else {
if (full) {
return;
}
color = reversed? associationColor(association.reversalAssociation) : associationColor(association);
}
item.setFillColor(color);
item.setStrokeColor(color);
BasicStroke stroke = item.getStroke();
if (stroke != null) {
if (reversed) {
if (association != null) {
association = association.reversalAssociation;
}
}
if (association != null && association.isRestricted() && !association.isIgnored()) {
item.setStroke(new BasicStroke(stroke.getLineWidth(), stroke.getEndCap(), stroke.getLineJoin(), stroke.getMiterLimit(),
new float[] { 8f, 6f }, 1.0f));
} else {
item.setStroke(new BasicStroke(stroke.getLineWidth(), stroke.getEndCap(), stroke.getLineJoin(), stroke.getMiterLimit()));
}
}
if ("XML".equals(association.getDataModel().getExportModus())) {
m_arrowHead = updateArrowHead(m_arrowWidth, m_arrowHeight, association, isSelected);
arrowIsPotAggregation = true;
} else {
if (arrowIsPotAggregation) {
m_arrowHead = updateArrowHead(m_arrowWidth, m_arrowHeight);
}
arrowIsPotAggregation = false;
}
starPosition = null;
render(g, item);
if (starPosition != null && starImage != null) {
double size = STAR_SIZE;
transform.setTransform(size, 0, 0, size, starPosition.getX() - size * (starWidth / 2), starPosition.getY() - size * (starHeight / 2));
g.drawImage(starImage, transform, null);
starPosition = null;
}
}
示例15: 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);
}
}