Statistics
| Revision:

root / trunk / extensions / extRasterTools-SE / src / org / gvsig / rastertools / vectorizacion / filter / GrayConversionData.java @ 27442

History | View | Annotate | Download (6.95 KB)

1 21579 nbrodin
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2007 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 22398 nbrodin
package org.gvsig.rastertools.vectorizacion.filter;
20 21579 nbrodin
21
import java.util.Observable;
22
23 21859 nbrodin
import org.gvsig.raster.filter.grayscale.GrayScaleFilter;
24
25 21579 nbrodin
/**
26
 * Datos asociados al panel GrayConversionPanel
27
 *
28
 * 12/06/2008
29
 * @author Nacho Brodin nachobrodin@gmail.com
30
 */
31
public class GrayConversionData extends Observable {
32 21859 nbrodin
        private String[]   bands                  = {"R", "G" , "B", "RGB"};
33
        private int        bandType               = GrayScaleFilter.GRAY;
34 22578 nbrodin
35 21859 nbrodin
        private int        posterizationLevels    = 2;
36 22578 nbrodin
        private boolean    posterizationActive    = true;
37
        private int        posterizationThreshold = 127;
38 21785 nbrodin
39 21859 nbrodin
        private boolean    highPassActive         = false;
40
        private int        radiusHighPass         = 0;
41
42 22578 nbrodin
        private boolean    noiseActive            = false;
43 22429 nbrodin
        private int        noiseThreshold         = 1;
44
45 22578 nbrodin
        private boolean    modeActive            = false;
46
        private int        modeThreshold         = 2;
47
48 21785 nbrodin
        /**
49 22578 nbrodin
         * Consulta si est? activo el filtro de ruido
50
         * @param true si est? activo y false si no lo est?
51
         */
52
        public boolean isNoiseActive() {
53
                return noiseActive;
54
        }
55
56
        /**
57
         * Asigna si est? activo el filtro de ruido
58
         * @return true si est? activo y false si no lo est?
59
         */
60
        public void setNoiseActive(boolean noiseActive) {
61
                this.noiseActive = noiseActive;
62
                updateObservers();
63
        }
64
65
        /**
66 22429 nbrodin
         * Obtiene el umbral para el filtro de reducci?n de ruido
67
         * @return Entero con el valor del umbral. El umbral es el lado de la ventana
68
         * de p?xeles a analizar.
69
         */
70
        public int getNoiseThreshold() {
71
                return noiseThreshold;
72
        }
73
74
        /**
75
         * Asigna el umbral para el filtro de reducci?n de ruido
76
         * @param Entero con el valor del umbral. El umbral es el lado de la ventana
77
         * de p?xeles a analizar.
78
         */
79
        public void setNoiseThreshold(int noiseThreshold) {
80
                this.noiseThreshold = noiseThreshold;
81
                updateObservers();
82
        }
83 22578 nbrodin
84
        /**
85
         * Consulta si est? activo el filtro de moda
86
         * @param true si est? activo y false si no lo est?
87
         */
88
        public boolean isModeActive() {
89
                return modeActive;
90
        }
91 22429 nbrodin
92
        /**
93 22578 nbrodin
         * Asigna si est? activo el filtro de moda
94
         * @return true si est? activo y false si no lo est?
95
         */
96
        public void setModeActive(boolean modeActive) {
97
                this.modeActive = modeActive;
98
                updateObservers();
99
        }
100
101
        /**
102
         * Obtiene el umbral para el filtro de moda
103
         * @return Entero con el valor del umbral. El umbral es el lado de la ventana
104
         * de p?xeles a analizar.
105
         */
106
        public int getModeThreshold() {
107
                return modeThreshold;
108
        }
109
110
        /**
111
         * Asigna el umbral para el filtro de moda
112
         * @param Entero con el valor del umbral. El umbral es el lado de la ventana
113
         * de p?xeles a analizar.
114
         */
115
        public void setModeThreshold(int modeThreshold) {
116
                this.modeThreshold = modeThreshold;
117
                updateObservers();
118
        }
119
120
        /**
121 21785 nbrodin
         * Consulta los niveles de posterizaci?n
122
         * @return
123
         */
124
        public int getPosterizationLevels() {
125
                return posterizationLevels;
126
        }
127 21579 nbrodin
128 21785 nbrodin
        /**
129
         * Asigna los niveles de posterizaci?n
130
         * @param posterizationLevels
131
         */
132
        public void setPosterizationLevels(int posterizationLevels) {
133
                this.posterizationLevels = posterizationLevels;
134
                updateObservers();
135
        }
136
137
        /**
138
         * Obtiene el texto del desplegable de bandas. Este depende del n?mero de bandas
139
         * del raster de origen.
140
         * @return Lista de textos con la interpretaci?n de las bandas con las que se har? la
141
         * posterizaci?n
142
         */
143
        public String[] getBands() {
144
                return bands;
145
        }
146
147
        /**
148
         * Asigna el texto del desplegable de bandas. Este depende del n?mero de bandas
149
         * del raster de origen.
150
         * @param Lista de textos con la interpretaci?n de las bandas con las que se har? la
151
         * posterizaci?n
152
         */
153
        public void setBands(String[] bands) {
154
                this.bands = bands;
155
                updateObservers();
156
        }
157
158
        /**
159 21859 nbrodin
         * Consulta si est? activo el filtro de paso alto
160
         * @return true si est? activo y false si no lo est?
161
         */
162
        public boolean isHighPassActive() {
163
                return highPassActive;
164
        }
165
166
        /**
167
         * Asigna si est? activo el filtro de paso alto
168
         * @param true si est? activo y false si no lo est?
169
         */
170
        public void setHighPassActive(boolean highPassActive) {
171
                this.highPassActive = highPassActive;
172
                updateObservers();
173
        }
174
175
        /**
176
         * Consulta si est? activa la posterizaci?n
177
         * @return true si est? activa y false si no lo est?
178
         */
179
        public boolean isPosterizationActive() {
180
                return posterizationActive;
181
        }
182
183
        /**
184
         * Asigna si est? activa la posterizaci?n
185
         * @return true si est? activo y false si no lo est?
186
         */
187
        public void setPosterizationActive(boolean posterizationActive) {
188
                this.posterizationActive = posterizationActive;
189
                updateObservers();
190
        }
191
192
        /**
193
         * Consulta el tipo de banda asignado
194
         * @return Entero con el tipo de banda. Debe corresponder a una constante
195
         * definida en la clase GrayScaleFilter
196
         */
197
        public int getBandType() {
198
                return bandType;
199
        }
200
201
        /**
202
         * Asigna el tipo de banda asignado
203
         * @param Entero con el tipo de banda. Debe corresponder a una constante
204
         * definida en la clase GrayScaleFilter
205
         */
206
        public void setBandType(int bandType) {
207
                this.bandType = bandType;
208
                updateObservers();
209
        }
210
211
        /**
212 21904 nbrodin
         * Obtiene el n?mero de banda a partir del tipo de interpretaci?n
213
         * @return
214
         */
215
        public int getBandFromBandType() {
216
                switch (bandType) {
217
                case GrayScaleFilter.R:
218
                case GrayScaleFilter.GRAY:        return 0;
219
                case GrayScaleFilter.G:        return 1;
220
                case GrayScaleFilter.B:        return 2;
221
                case GrayScaleFilter.RGB: return 3;
222
                }
223
                return -1;
224
        }
225
226
        /**
227 21859 nbrodin
         * Asigna el valor del umbral de la posterizaci?n
228
         * @param posterizationThreshold
229
         */
230
        public void setPosterizationThreshold(int posterizationThreshold) {
231
                this.posterizationThreshold = posterizationThreshold;
232 21904 nbrodin
                updateObservers();
233 21859 nbrodin
        }
234
235
        /**
236
         * Obtener el valor del umbral de la posterizaci?n
237
         * @param posterizationThreshold
238
         */
239
        public int getPosterizationThreshold() {
240
                return posterizationThreshold;
241
        }
242
243
        /**
244
         * Asigna el valor del radio del filtro de paso alto
245
         * @param radiusHighPass
246
         */
247
        public void setRadiusHighPass(int radiusHighPass) {
248
                this.radiusHighPass = radiusHighPass;
249 22429 nbrodin
                updateObservers();
250 21859 nbrodin
        }
251
252
        /**
253
         * Obtiene el valor del radio del filtro de paso alto
254
         * @return radiusHighPass
255
         */
256
        public int getRadiusHighPass() {
257
                return this.radiusHighPass;
258
        }
259
260
        /**
261 21785 nbrodin
         * Actualiza datos y llama al update de los observadores
262
         */
263
        public void updateObservers() {
264
                setChanged();
265
                notifyObservers();
266
        }
267 21860 nbrodin
268 21579 nbrodin
}