GridCellGeometry { public Geometry getCellGeometry(int xIndex, int yIndex) { if (xIndex < 0 || xIndex >= xCellCount || yIndex < 0 || yIndex >= yCellCount) { throw new IndexOutOfBoundsException(); } return getCellGeometryQuick(xIndex, yIndex); } GridCellGeometry(GridCoordSystem gridCoordSystem); GridCoordSystem getGridCoordSystem(); CoordinateReferenceSystem getGridCRS(); int getCellCountX(); int getCellCountY(); int getCellCount(); Geometry getCellGeometry(int xIndex, int yIndex); final int calculateYXIndex(int xIndex, int yIndex);  }
@Test public void testGeometryIndexOOB() { try { gcg.getCellGeometry(X_SIZE, 0); fail("expected IndexOutOfBoundsException on X index = X_SIZE"); } catch (IndexOutOfBoundsException e) { } try { gcg.getCellGeometry(-1, 0); fail("expected IndexOutOfBoundsException on X index = -1"); } catch (IndexOutOfBoundsException e) { } try { gcg.getCellGeometry(0, Y_SIZE); fail("expected IndexOutOfBoundsException on Y index = Y_SIZE"); } catch (IndexOutOfBoundsException e) { } try { gcg.getCellGeometry(0, -1); fail("expected IndexOutOfBoundsException on Y index = -1"); } catch (IndexOutOfBoundsException e) { } }
@Test public void testGetGeometryProper() { assertNotNull("Geometry should not be null", gcg.getCellGeometry(0, 0)); }
@Test public void testProjectionGeometry() throws IOException { String datasetUrl = getResourceDir() + File.separator + "testProjectedTYXGrid.ncml"; assignGridCellGeometryAndGridCoordSystem(datasetUrl); assertNotNull("Geometry should not be null", gcg.getCellGeometry(0, 0)); }
@Test public void testRotatedGeometry() throws IOException { String datasetUrl = getResourceDir() + File.separator + "testRotatedTYXGrid.ncml"; assignGridCellGeometryAndGridCoordSystem(datasetUrl); assertNotNull("Geometry should not be null", gcg.getCellGeometry(0, 0)); }