Revision 2218
org.gvsig.raster.mosaic/trunk/org.gvsig.raster.mosaic/org.gvsig.raster.mosaic.io/src/main/java/org/gvsig/raster/mosaic/io/MosaicProvider.java | ||
---|---|---|
658 | 658 |
|
659 | 659 |
boolean areThereBandsToDraw = false; |
660 | 660 |
for (int i = 0; i < provider.getBandCount(); i++) { |
661 |
int[] bandsToDrawByProviderBand = globalBandList.getBufferBandToDraw(provider.getURI(), i);
|
|
661 |
int[] bandsToDrawByProviderBand = globalBandList.getBufferBandToDraw(getURI(), i); |
|
662 | 662 |
if(bandsToDrawByProviderBand != null) { |
663 | 663 |
areThereBandsToDraw = true; |
664 | 664 |
for (int j = 0; j < bandsToDrawByProviderBand.length; j++) { |
... | ... | |
673 | 673 |
return null; |
674 | 674 |
} |
675 | 675 |
|
676 |
private double adjustCoordinate(double c) { |
|
677 |
return (c > 0.95 || c < 0.05) ? Math.round(c) : c; |
|
678 |
} |
|
679 |
|
|
676 | 680 |
private Buffer getBuffersFusion(BandList bandList, TaskStatus status, Buffer rasterBuf) throws RasterDriverException, ProcessInterruptedException { |
677 | 681 |
List<Buffer> bufferList = new ArrayList<Buffer>(); |
678 | 682 |
|
679 | 683 |
for (int i = 0; i < providerList.size(); i++) { |
680 | 684 |
RasterProvider provider = providerList.get(i); |
681 |
Extent extIntersection = extent.intersection(provider.getExtent());
|
|
685 |
Extent extIntersection = getView().intersection(provider.getExtent());
|
|
682 | 686 |
|
683 |
double relWidth = extent.width() / rasterBuf.getWidth();
|
|
684 |
double relHeight = extent.height() / rasterBuf.getHeight();
|
|
685 |
int w = (int)Math.ceil(extIntersection.width() / relWidth);
|
|
686 |
int h = (int)Math.ceil(extIntersection.height() / relHeight);
|
|
687 |
double relWidth = getView().width() / rasterBuf.getWidth();
|
|
688 |
double relHeight = getView().height() / rasterBuf.getHeight();
|
|
689 |
int w = (int)Math.ceil(adjustCoordinate(extIntersection.width() / relWidth));
|
|
690 |
int h = (int)Math.ceil(adjustCoordinate(extIntersection.height() / relHeight));
|
|
687 | 691 |
|
688 | 692 |
Buffer partialBuffer = DefaultRasterManager.getInstance().createBuffer( |
689 | 693 |
provider.getDataType()[0], w, h, rasterBuf.getBandCount(), true); |
690 | 694 |
BandList b = createBandListByProvider(bandList, provider); |
691 |
partialBuffer = ((DefaultRasterProvider)provider).getWindow(extent, b, partialBuffer, status);
|
|
695 |
partialBuffer = ((DefaultRasterProvider)provider).getWindow(extIntersection, b, partialBuffer, status);
|
|
692 | 696 |
partialBuffer.setDataExtent(extIntersection.toRectangle2D()); |
693 | 697 |
bufferList.add(partialBuffer); |
694 | 698 |
} |
695 | 699 |
|
696 |
PixelSquareStructure pxSquare = BufferListFusion.buildPixelSquareStructure(rasterBuf, extent, getCellSize());
|
|
700 |
PixelSquareStructure pxSquare = BufferListFusion.buildPixelSquareStructure(rasterBuf, getView(), getCellSize());
|
|
697 | 701 |
BufferListFusion bufferFusion = new BufferListFusion(bufferList, pxSquare, BufferListFusion.FIRST); |
698 | 702 |
rasterBuf = bufferFusion.getWindow(); |
699 | 703 |
bufferFusion.dispose(); |
... | ... | |
710 | 714 |
calcMetadataFromParams(); |
711 | 715 |
setView(extent); |
712 | 716 |
|
717 |
//BandList b = createBandListByProvider(bandList, providerList.get(0)); |
|
718 |
//return ((DefaultRasterProvider)providerList.get(0)).getWindow(extent, b, rasterBuf, status); |
|
713 | 719 |
return getBuffersFusion(bandList, status, rasterBuf); |
714 | 720 |
} |
715 | 721 |
|
Also available in: Unified diff