root / trunk / applications / appgvSIG / src / com / iver / cit / gvsig / gui / panels / PropertiesRasterDialog.java @ 6117
History | View | Annotate | Download (36.3 KB)
1 |
/*
|
---|---|
2 |
* Created on 17-feb-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.gui.panels; |
48 |
|
49 |
import java.awt.Container; |
50 |
import java.awt.Event; |
51 |
import java.awt.event.ActionEvent; |
52 |
import java.awt.event.ActionListener; |
53 |
import java.awt.event.FocusEvent; |
54 |
import java.awt.event.FocusListener; |
55 |
import java.awt.event.MouseEvent; |
56 |
import java.awt.event.MouseListener; |
57 |
import java.awt.geom.Rectangle2D; |
58 |
import java.io.File; |
59 |
import java.util.ArrayList; |
60 |
import java.util.Vector; |
61 |
|
62 |
import javax.swing.JFileChooser; |
63 |
import javax.swing.JOptionPane; |
64 |
import javax.swing.JPanel; |
65 |
import javax.swing.filechooser.FileFilter; |
66 |
|
67 |
import org.cresques.cts.IProjection; |
68 |
import org.cresques.filter.RasterFilter; |
69 |
import org.cresques.filter.RasterFilterStackManager; |
70 |
import org.cresques.filter.BrightnessContrast.BrightnessContrastStackManager; |
71 |
import org.cresques.io.GeoRasterFile; |
72 |
import org.cresques.px.Extent; |
73 |
import org.cresques.ui.BrightnessContrast.EnhancedBrightnessContrastPanel; |
74 |
import org.cresques.ui.raster.BandSetupPanel; |
75 |
import org.cresques.ui.raster.FilterRasterDialogPanel; |
76 |
import org.cresques.ui.raster.InfoPanel; |
77 |
import org.cresques.ui.raster.RasterTransparencyPanel; |
78 |
|
79 |
import com.hardcode.driverManager.Driver; |
80 |
import com.hardcode.driverManager.DriverLoadException; |
81 |
import com.iver.andami.PluginServices; |
82 |
import com.iver.andami.messages.NotificationManager; |
83 |
import com.iver.andami.ui.mdiManager.View; |
84 |
import com.iver.andami.ui.mdiManager.ViewInfo; |
85 |
import com.iver.cit.gvsig.fmap.drivers.RasterDriver; |
86 |
import com.iver.cit.gvsig.fmap.layers.FLyrRaster; |
87 |
import com.iver.cit.gvsig.fmap.layers.LayerFactory; |
88 |
import com.iver.cit.gvsig.fmap.layers.StatusLayerRaster; |
89 |
|
90 |
/**
|
91 |
* <P>
|
92 |
* Dialogo para las propiedades de un raster. Esta maneja los eventos y aplica
|
93 |
* filtros sobre el raster a trav?s de l gestor de la pila de filtros seg?n la
|
94 |
* selecci?n del usuario. Este dialogo contiene varios paneles:
|
95 |
* </P>
|
96 |
* <UL>
|
97 |
* <LI>Propiedades</LI>
|
98 |
* <LI>Selecci?n de bandas</LI>
|
99 |
* <LI>Transparencia</LI>
|
100 |
* <LI>Realce</LI>
|
101 |
* </UL>
|
102 |
* @author Nacho Brodin <brodin_ign@gva.es>
|
103 |
*/
|
104 |
public class PropertiesRasterDialog extends FilterRasterDialogPanel implements View, MouseListener, ActionListener, FocusListener { |
105 |
|
106 |
private JPanel propPanel = null; |
107 |
private IProjection currentProjection = null; |
108 |
private FLyrRaster fLayer = null; |
109 |
private static final int nprops = 11; |
110 |
private Object[][] props = null; |
111 |
private RasterFilterStackManager stackManager = null; |
112 |
private Status status = null; |
113 |
private String filename = null; |
114 |
private long filesize = 0; |
115 |
private int width = 0; |
116 |
private int height = 0; |
117 |
private JFileChooser fileChooser = null; |
118 |
private String lastPath = new String("./"); |
119 |
private StatusLayerRaster rasterStatus = null; |
120 |
private int sizeX = 486, sizeY = 360; |
121 |
|
122 |
/**
|
123 |
* Clase que guarda el estado del dialogo y gestiona la restauraci?n
|
124 |
* del estado inicial en caso de cancelar.
|
125 |
* @author Nacho Brodin <brodin_ign@gva.es>
|
126 |
*/
|
127 |
class Status{ |
128 |
public String inicAlpha; |
129 |
public int bandR; |
130 |
public int bandG; |
131 |
public int bandB; |
132 |
private ArrayList filesAdd = new ArrayList(); |
133 |
private ArrayList filesRem = new ArrayList(); |
134 |
private ArrayList filters = null; |
135 |
|
136 |
|
137 |
public Status(String alpha, int bandR, int bandG, int bandB){ |
138 |
this.inicAlpha = alpha;
|
139 |
this.bandR = bandR;
|
140 |
this.bandG = bandG;
|
141 |
this.bandB = bandB;
|
142 |
filters = stackManager.getStringsFromStack(); |
143 |
} |
144 |
|
145 |
/**
|
146 |
* A?ade un fichero a la lista de a?adidos. Si estaba en la de eliminados
|
147 |
* lo quitamos.
|
148 |
* @param file Fichero a?adido
|
149 |
*/
|
150 |
public void addFile(String file){ |
151 |
filesAdd.add(file); |
152 |
for(int j=0;j<filesRem.size();j++){ |
153 |
if(file.equals((String)filesRem.get(j))) |
154 |
filesRem.remove(j); |
155 |
} |
156 |
|
157 |
} |
158 |
|
159 |
/**
|
160 |
* Elimina un fichero de la lista de a?adidos si ha sido a?adido. Si ya estaba
|
161 |
* antes no estar? en la lista de a?adidos por lo que habr? que ponerlo en la
|
162 |
* lista de eliminados.
|
163 |
* @param file Fichero eliminado
|
164 |
*/
|
165 |
public void removeFile(String file){ |
166 |
boolean isAdd = false; |
167 |
for(int i=0;i<filesAdd.size();i++){ |
168 |
if(((String)filesAdd.get(i)).equals(file)){ |
169 |
filesAdd.remove(i); |
170 |
isAdd = true;
|
171 |
} |
172 |
} |
173 |
if(!isAdd)
|
174 |
filesRem.add(file); |
175 |
|
176 |
} |
177 |
|
178 |
/**
|
179 |
* Restaura el Estado salvado
|
180 |
* @param status Estado
|
181 |
*/
|
182 |
public void restoreStatus(PropertiesRasterDialog props){ |
183 |
//Devolvemos la pila de filtros al estado inicial
|
184 |
//if(stackManager != null)
|
185 |
// stackManager.deleteTempFilters();
|
186 |
|
187 |
//Devolvemos el alpha al estado inicial
|
188 |
int opac = Integer.parseInt(status.inicAlpha); |
189 |
opac = (int)((opac*255)/100); |
190 |
fLayer.getSource().setTransparency(true);
|
191 |
fLayer.setTransparency(255-opac);
|
192 |
rasterStatus.transparency = 255-opac;
|
193 |
|
194 |
//Devolvemos el estado inicial de las bandas
|
195 |
|
196 |
if (fLayer != null) { |
197 |
fLayer.getSource().setBand(GeoRasterFile.RED_BAND, status.bandR); |
198 |
fLayer.getSource().setBand(GeoRasterFile.GREEN_BAND, status.bandG); |
199 |
fLayer.getSource().setBand(GeoRasterFile.BLUE_BAND, status.bandB); |
200 |
rasterStatus.bandR = status.bandR; |
201 |
rasterStatus.bandG = status.bandG; |
202 |
rasterStatus.bandB = status.bandB; |
203 |
} |
204 |
|
205 |
|
206 |
//Los que han sido a?adidos los quitamos
|
207 |
for(int i=0;i<filesAdd.size();i++) |
208 |
fLayer.delFile((String)this.filesAdd.get(i)); |
209 |
|
210 |
//Los que fueron quitados los a?adimos
|
211 |
for(int i=0;i<filesRem.size();i++) |
212 |
fLayer.addFiles((String)this.filesRem.get(i)); |
213 |
|
214 |
//Restauramos los filtros
|
215 |
if(filters!=null && ((FLyrRaster)fLayer).getSource().getFiles() != null) |
216 |
stackManager.createStackFromStrings(filters, ((FLyrRaster)fLayer).getSource().getFiles()); |
217 |
|
218 |
fLayer.getFMap().invalidate(); |
219 |
//this.show();
|
220 |
} |
221 |
|
222 |
public void show(){ |
223 |
System.out.println("***Lista A?adidos***"); |
224 |
for(int i=0;i<filesAdd.size();i++){ |
225 |
System.out.println(filesAdd.get(i).toString());
|
226 |
} |
227 |
System.out.println("***Lista Eliminados***"); |
228 |
for(int i=0;i<filesRem.size();i++){ |
229 |
System.out.println(filesRem.get(i).toString());
|
230 |
} |
231 |
System.out.println("*********************"); |
232 |
} |
233 |
|
234 |
} |
235 |
|
236 |
public class DriverFileFilter extends FileFilter{ |
237 |
|
238 |
private Driver driver; |
239 |
|
240 |
public DriverFileFilter(String driverName) throws DriverLoadException{ |
241 |
driver = LayerFactory.getDM().getDriver(driverName); |
242 |
} |
243 |
|
244 |
/**
|
245 |
* @see javax.swing.filechooser.FileFilter#accept(java.io.File)
|
246 |
*/
|
247 |
public boolean accept(File f) { |
248 |
if (f.isDirectory()) return true; |
249 |
if (driver instanceof RasterDriver){ |
250 |
return ((RasterDriver) driver).fileAccepted(f);
|
251 |
}else{
|
252 |
throw new RuntimeException("Tipo no reconocido"); |
253 |
} |
254 |
} |
255 |
|
256 |
/**
|
257 |
* @see javax.swing.filechooser.FileFilter#getDescription()
|
258 |
*/
|
259 |
public String getDescription() { |
260 |
return ((Driver) driver).getName(); |
261 |
} |
262 |
} |
263 |
|
264 |
/**
|
265 |
* Inicializador de valores de la ventana de dialogo.
|
266 |
* @param app
|
267 |
*/
|
268 |
public PropertiesRasterDialog(FLyrRaster layer, ArrayList ranges){ |
269 |
fLayer = layer; |
270 |
if(fLayer.getStatus()==null){ |
271 |
rasterStatus = new StatusLayerRaster();
|
272 |
fLayer.setStatus(rasterStatus); |
273 |
}else
|
274 |
rasterStatus = (StatusLayerRaster)fLayer.getStatus(); |
275 |
init(); |
276 |
this.setRanges(ranges);
|
277 |
setTranslation(); |
278 |
|
279 |
EnhancedBrightnessContrastPanel ep = (EnhancedBrightnessContrastPanel)super.getPanelByClassName("EnhancedBrightnessContrastPanel"); |
280 |
ep.lstBrightness.getJSlider().addMouseListener(this);
|
281 |
ep.lstContrast.getJSlider().addMouseListener(this);
|
282 |
ep.getCheckSliderText().getJTextField().addKeyListener(this);
|
283 |
ep.lstBrightness.getJTextField().addActionListener(this);
|
284 |
ep.lstContrast.getJTextField().addActionListener(this);
|
285 |
ep.lstBrightness.getJTextField().addFocusListener(this);
|
286 |
ep.lstContrast.getJTextField().addFocusListener(this);
|
287 |
} |
288 |
|
289 |
/**
|
290 |
* Asigna los textos a los paneles
|
291 |
*/
|
292 |
private void setTranslation(){ |
293 |
BandSetupPanel bandSetup = (BandSetupPanel)super.getPanelByClassName("BandSetupPanel"); |
294 |
|
295 |
bandSetup.getFileList().getJButtonAdd().setText(PluginServices.getText(this,"Anadir")); |
296 |
bandSetup.getFileList().getJButtonRemove().setText(PluginServices.getText(this,"Eliminar")); |
297 |
bandSetup.getFileList().lbandasVisibles.setText(PluginServices.getText(this,"bandas")); |
298 |
|
299 |
RasterTransparencyPanel tpan = (RasterTransparencyPanel)super.getPanelByClassName("RasterTransparencyPanel"); |
300 |
|
301 |
tpan.getTransparencyCheck().setText(PluginServices.getText(this,"activar")); |
302 |
tpan.getPTransparencyByPixel().setBorder(javax.swing.BorderFactory.createTitledBorder(null, PluginServices.getText(this,"transparencia_pixel"), javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null)); |
303 |
tpan.getOpacityCheck().setText(PluginServices.getText(this,"activar")); |
304 |
tpan.getOpacityPanel().setBorder(javax.swing.BorderFactory.createTitledBorder(null, PluginServices.getText(this,"opacidad"), javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null)); |
305 |
|
306 |
|
307 |
EnhancedBrightnessContrastPanel ep = (EnhancedBrightnessContrastPanel)super.getPanelByClassName("EnhancedBrightnessContrastPanel"); |
308 |
|
309 |
ep.lLineal.setText(PluginServices.getText(this, "lineal_directo")); |
310 |
ep.lRemove.setText(PluginServices.getText(this, "eliminar_extremos")); |
311 |
ep.cstEnhanced.setName(PluginServices.getText(this, "recorte_colas")+" ( % )"); |
312 |
ep.lBrightC.setText(PluginServices.getText(this, "brillo_y_contraste")); |
313 |
ep.lstBrightness.setName(PluginServices.getText(this, "brillo")); |
314 |
ep.lstContrast.setName(PluginServices.getText(this, "contraste")); |
315 |
ep.lpreview.setText(PluginServices.getText(this, "previsualizacion")); |
316 |
ep.getPBrightCont().setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createLineBorder(java.awt.Color.gray,1), (PluginServices.getText(this, "brillo_y_contraste")), javax.swing.border.TitledBorder.LEFT, javax.swing.border.TitledBorder.DEFAULT_POSITION, null, java.awt.Color.black)); |
317 |
ep.getPEnhanced().setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createLineBorder(java.awt.Color.gray,1), (PluginServices.getText(this, "realce")), javax.swing.border.TitledBorder.LEFT, javax.swing.border.TitledBorder.DEFAULT_POSITION, null, java.awt.Color.black)); |
318 |
|
319 |
|
320 |
//Recorremos los Tab y traducimos el nombre
|
321 |
for(int i=0;i<this.getTab().getTabCount();i++){ |
322 |
if(this.getTab().getTitleAt(i).equals("Info")) |
323 |
this.getTab().setTitleAt(i,PluginServices.getText(this,"info")); |
324 |
if(this.getTab().getTitleAt(i).equals("Transparencia")) |
325 |
this.getTab().setTitleAt(i,PluginServices.getText(this,"Transparencia")); |
326 |
if(this.getTab().getTitleAt(i).equals("Bandas")) |
327 |
this.getTab().setTitleAt(i,PluginServices.getText(this,"bandas")); |
328 |
if(this.getTab().getTitleAt(i).equals("Realce")) |
329 |
this.getTab().setTitleAt(i,PluginServices.getText(this,"realce")); |
330 |
} |
331 |
|
332 |
this.getAcceptButton().setText(PluginServices.getText(this,"Aceptar")); |
333 |
this.getApplyButton().setText(PluginServices.getText(this,"Aplicar")); |
334 |
this.getCancelButton().setText(PluginServices.getText(this,"Cancelar")); |
335 |
} |
336 |
|
337 |
/**
|
338 |
* Asigna un FLayerRaster
|
339 |
* @param layer capa a asignar
|
340 |
*/
|
341 |
public void setFLyrRaster(FLyrRaster layer){ |
342 |
fLayer = layer; |
343 |
} |
344 |
|
345 |
|
346 |
|
347 |
/**
|
348 |
* Carga los datos del panel info.
|
349 |
*/
|
350 |
private void loadInfoData(){ |
351 |
if(fLayer.getSource()!=null){ |
352 |
props = new Object[nprops][2]; |
353 |
props[0][0] = new String(PluginServices.getText(this,"Fichero")+":"); |
354 |
props[0][1] = filename; |
355 |
props[1][0] = new String(PluginServices.getText(this,"num_bandas")+":"); |
356 |
props[1][1] = new String(String.valueOf(fLayer.getSource().getNumBands())); |
357 |
props[2][0] = new String(PluginServices.getText(this,"ancho_alto")+":"); |
358 |
props[2][1] = this.width+" X "+this.height; |
359 |
props[3][0] = new String(PluginServices.getText(this,"formato")+":"); |
360 |
props[3][1] = filename.substring( |
361 |
filename.lastIndexOf('.')+1, |
362 |
filename.length()); |
363 |
props[4][0] = new String(PluginServices.getText(this,"tipo_dato")+":"); |
364 |
String type = null; |
365 |
switch(fLayer.getSource().getDataType()){
|
366 |
case 0: type = new String("BYTE");break; |
367 |
case 1: type = new String("USHORT");break; |
368 |
case 2: type = new String("SHORT");break; |
369 |
case 3: type = new String("INT");break; |
370 |
case 4: type = new String("FLOAT");break; |
371 |
case 5: type = new String("DOUBLE");break; |
372 |
default: type = new String("UNDEFINED");break; |
373 |
} |
374 |
props[4][1] = type; |
375 |
props[5][0] = new String(PluginServices.getText(this,"coor_geograficas")); |
376 |
props[6][0] = new String(PluginServices.getText(this,"xmin")+":"); |
377 |
props[6][1] = String.valueOf(fLayer.getSource().getFullExtent().getMinX()); |
378 |
props[7][0] = new String(PluginServices.getText(this,"ymin")+":"); |
379 |
props[7][1] = String.valueOf(fLayer.getSource().getFullExtent().getMinY()); |
380 |
props[8][0] = new String(PluginServices.getText(this,"xmax")+":"); |
381 |
props[8][1] = String.valueOf(fLayer.getSource().getFullExtent().getMaxX()); |
382 |
props[9][0] = new String(PluginServices.getText(this,"ymax")+":"); |
383 |
props[9][1] = String.valueOf(fLayer.getSource().getFullExtent().getMaxY()); |
384 |
|
385 |
}else{
|
386 |
props = new Object[1][2]; |
387 |
props[0][0] = new String("No props"); |
388 |
props[0][1] = new String("-"); |
389 |
} |
390 |
|
391 |
} |
392 |
|
393 |
/**
|
394 |
* A?ade bandas al contador de bandas del FilterRasterDialogPanel
|
395 |
* @param numBands N?mero de bandas a a?adir
|
396 |
*/
|
397 |
public void addNumBands(int numBands){ |
398 |
nbands += numBands; |
399 |
RasterTransparencyPanel tpan = (RasterTransparencyPanel)super.getPanelByClassName("RasterTransparencyPanel"); |
400 |
if(tpan != null && tpan.getPTranspByPixel().isControlEnabled()) |
401 |
tpan.setActiveTransparencyControl(true);
|
402 |
} |
403 |
|
404 |
/**
|
405 |
* Inicializa el jDialog
|
406 |
*/
|
407 |
public void init() { |
408 |
|
409 |
//this.setLayout(new FlowLayout());
|
410 |
|
411 |
setName("filterRaster");
|
412 |
ArrayList attr = ((FLyrRaster)fLayer).getSource().getAttributes();
|
413 |
for (int i=0; i<attr.size(); i++) { |
414 |
Object[] a = (Object []) attr.get(i); |
415 |
if(a[0].toString().equals("Filename")) |
416 |
filename = a[1].toString();
|
417 |
if(a[0].toString().equals("Filesize")) |
418 |
filesize = ((Long)a[1]).intValue(); |
419 |
if(a[0].toString().equals("Width")) |
420 |
width = ((Integer)a[1]).intValue(); |
421 |
if(a[0].toString().equals("Height")) |
422 |
height = ((Integer)a[1]).intValue(); |
423 |
} |
424 |
|
425 |
this.loadInfoData();
|
426 |
super.init(props);
|
427 |
|
428 |
InfoPanel info = (InfoPanel)super.getPanelByClassName("InfoPanel"); |
429 |
info.columnNames[0] = PluginServices.getText(this,"propiedad"); |
430 |
info.columnNames[1] = PluginServices.getText(this,"Valor"); |
431 |
info.resetTable(); |
432 |
info.initialize(); |
433 |
|
434 |
//this.add(getContentPane());
|
435 |
|
436 |
this.setSize(this.sizeX, this.sizeY); |
437 |
|
438 |
//contentPane.getAcceptButton().setEnabled(false);
|
439 |
this.getAcceptButton().addActionListener(new java.awt.event.ActionListener() { |
440 |
public void actionPerformed(java.awt.event.ActionEvent evt) { |
441 |
acceptButtonActionPerformed(evt); |
442 |
//Solo cuando le damos a aceptar guardamos la situaci?n actual de los
|
443 |
//ficheros cargados en el StatusLayerRaster
|
444 |
if(rasterStatus!=null){ |
445 |
ArrayList rs = new ArrayList(); |
446 |
for(int i=0;i<fLayer.getSource().getFiles().length;i++) |
447 |
rs.add(fLayer.getSource().getFiles()[i].getName()); |
448 |
rasterStatus.files = rs; |
449 |
} |
450 |
closeJDialog(); |
451 |
} |
452 |
}); |
453 |
this.getCancelButton().addActionListener(new java.awt.event.ActionListener() { |
454 |
public void actionPerformed(java.awt.event.ActionEvent evt) { |
455 |
cancelButtonActionPerformed(evt); |
456 |
closeJDialog(); |
457 |
} |
458 |
}); |
459 |
this.getApplyButton().addActionListener(new java.awt.event.ActionListener() { |
460 |
public void actionPerformed(java.awt.event.ActionEvent evt) { |
461 |
acceptButtonActionPerformed(evt); |
462 |
} |
463 |
}); |
464 |
BandSetupPanel bandSetup = (BandSetupPanel)super.getPanelByClassName("BandSetupPanel"); |
465 |
bandSetup.getFileList().getJButtonAdd().addActionListener(new java.awt.event.ActionListener() {
|
466 |
public void actionPerformed(java.awt.event.ActionEvent evt){ |
467 |
addFileBand(evt); |
468 |
|
469 |
} |
470 |
}); |
471 |
bandSetup.getFileList().getJButtonRemove().addActionListener(new java.awt.event.ActionListener() {
|
472 |
public void actionPerformed(java.awt.event.ActionEvent evt){ |
473 |
delFileBand(evt); |
474 |
} |
475 |
}); |
476 |
|
477 |
|
478 |
} |
479 |
|
480 |
/**
|
481 |
* Salva el estado inicial por si se cancela
|
482 |
*/
|
483 |
public void readStat(){ |
484 |
RasterTransparencyPanel tpan = (RasterTransparencyPanel)super.getPanelByClassName("RasterTransparencyPanel"); |
485 |
status = new Status(tpan.getOpacityText().getText(),
|
486 |
getAssignedBand(GeoRasterFile.RED_BAND), |
487 |
getAssignedBand(GeoRasterFile.GREEN_BAND), |
488 |
getAssignedBand(GeoRasterFile.BLUE_BAND)); |
489 |
} |
490 |
|
491 |
/**
|
492 |
* This method initializes jContentPane
|
493 |
*/
|
494 |
public Container getContentPane() { |
495 |
return this; |
496 |
} |
497 |
|
498 |
/**
|
499 |
* Asigna una proyecci?n
|
500 |
* @param prj
|
501 |
*/
|
502 |
public void setProjection(IProjection prj) { |
503 |
this.currentProjection = prj;
|
504 |
} |
505 |
|
506 |
public void closeJDialog() { |
507 |
try{
|
508 |
PluginServices.getMDIManager().closeView(PropertiesRasterDialog.this); |
509 |
}catch(ArrayIndexOutOfBoundsException e){ |
510 |
//Si la ventana no se puede eliminar no hacemos nada
|
511 |
} |
512 |
} |
513 |
|
514 |
/**
|
515 |
* Asigna el RasterFilterStackManager
|
516 |
* @param stackManager
|
517 |
*/
|
518 |
public void setRasterFilterStackManager(RasterFilterStackManager stackManager){ |
519 |
this.stackManager = stackManager;
|
520 |
stackManager.resetTempFilters(); |
521 |
} |
522 |
|
523 |
/**
|
524 |
*
|
525 |
* @param flag
|
526 |
* @return
|
527 |
*/
|
528 |
public int getAssignedBand(int flag) { |
529 |
BandSetupPanel bandSetup = (BandSetupPanel)super.getPanelByClassName("BandSetupPanel"); |
530 |
return bandSetup.getAssignedBand(flag);
|
531 |
} |
532 |
|
533 |
/**
|
534 |
* Obtiene las bandas que el usuario ha seleccionado que son visibles.
|
535 |
* Devuelve una cadena: RGB, R, G, B, RG, RB, GB
|
536 |
* @return Bandas visibles
|
537 |
*/
|
538 |
public String getVisibleBands(){ |
539 |
BandSetupPanel bandSetup = (BandSetupPanel)super.getPanelByClassName("BandSetupPanel"); |
540 |
return bandSetup.getFileList().getJComboBox().getSelectedItem().toString();
|
541 |
} |
542 |
|
543 |
/**
|
544 |
* Pulsar aceptar con el panel de bandas seleccionado hace que se procesen los valores
|
545 |
* introducidos en este.
|
546 |
* @return true si estaba seleccionado el panel de bandas y se ha procesado la
|
547 |
* acci?n y false si no lo estaba.
|
548 |
*/
|
549 |
public void processBandPanel(){ |
550 |
//if(this.getTab().getSelectedComponent() == this.getBandSetup()){
|
551 |
fLayer.getSource().setBand(GeoRasterFile.RED_BAND, |
552 |
getAssignedBand(GeoRasterFile.RED_BAND)); |
553 |
fLayer.getSource().setBand(GeoRasterFile.GREEN_BAND, |
554 |
getAssignedBand(GeoRasterFile.GREEN_BAND)); |
555 |
fLayer.getSource().setBand(GeoRasterFile.BLUE_BAND, |
556 |
getAssignedBand(GeoRasterFile.BLUE_BAND)); |
557 |
rasterStatus.bandR = getAssignedBand(GeoRasterFile.RED_BAND); |
558 |
rasterStatus.bandG = getAssignedBand(GeoRasterFile.GREEN_BAND); |
559 |
rasterStatus.bandB = getAssignedBand(GeoRasterFile.BLUE_BAND); |
560 |
|
561 |
//Comprobamos si hay alguna banda que no est? asignada y aplicamos el filtro
|
562 |
StringBuffer sb = new StringBuffer(); |
563 |
if(getAssignedBand(GeoRasterFile.RED_BAND) == -1) |
564 |
sb.append("R");
|
565 |
if(getAssignedBand(GeoRasterFile.GREEN_BAND) == -1) |
566 |
sb.append("G");
|
567 |
if(getAssignedBand(GeoRasterFile.BLUE_BAND) == -1) |
568 |
sb.append("B");
|
569 |
|
570 |
if(!sb.toString().equals("")) |
571 |
stackManager.addRemoveBands(sb.toString()); |
572 |
else
|
573 |
stackManager.removeFilter(stackManager.getTypeFilter("removebands"));
|
574 |
|
575 |
//Al reasignar las bandas tenemos que tenerlo en cuenta en el sharpening
|
576 |
RasterFilter sharp = stackManager.getFilter("sharpening");
|
577 |
if(sharp != null){ |
578 |
int[] order = {getAssignedBand(GeoRasterFile.RED_BAND),getAssignedBand(GeoRasterFile.GREEN_BAND),getAssignedBand(GeoRasterFile.BLUE_BAND)}; |
579 |
sharp.removeParam("order");
|
580 |
sharp.addParam("order", order);
|
581 |
} |
582 |
fLayer.getFMap().invalidate(); |
583 |
} |
584 |
|
585 |
/**
|
586 |
* Pulsar aceptar con el panel de transparecias seleccionado hace que se procesen los valores
|
587 |
* introducidos en este.
|
588 |
* @return true si estaba seleccionado el panel de transparencias y se ha procesado la
|
589 |
* acci?n y false si no lo estaba.
|
590 |
*/
|
591 |
public void processTransparencyPanel(){ |
592 |
//OPACIDAD
|
593 |
RasterTransparencyPanel tpan = (RasterTransparencyPanel)super.getPanelByClassName("RasterTransparencyPanel"); |
594 |
String sOpac = tpan.getOpacityText().getText();
|
595 |
if(!sOpac.equals("") && tpan.getOpacityCheck().isSelected()){ |
596 |
int opac = Integer.parseInt(sOpac); |
597 |
opac = (int)((opac*255)/100); |
598 |
fLayer.getSource().setTransparency(true);
|
599 |
fLayer.setTransparency(255-opac);
|
600 |
rasterStatus.transparency = 255-opac;
|
601 |
}else{
|
602 |
fLayer.getSource().setTransparency(false);
|
603 |
fLayer.setTransparency(0);
|
604 |
rasterStatus.transparency = 0;
|
605 |
} |
606 |
|
607 |
//TRANSPARENCIA
|
608 |
if( tpan.getTransparencyCheck().isSelected()){
|
609 |
stackManager.addTransparencyFilter( tpan.getPTranspByPixel().getEntries(), |
610 |
0x10, //Transparencia |
611 |
0xff, //Color Transparencia R |
612 |
0xff, //Color Transparencia G |
613 |
0xff); //Color Transparencia B |
614 |
}else{
|
615 |
fLayer.getSource().getFilterStack().removeFilter(stackManager.getTypeFilter("transparency"));
|
616 |
} |
617 |
|
618 |
} |
619 |
|
620 |
private void processBrightnessContrastPanel(){ |
621 |
EnhancedBrightnessContrastPanel ebcPanel = (EnhancedBrightnessContrastPanel)super.getPanelByClassName("EnhancedBrightnessContrastPanel"); |
622 |
// Si est? activo el panel de brillo y contraste tomamos los valores y cargamos un filtro de
|
623 |
// brillo y contraste
|
624 |
|
625 |
BrightnessContrastStackManager bcStackManager = (BrightnessContrastStackManager)stackManager.getManagerByClass(BrightnessContrastStackManager.class); |
626 |
if(ebcPanel.getCBrightC().isSelected()){
|
627 |
int incrBrillo = (int)Math.round(Double.valueOf(ebcPanel.lstBrightness.getTextValue()).doubleValue()); |
628 |
int incrContraste = (int)Math.round(Double.valueOf(ebcPanel.lstContrast.getTextValue()).doubleValue()); |
629 |
bcStackManager.addBrightnessFilter(incrBrillo); |
630 |
bcStackManager.addContrastFilter(incrContraste); |
631 |
|
632 |
if(incrBrillo == 0) stackManager.removeFilter(bcStackManager.brightness); |
633 |
if(incrContraste == 0) stackManager.removeFilter(bcStackManager.contrast); |
634 |
|
635 |
}else{
|
636 |
stackManager.removeFilter(bcStackManager.brightness); |
637 |
stackManager.removeFilter(bcStackManager.contrast); |
638 |
} |
639 |
fLayer.getFMap().invalidate(); |
640 |
} |
641 |
|
642 |
/**
|
643 |
* Pulsar aceptar con el panel de realce seleccionado hace que se procesen los valores
|
644 |
* introducidos en este.
|
645 |
* @return true si estaba seleccionado el panel de realce y se ha procesado la
|
646 |
* acci?n y false si no lo estaba.
|
647 |
*/
|
648 |
public void processEnhancedPanel(){ |
649 |
EnhancedBrightnessContrastPanel ebcPanel = (EnhancedBrightnessContrastPanel)super.getPanelByClassName("EnhancedBrightnessContrastPanel"); |
650 |
|
651 |
//Filtro de realce lineal seleccionado
|
652 |
if(ebcPanel.getCEnhanced().isSelected()){
|
653 |
if((ebcPanel.getJCheckBox().isSelected()) && (!ebcPanel.getCheckSliderText().getJCheckBox().isSelected()))
|
654 |
stackManager.addEnhancedFilter(true, fLayer.getSource().getFiles()[0].getName()); |
655 |
else
|
656 |
stackManager.addEnhancedFilter(false, fLayer.getSource().getFiles()[0].getName()); |
657 |
|
658 |
//Recorte de colas seleccionado
|
659 |
if(ebcPanel.getCheckSliderText().getJCheckBox().isSelected()){
|
660 |
stackManager.removeFilter(stackManager.getTypeFilter("computeminmax"));
|
661 |
double recorte = Double.parseDouble(ebcPanel.getCheckSliderText().getTextValue())/100; |
662 |
if(ebcPanel.getJCheckBox().isSelected())
|
663 |
stackManager.addTailFilter(recorte, 0D, true); |
664 |
else
|
665 |
stackManager.addTailFilter(recorte, 0D, false); |
666 |
}else{
|
667 |
stackManager.removeFilter(stackManager.getTypeFilter("tail"));
|
668 |
stackManager.addComputeMinMaxFilter(); |
669 |
} |
670 |
|
671 |
} |
672 |
// Sin filtro lineal seleccionado
|
673 |
if(!ebcPanel.getCEnhanced().isSelected()){
|
674 |
stackManager.removeFilter(stackManager.getTypeFilter("computeminmax"));
|
675 |
stackManager.removeFilter(stackManager.getTypeFilter("tail"));
|
676 |
stackManager.removeFilter(stackManager.getTypeFilter("enhanced"));
|
677 |
} |
678 |
fLayer.getFMap().invalidate(); |
679 |
} |
680 |
|
681 |
/**
|
682 |
* Gestiona la acci?n cuando se pulsa aplicar/aceptar o aplicar en el control
|
683 |
* de propiedades de raster
|
684 |
* @param e
|
685 |
*/
|
686 |
public void acceptButtonActionPerformed(ActionEvent e) { |
687 |
this.processBandPanel();
|
688 |
this.processTransparencyPanel();
|
689 |
this.processBrightnessContrastPanel();
|
690 |
this.processEnhancedPanel();
|
691 |
|
692 |
//Pasamos por todos los tabs registrados ejecutando su actionPerformed
|
693 |
for(int i=0;i<super.getTab().getTabCount() ;i++){ |
694 |
JPanel p = (JPanel)super.getTab().getComponentAt(i); |
695 |
if(p instanceof IRasterPropertiesRegistrable) |
696 |
((IRasterPropertiesRegistrable)p).actionPerformed(stackManager, this, fLayer);
|
697 |
} |
698 |
} |
699 |
|
700 |
/**
|
701 |
* A?ade una banda al raster
|
702 |
* @param e
|
703 |
*/
|
704 |
private void addFileBand(ActionEvent e){ |
705 |
String[] driverNames = null; |
706 |
|
707 |
//Creaci?n del dialogo para selecci?n de ficheros
|
708 |
|
709 |
fileChooser = new JFileChooser(lastPath); |
710 |
fileChooser.setMultiSelectionEnabled(true);
|
711 |
fileChooser.setAcceptAllFileFilterUsed(false);
|
712 |
try {
|
713 |
driverNames = LayerFactory.getDM().getDriverNames(); |
714 |
FileFilter auxF;
|
715 |
for (int i = 0; i < driverNames.length; i++) { |
716 |
|
717 |
if (driverNames[i].endsWith("gvSIG Image Driver")){ |
718 |
auxF = new DriverFileFilter(driverNames[i]);
|
719 |
fileChooser.addChoosableFileFilter(auxF); |
720 |
} |
721 |
} |
722 |
} catch (DriverLoadException e1) {
|
723 |
NotificationManager.addError("No se pudo acceder a los drivers", e1);
|
724 |
} |
725 |
int result = fileChooser.showOpenDialog(PropertiesRasterDialog.this);
|
726 |
|
727 |
if(result == JFileChooser.APPROVE_OPTION){ |
728 |
File[] files = fileChooser.getSelectedFiles(); |
729 |
|
730 |
BandSetupPanel bandSetup = (BandSetupPanel)super.getPanelByClassName("BandSetupPanel"); |
731 |
lastPath = files[0].getPath();
|
732 |
|
733 |
//Lo a?adimos a la capa si no esta
|
734 |
|
735 |
Vector v = new Vector(); |
736 |
for(int i=0;i<files.length;i++){ |
737 |
|
738 |
//Comprobamos que el fichero no est?
|
739 |
boolean exist = false; |
740 |
for(int j=0;j<fLayer.getSource().getFiles().length;j++){ |
741 |
if(fLayer.getSource().getFiles()[j].getName().endsWith(files[i].getName()))
|
742 |
exist = true;
|
743 |
} |
744 |
if(!exist){
|
745 |
try{
|
746 |
Rectangle2D extentOrigin = fLayer.getFullExtent();
|
747 |
|
748 |
GeoRasterFile geoRasterFile = GeoRasterFile.openFile(fLayer.getProjection(), files[i].getAbsolutePath()); |
749 |
Extent extentNewFile = geoRasterFile.getExtent(); |
750 |
nbands += geoRasterFile.getBandCount(); |
751 |
|
752 |
//Comprobamos que el extent y tama?o del fichero a?adido sea igual al
|
753 |
//fichero original. Si no es as? no abrimos la capa y mostramos un aviso
|
754 |
|
755 |
double widthNewFile = (extentNewFile.getMax().getX()-extentNewFile.getMin().getX());
|
756 |
double heightNewFile = (extentNewFile.getMax().getY()-extentNewFile.getMin().getY());
|
757 |
|
758 |
if( (widthNewFile-extentOrigin.getWidth()) > 1.0 || |
759 |
(widthNewFile-extentOrigin.getWidth()) < -1.0 ||
|
760 |
(heightNewFile-extentOrigin.getHeight()) > 1.0 ||
|
761 |
(heightNewFile-extentOrigin.getHeight()) < -1.0){
|
762 |
JOptionPane.showMessageDialog( null, |
763 |
PluginServices.getText(this, "extents_no_coincidentes"), |
764 |
"",
|
765 |
JOptionPane.ERROR_MESSAGE);
|
766 |
return;
|
767 |
} |
768 |
|
769 |
if( (extentNewFile.getMax().getX()-extentNewFile.getMin().getX())!=extentOrigin.getWidth() ||
|
770 |
(extentNewFile.getMax().getY()-extentNewFile.getMin().getY())!=extentOrigin.getHeight() ){ |
771 |
JOptionPane.showMessageDialog(null, |
772 |
PluginServices.getText(this, "extents_no_coincidentes"), "", JOptionPane.ERROR_MESSAGE); |
773 |
return;
|
774 |
} |
775 |
|
776 |
}catch(Exception exc){ |
777 |
exc.printStackTrace(); |
778 |
} |
779 |
|
780 |
//Lo a?adimos a la capa
|
781 |
fLayer.addFiles(files[i].getAbsolutePath()); |
782 |
//Mantiene la lista de ficheros a?adidos por si se cancela
|
783 |
status.addFile(files[i].getAbsolutePath()); |
784 |
|
785 |
|
786 |
}else{
|
787 |
JOptionPane.showMessageDialog(null, |
788 |
PluginServices.getText(this, "fichero_existe")+" "+files[i].getAbsolutePath(), "", JOptionPane.ERROR_MESSAGE); |
789 |
} |
790 |
} |
791 |
|
792 |
//A?adimos los georasterfile a la tabla del Panel
|
793 |
|
794 |
v = new Vector(); |
795 |
for(int i=0;i<fLayer.getSource().getFiles().length;i++){ |
796 |
boolean exist = false; |
797 |
for(int j=0;j<bandSetup.getNBands();j++){ |
798 |
if(fLayer.getSource().getFiles()[i].getName().endsWith(bandSetup.getBandName(j)))
|
799 |
exist = true;
|
800 |
} |
801 |
if(!exist)
|
802 |
v.add(fLayer.getSource().getFiles()[i]); |
803 |
} |
804 |
|
805 |
grf = new GeoRasterFile[v.size()];
|
806 |
for(int i=0;i<grf.length;i++){ |
807 |
grf[i] = (GeoRasterFile)v.get(i); |
808 |
} |
809 |
this.addFiles(grf);
|
810 |
} |
811 |
} |
812 |
|
813 |
/**
|
814 |
* Asigna la lista de GeoRasterFile
|
815 |
* @return
|
816 |
*/
|
817 |
public void setGeoRasterFile(GeoRasterFile[] grf){ |
818 |
this.grf = grf;
|
819 |
} |
820 |
|
821 |
/**
|
822 |
* Elimina una banda del raster. Si queda solo un fichero o no se ha
|
823 |
* seleccionado ninguna banda no hace nada.
|
824 |
* @param e
|
825 |
*/
|
826 |
private void delFileBand(ActionEvent e){ |
827 |
BandSetupPanel bandSetup = (BandSetupPanel)super.getPanelByClassName("BandSetupPanel"); |
828 |
|
829 |
if( bandSetup.getFileList().getJList().getSelectedValue()!=null && |
830 |
bandSetup.getFileList().getNFiles() > 1){
|
831 |
String pathName = bandSetup.getFileList().getJList().getSelectedValue().toString();
|
832 |
GeoRasterFile geoRasterFile = GeoRasterFile.openFile(fLayer.getProjection(), pathName); |
833 |
nbands -= geoRasterFile.getBandCount(); |
834 |
fLayer.delFile(pathName); |
835 |
String file = pathName.substring(pathName.lastIndexOf("/")+1); |
836 |
file = file.substring(file.lastIndexOf("\\")+1); |
837 |
this.removeFile(file);
|
838 |
|
839 |
//Mantiene la lista de ficheros eliminados por si se cancela
|
840 |
status.removeFile(pathName); |
841 |
} |
842 |
} |
843 |
|
844 |
/**
|
845 |
* El bot?n de cancelar recupera el estado anterior a la apertura de
|
846 |
* este dialogo.
|
847 |
* @param e Evento
|
848 |
*/
|
849 |
private void cancelButtonActionPerformed(ActionEvent e) { |
850 |
this.status.restoreStatus(this); |
851 |
fLayer.getFMap().invalidate(); |
852 |
} |
853 |
|
854 |
/**
|
855 |
* @see com.iver.mdiApp.ui.MDIManager.View#getViewInfo()
|
856 |
*/
|
857 |
public ViewInfo getViewInfo() {
|
858 |
ViewInfo m_viewinfo=new ViewInfo(ViewInfo.MODALDIALOG);
|
859 |
m_viewinfo.setTitle(PluginServices.getText(this, "propiedades_raster")); |
860 |
return m_viewinfo;
|
861 |
} |
862 |
|
863 |
/**
|
864 |
* Devuelve el stackManager que se esta utilizando actualmente.
|
865 |
* @return stackManager.
|
866 |
*/
|
867 |
public RasterFilterStackManager getStackManager(){
|
868 |
return this.stackManager; |
869 |
} |
870 |
|
871 |
/**
|
872 |
* Devuelve el layer que se est? utilizando actualmente
|
873 |
* @return FLyrRaster actual.
|
874 |
*/
|
875 |
public FLyrRaster getFLyrRaster(){
|
876 |
return this.fLayer; |
877 |
} |
878 |
|
879 |
//********************************************************************
|
880 |
//***********************EVENTOS DE RAT?N*****************************
|
881 |
|
882 |
public void mouseClicked(MouseEvent e) { |
883 |
// TODO Auto-generated method stub
|
884 |
|
885 |
} |
886 |
|
887 |
public void mouseEntered(MouseEvent e) { |
888 |
// TODO Auto-generated method stub
|
889 |
|
890 |
} |
891 |
|
892 |
public void mouseExited(MouseEvent e) { |
893 |
// TODO Auto-generated method stub
|
894 |
|
895 |
} |
896 |
|
897 |
public void mousePressed(MouseEvent e) { |
898 |
// TODO Auto-generated method stub
|
899 |
|
900 |
} |
901 |
|
902 |
public void mouseReleased(MouseEvent e) { |
903 |
EnhancedBrightnessContrastPanel ebcPanel = (EnhancedBrightnessContrastPanel)super.getPanelByClassName("EnhancedBrightnessContrastPanel"); |
904 |
if (((e.getSource() == ebcPanel.lstBrightness.getJSlider()) || (e.getSource() == ebcPanel.lstContrast.getJSlider())) &&
|
905 |
(ebcPanel.getJCheckBox1().isSelected() == true))
|
906 |
processBrightnessContrastPanel(); |
907 |
} |
908 |
|
909 |
/*public void keyPressed(KeyEvent e) {
|
910 |
EnhancedBrightnessContrastPanel ebcPanel = (EnhancedBrightnessContrastPanel)super.getPanelByClassName("EnhancedBrightnessContrastPanel");
|
911 |
if(e.getSource() == ebcPanel.getCheckSliderText().getJTextField()){
|
912 |
ebcPanel.getCheckSliderText().getJSlider().setValue((int) Math.round(Double.valueOf(ebcPanel.getCheckSliderText().getTextValue()).doubleValue()));
|
913 |
}
|
914 |
|
915 |
}
|
916 |
|
917 |
public void keyReleased(KeyEvent e) {
|
918 |
// TODO Auto-generated method stub
|
919 |
|
920 |
}
|
921 |
|
922 |
public void keyTyped(KeyEvent e) {
|
923 |
// TODO Auto-generated method stub
|
924 |
|
925 |
}*/
|
926 |
|
927 |
public void brightnessContrastPreview(Event e){ |
928 |
|
929 |
} |
930 |
|
931 |
public void actionPerformed(ActionEvent e){ |
932 |
EnhancedBrightnessContrastPanel ebcPanel = (EnhancedBrightnessContrastPanel)super.getPanelByClassName("EnhancedBrightnessContrastPanel"); |
933 |
|
934 |
ebcPanel.getLabelSliderText().actionPerformed(e); |
935 |
ebcPanel.getLabelSliderText1().actionPerformed(e); |
936 |
|
937 |
if((e.getSource() == ebcPanel.getLabelSliderText().getJTextField()))
|
938 |
if(ebcPanel.getJCheckBox1().isSelected()){
|
939 |
int valor = Math.round(Float.parseFloat(ebcPanel.getLabelSliderText().getJTextField().getText())); |
940 |
if((valor > ebcPanel.getLabelSliderText().getJSlider().getMaximum()))
|
941 |
ebcPanel.getLabelSliderText().getJTextField().setText(String.valueOf(ebcPanel.getLabelSliderText().getJSlider().getMaximum()));
|
942 |
if((valor < ebcPanel.getLabelSliderText().getJSlider().getMinimum()))
|
943 |
ebcPanel.getLabelSliderText().getJTextField().setText(String.valueOf(ebcPanel.getLabelSliderText().getJSlider().getMinimum()));
|
944 |
processBrightnessContrastPanel(); |
945 |
} |
946 |
|
947 |
if((e.getSource() == ebcPanel.getLabelSliderText1().getJTextField()))
|
948 |
if(ebcPanel.getJCheckBox1().isSelected()){
|
949 |
int valor1 = Math.round(Float.parseFloat(ebcPanel.getLabelSliderText1().getJTextField().getText())); |
950 |
if((valor1 > ebcPanel.getLabelSliderText1().getJSlider().getMaximum()))
|
951 |
ebcPanel.getLabelSliderText1().getJTextField().setText(String.valueOf(ebcPanel.getLabelSliderText().getJSlider().getMaximum()));
|
952 |
if((valor1 < ebcPanel.getLabelSliderText1().getJSlider().getMinimum()))
|
953 |
ebcPanel.getLabelSliderText1().getJTextField().setText(String.valueOf(ebcPanel.getLabelSliderText().getJSlider().getMinimum()));
|
954 |
processBrightnessContrastPanel(); |
955 |
} |
956 |
} |
957 |
|
958 |
public void focusLost(FocusEvent e) { |
959 |
EnhancedBrightnessContrastPanel ebcPanel = (EnhancedBrightnessContrastPanel)super.getPanelByClassName("EnhancedBrightnessContrastPanel"); |
960 |
|
961 |
if((e.getSource() == ebcPanel.getLabelSliderText().getJTextField()))
|
962 |
if(ebcPanel.getJCheckBox1().isSelected()){
|
963 |
int valor = Math.round(Float.parseFloat(ebcPanel.getLabelSliderText().getJTextField().getText())); |
964 |
if((valor > ebcPanel.getLabelSliderText().getJSlider().getMaximum()))
|
965 |
ebcPanel.getLabelSliderText().getJTextField().setText(String.valueOf(ebcPanel.getLabelSliderText().getJSlider().getMaximum()));
|
966 |
if((valor < ebcPanel.getLabelSliderText().getJSlider().getMinimum()))
|
967 |
ebcPanel.getLabelSliderText().getJTextField().setText(String.valueOf(ebcPanel.getLabelSliderText().getJSlider().getMinimum()));
|
968 |
processBrightnessContrastPanel(); |
969 |
} |
970 |
|
971 |
if((e.getSource() == ebcPanel.getLabelSliderText1().getJTextField()))
|
972 |
if(ebcPanel.getJCheckBox1().isSelected()){
|
973 |
int valor1 = Math.round(Float.parseFloat(ebcPanel.getLabelSliderText1().getJTextField().getText())); |
974 |
if((valor1 > ebcPanel.getLabelSliderText1().getJSlider().getMaximum()))
|
975 |
ebcPanel.getLabelSliderText1().getJTextField().setText(String.valueOf(ebcPanel.getLabelSliderText().getJSlider().getMaximum()));
|
976 |
if((valor1 < ebcPanel.getLabelSliderText1().getJSlider().getMinimum()))
|
977 |
ebcPanel.getLabelSliderText1().getJTextField().setText(String.valueOf(ebcPanel.getLabelSliderText().getJSlider().getMinimum()));
|
978 |
processBrightnessContrastPanel(); |
979 |
} |
980 |
super.focusLost(e);
|
981 |
} |
982 |
} |
983 |
|