Skip to content

Commit

Permalink
ian, you beat me to it ;) minor fix in bing support, and removed near…
Browse files Browse the repository at this point in the history
…map 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.

git-svn-id: http://svn.openstreetmap.org/applications/editors/josm/plugins@24354 b9d5c4c9-76e1-0310-9c85-f3177eceb1e4
  • Loading branch information
frederik committed Nov 23, 2010
1 parent fe2bc92 commit 9610061
Showing 1 changed file with 14 additions and 34 deletions.
Expand Up @@ -275,28 +275,8 @@ public TileUpdate getTileUpdate() {
}
}

public static class NearMap extends OsmTileSource.AbstractOsmTileSource {
public NearMap() {
super("NearMap Australia", "http://www.nearmap.com/maps/hl=en&nml=Vert&");
}

@Override
public int getMaxZoom() {
return 21;
}

@Override
public String getTilePath(int zoom, int tilex, int tiley) {
return "z=" + zoom + "&x=" + tilex + "&y=" + tiley;
}

public TileUpdate getTileUpdate() {
return TileUpdate.IfNoneMatch;
}
}

public static class BingMaps extends OsmTileSource.AbstractOsmTileSource {
public BingMaps() {
public static class BingAerial extends OsmTileSource.AbstractOsmTileSource {
public BingAerial() {
super("Bing Aerial Maps", "http://ecn.t2.tiles.virtualearth.net/tiles/");
}

Expand All @@ -306,9 +286,14 @@ public int getMaxZoom() {
}

@Override
public String getTileUrl(int zoom, int tilex, int tiley) {
public String getExtension() {
return("jpeg");
}

@Override
public String getTilePath(int zoom, int tilex, int tiley) {
String quadtree = computeQuadTree(zoom, tilex, tiley);
return "http://ecn.t2.tiles.virtualearth.net/tiles/a" + quadtree + ".jpeg?g=587&mkt=en-us&n=z";
return "/tiles/a" + quadtree + "." + getExtension() + "?g=587";
}

public TileUpdate getTileUpdate() {
Expand All @@ -317,26 +302,21 @@ public TileUpdate getTileUpdate() {
}

private static String computeQuadTree(int zoom, int tilex, int tiley) {
String k = "";
StringBuilder k = new StringBuilder();
for(int i = zoom; i > 0; i--) {
int digit = 0;
char digit = 48;
int mask = 1 << (i - 1);
if ((tilex & mask) != 0) {
digit += 1;
}
if ((tiley & mask) != 0) {
digit += 2;
}
k += String.valueOf(digit);
k.append(digit);
}
return k;
return k.toString();
}

public static void main(String[] args) {
System.out.println("Expected: 021333011020221201");
System.out.println("Actual: " + computeQuadTree(18, 62985, 94388));
}

public static class HaitiImagery extends OsmTileSource.AbstractOsmTileSource {
public HaitiImagery() {
super("HaitiImagery", "http://gravitystorm.dev.openstreetmap.org/imagery/haiti");
Expand Down Expand Up @@ -440,11 +420,11 @@ public static List<TileSource> getAllMapSources()
sources.add(new OsmTileSource.Mapnik());
sources.add(new OsmTileSource.CycleMap());
sources.add(new OsmTileSource.TilesAtHome());
sources.add(new BingAerial());
sources.add(new Coastline());
sources.add(new FreeMapySkPokus());
sources.add(new FreeMapySk());
sources.add(new NearMap());
sources.add(new BingMaps());
sources.add(new HaitiImagery());
sources.addAll(getCustomSources());
// Probably need to either add these or let users add them somehow
Expand Down

0 comments on commit 9610061

Please sign in to comment.