本文整理了Java中prefuse.Visualization.getGroup()
方法的一些代码示例,展示了Visualization.getGroup()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Visualization.getGroup()
方法的具体详情如下:
包路径:prefuse.Visualization
类名称:Visualization
方法名:getGroup
[英]Get the TupleSet associated with the given data group name.
[中]获取与给定数据组名称关联的元组集。
代码示例来源:origin: de.sciss/prefuse-core
/**
* @see prefuse.action.EncoderAction#setup()
*/
protected void setup() {
TupleSet ts = m_vis.getGroup(m_group);
m_ordinalMap = DataLib.ordinalMap(ts, m_dataField);
}
代码示例来源:origin: de.sciss/prefuse-core
/**
* Get the size of the given visual data group.
* @param group the visual data group
* @return the size (number of tuples) of the group
*/
public int size(String group) {
TupleSet tSet = getGroup(group);
return ( tSet==null ? 0 : tSet.getTupleCount() );
}
代码示例来源:origin: de.sciss/prefuse-core
/**
* Indicates if a given VisualItem is contained in the given visual
* data group.
* @param item the VisualItem instance
* @param group the data group to check for containment
* @return true if the VisualItem is in the group, false otherwise
*/
public boolean isInGroup(VisualItem item, String group) {
if ( ALL_ITEMS.equals(group) )
return true;
if (item.getGroup().equals(group))
return true;
TupleSet tSet = getGroup(group);
return ( tSet==null ? false : tSet.containsTuple(item) );
}
代码示例来源:origin: de.sciss/prefuse-core
/**
* Get an iterator over all items in the given group which match the given
* Predicate filter.
* @param group the visual data group to iterate over
* @param filter a Predicate indicating which items should be included in
* the iteration.
* @return a filtered iterator over VisualItems
*/
public Iterator items(String group, Predicate filter) {
if ( ALL_ITEMS.equals(group) )
return items(filter);
TupleSet t = getGroup(group);
return ( t==null ? Collections.EMPTY_LIST.iterator()
: t.tuples(filter) );
}
代码示例来源:origin: es.ucm.fdi.gaia/jCOLIBRI
public void actionPerformed(ActionEvent e) {
boolean first = true;
for (Iterator<?> it=vis.getGroup(Visualization.SEARCH_ITEMS).tuples();it.hasNext(); ) {
VisualItem item = (VisualItem) it.next();
if (first){
vis.getGroup(Visualization.FOCUS_ITEMS).setTuple(item);
first = false;
}else{
vis.getGroup(Visualization.FOCUS_ITEMS).addTuple(item);
}
item.setFixed(false);
// System.out.println("Object: "+((VisualItem) it.next()).getRow());
}
vis.repaint();
}
});
代码示例来源:origin: es.ucm.fdi.gaia/jCOLIBRI
public void addSearchPanel(){
// create a search panel for the graph
SearchQueryBinding sq = new SearchQueryBinding(
(Table)vis.getGroup(NODES), "name",
(SearchTupleSet)vis.getGroup(Visualization.SEARCH_ITEMS));
spanel = sq.createSearchPanel();
spanel.setShowResultCount(true);
spanel.setBorder(BorderFactory.createEmptyBorder(5,5,4,0));
GridBagConstraints constraints = new GridBagConstraints();
constraints.insets = new Insets(0,5,5,5);
constraints.weightx = 1.0;
constraints.weighty = 0.0;
constraints.fill = GridBagConstraints.BOTH;
constraints.gridwidth = GridBagConstraints.REMAINDER;
constraints.anchor = GridBagConstraints.CENTER;
this.add(spanel, constraints,1);
}
代码示例来源:origin: de.sciss/prefuse-core
/**
* Return the NodeItem to use as the root for this tree layout. If the
* layout root is not set, this method has the side effect of setting it
* to the root of the graph's spanning tree.
* @return the root node to use for this tree layout.
* @throws IllegalStateException if the action's data group does not
* resolve to a {@link prefuse.data.Graph} instance.
*/
public NodeItem getLayoutRoot() {
if ( m_root != null )
return m_root;
TupleSet ts = m_vis.getGroup(m_group);
if ( ts instanceof Graph ) {
Tree tree = ((Graph)ts).getSpanningTree();
return (NodeItem)tree.getRoot();
} else {
throw new IllegalStateException("This action's data group does" +
"not resolve to a Graph instance.");
}
}
代码示例来源:origin: de.sciss/prefuse-core
/**
* @see prefuse.data.expression.Expression#get(prefuse.data.Tuple)
*/
public Object get(Tuple t) {
VisualItem item = (VisualItem)t;
Visualization vis = item.getVisualization();
String group = getGroup(t);
SearchTupleSet sts = (SearchTupleSet)vis.getGroup(group);
return sts.getQuery();
}
代码示例来源:origin: de.sciss/prefuse-core
/**
* @see prefuse.data.expression.Expression#getInt(prefuse.data.Tuple)
*/
public int getInt(Tuple t) {
String group = getGroup(t);
if ( group == null ) { return -1; }
TupleSet ts = ((VisualItem)t).getVisualization().getGroup(group);
return ( ts==null ? 0 : ts.getTupleCount() );
}
代码示例来源:origin: de.sciss/prefuse-core
/**
* Create a new table for representing axis labels.
*/
protected VisualTable getTable() {
TupleSet ts = m_vis.getGroup(m_group);
if ( ts == null ) {
Schema s = PrefuseLib.getAxisLabelSchema();
VisualTable vt = m_vis.addTable(m_group, s);
vt.index(VALUE);
return vt;
} else if ( ts instanceof VisualTable ) {
return (VisualTable)ts;
} else {
throw new IllegalStateException(
"Group already exists, not being used for labels");
}
}
代码示例来源:origin: de.sciss/prefuse-core
/**
* @see prefuse.action.Action#run(double)
*/
public void run(double frac) {
Graph g = (Graph)m_vis.getGroup(m_group);
initSchema(g.getNodes());
Point2D anchor = getLayoutAnchor();
NodeItem n = getLayoutRoot();
layout(n,anchor.getX(),anchor.getY());
}
代码示例来源:origin: es.ucm.fdi.gaia/jCOLIBRI
/**
* Changes the graph focus
*/
public void setFocus(int nodeID){
VisualItem f = (VisualItem)vg.getNode(nodeID);
vis.getGroup(Visualization.FOCUS_ITEMS).setTuple(f);
f.setFixed(false);
}
代码示例来源:origin: de.sciss/prefuse-core
/**
* @see prefuse.action.GroupAction#run(double)
*/
public void run(double frac) {
if ( frac == 0.0 ) {
setup();
} else if ( frac == 1.0 ) {
finish();
} else {
super.run(frac);
}
TupleSet ts = m_vis.getGroup(m_group);
ts.putClientProperty(AxisLabelLayout.FRAC, new Double(frac));
}
代码示例来源:origin: de.sciss/prefuse-core
/**
* @see prefuse.action.Action#run(double)
*/
public void run(double frac) {
TupleSet ts = m_vis.getGroup(m_group);
int nn = ts.getTupleCount();
Rectangle2D r = getLayoutBounds();
double height = r.getHeight();
double width = r.getWidth();
double cx = r.getCenterX();
double cy = r.getCenterY();
double radius = m_radius;
if (radius <= 0) {
radius = 0.45 * (height < width ? height : width);
}
Iterator items = ts.tuples();
for (int i=0; items.hasNext(); i++) {
VisualItem n = (VisualItem)items.next();
double angle = (2*Math.PI*i) / nn;
double x = Math.cos(angle)*radius + cx;
double y = Math.sin(angle)*radius + cy;
setX(n, null, x);
setY(n, null, y);
}
}
代码示例来源:origin: de.sciss/prefuse-core
/**
* Add a derived table, a VisualTable that is cascaded from an
* existing VisualTable. This is useful for creating VisualItems
* that inherit a set of visual properties from another group of
* VisualItems. This might be used, for example, in the creation
* of small multiples where only a few visual attributes vary
* across the multiples.
* @param group the data group to use for the derived table
* @param source the source data group to derive from
* @param filter a Predicate filter indicating which tuples of the
* source group should be inheritable by the new group
* @param override a data schema indicating which data fields
* should not be inherited, but managed locally by the derived group
* @return the derived VisualTable
*/
public synchronized VisualTable addDerivedTable(
String group, String source, Predicate filter, Schema override)
{
VisualTable src = (VisualTable)getGroup(source);
VisualTable vt = new VisualTable(src, this, group, filter, override);
addDataGroup(group, vt, getSourceData(source));
return vt;
}
代码示例来源:origin: de.sciss/prefuse-core
/**
* @see prefuse.data.expression.Expression#getBoolean(prefuse.data.Tuple)
*/
public boolean getBoolean(Tuple t) {
String group = getGroup(t);
if ( group == null ) return false;
boolean incEmpty = m_incEmpty.getBoolean(t);
VisualItem item = (VisualItem)t;
Visualization vis = item.getVisualization();
SearchTupleSet search = (SearchTupleSet)vis.getGroup(group);
if ( search == null && incEmpty )
return true;
String query = search != null ? search.getQuery() : null;
return (incEmpty && (query==null || query.length()==0))
|| vis.isInGroup(item, group);
}
代码示例来源:origin: de.sciss/prefuse-core
/**
* @see prefuse.action.Action#run(double)
*/
public void run(double frac) {
TupleSet ts = m_vis.getGroup(m_group);
setMinMax();
switch ( getDataType(ts) ) {
case Constants.NUMERICAL:
numericalLayout(ts);
break;
default:
ordinalLayout(ts);
}
}
代码示例来源:origin: de.sciss/prefuse-core
/**
* @see prefuse.action.GroupAction#run(double)
*/
public void run(double frac) {
Tree tree = ((Graph)m_vis.getGroup(m_group)).getSpanningTree();
m_divisor = tree.getNodeCount();
m_root = (NodeItem)tree.getRoot();
// mark the items
Iterator items = m_vis.visibleItems(m_group);
while ( items.hasNext() ) {
VisualItem item = (VisualItem)items.next();
item.setDOI(Constants.MINIMUM_DOI);
item.setExpanded(false);
}
// compute the fisheye over nodes
Iterator iter = m_vis.items(m_sources, m_groupP);
while ( iter.hasNext() )
visitFocus((NodeItem)iter.next(), null);
visitFocus(m_root, null);
// mark unreached items
items = m_vis.visibleItems(m_group);
while ( items.hasNext() ) {
VisualItem item = (VisualItem)items.next();
if ( item.getDOI() == Constants.MINIMUM_DOI )
PrefuseLib.updateVisible(item, false);
}
}
代码示例来源:origin: de.sciss/prefuse-core
/**
* @see prefuse.action.Action#run(double)
*/
public void run(double frac) {
Graph g = (Graph)m_vis.getGroup(m_group);
initSchema(g.getNodes());
Arrays.fill(m_depths, 0);
m_maxDepth = 0;
Point2D a = getLayoutAnchor();
m_ax = a.getX();
m_ay = a.getY();
NodeItem root = getLayoutRoot();
Params rp = getParams(root);
g.getSpanningTree(root);
// do first pass - compute breadth information, collect depth info
firstWalk(root, 0, 1);
// sum up the depth info
determineDepths();
// do second pass - assign layout positions
secondWalk(root, null, -rp.prelim, 0);
}
代码示例来源:origin: es.ucm.fdi.gaia/jCOLIBRI
/**
* Updating the graph
*/
public void setGraph(Graph g){
vis.cancel("layout");
vis.removeGroup(GRAPH);
vis.getGroup(Visualization.SEARCH_ITEMS).clear();
this.remove(spanel);
vis.addGraph(GRAPH, g);
addSearchPanel();
vis.setInteractive(EDGES, null, false);
setFocus(0);
stop.setText("Stop");
vis.run("layout");
}
内容来源于网络,如有侵权,请联系作者删除!