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()); } }
public void endEdgeCreate(BasicVisualizationServer<V, E> vv, V endVertex) { if(startVertex != null) { Graph<V,E> graph = vv.getGraphLayout().getGraph(); graph.addEdge(edgeFactory.get(), startVertex, endVertex, edgeType); vv.repaint(); } startVertex = null; edgeType = EdgeType.UNDIRECTED; edgeEffects.endEdgeEffects(vv); edgeEffects.endArrowEffects(vv); }
@SuppressWarnings({ "rawtypes", "unchecked" }) public CachingEdgeRenderer(BasicVisualizationServer<V,E> vv) { vv.getRenderContext().getMultiLayerTransformer().addChangeListener(this); Layout<V,E> layout = vv.getGraphLayout(); if(layout instanceof LayoutEventSupport) { ((LayoutEventSupport)layout).addLayoutChangeListener(this); } } /**
@SuppressWarnings({ "rawtypes", "unchecked" }) public CachingVertexRenderer(BasicVisualizationServer<V,E> vv) { vv.getRenderContext().getMultiLayerTransformer().addChangeListener(this); Layout<V,E> layout = vv.getGraphLayout(); if(layout instanceof LayoutEventSupport) { ((LayoutEventSupport)layout).addLayoutChangeListener(this); } }
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(); }