|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.geotools.coverage.io.AbstractGridCoverageReader org.geotools.coverage.io.ExoreferencedGridCoverageReader
An implementation of AbstractGridCoverageReader
using informations parsed by a
MetadataBuilder
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 MetadataBuilder
object, while the pixel
values are read by a ImageReader
object.
Field Summary | |
protected MetadataBuilder |
metadata
The object to use for parsing the meta-data. |
Fields inherited from class org.geotools.coverage.io.AbstractGridCoverageReader |
formatName, reader |
Constructor Summary | |
ExoreferencedGridCoverageReader(java.lang.String formatName,
MetadataBuilder parser)
Construct a new ExoreferencedGridCoverageReader
using the specified MetadataBuilder . |
|
ExoreferencedGridCoverageReader(java.lang.String formatName,
java.lang.String extension,
MetadataBuilder parser)
Construct a new ExoreferencedGridCoverageReader
using the specified MetadataBuilder . |
Method Summary | |
org.opengis.referencing.crs.CoordinateReferenceSystem |
getCoordinateReferenceSystem(int index)
Returns the coordinate system for the GridCoverage to be read.
|
org.opengis.spatialschema.geometry.Envelope |
getEnvelope(int index)
Returns the envelope for the GridCoverage to be read.
|
org.opengis.coverage.grid.GridRange |
getGridRange(int index)
Returns the grid range for the GridCoverage to be read.
|
org.opengis.coverage.SampleDimension[] |
getSampleDimensions(int index)
Returns the sample dimensions for each band of the GridCoverage
to be read. |
void |
reset()
Restores the AbstractGridCoverageReader to its initial state. |
void |
setInput(java.lang.Object input,
boolean seekForwardOnly)
Sets the input source to the given object. |
void |
setLocale(java.util.Locale locale)
Sets the current Locale of this AbstractGridCoverageReader
to the given value. |
protected java.lang.String |
toImageFileName(java.lang.String filename)
Returns the filename for image data. |
Methods inherited from class org.geotools.coverage.io.AbstractGridCoverageReader |
getGridCoverage, getImageReaders, getLocale, getName, getNumImages |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected MetadataBuilder metadata
Constructor Detail |
public ExoreferencedGridCoverageReader(java.lang.String formatName, MetadataBuilder parser)
ExoreferencedGridCoverageReader
using the specified MetadataBuilder
.
formatName
- The name for this format. This format name should be
understood by ImageIO.getImageReadersByFormatName(String)
,
unless AbstractGridCoverageReader.getImageReaders(java.lang.Object)
is overriden.parser
- The MetadataBuilder
to use for reading geographic metadata.public ExoreferencedGridCoverageReader(java.lang.String formatName, java.lang.String extension, MetadataBuilder parser)
ExoreferencedGridCoverageReader
using the specified MetadataBuilder
.
formatName
- The name for this format. This format name should be
understood by ImageIO.getImageReadersByFormatName(String)
,
unless AbstractGridCoverageReader.getImageReaders(java.lang.Object)
is overriden.extension
- Filename's extensions for file of this format.parser
- The MetadataBuilder
to use for reading geographic metadata.Method Detail |
public void reset() throws java.io.IOException
AbstractGridCoverageReader
to its initial state.
reset
in class AbstractGridCoverageReader
java.io.IOException
- if an error occurs while disposing resources.public void setInput(java.lang.Object input, boolean seekForwardOnly) throws java.io.IOException
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 overriden.
setInput
in class AbstractGridCoverageReader
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.
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.protected java.lang.String toImageFileName(java.lang.String filename)
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.
filename
- The filename part of metadata file. This
is the filename part of the file supplied by users
to setInput(java.lang.Object, boolean)
.
public org.opengis.referencing.crs.CoordinateReferenceSystem getCoordinateReferenceSystem(int index) throws java.io.IOException
GridCoverage
to be read.
The default implementation invokes
metadata
.getCoordinateReferenceSystem()
.
getCoordinateReferenceSystem
in class AbstractGridCoverageReader
index
- The index of the image to be queried.
GridCoverage
at the specified index.
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.public org.opengis.spatialschema.geometry.Envelope getEnvelope(int index) throws java.io.IOException
GridCoverage
to be read.
The default implementation invokes
metadata
.getEnvelope()
.
getEnvelope
in class AbstractGridCoverageReader
index
- The index of the image to be queried.
GridCoverage
at the specified index.
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.public org.opengis.coverage.grid.GridRange getGridRange(int index) throws java.io.IOException
GridCoverage
to be read.
The default implementation try to invoke
metadata
.getGridRange()
,
and fallback to super.getGridRange(index)
if the later fails.
getGridRange
in class AbstractGridCoverageReader
index
- The index of the image to be queried.
GridCoverage
at the specified index.
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.public org.opengis.coverage.SampleDimension[] getSampleDimensions(int index) throws java.io.IOException
GridCoverage
to be read. If sample dimensions are not known, then this method returns
null
. The default implementation invokes
metadata
.getSampleDimensions()
.
getSampleDimensions
in class AbstractGridCoverageReader
index
- The index of the image to be queried.
GridCoverage
at the specified index.
This array's length must be equals to the number of bands in GridCoverage
.
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.public void setLocale(java.util.Locale locale)
Locale
of this AbstractGridCoverageReader
to the given value. A value of null
removes any previous
setting, and indicates that the reader should localize as it sees fit.
setLocale
in class AbstractGridCoverageReader
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |