Changeset 24354 in osm for applications/editors


Ignore:
Timestamp:
2010-11-23T21:55:55+01:00 (14 years ago)
Author:
frederik
Message:

ian, you beat me to it ;) minor fix in bing support, and removed nearmap while we're at it (nearmap does not support the planned license change so we'd rather have people using bing). jar version not yet deployed as long as details haven't transpired from bing.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/slippymap/src/org/openstreetmap/josm/plugins/slippymap/SlippyMapPreferences.java

    r24351 r24354  
    276276    }
    277277
    278     public static class NearMap extends OsmTileSource.AbstractOsmTileSource {
    279         public NearMap() {
    280             super("NearMap Australia", "http://www.nearmap.com/maps/hl=en&nml=Vert&");
    281         }
    282 
    283         @Override
    284         public int getMaxZoom() {
    285             return 21;
    286         }
    287 
    288         @Override
    289         public String getTilePath(int zoom, int tilex, int tiley) {
    290             return "z=" + zoom + "&x=" + tilex + "&y=" + tiley;
    291         }
    292 
    293         public TileUpdate getTileUpdate() {
    294             return TileUpdate.IfNoneMatch;
    295         }
    296     }
    297 
    298     public static class BingMaps extends OsmTileSource.AbstractOsmTileSource {
    299         public BingMaps() {
     278    public static class BingAerial extends OsmTileSource.AbstractOsmTileSource {
     279        public BingAerial() {
    300280            super("Bing Aerial Maps", "http://ecn.t2.tiles.virtualearth.net/tiles/");
    301281        }
     
    307287       
    308288        @Override
    309         public String getTileUrl(int zoom, int tilex, int tiley) {
     289        public String getExtension() {
     290            return("jpeg");
     291        }
     292
     293        @Override
     294        public String getTilePath(int zoom, int tilex, int tiley) {
    310295            String quadtree = computeQuadTree(zoom, tilex, tiley);
    311             return "http://ecn.t2.tiles.virtualearth.net/tiles/a" + quadtree + ".jpeg?g=587&mkt=en-us&n=z";
     296            return "/tiles/a" + quadtree + "." + getExtension() + "?g=587";
    312297        }
    313298
     
    318303
    319304    private static String computeQuadTree(int zoom, int tilex, int tiley) {
    320         String k = "";
     305        StringBuilder k = new StringBuilder();
    321306        for(int i = zoom; i > 0; i--) {
    322             int digit = 0;
     307            char digit = 48;
    323308            int mask = 1 << (i - 1);
    324309            if ((tilex & mask) != 0) {
     
    328313                digit += 2;
    329314            }
    330             k += String.valueOf(digit);
    331         }
    332         return k;
     315            k.append(digit);
     316        }
     317        return k.toString();
    333318    }
    334319   
    335     public static void main(String[] args) {
    336         System.out.println("Expected: 021333011020221201");
    337         System.out.println("Actual:   " + computeQuadTree(18, 62985, 94388));
    338     }
    339 
    340320    public static class HaitiImagery extends OsmTileSource.AbstractOsmTileSource {
    341321        public HaitiImagery() {
     
    441421        sources.add(new OsmTileSource.CycleMap());
    442422        sources.add(new OsmTileSource.TilesAtHome());
     423        sources.add(new BingAerial());
    443424        sources.add(new Coastline());
    444425        sources.add(new FreeMapySkPokus());
    445426        sources.add(new FreeMapySk());
    446427        sources.add(new NearMap());
    447         sources.add(new BingMaps());
    448428        sources.add(new HaitiImagery());
    449429        sources.addAll(getCustomSources());
Note: See TracChangeset for help on using the changeset viewer.