Revision 17884 trunk/libraries/libRaster/src/org/gvsig/raster/grid/filter/bands/NoDataIntegerFilter.java

View differences:

NoDataIntegerFilter.java
26 26
 * @author BorSanZa - Borja S?nchez Zamorano (borja.sanchez@iver.es)
27 27
 */
28 28
public class NoDataIntegerFilter extends NoDataFilter {
29

  
29 30
	/*
30 31
	 * (non-Javadoc)
31
	 * @see org.gvsig.raster.grid.filter.bands.ColorTableFilter#process(int, int)
32
	 * @see org.gvsig.raster.grid.filter.bands.NoDataFilter#hasNoData(int, int)
32 33
	 */
33
	public void process(int col, int line) {
34
		byte alpha = (byte) 255;
35
		for (int band = 0; band < raster.getBandCount(); band++) {
36
			double value = (double) raster.getElemInt(line, col, band);
37
			if (noDataValue == value) {
38
				alpha = 0;
39
				break;
40
			}
41
		}
42
		rasterAlpha.setElem(line, col, 0, alpha);
34
	public boolean hasNoData(int col, int line) {
35
		int data[] = new int[raster.getBandCount()];
36
		raster.getElemInt(line, col, data);
37
		for (int band = 0; band < data.length; band++)
38
			if (noDataValue == (double) data[band])
39
				return true;
40
		return false;
43 41
	}
44 42

  
45 43
	/*
46 44
	 * (non-Javadoc)
45
	 * @see org.gvsig.raster.grid.filter.bands.NoDataFilter#writeNoData(int, int)
46
	 */
47
	public void writeNoData(int col, int line) {
48
		for (int band = 0; band < raster.getBandCount(); band++)
49
			raster.setElem(line, col, band, (int) noDataValue);
50
	}
51

  
52
	/*
53
	 * (non-Javadoc)
47 54
	 * @see org.gvsig.raster.grid.filter.bands.ColorTableFilter#getInRasterDataType()
48 55
	 */
49 56
	public int getInRasterDataType() {

Also available in: Unified diff