| 1 |
|
|---|
| 2 |
void doMicrosoftTest() { |
|---|
| 3 |
println(); |
|---|
| 4 |
println("microsoft test"); |
|---|
| 5 |
println(); |
|---|
| 6 |
|
|---|
| 7 |
AbstractMapProvider p = new RoadProvider(); |
|---|
| 8 |
String[] urls = p.getTileUrls(new Coordinate(25322, 10507, 16)); |
|---|
| 9 |
println( urls[0].startsWith("http://r") && urls[0].endsWith(".ortho.tiles.virtualearth.net/tiles/r0230102122203031.png?g=90&shading=hill") ); |
|---|
| 10 |
urls = p.getTileUrls(new Coordinate(25333, 10482, 16)); |
|---|
| 11 |
println( urls[0].startsWith("http://r") && urls[0].endsWith(".ortho.tiles.virtualearth.net/tiles/r0230102033330212.png?g=90&shading=hill") ); |
|---|
| 12 |
|
|---|
| 13 |
p = new AerialProvider(); |
|---|
| 14 |
urls = p.getTileUrls(new Coordinate(25322, 10507, 16)); |
|---|
| 15 |
println( urls[0].startsWith("http://a") && urls[0].endsWith(".ortho.tiles.virtualearth.net/tiles/a0230102122203031.jpeg?g=90") ); |
|---|
| 16 |
urls = p.getTileUrls(new Coordinate(25333, 10482, 16)); |
|---|
| 17 |
println( urls[0].startsWith("http://a") && urls[0].endsWith(".ortho.tiles.virtualearth.net/tiles/a0230102033330212.jpeg?g=90") ); |
|---|
| 18 |
|
|---|
| 19 |
p = new HybridProvider(); |
|---|
| 20 |
urls = p.getTileUrls(new Coordinate(25322, 10507, 16)); |
|---|
| 21 |
println( urls[0].startsWith("http://h") && urls[0].endsWith(".ortho.tiles.virtualearth.net/tiles/h0230102122203031.jpeg?g=90") ); |
|---|
| 22 |
urls = p.getTileUrls(new Coordinate(25333, 10482, 16)); |
|---|
| 23 |
println( urls[0].startsWith("http://h") && urls[0].endsWith(".ortho.tiles.virtualearth.net/tiles/h0230102033330212.jpeg?g=90") ); |
|---|
| 24 |
|
|---|
| 25 |
} |
|---|
| 26 |
|
|---|
| 27 |
|
|---|
| 28 |
|
|---|
| 29 |
abstract class MicrosoftProvider extends AbstractMapProvider { |
|---|
| 30 |
|
|---|
| 31 |
MicrosoftProvider() { |
|---|
| 32 |
super(new MercatorProjection(26, new Transformation(1.068070779e7, 0, 3.355443185e7, 0, -1.068070890e7, 3.355443057e7))); |
|---|
| 33 |
} |
|---|
| 34 |
|
|---|
| 35 |
String getZoomString(Coordinate coordinate) { |
|---|
| 36 |
return toMicrosoft( (int)coordinate.column, (int)coordinate.row, (int)coordinate.zoom ); |
|---|
| 37 |
} |
|---|
| 38 |
|
|---|
| 39 |
int tileWidth() { |
|---|
| 40 |
return 256; |
|---|
| 41 |
} |
|---|
| 42 |
|
|---|
| 43 |
int tileHeight() { |
|---|
| 44 |
return 256; |
|---|
| 45 |
} |
|---|
| 46 |
|
|---|
| 47 |
abstract String[] getTileUrls(Coordinate coordinate); |
|---|
| 48 |
|
|---|
| 49 |
} |
|---|
| 50 |
|
|---|
| 51 |
class RoadProvider extends MicrosoftProvider { |
|---|
| 52 |
String[] getTileUrls(Coordinate coordinate) { |
|---|
| 53 |
String url = "http://r" + (int)random(0, 4) + ".ortho.tiles.virtualearth.net/tiles/r" + getZoomString(sourceCoordinate(coordinate)) + ".png?g=90&shading=hill"; |
|---|
| 54 |
return new String[] { url }; |
|---|
| 55 |
} |
|---|
| 56 |
} |
|---|
| 57 |
|
|---|
| 58 |
class AerialProvider extends MicrosoftProvider { |
|---|
| 59 |
String[] getTileUrls(Coordinate coordinate) { |
|---|
| 60 |
String url = "http://a" + (int)random(0, 4) + ".ortho.tiles.virtualearth.net/tiles/a" + getZoomString(sourceCoordinate(coordinate)) + ".jpeg?g=90"; |
|---|
| 61 |
return new String[] { url }; |
|---|
| 62 |
} |
|---|
| 63 |
} |
|---|
| 64 |
|
|---|
| 65 |
class HybridProvider extends MicrosoftProvider { |
|---|
| 66 |
String[] getTileUrls(Coordinate coordinate) { |
|---|
| 67 |
String url = "http://h" + (int)random(0, 4) + ".ortho.tiles.virtualearth.net/tiles/h" + getZoomString(sourceCoordinate(coordinate)) + ".jpeg?g=90"; |
|---|
| 68 |
return new String[] { url }; |
|---|
| 69 |
} |
|---|
| 70 |
} |
|---|