本文整理汇总了Java中prefuse.visual.VisualItem.set方法的典型用法代码示例。如果您正苦于以下问题:Java VisualItem.set方法的具体用法?Java VisualItem.set怎么用?Java VisualItem.set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类prefuse.visual.VisualItem
的用法示例。
在下文中一共展示了VisualItem.set方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: itemEntered
import prefuse.visual.VisualItem; //导入方法依赖的package包/类
/**
* mouse-over event on a visual item (node item or edge item)
*/
@Override
public void itemEntered(VisualItem item, MouseEvent e) {
// if ctrl is pressed, user zooms -> ignore itemEntered
if (e.getModifiers() == InputEvent.CTRL_MASK) {
ctrlZoom(e);
return;
}
// only mark items as highlighted if the layout process is active
RunLayoutControl rlc = new RunLayoutControl(viewManagerID);
if (rlc.isLayouting()) {
if (item instanceof NodeItem) {
/* set highlight attribute to true, NodeRenderer will change the color */
item.set(ColumnNames.IS_HIGHLIGHTED, true);
}
if (item instanceof EdgeItem) {
/* set highlight attribute to true, EdgeRenderer will change the color */
item.set(ColumnNames.IS_HIGHLIGHTED, true);
}
if (item instanceof TableDecoratorItem) {
/* set highlight attribute to true, EdgeRenderer will change the color */
item.set(ColumnNames.IS_HIGHLIGHTED, true);
}
}
}
示例2: itemExited
import prefuse.visual.VisualItem; //导入方法依赖的package包/类
/**
* mouse moves away from a visual item (node item or edge item)
*/
@Override
public void itemExited(VisualItem item, java.awt.event.MouseEvent e) {
// if ctrl is pressed, user zooms -> ignore itemExited
// disable highlight possible but it should be same as zoom by mouse wheel or zoom by prefuse's right click zoom
if (e.getModifiers() == InputEvent.CTRL_MASK) {
ctrlZoom(e);
return;
}
if (item instanceof NodeItem) {
/* set highlight attribute to false, NodeRenderer will change the color */
item.set(ColumnNames.IS_HIGHLIGHTED, false);
}
if (item instanceof EdgeItem) {
/* set highlight attribute to false, EdgeRenderer will change the color */
item.set(ColumnNames.IS_HIGHLIGHTED, false);
}
if (item instanceof TableDecoratorItem) {
/* set highlight attribute to false, EdgeRenderer will change the color */
item.set(ColumnNames.IS_HIGHLIGHTED, false);
}
}
示例3: 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;
}
示例4: 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;
}
示例5: updateItemsData
import prefuse.visual.VisualItem; //导入方法依赖的package包/类
/**
* Update items position.
*
* @param orderedTerms
* the ordered terms
* @throws FeatureTermException
* the feature term exception
*/
public void updateItemsData(List<FeatureTerm> orderedTerms) throws FeatureTermException {
// Set labels:
Iterator<?> i = vg.nodes();
for (FeatureTerm t : orderedTerms) {
VisualItem vi = (VisualItem) i.next();
vi.set("id", new Integer(orderedTerms.indexOf(t)));
if (domain.contains(t) || t.getName() != null) {
vi.set("name", t.getName().get().toString());
} else {
if (t.isConstant()) {
vi.set("name", t.toStringNOOS(domain));
} else {
vi.set("name", "X" + (orderedTerms.indexOf(t) + 1) + " : " + t.getSort().get());
}
}
// colocar elemento actual
String solution = t.readPath(tsolution).toStringNOOS(domain);
Color color = solutionColors.get(solution);
vi.set(VisualItem.TEXTCOLOR, ColorLib.gray(0));
vi.setStrokeColor(color.getRGB());
}
updateItemsPosition(orderedTerms);
distancesComputed = true;
System.out.println("DISTANCE COMPUTED!!");
}
示例6: updateItemsPosition
import prefuse.visual.VisualItem; //导入方法依赖的package包/类
/**
* Update items position.
*
* @param orderedTerms
* the ordered terms
*/
private void updateItemsPosition(List<FeatureTerm> orderedTerms) {
Iterator<?> i;
System.out.println("Updating positions...");
i = vg.nodes();
int xy = 0;
for (FeatureTerm t : orderedTerms) {
System.out.print(".");
VisualItem vi = (VisualItem) i.next();
vi.set("id", new Integer(orderedTerms.indexOf(t)));
// set positions
int x = caseX(xy);
int y = caseY(xy);
// System.out.println(this.getSize().getHeight());
// System.out.println(orderedTerms.size());
// System.out.println(this.getSize().getHeight() / orderedTerms.size());
int multiplier = Math.min(Math.max(orderedTerms.size(), 20), 30);
vi.setX(x * multiplier);
vi.setY(y * multiplier);
xy++;
}
// if (gui != null)
// gui.panelGeneralCB.invalidate();
}
示例7: logLayout
import prefuse.visual.VisualItem; //导入方法依赖的package包/类
/**
* Calculates a quantitative, logarithmically-scaled layout.
* TODO: This method is currently not working correctly.
*/
protected void logLayout(VisualTable labels) {
Rectangle2D b = getLayoutBounds();
double breadth = getBreadth(b);
labels.clear();
// get span in log space
// get log of the difference
// if [0.1,1) round to .1's 0.1-->0.1
// if [1,10) round to 1's 1-->1
// if [10,100) round to 10's 10-->10
double llo = MathLib.safeLog10(m_lo);
double lhi = MathLib.safeLog10(m_hi);
double lspan = lhi - llo;
double d = MathLib.log10(lhi-llo);
int e = (int)Math.floor(d);
int ilo = (int)Math.floor(llo);
int ihi = (int)Math.ceil(lhi);
double start = Math.pow(10,ilo);
double end = Math.pow(10, ihi);
double step = start * Math.pow(10, e);
//System.out.println((hi-lo)+"\t"+e+"\t"+start+"\t"+end+"\t"+step);
// TODO: catch infinity case if diff is zero
// figure out label cases better
for ( double val, v=start, i=0; v<=end; v+=step, ++i ) {
val = MathLib.safeLog10(v);
if ( i != 0 && Math.abs(val-Math.round(val)) < 0.0001 ) {
i = 0;
step = 10*step;
}
val = ((val-llo)/lspan)*breadth;
if ( val < -0.5 ) continue;
VisualItem item = labels.addItem();
set(item, val, b);
String label = i==0 ? m_nf.format(v) : null;
item.set(LABEL, label);
item.setDouble(VALUE, v);
}
}
示例8: setValue
import prefuse.visual.VisualItem; //导入方法依赖的package包/类
/**
* Set a data field value for all items in a given data group matching a
* given filter predicate.
* @param group the visual data group name
* @param p the filter predicate determining which items to modify
* @param field the data field / column name to set
* @param val the value to set
*/
public void setValue(String group, Predicate p, String field, Object val) {
Iterator<VisualItem> items = items(group, p);
while ( items.hasNext() ) {
VisualItem item = items.next();
item.set(field, val);
}
}
示例9: update
import prefuse.visual.VisualItem; //导入方法依赖的package包/类
/**
* Update the values in an interpolated column (a set of three columns
* representing a current value along with starting and ending values).
* The current value will become the new starting value, while the given
* value will become the new current and ending values.
* @param item the VisualItem to update
* @param field the base field to update, start and ending fields will
* also be updated, too.
* @param val the value to set
*/
public static void update(VisualItem item, String field, Object val) {
item.set(getStartField(field), item.get(field));
item.set(field, val);
item.set(getEndField(field), val);
}