Statistics
| Revision:

svn-gvsig-desktop / trunk / applications / appgvSIG / src / com / iver / cit / gvsig / LayoutControls.java @ 3110

History | View | Annotate | Download (4.77 KB)

1
/*
2
 * Created on 05-may-2004
3
 *
4
 * To change the template for this generated file go to
5
 * Window>Preferences>Java>Code Generation>Code and Comments
6
 */
7
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
8
 *
9
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
10
 *
11
 * This program is free software; you can redistribute it and/or
12
 * modify it under the terms of the GNU General Public License
13
 * as published by the Free Software Foundation; either version 2
14
 * of the License, or (at your option) any later version.
15
 *
16
 * This program is distributed in the hope that it will be useful,
17
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19
 * GNU General Public License for more details.
20
 *
21
 * You should have received a copy of the GNU General Public License
22
 * along with this program; if not, write to the Free Software
23
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
24
 *
25
 * For more information, contact:
26
 *
27
 *  Generalitat Valenciana
28
 *   Conselleria d'Infraestructures i Transport
29
 *   Av. Blasco Ib??ez, 50
30
 *   46010 VALENCIA
31
 *   SPAIN
32
 *
33
 *      +34 963862235
34
 *   gvsig@gva.es
35
 *      www.gvsig.gva.es
36
 *
37
 *    or
38
 *
39
 *   IVER T.I. S.A
40
 *   Salamanca 50
41
 *   46005 Valencia
42
 *   Spain
43
 *
44
 *   +34 963163400
45
 *   dac@iver.es
46
 */
47
package com.iver.cit.gvsig;
48

    
49
import com.iver.andami.PluginServices;
50
import com.iver.andami.plugins.Extension;
51
import com.iver.andami.ui.mdiManager.View;
52

    
53
import com.iver.cit.gvsig.gui.layout.FLayoutZooms;
54
import com.iver.cit.gvsig.gui.layout.Layout;
55

    
56
import org.apache.log4j.Logger;
57

    
58

    
59
/**
60
 * Extensi?n para controlar las operaciones basicas sobre el Layout.
61
 *
62
 * @author Vicente Caballero Navarro
63
 */
64
public class LayoutControls implements Extension {
65
        private static Logger logger = Logger.getLogger(LayoutControls.class.getName());
66
        private Layout layout = null;
67

    
68
        /**
69
         * @see com.iver.andami.plugins.Extension#execute(java.lang.String)
70
         */
71
        public void execute(String s) {
72
                layout = (Layout) PluginServices.getMDIManager().getActiveView();
73

    
74
                FLayoutZooms zooms = new FLayoutZooms(layout);
75
                logger.debug("Comand : " + s);
76

    
77
                if (s.compareTo("PAN") == 0) {
78
                        layout.setTool(Layout.PAN);
79
                } else if (s.compareTo("ZOOM_IN") == 0) {
80
                        layout.setTool(Layout.ZOOM_MAS);
81
                } else if (s.compareTo("ZOOM_OUT") == 0) {
82
                        layout.setTool(Layout.ZOOM_MENOS);
83
                } else if (s.compareTo("RECTANGLEVIEW") == 0) {
84
                        layout.setTool(Layout.RECTANGLEVIEW);
85
                } else if (s.compareTo("RECTANGLEPICTURE") == 0) {
86
                        layout.setTool(Layout.RECTANGLEPICTURE);
87
                } else if (s.compareTo("RECTANGLESCALEBAR") == 0) {
88
                        layout.setTool(Layout.RECTANGLESCALEBAR);
89
                } else if (s.compareTo("RECTANGLELEGEND") == 0) {
90
                        layout.setTool(Layout.RECTANGLELEGEND);
91
                } else if (s.compareTo("RECTANGLETEXT") == 0) {
92
                        layout.setTool(Layout.RECTANGLETEXT);
93
                } else if (s.compareTo("RECTANGLENORTH") == 0) {
94
                        layout.setTool(Layout.RECTANGLENORTH);
95
                } else if (s.compareTo("SELECT") == 0) {
96
                        layout.setTool(Layout.SELECT);
97
                } else if (s.compareTo("POINT") == 0) {
98
                        layout.setTool(Layout.POINT);
99
                } else if (s.compareTo("LINE") == 0) {
100
                        layout.setTool(Layout.LINE);
101
                } else if (s.compareTo("POLYLINE") == 0) {
102
                        layout.setTool(Layout.POLYLINE);
103
                } else if (s.compareTo("CIRCLE") == 0) {
104
                        layout.setTool(Layout.CIRCLE);
105
                } else if (s.compareTo("RECTANGLESIMPLE") == 0) {
106
                        layout.setTool(Layout.RECTANGLESIMPLE);
107
                } else if (s.compareTo("POLYGON") == 0) {
108
                        layout.setTool(Layout.POLYGON);
109
                } else if (s.compareTo("CONFIG") == 0) {
110
                        layout.showFConfig();
111
                        layout.fullRect();
112
                } else if (s.compareTo("PROPERTIES") == 0) {
113
                        layout.showFProperties();
114
                } else if (s.compareTo("FULL") == 0) {
115
                        layout.fullRect();
116
                } else if (s.compareTo("REALZOOM") == 0) {
117
                        zooms.realZoom();
118
                } else if (s.compareTo("ZOOMOUT") == 0) {
119
                        zooms.zoomOut();
120
                } else if (s.compareTo("ZOOMIN") == 0) {
121
                        zooms.zoomIn();
122
                } else if (s.compareTo("ZOOMSELECT") == 0) {
123
                        zooms.zoomSelect();
124
                } else if (s.compareTo("PDF")==0){
125
                        layout.layoutToPDF();
126
                }
127
                        
128
                
129
        }
130

    
131
        /**
132
         * @see com.iver.mdiApp.plugins.Extension#isVisible()
133
         */
134
        public boolean isVisible() {
135
                View f = PluginServices.getMDIManager().getActiveView();
136

    
137
                if (f == null) {
138
                        return false;
139
                }
140

    
141
                if (f.getClass() == Layout.class) {
142
                //        Layout layout = (Layout) f;
143

    
144
                        return true; //layout.m_Display.getMapControl().getMapContext().getLayers().layerCount() > 0;
145
                } else {
146
                        return false;
147
                }
148
        }
149

    
150
        /**
151
         * @see com.iver.andami.plugins.Extension#inicializar()
152
         */
153
        public void inicializar() {
154
        }
155

    
156
        /**
157
         * @see com.iver.andami.plugins.Extension#isEnabled()
158
         */
159
        public boolean isEnabled() {
160
                return true;
161
        }
162

    
163
        /**
164
         * Devuelve el Layout sobre el que se opera.
165
         *
166
         * @return Layout.
167
         */
168
        public Layout getLayout() {
169
                return layout;
170
        }
171
}