Revision 11301 branches/v10/libraries/libCq_CMS_praster/src/org/cresques/io/MemoryRasterDriver.java
MemoryRasterDriver.java | ||
---|---|---|
214 | 214 |
writeRasterBufShort(begin, end, alpha, raster, width, height, w, h, stepX, stepY, endLine, endCol, initY, initX); |
215 | 215 |
break; |
216 | 216 |
case RasterBuf.TYPE_INT: |
217 |
//writeRasterBufInt(begin, end, alpha, raster, width, height, w, h, stepX, stepY, endLine, endCol, initY, initX);
|
|
217 |
writeRasterBufInt(begin, end, alpha, raster, width, height, w, h, stepX, stepY, endLine, endCol, initY, initX); |
|
218 | 218 |
break; |
219 | 219 |
case RasterBuf.TYPE_FLOAT: |
220 | 220 |
writeRasterBufFloat(begin, end, alpha, raster, width, height, w, h, stepX, stepY, endLine, endCol, initY, initX); |
... | ... | |
262 | 262 |
|
263 | 263 |
} |
264 | 264 |
|
265 |
private void writeRasterBufInt(Point2D begin, Point2D end, int alpha, RasterBuf rb, int widthImg, int heightImg, |
|
266 |
double w, double h, double stepX, double stepY, int endLine, int endCol, double l, double initX){ |
|
267 |
int[][][] pRGBArray = new int[4][(int)Math.ceil(h) + 1][(int)Math.ceil(w) + 1]; |
|
268 |
|
|
269 |
int x = 0, y = 0; |
|
270 |
for (int line = (int)begin.getY(); line < endLine ; line ++) { |
|
271 |
x = 0; |
|
272 |
for (int col = (int)begin.getX(); col < endCol; col ++){ |
|
273 |
pRGBArray[0][y][x] = buf.getElemInt(line, col, rBandNr); |
|
274 |
pRGBArray[1][y][x] = buf.getElemInt(line, col, gBandNr); |
|
275 |
pRGBArray[2][y][x] = buf.getElemInt(line, col, bBandNr); |
|
276 |
pRGBArray[3][y][x] = (short)alpha; |
|
277 |
x ++; |
|
278 |
} |
|
279 |
y ++; |
|
280 |
} |
|
281 |
for (int line = 0; line < heightImg; line ++) { |
|
282 |
double c = initX; |
|
283 |
for (int col = 0; col < widthImg; col ++){ |
|
284 |
try{ |
|
285 |
for(int band = 0; band < 4; band ++) |
|
286 |
rb.setElemInt(line, col, band, pRGBArray[band][(int)l][(int)c]); |
|
287 |
}catch(ArrayIndexOutOfBoundsException e){} |
|
288 |
c += stepX; |
|
289 |
} |
|
290 |
l += stepY; |
|
291 |
} |
|
292 |
|
|
293 |
} |
|
294 |
|
|
265 | 295 |
private void writeRasterBufFloat(Point2D begin, Point2D end, int alpha, RasterBuf rb, int widthImg, int heightImg, |
266 | 296 |
double w, double h, double stepX, double stepY, int endLine, int endCol, double l, double initX){ |
267 | 297 |
float[][][] pRGBArray = new float[4][(int)Math.ceil(h) + 1][(int)Math.ceil(w) + 1]; |
Also available in: Unified diff