Ticket #3983: slippymap_custom_url.patch
File slippymap_custom_url.patch, 2.4 KB (added by , 16 years ago) |
---|
-
SlippyMapPreferences.java
old new 286 286 super(name, url); 287 287 this.extension = extension; 288 288 } 289 public Custom(String name, String url, String extension, String type) { 290 super(name, url); 291 this.extension = extension; 292 this.type = type; 293 } 294 289 295 String extension; 296 String type; 297 290 298 @Override 291 299 public String getExtension() { 292 300 if (extension == null) 293 301 return super.getExtension(); 294 302 return extension; 295 303 } 304 public String getTilePath(int zoom, int tilex, int tiley) { 305 String ret; 306 307 if(!type.equals("URL")) 308 ret = "/"+zoom+"/"+tilex+"/"+tiley+"."+extension; 309 else 310 ret = "&z=" + zoom + "&x=" + tilex + "&y=" + tiley; 311 312 System.out.println("ret = "+ret); 313 return ret; 314 } 296 315 public TileUpdate getTileUpdate() { 297 316 return TileUpdate.IfNoneMatch; 298 317 } … … 307 326 // slippymap.custom_tile_source_1.name=OOC layer 308 327 // slippymap.custom_tile_source_1.url=http://a.ooc.openstreetmap.org/npe 309 328 // slippymap.custom_tile_source_1.ext=png 329 // slippymap.custom_tile_source_1.type=[URL|image] 310 330 311 331 if (!(short_key.endsWith("name"))) 312 332 continue; 313 333 String url_key = short_key.replaceFirst("name","url"); 314 334 String ext_key = short_key.replaceFirst("name","ext"); 335 String type_key = short_key.replaceFirst("name","type"); 315 336 String name = customSources.get(key); 316 337 String url = customSources.get(PREFERENCE_TILE_CUSTOM_SOURCE + url_key); 317 338 String ext = customSources.get(PREFERENCE_TILE_CUSTOM_SOURCE + ext_key); 339 String type = customSources.get(PREFERENCE_TILE_CUSTOM_SOURCE + type_key); 318 340 // ext may be null, but that's OK 319 System.out.println("found new tile source: '" +name+"' url:'"+url+"' "+"' ext:'"+ext+"'");320 ret.add(new Custom(name, url, ext ));341 System.out.println("found new tile source: '" +name+"' url:'"+url+"' ext:'"+ext+"' type:'"+type+"'"); 342 ret.add(new Custom(name, url, ext, type)); 321 343 } 322 344 return ret; 323 345 }