@Test public void getMapSizeTest() { for (byte zoomLevel = ZOOM_LEVEL_MIN; zoomLevel <= ZOOM_LEVEL_MAX; ++zoomLevel) { long factor = Math.round(Math.pow(2, zoomLevel)); Assert.assertEquals(Tile.TILE_SIZE * factor, MercatorProjection.getMapSize(zoomLevel)); } try { MercatorProjection.getMapSize((byte) -1); Assert.fail(); } catch (IllegalArgumentException e) { Assert.assertTrue(true); } }
public static long getMapSize(byte zoomLevel) { if (zoomLevel < 0) { throw new IllegalArgumentException("zoom level must not be negative: " + zoomLevel); } long mapSize = ((long) Tile.TILE_SIZE) << zoomLevel; return mapSize; }
MercatorProjection { public static long getMapSize(byte zoomLevel) { if (zoomLevel < 0) { throw new IllegalArgumentException("zoom level must not be negative: " + zoomLevel); } long mapSize = ((long) Tile.TILE_SIZE) << zoomLevel; return mapSize; } }
MercatorProjection { public static long getMapSize(byte zoomLevel) { if (zoomLevel < 0) { throw new IllegalArgumentException("zoom level must not be negative: " + zoomLevel); } long mapSize = ((long) Tile.TILE_SIZE) << zoomLevel; return mapSize; } private  MercatorProjection(); }
MercatorProjection { public static long getMapSize(byte zoomLevel) { if (zoomLevel < 0) { throw new IllegalArgumentException("zoom level must not be negative: " + zoomLevel); } long mapSize = ((long) Tile.TILE_SIZE) << zoomLevel; return mapSize; } private  MercatorProjection(); static double calculateGroundResolution(double latitude, byte zoomLevel); static double deltaLat(double deltaPixel, double lat, byte zoom); static long getMapSize(byte zoomLevel); static double latitudeToPixelY(double latitude, byte zoomLevel); static long latitudeToTileY(double latitude, byte zoomLevel); static double longitudeToPixelX(double longitude, byte zoomLevel); static long longitudeToTileX(double longitude, byte zoomLevel); static double pixelXToLongitude(double pixelX, byte zoomLevel); static long pixelXToTileX(double pixelX, byte zoomLevel); static double pixelYToLatitude(double pixelY, byte zoomLevel); static long pixelYToTileY(double pixelY, byte zoomLevel); static double tileXToLongitude(long tileX, byte zoomLevel); static double tileYToLatitude(long tileY, byte zoomLevel); }
MercatorProjection { public static long getMapSize(byte zoomLevel) { if (zoomLevel < 0) { throw new IllegalArgumentException("zoom level must not be negative: " + zoomLevel); } long mapSize = ((long) Tile.TILE_SIZE) << zoomLevel; return mapSize; } private  MercatorProjection(); static double calculateGroundResolution(double latitude, byte zoomLevel); static double deltaLat(double deltaPixel, double lat, byte zoom); static long getMapSize(byte zoomLevel); static double latitudeToPixelY(double latitude, byte zoomLevel); static long latitudeToTileY(double latitude, byte zoomLevel); static double longitudeToPixelX(double longitude, byte zoomLevel); static long longitudeToTileX(double longitude, byte zoomLevel); static double pixelXToLongitude(double pixelX, byte zoomLevel); static long pixelXToTileX(double pixelX, byte zoomLevel); static double pixelYToLatitude(double pixelY, byte zoomLevel); static long pixelYToTileY(double pixelY, byte zoomLevel); static double tileXToLongitude(long tileX, byte zoomLevel); static double tileYToLatitude(long tileY, byte zoomLevel); static final double EARTH_CIRCUMFERENCE; static final double LATITUDE_MAX; static final double LATITUDE_MIN; }