Statistics
| Revision:

svn-document-layout / tags / 2059 / org.gvsig.app.document.layout.app.mainplugin / src / main / java / org / gvsig / app / project / documents / layout / tools / LayoutZoomOutListenerImpl.java @ 46

History | View | Annotate | Download (2.88 KB)

1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 */
22
package org.gvsig.app.project.documents.layout.tools;
23

    
24
import java.awt.Image;
25
import java.awt.Point;
26
import java.awt.event.MouseEvent;
27

    
28
import org.gvsig.andami.PluginServices;
29
import org.gvsig.app.project.documents.layout.gui.LayoutPanel;
30
import org.gvsig.app.project.documents.layout.tools.listener.LayoutRectangleListener;
31
import org.gvsig.fmap.mapcontrol.tools.BehaviorException;
32
import org.gvsig.fmap.mapcontrol.tools.Events.EnvelopeEvent;
33
import org.gvsig.fmap.mapcontrol.tools.Events.PointEvent;
34

    
35
/**
36
 * Implementaci�n de la interfaz LayoutPointListener como herramienta para
37
 * realizar
38
 * un zoom menos.
39
 * 
40
 * @author Vicente Caballero Navarro
41
 */
42
public class LayoutZoomOutListenerImpl extends AbstractLayoutToolListener
43
    implements LayoutRectangleListener {
44

    
45
    private static final Image iLayoutzoomout = PluginServices.getIconTheme()
46
        .get("cursor-layout-navigation-zoom-out-topoint").getImage();
47

    
48
    /**
49
     * Crea un nuevo LayoutZoomOutListenerImpl.
50
     * 
51
     * @param mapControl
52
     *            MapControl.
53
     */
54
    public LayoutZoomOutListenerImpl(LayoutPanel layoutPanel) {
55
        super(layoutPanel);
56
    }
57

    
58
    /**
59
     * @see org.gvsig.fmap.mapcontrol.tools.Listeners.ToolListener#getCursor()
60
     */
61
    public Image getImageCursor() {
62
        return iLayoutzoomout;
63
    }
64

    
65
    /**
66
     * @see org.gvsig.fmap.mapcontrol.tools.Listeners.ToolListener#cancelDrawing()
67
     */
68
    public boolean cancelDrawing() {
69
        System.out.println("cancelDrawing del ZoomOutListenerImpl");
70
        return true;
71
    }
72

    
73
    public void pointDoubleClick(PointEvent event) {
74
        // TODO Auto-generated method stub
75

    
76
    }
77

    
78
    public void rectangle(EnvelopeEvent event) throws BehaviorException {
79
        if (event.getEvent().getButton() == MouseEvent.BUTTON1) {
80
            Point p2 =
81
                new Point(event.getEvent().getX(), event.getEvent().getY());
82
            layoutPanel.getLayoutControl().getLayoutZooms().setZoomOut(p2);
83
            layoutPanel.getLayoutControl().refresh();
84
        }
85

    
86
    }
87
}