org.geotools.coverageio
Class BaseGridCoverage2DReader

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

public abstract class BaseGridCoverage2DReader
extends AbstractGridCoverage2DReader
implements GridCoverageReader

Base class for GridCoverage data access

Author:
Daniele Romagnoli, GeoSolutions, Simone Giannecchini, GeoSolutions

Field Summary
 
Fields inherited from class AbstractGridCoverage2DReader
closeMe, coverageFactory, crs, demColors, EPS, gzipped, highestRes, hints, inStream, numOverviews, originalEnvelope, originalGridRange, overViewResolutions, raster2Model, source
 
Constructor Summary
protected BaseGridCoverage2DReader(Object input, Hints hints, String worldFileExtension, ImageReaderSpi formatSpecificSpi)
          Creates a new instance of a BaseGridCoverage2DReader.
 
Method Summary
protected  CoordinateReferenceSystem getCoverageCRS()
           
protected  GeneralEnvelope getCoverageEnvelope()
           
protected  GridEnvelope2D getCoverageGridRange()
           
 String getCoverageName()
           
 int getGridCoverageCount()
           
 ServiceInfo getInfo()
          Information about this source.
 ResourceInfo getInfo(String subname)
          Information about the named gridcoverage.
protected  File getInputFile()
           
 boolean hasMoreGridCoverages()
           
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  void setCoverageCRS(CoordinateReferenceSystem coverageCRS)
           
protected  void setCoverageEnvelope(GeneralEnvelope coverageEnvelope)
           
protected  void setCoverageGridRange(GridEnvelope2D coverageGridRange)
           
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
createImageCoverage, createImageCoverage, decimationOnReadingControl, dispose, finalize, getCrs, getCurrentSubname, getMetadataNames, getMetadataValue, getOriginalEnvelope, getOriginalGridRange, getOriginalGridToWorld, getResolution, getSource, listSubNames, setReadParams, skip
 
Methods inherited from class Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface GridCoverageReader
dispose, getCurrentSubname, getFormat, getMetadataNames, 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 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:
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

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

setCoverageCRS

protected void setCoverageCRS(CoordinateReferenceSystem coverageCRS)
Parameters:
nativeCRS - the nativeCRS to set

getCoverageCRS

protected CoordinateReferenceSystem getCoverageCRS()
Returns:
the nativeCRS

setCoverageEnvelope

protected void setCoverageEnvelope(GeneralEnvelope coverageEnvelope)
Parameters:
nativeEnvelope - the nativeEnvelope to set

getCoverageEnvelope

protected GeneralEnvelope getCoverageEnvelope()
Returns:
the nativeEnvelope

setCoverageGridRange

protected void setCoverageGridRange(GridEnvelope2D coverageGridRange)
Parameters:
nativeGridRange - the nativeGridRange to set

getCoverageGridRange

protected GridEnvelope2D getCoverageGridRange()
Returns:
the nativeGridRange

getInputFile

protected File getInputFile()
Returns:
the input file

getCoverageName

public String getCoverageName()
Returns:
the coverage name

getGridCoverageCount

public int getGridCoverageCount()
Overrides:
getGridCoverageCount in class AbstractGridCoverage2DReader
Returns:
the gridCoverage count
See Also:
org.opengis.coverage.grid.GridCoverageReader#getGridCoverageCount()

hasMoreGridCoverages

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

parsePRJFile

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



Copyright © 1996-2010 Geotools. All Rights Reserved.