Revision 11960 trunk/libraries/libRaster/src/org/gvsig/raster/dataset/io/ErmapperWriter.java
ErmapperWriter.java | ||
---|---|---|
325 | 325 |
e.printStackTrace(); |
326 | 326 |
} |
327 | 327 |
} |
328 |
|
|
329 |
/* |
|
330 |
* (non-Javadoc) |
|
331 |
* @see org.gvsig.raster.dataset.GeoRasterWriter#getDriverExtensionsByDataType(java.lang.String) |
|
332 |
*/ |
|
333 |
public String[] getDriverExtensionsByDataType(int dataType) { |
|
334 |
switch(dataType) { |
|
335 |
case IBuffer.TYPE_BYTE: return new String[]{"jp2"}; |
|
336 |
case IBuffer.TYPE_SHORT: |
|
337 |
case IBuffer.TYPE_INT: |
|
338 |
case IBuffer.TYPE_FLOAT: |
|
339 |
case IBuffer.TYPE_DOUBLE: |
|
340 |
} |
|
341 |
return null; |
|
342 |
} |
|
328 | 343 |
|
329 | 344 |
} |
330 | 345 |
|
... | ... | |
357 | 372 |
byte[] bufband5 = null; |
358 | 373 |
byte[] bufband6 = null; |
359 | 374 |
int[] dataBuffer = null; |
375 |
byte[][] byteBuffer = null; |
|
360 | 376 |
private int lineasBloqueFinal = 0; //N?mero de l?neas leidas del bloque final |
361 | 377 |
private int nBlocks = 0; //N?mero de bloques completos |
362 | 378 |
private int countBlock = 1; //Contador de bloques completos procesados |
... | ... | |
473 | 489 |
|
474 | 490 |
//si se leen bloques completos lineasLeidas es == al tama?o de bloque sino |
475 | 491 |
//es que es el ?ltimo con lo que ser? del tama?o del bloque final |
476 |
if (countBlock <= nBlocks) {
|
|
492 |
if (countBlock <= nBlocks) |
|
477 | 493 |
lineasLeidas = blockSizeRead; |
478 |
} else {
|
|
494 |
else
|
|
479 | 495 |
lineasLeidas = lineasBloqueFinal; |
480 |
} |
|
481 |
|
|
482 |
byte[][] b = null; |
|
483 |
|
|
496 |
|
|
484 | 497 |
//Leemos un bloque nuevo cuando se han procesado todas las l?neas del anterior |
485 | 498 |
if ((nNextLine % blockSizeRead) == 0) { |
486 | 499 |
if (grf != null) |
... | ... | |
489 | 502 |
if(dataType == IBuffer.TYPE_IMAGE) |
490 | 503 |
dataBuffer = dataWriter.readARGBData(width, lineasLeidas, 0); |
491 | 504 |
if(dataType == IBuffer.TYPE_BYTE) |
492 |
b = dataWriter.readByteData(width, lineasLeidas); |
|
505 |
byteBuffer = dataWriter.readByteData(width, lineasLeidas);
|
|
493 | 506 |
} |
494 | 507 |
|
495 | 508 |
countLine = 0; |
... | ... | |
499 | 512 |
if(dataType == IBuffer.TYPE_IMAGE) |
500 | 513 |
loadBufferFromImageDataType(dataBuffer); |
501 | 514 |
if(dataType == IBuffer.TYPE_BYTE) |
502 |
loadBufferFromByteDataType(b); |
|
515 |
loadBufferFromByteDataType(byteBuffer);
|
|
503 | 516 |
|
504 | 517 |
/* for (int iBand = 0; iBand < this.nBands; iBand++) { |
505 | 518 |
for (int pos = 0; pos < width; pos++) { |
... | ... | |
552 | 565 |
}*/ |
553 | 566 |
} |
554 | 567 |
|
568 |
/** |
|
569 |
* Carga el buffer de datos desde elementos de tipo entero con contenido ARGB |
|
570 |
* @param data Array de datos enteros |
|
571 |
*/ |
|
555 | 572 |
private void loadBufferFromImageDataType(int[] data) { |
556 | 573 |
for (int iBand = 0; iBand < this.nBands; iBand++) { |
557 | 574 |
for (int pos = 0; pos < width; pos++) { |
... | ... | |
575 | 592 |
} |
576 | 593 |
} |
577 | 594 |
|
595 |
/** |
|
596 |
* Carga el buffer de datos a comprimir desde un buffer byte[][] donde la primera dimensi?n |
|
597 |
* es el n?mero de bandas y la segunda los elementos en lista (Ancho X Alto) |
|
598 |
* @param b Buffer de datos de tipo byte[][] |
|
599 |
*/ |
|
578 | 600 |
private void loadBufferFromByteDataType(byte[][] b) { |
579 | 601 |
for (int iBand = 0; iBand < this.nBands; iBand++) { |
580 | 602 |
for (int pos = 0; pos < width; pos++) { |
581 |
compressclient.buffer[pos + (width * iBand)] = b[iBand][pos]; |
|
603 |
compressclient.buffer[pos + (width * iBand)] = b[iBand][pos + (width * countLine)];
|
|
582 | 604 |
if ((pos == (width - 1)) && (iBand == (this.nBands - 1))) |
583 | 605 |
countLine++; |
584 | 606 |
} |
Also available in: Unified diff