Statistics
| Revision:

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

History | View | Annotate | Download (3.31 KB)

1
/* 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
         * (non-Javadoc)
68
         * @see org.gvsig.raster.grid.filter.RasterFilter#getGroup()
69
         */
70
        public String getGroup() {
71
                return "basics";
72
        }
73

    
74
        public String[] getNames() {
75
                return names;
76
        }
77

    
78
        /*
79
         * (non-Javadoc)
80
         * @see org.gvsig.raster.grid.filter.RasterFilter#getResult(java.lang.String)
81
         */
82
        public Object getResult(String name) {
83
                if (name.equals("raster"))
84
                        return (Object) this.rasterResult;
85
                return null;
86
        }
87

    
88
        /*
89
         * (non-Javadoc)
90
         * @see org.gvsig.raster.grid.filter.RasterFilter#getUIParams(java.lang.String)
91
         */
92
        public Params getUIParams(String nameFilter) {
93
                Params params = new Params();
94
                params.setParam("colorTable",
95
                                colorTable,
96
                                -1,
97
                                null);
98
                return params;
99
        }
100

    
101
        public void post() {
102
                // En caso de que nadie apunte a raster, se liberar? su memoria.
103
                raster = null;
104
        }
105

    
106
        public void process(int x, int y) {
107
        }
108

    
109
        /*
110
         * (non-Javadoc)
111
         * @see org.gvsig.raster.grid.filter.RasterFilter#getInRasterDataType()
112
         */
113
        public int getInRasterDataType() {
114
                return IBuffer.TYPE_UNDEFINED;
115
        }
116

    
117
        /*
118
         * (non-Javadoc)
119
         * @see org.gvsig.raster.grid.filter.RasterFilter#getOutRasterDataType()
120
         */
121
        public int getOutRasterDataType() {
122
                return IBuffer.TYPE_UNDEFINED;
123
        }
124

    
125
        /*
126
         * (non-Javadoc)
127
         * @see org.gvsig.raster.grid.filter.RasterFilter#isVisible()
128
         */
129
        public boolean isVisible() {
130
                return false;
131
        }
132
}