Revision 38531

View differences:

branches/v2_0_0_prep/libraries/libRemoteServices/src/org/gvsig/remoteclient/wmts/request/WMTSRequest.java
183 183
		} catch (SocketTimeoutException e) {
184 184
			throw new IOException();
185 185
		} finally {
186
			is.close();
187
			dos.close();
188
			connection.disconnect();
186
			if(is != null)
187
				is.close();
188
			if(dos != null)
189
				dos.close();
190
			if(connection != null)
191
				connection.disconnect();
189 192
		}
190 193
	}
191 194

  
branches/v2_0_0_prep/libraries/libRemoteServices/src/org/gvsig/remoteclient/wmts/struct/WMTSTileMatrix.java
176 176
     */
177 177
    public double getHeightMtsTile(boolean projected) {
178 178
    	if(!projected) {
179
    		return (scaleDenominator * tileHeight * 0.28) / (MTS_X_GRADO * 1000);
179
    		double coord = (scaleDenominator * tileHeight * 0.28) / (MTS_X_GRADO * 1000);
180
    		if(coord > 0.99 || coord < 0.005)
181
    			return Math.round(coord);
182
    		return coord;
180 183
    	} else {
181 184
    		return (scaleDenominator * tileHeight * 0.28) / 1000;
182 185
    	}
......
213 216
				ulx = initX + (widthMtsTile * j);
214 217
				lrx = ulx + widthMtsTile;
215 218
				r.setRect(Math.min(ulx, lrx), Math.min(uly, lry), Math.abs(ulx - lrx), Math.abs(uly - lry));
216
				if(request.intersects(r)) {
219
				if(request.intersects(r) && r.intersects(extentLayer)) {
217 220
					list.add(new Tile(tileWidth, tileHeight, row, col, ulx, uly, lrx, lry));
218 221
				}
219 222
				j ++;
......
255 258
				ulx = initX + (widthMtsTile * col);
256 259
				lrx = ulx + widthMtsTile;
257 260
				r.setRect(Math.min(ulx, lrx), Math.min(uly, lry), Math.abs(ulx - lrx), Math.abs(uly - lry));
258
				if(request.intersects(r)) {
261
				//El segundo intersects es necesario porque el extent de la capa puede variar por cada nivel de 
262
				//resoluci?n en caso de que haya una lista de TileMatrix en el capabilities
263
				if(request.intersects(r) && r.intersects(extentLayer)) { 
259 264
					list.add(new Tile(tileWidth, tileHeight, row, col, ulx, uly, lrx, lry));
260 265
				}
261 266
			}
......
280 285
    	
281 286
    	return list;
282 287
    }
288
	
283 289
    
284 290
    /**
285 291
     * This function will check if the request coordinates intersects with the tiles in the matrix. If a tile

Also available in: Unified diff