Ticket #3983: slippymap_custom_url.patch

File slippymap_custom_url.patch, 2.4 KB (added by delta_foxtrot2, 16 years ago)

fixed a few typos

  • SlippyMapPreferences.java

    old new  
    286286            super(name, url);
    287287            this.extension = extension;
    288288        }
     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
    289295        String extension;
     296        String type;
     297
    290298        @Override
    291299        public String getExtension() {
    292300            if (extension == null)
    293301                return super.getExtension();
    294302            return extension;
    295303        }
     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        }
    296315        public TileUpdate getTileUpdate() {
    297316            return TileUpdate.IfNoneMatch;
    298317        }
     
    307326            // slippymap.custom_tile_source_1.name=OOC layer
    308327            // slippymap.custom_tile_source_1.url=http://a.ooc.openstreetmap.org/npe
    309328            // slippymap.custom_tile_source_1.ext=png
     329            // slippymap.custom_tile_source_1.type=[URL|image]
    310330
    311331            if (!(short_key.endsWith("name")))
    312332                continue;
    313333            String url_key = short_key.replaceFirst("name","url");
    314334            String ext_key = short_key.replaceFirst("name","ext");
     335            String type_key = short_key.replaceFirst("name","type");
    315336            String name = customSources.get(key);
    316337            String url = customSources.get(PREFERENCE_TILE_CUSTOM_SOURCE + url_key);
    317338            String ext = customSources.get(PREFERENCE_TILE_CUSTOM_SOURCE + ext_key);
     339            String type = customSources.get(PREFERENCE_TILE_CUSTOM_SOURCE + type_key);
    318340            // 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));
    321343        }
    322344        return ret;
    323345    }