@Test public void getMaxTileNumberTest() { Assert.assertEquals(0, Tile.getMaxTileNumber((byte) 0)); Assert.assertEquals(1, Tile.getMaxTileNumber((byte) 1)); Assert.assertEquals(3, Tile.getMaxTileNumber((byte) 2)); Assert.assertEquals(7, Tile.getMaxTileNumber((byte) 3)); Assert.assertEquals(1023, Tile.getMaxTileNumber((byte) 10)); Assert.assertEquals(1048575, Tile.getMaxTileNumber((byte) 20)); Assert.assertEquals(1073741823, Tile.getMaxTileNumber((byte) 30)); verifyInvalidMaxTileNumber((byte) -1); verifyInvalidMaxTileNumber(Byte.MIN_VALUE); }
public static int getMaxTileNumber(byte zoomLevel) { if (zoomLevel < 0) { throw new IllegalArgumentException("zoomLevel must not be negative: " + zoomLevel); } else if (zoomLevel == 0) { return 0; } return (2 << zoomLevel - 1) - 1; }
Tile implements Serializable { public static int getMaxTileNumber(byte zoomLevel) { if (zoomLevel < 0) { throw new IllegalArgumentException("zoomLevel must not be negative: " + zoomLevel); } else if (zoomLevel == 0) { return 0; } return (2 << zoomLevel - 1) - 1; } }
Tile implements Serializable { public static int getMaxTileNumber(byte zoomLevel) { if (zoomLevel < 0) { throw new IllegalArgumentException("zoomLevel must not be negative: " + zoomLevel); } else if (zoomLevel == 0) { return 0; } return (2 << zoomLevel - 1) - 1; } Tile(int tileX, int tileY, byte zoomLevel, int tileSize); }
Tile implements Serializable { public static int getMaxTileNumber(byte zoomLevel) { if (zoomLevel < 0) { throw new IllegalArgumentException("zoomLevel must not be negative: " + zoomLevel); } else if (zoomLevel == 0) { return 0; } return (2 << zoomLevel - 1) - 1; } Tile(int tileX, int tileY, byte zoomLevel, int tileSize); static BoundingBox getBoundingBox(Tile upperLeft, Tile lowerRight); static Rectangle getBoundaryAbsolute(Tile upperLeft, Tile lowerRight); static boolean tileAreasOverlap(Tile upperLeft, Tile lowerRight, Tile upperLeftOther, Tile lowerRightOther); static int getMaxTileNumber(byte zoomLevel); @Override boolean equals(Object obj); BoundingBox getBoundingBox(); Set<Tile> getNeighbours(); Rectangle getBoundaryAbsolute(); Rectangle getBoundaryRelative(); Point getOrigin(); Tile getLeft(); Tile getRight(); Tile getAbove(); Tile getBelow(); Tile getAboveLeft(); Tile getAboveRight(); Tile getBelowLeft(); Tile getBelowRight(); Tile getParent(); int getShiftX(Tile otherTile); int getShiftY(Tile otherTile); @Override int hashCode(); @Override String toString(); }
Tile implements Serializable { public static int getMaxTileNumber(byte zoomLevel) { if (zoomLevel < 0) { throw new IllegalArgumentException("zoomLevel must not be negative: " + zoomLevel); } else if (zoomLevel == 0) { return 0; } return (2 << zoomLevel - 1) - 1; } Tile(int tileX, int tileY, byte zoomLevel, int tileSize); static BoundingBox getBoundingBox(Tile upperLeft, Tile lowerRight); static Rectangle getBoundaryAbsolute(Tile upperLeft, Tile lowerRight); static boolean tileAreasOverlap(Tile upperLeft, Tile lowerRight, Tile upperLeftOther, Tile lowerRightOther); static int getMaxTileNumber(byte zoomLevel); @Override boolean equals(Object obj); BoundingBox getBoundingBox(); Set<Tile> getNeighbours(); Rectangle getBoundaryAbsolute(); Rectangle getBoundaryRelative(); Point getOrigin(); Tile getLeft(); Tile getRight(); Tile getAbove(); Tile getBelow(); Tile getAboveLeft(); Tile getAboveRight(); Tile getBelowLeft(); Tile getBelowRight(); Tile getParent(); int getShiftX(Tile otherTile); int getShiftY(Tile otherTile); @Override int hashCode(); @Override String toString(); final long mapSize; final int tileSize; final int tileX; final int tileY; final byte zoomLevel; }