Line | Hits | Source |
---|---|---|
1 | /* | |
2 | * Copyright (c) 2005, the JUNG Project and the Regents of the University | |
3 | * of California | |
4 | * All rights reserved. | |
5 | * | |
6 | * This software is open-source under the BSD license; see either | |
7 | * "license.txt" or | |
8 | * http://jung.sourceforge.net/license.txt for a description. | |
9 | * Created on Mar 8, 2005 | |
10 | * | |
11 | */ | |
12 | package edu.uci.ics.jung.visualization; | |
13 | ||
14 | import edu.uci.ics.jung.visualization.control.LayoutScalingControl; | |
15 | import edu.uci.ics.jung.visualization.control.PluggableGraphMouse; | |
16 | import edu.uci.ics.jung.visualization.control.ScalingGraphMousePlugin; | |
17 | import edu.uci.ics.jung.visualization.control.TranslatingGraphMousePlugin; | |
18 | ||
19 | ||
20 | /** | |
21 | * ZoomPanGraphMouse is a PluggableGraphMouse class that includes | |
22 | * zoom via the mouse wheel, and pan via a mouse drag | |
23 | * | |
24 | * | |
25 | * @author Tom Nelson | |
26 | */ | |
27 | public class ZoomPanGraphMouse extends PluggableGraphMouse { | |
28 | ||
29 | protected TranslatingGraphMousePlugin translatingPlugin; | |
30 | protected ScalingGraphMousePlugin scalingPlugin; | |
31 | ||
32 | /** | |
33 | * create an instance with default zoom in/out values | |
34 | * @deprecated no need to pass a VisualizationViewer in constructor | |
35 | * @param vv the VisualizationViewer not used | |
36 | */ | |
37 | public ZoomPanGraphMouse(VisualizationViewer vv) { | |
38 | 0 | this(1.1f, 1/1.1f); |
39 | 0 | } |
40 | ||
41 | /** | |
42 | * create an instance with passed zoom in/out values | |
43 | * @deprecated no need to pass a VisualizationViewer | |
44 | * @param vv the VisualizationViewer - not used | |
45 | * @param in zoom in value | |
46 | * @param out zoom out value | |
47 | */ | |
48 | public ZoomPanGraphMouse(VisualizationViewer vv, float in, float out) { | |
49 | 0 | this(in, out); |
50 | 0 | } |
51 | ||
52 | public ZoomPanGraphMouse() { | |
53 | 0 | this(1.1f, 1/1.1f); |
54 | 0 | } |
55 | ||
56 | 0 | public ZoomPanGraphMouse(float in, float out) { |
57 | 0 | translatingPlugin = new TranslatingGraphMousePlugin(); |
58 | 0 | scalingPlugin = new ScalingGraphMousePlugin(new LayoutScalingControl(), 0, in, out); |
59 | 0 | add(translatingPlugin); |
60 | 0 | add(scalingPlugin); |
61 | 0 | } |
62 | ||
63 | /** | |
64 | * @param zoomAtMouse The zoomAtMouse to set. | |
65 | */ | |
66 | public void setZoomAtMouse(boolean zoomAtMouse) { | |
67 | 0 | scalingPlugin.setZoomAtMouse(zoomAtMouse); |
68 | 0 | } |
69 | } |
this report was generated by version 1.0.5 of jcoverage. |
copyright © 2003, jcoverage ltd. all rights reserved. |