@Test public void getBoundingBoxTest() { for (byte zoom = (byte) 0; zoom < 25; zoom++) { Tile tile1 = new Tile(0, 0, zoom, TILE_SIZE); if (zoom == 0) { Assert.assertTrue(tile1.getBoundingBox().equals(new BoundingBox(MercatorProjection.LATITUDE_MIN, -180, MercatorProjection.LATITUDE_MAX, 180))); } Tile tile2 = new Tile(0, 0, zoom, TILE_SIZE); Assert.assertEquals(tile1.getBoundingBox().maxLatitude, tile2.getBoundingBox().maxLatitude, 0.0001); Assert.assertEquals(tile1.getBoundingBox().minLongitude, tile2.getBoundingBox().minLongitude, 0.0001); if (zoom >= 1) { Tile tile3 = new Tile(1, 1, zoom, TILE_SIZE); Assert.assertEquals(tile1.getBelow().getBoundingBox().minLatitude, tile3.getBoundingBox().minLatitude, 0.0001); Assert.assertEquals(tile1.getRight().getBoundingBox().minLongitude, tile3.getBoundingBox().minLongitude, 0.0001); if (zoom == 1) { Assert.assertEquals(tile3.getBoundingBox().minLongitude, 0, 0.0001); Assert.assertEquals(tile3.getBoundingBox().maxLongitude, 180, 0.0001); } Assert.assertEquals(tile3.getBoundingBox(), Tile.getBoundingBox(tile3, tile3)); } Tile tile4 = new Tile(0, 0, zoom, TILE_SIZE); Assert.assertEquals(tile1.getBoundingBox().maxLatitude, tile4.getBoundingBox().maxLatitude, 0.0001); Assert.assertEquals(tile1.getBoundingBox().minLongitude, tile4.getBoundingBox().minLongitude, 0.0001); Tile tile5 = new Tile(0, 0, zoom, TILE_SIZE); Assert.assertEquals(tile1.getBoundingBox().maxLatitude, tile5.getBoundingBox().maxLatitude, 0.0001); Assert.assertEquals(tile1.getBoundingBox().minLongitude, tile5.getBoundingBox().minLongitude, 0.0001); Assert.assertEquals(tile1.getBoundingBox(), Tile.getBoundingBox(tile1, tile1)); Assert.assertEquals(tile2.getBoundingBox(), Tile.getBoundingBox(tile2, tile2)); Assert.assertEquals(tile4.getBoundingBox(), Tile.getBoundingBox(tile4, tile4)); Assert.assertEquals(tile4.getBoundingBox(), Tile.getBoundingBox(tile5, tile5)); } }
public static BoundingBox getBoundingBox(Tile upperLeft, Tile lowerRight) { BoundingBox ul = upperLeft.getBoundingBox(); BoundingBox lr = lowerRight.getBoundingBox(); return ul.extendBoundingBox(lr); }
Tile implements Serializable { public static BoundingBox getBoundingBox(Tile upperLeft, Tile lowerRight) { BoundingBox ul = upperLeft.getBoundingBox(); BoundingBox lr = lowerRight.getBoundingBox(); return ul.extendBoundingBox(lr); } }
Tile implements Serializable { public static BoundingBox getBoundingBox(Tile upperLeft, Tile lowerRight) { BoundingBox ul = upperLeft.getBoundingBox(); BoundingBox lr = lowerRight.getBoundingBox(); return ul.extendBoundingBox(lr); } Tile(int tileX, int tileY, byte zoomLevel, int tileSize); }
Tile implements Serializable { public static BoundingBox getBoundingBox(Tile upperLeft, Tile lowerRight) { BoundingBox ul = upperLeft.getBoundingBox(); BoundingBox lr = lowerRight.getBoundingBox(); return ul.extendBoundingBox(lr); } 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 BoundingBox getBoundingBox(Tile upperLeft, Tile lowerRight) { BoundingBox ul = upperLeft.getBoundingBox(); BoundingBox lr = lowerRight.getBoundingBox(); return ul.extendBoundingBox(lr); } 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; }