Changeset 24351 in osm for applications/editors


Ignore:
Timestamp:
2010-11-23T19:42:07+01:00 (14 years ago)
Author:
yellowbkpk
Message:

Adding support for Bing Aerial Maps.

Location:
applications/editors/josm/plugins/slippymap
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/slippymap/.classpath

    r18593 r24351  
    22<classpath>
    33        <classpathentry kind="src" path="src"/>
    4         <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JDK 5"/>
     4        <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
    55        <classpathentry combineaccessrules="false" kind="src" path="/JOSM"/>
    66        <classpathentry kind="output" path="build"/>
  • applications/editors/josm/plugins/slippymap/src/org/openstreetmap/josm/plugins/slippymap/SlippyMapPreferences.java

    r23190 r24351  
    296296    }
    297297
     298    public static class BingMaps extends OsmTileSource.AbstractOsmTileSource {
     299        public BingMaps() {
     300            super("Bing Aerial Maps", "http://ecn.t2.tiles.virtualearth.net/tiles/");
     301        }
     302
     303        @Override
     304        public int getMaxZoom() {
     305            return 22;
     306        }
     307       
     308        @Override
     309        public String getTileUrl(int zoom, int tilex, int tiley) {
     310            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";
     312        }
     313
     314        public TileUpdate getTileUpdate() {
     315            return TileUpdate.IfNoneMatch;
     316        }
     317    }
     318
     319    private static String computeQuadTree(int zoom, int tilex, int tiley) {
     320        String k = "";
     321        for(int i = zoom; i > 0; i--) {
     322            int digit = 0;
     323            int mask = 1 << (i - 1);
     324            if ((tilex & mask) != 0) {
     325                digit += 1;
     326            }
     327            if ((tiley & mask) != 0) {
     328                digit += 2;
     329            }
     330            k += String.valueOf(digit);
     331        }
     332        return k;
     333    }
     334   
     335    public static void main(String[] args) {
     336        System.out.println("Expected: 021333011020221201");
     337        System.out.println("Actual:   " + computeQuadTree(18, 62985, 94388));
     338    }
    298339
    299340    public static class HaitiImagery extends OsmTileSource.AbstractOsmTileSource {
     
    404445        sources.add(new FreeMapySk());
    405446        sources.add(new NearMap());
     447        sources.add(new BingMaps());
    406448        sources.add(new HaitiImagery());
    407449        sources.addAll(getCustomSources());
Note: See TracChangeset for help on using the changeset viewer.