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

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

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

Layout.getSize介绍

[英]Returns the current size of the visualization's space.
[中]返回可视化空间的当前大小。

代码示例

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

/**
 * @see edu.uci.ics.jung.algorithms.layout.Layout#getSize()
 */
public Dimension getSize() {
  return delegate.getSize();
}

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

/**
 * Returns the size of the underlying layout.
 * @return the size of the underlying layout
 * @see edu.uci.ics.jung.algorithms.layout.Layout#getSize()
 */
public Dimension getSize() {
  return delegate.getSize();
}

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

public Dimension getSize() {
  return delegate.getSize();
}

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

public Dimension getSize() {
  return layout.getSize();
}

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

public Dimension getSize() {
  return delegate.getSize();
}

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

/**
 * Returns the location of the vertex.  The location is specified first
 * by the sublayouts, and then by the base layout if no sublayouts operate
 * on this vertex.
 * @return the location of the vertex
 */
public Point2D apply(V v) {
  boolean wasInSublayout = false;
  for(Layout<V,E> layout : layouts.keySet()) {
    if(layout.getGraph().getVertices().contains(v)) {
      wasInSublayout = true;
      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);
      return at.transform(layout.apply(v),null);
    }
  }
  if(wasInSublayout == false) {
    return delegate.apply(v);
  }
  return null;

}

代码示例来源: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

/**
 * Returns the location of the vertex.  The location is specified first
 * by the sublayouts, and then by the base layout if no sublayouts operate
 * on this vertex.
 * @return the location of the vertex
 * @see org.apache.commons.collections15.Transformer#transform(java.lang.Object)
 */
public Point2D transform(V v) {
  boolean wasInSublayout = false;
  for(Layout<V,E> layout : layouts.keySet()) {
    if(layout.getGraph().getVertices().contains(v)) {
      wasInSublayout = true;
      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);
      return at.transform(layout.transform(v),null);
    }
  }
  if(wasInSublayout == false) {
    return delegate.transform(v);
  }
  return null;

}

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

public void scaleToLayout(ScalingControl scaler) {
  Dimension vd = getPreferredSize();
  if(this.isShowing()) {
    vd = getSize();
  }
  Dimension ld = getGraphLayout().getSize();
  if(vd.equals(ld) == false) {
    scaler.scale(this, (float)(vd.getWidth()/ld.getWidth()), new Point2D.Double());
  }
}

代码示例来源: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: OpenNMS/opennms

layout.setSize(new Dimension(1024,1024)); // Size of the layout
VisualizationImageServer<GraphVertex, GraphEdge> vv = new VisualizationImageServer<GraphVertex, GraphEdge>(layout, layout.getSize());
vv.setPreferredSize(new Dimension(1200,1200)); // Viewing area size
vv.getRenderContext().setVertexLabelTransformer(new Transformer<GraphVertex,String>() {
    new Point2D.Double(vv.getGraphLayout().getSize().getWidth() / 2,
    vv.getGraphLayout().getSize().getHeight() / 2),
    new Dimension(vv.getGraphLayout().getSize()));

代码示例来源:origin: org.apache.batchee/batchee-maven-plugin

viewer.setPreferredSize(diagramLayout.getSize());
viewer.setSize(diagramLayout.getSize());
  throw new IllegalStateException("Can't create '" + output.getPath() + "'");
saveView(diagramLayout.getSize(), outputSize, diagram.getName(), viewer);

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

public void writeServerJPEGImage(File file) {
  VisualizationImageServer<Vertex, Edge> vis = new VisualizationImageServer<Vertex, Edge>(vv.getGraphLayout(), vv.getGraphLayout().getSize());
  vis.setBackground(Color.WHITE);
  vis.getRenderContext().setEdgeDrawPaintTransformer(edgeColor);
  vis.getRenderContext().setVertexIconTransformer(vertexColor);
  BufferedImage image = (BufferedImage) vis.getImage(
      new Point2D.Double(vis.getWidth(), vis.getHeight()),
      new Dimension(vv.getGraphLayout().getSize()));
  try {
    ImageIO.write(image, "jpeg", file);
  } catch (Exception e) {
    e.printStackTrace();
  }
}

代码示例来源:origin: org.opennms.features.topology/org.opennms.features.topology.app

.collect(Collectors.toSet());
VisualizationImageServer<VertexRef, Edge> vv = new VisualizationImageServer<>(jungLayout, jungLayout.getSize());
vv.setPreferredSize(new Dimension(2000,2000)); // Viewing area size
vv.getRenderContext().setVertexLabelTransformer(VertexRef::getLabel);
    new Point2D.Double(vv.getGraphLayout().getSize().getWidth() / 2,
        vv.getGraphLayout().getSize().getHeight() / 2),
    new Dimension(vv.getGraphLayout().getSize()));

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

private void setLtoR(VisualizationViewer<String,Integer> vv) {
  Layout<String,Integer> layout = vv.getModel().getGraphLayout();
  Dimension d = layout.getSize();
  Point2D center = new Point2D.Double(d.width/2, d.height/2);
  vv.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.LAYOUT).rotate(-Math.PI/2, center);
}

代码示例来源:origin: OpenNMS/opennms

.collect(Collectors.toSet());
VisualizationImageServer<VertexRef, Edge> vv = new VisualizationImageServer<>(jungLayout, jungLayout.getSize());
vv.setPreferredSize(new Dimension(2000,2000)); // Viewing area size
vv.getRenderContext().setVertexLabelTransformer(VertexRef::getLabel);
    new Point2D.Double(vv.getGraphLayout().getSize().getWidth() / 2,
        vv.getGraphLayout().getSize().getHeight() / 2),
    new Dimension(vv.getGraphLayout().getSize()));

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

Dimension d = vv.getGraphLayout().getSize();
Rectangle2D vvBounds = vv.getBounds();

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

this.vv = vv;
addComponentListener(new ResizeListener());        
Dimension d = vv.getGraphLayout().getSize();
verticalScrollBar = new JScrollBar(JScrollBar.VERTICAL, 0, d.height, 0, d.height);
horizontalScrollBar = new JScrollBar(JScrollBar.HORIZONTAL, 0, d.width, 0, d.width);

代码示例来源:origin: org.apache.batchee/batchee-maven-plugin

int w = fm.stringWidth(e.text);
double p = Math.max(0, p1.getX() + p2.getX() - w);
xform.translate(Math.min(layout.getSize().width - w, p / 2), (p1.getY() + p2.getY() - fm.getHeight()) / 2);
g.setTransform(xform);
g.draw(component, rc.getRendererPane(), 0, 0, d.width, d.height, true);

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

viewSize = new Dimension(600,600);
Dimension layoutSize = layout.getSize();

相关文章