Revision 4272 org.gvsig.raster.wmts/trunk/org.gvsig.raster.wmts/org.gvsig.raster.wmts.io/src/main/java/org/gvsig/raster/wmts/io/downloader/TileDownloaderForWMTS.java

View differences:

TileDownloaderForWMTS.java
39 39
import org.gvsig.raster.wmts.ogc.exception.ServerErrorException;
40 40
import org.gvsig.raster.wmts.ogc.exception.WMTSException;
41 41

  
42
/** 
43
 * Tile getter 
42
/**
43
 * Tile getter
44 44
 * @author Nacho Brodin (nachobrodin@gmail.com)
45 45
 */
46 46
public class TileDownloaderForWMTS extends BaseTileDownloader {
47 47
	private WMTSClient             ogcClient  = null;
48
	
49
	public TileDownloaderForWMTS(RasterDataStore store, 
48

  
49
	public TileDownloaderForWMTS(RasterDataStore store,
50 50
			int tilePxWidth,
51 51
			int tilePxHeight) {
52 52
		super(store, tilePxWidth, tilePxHeight);
53 53
	}
54
	
54

  
55 55
	/**
56 56
	 * Gets the connector from the URL
57 57
	 * @return
......
63 63
			ogcClient = p.getOGCClient();
64 64
			if(ogcClient != null)
65 65
				return ogcClient;
66
			
66

  
67 67
			URL url = null;
68 68
			try {
69
				url = new URL(p.getURI());
69
				url = p.getURI().toURL();
70 70
			} catch (Exception e) {
71 71
				throw new WMTSException("Malformed URL",e);
72 72
			}
......
76 76
					public boolean isCanceled() {
77 77
						return false;
78 78
					}
79
					
79

  
80 80
					public Object getID() {
81 81
						return null;
82 82
					}
......
89 89
		}
90 90
		return ogcClient;
91 91
	}
92
	
92

  
93 93
	public synchronized Tile downloadTile(Tile tile) throws TileGettingException {
94 94
		try {
95 95
			WMTSStatus status = (WMTSStatus)tile.getDownloaderParams("WMTSStatus");
96 96
			status.setTileRow(tile.getRow());
97 97
			status.setTileCol(tile.getCol());
98
			
98

  
99 99
			String urlFromTemplate = status.getResourceURL(tile.getRow() + "" + tile.getCol() + "");
100 100
			//System.out.println(urlFromTemplate);
101 101
			File f = null;
......
117 117
		readTileFromDisk(tile);
118 118
		return tile;
119 119
	}
120
	
120

  
121 121
}

Also available in: Unified diff