org.geotools.coverage.io
Class ExoreferencedGridCoverageReader

java.lang.Object
  extended by org.geotools.coverage.io.AbstractGridCoverageReader
      extended by org.geotools.coverage.io.ExoreferencedGridCoverageReader
All Implemented Interfaces:
GridCoverageReader

Deprecated. To be refactored (work in progress).

public class ExoreferencedGridCoverageReader
extends AbstractGridCoverageReader

An implementation of AbstractGridCoverageReader using informations parsed by a TextMetadataParser object. This reader is typically used for format that stores pixel values and geographic metadata in separated files. For example, pixel values may be stored as a PNG images ou a RAW binary file, and geographic metadata (coordinate system, geographic location, etc.) may be stored in a separated text file. The text file is parsed by a TextMetadataParser object, while the pixel values are read by a ImageReader object.

Since:
2.2
Version:
$Id: ExoreferencedGridCoverageReader.java 30965 2008-07-09 10:04:21Z cedricbr $
Author:
Martin Desruisseaux (IRD), Cédric Briançon

Field Summary
protected  TextMetadataParser metadata
          Deprecated. The object to use for parsing the meta-data.
 
Fields inherited from class org.geotools.coverage.io.AbstractGridCoverageReader
gridToEnvelope, reader
 
Constructor Summary
ExoreferencedGridCoverageReader(Hints hints, java.lang.String formatName, java.lang.String extension, TextMetadataParser parser)
          Deprecated. Constructs a new ExoreferencedGridCoverageReader using the specified MetadataBuilder.
ExoreferencedGridCoverageReader(Hints hints, java.lang.String formatName, TextMetadataParser parser)
          Deprecated. Constructs a new ExoreferencedGridCoverageReader using the specified TextMetadataParser.
 
Method Summary
 org.opengis.referencing.crs.CoordinateReferenceSystem getCoordinateReferenceSystem(int index)
          Deprecated. Returns the coordinate system for the GridCoverage to be read.
 org.opengis.geometry.Envelope getEnvelope(int index)
          Deprecated. Returns the envelope for the GridCoverage to be read.
 org.opengis.coverage.grid.GridRange getGridRange(int index)
          Deprecated. Returns the grid range for the GridCoverage to be read.
 GridSampleDimension[] getSampleDimensions(int index)
          Deprecated. Returns the sample dimensions for each band of the GridCoverage to be read.
 void reset()
          Deprecated. Restores the coverage reader to its initial state.
 void setInput(java.lang.Object input, boolean seekForwardOnly)
          Deprecated. Sets the input source to the given object.
 void setLocale(java.util.Locale locale)
          Deprecated. Sets the current locale of this grid coverage reader to the given value.
protected  java.lang.String toImageFileName(java.lang.String filename)
          Deprecated. Returns the filename for image data.
 
Methods inherited from class org.geotools.coverage.io.AbstractGridCoverageReader
getGridCoverage, getImageReaders, getLocale, getMathTransform, getName, getNumImages
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

metadata

protected final TextMetadataParser metadata
Deprecated. 
The object to use for parsing the meta-data.

Constructor Detail

ExoreferencedGridCoverageReader

public ExoreferencedGridCoverageReader(Hints hints,
                                       java.lang.String formatName,
                                       TextMetadataParser parser)
Deprecated. 
Constructs a new ExoreferencedGridCoverageReader using the specified TextMetadataParser.

Parameters:
hints - The factory hints to use.
formatName - The name for this format. This format name should be understood by ImageIO.getImageReadersByFormatName(String), unless AbstractGridCoverageReader.getImageReaders(java.lang.Object) is overridden.
parser - The TextMetadataParser to use for reading geographic metadata.

ExoreferencedGridCoverageReader

public ExoreferencedGridCoverageReader(Hints hints,
                                       java.lang.String formatName,
                                       java.lang.String extension,
                                       TextMetadataParser parser)
Deprecated. 
Constructs a new ExoreferencedGridCoverageReader using the specified MetadataBuilder.

Parameters:
hints - The factory hints to use.
formatName - The name for this format. This format name should be understood by ImageIO.getImageReadersByFormatName(String), unless AbstractGridCoverageReader.getImageReaders(java.lang.Object) is overridden.
extension - Filename's extensions for file of this format.
parser - The TextMetadataParser to use for reading geographic metadata.
Method Detail

reset

public void reset()
           throws java.io.IOException
Deprecated. 
Restores the coverage reader to its initial state.

Specified by:
reset in interface GridCoverageReader
Overrides:
reset in class AbstractGridCoverageReader
Throws:
java.io.IOException - if an error occurs while disposing resources.

setLocale

public void setLocale(java.util.Locale locale)
Deprecated. 
Sets the current locale of this grid coverage reader to the given value. A value of null removes any previous setting, and indicates that the reader should localize as it sees fit.

Overrides:
setLocale in class AbstractGridCoverageReader

setInput

public void setInput(java.lang.Object input,
                     boolean seekForwardOnly)
              throws java.io.IOException
Deprecated. 
Sets the input source to the given object. The input must be File or an URL object. The input source must be the metadata file or URL. The image file or URL will be derived from the metadata filename by a call to toImageFileName(java.lang.String), which may be overridden.

Specified by:
setInput in interface GridCoverageReader
Overrides:
setInput in class AbstractGridCoverageReader
Parameters:
input - The File or URL to be read.
seekForwardOnly - if true, grid coverages and metadata may only be read in ascending order from the input source.
Throws:
java.io.IOException - if an I/O operation failed.
java.lang.IllegalArgumentException - if input is not an instance of a classe supported by this reader.

toImageFileName

protected java.lang.String toImageFileName(java.lang.String filename)
Deprecated. 
Returns the filename for image data. This method is invoked by setInput(java.lang.Object, boolean) after metadata has been loaded. Default implementation just replace the file extension by the extension argument specified to the constructor.

Parameters:
filename - The filename part of metadata file. This is the filename part of the file supplied by users to setInput(java.lang.Object, boolean).
Returns:
The filename to use for for the image file. The directory is assumed to be the same than the metadata file.

getCoordinateReferenceSystem

public org.opengis.referencing.crs.CoordinateReferenceSystem getCoordinateReferenceSystem(int index)
                                                                                   throws java.io.IOException
Deprecated. 
Returns the coordinate system for the GridCoverage to be read. The default implementation invokes metadata.getCoordinateReferenceSystem().

Specified by:
getCoordinateReferenceSystem in interface GridCoverageReader
Specified by:
getCoordinateReferenceSystem in class AbstractGridCoverageReader
Parameters:
index - The index of the image to be queried.
Returns:
The coordinate system for the GridCoverage at the specified index.
Throws:
java.lang.IllegalStateException - if the input source has not been set.
java.lang.IndexOutOfBoundsException - if the supplied index is out of bounds.
java.io.IOException - if an error occurs reading the width information from the input source.

getEnvelope

public org.opengis.geometry.Envelope getEnvelope(int index)
                                          throws java.io.IOException
Deprecated. 
Returns the envelope for the GridCoverage to be read. The default implementation invokes metadata.getEnvelope().

Specified by:
getEnvelope in interface GridCoverageReader
Specified by:
getEnvelope in class AbstractGridCoverageReader
Parameters:
index - The index of the image to be queried.
Returns:
The envelope for the GridCoverage at the specified index.
Throws:
java.lang.IllegalStateException - if the input source has not been set.
java.lang.IndexOutOfBoundsException - if the supplied index is out of bounds.
java.io.IOException - if an error occurs reading the width information from the input source.

getGridRange

public org.opengis.coverage.grid.GridRange getGridRange(int index)
                                                 throws java.io.IOException
Deprecated. 
Returns the grid range for the GridCoverage to be read. The default implementation invokes metadata.getGridRange().

Specified by:
getGridRange in interface GridCoverageReader
Overrides:
getGridRange in class AbstractGridCoverageReader
Parameters:
index - The index of the image to be queried.
Returns:
The grid range for the GridCoverage at the specified index.
Throws:
java.lang.IllegalStateException - if the input source has not been set.
java.lang.IndexOutOfBoundsException - if the supplied index is out of bounds.
java.io.IOException - if an error occurs reading the width information from the input source.

getSampleDimensions

public GridSampleDimension[] getSampleDimensions(int index)
                                          throws java.io.IOException
Deprecated. 
Returns the sample dimensions for each band of the GridCoverage to be read. If sample dimensions are not known, then this method returns null. The default implementation invokes metadata.getSampleDimensions().

Specified by:
getSampleDimensions in interface GridCoverageReader
Overrides:
getSampleDimensions in class AbstractGridCoverageReader
Parameters:
index - The index of the image to be queried.
Returns:
The category lists for the GridCoverage at the specified index. This array's length must be equals to the number of bands in GridCoverage.
Throws:
java.lang.IllegalStateException - if the input source has not been set.
java.lang.IndexOutOfBoundsException - if the supplied index is out of bounds.
java.io.IOException - if an error occurs reading the width information from the input source.


Copyright © 1996-2010 Geotools. All Rights Reserved.