svn-gvsig-desktop / tags / v1_0_2_Build_896 / extensions / extRasterTools / src / org / gvsig / rasterTools / brightnessContrast / ui / EnhancedBrightnessContrastPanel.java @ 10391
History | View | Annotate | Download (21.3 KB)
1 | 5497 | maquerol | /* 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 | 5159 | nacho | 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 | 5358 | maquerol | import java.awt.event.KeyEvent; |
27 | import java.awt.event.KeyListener; |
||
28 | 5247 | nacho | import java.awt.event.MouseEvent; |
29 | import java.awt.event.MouseListener; |
||
30 | 5159 | nacho | |
31 | import javax.swing.JCheckBox; |
||
32 | import javax.swing.JLabel; |
||
33 | import javax.swing.JPanel; |
||
34 | |||
35 | 5982 | nacho | import org.cresques.filter.IRasterOperationsRegistrablePanels; |
36 | import org.cresques.filter.IStackManager; |
||
37 | import org.cresques.filter.RasterFilterStackManager; |
||
38 | 5159 | nacho | import org.cresques.io.GeoRasterFile; |
39 | 9056 | nacho | import org.cresques.ui.filter.FilterRasterDialogPanel; |
40 | 5159 | nacho | import org.gvsig.rasterTools.brightnessContrast.filter.BrightnessContrastStackManager; |
41 | |||
42 | 5358 | maquerol | import com.iver.andami.PluginServices; |
43 | 5159 | nacho | import com.iver.cit.gvsig.fmap.layers.FLyrRaster; |
44 | 6138 | jmvivo | import com.iver.cit.gvsig.gui.panels.IRasterPropertiesRegistrable; |
45 | import com.iver.cit.gvsig.gui.panels.PropertiesRasterDialog; |
||
46 | 8765 | jjdelcerro | import com.iver.cit.gvsig.project.documents.view.toc.gui.FLyrRasterAdjustPropertiesTocMenuEntry; |
47 | 5159 | nacho | |
48 | |||
49 | /**
|
||
50 | 5497 | maquerol | * Panel para los controles de brillo, contrase y realce.
|
51 | 5159 | nacho | * @author Miguel Angel Querol Carratal? <querol_mig@gva.es>
|
52 | *
|
||
53 | */
|
||
54 | 5358 | maquerol | public class EnhancedBrightnessContrastPanel extends JPanel implements ActionListener, |
55 | 5247 | nacho | MouseListener,
|
56 | 5358 | maquerol | KeyListener,
|
57 | 5159 | nacho | 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 | 5358 | maquerol | |
75 | 5159 | nacho | private BrightnessContrastStackManager bcManager = null; |
76 | 5247 | nacho | private JCheckBox jCheckBox1 = null; |
77 | 5497 | maquerol | private JLabel lpreview = null; |
78 | 5358 | maquerol | 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 | 5159 | nacho | /**
|
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 | 5497 | maquerol | gridBagConstraints3.insets = new java.awt.Insets(0,4,0,4); |
101 | 5159 | nacho | gridBagConstraints3.gridy = 0;
|
102 | gridBagConstraints3.gridx = 1;
|
||
103 | GridBagConstraints gridBagConstraints2 = new GridBagConstraints(); |
||
104 | 5497 | maquerol | gridBagConstraints2.insets = new java.awt.Insets(0,4,0,4); |
105 | 5159 | nacho | 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 | 5358 | maquerol | this.getLabelSliderText().getJSlider().addMouseListener(this); |
116 | this.getLabelSliderText1().getJSlider().addMouseListener(this); |
||
117 | this.setTranslation();
|
||
118 | 5497 | maquerol | this.getLabelSliderText().getJTextField().addActionListener(this); |
119 | this.getLabelSliderText1().getJTextField().addActionListener(this); |
||
120 | 5159 | nacho | } |
121 | |||
122 | 5358 | maquerol | 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 | 5497 | maquerol | this.lBrightC.setText(PluginServices.getText(this, "activar")); |
127 | 5358 | maquerol | this.lstBrightness.setName(PluginServices.getText(this, "brillo")); |
128 | this.lstContrast.setName(PluginServices.getText(this, "contraste")); |
||
129 | 5497 | maquerol | this.lpreview.setText(PluginServices.getText(this, "previsualizacion")); |
130 | 5358 | maquerol | } |
131 | |||
132 | |||
133 | 5159 | nacho | /**
|
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 | 5497 | maquerol | gridBagConstraints4.insets = new java.awt.Insets(4,0,8,0); |
143 | 5159 | nacho | gridBagConstraints4.gridy = 1;
|
144 | GridBagConstraints gridBagConstraints = new GridBagConstraints(); |
||
145 | gridBagConstraints.gridx = 0;
|
||
146 | 5497 | maquerol | gridBagConstraints.insets = new java.awt.Insets(0,8,4,8); |
147 | 5159 | nacho | gridBagConstraints.gridy = 0;
|
148 | pBrightCont = new JPanel(); |
||
149 | pBrightCont.setLayout(new GridBagLayout()); |
||
150 | pBrightCont.setPreferredSize(new java.awt.Dimension(210,223)); |
||
151 | 5497 | maquerol | 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 | 5159 | nacho | 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 | 5497 | maquerol | gridBagConstraints12.insets = new java.awt.Insets(4,4,59,4); |
168 | 5159 | nacho | gridBagConstraints12.gridy = 1;
|
169 | GridBagConstraints gridBagConstraints11 = new GridBagConstraints(); |
||
170 | gridBagConstraints11.gridx = 0;
|
||
171 | 5497 | maquerol | gridBagConstraints11.insets = new java.awt.Insets(0,8,4,8); |
172 | 5159 | nacho | 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 | 5497 | maquerol | 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 | 5159 | nacho | pEnhanced.add(getPEnCheck(), gridBagConstraints11); |
181 | pEnhanced.add(getPEnSlider(), gridBagConstraints12); |
||
182 | } |
||
183 | return pEnhanced;
|
||
184 | } |
||
185 | |||
186 | 5497 | maquerol | /**
|
187 | * inicializa el conponente LabelSliderText
|
||
188 | */
|
||
189 | 5159 | nacho | 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 | 5497 | maquerol | /**
|
200 | * inicializa el conponente LabelSliderText
|
||
201 | */
|
||
202 | 5159 | nacho | public LabelSliderText getLabelSliderText1(){
|
203 | if (lstContrast == null){ |
||
204 | lstContrast = new LabelSliderText();
|
||
205 | lstContrast.setName("Contraste");
|
||
206 | 5497 | maquerol | lstContrast.setPreferredSize(new java.awt.Dimension(180,45)); |
207 | 5159 | nacho | 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 | 5497 | maquerol | lBrightC.setText("Activar");
|
225 | 5159 | nacho | 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 | 5497 | maquerol | pBCCheck.setPreferredSize(new java.awt.Dimension(182,25)); |
232 | 5159 | nacho | 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 | 5497 | maquerol | gridBagConstraints5.insets = new java.awt.Insets(0,0,0,0); |
256 | 5159 | nacho | gridBagConstraints5.gridy = 1;
|
257 | pBCSlider = new JPanel(); |
||
258 | pBCSlider.setLayout(new GridBagLayout()); |
||
259 | 5497 | maquerol | pBCSlider.setPreferredSize(new java.awt.Dimension(188,150)); |
260 | 5159 | nacho | 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 | 5247 | nacho | GridBagConstraints gridBagConstraints19 = new GridBagConstraints(); |
277 | gridBagConstraints19.gridx = 1;
|
||
278 | gridBagConstraints19.gridy = 0;
|
||
279 | 5497 | maquerol | 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 | 5159 | nacho | GridBagConstraints gridBagConstraints10 = new GridBagConstraints(); |
284 | 5247 | nacho | gridBagConstraints10.gridx = 0;
|
285 | gridBagConstraints10.insets = new java.awt.Insets(0,0,0,0); |
||
286 | 5159 | nacho | gridBagConstraints10.gridy = 0;
|
287 | jPanel1 = new JPanel(); |
||
288 | jPanel1.setLayout(new GridBagLayout()); |
||
289 | 5247 | nacho | jPanel1.setPreferredSize(new java.awt.Dimension(180,25)); |
290 | jPanel1.add(getJCheckBox1(), gridBagConstraints10); |
||
291 | 5497 | maquerol | jPanel1.add(lpreview, gridBagConstraints19); |
292 | 5159 | nacho | } |
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 | 5358 | maquerol | lLineal = new JLabel(); |
324 | lLineal.setText("Lineal Directo");
|
||
325 | lLineal.setPreferredSize(new java.awt.Dimension(160,15)); |
||
326 | 5159 | nacho | pEnCheck = new JPanel(); |
327 | pEnCheck.setLayout(new GridBagLayout()); |
||
328 | 5497 | maquerol | pEnCheck.setPreferredSize(new java.awt.Dimension(182,25)); |
329 | 5159 | nacho | pEnCheck.add(getCEnhanced(), gridBagConstraints13); |
330 | 5358 | maquerol | pEnCheck.add(lLineal, gridBagConstraints14); |
331 | 5159 | nacho | } |
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 | 5497 | maquerol | pEnSlider.setPreferredSize(new java.awt.Dimension(188,100)); |
353 | 5159 | nacho | 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 | 5247 | nacho | public JCheckBox getCEnhanced() { |
367 | 5159 | nacho | 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 | 5358 | maquerol | lRemove = new JLabel(); |
384 | lRemove.setText("Eliminar Extremos");
|
||
385 | lRemove.setPreferredSize(new java.awt.Dimension(150,15)); |
||
386 | 5159 | nacho | 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 | 5358 | maquerol | pDelInt.add(lRemove, gridBagConstraints17); |
395 | 5159 | nacho | } |
396 | return pDelInt;
|
||
397 | } |
||
398 | |||
399 | /**
|
||
400 | * This method initializes jCheckBox
|
||
401 | *
|
||
402 | * @return javax.swing.JCheckBox
|
||
403 | */
|
||
404 | 5247 | nacho | public JCheckBox getJCheckBox() { |
405 | 5159 | nacho | if (jCheckBox == null) { |
406 | jCheckBox = new JCheckBox(); |
||
407 | } |
||
408 | return jCheckBox;
|
||
409 | } |
||
410 | |||
411 | 5497 | maquerol | /**
|
412 | * inicializa el conponente CheckSliderText
|
||
413 | */
|
||
414 | 5247 | nacho | public CheckSliderText getCheckSliderText(){
|
415 | 5358 | maquerol | String rcName = "Recorte de colas"; |
416 | 5159 | nacho | if (cstEnhanced == null){ |
417 | cstEnhanced = new CheckSliderText();
|
||
418 | cstEnhanced.setName(rcName); |
||
419 | cstEnhanced.setSliderValue(0);
|
||
420 | cstEnhanced.setSliderRange(0,50); |
||
421 | 5497 | maquerol | cstEnhanced.setDecimal(true);
|
422 | 5247 | nacho | cstEnhanced.setTextValue("0.0");
|
423 | 5159 | nacho | |
424 | } |
||
425 | return cstEnhanced;
|
||
426 | } |
||
427 | |||
428 | 5497 | maquerol | /**
|
429 | * Habilita o dehabilita el panel de brillo y contraste
|
||
430 | * @param active
|
||
431 | */
|
||
432 | 5159 | nacho | public void setBCControlEnabled(boolean active){ |
433 | this.lstBrightness.setControlEnabled(active);
|
||
434 | this.lstContrast.setControlEnabled(active);
|
||
435 | 5247 | nacho | this.getJCheckBox1().setEnabled(active);
|
436 | 5497 | maquerol | this.lpreview.setEnabled(active);
|
437 | 5159 | nacho | } |
438 | |||
439 | 5497 | maquerol | /**
|
440 | * Habilita o dehabilita el panel de realce
|
||
441 | * @param active
|
||
442 | */
|
||
443 | 5159 | nacho | public void setEControlEnabled(boolean active){ |
444 | this.jCheckBox.setEnabled(active);
|
||
445 | 5358 | maquerol | this.lRemove.setEnabled(active);
|
446 | 5497 | maquerol | this.cstEnhanced.setControlEnabled(active);
|
447 | 5159 | nacho | } |
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 | 5497 | maquerol | 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 | 5358 | maquerol | } |
468 | 5159 | nacho | |
469 | 5497 | maquerol | /**
|
470 | * Asigna a este panel un stack manager
|
||
471 | * @param p
|
||
472 | */
|
||
473 | 5159 | nacho | public void setBrightnessContrastStackManager (BrightnessContrastStackManager p){ |
474 | this.bcManager = p;
|
||
475 | } |
||
476 | |||
477 | 5497 | maquerol | /**
|
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 | 5358 | maquerol | private void processBrightnessContrastPanel(RasterFilterStackManager stackManager, PropertiesRasterDialog propsDialog, FLyrRaster layer){ |
485 | 5159 | nacho | 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 | 5358 | maquerol | |
489 | 5159 | nacho | if(ebcPanel.getCBrightC().isSelected()){
|
490 | 5358 | maquerol | int incrBrillo = (int)Math.round(Double.valueOf(ebcPanel.lstBrightness.getTextValue()).doubleValue()); |
491 | int incrContraste = (int)Math.round(Double.valueOf(ebcPanel.lstContrast.getTextValue()).doubleValue()); |
||
492 | 5159 | nacho | bcManager.addBrightnessFilter(incrBrillo); |
493 | bcManager.addContrastFilter(incrContraste); |
||
494 | }else{
|
||
495 | stackManager.removeFilter(bcManager.brightness); |
||
496 | stackManager.removeFilter(bcManager.contrast); |
||
497 | 5358 | maquerol | } |
498 | 6881 | cesar | layer.getMapContext().invalidate(); |
499 | 5358 | maquerol | } |
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 | 5247 | nacho | //Filtro de realce lineal seleccionado
|
515 | if(ebcPanel.getCEnhanced().isSelected()){
|
||
516 | 5497 | maquerol | if((ebcPanel.getJCheckBox().isSelected()) && (!ebcPanel.getCheckSliderText().getJCheckBox().isSelected()))
|
517 | 5247 | nacho | 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 | 5497 | maquerol | if(ebcPanel.getCheckSliderText().getJCheckBox().isSelected()){
|
523 | 5247 | nacho | 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 | 5358 | maquerol | // Sin filtro lineal seleccionado
|
536 | 5247 | nacho | if(!ebcPanel.getCEnhanced().isSelected()){
|
537 | stackManager.removeFilter(stackManager.getTypeFilter("computeminmax"));
|
||
538 | stackManager.removeFilter(stackManager.getTypeFilter("tail"));
|
||
539 | stackManager.removeFilter(stackManager.getTypeFilter("enhanced"));
|
||
540 | } |
||
541 | 6881 | cesar | fLayer.getMapContext().invalidate(); |
542 | 5247 | nacho | |
543 | 5159 | nacho | } |
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 | 5358 | maquerol | |
561 | 5159 | nacho | //----------------------------------------------------------------------------------
|
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 | 5247 | nacho | /**
|
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 | 5358 | maquerol | |
586 | public void setPropertiesDialog(PropertiesRasterDialog prop){ |
||
587 | this.propertiesRasterDialog = prop;
|
||
588 | } |
||
589 | |||
590 | 5247 | nacho | |
591 | //********************************************************************
|
||
592 | //***********************EVENTOS DE RAT?N*****************************
|
||
593 | 5358 | maquerol | |
594 | 5247 | nacho | 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 | 5497 | maquerol | /**
|
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 | 5247 | nacho | public void mouseReleased(MouseEvent e) { |
620 | 5358 | maquerol | 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 | 5247 | nacho | } |
629 | |||
630 | 5358 | maquerol | 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 | 5497 | maquerol | |
636 | 5358 | maquerol | public void keyReleased(KeyEvent e) { |
637 | // TODO Auto-generated method stub
|
||
638 | |||
639 | } |
||
640 | |||
641 | public void keyTyped(KeyEvent e) { |
||
642 | |||
643 | } |
||
644 | 5497 | maquerol | } |