@Override public String getDescription() { return delegateFormat.getDescription(); } };
@Override public String getDocURL() { return delegateFormat.getDocURL(); }
@Override public String getName() { return delegateFormat.getName(); }
private GeoTiffWriteParams buildWriteParams(GridCoverage2D coverage) { final RenderedImage renderedImage = coverage.getRenderedImage(); int tileWidth = renderedImage.getTileWidth(); int tileHeight = renderedImage.getTileHeight(); // avoid tiles bigger than the image final GridEnvelope gr = coverage.getGridGeometry().getGridRange(); if (gr.getSpan(0) < tileWidth) { tileWidth = gr.getSpan(0); } if (gr.getSpan(1) < tileHeight) { tileHeight = gr.getSpan(1); } GeoTiffWriteParams writeParams = new GeoTiffWriteParams(); writeParams.setTilingMode(GeoToolsWriteParams.MODE_EXPLICIT); writeParams.setTiling(tileWidth, tileHeight); return writeParams; }
/** * Utility method for finding Params * * @param factory DOCUMENT ME! * @param key DOCUMENT ME! * @return DOCUMENT ME! */ public static ParameterValue find(Format format, String key) { return find(format.getReadParameters(), key); }
private void assertBandNames(GridCoverage coverage, String... bandNames) { assertEquals(bandNames.length, coverage.getNumSampleDimensions()); for (int i = 0; i < bandNames.length; i++) { String expectedName = bandNames[i]; String actualName = coverage.getSampleDimension(i).getDescription().toString(); assertEquals(expectedName, actualName); } }
/** * Cleans up a coverage and its internal rendered image * * @param coverage */ public static void disposeCoverage(GridCoverage coverage) { RenderedImage ri = coverage.getRenderedImage(); if (coverage instanceof GridCoverage2D) { ((GridCoverage2D) coverage).dispose(true); } if (ri instanceof PlanarImage) { ImageUtilities.disposePlanarImageChain((PlanarImage) ri); } }
protected void dispose(CoverageHintReaderKey key, GridCoverageReader reader) { CoverageStoreInfo info = catalog.getCoverageStore(key.id); if (info != null) { String name = info.getName(); LOGGER.fine("Disposing coverage store '" + name + "'"); fireDisposed(info, reader); } try { reader.dispose(); } catch (Exception e) { LOGGER.warning("Error occured disposing coverage reader '" + info.getName() + "'"); LOGGER.log(Level.FINE, "", e); } } }
@Test public void testPreserveStructuredReader() throws IOException { // we have to make sure time ranges native name is set to trigger the bug in question CoverageInfo ci = getCatalog().getCoverageByName(getLayerId(TIMERANGES)); assertTrue(ci.getGridCoverageReader(null, null) instanceof StructuredGridCoverage2DReader); String name = ci.getGridCoverageReader(null, null).getGridCoverageNames()[0]; ci.setNativeCoverageName(name); getCatalog().save(ci); ci = getCatalog().getCoverageByName(getLayerId(TIMERANGES)); assertTrue(ci.getGridCoverageReader(null, null) instanceof StructuredGridCoverage2DReader); }
@Override public ParameterValueGroup getWriteParameters() { return delegateFormat.getWriteParameters(); }
@Override public String getVendor() { return delegateFormat.getVendor(); }
@Override public String getVersion() { return delegateFormat.getVersion(); }
/** Helper method that checks if the delegate reader support bands selection. */ private boolean checkIfDelegateReaderSupportsBands() { List<GeneralParameterDescriptor> parameters = delegate.getFormat().getReadParameters().getDescriptor().descriptors(); for (GeneralParameterDescriptor parameterDescriptor : parameters) { if (parameterDescriptor.getName().equals(AbstractGridFormat.BANDS.getName())) { return true; } } return false; }
private void disposeCoverage(GridCoverage coverage) { RenderedImage ri = coverage.getRenderedImage(); if (coverage instanceof GridCoverage2D) { ((GridCoverage2D) coverage).dispose(true); } if (ri instanceof PlanarImage) { ImageUtilities.disposePlanarImageChain((PlanarImage) ri); } }
/** * When loading from DTO use the params to locate factory. * * <p>bleck */ public static Format aquireFactoryByType(String type) { final Format[] formats = GridFormatFinder.getFormatArray(); Format format = null; final int length = formats.length; for (int i = 0; i < length; i++) { format = formats[i]; if (format.getName().equals(type)) { return format; } } return null; }
protected void dispose(String id, GridCoverageReader reader) { CoverageStoreInfo info = catalog.getCoverageStore(id); if (info != null) { String name = info.getName(); LOGGER.fine("Disposing coverage store '" + name + "'"); fireDisposed(info, reader); } try { reader.dispose(); } catch (Exception e) { LOGGER.warning("Error occured disposing coverage reader '" + info.getName() + "'"); LOGGER.log(Level.FINE, "", e); } } }
/** * After user has selected Description can aquire Format based on description. * * @param description */ public static Format aquireFactory(String description) { Format[] formats = GridFormatFinder.getFormatArray(); Format format = null; final int length = formats.length; for (int i = 0; i < length; i++) { format = formats[i]; if (format.getDescription().equals(description)) { return format; } } return null; }
/** * Returns the format for a coverage. * * <p>The format is inferred from {@link CoverageStoreInfo#getType()} * * @param info The coverage metadata. * @return The format, or null. */ @SuppressWarnings("deprecation") public AbstractGridFormat getGridCoverageFormat(CoverageStoreInfo info) { final int length = CoverageStoreUtils.formats.length; for (int i = 0; i < length; i++) { if (CoverageStoreUtils.formats[i].getName().equals(info.getType())) { return (AbstractGridFormat) CoverageStoreUtils.formats[i]; } } return null; }
/** * Returns the descriptions for the available DataFormats. * * <p>Arrrg! Put these in the select box. * * @return Descriptions for user to choose from */ public static List listDataFormatsDescriptions() { List list = new ArrayList(); Format[] formats = GridFormatFinder.getFormatArray(); final int length = formats.length; for (int i = 0; i < length; i++) { if (!list.contains(formats[i].getDescription())) { list.add(formats[i].getDescription()); } } return Collections.synchronizedList(list); }
public static Format acquireFormat(String type) throws IOException { Format[] formats = GridFormatFinder.getFormatArray(); Format format = null; final int length = formats.length; for (int i = 0; i < length; i++) { if (formats[i].getName().equals(type)) { format = formats[i]; break; } } if (format == null) { throw new IOException("Cannot handle format: " + type); } else { return format; } }