/** * Test method for {@link * org.geotools.referencing.factory.gridshift.NTv2GridShiftFactory#isNTv2Grid(java.lang.String)}. */ @Test public void testIsNTv2GridAvailable() { assertFalse(factory.isNTv2Grid(null)); assertFalse(factory.isNTv2Grid(INEXISTENT_GRID)); // Will log a FINEST message assertFalse(factory.isNTv2Grid(MALFORMED_GRID)); // Will log a WARNING message assertTrue(factory.isNTv2Grid(TEST_GRID)); }
/** * Constructs a {@code NTv2Transform} from the specified grid shift file. * * <p>This constructor checks for grid shift file availability, but doesn't actually load the * full grid into memory to preserve resources. * * @param file NTv2 grid file name * @throws NoSuchIdentifierException if the grid is not available. */ public NTv2Transform(URI file) throws NoSuchIdentifierException { if (file == null) { throw new NoSuchIdentifierException("No NTv2 Grid File specified.", null); } this.grid = file; gridLocation = locateGrid(grid.toString()); if (gridLocation == null) { throw new NoSuchIdentifierException("Could not locate NTv2 Grid File " + file, null); } // Search for grid file if (!FACTORY.isNTv2Grid(gridLocation)) { throw new NoSuchIdentifierException("NTv2 Grid File not available.", file.toString()); } }