Revision 20098 trunk/applications/appgvSIG/src/com/iver/cit/gvsig/project/documents/view/toolListeners/MapOverviewChangeZoomListener.java

View differences:

MapOverviewChangeZoomListener.java
24 24
import com.iver.cit.gvsig.project.documents.view.MapOverview;
25 25

  
26 26
/**
27
 * <p>Listener for changes of the zoom caused by selecting a rectangular area on the associated
28
 *  {@link MapOverview MapOverview} object with the first button of the mouse.</p>
29
 *
30
 * <p>If the kind of action was a movement on the associated object,
31
 *  updates the <i>extent</i> of its rectangular area.</p>
32
 * 
33
 * <p>If the kind of action is the selection of a rectangular area, and is bigger than 3x3 pixels,
34
 *  applies a <i>zoom in</i> operation centering its <code>ViewPort</code> according the equivalent <i>extent</i>
35
 *  in map coordinates.</p>
36
 * 
37
 * @see ViewPort
38
 * 
27 39
 * @author jmvivo
28
 *
29 40
 */
30

  
31

  
32

  
33 41
public class MapOverviewChangeZoomListener implements RectangleListener, PanListener {
42
	/**
43
	 * The image to display when the cursor is active.
44
	 */
34 45
	private final Image izoomin = PluginServices.getIconTheme()
35 46
		.get("cursor-zoom-in").getImage();
36
	
47

  
48
	/**
49
	 * The cursor used to work with this tool listener.
50
	 * 
51
	 * @see #getCursor()
52
	 */
37 53
	private Cursor cur = Toolkit.getDefaultToolkit().createCustomCursor(izoomin,new Point(16, 16), "");
54

  
55
	/**
56
	 * Reference to the <code>MapControl</code> object that uses.
57
	 */
38 58
	protected MapControl mapControl;
39 59

  
40 60
	/**
41
	 * Crea un nuevo MapOverviewChangeZoomListener.
61
	 * <p>Creates a new listener for changes of zoom at the associated {@link MapOverview MapOverview} object.</p>
42 62
	 *
43
	 * @param mapControl Control de mapa asociado
63
	 * @param mapControl the <code>MapControl</code> object which represents the <code>MapOverview</code>  
44 64
	 */
45 65
	public MapOverviewChangeZoomListener(MapControl mapControl) {
46 66
		this.mapControl=mapControl;
47 67
	}
48 68

  
49
	/**
50
	 * Cambia el zoom. Es llamado cuando finaliza de
51
	 * pintar el recuadro
52
	 *
53
	 *
54
	 *
69
	/*
70
	 * (non-Javadoc)
55 71
	 * @see com.iver.cit.gvsig.fmap.tools.Listeners.RectangleListener#rectangle(com.iver.cit.gvsig.fmap.tools.Events.RectangleEvent)
56 72
	 */
57 73
	public void rectangle(RectangleEvent event) throws BehaviorException {
......
81 97
				mov.getAssociatedMapContext().invalidate();
82 98
				vpView.setExtent(realRectangle);
83 99
			}
84

  
85 100
		}
86

  
87

  
88 101
	}
89 102

  
90
	/**
103
	/*
91 104
	 * (non-Javadoc)
92 105
	 * @see com.iver.cit.gvsig.fmap.tools.Listeners.ToolListener#getCursor()
93
	 **/
106
	 */
94 107
	public Cursor getCursor() {
95 108
		return this.cur;
96 109
	}
......
102 115
		return true; //???
103 116
	}
104 117

  
105
	/**
106
	 * Es llamado mientras se hace del 'Dragg' del
107
	 * raton. Pinta el recuadro de la forma.
108
	 **/
118
	/*
119
	 * (non-Javadoc)
120
	 * @see com.iver.cit.gvsig.fmap.tools.Listeners.PanListener#move(com.iver.cit.gvsig.fmap.tools.Events.MoveEvent)
121
	 */
109 122
	public void move(MoveEvent event) throws BehaviorException {
110 123

  
111 124

  
......
132 145

  
133 146
	}
134 147

  
135
	/**
136
	 * Comprueba que el estado de los botones
137
	 * sea el deseado para esta herramienta.
138
	 **/
148
	/** 
149
	 * Determines if has pressed the button 1 of the mouse.
150
	 */
139 151
	private boolean checkModifiers(MouseEvent event) {
140 152
		int modifiers = event.getModifiers();
141 153
		int keyPressedMask = InputEvent.BUTTON1_MASK;
142 154
		return ((modifiers & keyPressedMask) == keyPressedMask);
143 155
	}
144

  
145 156
}

Also available in: Unified diff