Revision 20098 trunk/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
 *
82
 * @see MapContext#ZOOMOUTFACTOR
83
 * @see ViewPort#setExtent(Rectangle2D)
84
 * @see ZoomInListenerImpl
85
 * @see ZoomOutRightButtonListener
86
 *
63 87
 * @author Vicente Caballero Navarro
64 88
 */
65 89
public class ZoomOutListenerImpl implements PointListener {
90
	/**
91
	 * The image to display when the cursor is active.
92
	 */	
66 93
	private final Image izoomout = new ImageIcon(MapControl.class.getResource(
67 94
				"images/ZoomOutCursor.gif")).getImage();
95

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

  
104
	/**
105
	 * Reference to the <code>MapControl</code> object that uses.
106
	 */
70 107
	private MapControl mapControl;
71 108

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

  
81
	/**
82
	 * @see com.iver.cit.gvsig.fmap.tools.Listeners.PointListener#point(com.iver.cit.gvsig.fmap.tools.PointEvent)
118
	/*
119
	 * (non-Javadoc)
120
	 * @see com.iver.cit.gvsig.fmap.tools.Listeners.PointListener#point(com.iver.cit.gvsig.fmap.tools.Events.PointEvent)
83 121
	 */
84 122
	public void point(PointEvent event) {
85 123
		ViewPort vp = mapControl.getMapContext().getViewPort();
......
102 140
		// mapControl.drawMap(false);
103 141
	}
104 142

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

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

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

  
123 166
	}
124 167
}

Also available in: Unified diff