1 package tim.prune.gui.map;
3 import tim.prune.I18nManager;
6 * Class to provide a map source for maps-for-free sources
7 * These are double-layer sources with jpg and gif tiles
9 public class MffMapSource extends MapSource
11 /** Name for this source */
12 private String _name = null;
14 private String[] _baseUrls = null;
16 private String[] _siteNames = null;
17 /** Maximum zoom level */
18 private int _maxZoom = 0;
21 * Constructor giving name, url and maximum zoom
22 * @param inName source name
23 * @param inUrl base url
24 * @param inMaxZoom maximum zoom level
26 public MffMapSource(String inName, String inUrl1, String inExt1,
27 String inUrl2, String inExt2, int inMaxZoom)
30 if (_name == null || _name.trim().equals("")) {_name = I18nManager.getText("mapsource.unknown");}
31 _baseUrls = new String[2];
32 _baseUrls[0] = fixBaseUrl(inUrl1);
33 _baseUrls[1] = fixBaseUrl(inUrl2);
34 _siteNames = new String[2];
35 _siteNames[0] = fixSiteName(_baseUrls[0]);
36 _siteNames[1] = fixSiteName(_baseUrls[1]);
37 _extensions = new String[2];
38 _extensions[0] = inExt1;
39 _extensions[1] = inExt2;
46 public String getName() {
50 /** Number of layers is always 2 for mff sources */
51 public int getNumLayers() {
55 /** Get base url for specified layer */
56 public String getBaseUrl(int inLayerNum) {
57 return _baseUrls[inLayerNum];
60 /** site name without protocol or www. */
61 public String getSiteName(int inLayerNum) {
62 return _siteNames[inLayerNum];
66 * Make the URL to get the specified tile
68 public String makeURL(int inLayerNum, int inZoom, int inX, int inY)
70 return _baseUrls[inLayerNum] + "z" + inZoom + "/row" + inY + "/" + inZoom + "_" + inX + "-" + inY + "." + getFileExtension(inLayerNum);
74 * @return maximum zoom level
76 public final int getMaxZoomLevel()
82 * @return semicolon-separated list of all fields
84 public String getConfigString()
86 // TODO: Maybe a gui will be necessary for this one day
87 return "not required";