org.geotools.coverageio
Class BaseGridCoverage2DReader

Object
  extended by AbstractGridCoverage2DReader
      extended by BaseGridCoverage2DReader
All Implemented Interfaces:
GridCoverage2DReader, GridCoverageReader
Direct Known Subclasses:
BaseGDALGridCoverage2DReader

public abstract class BaseGridCoverage2DReader
extends AbstractGridCoverage2DReader
implements GridCoverage2DReader

Base class for GridCoverage data access

Author:
Daniele Romagnoli, GeoSolutions, Simone Giannecchini, GeoSolutions

Field Summary
 
Fields inherited from class AbstractGridCoverage2DReader
closeMe, coverageFactory, crs, gzipped, highestRes, hints, inStream, inStreamSPI, numOverviews, originalEnvelope, originalGridRange, overViewResolutions, raster2Model, source
 
Fields inherited from interface GridCoverage2DReader
ELEVATION_DOMAIN, ELEVATION_DOMAIN_MAXIMUM, ELEVATION_DOMAIN_MINIMUM, ELEVATION_DOMAIN_RESOLUTION, FILE_SOURCE_PROPERTY, HAS_ELEVATION_DOMAIN, HAS_TIME_DOMAIN, TIME_DOMAIN, TIME_DOMAIN_MAXIMUM, TIME_DOMAIN_MINIMUM, TIME_DOMAIN_RESOLUTION
 
Constructor Summary
protected BaseGridCoverage2DReader(Object input, Hints hints, String worldFileExtension, ImageReaderSpi formatSpecificSpi)
          Creates a new instance of a BaseGridCoverage2DReader.
 
Method Summary
 String getCoverageName()
           
 int getGridCoverageCount()
          Retrieve the number of coverages contained within the input source.
 ServiceInfo getInfo()
          Information about this source.
 ResourceInfo getInfo(String subname)
          Information about the named gridcoverage.
protected  File getInputFile()
           
 boolean hasMoreGridCoverages()
          Returns true if there is at least one more grid coverage available on the stream.
protected  void parsePRJFile()
          Gets the coordinate reference system that will be associated to the GridCoverage by looking for a related PRJ.
protected  void parseWorldFile()
          Checks whether a world file is associated with the data source.
 GridCoverage2D read(GeneralParameterValue[] params)
          Returns a GridCoverage from this reader in compliance with the specified parameters.
protected abstract  void setCoverageProperties(ImageReader reader)
          Implement this method to setup the coverage properties (Envelope, CRS, GridRange) using the provided ImageReader
 
Methods inherited from class AbstractGridCoverage2DReader
checkName, createImageCoverage, createImageCoverage, createImageCoverage, createImageCoverage, decimationOnReadingControl, decimationOnReadingControl, dispose, finalize, getCoordinateReferenceSystem, getCoordinateReferenceSystem, getCrs, getCurrentSubname, getDynamicParameters, getDynamicParameters, getGridCoverageNames, getHighestRes, getImageLayout, getImageLayout, getMetadataNames, getMetadataNames, getMetadataValue, getMetadataValue, getNumOverviews, getNumOverviews, getOriginalEnvelope, getOriginalEnvelope, getOriginalGridRange, getOriginalGridRange, getOriginalGridToWorld, getOriginalGridToWorld, getOverviewGridEnvelope, getOverviewGridEnvelope, getReadingResolutions, getReadingResolutions, getResolution, getResolutionLevels, getResolutionLevels, getSource, listSubNames, read, setlayout, setLayout, setReadParams, setReadParams, skip
 
Methods inherited from class Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface GridCoverage2DReader
getCoordinateReferenceSystem, getCoordinateReferenceSystem, getDynamicParameters, getDynamicParameters, getImageLayout, getImageLayout, getNumOverviews, getNumOverviews, getOriginalEnvelope, getOriginalEnvelope, getOriginalGridRange, getOriginalGridRange, getOriginalGridToWorld, getOriginalGridToWorld, getReadingResolutions, getReadingResolutions, getResolutionLevels, getResolutionLevels, read
 
Methods inherited from interface GridCoverageReader
dispose, getCurrentSubname, getFormat, getGridCoverageNames, getMetadataNames, getMetadataNames, getMetadataValue, getMetadataValue, getSource, listSubNames, skip
 

Constructor Detail

BaseGridCoverage2DReader

protected BaseGridCoverage2DReader(Object input,
                                   Hints hints,
                                   String worldFileExtension,
                                   ImageReaderSpi formatSpecificSpi)
                            throws DataSourceException
Creates a new instance of a BaseGridCoverage2DReader. I assume nothing about file extension.

Parameters:
input - Source object for which we want to build a BaseGridCoverage2DReader.
hints - Hints to be used by this reader throughout his life.
worldFileExtension - the specific world file extension of the underlying format
formatSpecificSpi - an instance of a proper ImageReaderSpi.
Throws:
DataSourceException
Method Detail

setCoverageProperties

protected abstract void setCoverageProperties(ImageReader reader)
                                       throws IOException
Implement this method to setup the coverage properties (Envelope, CRS, GridRange) using the provided ImageReader

Throws:
IOException

read

public GridCoverage2D read(GeneralParameterValue[] params)
                    throws IllegalArgumentException,
                           IOException
Returns a GridCoverage from this reader in compliance with the specified parameters.

Specified by:
read in interface GridCoverage2DReader
Specified by:
read in interface GridCoverageReader
Specified by:
read in class AbstractGridCoverage2DReader
Parameters:
params - a GeneralParameterValue array to customize the read operation.
Returns:
a grid coverage from the input source.
Throws:
InvalidParameterNameException - if a parameter in parameters doesn't have a recognized name.
InvalidParameterValueException - if a parameter in parameters doesn't have a valid value.
ParameterNotFoundException - if a parameter was required for the operation but was not provided in the parameters list.
IOException - if a read operation failed for some other input/output reason, including FileNotFoundException if no file with the given name can be found, or IIOException if an error was thrown by the underlying image library.
IllegalArgumentException

parsePRJFile

protected void parsePRJFile()
Gets the coordinate reference system that will be associated to the GridCoverage by looking for a related PRJ.


parseWorldFile

protected void parseWorldFile()
Checks whether a world file is associated with the data source. If found, set a proper envelope.

Throws:
IllegalStateException
IOException

getInfo

public ServiceInfo getInfo()
Information about this source. Subclasses should provide additional format specific information.

Overrides:
getInfo in class AbstractGridCoverage2DReader
Returns:
ServiceInfo describing getSource().

getInfo

public ResourceInfo getInfo(String subname)
Information about the named gridcoverage.

Parameters:
subname - Name indicing grid coverage to describe
Returns:
ResourceInfo describing grid coverage indicated

getInputFile

protected File getInputFile()
Returns:
the input file

getCoverageName

public String getCoverageName()
Returns:
the coverage name

getGridCoverageCount

public int getGridCoverageCount()
Description copied from interface: GridCoverageReader
Retrieve the number of coverages contained within the input source.

Specified by:
getGridCoverageCount in interface GridCoverageReader
Overrides:
getGridCoverageCount in class AbstractGridCoverage2DReader
Returns:
the gridCoverage count
See Also:
GridCoverageReader.getGridCoverageCount()

hasMoreGridCoverages

public boolean hasMoreGridCoverages()
Description copied from interface: GridCoverageReader
Returns true if there is at least one more grid coverage available on the stream.

Specified by:
hasMoreGridCoverages in interface GridCoverageReader
Overrides:
hasMoreGridCoverages in class AbstractGridCoverage2DReader
See Also:
GridCoverageReader.hasMoreGridCoverages()


Copyright © 1996-2014 Geotools. All Rights Reserved.