Revision 956 org.gvsig.raster.postgis/trunk/org.gvsig.raster.postgis/org.gvsig.raster.postgis.io/src/main/java/org/gvsig/raster/postgis/io/PostGISRasterProvider.java
PostGISRasterProvider.java | ||
---|---|---|
100 | 100 |
public void createProvider(PostGISRasterDataParameters p) throws NotSupportedExtensionException { |
101 | 101 |
GdalDataParameters gdalParams = new GdalDataParameters(); |
102 | 102 |
gdalParams.setURI(p.getURI()); |
103 |
this.provider = new GdalProvider(gdalParams, storeServices); |
|
103 |
try { |
|
104 |
this.provider = new GdalProvider(gdalParams, storeServices); |
|
105 |
} catch (NotSupportedExtensionException e) { |
|
106 |
System.out.println("===>" + gdalParams.getURI()); |
|
107 |
} |
|
104 | 108 |
this.width = (int)provider.getWidth(); |
105 | 109 |
this.height = (int)provider.getHeight(); |
106 | 110 |
this.pxSizeOverview = provider.getExtent().width() / (double)this.width; |
... | ... | |
325 | 329 |
*/ |
326 | 330 |
public void getWindow(Extent ex, int bufWidth, int bufHeight, |
327 | 331 |
BandList bandList, TileListener listener) throws ProcessInterruptedException, RasterDriverException { |
328 |
super.getWindow(ex, bufWidth, bufHeight, bandList, listener); |
|
332 |
// PostGISRasterDataParameters p = (PostGISRasterDataParameters)param; |
|
333 |
// Buffer buf = RasterLocator.getManager().createBuffer(getDataType()[0], bufWidth, bufHeight, getBandCount(), true); |
|
334 |
// TileCacheManager m = TileCacheLocator.getManager(); |
|
335 |
// Tile tile = m.createTile(-1, 0, 0); |
|
336 |
// |
|
337 |
// //Creamos un BandList con todas las bandas del fichero |
|
338 |
// BandList bl = new BandListImpl(); |
|
339 |
// for(int i = 0; i < getBandCount(); i++) { |
|
340 |
// try { |
|
341 |
// DatasetBand band = new DatasetBandImpl(selectedProvider.getURIOfFirstProvider(), i, getDataType()[i], getBandCount()); |
|
342 |
// bl.addBand(band, i); |
|
343 |
// } catch(BandNotFoundInListException e) { |
|
344 |
// //No a?adimos la banda |
|
345 |
// } |
|
346 |
// } |
|
347 |
// |
|
348 |
// if(p.getNumberOfBlocks() > 1) { |
|
349 |
// for (int i = 0; i < p.getNumberOfBlocks(); i++) { |
|
350 |
// GdalNative gdal; |
|
351 |
// try { |
|
352 |
// gdal = new GdalNative(p.getURI() + " column='rast' where='rid = " + i + "'"); |
|
353 |
// gdal.readWindow(buf, bandList, 0, 0, gdal.width, gdal.height, bufWidth, bufHeight); |
|
354 |
// Extent ext = gdal.getExtentWithoutRot(); |
|
355 |
// tile.setUl(new Point2D.Double(ext.getULX(), ext.getULY())); |
|
356 |
// tile.setLr(new Point2D.Double(ext.getLRX(), ext.getLRY())); |
|
357 |
// tile.setData(new Object[]{buf, null, null}); |
|
358 |
// listener.tileReady(tile); |
|
359 |
// } catch (GdalException e) { |
|
360 |
// throw new RasterDriverException("", e); |
|
361 |
// } catch (IOException e) { |
|
362 |
// throw new RasterDriverException("", e); |
|
363 |
// } catch (TileGettingException e) { |
|
364 |
// throw new RasterDriverException("", e); |
|
365 |
// } |
|
366 |
// } |
|
367 |
// } |
|
368 |
super.getWindow(ex, bufWidth, bufHeight, bandList, listener); |
|
329 | 369 |
} |
330 | 370 |
|
331 | 371 |
/* |
... | ... | |
352 | 392 |
*/ |
353 | 393 |
public Buffer getWindow(Extent extent, |
354 | 394 |
int bufWidth, int bufHeight, BandList bandList, Buffer rasterBuf, boolean adjustToExtent) throws ProcessInterruptedException, RasterDriverException { |
395 |
|
|
355 | 396 |
try { |
356 | 397 |
readOverviews(); |
357 | 398 |
} catch (DataException e) { |
358 | 399 |
throw new RasterDriverException("Overviews can't be read", e); |
359 | 400 |
} |
401 |
|
|
360 | 402 |
overviewSelector(bufWidth, extent.width()); |
361 | 403 |
//Creamos un BandList con todas las bandas del fichero |
362 | 404 |
BandList bl = new BandListImpl(); |
... | ... | |
369 | 411 |
} |
370 | 412 |
} |
371 | 413 |
bl.setDrawableBands(bandList.getDrawableBands()); |
372 |
|
|
414 |
|
|
373 | 415 |
return selectedProvider.getWindow(extent, bufWidth, bufHeight, bl, rasterBuf, adjustToExtent); |
374 | 416 |
} |
375 | 417 |
|
... | ... | |
391 | 433 |
return super.getWindow(x, y, w, h, bufWidth, bufHeight, bandList, rasterBuf); |
392 | 434 |
} |
393 | 435 |
|
436 |
/* |
|
437 |
* (non-Javadoc) |
|
438 |
* @see org.gvsig.raster.impl.provider.RasterProvider#isTiled() |
|
439 |
*/ |
|
440 |
/*public boolean isTiled() { |
|
441 |
PostGISRasterDataParameters p = (PostGISRasterDataParameters)param; |
|
442 |
return p.getNumberOfBlocks() > 1; |
|
443 |
}*/ |
|
394 | 444 |
|
395 | 445 |
} |
Also available in: Unified diff