Statistics
| Revision:

svn-gvsig-desktop / trunk / applications / appgvSIG / src / com / iver / cit / gvsig / project / documents / view / toc / actions / ZoomPixelCursorTocMenuEntry.java @ 8163

History | View | Annotate | Download (3.1 KB)

1
package com.iver.cit.gvsig.project.documents.view.toc.actions;
2

    
3
import com.iver.andami.PluginServices;
4
import com.iver.cit.gvsig.fmap.MapControl;
5
import com.iver.cit.gvsig.fmap.layers.FLayer;
6
import com.iver.cit.gvsig.fmap.layers.FLyrRaster;
7
import com.iver.cit.gvsig.project.documents.view.gui.View;
8
import com.iver.cit.gvsig.project.documents.view.toc.AbstractTocContextMenuAction;
9
import com.iver.cit.gvsig.project.documents.view.toc.ITocItem;
10

    
11
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
12
 *
13
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
14
 *
15
 * This program is free software; you can redistribute it and/or
16
 * modify it under the terms of the GNU General Public License
17
 * as published by the Free Software Foundation; either version 2
18
 * of the License, or (at your option) any later version.
19
 *
20
 * This program is distributed in the hope that it will be useful,
21
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23
 * GNU General Public License for more details.
24
 *
25
 * You should have received a copy of the GNU General Public License
26
 * along with this program; if not, write to the Free Software
27
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
28
 *
29
 * For more information, contact:
30
 *
31
 *  Generalitat Valenciana
32
 *   Conselleria d'Infraestructures i Transport
33
 *   Av. Blasco Ib??ez, 50
34
 *   46010 VALENCIA
35
 *   SPAIN
36
 *
37
 *      +34 963862235
38
 *   gvsig@gva.es
39
 *      www.gvsig.gva.es
40
 *
41
 *    or
42
 *
43
 *   IVER T.I. S.A
44
 *   Salamanca 50
45
 *   46005 Valencia
46
 *   Spain
47
 *
48
 *   +34 963163400
49
 *   dac@iver.es
50
 */
51
/* CVS MESSAGES:
52
 *
53
 * $Id: ZoomPixelCursorTocMenuEntry.java 7738 2006-10-02 13:52:34Z jaume $
54
 * $Log$
55
 * Revision 1.2  2006-10-02 13:52:34  jaume
56
 * organize impots
57
 *
58
 * Revision 1.1  2006/09/15 10:41:30  caballero
59
 * extensibilidad de documentos
60
 *
61
 * Revision 1.1  2006/09/12 15:58:14  jorpiell
62
 * "Sacadas" las opcines del men? de FPopupMenu
63
 *
64
 *
65
 */
66
/**
67
 * @author Nacho Brodin <brodin_ign@gva.es>
68
 *
69
 * Entrada de men? para la activaci?n de la funcionalidad de zoom a un
70
 * pixel centrado en el cursor.
71
 */
72
public class ZoomPixelCursorTocMenuEntry extends AbstractTocContextMenuAction {
73
        public static final int ZOOM_TO_IMAGE_CENTER = 0x1;
74
        public static final int ZOOM_TO_VIEW_CENTER = 0x2;
75
        FLayer lyr = null;
76
        public int zoomType = ZOOM_TO_VIEW_CENTER;
77

    
78
        public String getGroup() {
79
                return "group2"; //FIXME
80
        }
81

    
82
        public int getGroupOrder() {
83
                return 20;
84
        }
85

    
86
        public int getOrder() {
87
                return 2;
88
        }
89

    
90
        public String getText() {
91
                return PluginServices.getText(this, "Zoom_pixel");
92
        }
93

    
94
        public boolean isEnabled(ITocItem item, FLayer[] selectedItems) {
95
                return true;
96
        }
97

    
98
        public boolean isVisible(ITocItem item, FLayer[] selectedItems) {
99
                if (isTocItemBranch(item)) {
100
                        return getNodeLayer(item) instanceof FLyrRaster;
101
                }
102
                return false;
103

    
104
        }
105

    
106

    
107
        public void execute(ITocItem item, FLayer[] selectedItems) {
108
                if (selectedItems.length==1) {
109
                lyr = getNodeLayer(item);
110
                    View vista = (View) PluginServices.getMDIManager().getActiveWindow();
111
                    MapControl mapCtrl = vista.getMapControl();
112
                    mapCtrl.setTool("zoom_pixel_cursor");
113

    
114
                }
115
        }
116
}