/** * Finds the spatial bounding box of a rectangular group of tiles. * * @param rectangleExtent the rectangle of tiles. {minx, miny, maxx, maxy} in tile coordinates * @return the spatial bounding box in the coordinates of the SRS used by the GridSet */ public BoundingBox boundsFromRectangle(long[] rectangleExtent) { return gridSet.boundsFromRectangle(rectangleExtent); }
public BoundingBox getCoverageBounds(int level) { long[] coverage = getCoverage(level); return gridSet.boundsFromRectangle(coverage); }
@Test public void testBoundsFromRectangle() throws Exception { long[] rect = {0, 0, 0, 0, 0}; BoundingBox bboxTL = gridSetTL.boundsFromRectangle(rect); BoundingBox bboxBL = gridSetBL.boundsFromRectangle(rect); BoundingBox bboxTLswap = gridSetTLswap.boundsFromRectangle(rect); BoundingBox bboxBLswap = gridSetBLswap.boundsFromRectangle(rect); BoundingBox solution = new BoundingBox(-180.0, -90.0, 0.0, 90.0); assertThat(bboxTL, equalTo(solution)); assertThat(bboxBL, equalTo(solution)); assertThat(bboxTLswap, equalTo(solution)); assertThat(bboxBLswap, equalTo(solution)); long[] rect2 = {2, 1, 2, 1, 1}; BoundingBox bboxTL2 = gridSetTL.boundsFromRectangle(rect2); BoundingBox bboxBL2 = gridSetBL.boundsFromRectangle(rect2); BoundingBox bboxTLswap2 = gridSetTLswap.boundsFromRectangle(rect2); BoundingBox bboxBLswap2 = gridSetBLswap.boundsFromRectangle(rect2); BoundingBox solution2 = new BoundingBox(0.0, 0.0, 90.0, 90.0); assertThat(bboxTL2, equalTo(solution2)); assertThat(bboxBL2, equalTo(solution2)); assertThat(bboxTLswap2, equalTo(solution2)); assertThat(bboxBLswap2, equalTo(solution2)); }
public BoundingBox getBounds() { int i; long tilesWide, tilesHigh; for (i = (getGridLevels().length - 1); i > 0; i--) { tilesWide = getGridLevels()[i].getNumTilesWide(); tilesHigh = getGridLevels()[i].getNumTilesHigh(); if (tilesWide == 1 && tilesHigh == 0) { break; } } tilesWide = getGridLevels()[i].getNumTilesWide(); tilesHigh = getGridLevels()[i].getNumTilesHigh(); long[] ret = {0, 0, tilesWide - 1, tilesHigh - 1, i}; return boundsFromRectangle(ret); }