root / tags / v1_0_2_Build_901 / extensions / extRasterTools / src / org / gvsig / rasterTools / brightnessContrast / ui / EnhancedBrightnessContrastPanel.java @ 10571
History | View | Annotate | Download (21.3 KB)
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
---|---|
2 |
*
|
3 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
4 |
*
|
5 |
* This program is free software; you can redistribute it and/or
|
6 |
* modify it under the terms of the GNU General Public License
|
7 |
* as published by the Free Software Foundation; either version 2
|
8 |
* of the License, or (at your option) any later version.
|
9 |
*
|
10 |
* This program is distributed in the hope that it will be useful,
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
* GNU General Public License for more details.
|
14 |
*
|
15 |
* You should have received a copy of the GNU General Public License
|
16 |
* along with this program; if not, write to the Free Software
|
17 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
18 |
*/
|
19 |
|
20 |
package org.gvsig.rasterTools.brightnessContrast.ui; |
21 |
|
22 |
import java.awt.GridBagConstraints; |
23 |
import java.awt.GridBagLayout; |
24 |
import java.awt.event.ActionEvent; |
25 |
import java.awt.event.ActionListener; |
26 |
import java.awt.event.KeyEvent; |
27 |
import java.awt.event.KeyListener; |
28 |
import java.awt.event.MouseEvent; |
29 |
import java.awt.event.MouseListener; |
30 |
|
31 |
import javax.swing.JCheckBox; |
32 |
import javax.swing.JLabel; |
33 |
import javax.swing.JPanel; |
34 |
|
35 |
import org.cresques.filter.IRasterOperationsRegistrablePanels; |
36 |
import org.cresques.filter.IStackManager; |
37 |
import org.cresques.filter.RasterFilterStackManager; |
38 |
import org.cresques.io.GeoRasterFile; |
39 |
import org.cresques.ui.filter.FilterRasterDialogPanel; |
40 |
import org.gvsig.rasterTools.brightnessContrast.filter.BrightnessContrastStackManager; |
41 |
|
42 |
import com.iver.andami.PluginServices; |
43 |
import com.iver.cit.gvsig.fmap.layers.FLyrRaster; |
44 |
import com.iver.cit.gvsig.gui.panels.IRasterPropertiesRegistrable; |
45 |
import com.iver.cit.gvsig.gui.panels.PropertiesRasterDialog; |
46 |
import com.iver.cit.gvsig.project.documents.view.toc.gui.FLyrRasterAdjustPropertiesTocMenuEntry; |
47 |
|
48 |
|
49 |
/**
|
50 |
* Panel para los controles de brillo, contrase y realce.
|
51 |
* @author Miguel Angel Querol Carratal? <querol_mig@gva.es>
|
52 |
*
|
53 |
*/
|
54 |
public class EnhancedBrightnessContrastPanel extends JPanel implements ActionListener, |
55 |
MouseListener,
|
56 |
KeyListener,
|
57 |
IRasterPropertiesRegistrable, |
58 |
IRasterOperationsRegistrablePanels{ |
59 |
|
60 |
private JPanel pBrightCont = null; |
61 |
private JPanel pEnhanced = null; |
62 |
private LabelSliderText lstBrightness = null; |
63 |
private LabelSliderText lstContrast = null; |
64 |
private JPanel pBCCheck = null; |
65 |
private JPanel pBCSlider = null; |
66 |
private JPanel jPanel1 = null; |
67 |
private JCheckBox cBrightC = null; |
68 |
private JLabel lBrightC = null; |
69 |
private JPanel pEnCheck = null; |
70 |
private JPanel pEnSlider = null; |
71 |
private JCheckBox cEnhanced = null; |
72 |
private JPanel pDelInt = null; |
73 |
private JCheckBox jCheckBox = null; |
74 |
|
75 |
private BrightnessContrastStackManager bcManager = null; |
76 |
private JCheckBox jCheckBox1 = null; |
77 |
private JLabel lpreview = null; |
78 |
public FLyrRaster layer = null; |
79 |
public PropertiesRasterDialog propertiesRasterDialog = null; |
80 |
public RasterFilterStackManager rasterStackManager = null; |
81 |
public JLabel lLineal = null; |
82 |
public JLabel lRemove = null; |
83 |
public CheckSliderText cstEnhanced = null; |
84 |
|
85 |
/**
|
86 |
* This is the default constructor
|
87 |
*/
|
88 |
public EnhancedBrightnessContrastPanel() {
|
89 |
super();
|
90 |
initialize(); |
91 |
} |
92 |
|
93 |
/**
|
94 |
* This method initializes this
|
95 |
*
|
96 |
* @return void
|
97 |
*/
|
98 |
private void initialize() { |
99 |
GridBagConstraints gridBagConstraints3 = new GridBagConstraints(); |
100 |
gridBagConstraints3.insets = new java.awt.Insets(0,4,0,4); |
101 |
gridBagConstraints3.gridy = 0;
|
102 |
gridBagConstraints3.gridx = 1;
|
103 |
GridBagConstraints gridBagConstraints2 = new GridBagConstraints(); |
104 |
gridBagConstraints2.insets = new java.awt.Insets(0,4,0,4); |
105 |
gridBagConstraints2.gridy = 0;
|
106 |
gridBagConstraints2.gridx = 0;
|
107 |
this.setLayout(new GridBagLayout()); |
108 |
this.setSize(445, 239); |
109 |
this.setPreferredSize(new java.awt.Dimension(445,239)); |
110 |
this.add(getPBrightCont(), gridBagConstraints2);
|
111 |
this.add(getPEnhanced(), gridBagConstraints3);
|
112 |
|
113 |
this.getCBrightC().addActionListener(this); |
114 |
this.getCEnhanced().addActionListener(this); |
115 |
this.getLabelSliderText().getJSlider().addMouseListener(this); |
116 |
this.getLabelSliderText1().getJSlider().addMouseListener(this); |
117 |
this.setTranslation();
|
118 |
this.getLabelSliderText().getJTextField().addActionListener(this); |
119 |
this.getLabelSliderText1().getJTextField().addActionListener(this); |
120 |
} |
121 |
|
122 |
public void setTranslation(){ |
123 |
this.lLineal.setText(PluginServices.getText(this, "lineal_directo")); |
124 |
this.lRemove.setText(PluginServices.getText(this, "eliminar_extremos")); |
125 |
this.cstEnhanced.setName(PluginServices.getText(this, "recorte_colas")+" ( % )"); |
126 |
this.lBrightC.setText(PluginServices.getText(this, "activar")); |
127 |
this.lstBrightness.setName(PluginServices.getText(this, "brillo")); |
128 |
this.lstContrast.setName(PluginServices.getText(this, "contraste")); |
129 |
this.lpreview.setText(PluginServices.getText(this, "previsualizacion")); |
130 |
} |
131 |
|
132 |
|
133 |
/**
|
134 |
* This method initializes jPanel
|
135 |
*
|
136 |
* @return javax.swing.JPanel
|
137 |
*/
|
138 |
private JPanel getPBrightCont() { |
139 |
if (pBrightCont == null) { |
140 |
GridBagConstraints gridBagConstraints4 = new GridBagConstraints(); |
141 |
gridBagConstraints4.gridx = 0;
|
142 |
gridBagConstraints4.insets = new java.awt.Insets(4,0,8,0); |
143 |
gridBagConstraints4.gridy = 1;
|
144 |
GridBagConstraints gridBagConstraints = new GridBagConstraints(); |
145 |
gridBagConstraints.gridx = 0;
|
146 |
gridBagConstraints.insets = new java.awt.Insets(0,8,4,8); |
147 |
gridBagConstraints.gridy = 0;
|
148 |
pBrightCont = new JPanel(); |
149 |
pBrightCont.setLayout(new GridBagLayout()); |
150 |
pBrightCont.setPreferredSize(new java.awt.Dimension(210,223)); |
151 |
pBrightCont.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)); |
152 |
pBrightCont.add(getPBCCheck(), gridBagConstraints); |
153 |
pBrightCont.add(getPBCSlider(), gridBagConstraints4); |
154 |
} |
155 |
return pBrightCont;
|
156 |
} |
157 |
|
158 |
/**
|
159 |
* This method initializes jPanel1
|
160 |
*
|
161 |
* @return javax.swing.JPanel
|
162 |
*/
|
163 |
private JPanel getPEnhanced() { |
164 |
if (pEnhanced == null) { |
165 |
GridBagConstraints gridBagConstraints12 = new GridBagConstraints(); |
166 |
gridBagConstraints12.gridx = 0;
|
167 |
gridBagConstraints12.insets = new java.awt.Insets(4,4,59,4); |
168 |
gridBagConstraints12.gridy = 1;
|
169 |
GridBagConstraints gridBagConstraints11 = new GridBagConstraints(); |
170 |
gridBagConstraints11.gridx = 0;
|
171 |
gridBagConstraints11.insets = new java.awt.Insets(0,8,4,8); |
172 |
gridBagConstraints11.gridy = 0;
|
173 |
GridBagConstraints gridBagConstraints1 = new GridBagConstraints(); |
174 |
gridBagConstraints1.gridx = 0;
|
175 |
gridBagConstraints1.gridy = 0;
|
176 |
pEnhanced = new JPanel(); |
177 |
pEnhanced.setLayout(new GridBagLayout()); |
178 |
pEnhanced.setPreferredSize(new java.awt.Dimension(210,223)); |
179 |
pEnhanced.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)); |
180 |
pEnhanced.add(getPEnCheck(), gridBagConstraints11); |
181 |
pEnhanced.add(getPEnSlider(), gridBagConstraints12); |
182 |
} |
183 |
return pEnhanced;
|
184 |
} |
185 |
|
186 |
/**
|
187 |
* inicializa el conponente LabelSliderText
|
188 |
*/
|
189 |
public LabelSliderText getLabelSliderText(){
|
190 |
if(lstBrightness == null){ |
191 |
lstBrightness = new LabelSliderText();
|
192 |
lstBrightness.setName("Brillo");
|
193 |
lstBrightness.setSliderRange(-255,255); |
194 |
lstBrightness.setSliderValue(0);
|
195 |
} |
196 |
return lstBrightness;
|
197 |
} |
198 |
|
199 |
/**
|
200 |
* inicializa el conponente LabelSliderText
|
201 |
*/
|
202 |
public LabelSliderText getLabelSliderText1(){
|
203 |
if (lstContrast == null){ |
204 |
lstContrast = new LabelSliderText();
|
205 |
lstContrast.setName("Contraste");
|
206 |
lstContrast.setPreferredSize(new java.awt.Dimension(180,45)); |
207 |
lstContrast.setSliderRange(-255,255); |
208 |
lstContrast.setSliderValue(0);
|
209 |
} |
210 |
return lstContrast;
|
211 |
} |
212 |
|
213 |
/**
|
214 |
* This method initializes jPanel1
|
215 |
*
|
216 |
* @return javax.swing.JPanel
|
217 |
*/
|
218 |
private JPanel getPBCCheck() { |
219 |
if (pBCCheck == null) { |
220 |
GridBagConstraints gridBagConstraints9 = new GridBagConstraints(); |
221 |
gridBagConstraints9.gridx = 1;
|
222 |
gridBagConstraints9.gridy = 0;
|
223 |
lBrightC = new JLabel(); |
224 |
lBrightC.setText("Activar");
|
225 |
lBrightC.setPreferredSize(new java.awt.Dimension(160,15)); |
226 |
GridBagConstraints gridBagConstraints8 = new GridBagConstraints(); |
227 |
gridBagConstraints8.gridx = 0;
|
228 |
gridBagConstraints8.gridy = 0;
|
229 |
pBCCheck = new JPanel(); |
230 |
pBCCheck.setLayout(new GridBagLayout()); |
231 |
pBCCheck.setPreferredSize(new java.awt.Dimension(182,25)); |
232 |
pBCCheck.add(getCBrightC(), gridBagConstraints8); |
233 |
pBCCheck.add(lBrightC, gridBagConstraints9); |
234 |
} |
235 |
return pBCCheck;
|
236 |
} |
237 |
|
238 |
/**
|
239 |
* This method initializes jPanel3
|
240 |
*
|
241 |
* @return javax.swing.JPanel
|
242 |
*/
|
243 |
private JPanel getPBCSlider() { |
244 |
if (pBCSlider == null) { |
245 |
GridBagConstraints gridBagConstraints7 = new GridBagConstraints(); |
246 |
gridBagConstraints7.gridx = 0;
|
247 |
gridBagConstraints7.insets = new java.awt.Insets(0,0,2,0); |
248 |
gridBagConstraints7.gridy = 0;
|
249 |
GridBagConstraints gridBagConstraints6 = new GridBagConstraints(); |
250 |
gridBagConstraints6.gridx = 0;
|
251 |
gridBagConstraints6.insets = new java.awt.Insets(10,0,8,0); |
252 |
gridBagConstraints6.gridy = 2;
|
253 |
GridBagConstraints gridBagConstraints5 = new GridBagConstraints(); |
254 |
gridBagConstraints5.gridx = 0;
|
255 |
gridBagConstraints5.insets = new java.awt.Insets(0,0,0,0); |
256 |
gridBagConstraints5.gridy = 1;
|
257 |
pBCSlider = new JPanel(); |
258 |
pBCSlider.setLayout(new GridBagLayout()); |
259 |
pBCSlider.setPreferredSize(new java.awt.Dimension(188,150)); |
260 |
pBCSlider.setBorder(javax.swing.BorderFactory.createLineBorder(java.awt.Color.gray,1));
|
261 |
pBCSlider.add(getLabelSliderText(), gridBagConstraints7); |
262 |
pBCSlider.add(getLabelSliderText1(), gridBagConstraints5); |
263 |
pBCSlider.add(getJPanel1(), gridBagConstraints6); |
264 |
this.setBCControlEnabled(false); |
265 |
} |
266 |
return pBCSlider;
|
267 |
} |
268 |
|
269 |
/**
|
270 |
* This method initializes jPanel1
|
271 |
*
|
272 |
* @return javax.swing.JPanel
|
273 |
*/
|
274 |
private JPanel getJPanel1() { |
275 |
if (jPanel1 == null) { |
276 |
GridBagConstraints gridBagConstraints19 = new GridBagConstraints(); |
277 |
gridBagConstraints19.gridx = 1;
|
278 |
gridBagConstraints19.gridy = 0;
|
279 |
lpreview = new JLabel(); |
280 |
lpreview.setText("Previsualizacion");
|
281 |
lpreview.setPreferredSize(new java.awt.Dimension(150,15)); |
282 |
lpreview.setSize(new java.awt.Dimension(160,15)); |
283 |
GridBagConstraints gridBagConstraints10 = new GridBagConstraints(); |
284 |
gridBagConstraints10.gridx = 0;
|
285 |
gridBagConstraints10.insets = new java.awt.Insets(0,0,0,0); |
286 |
gridBagConstraints10.gridy = 0;
|
287 |
jPanel1 = new JPanel(); |
288 |
jPanel1.setLayout(new GridBagLayout()); |
289 |
jPanel1.setPreferredSize(new java.awt.Dimension(180,25)); |
290 |
jPanel1.add(getJCheckBox1(), gridBagConstraints10); |
291 |
jPanel1.add(lpreview, gridBagConstraints19); |
292 |
} |
293 |
return jPanel1;
|
294 |
} |
295 |
|
296 |
/**
|
297 |
* This method initializes jCheckBox
|
298 |
*
|
299 |
* @return javax.swing.JCheckBox
|
300 |
*/
|
301 |
public JCheckBox getCBrightC() { |
302 |
if (cBrightC == null) { |
303 |
cBrightC = new JCheckBox(); |
304 |
} |
305 |
return cBrightC;
|
306 |
} |
307 |
|
308 |
/**
|
309 |
* This method initializes jPanel
|
310 |
*
|
311 |
* @return javax.swing.JPanel
|
312 |
*/
|
313 |
private JPanel getPEnCheck() { |
314 |
if (pEnCheck == null) { |
315 |
GridBagConstraints gridBagConstraints14 = new GridBagConstraints(); |
316 |
gridBagConstraints14.insets = new java.awt.Insets(0,0,0,0); |
317 |
gridBagConstraints14.gridy = 0;
|
318 |
gridBagConstraints14.gridx = 1;
|
319 |
GridBagConstraints gridBagConstraints13 = new GridBagConstraints(); |
320 |
gridBagConstraints13.insets = new java.awt.Insets(0,0,0,0); |
321 |
gridBagConstraints13.gridy = 0;
|
322 |
gridBagConstraints13.gridx = 0;
|
323 |
lLineal = new JLabel(); |
324 |
lLineal.setText("Lineal Directo");
|
325 |
lLineal.setPreferredSize(new java.awt.Dimension(160,15)); |
326 |
pEnCheck = new JPanel(); |
327 |
pEnCheck.setLayout(new GridBagLayout()); |
328 |
pEnCheck.setPreferredSize(new java.awt.Dimension(182,25)); |
329 |
pEnCheck.add(getCEnhanced(), gridBagConstraints13); |
330 |
pEnCheck.add(lLineal, gridBagConstraints14); |
331 |
} |
332 |
return pEnCheck;
|
333 |
} |
334 |
|
335 |
/**
|
336 |
* This method initializes jPanel2
|
337 |
*
|
338 |
* @return javax.swing.JPanel
|
339 |
*/
|
340 |
private JPanel getPEnSlider() { |
341 |
if (pEnSlider == null) { |
342 |
GridBagConstraints gridBagConstraints18 = new GridBagConstraints(); |
343 |
gridBagConstraints18.insets = new java.awt.Insets(2,0,0,0); |
344 |
gridBagConstraints18.gridy = 1;
|
345 |
gridBagConstraints18.gridx = 0;
|
346 |
GridBagConstraints gridBagConstraints15 = new GridBagConstraints(); |
347 |
gridBagConstraints15.insets = new java.awt.Insets(0,0,2,0); |
348 |
gridBagConstraints15.gridy = 0;
|
349 |
gridBagConstraints15.gridx = 0;
|
350 |
pEnSlider = new JPanel(); |
351 |
pEnSlider.setLayout(new GridBagLayout()); |
352 |
pEnSlider.setPreferredSize(new java.awt.Dimension(188,100)); |
353 |
pEnSlider.setBorder(javax.swing.BorderFactory.createLineBorder(java.awt.Color.gray,1));
|
354 |
pEnSlider.add(getPDelInt(), gridBagConstraints15); |
355 |
pEnSlider.add(getCheckSliderText(), gridBagConstraints18); |
356 |
this.setEControlEnabled(false); |
357 |
} |
358 |
return pEnSlider;
|
359 |
} |
360 |
|
361 |
/**
|
362 |
* This method initializes jCheckBox
|
363 |
*
|
364 |
* @return javax.swing.JCheckBox
|
365 |
*/
|
366 |
public JCheckBox getCEnhanced() { |
367 |
if (cEnhanced == null) { |
368 |
cEnhanced = new JCheckBox(); |
369 |
} |
370 |
return cEnhanced;
|
371 |
} |
372 |
|
373 |
/**
|
374 |
* This method initializes jPanel3
|
375 |
*
|
376 |
* @return javax.swing.JPanel
|
377 |
*/
|
378 |
private JPanel getPDelInt() { |
379 |
if (pDelInt == null) { |
380 |
GridBagConstraints gridBagConstraints17 = new GridBagConstraints(); |
381 |
gridBagConstraints17.gridx = 1;
|
382 |
gridBagConstraints17.gridy = 0;
|
383 |
lRemove = new JLabel(); |
384 |
lRemove.setText("Eliminar Extremos");
|
385 |
lRemove.setPreferredSize(new java.awt.Dimension(150,15)); |
386 |
GridBagConstraints gridBagConstraints16 = new GridBagConstraints(); |
387 |
gridBagConstraints16.insets = new java.awt.Insets(0,0,0,0); |
388 |
gridBagConstraints16.gridy = 0;
|
389 |
gridBagConstraints16.gridx = 0;
|
390 |
pDelInt = new JPanel(); |
391 |
pDelInt.setLayout(new GridBagLayout()); |
392 |
pDelInt.setPreferredSize(new java.awt.Dimension(180,25)); |
393 |
pDelInt.add(getJCheckBox(), gridBagConstraints16); |
394 |
pDelInt.add(lRemove, gridBagConstraints17); |
395 |
} |
396 |
return pDelInt;
|
397 |
} |
398 |
|
399 |
/**
|
400 |
* This method initializes jCheckBox
|
401 |
*
|
402 |
* @return javax.swing.JCheckBox
|
403 |
*/
|
404 |
public JCheckBox getJCheckBox() { |
405 |
if (jCheckBox == null) { |
406 |
jCheckBox = new JCheckBox(); |
407 |
} |
408 |
return jCheckBox;
|
409 |
} |
410 |
|
411 |
/**
|
412 |
* inicializa el conponente CheckSliderText
|
413 |
*/
|
414 |
public CheckSliderText getCheckSliderText(){
|
415 |
String rcName = "Recorte de colas"; |
416 |
if (cstEnhanced == null){ |
417 |
cstEnhanced = new CheckSliderText();
|
418 |
cstEnhanced.setName(rcName); |
419 |
cstEnhanced.setSliderValue(0);
|
420 |
cstEnhanced.setSliderRange(0,50); |
421 |
cstEnhanced.setDecimal(true);
|
422 |
cstEnhanced.setTextValue("0.0");
|
423 |
|
424 |
} |
425 |
return cstEnhanced;
|
426 |
} |
427 |
|
428 |
/**
|
429 |
* Habilita o dehabilita el panel de brillo y contraste
|
430 |
* @param active
|
431 |
*/
|
432 |
public void setBCControlEnabled(boolean active){ |
433 |
this.lstBrightness.setControlEnabled(active);
|
434 |
this.lstContrast.setControlEnabled(active);
|
435 |
this.getJCheckBox1().setEnabled(active);
|
436 |
this.lpreview.setEnabled(active);
|
437 |
} |
438 |
|
439 |
/**
|
440 |
* Habilita o dehabilita el panel de realce
|
441 |
* @param active
|
442 |
*/
|
443 |
public void setEControlEnabled(boolean active){ |
444 |
this.jCheckBox.setEnabled(active);
|
445 |
this.lRemove.setEnabled(active);
|
446 |
this.cstEnhanced.setControlEnabled(active);
|
447 |
} |
448 |
|
449 |
|
450 |
public void actionPerformed(ActionEvent e) { |
451 |
if(e.getSource() == this.getCBrightC()){ |
452 |
this.setBCControlEnabled(this.getCBrightC().isSelected()); |
453 |
} |
454 |
if(e.getSource() == cEnhanced){
|
455 |
this.setEControlEnabled(this.getCEnhanced().isSelected()); |
456 |
} |
457 |
if((e.getSource() == this.getLabelSliderText().getJTextField()) || |
458 |
(e.getSource() == this.getLabelSliderText1().getJTextField())){
|
459 |
|
460 |
if(this.getJCheckBox1().isSelected()){ |
461 |
this.layer = propertiesRasterDialog.getFLyrRaster();
|
462 |
this.rasterStackManager = propertiesRasterDialog.getStackManager();
|
463 |
processBrightnessContrastPanel(this.rasterStackManager, this.propertiesRasterDialog, this.layer); |
464 |
} |
465 |
|
466 |
} |
467 |
} |
468 |
|
469 |
/**
|
470 |
* Asigna a este panel un stack manager
|
471 |
* @param p
|
472 |
*/
|
473 |
public void setBrightnessContrastStackManager (BrightnessContrastStackManager p){ |
474 |
this.bcManager = p;
|
475 |
} |
476 |
|
477 |
/**
|
478 |
* A?ade los filtros de frillo y contraste a la pila de filtros con los valores
|
479 |
* introducidos en el panel.
|
480 |
* @param stackManager
|
481 |
* @param propsDialog
|
482 |
* @param layer
|
483 |
*/
|
484 |
private void processBrightnessContrastPanel(RasterFilterStackManager stackManager, PropertiesRasterDialog propsDialog, FLyrRaster layer){ |
485 |
EnhancedBrightnessContrastPanel ebcPanel = (EnhancedBrightnessContrastPanel)((FilterRasterDialogPanel)propsDialog.getContentPane()).getPanelByClassName("EnhancedBrightnessContrastPanel");
|
486 |
// Si est? activo el panel de brillo y contraste tomamos los valores y cargamos un filtro de
|
487 |
// brillo y contraste
|
488 |
|
489 |
if(ebcPanel.getCBrightC().isSelected()){
|
490 |
int incrBrillo = (int)Math.round(Double.valueOf(ebcPanel.lstBrightness.getTextValue()).doubleValue()); |
491 |
int incrContraste = (int)Math.round(Double.valueOf(ebcPanel.lstContrast.getTextValue()).doubleValue()); |
492 |
bcManager.addBrightnessFilter(incrBrillo); |
493 |
bcManager.addContrastFilter(incrContraste); |
494 |
}else{
|
495 |
stackManager.removeFilter(bcManager.brightness); |
496 |
stackManager.removeFilter(bcManager.contrast); |
497 |
} |
498 |
layer.getMapContext().invalidate(); |
499 |
} |
500 |
|
501 |
|
502 |
//-------------------------------------------------------------------------------
|
503 |
|
504 |
/**
|
505 |
* M?todo que se ejecuta desde el PropertiesRasterDialog para todos los paneles insertados
|
506 |
* cuando se pulsa el bot?n aceptar.
|
507 |
*/
|
508 |
public void actionPerformed(RasterFilterStackManager stackManager, PropertiesRasterDialog propsDialog, FLyrRaster fLayer) { |
509 |
|
510 |
processBrightnessContrastPanel(stackManager, propsDialog, fLayer); |
511 |
|
512 |
EnhancedBrightnessContrastPanel ebcPanel = (EnhancedBrightnessContrastPanel)((FilterRasterDialogPanel)propsDialog.getContentPane()).getPanelByClassName("EnhancedBrightnessContrastPanel");
|
513 |
|
514 |
//Filtro de realce lineal seleccionado
|
515 |
if(ebcPanel.getCEnhanced().isSelected()){
|
516 |
if((ebcPanel.getJCheckBox().isSelected()) && (!ebcPanel.getCheckSliderText().getJCheckBox().isSelected()))
|
517 |
stackManager.addEnhancedFilter(true, fLayer.getSource().getFiles()[0].getName()); |
518 |
else
|
519 |
stackManager.addEnhancedFilter(false, fLayer.getSource().getFiles()[0].getName()); |
520 |
|
521 |
//Recorte de colas seleccionado
|
522 |
if(ebcPanel.getCheckSliderText().getJCheckBox().isSelected()){
|
523 |
stackManager.removeFilter(stackManager.getTypeFilter("computeminmax"));
|
524 |
double recorte = Double.parseDouble(ebcPanel.getCheckSliderText().getTextValue())/100; |
525 |
if(ebcPanel.getJCheckBox().isSelected())
|
526 |
stackManager.addTailFilter(recorte, 0D, true); |
527 |
else
|
528 |
stackManager.addTailFilter(recorte, 0D, false); |
529 |
}else{
|
530 |
stackManager.removeFilter(stackManager.getTypeFilter("tail"));
|
531 |
stackManager.addComputeMinMaxFilter(); |
532 |
} |
533 |
|
534 |
} |
535 |
// Sin filtro lineal seleccionado
|
536 |
if(!ebcPanel.getCEnhanced().isSelected()){
|
537 |
stackManager.removeFilter(stackManager.getTypeFilter("computeminmax"));
|
538 |
stackManager.removeFilter(stackManager.getTypeFilter("tail"));
|
539 |
stackManager.removeFilter(stackManager.getTypeFilter("enhanced"));
|
540 |
} |
541 |
fLayer.getMapContext().invalidate(); |
542 |
|
543 |
} |
544 |
|
545 |
public void addTabPanel(FLyrRasterAdjustPropertiesTocMenuEntry menu) { |
546 |
// TODO Auto-generated method stub
|
547 |
|
548 |
} |
549 |
|
550 |
public void setStackManager(RasterFilterStackManager stackManager) { |
551 |
// TODO Auto-generated method stub
|
552 |
|
553 |
} |
554 |
|
555 |
public IStackManager getStackManager() {
|
556 |
// TODO Auto-generated method stub
|
557 |
return bcManager;
|
558 |
} |
559 |
|
560 |
|
561 |
//----------------------------------------------------------------------------------
|
562 |
|
563 |
|
564 |
public void removeFile(String file) { |
565 |
// TODO Auto-generated method stub
|
566 |
|
567 |
} |
568 |
|
569 |
public void addFiles(GeoRasterFile[] files) { |
570 |
// TODO Auto-generated method stub
|
571 |
|
572 |
} |
573 |
|
574 |
/**
|
575 |
* This method initializes jCheckBox1
|
576 |
*
|
577 |
* @return javax.swing.JCheckBox
|
578 |
*/
|
579 |
private JCheckBox getJCheckBox1() { |
580 |
if (jCheckBox1 == null) { |
581 |
jCheckBox1 = new JCheckBox(); |
582 |
} |
583 |
return jCheckBox1;
|
584 |
} |
585 |
|
586 |
public void setPropertiesDialog(PropertiesRasterDialog prop){ |
587 |
this.propertiesRasterDialog = prop;
|
588 |
} |
589 |
|
590 |
|
591 |
//********************************************************************
|
592 |
//***********************EVENTOS DE RAT?N*****************************
|
593 |
|
594 |
public void mouseClicked(MouseEvent e) { |
595 |
// TODO Auto-generated method stub
|
596 |
|
597 |
} |
598 |
|
599 |
public void mouseEntered(MouseEvent e) { |
600 |
// TODO Auto-generated method stub
|
601 |
|
602 |
} |
603 |
|
604 |
public void mouseExited(MouseEvent e) { |
605 |
// TODO Auto-generated method stub
|
606 |
|
607 |
} |
608 |
|
609 |
public void mousePressed(MouseEvent e) { |
610 |
// TODO Auto-generated method stub
|
611 |
|
612 |
} |
613 |
|
614 |
/**
|
615 |
* Listener que actua cuando el check "previsualizar" est? activado
|
616 |
* y aplica los filtros con los valores seleccionados cuando soltamos
|
617 |
* el bot?n del rat?n al seleccionar valor en el slider.
|
618 |
*/
|
619 |
public void mouseReleased(MouseEvent e) { |
620 |
if (((e.getSource() == this.lstBrightness.getJSlider()) || |
621 |
(e.getSource() == this.lstContrast.getJSlider())) &&
|
622 |
(this.getJCheckBox1().isSelected() == true)){ |
623 |
this.layer = propertiesRasterDialog.getFLyrRaster();
|
624 |
this.rasterStackManager = propertiesRasterDialog.getStackManager();
|
625 |
processBrightnessContrastPanel(this.rasterStackManager, this.propertiesRasterDialog, this.layer); |
626 |
} |
627 |
|
628 |
} |
629 |
|
630 |
public void keyPressed(KeyEvent e) { |
631 |
if(e.getSource() == this.getCheckSliderText().getJTextField()){ |
632 |
this.getCheckSliderText().getJSlider().setValue((int) Math.round(Double.valueOf(this.getCheckSliderText().getTextValue()).doubleValue())); |
633 |
} |
634 |
} |
635 |
|
636 |
public void keyReleased(KeyEvent e) { |
637 |
// TODO Auto-generated method stub
|
638 |
|
639 |
} |
640 |
|
641 |
public void keyTyped(KeyEvent e) { |
642 |
|
643 |
} |
644 |
} |
645 |
|