Revision 4182 org.gvsig.raster.gdal/trunk/org.gvsig.raster.gdal/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/io/GdalWriter.java
GdalWriter.java | ||
---|---|---|
36 | 36 |
import org.gvsig.fmap.dal.coverage.exception.ProcessInterruptedException; |
37 | 37 |
import org.gvsig.fmap.dal.coverage.exception.RmfSerializerException; |
38 | 38 |
import org.gvsig.fmap.dal.coverage.store.DataServerWriter; |
39 |
import org.gvsig.jgdal.Gdal; |
|
39 |
import org.gvsig.jgdal.GdalDataset;
|
|
40 | 40 |
import org.gvsig.jgdal.GdalBuffer; |
41 | 41 |
import org.gvsig.jgdal.GdalDriver; |
42 | 42 |
import org.gvsig.jgdal.GdalException; |
... | ... | |
122 | 122 |
} |
123 | 123 |
|
124 | 124 |
private GdalDriver drv; |
125 |
private Gdal dstDataset = null; |
|
125 |
private GdalDataset dstDataset = null;
|
|
126 | 126 |
private GdalRasterBand rband = null; |
127 | 127 |
private GeoTransform geot = null; //Datos de georeferenciaci?n |
128 | 128 |
//private OGRSpatialReference oSRS; //Datos de proyecci?n |
... | ... | |
290 | 290 |
throw new GdalException("El tipo de driver " + driver + " no est? soportado por GdalWriter."); |
291 | 291 |
|
292 | 292 |
//Obtenemos el driver y creamos el dataset del destino |
293 |
drv = Gdal.getDriverByName(driver); |
|
293 |
drv = GdalDataset.getDriverByName(driver);
|
|
294 | 294 |
|
295 | 295 |
if (dstDataset != null) { |
296 | 296 |
dstDataset.close(); |
... | ... | |
298 | 298 |
} |
299 | 299 |
|
300 | 300 |
dstDataset = drv.create(outFileName, sizeWindowX, sizeWindowY, |
301 |
nBands, GdalNative.getGdalTypeFromRasterBufType(dataType), gdalParamsFromRasterParams(driverParams));
|
|
301 |
nBands, GdalDataSource.getGdalTypeFromRasterBufType(dataType), gdalParamsFromRasterParams(driverParams));
|
|
302 | 302 |
|
303 | 303 |
dstDataset.setGeoTransform(geot); |
304 | 304 |
|
... | ... | |
312 | 312 |
|
313 | 313 |
public void anotherFile(String fileName)throws GdalException { |
314 | 314 |
dstDataset = drv.create(fileName, sizeWindowX, sizeWindowY, |
315 |
nBands, GdalNative.getGdalTypeFromRasterBufType(dataType), gdalParamsFromRasterParams(driverParams));
|
|
315 |
nBands, GdalDataSource.getGdalTypeFromRasterBufType(dataType), gdalParamsFromRasterParams(driverParams));
|
|
316 | 316 |
} |
317 | 317 |
|
318 | 318 |
/** |
... | ... | |
383 | 383 |
for (int iBand = 0; iBand < buftmp.length; iBand++) |
384 | 384 |
try { |
385 | 385 |
rband = dstDataset.getRasterBand(iBand + 1); |
386 |
rband.writeRaster(0, posicionY, sizeWindowX, sizeY, bufBands[iBand], Gdal.GDT_Byte); |
|
386 |
rband.writeRaster(0, posicionY, sizeWindowX, sizeY, bufBands[iBand], GdalDataset.GDT_Byte);
|
|
387 | 387 |
bufBands[iBand].buffByte = null; |
388 | 388 |
} catch (GdalException e) { |
389 | 389 |
//No se est? escribiendo ... |
... | ... | |
410 | 410 |
for (int iBand = 0; iBand < nBands; iBand++) |
411 | 411 |
try { |
412 | 412 |
rband = dstDataset.getRasterBand(iBand + 1); |
413 |
rband.writeRaster(0, posicionY, sizeWindowX, sizeY, bufBands[iBand], Gdal.GDT_Int16); |
|
413 |
rband.writeRaster(0, posicionY, sizeWindowX, sizeY, bufBands[iBand], GdalDataset.GDT_Int16);
|
|
414 | 414 |
bufBands[iBand].buffShort = null; |
415 | 415 |
} catch (GdalException e) { |
416 | 416 |
//No se est? escribiendo ... |
... | ... | |
436 | 436 |
for (int iBand = 0; iBand < buftmp.length; iBand++) |
437 | 437 |
try { |
438 | 438 |
rband = dstDataset.getRasterBand(iBand + 1); |
439 |
rband.writeRaster(0, posicionY, sizeWindowX, sizeY, bufBands[iBand], Gdal.GDT_Int32); |
|
439 |
rband.writeRaster(0, posicionY, sizeWindowX, sizeY, bufBands[iBand], GdalDataset.GDT_Int32);
|
|
440 | 440 |
bufBands[iBand].buffInt = null; |
441 | 441 |
} catch (GdalException e) { |
442 | 442 |
//No se est? escribiendo ... |
... | ... | |
462 | 462 |
for (int iBand = 0; iBand < buftmp.length; iBand++) |
463 | 463 |
try { |
464 | 464 |
rband = dstDataset.getRasterBand(iBand + 1); |
465 |
rband.writeRaster(0, posicionY, sizeWindowX, sizeY, bufBands[iBand], Gdal.GDT_Float32); |
|
465 |
rband.writeRaster(0, posicionY, sizeWindowX, sizeY, bufBands[iBand], GdalDataset.GDT_Float32);
|
|
466 | 466 |
bufBands[iBand].buffFloat = null; |
467 | 467 |
} catch (GdalException e) { |
468 | 468 |
//No se est? escribiendo ... |
... | ... | |
488 | 488 |
for (int iBand = 0; iBand < buftmp.length; iBand++) |
489 | 489 |
try { |
490 | 490 |
rband = dstDataset.getRasterBand(iBand + 1); |
491 |
rband.writeRaster(0, posicionY, sizeWindowX, sizeY, bufBands[iBand], Gdal.GDT_Float64); |
|
491 |
rband.writeRaster(0, posicionY, sizeWindowX, sizeY, bufBands[iBand], GdalDataset.GDT_Float64);
|
|
492 | 492 |
bufBands[iBand].buffDouble = null; |
493 | 493 |
} catch (GdalException e) { |
494 | 494 |
//No se est? escribiendo ... |
... | ... | |
517 | 517 |
try { |
518 | 518 |
rband = dstDataset.getRasterBand(1); |
519 | 519 |
rband.writeRaster(0, posicionY, sizeWindowX, sizeY, bufBands[0], |
520 |
Gdal.GDT_Byte); |
|
520 |
GdalDataset.GDT_Byte);
|
|
521 | 521 |
rband = dstDataset.getRasterBand(2); |
522 | 522 |
rband.writeRaster(0, posicionY, sizeWindowX, sizeY, bufBands[1], |
523 |
Gdal.GDT_Byte); |
|
523 |
GdalDataset.GDT_Byte);
|
|
524 | 524 |
rband = dstDataset.getRasterBand(3); |
525 | 525 |
rband.writeRaster(0, posicionY, sizeWindowX, sizeY, bufBands[2], |
526 |
Gdal.GDT_Byte); |
|
526 |
GdalDataset.GDT_Byte);
|
|
527 | 527 |
} catch (GdalException e) { |
528 | 528 |
e.printStackTrace(); |
529 | 529 |
} |
... | ... | |
635 | 635 |
GdalDataParameters par = new GdalDataParameters(); |
636 | 636 |
par.setFile(new File(src)); |
637 | 637 |
gdalFile = new GdalProvider(par, null); |
638 |
Gdal dstDataset = driverDst.createCopy(dst, gdalFile.getNative(), bstrict, params); |
|
638 |
GdalDataset dstDataset = driverDst.createCopy(dst, gdalFile.getNative(), bstrict, params);
|
|
639 | 639 |
if( dst.endsWith(".jpg") || |
640 | 640 |
dst.endsWith(".jpeg") || |
641 | 641 |
dst.endsWith(".png")) |
Also available in: Unified diff