svn-gvsig-desktop / trunk / libraries / libRaster / src / org / gvsig / raster / grid / filter / bands / ColorTableFloatFilter.java @ 12066
History | View | Annotate | Download (2.11 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 |
|
24 |
/**
|
25 |
* Filtro de tabla de color para tipo de datos float.
|
26 |
*
|
27 |
* @version 06/06/2007
|
28 |
* @author Nacho Brodin (nachobrodin@gmail.com)
|
29 |
*
|
30 |
*/
|
31 |
public class ColorTableFloatFilter extends ColorTableFilter { |
32 |
|
33 |
/*
|
34 |
* (non-Javadoc)
|
35 |
* @see org.gvsig.raster.grid.filter.bands.ColorTableFilter#pre()
|
36 |
*/
|
37 |
public void pre() { |
38 |
super.pre();
|
39 |
rasterResult = RasterBuffer.getBuffer(IBuffer.TYPE_FLOAT, raster.getWidth(), raster.getHeight(), 4, true); |
40 |
} |
41 |
|
42 |
/*
|
43 |
* (non-Javadoc)
|
44 |
* @see org.gvsig.raster.grid.filter.bands.ColorTableFilter#process(int, int)
|
45 |
*/
|
46 |
public void process(int col, int line) { |
47 |
double value = (double)raster.getElemFloat(line, col, 0); |
48 |
byte[] rgb = colorTable.getRGBByBand(value); |
49 |
rasterResult.setElemByte(line, col, rgb); |
50 |
} |
51 |
|
52 |
/**
|
53 |
* Constructor.
|
54 |
*/
|
55 |
public ColorTableFloatFilter() {
|
56 |
super();
|
57 |
} |
58 |
|
59 |
/*
|
60 |
* (non-Javadoc)
|
61 |
* @see org.gvsig.raster.grid.filter.RasterFilter#getInRasterDataType()
|
62 |
*/
|
63 |
public int getInRasterDataType() { |
64 |
return IBuffer.TYPE_FLOAT;
|
65 |
} |
66 |
|
67 |
/*
|
68 |
* (non-Javadoc)
|
69 |
* @see org.gvsig.raster.grid.filter.RasterFilter#getOutRasterDataType()
|
70 |
*/
|
71 |
public int getOutRasterDataType() { |
72 |
return IBuffer.TYPE_BYTE;
|
73 |
} |
74 |
|
75 |
} |