root / trunk / applications / appgvSIG / src / com / iver / cit / gvsig / gui / toc / BrightnessContrastTocMenuEntry.java @ 6117
History | View | Annotate | Download (4.29 KB)
1 | 5534 | nacho | /* 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 com.iver.cit.gvsig.gui.toc; |
||
21 | |||
22 | 5981 | nacho | import org.cresques.filter.RasterFilter; |
23 | import org.cresques.filter.RasterFilterStackManager; |
||
24 | import org.cresques.filter.BrightnessContrast.BrightnessContrastStackManager; |
||
25 | 5534 | nacho | import org.cresques.ui.BrightnessContrast.EnhancedBrightnessContrastPanel; |
26 | import org.cresques.ui.raster.FilterRasterDialogPanel; |
||
27 | |||
28 | import com.iver.cit.gvsig.fmap.layers.FLyrRaster; |
||
29 | 6117 | jaume | import com.iver.cit.gvsig.gui.panels.PropertiesRasterDialog; |
30 | 5534 | nacho | |
31 | /**
|
||
32 | * Entrada al menu TOC que contiene la parter del listener que corresponde a los
|
||
33 | * filtros de brillo y contraste. El metodo actionPerformed de esta clase sera llamado
|
||
34 | * por FLyrRasterAdjustPropertiesTocMenuEntry. Para ello, tiene que registrarse usando
|
||
35 | * el metodo register.
|
||
36 | *
|
||
37 | * @author Miguel ?ngel Querol Carratal? <querol_mig@gva.es>
|
||
38 | *
|
||
39 | */
|
||
40 | |||
41 | public class BrightnessContrastTocMenuEntry{ |
||
42 | |||
43 | EnhancedBrightnessContrastPanel panel = null;
|
||
44 | BrightnessContrastStackManager bcManager = null;
|
||
45 | |||
46 | /**
|
||
47 | * Constructor. Se registra a si mismo en las propiedades de raster del TOC.
|
||
48 | * @param menu
|
||
49 | */
|
||
50 | public BrightnessContrastTocMenuEntry (){
|
||
51 | |||
52 | } |
||
53 | |||
54 | /**
|
||
55 | * Modificaci?n del estado de los controles del panel de brillo y contraste
|
||
56 | */
|
||
57 | public void actionPerformed(RasterFilterStackManager stackManager, PropertiesRasterDialog propsDialog, FLyrRaster fLayer) { |
||
58 | EnhancedBrightnessContrastPanel bcPanel = (EnhancedBrightnessContrastPanel)((FilterRasterDialogPanel)propsDialog.getContentPane()).getPanelByClassName("EnhancedBrightnessContrastPanel");
|
||
59 | //bcPanel.setPropertiesDialog(propsDialog);
|
||
60 | |||
61 | if(stackManager.isActive(stackManager.getTypeFilter("brightness"))){ |
||
62 | bcPanel.getCBrightC().setSelected(true);
|
||
63 | bcPanel.setBCControlEnabled(true);
|
||
64 | |||
65 | RasterFilter bright = stackManager.getFilter("brightness");
|
||
66 | |||
67 | if(bright.getParam("incrBrillo") != null){ |
||
68 | int incr = ((Integer)bright.getParam("incrBrillo")).intValue(); |
||
69 | bcPanel.getLabelSliderText().setSliderValue(incr); |
||
70 | bcPanel.getLabelSliderText().setTextValue(String.valueOf(incr));
|
||
71 | } |
||
72 | } |
||
73 | |||
74 | if(stackManager.isActive(stackManager.getTypeFilter("contrast"))){ |
||
75 | bcPanel.getCBrightC().setSelected(true);
|
||
76 | bcPanel.setBCControlEnabled(true);
|
||
77 | |||
78 | RasterFilter cont = stackManager.getFilter("contrast");
|
||
79 | |||
80 | if(cont.getParam("incrContraste") != null){ |
||
81 | int incr = ((Integer)cont.getParam("incrContraste")).intValue(); |
||
82 | bcPanel.getLabelSliderText1().setSliderValue(incr); |
||
83 | bcPanel.getLabelSliderText1().setTextValue(String.valueOf(incr));
|
||
84 | } |
||
85 | } |
||
86 | |||
87 | if(stackManager.isActive(stackManager.getTypeFilter("enhanced"))){ |
||
88 | bcPanel.getCEnhanced().setSelected(true);
|
||
89 | bcPanel.setEControlEnabled(true);
|
||
90 | |||
91 | RasterFilter enhan = stackManager.getFilter("enhanced");
|
||
92 | RasterFilter tail = stackManager.getFilter("tail");
|
||
93 | |||
94 | |||
95 | boolean rem = ((Boolean)enhan.getParam("remove")).booleanValue(); |
||
96 | bcPanel.getJCheckBox().setSelected(rem); |
||
97 | |||
98 | if(stackManager.isActive(stackManager.getTypeFilter("tail"))){ |
||
99 | double percent = (stackManager.getStackStats().tailPercent)*100; |
||
100 | bcPanel.getCheckSliderText().setTextValue(String.valueOf(percent));
|
||
101 | bcPanel.getCheckSliderText().setSliderValue((int)percent);
|
||
102 | bcPanel.getCheckSliderText().setSelected(true);
|
||
103 | bcPanel.getCheckSliderText().setControlEnabled(true);
|
||
104 | boolean remove = ((Boolean)tail.getParam("remove")).booleanValue(); |
||
105 | if((remove == true) || (rem == true)) |
||
106 | bcPanel.getJCheckBox().setSelected(true);
|
||
107 | else
|
||
108 | bcPanel.getJCheckBox().setSelected(false);
|
||
109 | |||
110 | } |
||
111 | |||
112 | |||
113 | } |
||
114 | } |
||
115 | |||
116 | } |