edu.uci.ics.jung.algorithms.layout.Layout.setLocation()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(7.4k)|赞(0)|评价(0)|浏览(164)

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

Layout.setLocation介绍

[英]set the location of a vertex
[中]设置顶点的位置

代码示例

代码示例来源:origin: org.opendaylight.controller.thirdparty/net.sf.jung2

/**
 * @param v
 * @param location
 * @see edu.uci.ics.jung.algorithms.layout.Layout#setLocation(java.lang.Object, java.awt.geom.Point2D)
 */
public void setLocation(V v, Point2D location) {
  delegate.setLocation(v, location);
}

代码示例来源:origin: girtel/Net2Plan

@Override
public void moveVertexToXYPosition(GUINode npNode, Point2D point)
{
  l.setLocation(npNode, point);
}

代码示例来源:origin: net.sf.jung/jung-visualization

public void setLocation(V v, Point2D location) {
  layout.setLocation(v, location);
}

代码示例来源:origin: net.sf.jung/jung-algorithms

public void setLocation(V v, Point2D location) {
  delegate.setLocation(v, location);
}

代码示例来源:origin: net.sf.jung/jung-algorithms

public void setLocation(V v, Point2D location) {
  boolean wasInSublayout = false;
  for(Layout<V,E> layout : layouts.keySet()) {
    if(layout.getGraph().getVertices().contains(v)) {
      Point2D center = layouts.get(layout);
      // transform by the layout itself, but offset to the
      // center of the sublayout
      Dimension d = layout.getSize();
      AffineTransform at = 
        AffineTransform.getTranslateInstance(-center.getX()+d.width/2,-center.getY()+d.height/2);
      Point2D localLocation = at.transform(location, null);
      layout.setLocation(v, localLocation);
      wasInSublayout = true;
    }
  }
  if(wasInSublayout == false && getGraph().getVertices().contains(v)) {
    delegate.setLocation(v, location);
  }
}

代码示例来源:origin: org.opendaylight.controller.thirdparty/net.sf.jung2

/**
 * @param v
 * @param location
 * @see edu.uci.ics.jung.algorithms.layout.Layout#setLocation(java.lang.Object, java.awt.geom.Point2D)
 */
public void setLocation(V v, Point2D location) {
  boolean wasInSublayout = false;
  for(Layout<V,E> layout : layouts.keySet()) {
    if(layout.getGraph().getVertices().contains(v)) {
      Point2D center = layouts.get(layout);
      // transform by the layout itself, but offset to the
      // center of the sublayout
      Dimension d = layout.getSize();
      AffineTransform at = 
        AffineTransform.getTranslateInstance(-center.getX()+d.width/2,-center.getY()+d.height/2);
      Point2D localLocation = at.transform(location, null);
      layout.setLocation(v, localLocation);
      wasInSublayout = true;
    }
  }
  if(wasInSublayout == false && getGraph().getVertices().contains(v)) {
    delegate.setLocation(v, location);
  }
}

代码示例来源:origin: net.sf.jung/jung-visualization

public void step() {
    Graph<V,E> g = transitionLayout.getGraph();
    for(V v : g.getVertices()) {
      Point2D tp = transitionLayout.apply(v);
      Point2D fp = endLayout.apply(v);
      double dx = (fp.getX()-tp.getX())/(count-counter);
      double dy = (fp.getY()-tp.getY())/(count-counter);
      transitionLayout.setLocation(v, 
          new Point2D.Double(tp.getX()+dx,tp.getY()+dy));
    }
    counter++;
    if(counter >= count) {
      done = true;
      vv.setGraphLayout(endLayout);
    }
    vv.repaint();
  }
}

代码示例来源:origin: net.sourceforge.jadex/jadex-tools-comanalyzer

double dx = (fp.getX() - tp.getX()) / (count - counter);
double dy = (fp.getY() - tp.getY()) / (count - counter);
transitionLayout.setLocation(v, new Point2D.Double(tp.getX() + dx, tp.getY() + dy));

代码示例来源:origin: net.sourceforge.ondex.apps/ovtk2

layout.setLocation(vertices[i], coord);

代码示例来源:origin: net.sf.jung/jung-visualization

public void actionPerformed(ActionEvent e) {
    V newVertex = vertexFactory.get();
    graph.addVertex(newVertex);
    layout.setLocation(newVertex, vv.getRenderContext().getMultiLayerTransformer().inverseTransform(p));
    vv.repaint();
  }
});

代码示例来源:origin: net.sf.jung/jung-visualization

@SuppressWarnings({ "unchecked", "rawtypes" })
public void collapse(Layout layout, Forest tree, Object subRoot) throws InstantiationException, IllegalAccessException {
  
  // get a sub tree from subRoot
  Forest subTree = TreeUtils.getSubTree(tree, subRoot);
  Object parent = null;
  Object edge = null;
  if(tree.getPredecessorCount(subRoot) > 0) {
    parent = tree.getPredecessors(subRoot).iterator().next();
    edge = tree.getInEdges(subRoot).iterator().next();
  }    
  tree.removeVertex(subRoot);
  if(parent != null) {
    tree.addEdge(edge, parent, subTree);
  } else {
    tree.addVertex(subTree);
  }
  
  layout.setLocation(subTree, (Point2D)layout.apply(subRoot));
}

代码示例来源:origin: girtel/Net2Plan

@Override
public void updateNodesXYPosition()
{
  for (GUINode vertex : canvas.getAllVertices())
    canvas.getLayout().setLocation(vertex, canvas.getTransformer().transform(vertex));
}

代码示例来源:origin: net.sf.jung/jung-visualization

Point2D vp = layout.apply(v);
vp.setLocation(vp.getX()+dx, vp.getY()+dy);
layout.setLocation(v, vp);

代码示例来源:origin: net.sf.jung/jung-visualization

public void startVertexCreate(BasicVisualizationServer<V, E> vv,
    Point2D point) {
  V newVertex = vertexFactory.get();
  Layout<V,E> layout = vv.getGraphLayout();
  Graph<V,E> graph = layout.getGraph();
  graph.addVertex(newVertex);
  layout.setLocation(newVertex, vv.getRenderContext().getMultiLayerTransformer().inverseTransform(point));
  vv.repaint();
}

代码示例来源:origin: net.sf.jung/jung-samples

public void actionPerformed(ActionEvent e) {
  Collection picked = new HashSet(vv.getPickedVertexState().getPicked());
  if(picked.size() > 1) {
    Graph inGraph = layout.getGraph();
    Graph clusterGraph = collapser.getClusterGraph(inGraph, picked);
    Graph g = collapser.collapse(layout.getGraph(), clusterGraph);
    collapsedGraph = g;
    double sumx = 0;
    double sumy = 0;
    for(Object v : picked) {
      Point2D p = (Point2D)layout.apply(v);
      sumx += p.getX();
      sumy += p.getY();
    }
    Point2D cp = new Point2D.Double(sumx/picked.size(), sumy/picked.size());
    vv.getRenderContext().getParallelEdgeIndexFunction().reset();
    layout.setGraph(g);
    layout.setLocation(clusterGraph, cp);
    vv.getPickedVertexState().clear();
    vv.repaint();
  }
}});

代码示例来源:origin: net.sf.jung/jung-samples

public void actionPerformed(ActionEvent e) {
  Collection picked = new HashSet(vv.getPickedVertexState().getPicked());
  if(picked.size() > 1) {
    Graph inGraph = layout.getGraph();
    Graph clusterGraph = collapser.getClusterGraph(inGraph, picked);
    Graph g = collapser.collapse(layout.getGraph(), clusterGraph);
    double sumx = 0;
    double sumy = 0;
    for(Object v : picked) {
      Point2D p = (Point2D)layout.apply(v);
      sumx += p.getX();
      sumy += p.getY();
    }
    Point2D cp = new Point2D.Double(sumx/picked.size(), sumy/picked.size());
    vv.getRenderContext().getParallelEdgeIndexFunction().reset();
    layout.setGraph(g);
    layout.setLocation(clusterGraph, cp);
    vv.getPickedVertexState().clear();
    vv.repaint();
  }
}});

代码示例来源:origin: net.sourceforge.ondex.apps/ovtk2

viz.getGraphLayout().setLocation(concept, new Point2D.Float(width, height));

代码示例来源:origin: org.cloudml/ui.graph

Vertex v=new Vertex(nodeType+cnt, "soft", ai);
graph.addVertex(v);
vv.getModel().getGraphLayout().setLocation(v, vv.getRenderContext().getMultiLayerTransformer().inverseTransform(e.getPoint()));
Edge newEdge=new Edge(ai.getDestination().getName()+cnt, "destination");
Vertex dest=null;
Vertex v=new Vertex(nodeType+cnt, "node", ai);
graph.addVertex(v);
vv.getModel().getGraphLayout().setLocation(v, vv.getRenderContext().getMultiLayerTransformer().inverseTransform(e.getPoint()));

代码示例来源:origin: net.sourceforge.ondex.apps/ovtk2

for (ONDEXMetaConcept mc : layout.getGraph().getVertices()) {
  if (mc.getConceptClass().getId().equals(id)) {
    layout.setLocation(mc, p);
    break;

代码示例来源:origin: SINTEF-9012/cloudml

vv.getModel().getGraphLayout().setLocation(v, vv.getRenderContext().getMultiLayerTransformer().inverseTransform(e.getPoint()));
  Edge newEdge = new Edge(ai.getRequiredExecutionPlatform().getName() + cnt, "destination");
  Vertex dest = null;
Vertex v = new Vertex(nodeType + cnt, "node", ai);
graph.addVertex(v);
vv.getModel().getGraphLayout().setLocation(v, vv.getRenderContext().getMultiLayerTransformer().inverseTransform(e.getPoint()));

相关文章