Revision 41964 trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.fmap.control/src/main/java/org/gvsig/fmap/mapcontrol/tools/ZoomOutRightButtonListener.java
ZoomOutRightButtonListener.java | ||
---|---|---|
32 | 32 |
import org.gvsig.fmap.geom.GeometryLocator; |
33 | 33 |
import org.gvsig.fmap.geom.GeometryManager; |
34 | 34 |
import org.gvsig.fmap.geom.exception.CreateEnvelopeException; |
35 |
import org.gvsig.fmap.geom.primitive.Envelope; |
|
36 | 35 |
import org.gvsig.fmap.mapcontext.MapContext; |
37 | 36 |
import org.gvsig.fmap.mapcontext.ViewPort; |
38 | 37 |
import org.gvsig.fmap.mapcontrol.MapControl; |
... | ... | |
44 | 43 |
|
45 | 44 |
|
46 | 45 |
/** |
47 |
* <p>Listener for doing a <i>zoom out</i> operation on the extent of the <code>ViewPort</code> of the associated {@link MapControl MapControl} |
|
48 |
* object, selecting a point of the <code>MapControl</code> by a single click of the third button of the mouse.</p> |
|
49 |
* |
|
50 |
* <p>Calculates the new extent <i>r</i> with this equations: |
|
51 |
* <code><br> |
|
52 |
* ViewPort vp = mapControl.getMapContext().getViewPort();<br> |
|
53 |
* Point2D p2 = vp.toMapPoint(event.getPoint());<br> |
|
54 |
* double factor = 1/MapContext.ZOOMOUTFACTOR;<br> |
|
55 |
* Rectangle2D.Double r = new Rectangle2D.Double();<br> |
|
56 |
* double nuevoX = p2.getX() - ((vp.getExtent().getWidth() * factor) / 2.0);<br> |
|
57 |
* double nuevoY = p2.getY() - ((vp.getExtent().getHeight() * factor) / 2.0);<br> |
|
58 |
* r.x = nuevoX;<br> |
|
59 |
* r.y = nuevoY;<br> |
|
60 |
* r.width = vp.getExtent().getWidth() * factor;<br> |
|
61 |
* r.height = vp.getExtent().getHeight() * factor;<br> |
|
62 |
* vp.setExtent(r); |
|
63 |
* </code> |
|
64 |
* </p> |
|
65 |
* |
|
66 |
* <p>The ultimately extent will be an adaptation from that, calculated by the <code>ViewPort</code> |
|
67 |
* bearing in mind the ratio of the available rectangle.</p> |
|
68 |
* |
|
69 |
* @see MapContext#ZOOMOUTFACTOR |
|
70 |
* @see ViewPort#setEnvelope(Envelope) |
|
71 |
* @see ZoomInListenerImpl |
|
72 |
* @see ZoomOutListenerImpl |
|
73 |
* |
|
74 |
* @author Vicente Caballero Navarro |
|
46 |
* @deprecated use ZoomOutListenerImpl setting mouseButton to right in the Behavior. |
|
75 | 47 |
*/ |
76 | 48 |
public class ZoomOutRightButtonListener implements PointListener { |
77 | 49 |
private static final GeometryManager geomManager = GeometryLocator.getGeometryManager(); |
78 | 50 |
private static final Logger logger = LoggerFactory.getLogger(ZoomOutRightButtonListener.class); |
79 |
|
|
51 |
|
|
80 | 52 |
/** |
81 |
* The image to display when the cursor is active. |
|
82 |
*/ |
|
83 |
// private final Image izoomout = PluginServices.getIconTheme().get("cursor-zoom-out").getImage(); |
|
84 |
|
|
85 |
/** |
|
86 | 53 |
* Reference to the <code>MapControl</code> object that uses. |
87 | 54 |
*/ |
88 | 55 |
private MapControl mapControl; |
... | ... | |
94 | 61 |
*/ |
95 | 62 |
public ZoomOutRightButtonListener(MapControl mapControl) { |
96 | 63 |
this.mapControl = mapControl; |
64 |
logger.warn("Using deprecated class ZoomOutRightButtonListener"); |
|
97 | 65 |
} |
98 | 66 |
|
99 | 67 |
/* |
Also available in: Unified diff