Revision 1397 org.gvsig.raster.cache/trunk/org.gvsig.raster.cache/org.gvsig.raster.cache.lib.impl/src/main/java/org/gvsig/raster/cache/tile/impl/provider/DefaultCacheStruct.java

View differences:

DefaultCacheStruct.java
151 151
    		
152 152
    		tm.setMatrixWidth(nTilesWidth);
153 153
    		tm.setMatrixHeight(nTilesHeight);
154
    		if((tilePxWidth * nTilesWidth) != 0)
154
    		if(tilePxWidth > 0 && nTilesWidth > 0)
155 155
    			pixelSizeList[i] = worldExtent.getWidth() / ((long)tilePxWidth * (long)nTilesWidth);
156 156
    		else
157 157
    			pixelSizeList[i] = 0;
......
361 361
		double tileWCHeight = 0;
362 362
		int level = 0;
363 363
		double mtsPixelLevel = 0;
364
		boolean levelAssigned = false;
364 365
		for (int i = 0; i < tileMatrixSet.getTileMatrix().size(); i++) {
365 366
			mtsPixelLevel = tileMatrixSet.getTileMatrix().get(i).getScaleDenominator();
366
			if(mtsPixelRequest > mtsPixelLevel) {
367
			if(mtsPixelRequest > mtsPixelLevel || 
368
			   (!levelAssigned && i == (tileMatrixSet.getTileMatrix().size() - 1))) {
367 369
				level = Math.max(i, 0);
368 370
				//Se ajusta al m?ximo nivel disponible para esa capa
369 371
				if(level > (limits.size() - 1)) {
......
377 379
				//mtsPixelLevel = tileMatrixSet.getTileMatrix().get(i + 1).getScaleDenominator();
378 380
				tileWCWidth = tilePxWidth * mtsPixelLevel;
379 381
				tileWCHeight = tilePxHeight * mtsPixelLevel;
382
				levelAssigned = true;
380 383
				break;
381 384
			}
382 385
		}

Also available in: Unified diff