1
2
3
4
5
6
7
8
9
10
11
12 package edu.uci.ics.jung.visualization.control;
13
14 import java.awt.geom.Point2D;
15
16 import edu.uci.ics.jung.visualization.Layer;
17 import edu.uci.ics.jung.visualization.VisualizationServer;
18 import edu.uci.ics.jung.visualization.transform.MutableTransformer;
19
20
21
22
23
24
25
26
27 public class LayoutScalingControl implements ScalingControl {
28
29
30
31
32
33 public void scale(VisualizationServer<?, ?> vv, float amount, Point2D from) {
34
35 Point2D ivtfrom = vv.getRenderContext().getMultiLayerTransformer()
36 .inverseTransform(Layer.VIEW, from);
37 MutableTransformer modelTransformer = vv.getRenderContext().getMultiLayerTransformer()
38 .getTransformer(Layer.LAYOUT);
39 modelTransformer.scale(amount, amount, ivtfrom);
40 vv.repaint();
41 }
42 }