Revision 2369

View differences:

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
161 161
	 * @throws ProcessInterruptedException
162 162
	 * @throws TileGettingException
163 163
	 */
164
	protected Buffer readSupersampledBuffer(Extent tileExtent, int bufWidth, int bufHeight, boolean hasAlphaBand) throws ProcessInterruptedException, TileGettingException {
164
	protected Buffer readSupersampledBuffer(Extent tileExtent, int bufWidth, int bufHeight, boolean hasAlphaBand) throws ProcessInterruptedException, QueryException, TileGettingException {
165 165
		int widthImgPx = (int)Math.abs(tileExtent.width() / store.getPixelSizeX());
166 166
		int heightImgPx = (int)Math.abs(tileExtent.height() / store.getPixelSizeY());
167
		
168
		if(widthImgPx <= 0)
169
			widthImgPx = 1;
170
		if(heightImgPx <= 0)
171
			heightImgPx = 1;
172
		
167 173
		boolean supersampling = ((bufWidth > widthImgPx) || (bufHeight > heightImgPx)) ? true : false;
168 174
		
169 175
		if(supersampling) {
......
173 179
			q.setAdjustToExtent(true); 
174 180
			if(hasAlphaBand)
175 181
				q.setAlphaBand(store.getBandCount() - 1);
176
			Buffer buf = null;
177
			try {
178
				buf = store.query(q);
179
			} catch (QueryException e) {
180
				throw new TileGettingException(e);
181
			}
182
			Buffer buf = store.query(q);
182 183
			Buffer result = buf.getAdjustedWindow(bufWidth, bufHeight, Buffer.INTERPOLATION_NearestNeighbour);
183 184
			if(result != buf)
184 185
				buf.dispose();

Also available in: Unified diff