Revision 25523 trunk/extensions/extRemoteSensing/src/org/gvsig/remotesensing/RemoteSensingUtils.java
RemoteSensingUtils.java | ||
---|---|---|
43 | 43 |
import java.util.ArrayList; |
44 | 44 |
|
45 | 45 |
import org.gvsig.fmap.raster.layers.FLyrRasterSE; |
46 |
import org.gvsig.raster.buffer.RasterBuffer; |
|
47 |
import org.gvsig.raster.dataset.IBuffer; |
|
46 | 48 |
import org.gvsig.raster.datastruct.ColorTable; |
47 | 49 |
import org.gvsig.raster.grid.GridPalette; |
48 | 50 |
import org.gvsig.raster.grid.filter.FilterTypeException; |
... | ... | |
101 | 103 |
} |
102 | 104 |
} |
103 | 105 |
|
104 |
|
|
106 |
public static double getCellValueInLayerCoords(IBuffer buffer, int x, int y, int band) { |
|
107 |
int iType = buffer.getDataType(); |
|
105 | 108 |
|
109 |
if (iType == RasterBuffer.TYPE_DOUBLE) { |
|
110 |
return buffer.getElemDouble(y, x, band); |
|
111 |
} else if (iType == RasterBuffer.TYPE_INT) { |
|
112 |
return (double) buffer.getElemInt(y, x, band); |
|
113 |
} else if (iType == RasterBuffer.TYPE_FLOAT) { |
|
114 |
return (double) buffer.getElemFloat(y, x, band); |
|
115 |
} else if (iType == RasterBuffer.TYPE_BYTE) { |
|
116 |
return (double) (buffer.getElemByte(y, x, band) & 0xff); |
|
117 |
} else if ((iType == RasterBuffer.TYPE_SHORT) | (iType == RasterBuffer.TYPE_USHORT)) { |
|
118 |
return (double) buffer.getElemShort(y, x, band); |
|
119 |
} |
|
120 |
|
|
121 |
return buffer.getNoDataValue(); |
|
122 |
} |
|
106 | 123 |
} |
Also available in: Unified diff