svn-gvsig-desktop / trunk / extensions / extRemoteSensing / src / org / gvsig / remotesensing / imagefusion / gui / FusionImagePanel.java @ 19524
History | View | Annotate | Download (7.85 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; |
43 |
|
44 |
import java.awt.BorderLayout; |
45 |
import java.awt.Dimension; |
46 |
import java.awt.GridBagConstraints; |
47 |
import java.awt.GridBagLayout; |
48 |
import java.util.ArrayList; |
49 |
|
50 |
import javax.swing.BorderFactory; |
51 |
import javax.swing.ButtonGroup; |
52 |
import javax.swing.JCheckBox; |
53 |
import javax.swing.JPanel; |
54 |
import javax.swing.JRadioButton; |
55 |
import javax.swing.JTextField; |
56 |
|
57 |
import org.gvsig.fmap.raster.layers.FLyrRasterSE; |
58 |
import org.gvsig.raster.beans.previewbase.IPreviewRenderProcess; |
59 |
import org.gvsig.raster.beans.previewbase.PreviewBasePanel; |
60 |
import org.gvsig.raster.grid.filter.FilterTypeException; |
61 |
import org.gvsig.raster.hierarchy.IRasterRendering; |
62 |
|
63 |
import com.iver.andami.PluginServices; |
64 |
import com.iver.cit.gvsig.fmap.layers.FLayer; |
65 |
import com.iver.cit.gvsig.project.documents.view.gui.View; |
66 |
|
67 |
/**
|
68 |
* Clase que define la interfaz del proceso de fusion de una imagenes. Recoge la
|
69 |
* imagen a fusionar y la banda de alta definicion. Posibilita la elecci?n del
|
70 |
* m?todo empleado y da la posibilidad de configurar ciertos parametros especificos para cada tipo.
|
71 |
*
|
72 |
*
|
73 |
* @author amunoz (alejandro.munoz@uclm.es)
|
74 |
* @version 19/10/2007
|
75 |
*/
|
76 |
public class FusionImagePanel extends JPanel implements IPreviewRenderProcess{ |
77 |
|
78 |
private static final long serialVersionUID = 1L; |
79 |
private PreviewBasePanel previewBasePanel = null; |
80 |
private FLayer layer = null; |
81 |
private FusionImageDialog fusionDialog = null; |
82 |
|
83 |
// Panel con la seleccion de banda alta resolucion y metodo seleccionado
|
84 |
private FusionImageMainPanel fusionMainPanel = null; |
85 |
|
86 |
private JRadioButton rButtonMemory = null; |
87 |
private JRadioButton rButtonFile = null; |
88 |
private JPanel jPanelOptions = null; |
89 |
private JTextField filenameTextField = null; |
90 |
private String viewName = null; |
91 |
private JCheckBox jPreviewCheck = null; |
92 |
private FusionImageListener listener = null; |
93 |
|
94 |
|
95 |
/**
|
96 |
* Constructor
|
97 |
*/
|
98 |
public FusionImagePanel(FLayer layer, FusionImageDialog fusionDialog) {
|
99 |
this.fusionDialog = fusionDialog;
|
100 |
View view = (View) PluginServices.getMDIManager().getActiveWindow(); |
101 |
viewName = PluginServices.getMDIManager().getWindowInfo(view).getTitle(); |
102 |
setLayer(layer); |
103 |
initialize(); |
104 |
} |
105 |
|
106 |
|
107 |
private void initialize() { |
108 |
setLayout(new BorderLayout()); |
109 |
add(getPreviewBasePanel(), BorderLayout.CENTER);
|
110 |
} |
111 |
|
112 |
/**
|
113 |
* Obtiene el panel con el la vista previa
|
114 |
*/
|
115 |
public PreviewBasePanel getPreviewBasePanel() {
|
116 |
if (previewBasePanel == null) { |
117 |
listener= new FusionImageListener(fusionDialog);
|
118 |
ArrayList list = new ArrayList(); |
119 |
list.add(getMainPanel()); |
120 |
previewBasePanel = new PreviewBasePanel(list, null, panelOptions(), this, (FLyrRasterSE) layer); |
121 |
previewBasePanel.setPreviewSize(new Dimension(230, 215)); |
122 |
previewBasePanel.addButtonPressedListener(fusionDialog); |
123 |
} |
124 |
return previewBasePanel;
|
125 |
} |
126 |
|
127 |
|
128 |
/** Establece layer para visualizacion */
|
129 |
public void setLayer(FLayer layer) { |
130 |
if (layer == null) |
131 |
return;
|
132 |
this.layer = layer;
|
133 |
getPreviewBasePanel().setLayer((FLyrRasterSE) layer); |
134 |
|
135 |
} |
136 |
|
137 |
public FusionImageMainPanel getMainPanel() {
|
138 |
if (fusionMainPanel == null) { |
139 |
fusionMainPanel = new FusionImageMainPanel();
|
140 |
} |
141 |
return fusionMainPanel;
|
142 |
} |
143 |
|
144 |
public void process(IRasterRendering rendering) throws FilterTypeException { |
145 |
|
146 |
|
147 |
|
148 |
|
149 |
|
150 |
|
151 |
|
152 |
} |
153 |
|
154 |
/** Panel de opciones de visualizacion y salida */
|
155 |
public JPanel panelOptions() { |
156 |
if (jPanelOptions == null) { |
157 |
|
158 |
jPanelOptions=new JPanel(); |
159 |
GridBagConstraints gridBagConstraints;
|
160 |
JPanel radioPanel = new JPanel(); |
161 |
radioPanel.setLayout(new GridBagLayout()); |
162 |
ButtonGroup buttonGroup = new ButtonGroup(); |
163 |
buttonGroup.add(getRadioMemory()); |
164 |
gridBagConstraints = new java.awt.GridBagConstraints();
|
165 |
gridBagConstraints.gridx = 0;
|
166 |
gridBagConstraints.gridy = 0;
|
167 |
gridBagConstraints.anchor = GridBagConstraints.WEST;
|
168 |
|
169 |
radioPanel.setBorder(BorderFactory.createTitledBorder(PluginServices.getText(this,"output_options"))); |
170 |
gridBagConstraints = new java.awt.GridBagConstraints();
|
171 |
gridBagConstraints.gridx = 0;
|
172 |
gridBagConstraints.gridy = 1;
|
173 |
gridBagConstraints.anchor = GridBagConstraints.WEST;
|
174 |
gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3); |
175 |
radioPanel.add(getRadioMemory(),gridBagConstraints); |
176 |
buttonGroup.add(getRadioFile()); |
177 |
gridBagConstraints = new java.awt.GridBagConstraints();
|
178 |
gridBagConstraints.gridx = 0;
|
179 |
gridBagConstraints.gridy = 2;
|
180 |
gridBagConstraints.anchor = GridBagConstraints.WEST;
|
181 |
gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3); |
182 |
radioPanel.add(getRadioFile(),gridBagConstraints); |
183 |
|
184 |
jPanelOptions.setLayout(new GridBagLayout()); |
185 |
gridBagConstraints = new java.awt.GridBagConstraints();
|
186 |
gridBagConstraints.gridx = 0;
|
187 |
gridBagConstraints.gridy = 0;
|
188 |
gridBagConstraints.anchor = GridBagConstraints.WEST;
|
189 |
gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3); |
190 |
jPanelOptions.add(getJPreviewCheck(),gridBagConstraints); |
191 |
|
192 |
gridBagConstraints = new java.awt.GridBagConstraints();
|
193 |
gridBagConstraints.gridx = 0;
|
194 |
gridBagConstraints.gridy = 1;
|
195 |
gridBagConstraints.anchor = GridBagConstraints.WEST;
|
196 |
gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3); |
197 |
jPanelOptions.add(radioPanel,gridBagConstraints); |
198 |
|
199 |
} |
200 |
|
201 |
return jPanelOptions;
|
202 |
} |
203 |
|
204 |
|
205 |
/** @return radiobutton a fichero */
|
206 |
public JRadioButton getRadioFile(){ |
207 |
if (rButtonFile == null){ |
208 |
rButtonFile = new JRadioButton(PluginServices.getText(this,"a_fichero")); |
209 |
rButtonFile.addActionListener(listener); |
210 |
} |
211 |
return rButtonFile;
|
212 |
} |
213 |
|
214 |
/** @return radiobutton a memoria */
|
215 |
public JRadioButton getRadioMemory(){ |
216 |
if (rButtonMemory == null){ |
217 |
rButtonMemory = new JRadioButton(PluginServices.getText(this,"a_memoria"),true); |
218 |
rButtonMemory.addActionListener(listener); |
219 |
} |
220 |
return rButtonMemory;
|
221 |
} |
222 |
|
223 |
|
224 |
public JTextField getFilenameTextField() { |
225 |
if (filenameTextField == null) { |
226 |
filenameTextField = new JTextField(); |
227 |
filenameTextField.setPreferredSize(new Dimension(150, filenameTextField.getPreferredSize().height)); |
228 |
//RasterLibrary.addOnlyLayerNameListener(this);
|
229 |
} |
230 |
return filenameTextField;
|
231 |
} |
232 |
|
233 |
|
234 |
public JCheckBox getJPreviewCheck() { |
235 |
if(jPreviewCheck==null){ |
236 |
jPreviewCheck = new JCheckBox(PluginServices.getText(this,"apply_preview")); |
237 |
jPreviewCheck.addActionListener(listener); |
238 |
} |
239 |
return jPreviewCheck;
|
240 |
} |
241 |
|
242 |
|
243 |
public FusionImageListener getFusionImageListener(){
|
244 |
if(listener==null){ |
245 |
listener= new FusionImageListener(fusionDialog);
|
246 |
} |
247 |
return listener;
|
248 |
} |
249 |
|
250 |
public String getViewName(){ |
251 |
return viewName;
|
252 |
} |
253 |
|
254 |
// Aplica las acciones al aceptar
|
255 |
public void accept(){ |
256 |
listener.accept(); |
257 |
} |
258 |
} |
259 |
|
260 |
|