org.geotools.gce.image
Class WorldImageReader

Object
  extended by AbstractGridCoverage2DReader
      extended by WorldImageReader
All Implemented Interfaces:
GridCoverageReader

public final class WorldImageReader
extends AbstractGridCoverage2DReader
implements GridCoverageReader

Reads a GridCoverage from a given source. WorldImage sources only support one GridCoverage so hasMoreGridCoverages() will return true until the only GridCoverage is read. No metadata is currently supported, so all related methods return null. In the early future we will start (hopefully supporting them).

Author:
simone giannecchini, alessio fabiani, rgould
Module:
modules/plugin/image (gt-image.jar)

Field Summary
 
Fields inherited from class AbstractGridCoverage2DReader
closeMe, coverageFactory, coverageName, crs, demColors, EPS, gzipped, highestRes, hints, inStream, numOverviews, originalEnvelope, originalGridRange, overViewResolutions, raster2Model, source
 
Constructor Summary
WorldImageReader(Object input)
          Class constructor.
WorldImageReader(Object input, Hints hints)
          Class constructor.
 
Method Summary
 String getExtension()
          Returns the file extension of the image.
 Format getFormat()
          Returns the format that this Reader accepts.
 int getGridCoverageCount()
          Number of coverages for this reader is 1
 GridCoverage2D read(GeneralParameterValue[] params)
          Reads an image from a source stream.
 
Methods inherited from class AbstractGridCoverage2DReader
createImageCoverage, createImageCoverage, decimationOnReadingControl, dispose, finalize, getCrs, getCurrentSubname, getInfo, getMetadataNames, getMetadataValue, getOriginalEnvelope, getOriginalGridRange, getOriginalGridToWorld, getResolution, getSource, hasMoreGridCoverages, 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, getMetadataNames, getMetadataValue, getSource, hasMoreGridCoverages, listSubNames, skip
 

Constructor Detail

WorldImageReader

public WorldImageReader(Object input)
                 throws DataSourceException
Class constructor. Construct a new ImageWorldReader to read a GridCoverage from the source object. The source must point to the raster file itself, not the world file. If the source is a Java URL it checks if it is ponting to a file and if so it converts the url into a file.

Parameters:
input - The source of a GridCoverage, can be a File, a URL or an input stream.
Throws:
DataSourceException

WorldImageReader

public WorldImageReader(Object input,
                        Hints hints)
                 throws DataSourceException
Class constructor. Construct a new ImageWorldReader to read a GridCoverage from the source object. The source must point to the raster file itself, not the world file. If the source is a Java URL it checks if it is ponting to a file and if so it converts the url into a file.

Parameters:
input - The source of a GridCoverage, can be a File, a URL or an input stream.
Throws:
DataSourceException
Method Detail

getFormat

public Format getFormat()
Returns the format that this Reader accepts.

Specified by:
getFormat in interface GridCoverageReader
Returns:
a new WorldImageFormat class

read

public GridCoverage2D read(GeneralParameterValue[] params)
                    throws IllegalArgumentException,
                           IOException
Reads an image from a source stream. Loads an image from a source stream, then loads the values from the world file and constructs a new GridCoverage from this information. When reading from a remote stream we do not look for a world fiel but we suppose those information comes from a different way (xml, gml, pigeon?)

Specified by:
read in interface GridCoverageReader
Specified by:
read in class AbstractGridCoverage2DReader
Parameters:
params - WorldImageReader supports no parameters, it just ignores them.
Returns:
a new GridCoverage read from the source.
Throws:
IllegalArgumentException - DOCUMENT ME!
IOException - DOCUMENT ME!

getGridCoverageCount

public int getGridCoverageCount()
Number of coverages for this reader is 1

Overrides:
getGridCoverageCount in class AbstractGridCoverage2DReader
Returns:
the number of coverages for this reader.
See Also:
org.opengis.coverage.grid.GridCoverageReader#getGridCoverageCount()

getExtension

public String getExtension()
Returns the file extension of the image.

Since:
2.7


Copyright © 1996-2010 Geotools. All Rights Reserved.