Revision 2305 org.gvsig.raster/branches/org.gvsig.raster_dataaccess_refactoring/org.gvsig.raster.lib/org.gvsig.raster.lib.impl/src/main/java/org/gvsig/raster/impl/provider/tile/TileDownloaderForFiles.java

View differences:

TileDownloaderForFiles.java
80 80
			if(store.getColorInterpretation().hasAlphaBand())
81 81
				alphaBand = true;
82 82
			
83
			//Si no hay parte del tile que cae fuera de la imagen no se usa una nueva banda de transparencia ni valores nodata
84
			if(isInternalTile(newBufWidth, newBufHeight)) {
83
			//A partir de ahora todos los tiles RGB llevan banda de transparencia, por eso eliminamos este c?digo. Esto es para que 
84
			//las capas tileadas puedan aparecer con banda transparente en el cuadro de propiedades. Si no da problemas la 
85
			//modificaci?n eliminarlo permanentemente dentro de un par de versiones (19/11/2013 BN2207)
86
			
87
			/*if(isInternalTile(newBufWidth, newBufHeight)) {
85 88
				bufResult = readSupersampledBuffer(tileExtent, this.tilePxWidth, this.tilePxHeight, false);
86 89
				if(bufResult == null) {
87 90
					RasterQuery q = RasterLocator.getManager().createQuery();
......
90 93
					q.setAdjustToExtent(true); 
91 94
					bufResult = store.query(q);
92 95
				}
93
			} else {
94
				//Hay parte del tile que cae fuera de la imagen
95
				if(store.getDataType()[0] == Buffer.TYPE_BYTE) {
96
					//Para imagenes byte se crea una banda de transparencia
97
					alphaBand = true;
98
					if(!store.getColorInterpretation().hasAlphaBand())
99
						nBandsBuffer ++; 
100
				} 
101
				
102
				Buffer smallBuf = readSupersampledBuffer(ex, newBufWidth, newBufHeight, alphaBand);
103
				
104
				if(smallBuf == null) { //No ha habido resampleo
105
					RasterQuery q = RasterLocator.getManager().createQuery();
106
					q.setAreaOfInterest(ex, newBufWidth, newBufHeight);
107
					q.setAllDrawableBands();
108
					q.setAdjustToExtent(true); 
109
					if(alphaBand)
110
						q.setAlphaBand(store.getBandCount() - 1);
111
					smallBuf = store.query(q);
112
				}
113
				
114
				bufResult = buildTileBuffer(nBandsBuffer, this.tilePxWidth, this.tilePxHeight);
115
				RasterLocator.getManager().getRasterUtils().copyToBuffer(
116
						bufResult, 
117
						tileExtent, 
118
						smallBuf, 
119
						ex, 
120
						pixelSize, 
121
						store.getColorInterpretation().hasAlphaBand());
96
			} else {*/
97
			
98
			//Hay parte del tile que cae fuera de la imagen
99
			if(store.getDataType()[0] == Buffer.TYPE_BYTE) {
100
				//Para imagenes byte se crea una banda de transparencia
101
				alphaBand = true;
102
				if(!store.getColorInterpretation().hasAlphaBand())
103
					nBandsBuffer ++; 
104
			} 
105

  
106
			Buffer smallBuf = readSupersampledBuffer(ex, newBufWidth, newBufHeight, alphaBand);
107

  
108
			if(smallBuf == null) { //No ha habido resampleo
109
				RasterQuery q = RasterLocator.getManager().createQuery();
110
				q.setAreaOfInterest(ex, newBufWidth, newBufHeight);
111
				q.setAllDrawableBands();
112
				q.setAdjustToExtent(true); 
113
				if(alphaBand)
114
					q.setAlphaBand(store.getBandCount() - 1);
115
				smallBuf = store.query(q);
122 116
			}
123
			
117

  
118
			bufResult = buildTileBuffer(nBandsBuffer, this.tilePxWidth, this.tilePxHeight);
119
			RasterLocator.getManager().getRasterUtils().copyToBuffer(
120
					bufResult, 
121
					tileExtent, 
122
					smallBuf, 
123
					ex, 
124
					pixelSize, 
125
					store.getColorInterpretation().hasAlphaBand());
126
			//}
127

  
124 128
			saveTile(bufResult, pixelSize, extension, alphaBand, tile, tileExtent, ci);
125 129
			//Si borramos el rmf no se puede leer la etiqueta Alpha. En caso de que se modifique jgdal para
126 130
			//poder guardar esta etiqueta deberiamos borrar el rmf para ahorrar ficheros
127 131
			//File rmf = new File(tile.getFile().getAbsolutePath() + ".rmf");
128 132
			//if(rmf.exists())
129
				//rmf.delete();
133
			//rmf.delete();
130 134
		} catch (ProcessInterruptedException e) {
131 135
		} catch (RasterDriverException e) {
132 136
			throw new TileGettingException(e);

Also available in: Unified diff