@Override public String getDataLocationId() { return ( cachedReader != null ) ? cachedReader.getDataLocationId() : super.getDataLocationId(); }
/** * Adds a raster reader to this cache, all cache files will be written to this cache directory. * * @param reader * to add to the cache. * @return a new CachedReader which was added to the cache. */ public RasterReader addReader( RasterReader reader ) { CacheRasterReader result = null; if ( reader != null ) { if ( reader instanceof CacheRasterReader ) { result = (CacheRasterReader) reader; } else { boolean createCache = reader.shouldCreateCacheFile(); File cacheFile = null; if ( createCache ) { cacheFile = createCacheFile( reader.getDataLocationId() ); } result = new CacheRasterReader( reader, cacheFile, this ); } addReader( result ); } else { LOG.debug( "Not adding reader to cache, because it is was null." ); } if ( LOG.isDebugEnabled() && result != null && reader != null ) { LOG.debug( "Adding reader to cache {} with id: {}.", reader, reader.getDataLocationId() ); } return result; }
ByteBufferRasterData data = (ByteBufferRasterData) tile.getRasterData(); RasterReader origReader = data.getReader(); final String tileName = origReader.getDataLocationId(); if ( tiles.size() == 1 ) { if ( outputLocation.isFile() ) {
String id = origReader.getDataLocationId(); File outputFile = new File( outputDir, id + "." + outputType ); RasterFactory.saveRasterToFile( subRaster, outputFile ); Envelope env = raster.getEnvelope(); AbstractRaster subRaster = filteredRaster.getSubRaster( env ); String id = origReader.getDataLocationId(); File outputFile = new File( outputDir, id + "." + outputType ); RasterFactory.saveRasterToFile( subRaster, outputFile );