Revision 20100 branches/v10/libraries/libFMap/src/com/iver/cit/gvsig/fmap/tools/ZoomOutListenerImpl.java

View differences:

ZoomOutListenerImpl.java
57 57

  
58 58

  
59 59
/**
60
 * Implementaci?n de la interfaz PointListener como herramienta para realizar
61
 * un zoom menos.
60
 * <p>Listener for doing a <i>zoom out</i> operation on the extent of the <code>ViewPort</code> of the associated {@link MapControl MapControl}
61
 *  object, selecting a point of the <code>MapControl</code> by a single click of any mouse's button.</p>
62
 * 
63
 * <p>Calculates the new extent <i>r</i> with this equations:
64
 *  <code><br>
65
 *   ViewPort vp = mapControl.getMapContext().getViewPort();<br>
66
 *   Point2D p2 = vp.toMapPoint(event.getPoint());<br>
67
 *   double factor = 1/MapContext.ZOOMOUTFACTOR;<br>
68
 *   Rectangle2D.Double r = new Rectangle2D.Double();<br>
69
 *   double nuevoX = p2.getX() - ((vp.getExtent().getWidth() * factor) / 2.0);<br>
70
 *   double nuevoY = p2.getY() - ((vp.getExtent().getHeight() * factor) / 2.0);<br>
71
 *   r.x = nuevoX;<br>
72
 *   r.y = nuevoY;<br>
73
 *   r.width = vp.getExtent().getWidth() * factor;<br>
74
 *   r.height = vp.getExtent().getHeight() * factor;<br>
75
 *   vp.setExtent(r);
76
 *  </code>
77
 * </p>
78
 * 
79
 * <p>The ultimately extent will be an adaptation from that, calculated by the <code>ViewPort</code>
80
 *  bearing in mind the ratio of the available rectangle.</p>
62 81
 *
63
 * @author Vicente Caballero Navarro
82
 * @see MapContext#ZOOMOUTFACTOR
83
 * @see ViewPort#setExtent(Rectangle2D)
84
 * @see ZoomInListenerImpl
85
 * @see ZoomOutRightButtonListener
64 86
 */
65 87
public class ZoomOutListenerImpl implements PointListener {
66
	private final Image izoomout = new ImageIcon(MapControl.class.getResource(
67
				"images/ZoomOutCursor.gif")).getImage();
88
	/**
89
	 * The image to display when the cursor is active.
90
	 */	
91
	private final Image izoomout = new ImageIcon(MapControl.class.getResource("images/ZoomOutCursor.gif")).getImage();
92

  
93
	/**
94
	 * The cursor used to work with this tool listener.
95
	 * 
96
	 * @see #getCursor()
97
	 */
68 98
	private Cursor cur = Toolkit.getDefaultToolkit().createCustomCursor(izoomout,
69 99
			new Point(16, 16), "");
100

  
101
	/**
102
	 * Reference to the <code>MapControl</code> object that uses.
103
	 */
70 104
	private MapControl mapControl;
71 105

  
72 106
	/**
73
	 * Crea un nuevo ZoomOutListenerImpl.
74
	 *
75
	 * @param mapControl MapControl.
107
	 * <p>Creates a new <code>ZoomOutListenerImpl</code> object.</p>
108
	 * 
109
	 * @param mapControl the <code>MapControl</code> where will be applied the changes
76 110
	 */
77 111
	public ZoomOutListenerImpl(MapControl mapControl) {
78 112
		this.mapControl = mapControl;
79 113
	}
80 114

  
81
	/**
82
	 * @see com.iver.cit.gvsig.fmap.tools.Listeners.PointListener#point(com.iver.cit.gvsig.fmap.tools.PointEvent)
115
	/*
116
	 * (non-Javadoc)
117
	 * @see com.iver.cit.gvsig.fmap.tools.Listeners.PointListener#point(com.iver.cit.gvsig.fmap.tools.Events.PointEvent)
83 118
	 */
84 119
	public void point(PointEvent event) {
85 120
		ViewPort vp = mapControl.getMapContext().getViewPort();
......
102 137
		// mapControl.drawMap(false);
103 138
	}
104 139

  
105
	/**
140
	/*
141
	 * (non-Javadoc)
106 142
	 * @see com.iver.cit.gvsig.fmap.tools.Listeners.ToolListener#getCursor()
107 143
	 */
108 144
	public Cursor getCursor() {
109 145
		return cur;
110 146
	}
111 147

  
112
	/**
148
	/*
149
	 * (non-Javadoc)
113 150
	 * @see com.iver.cit.gvsig.fmap.tools.Listeners.ToolListener#cancelDrawing()
114 151
	 */
115 152
	public boolean cancelDrawing() {
......
117 154
		return true;
118 155
	}
119 156

  
157
	/*
158
	 * (non-Javadoc)
159
	 * @see com.iver.cit.gvsig.fmap.tools.Listeners.PointListener#pointDoubleClick(com.iver.cit.gvsig.fmap.tools.Events.PointEvent)
160
	 */
120 161
	public void pointDoubleClick(PointEvent event) {
121 162
		// TODO Auto-generated method stub
122 163

  

Also available in: Unified diff