public Point2D getCenter() { Dimension d = getSize(); return new Point2D.Double(d.width / 2, d.height / 2); }
public Point2D getCenter() { Dimension d = getSize(); return new Point2D.Float(d.width/2, d.height/2); }
private static void graphToFile(BasicVisualizationServer<String, String> visualization, File file) throws IOException { Dimension size = visualization.getSize(); int width = (int) (size.getWidth() + 1); int height = (int) (size.getHeight() + 1); BufferedImage bufferedImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); Graphics2D graphics = bufferedImage.createGraphics(); graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); graphics.setColor(Color.WHITE); graphics.fillRect(0, 0, 900, 650); visualization.setBounds(0, 0, 900, 650); visualization.paint(graphics); graphics.dispose(); ImageIO.write(bufferedImage, "png", file); }
public Shape viewOnLayout() { Dimension d = this.getSize(); MultiLayerTransformer vt = renderContext.getMultiLayerTransformer(); Shape s = new Rectangle2D.Double(0, 0, d.width, d.height); return vt.inverseTransform(s); }
@Override protected void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2d = (Graphics2D)g; if(doubleBuffered) { checkOffscreenImage(getSize()); renderGraph(offscreenG2d); g2d.drawImage(offscreen, null, 0, 0); } else { renderGraph(g2d); } }
@Override protected void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2d = (Graphics2D) g; if (doubleBuffered) { checkOffscreenImage(getSize()); renderGraph(offscreenG2d); g2d.drawImage(offscreen, null, 0, 0); } else { renderGraph(g2d); } }
@Override public void setVisible(boolean aFlag) { super.setVisible(aFlag); if(aFlag == true) { Dimension d = this.getSize(); if(d.width <= 0 || d.height <= 0) { d = this.getPreferredSize(); } model.getGraphLayout().setSize(d); } }
public void scaleToLayout(ScalingControl scaler) { Dimension vd = getPreferredSize(); if (this.isShowing()) { vd = getSize(); } Dimension ld = model.getLayoutSize(); if (vd.equals(ld) == false) { scaler.scale(this, (float) (vd.getWidth() / ld.getWidth()), new Point2D.Double()); } }
public void setGraphLayout(Layout<V,E> layout) { Dimension viewSize = getPreferredSize(); if(this.isShowing()) { viewSize = getSize(); } model.setGraphLayout(layout, viewSize); }
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()); } }
Dimension d = getSize();
Dimension d = getSize();