Revision 5497
trunk/extensions/extRasterTools/src/org/gvsig/rasterTools/brightnessContrast/filter/BrightnessImageFilter.java | ||
---|---|---|
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 |
|
|
1 | 20 |
package org.gvsig.rasterTools.brightnessContrast.filter; |
2 | 21 |
|
3 | 22 |
import java.awt.Image; |
trunk/extensions/extRasterTools/src/org/gvsig/rasterTools/brightnessContrast/filter/ContrastFilter.java | ||
---|---|---|
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 |
|
|
1 | 20 |
package org.gvsig.rasterTools.brightnessContrast.filter; |
2 | 21 |
|
3 | 22 |
import org.cresques.io.raster.RasterFilter; |
... | ... | |
16 | 35 |
int incrContraste = 0; |
17 | 36 |
|
18 | 37 |
/** |
19 |
* Valor del desplazamiento del histograma de la imagen. |
|
20 |
*/ |
|
21 |
int desplazamiento = 0; |
|
22 |
|
|
23 |
/** |
|
24 |
* Valor del estiramiento del histograma de la imagen. |
|
25 |
*/ |
|
26 |
float estiramiento = 0; |
|
27 |
|
|
28 |
/** |
|
29 | 38 |
* Valor que toma el pixel despues de aplicarle el algoritmo de |
30 | 39 |
* mejora del contraste. |
31 | 40 |
*/ |
32 | 41 |
int result = 0; |
33 | 42 |
|
34 |
int est = 0; |
|
35 |
int desp = 0; |
|
36 | 43 |
|
37 |
|
|
38 | 44 |
/** |
39 | 45 |
* Constructor |
40 | 46 |
*/ |
trunk/extensions/extRasterTools/src/org/gvsig/rasterTools/brightnessContrast/filter/HistogramFilter.java | ||
---|---|---|
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 |
|
|
1 | 20 |
package org.gvsig.rasterTools.brightnessContrast.filter; |
2 | 21 |
|
3 | 22 |
import org.cresques.io.raster.RasterFilter; |
... | ... | |
11 | 30 |
public abstract class HistogramFilter extends RasterFilter { |
12 | 31 |
|
13 | 32 |
/** |
14 |
* Alto de la imagen
|
|
33 |
* N?mero de bandas de la imagen sin contar RGB
|
|
15 | 34 |
*/ |
16 |
protected int imgHeight = 0;
|
|
35 |
protected int nBands = 0;
|
|
17 | 36 |
|
18 |
/** |
|
19 |
* Ancho de la imagen |
|
20 |
*/ |
|
21 |
protected int imgWidth = 0; |
|
22 | 37 |
|
23 | 38 |
/** |
24 |
* N?mero de bandas de la imagen sin contar RGB
|
|
39 |
* N?mero de pixels de la imagen.
|
|
25 | 40 |
*/ |
26 |
protected int nBands = 0;
|
|
41 |
int pixel = 0;
|
|
27 | 42 |
|
28 | 43 |
/** |
29 | 44 |
* Constructor |
trunk/extensions/extRasterTools/src/org/gvsig/rasterTools/brightnessContrast/filter/ContrastImageFilter.java | ||
---|---|---|
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 |
|
|
1 | 20 |
package org.gvsig.rasterTools.brightnessContrast.filter; |
2 | 21 |
|
3 | 22 |
import java.awt.Image; |
... | ... | |
19 | 38 |
public ContrastImageFilter(){ |
20 | 39 |
super(); |
21 | 40 |
} |
22 |
RasterFilterStack stack = null; |
|
41 |
|
|
42 |
int diferencia = 0; |
|
43 |
double dif = 0; |
|
44 |
double incr = 0; |
|
45 |
double mov = 0; |
|
23 | 46 |
|
47 |
|
|
24 | 48 |
public void pre(){ |
25 | 49 |
exec = true; |
26 | 50 |
this.image = (Image) params.get("raster"); |
27 |
this.stack = (RasterFilterStack) params.get("stack"); |
|
28 | 51 |
height = image.getHeight(null); |
29 | 52 |
width = image.getWidth(null); |
30 | 53 |
this.incrContraste = ((Integer)this.params.get("incrContraste")).intValue(); |
31 |
|
|
32 |
desplazamiento = incrContraste/2; |
|
33 |
estiramiento = incrContraste/80; |
|
34 |
|
|
35 |
if(estiramiento == 0) |
|
36 |
estiramiento += 1; |
|
37 |
if(estiramiento < 0) |
|
38 |
estiramiento = -estiramiento; |
|
54 |
|
|
39 | 55 |
|
40 | 56 |
super.pre(); |
41 | 57 |
} |
... | ... | |
48 | 64 |
(px & 0x000000ff)}; |
49 | 65 |
|
50 | 66 |
for (int i = 1 ; i < 4 ; i++){ |
51 |
/*if(incrContraste < 0) |
|
52 |
result = (int)((px3[i] + desplazamiento) / estiramiento); |
|
53 |
else |
|
54 |
result = (int)((px3[i] - desplazamiento) * Math.pow(estiramiento, 2)); |
|
55 |
*/ |
|
56 |
desp = px3[i] - desplazamiento; |
|
57 |
if(desp <= 0) desp = 1; |
|
58 |
result = desp * (int)estiramiento; |
|
59 |
|
|
60 |
if(result > 255) |
|
61 |
px3[i] = 255; |
|
62 |
else if(result < 0) |
|
63 |
px3[i] = 0; |
|
64 |
else |
|
65 |
px3[i] = result; |
|
67 |
//************ALGORITMO DE CONTRASTE************* |
|
68 |
if(incrContraste >= 0){ |
|
69 |
if (px3[i] < 127){ |
|
70 |
diferencia = 127 - px3[i]; |
|
71 |
result = px3[i] - (diferencia / 10) * (incrContraste/4); |
|
72 |
if(result < 0) result = 0; |
|
73 |
|
|
74 |
} |
|
75 |
if (px3[i] > 127){ |
|
76 |
diferencia = px3[i] - 127; |
|
77 |
result = px3[i] + (diferencia / 10) * (incrContraste/4); |
|
78 |
if(result > 255) result = 255; |
|
79 |
} |
|
80 |
} |
|
81 |
if(incrContraste < 0){ |
|
82 |
if(px3[i] < 127){ |
|
83 |
diferencia = 127 - px3[i]; |
|
84 |
result = px3[i] + (diferencia / 10) * (-incrContraste/20); |
|
85 |
if(result > 127) result = 127; |
|
86 |
if(px3[i] == 0 || px3[i] == 0) |
|
87 |
if(incrContraste > -255) |
|
88 |
result = 0; |
|
89 |
} |
|
90 |
if(px3[i] > 127){ |
|
91 |
diferencia = px3[i] - 127; |
|
92 |
result = px3[i] - (diferencia / 10) * (-incrContraste/20); |
|
93 |
if (result < 127) result = 127; |
|
94 |
if(px3[i] == 255 || px3[i] == 254) |
|
95 |
if(incrContraste > -255) |
|
96 |
result = 255; |
|
97 |
} |
|
98 |
} |
|
99 |
px3[i] = result; |
|
66 | 100 |
} |
67 | 101 |
|
68 | 102 |
((BufferedImage) this.image).setRGB(x, y, ((px3[0] << 24) & 0xff000000) | |
trunk/extensions/extRasterTools/src/org/gvsig/rasterTools/brightnessContrast/filter/HistogramImageFilter.java | ||
---|---|---|
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 |
|
|
1 | 20 |
package org.gvsig.rasterTools.brightnessContrast.filter; |
2 | 21 |
|
3 | 22 |
import java.awt.Image; |
... | ... | |
2 | 21 |
import java.awt.image.BufferedImage; |
22 |
import java.util.Vector; |
|
3 | 23 |
|
... | ... | |
18 | 38 |
/** |
19 | 39 |
* Matriz donde se van a almacenar los histogramas. |
20 | 40 |
*/ |
21 |
int histoRed[]; |
|
22 |
int histoGreen[]; |
|
23 |
int histoBlue[]; |
|
41 |
int histoRed[] = new int[256];
|
|
42 |
int histoGreen[] = new int[256];
|
|
43 |
int histoBlue[] = new int[256];
|
|
24 | 44 |
|
45 |
|
|
25 | 46 |
/** |
26 | 47 |
* Constructor |
27 | 48 |
* |
... | ... | |
33 | 54 |
} |
34 | 55 |
|
35 | 56 |
public void pre(){ |
57 |
this.exec=true; |
|
36 | 58 |
this.image = (Image) params.get("raster"); |
37 |
this.imgWidth = image.getWidth(null);
|
|
38 |
this.imgHeight = image.getHeight(null);
|
|
59 |
this.width = image.getWidth(null);
|
|
60 |
this.height = image.getHeight(null);
|
|
39 | 61 |
|
62 |
for(int i = 0 ; i <= 255 ; i++){ |
|
63 |
histoRed[i]= 0; |
|
64 |
histoGreen[i] = 0; |
|
65 |
histoBlue[i] = 0; |
|
66 |
} |
|
67 |
|
|
40 | 68 |
super.pre(); |
41 | 69 |
} |
42 | 70 |
|
43 | 71 |
|
44 | 72 |
public void post() { |
45 |
// TODO Auto-generated method stub |
|
46 |
|
|
47 | 73 |
} |
48 | 74 |
|
49 | 75 |
public void process(int x, int y) { |
50 | 76 |
int px = ((BufferedImage) image).getRGB(x, y); |
51 | 77 |
int px3[] = {(px & 0xff0000) >> 16, (px & 0xff00) >> 8, (px & 0xff)}; |
52 | 78 |
|
53 |
this.histoRed[px3[0]]++; //Histograma para la banda R |
|
54 |
this.histoGreen[px3[1]]++; //Histograma para la banda G |
|
55 |
this.histoBlue[px3[2]]++; //Histograma para la banda B |
|
56 |
|
|
57 |
|
|
79 |
this.histoRed[px3[0]]+=1; //Histograma para la banda R |
|
80 |
this.histoGreen[px3[1]]+=1; //Histograma para la banda G |
|
81 |
this.histoBlue[px3[2]]+=1; //Histograma para la banda B |
|
82 |
pixel++; //Cuenta de los pixels de la imagen |
|
58 | 83 |
} |
59 | 84 |
|
60 | 85 |
/** |
... | ... | |
67 | 92 |
int suma = 0; |
68 | 93 |
|
69 | 94 |
for (int i = 1 ; i <= 255 ; i++){ |
70 |
suma += vector[i]; |
|
95 |
suma += vector[i]*i;
|
|
71 | 96 |
} |
72 |
media = suma/255;
|
|
97 |
media = suma/pixel;
|
|
73 | 98 |
|
74 | 99 |
return media; |
75 | 100 |
} |
76 | 101 |
|
102 |
public int getPixel(){ |
|
103 |
return this.pixel; |
|
104 |
} |
|
77 | 105 |
|
78 | 106 |
public void processLine(int y) { |
79 | 107 |
// TODO Auto-generated method stub |
... | ... | |
96 | 124 |
} |
97 | 125 |
} |
98 | 126 |
|
127 |
/** |
|
128 |
* Metodos para acceder al los valores medios de brillo para cada banda |
|
129 |
* @return Media de brillo para la banda de color correspondiente. |
|
130 |
*/ |
|
99 | 131 |
|
132 |
public int getMediaRed(){ |
|
133 |
return calculaMedia(this.histoRed); |
|
134 |
} |
|
135 |
|
|
136 |
public int getMediaGreen(){ |
|
137 |
return calculaMedia(this.histoGreen); |
|
138 |
} |
|
139 |
|
|
140 |
public int getMediaBlue(){ |
|
141 |
return calculaMedia(this.histoBlue); |
|
142 |
} |
|
143 |
|
|
144 |
|
|
100 | 145 |
/** |
101 | 146 |
* Metodos para acceder desde fuera a los histogramas calculados por el filtro |
102 | 147 |
* @return Histogramas de cada una de las bandas de color. |
... | ... | |
113 | 158 |
return (Object) this.histoBlue; |
114 | 159 |
} |
115 | 160 |
|
116 |
/** |
|
117 |
* Metodos para acceder al los valores medios de brillo para cada banda |
|
118 |
* @return Media de brillo para la banda de color correspondiente. |
|
119 |
*/ |
|
120 | 161 |
|
121 |
int mediaRed(){ |
|
122 |
return calculaMedia(this.histoRed); |
|
123 |
} |
|
124 |
|
|
125 |
int mediaGreen(){ |
|
126 |
return calculaMedia(this.histoGreen); |
|
127 |
} |
|
128 |
|
|
129 |
int mediaBlue(){ |
|
130 |
return calculaMedia(this.histoBlue); |
|
131 |
} |
|
132 | 162 |
} |
trunk/extensions/extRasterTools/src/org/gvsig/rasterTools/brightnessContrast/filter/BrightnessContrastStackManager.java | ||
---|---|---|
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 |
|
|
1 | 20 |
package org.gvsig.rasterTools.brightnessContrast.filter; |
2 | 21 |
|
3 | 22 |
import java.util.ArrayList; |
4 | 23 |
|
5 | 24 |
import org.cresques.io.GeoRasterFile; |
6 | 25 |
import org.cresques.io.raster.IStackManager; |
7 |
import org.cresques.io.raster.LinearEnhancementFilter; |
|
8 |
import org.cresques.io.raster.LinearEnhancementImageFilter; |
|
9 |
import org.cresques.io.raster.LinearEnhancementShortFilter; |
|
10 | 26 |
import org.cresques.io.raster.RasterBuf; |
11 | 27 |
import org.cresques.io.raster.RasterFilter; |
12 | 28 |
import org.cresques.io.raster.RasterFilterStack; |
13 | 29 |
import org.cresques.io.raster.RasterFilterStackManager; |
14 |
import org.gvsig.rasterTools.histogram.filter.HistogramFilter; |
|
15 |
import org.gvsig.rasterTools.histogram.filter.HistogramImageFilter; |
|
16 | 30 |
|
17 | 31 |
/** |
18 | 32 |
* Gestor de la pila de filtros para el filtro de brillo. |
... | ... | |
167 | 181 |
public int createStackFromStrings(ArrayList filters, String fil, GeoRasterFile[] grfList, int filteri) { |
168 | 182 |
this.grfList = grfList; |
169 | 183 |
|
170 |
if((fil.startsWith("filter.brightContHist.active"))&&
|
|
184 |
if((fil.startsWith("filter.brightCont.active"))&& |
|
171 | 185 |
(RasterFilterStackManager.getValue(fil).equals("true"))){ |
172 | 186 |
|
173 | 187 |
int incrBrillo = 0; |
... | ... | |
188 | 202 |
prop--; |
189 | 203 |
} |
190 | 204 |
} |
191 |
addHistogramFilter(); |
|
192 | 205 |
addBrightnessFilter(incrBrillo); |
193 | 206 |
addContrastFilter(incrContraste); |
194 | 207 |
} |
... | ... | |
209 | 222 |
|
210 | 223 |
|
211 | 224 |
if((rf instanceof BrightnessFilter) || |
212 |
(rf instanceof ContrastFilter) || |
|
213 |
(rf instanceof HistogramFilter)){ |
|
214 |
filterList.add("filter.brightContHist.active=true"); |
|
225 |
(rf instanceof ContrastFilter)){ |
|
226 |
filterList.add("filter.brightCont.active=true"); |
|
215 | 227 |
} |
216 | 228 |
|
217 | 229 |
if(rf instanceof BrightnessFilter){ |
trunk/extensions/extRasterTools/src/org/gvsig/rasterTools/brightnessContrast/filter/BrightnessFilter.java | ||
---|---|---|
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 |
|
|
1 | 20 |
package org.gvsig.rasterTools.brightnessContrast.filter; |
2 | 21 |
|
3 | 22 |
import org.cresques.io.raster.RasterFilter; |
trunk/extensions/extRasterTools/src/org/gvsig/rasterTools/brightnessContrast/toc/BrightnessContrastTocMenuEntry.java | ||
---|---|---|
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 |
|
|
1 | 20 |
package org.gvsig.rasterTools.brightnessContrast.toc; |
2 | 21 |
|
3 | 22 |
import org.cresques.io.raster.IStackManager; |
... | ... | |
7 | 26 |
import org.gvsig.rasterTools.brightnessContrast.filter.BrightnessContrastStackManager; |
8 | 27 |
import org.gvsig.rasterTools.brightnessContrast.ui.EnhancedBrightnessContrastPanel; |
9 | 28 |
|
29 |
import com.iver.andami.PluginServices; |
|
10 | 30 |
import com.iver.cit.gvsig.fmap.layers.FLyrRaster; |
11 | 31 |
import com.iver.cit.gvsig.gui.Panels.IRasterPropertiesRegistrable; |
12 | 32 |
import com.iver.cit.gvsig.gui.Panels.PropertiesRasterDialog; |
... | ... | |
102 | 122 |
public void addTabPanel(FLyrRasterAdjustPropertiesTocMenuEntry menu) { |
103 | 123 |
if(panel == null) |
104 | 124 |
panel = new EnhancedBrightnessContrastPanel(); |
105 |
menu.getPropertiesDialog().addTab("Realce", panel);
|
|
125 |
menu.getPropertiesDialog().addTab(PluginServices.getText(this, "realces"), panel);
|
|
106 | 126 |
|
107 | 127 |
} |
108 | 128 |
/** |
trunk/extensions/extRasterTools/src/org/gvsig/rasterTools/brightnessContrast/BrightnessContrastModule.java | ||
---|---|---|
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 |
|
|
1 | 20 |
package org.gvsig.rasterTools.brightnessContrast; |
2 | 21 |
|
3 | 22 |
import org.cresques.io.raster.RasterFilterStackManager; |
trunk/extensions/extRasterTools/src/org/gvsig/rasterTools/brightnessContrast/ui/CheckSliderText.java | ||
---|---|---|
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 |
|
|
1 | 20 |
package org.gvsig.rasterTools.brightnessContrast.ui; |
2 | 21 |
|
3 | 22 |
import java.awt.GridBagConstraints; |
... | ... | |
8 | 27 |
import javax.swing.JCheckBox; |
9 | 28 |
import javax.swing.JLabel; |
10 | 29 |
|
30 |
/** |
|
31 |
* Clase que contiene slider, campo de texto, etiqueta para el nombre y un |
|
32 |
* checkBox para habilitar o deshabilitar el slider y el campo de texto. |
|
33 |
* @author Miguel ?ngel Querol Carratal? <querol_mig@gva.es> |
|
34 |
* |
|
35 |
*/ |
|
11 | 36 |
public class CheckSliderText extends SliderTextPanel implements ActionListener{ |
12 | 37 |
|
13 | 38 |
public JLabel lName = null; |
... | ... | |
33 | 58 |
* Inicializa cSliderText |
34 | 59 |
* @return |
35 | 60 |
*/ |
36 |
private JCheckBox getJCheckBox(){
|
|
61 |
public JCheckBox getJCheckBox(){
|
|
37 | 62 |
if(cSliderText == null){ |
38 | 63 |
cSliderText = new JCheckBox(); |
39 | 64 |
} |
... | ... | |
50 | 75 |
return lName; |
51 | 76 |
} |
52 | 77 |
|
78 |
/** |
|
79 |
* Pone nombre al panel en la etiqueta que est? encima del slider |
|
80 |
*/ |
|
53 | 81 |
public void setName(String name){ |
54 | 82 |
lName.setText(name); |
55 | 83 |
} |
56 | 84 |
|
85 |
/** |
|
86 |
* Activa o desactiva el slider y el campo de texto |
|
87 |
*/ |
|
57 | 88 |
public void setControlEnabled(boolean active){ |
58 | 89 |
this.cSliderText.setEnabled(active); |
59 | 90 |
this.lName.setEnabled(active); |
91 |
this.getJTextField().setEnabled(active); |
|
60 | 92 |
super.setControlEnabled(active); |
61 | 93 |
if(cSliderText.isSelected() == false){ |
62 | 94 |
super.setControlEnabled(false); |
63 |
this.lName.setEnabled(false); |
|
64 | 95 |
} |
65 | 96 |
|
66 | 97 |
} |
67 | 98 |
|
68 |
public boolean isSelected(){ |
|
69 |
return this.getJCheckBox().isSelected(); |
|
70 |
} |
|
71 | 99 |
|
72 | 100 |
public void actionPerformed(ActionEvent e) { |
73 | 101 |
super.actionPerformed(e); |
trunk/extensions/extRasterTools/src/org/gvsig/rasterTools/brightnessContrast/ui/LabelSliderText.java | ||
---|---|---|
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 |
|
|
1 | 20 |
package org.gvsig.rasterTools.brightnessContrast.ui; |
2 | 21 |
|
3 | 22 |
import java.awt.GridBagConstraints; |
... | ... | |
5 | 24 |
|
6 | 25 |
import javax.swing.JLabel; |
7 | 26 |
|
27 |
/** |
|
28 |
* Clase que contiene un slider, un campo de texto y una etiqueta para el nombre. |
|
29 |
* @author Miguel ?ngel Querol Carratal? <querol_mig@gva.es> |
|
30 |
* |
|
31 |
*/ |
|
8 | 32 |
public class LabelSliderText extends SliderTextPanel { |
9 | 33 |
|
10 | 34 |
public JLabel lName = null; |
trunk/extensions/extRasterTools/src/org/gvsig/rasterTools/brightnessContrast/ui/SliderTextPanel.java | ||
---|---|---|
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 |
|
|
1 | 20 |
package org.gvsig.rasterTools.brightnessContrast.ui; |
2 | 21 |
|
3 | 22 |
import java.awt.GridBagConstraints; |
... | ... | |
16 | 35 |
|
17 | 36 |
|
18 | 37 |
/** |
19 |
* Clase base para un componente con un slider y un campo de texto |
|
38 |
* Clase base para un componente con un slider y un campo de texto. |
|
39 |
* Contiene una etiqueta entre el slider y el campo de texto en la que se |
|
40 |
* pueden poner las unidades en las que se cuantifica el valor. |
|
20 | 41 |
* @author Miguel ?ngel Querol Carratal? <querol_mig@gva.es> |
21 | 42 |
* |
22 | 43 |
*/ |
... | ... | |
27 | 48 |
private JSlider jSlider = null; |
28 | 49 |
private JTextField jTextField = null; |
29 | 50 |
private JLabel lPercent = null; |
51 |
private boolean decimal = false; |
|
30 | 52 |
/** |
31 | 53 |
* This is the default constructor |
32 | 54 |
*/ |
... | ... | |
133 | 155 |
jTextField = new JTextField(); |
134 | 156 |
jTextField.setPreferredSize(new java.awt.Dimension(20,19)); |
135 | 157 |
jTextField.setComponentOrientation(java.awt.ComponentOrientation.LEFT_TO_RIGHT); |
136 |
jTextField.setText(String.valueOf(this.getJSlider().getValue()) + ".0");
|
|
158 |
jTextField.setText(String.valueOf(this.getJSlider().getValue())); |
|
137 | 159 |
} |
138 | 160 |
return jTextField; |
139 | 161 |
} |
... | ... | |
194 | 216 |
|
195 | 217 |
public void stateChanged(ChangeEvent e) { |
196 | 218 |
if(e.getSource() == this.jSlider){ |
197 |
this.jTextField.setText(String.valueOf(this.jSlider.getValue()) + ".0"); |
|
219 |
if(decimal == true) |
|
220 |
this.jTextField.setText(String.valueOf(this.jSlider.getValue()) + ".0"); |
|
221 |
if(decimal == false) |
|
222 |
this.jTextField.setText(String.valueOf(this.jSlider.getValue())); |
|
198 | 223 |
} |
199 | 224 |
} |
200 | 225 |
|
... | ... | |
229 | 254 |
double value = Double.valueOf(text).doubleValue(); |
230 | 255 |
this.getJSlider().setValue((int) Math.round(value)); |
231 | 256 |
this.getJTextField().setText(text); |
232 |
} |
|
257 |
}
|
|
233 | 258 |
} |
234 | 259 |
|
260 |
public void setDecimal (boolean dec){ |
|
261 |
decimal = dec; |
|
262 |
} |
|
235 | 263 |
|
236 | 264 |
} |
trunk/extensions/extRasterTools/src/org/gvsig/rasterTools/brightnessContrast/ui/EnhancedBrightnessContrastPanel.java | ||
---|---|---|
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 |
|
|
1 | 20 |
package org.gvsig.rasterTools.brightnessContrast.ui; |
2 | 21 |
|
3 | 22 |
import java.awt.GridBagConstraints; |
... | ... | |
28 | 47 |
|
29 | 48 |
|
30 | 49 |
/** |
31 |
* |
|
50 |
* Panel para los controles de brillo, contrase y realce.
|
|
32 | 51 |
* @author Miguel Angel Querol Carratal? <querol_mig@gva.es> |
33 | 52 |
* |
34 | 53 |
*/ |
... | ... | |
55 | 74 |
|
56 | 75 |
private BrightnessContrastStackManager bcManager = null; |
57 | 76 |
private JCheckBox jCheckBox1 = null; |
58 |
private JLabel jLabel1 = null;
|
|
77 |
private JLabel lpreview = null;
|
|
59 | 78 |
public FLyrRaster layer = null; |
60 | 79 |
public PropertiesRasterDialog propertiesRasterDialog = null; |
61 | 80 |
public RasterFilterStackManager rasterStackManager = null; |
... | ... | |
78 | 97 |
*/ |
79 | 98 |
private void initialize() { |
80 | 99 |
GridBagConstraints gridBagConstraints3 = new GridBagConstraints(); |
81 |
gridBagConstraints3.insets = new java.awt.Insets(8,4,8,8);
|
|
100 |
gridBagConstraints3.insets = new java.awt.Insets(0,4,0,4);
|
|
82 | 101 |
gridBagConstraints3.gridy = 0; |
83 | 102 |
gridBagConstraints3.gridx = 1; |
84 | 103 |
GridBagConstraints gridBagConstraints2 = new GridBagConstraints(); |
85 |
gridBagConstraints2.insets = new java.awt.Insets(8,8,8,4);
|
|
104 |
gridBagConstraints2.insets = new java.awt.Insets(0,4,0,4);
|
|
86 | 105 |
gridBagConstraints2.gridy = 0; |
87 | 106 |
gridBagConstraints2.gridx = 0; |
88 | 107 |
this.setLayout(new GridBagLayout()); |
... | ... | |
96 | 115 |
this.getLabelSliderText().getJSlider().addMouseListener(this); |
97 | 116 |
this.getLabelSliderText1().getJSlider().addMouseListener(this); |
98 | 117 |
this.setTranslation(); |
118 |
this.getLabelSliderText().getJTextField().addActionListener(this); |
|
119 |
this.getLabelSliderText1().getJTextField().addActionListener(this); |
|
99 | 120 |
} |
100 | 121 |
|
101 | 122 |
public void setTranslation(){ |
102 | 123 |
this.lLineal.setText(PluginServices.getText(this, "lineal_directo")); |
103 | 124 |
this.lRemove.setText(PluginServices.getText(this, "eliminar_extremos")); |
104 | 125 |
this.cstEnhanced.setName(PluginServices.getText(this, "recorte_colas")+" ( % )"); |
105 |
this.lBrightC.setText(PluginServices.getText(this, "brillo_y_contraste"));
|
|
126 |
this.lBrightC.setText(PluginServices.getText(this, "activar"));
|
|
106 | 127 |
this.lstBrightness.setName(PluginServices.getText(this, "brillo")); |
107 | 128 |
this.lstContrast.setName(PluginServices.getText(this, "contraste")); |
108 |
this.jLabel1.setText(PluginServices.getText(this, "previsualizacion"));
|
|
129 |
this.lpreview.setText(PluginServices.getText(this, "previsualizacion"));
|
|
109 | 130 |
} |
110 | 131 |
|
111 | 132 |
|
... | ... | |
118 | 139 |
if (pBrightCont == null) { |
119 | 140 |
GridBagConstraints gridBagConstraints4 = new GridBagConstraints(); |
120 | 141 |
gridBagConstraints4.gridx = 0; |
121 |
gridBagConstraints4.insets = new java.awt.Insets(8,8,8,8);
|
|
142 |
gridBagConstraints4.insets = new java.awt.Insets(4,0,8,0);
|
|
122 | 143 |
gridBagConstraints4.gridy = 1; |
123 | 144 |
GridBagConstraints gridBagConstraints = new GridBagConstraints(); |
124 | 145 |
gridBagConstraints.gridx = 0; |
125 |
gridBagConstraints.insets = new java.awt.Insets(8,8,4,8);
|
|
146 |
gridBagConstraints.insets = new java.awt.Insets(0,8,4,8);
|
|
126 | 147 |
gridBagConstraints.gridy = 0; |
127 | 148 |
pBrightCont = new JPanel(); |
128 | 149 |
pBrightCont.setLayout(new GridBagLayout()); |
129 | 150 |
pBrightCont.setPreferredSize(new java.awt.Dimension(210,223)); |
130 |
pBrightCont.setBorder(javax.swing.BorderFactory.createLineBorder(java.awt.Color.gray,1));
|
|
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));
|
|
131 | 152 |
pBrightCont.add(getPBCCheck(), gridBagConstraints); |
132 | 153 |
pBrightCont.add(getPBCSlider(), gridBagConstraints4); |
133 | 154 |
} |
... | ... | |
143 | 164 |
if (pEnhanced == null) { |
144 | 165 |
GridBagConstraints gridBagConstraints12 = new GridBagConstraints(); |
145 | 166 |
gridBagConstraints12.gridx = 0; |
146 |
gridBagConstraints12.insets = new java.awt.Insets(8,8,76,8);
|
|
167 |
gridBagConstraints12.insets = new java.awt.Insets(4,4,59,4);
|
|
147 | 168 |
gridBagConstraints12.gridy = 1; |
148 | 169 |
GridBagConstraints gridBagConstraints11 = new GridBagConstraints(); |
149 | 170 |
gridBagConstraints11.gridx = 0; |
150 |
gridBagConstraints11.insets = new java.awt.Insets(8,8,4,8);
|
|
171 |
gridBagConstraints11.insets = new java.awt.Insets(0,8,4,8);
|
|
151 | 172 |
gridBagConstraints11.gridy = 0; |
152 | 173 |
GridBagConstraints gridBagConstraints1 = new GridBagConstraints(); |
153 | 174 |
gridBagConstraints1.gridx = 0; |
... | ... | |
155 | 176 |
pEnhanced = new JPanel(); |
156 | 177 |
pEnhanced.setLayout(new GridBagLayout()); |
157 | 178 |
pEnhanced.setPreferredSize(new java.awt.Dimension(210,223)); |
158 |
pEnhanced.setBorder(javax.swing.BorderFactory.createLineBorder(java.awt.Color.gray,1));
|
|
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));
|
|
159 | 180 |
pEnhanced.add(getPEnCheck(), gridBagConstraints11); |
160 | 181 |
pEnhanced.add(getPEnSlider(), gridBagConstraints12); |
161 | 182 |
} |
162 | 183 |
return pEnhanced; |
163 | 184 |
} |
164 | 185 |
|
186 |
/** |
|
187 |
* inicializa el conponente LabelSliderText |
|
188 |
*/ |
|
165 | 189 |
public LabelSliderText getLabelSliderText(){ |
166 | 190 |
if(lstBrightness == null){ |
167 | 191 |
lstBrightness = new LabelSliderText(); |
... | ... | |
172 | 196 |
return lstBrightness; |
173 | 197 |
} |
174 | 198 |
|
199 |
/** |
|
200 |
* inicializa el conponente LabelSliderText |
|
201 |
*/ |
|
175 | 202 |
public LabelSliderText getLabelSliderText1(){ |
176 | 203 |
if (lstContrast == null){ |
177 | 204 |
lstContrast = new LabelSliderText(); |
178 | 205 |
lstContrast.setName("Contraste"); |
206 |
lstContrast.setPreferredSize(new java.awt.Dimension(180,45)); |
|
179 | 207 |
lstContrast.setSliderRange(-255,255); |
180 | 208 |
lstContrast.setSliderValue(0); |
181 | 209 |
} |
... | ... | |
193 | 221 |
gridBagConstraints9.gridx = 1; |
194 | 222 |
gridBagConstraints9.gridy = 0; |
195 | 223 |
lBrightC = new JLabel(); |
196 |
lBrightC.setText("Brillo y Contraste");
|
|
224 |
lBrightC.setText("Activar");
|
|
197 | 225 |
lBrightC.setPreferredSize(new java.awt.Dimension(160,15)); |
198 | 226 |
GridBagConstraints gridBagConstraints8 = new GridBagConstraints(); |
199 | 227 |
gridBagConstraints8.gridx = 0; |
200 | 228 |
gridBagConstraints8.gridy = 0; |
201 | 229 |
pBCCheck = new JPanel(); |
202 | 230 |
pBCCheck.setLayout(new GridBagLayout()); |
203 |
pBCCheck.setPreferredSize(new java.awt.Dimension(192,25));
|
|
231 |
pBCCheck.setPreferredSize(new java.awt.Dimension(182,25));
|
|
204 | 232 |
pBCCheck.add(getCBrightC(), gridBagConstraints8); |
205 | 233 |
pBCCheck.add(lBrightC, gridBagConstraints9); |
206 | 234 |
} |
... | ... | |
224 | 252 |
gridBagConstraints6.gridy = 2; |
225 | 253 |
GridBagConstraints gridBagConstraints5 = new GridBagConstraints(); |
226 | 254 |
gridBagConstraints5.gridx = 0; |
227 |
gridBagConstraints5.insets = new java.awt.Insets(2,0,2,0);
|
|
255 |
gridBagConstraints5.insets = new java.awt.Insets(0,0,0,0);
|
|
228 | 256 |
gridBagConstraints5.gridy = 1; |
229 | 257 |
pBCSlider = new JPanel(); |
230 | 258 |
pBCSlider.setLayout(new GridBagLayout()); |
231 |
pBCSlider.setPreferredSize(new java.awt.Dimension(192,168));
|
|
259 |
pBCSlider.setPreferredSize(new java.awt.Dimension(188,150));
|
|
232 | 260 |
pBCSlider.setBorder(javax.swing.BorderFactory.createLineBorder(java.awt.Color.gray,1)); |
233 | 261 |
pBCSlider.add(getLabelSliderText(), gridBagConstraints7); |
234 | 262 |
pBCSlider.add(getLabelSliderText1(), gridBagConstraints5); |
... | ... | |
248 | 276 |
GridBagConstraints gridBagConstraints19 = new GridBagConstraints(); |
249 | 277 |
gridBagConstraints19.gridx = 1; |
250 | 278 |
gridBagConstraints19.gridy = 0; |
251 |
jLabel1 = new JLabel();
|
|
252 |
jLabel1.setText("Previsualizacion");
|
|
253 |
jLabel1.setPreferredSize(new java.awt.Dimension(150,15));
|
|
254 |
jLabel1.setSize(new java.awt.Dimension(160,15));
|
|
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));
|
|
255 | 283 |
GridBagConstraints gridBagConstraints10 = new GridBagConstraints(); |
256 | 284 |
gridBagConstraints10.gridx = 0; |
257 | 285 |
gridBagConstraints10.insets = new java.awt.Insets(0,0,0,0); |
... | ... | |
260 | 288 |
jPanel1.setLayout(new GridBagLayout()); |
261 | 289 |
jPanel1.setPreferredSize(new java.awt.Dimension(180,25)); |
262 | 290 |
jPanel1.add(getJCheckBox1(), gridBagConstraints10); |
263 |
jPanel1.add(jLabel1, gridBagConstraints19);
|
|
291 |
jPanel1.add(lpreview, gridBagConstraints19);
|
|
264 | 292 |
} |
265 | 293 |
return jPanel1; |
266 | 294 |
} |
... | ... | |
297 | 325 |
lLineal.setPreferredSize(new java.awt.Dimension(160,15)); |
298 | 326 |
pEnCheck = new JPanel(); |
299 | 327 |
pEnCheck.setLayout(new GridBagLayout()); |
300 |
pEnCheck.setPreferredSize(new java.awt.Dimension(190,25));
|
|
328 |
pEnCheck.setPreferredSize(new java.awt.Dimension(182,25));
|
|
301 | 329 |
pEnCheck.add(getCEnhanced(), gridBagConstraints13); |
302 | 330 |
pEnCheck.add(lLineal, gridBagConstraints14); |
303 | 331 |
} |
... | ... | |
321 | 349 |
gridBagConstraints15.gridx = 0; |
322 | 350 |
pEnSlider = new JPanel(); |
323 | 351 |
pEnSlider.setLayout(new GridBagLayout()); |
324 |
pEnSlider.setPreferredSize(new java.awt.Dimension(190,100));
|
|
352 |
pEnSlider.setPreferredSize(new java.awt.Dimension(188,100));
|
|
325 | 353 |
pEnSlider.setBorder(javax.swing.BorderFactory.createLineBorder(java.awt.Color.gray,1)); |
326 | 354 |
pEnSlider.add(getPDelInt(), gridBagConstraints15); |
327 | 355 |
pEnSlider.add(getCheckSliderText(), gridBagConstraints18); |
... | ... | |
380 | 408 |
return jCheckBox; |
381 | 409 |
} |
382 | 410 |
|
411 |
/** |
|
412 |
* inicializa el conponente CheckSliderText |
|
413 |
*/ |
|
383 | 414 |
public CheckSliderText getCheckSliderText(){ |
384 | 415 |
String rcName = "Recorte de colas"; |
385 | 416 |
if (cstEnhanced == null){ |
... | ... | |
387 | 418 |
cstEnhanced.setName(rcName); |
388 | 419 |
cstEnhanced.setSliderValue(0); |
389 | 420 |
cstEnhanced.setSliderRange(0,50); |
421 |
cstEnhanced.setDecimal(true); |
|
390 | 422 |
cstEnhanced.setTextValue("0.0"); |
391 | 423 |
|
392 | 424 |
} |
393 | 425 |
return cstEnhanced; |
394 | 426 |
} |
395 | 427 |
|
428 |
/** |
|
429 |
* Habilita o dehabilita el panel de brillo y contraste |
|
430 |
* @param active |
|
431 |
*/ |
|
396 | 432 |
public void setBCControlEnabled(boolean active){ |
397 | 433 |
this.lstBrightness.setControlEnabled(active); |
398 | 434 |
this.lstContrast.setControlEnabled(active); |
399 | 435 |
this.getJCheckBox1().setEnabled(active); |
400 |
this.jLabel1.setEnabled(active); |
|
401 |
this.lBrightC.setEnabled(active); |
|
436 |
this.lpreview.setEnabled(active); |
|
402 | 437 |
} |
403 | 438 |
|
439 |
/** |
|
440 |
* Habilita o dehabilita el panel de realce |
|
441 |
* @param active |
|
442 |
*/ |
|
404 | 443 |
public void setEControlEnabled(boolean active){ |
405 | 444 |
this.jCheckBox.setEnabled(active); |
406 | 445 |
this.lRemove.setEnabled(active); |
407 |
this.cstEnhanced.setControlEnabled(active); |
|
408 |
this.lLineal.setEnabled(active); |
|
446 |
this.cstEnhanced.setControlEnabled(active); |
|
409 | 447 |
} |
410 | 448 |
|
411 | 449 |
|
... | ... | |
416 | 454 |
if(e.getSource() == cEnhanced){ |
417 | 455 |
this.setEControlEnabled(this.getCEnhanced().isSelected()); |
418 | 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 |
} |
|
419 | 467 |
} |
420 | 468 |
|
469 |
/** |
|
470 |
* Asigna a este panel un stack manager |
|
471 |
* @param p |
|
472 |
*/ |
|
421 | 473 |
public void setBrightnessContrastStackManager (BrightnessContrastStackManager p){ |
422 | 474 |
this.bcManager = p; |
423 | 475 |
} |
424 | 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 |
*/ |
|
425 | 484 |
private void processBrightnessContrastPanel(RasterFilterStackManager stackManager, PropertiesRasterDialog propsDialog, FLyrRaster layer){ |
426 | 485 |
EnhancedBrightnessContrastPanel ebcPanel = (EnhancedBrightnessContrastPanel)((FilterRasterDialogPanel)propsDialog.getContentPane()).getPanelByClassName("EnhancedBrightnessContrastPanel"); |
427 | 486 |
// Si est? activo el panel de brillo y contraste tomamos los valores y cargamos un filtro de |
... | ... | |
430 | 489 |
if(ebcPanel.getCBrightC().isSelected()){ |
431 | 490 |
int incrBrillo = (int)Math.round(Double.valueOf(ebcPanel.lstBrightness.getTextValue()).doubleValue()); |
432 | 491 |
int incrContraste = (int)Math.round(Double.valueOf(ebcPanel.lstContrast.getTextValue()).doubleValue()); |
433 |
bcManager.addHistogramFilter(); |
|
434 | 492 |
bcManager.addBrightnessFilter(incrBrillo); |
435 | 493 |
bcManager.addContrastFilter(incrContraste); |
436 | 494 |
}else{ |
437 |
stackManager.removeFilter(bcManager.histogram); |
|
438 | 495 |
stackManager.removeFilter(bcManager.brightness); |
439 | 496 |
stackManager.removeFilter(bcManager.contrast); |
440 | 497 |
} |
... | ... | |
456 | 513 |
|
457 | 514 |
//Filtro de realce lineal seleccionado |
458 | 515 |
if(ebcPanel.getCEnhanced().isSelected()){ |
459 |
if((ebcPanel.getJCheckBox().isSelected()) && (!ebcPanel.getCheckSliderText().isSelected())) |
|
516 |
if((ebcPanel.getJCheckBox().isSelected()) && (!ebcPanel.getCheckSliderText().getJCheckBox().isSelected()))
|
|
460 | 517 |
stackManager.addEnhancedFilter(true, fLayer.getSource().getFiles()[0].getName()); |
461 | 518 |
else |
462 | 519 |
stackManager.addEnhancedFilter(false, fLayer.getSource().getFiles()[0].getName()); |
463 | 520 |
|
464 | 521 |
//Recorte de colas seleccionado |
465 |
if(ebcPanel.getCheckSliderText().isSelected()){ |
|
522 |
if(ebcPanel.getCheckSliderText().getJCheckBox().isSelected()){
|
|
466 | 523 |
stackManager.removeFilter(stackManager.getTypeFilter("computeminmax")); |
467 | 524 |
double recorte = Double.parseDouble(ebcPanel.getCheckSliderText().getTextValue())/100; |
468 | 525 |
if(ebcPanel.getJCheckBox().isSelected()) |
... | ... | |
554 | 611 |
|
555 | 612 |
} |
556 | 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 |
*/ |
|
557 | 619 |
public void mouseReleased(MouseEvent e) { |
558 | 620 |
if (((e.getSource() == this.lstBrightness.getJSlider()) || |
559 | 621 |
(e.getSource() == this.lstContrast.getJSlider())) && |
... | ... | |
569 | 631 |
if(e.getSource() == this.getCheckSliderText().getJTextField()){ |
570 | 632 |
this.getCheckSliderText().getJSlider().setValue((int) Math.round(Double.valueOf(this.getCheckSliderText().getTextValue()).doubleValue())); |
571 | 633 |
} |
572 |
|
|
573 | 634 |
} |
574 |
|
|
635 |
|
|
575 | 636 |
public void keyReleased(KeyEvent e) { |
576 | 637 |
// TODO Auto-generated method stub |
577 | 638 |
|
578 | 639 |
} |
579 | 640 |
|
580 | 641 |
public void keyTyped(KeyEvent e) { |
581 |
// TODO Auto-generated method stub |
|
582 | 642 |
|
583 | 643 |
} |
644 |
} |
|
584 | 645 |
|
585 |
} |
Also available in: Unified diff