View Javadoc
1   package edu.uci.ics.jung.visualization.spatial;
2   
3   import java.awt.Dimension;
4   import java.awt.geom.Point2D;
5   import java.awt.geom.Rectangle2D;
6   
7   import com.google.common.base.Function;
8   
9   import edu.uci.ics.jung.algorithms.layout.Layout;
10  import edu.uci.ics.jung.graph.Graph;
11  
12  /**
13   * break into several rectangular areas, each of which will have a reference Graph
14   * @author tanelso
15   *
16   * @param <V> the vertex type
17   * @param <E> the edge type
18   */
19  public class FastRenderingLayout<V,E> implements Layout<V,E> {
20  	
21  	protected Layout<V,E> layout;
22  	protected Graph<V,E> graph;
23  	
24  	protected Rectangle2D[][] grid;
25  	
26  	public FastRenderingLayout(Layout<V,E> layout) {
27  		this.layout = layout;
28  	}
29  
30  	public Graph<V, E> getGraph() {
31  		return layout.getGraph();
32  	}
33  
34  	public Dimension getSize() {
35  		return layout.getSize();
36  	}
37  
38  	public void initialize() {
39  		layout.initialize();
40  	}
41  
42  	public boolean isLocked(V v) {
43  		return layout.isLocked(v);
44  	}
45  
46  	public void lock(V v, boolean state) {
47  		layout.lock(v, state);
48  	}
49  
50  	public void reset() {
51  		layout.reset();
52  	}
53  
54  	public void setGraph(Graph<V, E> graph) {
55  //		layout.setGraph(new FastRenderingGraph(graph));
56  	}
57  
58  	public void setInitializer(Function<V, Point2D> initializer) {
59  		layout.setInitializer(initializer);
60  	}
61  
62  	public void setLocation(V v, Point2D location) {
63  		layout.setLocation(v, location);
64  	}
65  
66  	public void setSize(Dimension d) {
67  		layout.setSize(d);
68  	}
69  
70  	public Point2D apply(V arg0) {
71  		return layout.apply(arg0);
72  	}
73  
74  }