svn-gvsig-desktop / trunk / libraries / libRaster / src / org / gvsig / raster / grid / filter / enhancement / LinearEnhancementIntegerFilter.java @ 19494
History | View | Annotate | Download (2.16 KB)
1 | 11964 | bsanchez | /* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
---|---|---|---|
2 | *
|
||
3 | * Copyright (C) 2006 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.enhancement; |
||
20 | |||
21 | import org.gvsig.raster.dataset.IBuffer; |
||
22 | /**
|
||
23 | * Filtro de realce para tipos de datos int. En el m?todo de proceso procesa
|
||
24 | * un solo pixel int. Asigna su valor en relaci?n a los datos calculados en el
|
||
25 | * m?todo pre() del padre.
|
||
26 | *
|
||
27 | * @version 11/05/2007
|
||
28 | * @author Nacho Brodin (nachobrodin@gmail.com)
|
||
29 | */
|
||
30 | public class LinearEnhancementIntegerFilter extends LinearEnhancementFilter { |
||
31 | |||
32 | 12008 | bsanchez | /*
|
33 | * (non-Javadoc)
|
||
34 | * @see org.gvsig.raster.grid.filter.enhancement.LinearEnhancementFilter#process(int, int)
|
||
35 | */
|
||
36 | 11964 | bsanchez | public void process(int col, int line) { |
37 | 12535 | nacho | for (int iBand = 0; iBand < raster.getBandCount(); iBand++) { |
38 | 11964 | bsanchez | int p = raster.getElemInt(line, col, iBand);
|
39 | 12474 | nacho | if(renderBands[iBand] < 0) { |
40 | rasterResult.setElem(line, col, iBand, (byte)p);
|
||
41 | continue;
|
||
42 | } |
||
43 | if (p > maxBandValue[renderBands[iBand]])
|
||
44 | p = (int) maxBandValue[renderBands[iBand]];
|
||
45 | else if (p < minBandValue[renderBands[iBand]]) |
||
46 | p = (int) minBandValue[renderBands[iBand]];
|
||
47 | 11964 | bsanchez | |
48 | 12474 | nacho | p = (int) (((int) ((p * scale[renderBands[iBand]]) + offset[renderBands[iBand]])) & 0xff); |
49 | 11964 | bsanchez | rasterResult.setElem(line, col, iBand, (byte) p);
|
50 | } |
||
51 | } |
||
52 | |||
53 | /*
|
||
54 | * (non-Javadoc)
|
||
55 | * @see org.gvsig.raster.grid.filter.enhancement.LinearEnhancementFilter#getInRasterDataType()
|
||
56 | */
|
||
57 | public int getInRasterDataType() { |
||
58 | return IBuffer.TYPE_INT;
|
||
59 | } |
||
60 | } |