svn-gvsig-desktop / trunk / libraries / libFMap / src / com / iver / cit / gvsig / fmap / tools / ZoomOutListenerImpl.java @ 288
History | View | Annotate | Download (1.25 KB)
1 |
package com.iver.cit.gvsig.fmap.tools; |
---|---|
2 |
|
3 |
import java.awt.geom.Point2D; |
4 |
import java.awt.geom.Rectangle2D; |
5 |
|
6 |
import com.iver.cit.gvsig.fmap.ViewPort; |
7 |
import com.iver.cit.gvsig.fmap.tools.Events.PointEvent; |
8 |
import com.iver.cit.gvsig.fmap.tools.Listeners.PointListener; |
9 |
|
10 |
|
11 |
/**
|
12 |
* DOCUMENT ME!
|
13 |
*
|
14 |
* @author Vicente Caballero Navarro
|
15 |
*/
|
16 |
public class ZoomOutListenerImpl implements PointListener { |
17 |
private ViewPort vp;
|
18 |
|
19 |
/**
|
20 |
* Crea un nuevo ZoomOutListenerImpl.
|
21 |
*
|
22 |
* @param vp DOCUMENT ME!
|
23 |
*/
|
24 |
public ZoomOutListenerImpl(ViewPort vp) {
|
25 |
this.vp = vp;
|
26 |
} |
27 |
|
28 |
/**
|
29 |
* @see com.iver.cit.gvsig.fmap.tools.Listeners.PointListener#point(com.iver.cit.gvsig.fmap.tools.PointEvent)
|
30 |
*/
|
31 |
public void point(PointEvent event) { |
32 |
Point2D p2 = vp.toMapPoint(event.getPoint());
|
33 |
|
34 |
double nuevoX;
|
35 |
double nuevoY;
|
36 |
double factor = 1.8; |
37 |
Rectangle2D.Double r = new Rectangle2D.Double(); |
38 |
|
39 |
nuevoX = p2.getX() - ((vp.getExtent().getWidth() * factor) / 2.0);
|
40 |
nuevoY = p2.getY() - ((vp.getExtent().getHeight() * factor) / 2.0);
|
41 |
r.x = nuevoX; |
42 |
r.y = nuevoY; |
43 |
r.width = vp.getExtent().getWidth() * factor; |
44 |
r.height = vp.getExtent().getHeight() * factor; |
45 |
|
46 |
vp.setExtent(r); |
47 |
} |
48 |
} |