Statistics
| Revision:

root / trunk / extensions / extRemoteSensing / src / org / gvsig / remotesensing / imagefusion / gui / components / CreateOptionsFusionPanel.java @ 22165

History | View | Annotate | Download (6.4 KB)

1
/*
2
* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
3
*
4
* Copyright (C) 2006 Instituto de Desarrollo Regional and Generalitat Valenciana.
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., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
19
*
20
* For more information, contact:
21
*
22
*  Generalitat Valenciana
23
*   Conselleria d'Infraestructures i Transport
24
*   Av. Blasco Iba?ez, 50
25
*   46010 VALENCIA
26
*   SPAIN
27
*
28
*      +34 963862235
29
*   gvsig@gva.es
30
*      www.gvsig.gva.es
31
*
32
*    or
33
*
34
*   Instituto de Desarrollo Regional (Universidad de Castilla La-Mancha)
35
*   Campus Universitario s/n
36
*   02071 Alabacete
37
*   Spain
38
*
39
*   +34 967 599 200
40
*/
41

    
42
package org.gvsig.remotesensing.imagefusion.gui.components;
43

    
44
import java.awt.GridBagConstraints;
45
import java.awt.GridBagLayout;
46
import java.awt.Insets;
47
import java.awt.event.ItemEvent;
48
import java.awt.event.ItemListener;
49

    
50
import javax.swing.BorderFactory;
51
import javax.swing.ButtonGroup;
52
import javax.swing.JPanel;
53
import javax.swing.JRadioButton;
54

    
55
import org.gvsig.raster.beans.createlayer.NewLayerPanel;
56

    
57
import com.iver.andami.PluginServices;
58
/**
59
* Panel para unificar las propiedades de generacion de capas nuevas en ficheros
60
* o solo en visualizacion.
61
* 
62
* @version 10/03/2008
63
* @author aMu?oz (alejandro.munoz@uclm.es)
64
*/
65
public class CreateOptionsFusionPanel {
66
        private static final long serialVersionUID = 3921564127360827156L;
67
        private JPanel        panel         = null;
68
        private JRadioButton  jAsignedBand   = null;
69
        private JRadioButton  jAllBand   = null;
70
        private NewLayerPanel panelNewLayer = null;
71

    
72
        /**
73
         * Constructor de un CreateLayerPanel
74
         */
75
        public CreateOptionsFusionPanel() {
76
                initialize();
77
                translate();
78
        }
79
        
80
        /**
81
         * Devuelve el panel principal
82
         * @return
83
         */
84
        public JPanel getJPanel() {
85
                if (panel == null) {
86
                        panel = new JPanel();
87
                }
88
                return panel;
89
        }
90

    
91
        /**
92
         * Seccion donde ir?n todas las traducciones invariables del componente
93
         */
94
        private void translate() {
95
                getRadioAsignedBand().setText(PluginServices.getText(this, "bandas_visualizacion"));
96
                getRadioAllBand().setText(PluginServices.getText(this, "all_bands"));
97
        }
98
        
99
        private void initialize() {
100
                ButtonGroup buttonGroup1;
101
                GridBagConstraints gridBagConstraints;
102

    
103
                getJPanel().setLayout(new GridBagLayout());
104
                
105
                buttonGroup1 = new ButtonGroup();
106
                buttonGroup1.add(getRadioAsignedBand());
107

    
108
                gridBagConstraints = new GridBagConstraints();
109
                gridBagConstraints.gridx = 0;
110
                gridBagConstraints.gridy = 0;
111
                gridBagConstraints.anchor = GridBagConstraints.WEST;
112
                gridBagConstraints.insets = new Insets(3, 3, 3, 3);
113
                getJPanel().add(getRadioAsignedBand(), gridBagConstraints);
114

    
115
                buttonGroup1.add(getRadioAllBand());
116

    
117
                gridBagConstraints = new GridBagConstraints();
118
                gridBagConstraints.gridx = 0;
119
                gridBagConstraints.gridy = 1;
120
                gridBagConstraints.anchor = GridBagConstraints.WEST;
121
                gridBagConstraints.insets = new Insets(3, 3, 3, 3);
122
                getJPanel().add(getRadioAllBand(), gridBagConstraints);
123
                
124
                gridBagConstraints = new GridBagConstraints();
125
                gridBagConstraints.gridx = 0;
126
                gridBagConstraints.gridy = 2;
127
                gridBagConstraints.anchor = GridBagConstraints.WEST;
128
                gridBagConstraints.insets = new Insets(3, 3, 3, 3);
129
                getJPanel().add(getPanelNewLayer().getJPanel(), gridBagConstraints);
130
        }
131
        
132
        public NewLayerPanel getPanelNewLayer() {
133
                if (panelNewLayer == null)
134
                        panelNewLayer = new NewLayerPanel(null);
135
                return panelNewLayer;
136
        }
137
        
138
        /**
139
         * Poner los estados de los RadioButton en caso de que cambien de valor
140
         * @param evt
141
         */
142
        private void jRBNewLayerStateChanged(ItemEvent evt) {
143
                
144
        }
145

    
146
        /**
147
         * Especifica si se generara solo en la vista o se guardara en un fichero
148
         * @param enabled
149
         */
150
        public void setOnlyView(boolean enabled) {
151
                getRadioAsignedBand().setSelected(enabled);
152
        }
153

    
154
        /**
155
         * Devuelve el JRadioButton de Solo vista
156
         * @return
157
         */
158
        public JRadioButton getRadioAsignedBand() {
159
                if (jAsignedBand == null) {
160
                        jAsignedBand = new JRadioButton();
161
                        jAsignedBand.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
162
                        jAsignedBand.setMargin(new Insets(0, 0, 0, 0));
163
                        jAsignedBand.setSelected(true);
164
                }
165
                return jAsignedBand;
166
        }
167
        
168
        /**
169
         * Devuelve el JRadioButton de nueva capa
170
         * @return
171
         */
172
        public JRadioButton getRadioAllBand() {
173
                if (jAllBand == null) {
174
                        jAllBand = new JRadioButton();
175
                        jAllBand.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
176
                        jAllBand.setMargin(new Insets(0, 0, 0, 0));
177
                        jAllBand.setEnabled(false);
178
                        jAllBand.setSelected(false);
179
                        jAllBand.addItemListener(new ItemListener() {
180
                                public void itemStateChanged(ItemEvent evt) {
181
                                        jRBNewLayerStateChanged(evt);
182
                                }
183
                        });
184
                        jAllBand.setSelected(true);
185
                }
186
                return jAllBand;
187
        }
188
        
189
        /**
190
         * This method initializes jPNameFile
191
         *
192
         * @return javax.swing.JPanel
193
         */
194
        public JPanel getFileNamePanel() {
195
                return getPanelNewLayer().getFileNamePanel();
196
        }
197
        
198
        /**
199
         * Establece el texto de la etiqueta del nombre de fichero
200
         * @param text
201
         */
202
        public void setLabelFilename(String text) {
203
                getPanelNewLayer().setLabelFilename(text);
204
        }
205
        
206
        public boolean isNewLayerSelected() {
207
                return getRadioAllBand().isSelected();
208
        }
209

    
210
        public boolean isOnlyViewSelected() {
211
                return getRadioAsignedBand().isSelected();
212
        }
213
        
214
        /**
215
         * Asigna un valor para el par?metro que informa de si el raster de salida hay
216
         * que comprimirlo o no. Este valor es necesario cuando el raster de salida 
217
         * es mayor de 4G ya que no se puede crear un tiff tan grande.
218
         * @param compress true para comprimir el raster de salida y false para no hacerlo.
219
         */
220
        public void setCompress(boolean compress) {
221
                getPanelNewLayer().setCompress(compress);
222
        }
223
        
224
        /**
225
         * Devuelve la ruta del fichero donde se va a guardar, en caso de guardarse
226
         * en memoria, calcula el nombre sin preguntar y devuelve la ruta.
227
         * @return
228
         */
229
        public String getFileSelected() {
230
                return getPanelNewLayer().getFileSelected();
231
        }
232
        
233
        public void updateNewLayerText() {
234
                getPanelNewLayer().updateNewLayerText();
235
        }
236
}