Revision 1534
branches/v02_desarrollo/libraries/libCq CMS for java.old/src-dvp/org/cresques/io/GdalFile.java | ||
---|---|---|
207 | 207 |
|
208 | 208 |
int lastY = -1; |
209 | 209 |
|
210 |
public void readLine(short[][] line) throws GdalException {
|
|
210 |
public void readLine(int[][] line) throws GdalException {
|
|
211 | 211 |
int err = 0; |
212 | 212 |
int nbands = getRasterCount(); |
213 | 213 |
GdalRasterBand band = null; |
... | ... | |
237 | 237 |
}*/ |
238 | 238 |
for (int k=0; k<3; k++) |
239 | 239 |
for (i=0, j=0F; i<currentViewWidth && j<r.getSize(); i++, j+=step) { |
240 |
line[i][k] = (short) (r.buffShort[(int) j] & 0xffff);
|
|
240 |
line[i][k] = (r.buffShort[(int) j] & 0xffff); |
|
241 | 241 |
} |
242 | 242 |
else { // Multiband |
243 | 243 |
short px; |
... | ... | |
245 | 245 |
GdalBuffer [] bands = {r,g,b}; |
246 | 246 |
for (int k=0; k<3; k++) |
247 | 247 |
for (i=0, j=0F; i<currentViewWidth && j<r.getSize(); i++, j+=step) |
248 |
line[i][k] = (short) (bands[k].buffShort[(int) j] & 0xffff);
|
|
248 |
line[i][k] = (bands[k].buffShort[(int) j] & 0xffff); |
|
249 | 249 |
} |
250 | 250 |
return; |
251 | 251 |
} |
... | ... | |
292 | 292 |
line[i] = alpha + r.buffShort[(int) j]; |
293 | 293 |
} |
294 | 294 |
else { // Multiband |
295 |
System.err.println("Raster 16bits multibanda"); |
|
295 |
// System.err.println("Raster 16bits multibanda");
|
|
296 | 296 |
for (i=0, j=0F; i<currentViewWidth && j<r.getSize(); i++, j+=step) { |
297 | 297 |
line[i] = alpha | (((r.buffShort[(int) j] & 0xfff0) << 12) & 0xff0000 ) | |
298 | 298 |
(((g.buffShort[(int) j] & 0xfff0) << 4 ) & 0xff00 ) | |
... | ... | |
522 | 522 |
file.setView(v.minX(), v.maxY(), v.maxX(), v.minY(), |
523 | 523 |
width, height); |
524 | 524 |
|
525 |
raster = new RasterBuf(getDataType(), width, height, 3, new Point(0,0));
|
|
525 |
raster = new RasterBuf(DataBuffer.TYPE_INT, width, height, 3, new Point(0,0));
|
|
526 | 526 |
try { |
527 | 527 |
//int nLin = height % BAND_HEIGHT; |
528 | 528 |
file.setAlpha(getAlpha()); |
... | ... | |
530 | 530 |
setBand(GREEN_BAND, gBandNr); |
531 | 531 |
setBand(BLUE_BAND, bBandNr); |
532 | 532 |
for (line=0; line < height; line++) { //+=BAND_HEIGHT) { |
533 |
file.readLine(raster.getLineShort(line));
|
|
533 |
file.readLine(raster.getLineInt(line));
|
|
534 | 534 |
} |
535 | 535 |
} catch (Exception e) { |
536 | 536 |
// TODO Auto-generated catch block |
branches/v02_desarrollo/libraries/libCq CMS for java.old/src/org/cresques/px/PxRaster.java | ||
---|---|---|
375 | 375 |
} |
376 | 376 |
|
377 | 377 |
public void process(int x, int y) { |
378 |
raster.getPixelShort(x, y, px);
|
|
378 |
raster.getPixelInt(x, y, px);
|
|
379 | 379 |
for (int i=0; i<3; i++) { |
380 | 380 |
min[i] = Math.min(min[i], px[i]); |
381 | 381 |
max[i] = Math.max(max[i], px[i]); |
... | ... | |
404 | 404 |
} |
405 | 405 |
|
406 | 406 |
public void process(int x, int y) { |
407 |
raster.getPixelShort(x, y, px);
|
|
407 |
raster.getPixelInt(x, y, px);
|
|
408 | 408 |
px[0] = (((int) (((double)px[0])*scale[0] + offset[0])) & 0xff); |
409 | 409 |
px[1] = (((int) (((double)px[1])*scale[1] + offset[1])) & 0xff); |
410 | 410 |
px[2] = (((int) (((double)px[2])*scale[2] + offset[2])) & 0xff); |
411 |
raster.setPixelShort(x, y, px);
|
|
411 |
raster.setPixelInt(x, y, px);
|
|
412 | 412 |
} |
413 | 413 |
} |
414 | 414 |
|
... | ... | |
432 | 432 |
* @see org.cresques.px.PxRaster.RasterFilter#process(int, int) |
433 | 433 |
*/ |
434 | 434 |
public void process(int x, int y) { |
435 |
raster.getPixelShort(x, y, px);
|
|
435 |
raster.getPixelInt(x, y, px);
|
|
436 | 436 |
rgb = alpha | ((px[0] & 0xff) << 16) | |
437 | 437 |
((px[1] & 0xff) << 8) | (px[2] & 0xff); |
438 | 438 |
|
... | ... | |
450 | 450 |
maxBandValue[i] = filter.getMax(i); |
451 | 451 |
} |
452 | 452 |
|
453 |
LinearEnhancementFilter lEFilter = |
|
454 |
new LinearEnhancementFilter(raster, minBandValue, maxBandValue); |
|
453 |
if (true) { |
|
454 |
LinearEnhancementFilter lEFilter = |
|
455 |
new LinearEnhancementFilter(raster, minBandValue, maxBandValue); |
|
456 |
} |
|
455 | 457 |
|
456 | 458 |
Image image = new RasterToImageFilter(raster, getAlpha()).getImage(); |
457 | 459 |
|
Also available in: Unified diff