@Test public void testReader() throws IllegalArgumentException, IOException, NoSuchAuthorityCodeException { final File file = TestData.file(this, "."); final File files[] = file.listFiles(); final int numFiles = files.length; final AbstractGridFormat format = new GeoTiffFormat(); for (int i = 0; i < numFiles; i++) { StringBuilder buffer = new StringBuilder(); final String path = files[i].getAbsolutePath().toLowerCase(); if (!path.endsWith("tif") && !path.endsWith("tiff")||path.contains("no_crs")) continue; if (path.contains("ovr.tif")) continue; buffer.append(files[i].getAbsolutePath()).append("\n"); Object o; if (i % 2 == 0) o = files[i]; else o = files[i].toURI().toURL(); if (format.accepts(o)) { buffer.append("ACCEPTED").append("\n"); GeoTiffReader reader = new GeoTiffReader(o, new Hints( Hints.FORCE_LONGITUDE_FIRST_AXIS_ORDER, Boolean.TRUE)); if (reader != null) { GridCoverage2D coverage = (GridCoverage2D) reader.read(null); if (TestData.isInteractiveTest()) { buffer.append("CRS: ") .append(coverage.getCoordinateReferenceSystem2D().toWKT()) .append("\n"); buffer.append("GG: ").append(coverage.getGridGeometry().toString()) .append("\n"); } if (TestData.isInteractiveTest()) coverage.show(); else PlanarImage.wrapRenderedImage(coverage.getRenderedImage()).getTiles(); } } else buffer.append("NOT ACCEPTED").append("\n"); if (TestData.isInteractiveTest()) LOGGER.info(buffer.toString()); } }
@Override public GridCoverage2D read(GeneralParameterValue[] params) throws IOException { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.fine("Reading image from " + sourceURL.toString() + "\n" + "Highest res " + highestRes[0] + " " + highestRes[1]); } final Collection<GridCoverage2D> response = rasterManager.read(params); if (response.isEmpty()) { if (LOGGER.isLoggable(Level.FINE)){ LOGGER.fine("The response is empty. ==> returning a null GridCoverage"); } return null; } else { return response.iterator().next(); } }
GeoTiffReader extends AbstractGridCoverage2DReader implements
		GridCoverageReader { @Override public GridCoverage2D read(GeneralParameterValue[] params) throws IOException { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.fine("Reading image from " + sourceURL.toString() + "\n" + "Highest res " + highestRes[0] + " " + highestRes[1]); } final Collection<GridCoverage2D> response = rasterManager.read(params); if (response.isEmpty()) { if (LOGGER.isLoggable(Level.FINE)){ LOGGER.fine("The response is empty. ==> returning a null GridCoverage"); } return null; } else { return response.iterator().next(); } } }
GeoTiffReader extends AbstractGridCoverage2DReader implements
		GridCoverageReader { @Override public GridCoverage2D read(GeneralParameterValue[] params) throws IOException { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.fine("Reading image from " + sourceURL.toString() + "\n" + "Highest res " + highestRes[0] + " " + highestRes[1]); } final Collection<GridCoverage2D> response = rasterManager.read(params); if (response.isEmpty()) { if (LOGGER.isLoggable(Level.FINE)){ LOGGER.fine("The response is empty. ==> returning a null GridCoverage"); } return null; } else { return response.iterator().next(); } } GeoTiffReader(Object input);  GeoTiffReader(Object input, Hints uHints); }
GeoTiffReader extends AbstractGridCoverage2DReader implements
		GridCoverageReader { @Override public GridCoverage2D read(GeneralParameterValue[] params) throws IOException { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.fine("Reading image from " + sourceURL.toString() + "\n" + "Highest res " + highestRes[0] + " " + highestRes[1]); } final Collection<GridCoverage2D> response = rasterManager.read(params); if (response.isEmpty()) { if (LOGGER.isLoggable(Level.FINE)){ LOGGER.fine("The response is empty. ==> returning a null GridCoverage"); } return null; } else { return response.iterator().next(); } } GeoTiffReader(Object input);  GeoTiffReader(Object input, Hints uHints); @Override int getGridCoverageCount(); @Override void dispose(); Format getFormat(); @Override GridCoverage2D read(GeneralParameterValue[] params); GeoTiffIIOMetadataDecoder getMetadata(); }
GeoTiffReader extends AbstractGridCoverage2DReader implements
		GridCoverageReader { @Override public GridCoverage2D read(GeneralParameterValue[] params) throws IOException { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.fine("Reading image from " + sourceURL.toString() + "\n" + "Highest res " + highestRes[0] + " " + highestRes[1]); } final Collection<GridCoverage2D> response = rasterManager.read(params); if (response.isEmpty()) { if (LOGGER.isLoggable(Level.FINE)){ LOGGER.fine("The response is empty. ==> returning a null GridCoverage"); } return null; } else { return response.iterator().next(); } } GeoTiffReader(Object input);  GeoTiffReader(Object input, Hints uHints); @Override int getGridCoverageCount(); @Override void dispose(); Format getFormat(); @Override GridCoverage2D read(GeneralParameterValue[] params); GeoTiffIIOMetadataDecoder getMetadata();  }