prefuse.Visualization.getGroup()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(9.2k)|赞(0)|评价(0)|浏览(150)

本文整理了Java中prefuse.Visualization.getGroup()方法的一些代码示例,展示了Visualization.getGroup()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Visualization.getGroup()方法的具体详情如下:
包路径:prefuse.Visualization
类名称:Visualization
方法名:getGroup

Visualization.getGroup介绍

[英]Get the TupleSet associated with the given data group name.
[中]获取与给定数据组名称关联的元组集。

代码示例

代码示例来源:origin: de.sciss/prefuse-core

  1. /**
  2. * @see prefuse.action.EncoderAction#setup()
  3. */
  4. protected void setup() {
  5. TupleSet ts = m_vis.getGroup(m_group);
  6. m_ordinalMap = DataLib.ordinalMap(ts, m_dataField);
  7. }

代码示例来源:origin: de.sciss/prefuse-core

  1. /**
  2. * Get the size of the given visual data group.
  3. * @param group the visual data group
  4. * @return the size (number of tuples) of the group
  5. */
  6. public int size(String group) {
  7. TupleSet tSet = getGroup(group);
  8. return ( tSet==null ? 0 : tSet.getTupleCount() );
  9. }

代码示例来源:origin: de.sciss/prefuse-core

  1. /**
  2. * Indicates if a given VisualItem is contained in the given visual
  3. * data group.
  4. * @param item the VisualItem instance
  5. * @param group the data group to check for containment
  6. * @return true if the VisualItem is in the group, false otherwise
  7. */
  8. public boolean isInGroup(VisualItem item, String group) {
  9. if ( ALL_ITEMS.equals(group) )
  10. return true;
  11. if (item.getGroup().equals(group))
  12. return true;
  13. TupleSet tSet = getGroup(group);
  14. return ( tSet==null ? false : tSet.containsTuple(item) );
  15. }

代码示例来源:origin: de.sciss/prefuse-core

  1. /**
  2. * Get an iterator over all items in the given group which match the given
  3. * Predicate filter.
  4. * @param group the visual data group to iterate over
  5. * @param filter a Predicate indicating which items should be included in
  6. * the iteration.
  7. * @return a filtered iterator over VisualItems
  8. */
  9. public Iterator items(String group, Predicate filter) {
  10. if ( ALL_ITEMS.equals(group) )
  11. return items(filter);
  12. TupleSet t = getGroup(group);
  13. return ( t==null ? Collections.EMPTY_LIST.iterator()
  14. : t.tuples(filter) );
  15. }

代码示例来源:origin: es.ucm.fdi.gaia/jCOLIBRI

  1. public void actionPerformed(ActionEvent e) {
  2. boolean first = true;
  3. for (Iterator<?> it=vis.getGroup(Visualization.SEARCH_ITEMS).tuples();it.hasNext(); ) {
  4. VisualItem item = (VisualItem) it.next();
  5. if (first){
  6. vis.getGroup(Visualization.FOCUS_ITEMS).setTuple(item);
  7. first = false;
  8. }else{
  9. vis.getGroup(Visualization.FOCUS_ITEMS).addTuple(item);
  10. }
  11. item.setFixed(false);
  12. // System.out.println("Object: "+((VisualItem) it.next()).getRow());
  13. }
  14. vis.repaint();
  15. }
  16. });

代码示例来源:origin: es.ucm.fdi.gaia/jCOLIBRI

  1. public void addSearchPanel(){
  2. // create a search panel for the graph
  3. SearchQueryBinding sq = new SearchQueryBinding(
  4. (Table)vis.getGroup(NODES), "name",
  5. (SearchTupleSet)vis.getGroup(Visualization.SEARCH_ITEMS));
  6. spanel = sq.createSearchPanel();
  7. spanel.setShowResultCount(true);
  8. spanel.setBorder(BorderFactory.createEmptyBorder(5,5,4,0));
  9. GridBagConstraints constraints = new GridBagConstraints();
  10. constraints.insets = new Insets(0,5,5,5);
  11. constraints.weightx = 1.0;
  12. constraints.weighty = 0.0;
  13. constraints.fill = GridBagConstraints.BOTH;
  14. constraints.gridwidth = GridBagConstraints.REMAINDER;
  15. constraints.anchor = GridBagConstraints.CENTER;
  16. this.add(spanel, constraints,1);
  17. }

代码示例来源:origin: de.sciss/prefuse-core

  1. /**
  2. * Return the NodeItem to use as the root for this tree layout. If the
  3. * layout root is not set, this method has the side effect of setting it
  4. * to the root of the graph's spanning tree.
  5. * @return the root node to use for this tree layout.
  6. * @throws IllegalStateException if the action's data group does not
  7. * resolve to a {@link prefuse.data.Graph} instance.
  8. */
  9. public NodeItem getLayoutRoot() {
  10. if ( m_root != null )
  11. return m_root;
  12. TupleSet ts = m_vis.getGroup(m_group);
  13. if ( ts instanceof Graph ) {
  14. Tree tree = ((Graph)ts).getSpanningTree();
  15. return (NodeItem)tree.getRoot();
  16. } else {
  17. throw new IllegalStateException("This action's data group does" +
  18. "not resolve to a Graph instance.");
  19. }
  20. }

代码示例来源:origin: de.sciss/prefuse-core

  1. /**
  2. * @see prefuse.data.expression.Expression#get(prefuse.data.Tuple)
  3. */
  4. public Object get(Tuple t) {
  5. VisualItem item = (VisualItem)t;
  6. Visualization vis = item.getVisualization();
  7. String group = getGroup(t);
  8. SearchTupleSet sts = (SearchTupleSet)vis.getGroup(group);
  9. return sts.getQuery();
  10. }

代码示例来源:origin: de.sciss/prefuse-core

  1. /**
  2. * @see prefuse.data.expression.Expression#getInt(prefuse.data.Tuple)
  3. */
  4. public int getInt(Tuple t) {
  5. String group = getGroup(t);
  6. if ( group == null ) { return -1; }
  7. TupleSet ts = ((VisualItem)t).getVisualization().getGroup(group);
  8. return ( ts==null ? 0 : ts.getTupleCount() );
  9. }

代码示例来源:origin: de.sciss/prefuse-core

  1. /**
  2. * Create a new table for representing axis labels.
  3. */
  4. protected VisualTable getTable() {
  5. TupleSet ts = m_vis.getGroup(m_group);
  6. if ( ts == null ) {
  7. Schema s = PrefuseLib.getAxisLabelSchema();
  8. VisualTable vt = m_vis.addTable(m_group, s);
  9. vt.index(VALUE);
  10. return vt;
  11. } else if ( ts instanceof VisualTable ) {
  12. return (VisualTable)ts;
  13. } else {
  14. throw new IllegalStateException(
  15. "Group already exists, not being used for labels");
  16. }
  17. }

代码示例来源:origin: de.sciss/prefuse-core

  1. /**
  2. * @see prefuse.action.Action#run(double)
  3. */
  4. public void run(double frac) {
  5. Graph g = (Graph)m_vis.getGroup(m_group);
  6. initSchema(g.getNodes());
  7. Point2D anchor = getLayoutAnchor();
  8. NodeItem n = getLayoutRoot();
  9. layout(n,anchor.getX(),anchor.getY());
  10. }

代码示例来源:origin: es.ucm.fdi.gaia/jCOLIBRI

  1. /**
  2. * Changes the graph focus
  3. */
  4. public void setFocus(int nodeID){
  5. VisualItem f = (VisualItem)vg.getNode(nodeID);
  6. vis.getGroup(Visualization.FOCUS_ITEMS).setTuple(f);
  7. f.setFixed(false);
  8. }

代码示例来源:origin: de.sciss/prefuse-core

  1. /**
  2. * @see prefuse.action.GroupAction#run(double)
  3. */
  4. public void run(double frac) {
  5. if ( frac == 0.0 ) {
  6. setup();
  7. } else if ( frac == 1.0 ) {
  8. finish();
  9. } else {
  10. super.run(frac);
  11. }
  12. TupleSet ts = m_vis.getGroup(m_group);
  13. ts.putClientProperty(AxisLabelLayout.FRAC, new Double(frac));
  14. }

代码示例来源:origin: de.sciss/prefuse-core

  1. /**
  2. * @see prefuse.action.Action#run(double)
  3. */
  4. public void run(double frac) {
  5. TupleSet ts = m_vis.getGroup(m_group);
  6. int nn = ts.getTupleCount();
  7. Rectangle2D r = getLayoutBounds();
  8. double height = r.getHeight();
  9. double width = r.getWidth();
  10. double cx = r.getCenterX();
  11. double cy = r.getCenterY();
  12. double radius = m_radius;
  13. if (radius <= 0) {
  14. radius = 0.45 * (height < width ? height : width);
  15. }
  16. Iterator items = ts.tuples();
  17. for (int i=0; items.hasNext(); i++) {
  18. VisualItem n = (VisualItem)items.next();
  19. double angle = (2*Math.PI*i) / nn;
  20. double x = Math.cos(angle)*radius + cx;
  21. double y = Math.sin(angle)*radius + cy;
  22. setX(n, null, x);
  23. setY(n, null, y);
  24. }
  25. }

代码示例来源:origin: de.sciss/prefuse-core

  1. /**
  2. * Add a derived table, a VisualTable that is cascaded from an
  3. * existing VisualTable. This is useful for creating VisualItems
  4. * that inherit a set of visual properties from another group of
  5. * VisualItems. This might be used, for example, in the creation
  6. * of small multiples where only a few visual attributes vary
  7. * across the multiples.
  8. * @param group the data group to use for the derived table
  9. * @param source the source data group to derive from
  10. * @param filter a Predicate filter indicating which tuples of the
  11. * source group should be inheritable by the new group
  12. * @param override a data schema indicating which data fields
  13. * should not be inherited, but managed locally by the derived group
  14. * @return the derived VisualTable
  15. */
  16. public synchronized VisualTable addDerivedTable(
  17. String group, String source, Predicate filter, Schema override)
  18. {
  19. VisualTable src = (VisualTable)getGroup(source);
  20. VisualTable vt = new VisualTable(src, this, group, filter, override);
  21. addDataGroup(group, vt, getSourceData(source));
  22. return vt;
  23. }

代码示例来源:origin: de.sciss/prefuse-core

  1. /**
  2. * @see prefuse.data.expression.Expression#getBoolean(prefuse.data.Tuple)
  3. */
  4. public boolean getBoolean(Tuple t) {
  5. String group = getGroup(t);
  6. if ( group == null ) return false;
  7. boolean incEmpty = m_incEmpty.getBoolean(t);
  8. VisualItem item = (VisualItem)t;
  9. Visualization vis = item.getVisualization();
  10. SearchTupleSet search = (SearchTupleSet)vis.getGroup(group);
  11. if ( search == null && incEmpty )
  12. return true;
  13. String query = search != null ? search.getQuery() : null;
  14. return (incEmpty && (query==null || query.length()==0))
  15. || vis.isInGroup(item, group);
  16. }

代码示例来源:origin: de.sciss/prefuse-core

  1. /**
  2. * @see prefuse.action.Action#run(double)
  3. */
  4. public void run(double frac) {
  5. TupleSet ts = m_vis.getGroup(m_group);
  6. setMinMax();
  7. switch ( getDataType(ts) ) {
  8. case Constants.NUMERICAL:
  9. numericalLayout(ts);
  10. break;
  11. default:
  12. ordinalLayout(ts);
  13. }
  14. }

代码示例来源:origin: de.sciss/prefuse-core

  1. /**
  2. * @see prefuse.action.GroupAction#run(double)
  3. */
  4. public void run(double frac) {
  5. Tree tree = ((Graph)m_vis.getGroup(m_group)).getSpanningTree();
  6. m_divisor = tree.getNodeCount();
  7. m_root = (NodeItem)tree.getRoot();
  8. // mark the items
  9. Iterator items = m_vis.visibleItems(m_group);
  10. while ( items.hasNext() ) {
  11. VisualItem item = (VisualItem)items.next();
  12. item.setDOI(Constants.MINIMUM_DOI);
  13. item.setExpanded(false);
  14. }
  15. // compute the fisheye over nodes
  16. Iterator iter = m_vis.items(m_sources, m_groupP);
  17. while ( iter.hasNext() )
  18. visitFocus((NodeItem)iter.next(), null);
  19. visitFocus(m_root, null);
  20. // mark unreached items
  21. items = m_vis.visibleItems(m_group);
  22. while ( items.hasNext() ) {
  23. VisualItem item = (VisualItem)items.next();
  24. if ( item.getDOI() == Constants.MINIMUM_DOI )
  25. PrefuseLib.updateVisible(item, false);
  26. }
  27. }

代码示例来源:origin: de.sciss/prefuse-core

  1. /**
  2. * @see prefuse.action.Action#run(double)
  3. */
  4. public void run(double frac) {
  5. Graph g = (Graph)m_vis.getGroup(m_group);
  6. initSchema(g.getNodes());
  7. Arrays.fill(m_depths, 0);
  8. m_maxDepth = 0;
  9. Point2D a = getLayoutAnchor();
  10. m_ax = a.getX();
  11. m_ay = a.getY();
  12. NodeItem root = getLayoutRoot();
  13. Params rp = getParams(root);
  14. g.getSpanningTree(root);
  15. // do first pass - compute breadth information, collect depth info
  16. firstWalk(root, 0, 1);
  17. // sum up the depth info
  18. determineDepths();
  19. // do second pass - assign layout positions
  20. secondWalk(root, null, -rp.prelim, 0);
  21. }

代码示例来源:origin: es.ucm.fdi.gaia/jCOLIBRI

  1. /**
  2. * Updating the graph
  3. */
  4. public void setGraph(Graph g){
  5. vis.cancel("layout");
  6. vis.removeGroup(GRAPH);
  7. vis.getGroup(Visualization.SEARCH_ITEMS).clear();
  8. this.remove(spanel);
  9. vis.addGraph(GRAPH, g);
  10. addSearchPanel();
  11. vis.setInteractive(EDGES, null, false);
  12. setFocus(0);
  13. stop.setText("Stop");
  14. vis.run("layout");
  15. }

相关文章