Statistics
| Revision:

root / trunk / libraries / libRaster / src / org / gvsig / raster / grid / filter / bands / ColorTableFilter.java @ 12167

History | View | Annotate | Download (3.09 KB)

1 12066 nacho
/* 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
package org.gvsig.raster.grid.filter.bands;
20
21
import org.gvsig.raster.buffer.RasterBuffer;
22
import org.gvsig.raster.dataset.IBuffer;
23
import org.gvsig.raster.dataset.Params;
24
import org.gvsig.raster.grid.GridPalette;
25
import org.gvsig.raster.grid.filter.RasterFilter;
26
27
/**
28
 * <P>
29
 * Clase base para los filtros de tabla de color. Siempre gastar? la banda cero
30
 * del raster para aplicar el filtro ya que la aplicaci?n de tablas suele tener
31
 * sentido solo en raster de una sola banda.
32
 * </P>
33
 * <P>
34
 * La salida siempre es un ARGB.
35
 * </P>
36
 *
37
 * @version 06/06/2007
38
 * @author Nacho Brodin (nachobrodin@gmail.com)
39
 *
40
 */
41
public class ColorTableFilter extends RasterFilter {
42
        protected IBuffer rasterResult = null;
43
        public static String[] names = new String[] {"colortable"};
44
        protected GridPalette colorTable = null;
45
46
        /**
47
         * Constructor
48
         */
49
        public ColorTableFilter() {
50
                super();
51
                setName(names[0]);
52
        }
53
54
        /*
55
         * (non-Javadoc)
56
         * @see org.gvsig.raster.grid.filter.RasterFilter#pre()
57
         */
58
        public void pre() {
59
                exec = true;
60
                raster = (RasterBuffer) params.get("raster");
61
                height = raster.getHeight();
62
                width = raster.getWidth();
63
                colorTable = ((GridPalette) params.get("colorTable"));
64
65
        }
66
67
        /*
68
         * (non-Javadoc)
69
         * @see org.gvsig.raster.grid.filter.RasterFilter#getGroup()
70
         */
71
        public String getGroup() {
72
                return "basics";
73
        }
74
75
        public String[] getNames() {
76
                return names;
77
        }
78
79
        /*
80
         * (non-Javadoc)
81
         * @see org.gvsig.raster.grid.filter.RasterFilter#getResult(java.lang.String)
82
         */
83
        public Object getResult(String name) {
84
                if (name.equals("raster"))
85
                        return (Object) this.rasterResult;
86
                return null;
87
        }
88
89
        /*
90
         * (non-Javadoc)
91
         * @see org.gvsig.raster.grid.filter.RasterFilter#getUIParams(java.lang.String)
92
         */
93
        public Params getUIParams(String nameFilter) {
94
                return new Params();
95
        }
96
97
        public void post() {
98
                // En caso de que nadie apunte a raster, se liberar? su memoria.
99
                raster = null;
100
        }
101
102
        public void process(int x, int y) {
103
        }
104
105
        /*
106
         * (non-Javadoc)
107
         * @see org.gvsig.raster.grid.filter.RasterFilter#getInRasterDataType()
108
         */
109
        public int getInRasterDataType() {
110
                return IBuffer.TYPE_UNDEFINED;
111
        }
112
113
        /*
114
         * (non-Javadoc)
115
         * @see org.gvsig.raster.grid.filter.RasterFilter#getOutRasterDataType()
116
         */
117
        public int getOutRasterDataType() {
118
                return IBuffer.TYPE_UNDEFINED;
119
        }
120
121
}