Revision 38528

View differences:

branches/v2_0_0_prep/libraries/libRemoteServices/src/org/gvsig/remoteclient/wmts/struct/WMTSTileMatrix.java
184 184
    
185 185
    /**
186 186
     * This function will check if the request coordinates intersects with the tiles in the matrix. If a tile
187
     * intersects then this will be added to the list.  
187
     * intersects then this will be added to the list.
188
     * @deprecated this method was for grid subsets.   
188 189
     */
189 190
	public ArrayList intersects(boolean projected, WMTSTileMatrixLimits tileMatrixLimits, Rectangle2D request, Rectangle2D extentLayer) {
190 191
    	double widthMtsTile = getWidthMtsTile(projected);
......
239 240
    	//Para cada tile comprueba si intersecta con el ?rea seleccionada si es as?
240 241
    	//mete el tile en la lista para devolverlo como resultado
241 242
    	
242
    	int i = 0, j = 0;
243 243
    	double initX = topLeftCorner[1];
244 244
    	double initY = topLeftCorner[0];
245 245
    	
246
    	//cambiar esto por un conversor entre coordenadas pixel y reales
247
    	for (int row = 0; row < matrixHeight; row++) {
248
    		uly = initY - (heightMtsTile * i);
246
    	int tileInitX = (int)((request.getMinX() - initX) / widthMtsTile);
247
    	int tileInitY = (int)(Math.abs(request.getMaxY() - initY) / heightMtsTile);
248
    	int tileEndX = (int)((request.getMaxX() - initX) / widthMtsTile);
249
    	int tileEndY = (int)(Math.abs(request.getMinY() - initY) / heightMtsTile);
250
    	
251
    	for (int row = tileInitY; row <= tileEndY; row++) {
252
    		uly = initY - (heightMtsTile * row);
249 253
			lry = uly - heightMtsTile;
250
			j = 0;
251
			for (int col = 0; col < matrixWidth; col++) {
252
				ulx = initX + (widthMtsTile * j);
254
			for (int col = tileInitX; col <= tileEndX; col++) {
255
				ulx = initX + (widthMtsTile * col);
253 256
				lrx = ulx + widthMtsTile;
254 257
				r.setRect(Math.min(ulx, lrx), Math.min(uly, lry), Math.abs(ulx - lrx), Math.abs(uly - lry));
255 258
				if(request.intersects(r)) {
256 259
					list.add(new Tile(tileWidth, tileHeight, row, col, ulx, uly, lrx, lry));
257 260
				}
258
				j ++;
259 261
			}
260
			i ++;
261 262
		}
262 263
    	
264
//    	int i = 0, j = 0;
265
//    	for (int row = 0; row < matrixHeight; row++) {
266
//    		uly = initY - (heightMtsTile * i);
267
//			lry = uly - heightMtsTile;
268
//			j = 0;
269
//			for (int col = 0; col < matrixWidth; col++) {
270
//				ulx = initX + (widthMtsTile * j);
271
//				lrx = ulx + widthMtsTile;
272
//				r.setRect(Math.min(ulx, lrx), Math.min(uly, lry), Math.abs(ulx - lrx), Math.abs(uly - lry));
273
//				if(request.intersects(r)) {
274
//					list.add(new Tile(tileWidth, tileHeight, row, col, ulx, uly, lrx, lry));
275
//				}
276
//				j ++;
277
//			}
278
//			i ++;
279
//		}
280
    	
263 281
    	return list;
264 282
    }
265 283
    

Also available in: Unified diff