org.geotools.coverage
Class CoverageStack.Adapter

java.lang.Object
  extended byorg.geotools.coverage.CoverageStack.Adapter
All Implemented Interfaces:
CoverageStack.Element
Enclosing class:
CoverageStack

public static class CoverageStack.Adapter
extends java.lang.Object
implements CoverageStack.Element

A convenience adapter class for wrapping a pre-loaded Coverage into an Element object. This adapter provides basic implementation for all methods, but they a require a fully constructed Coverage object. Subclasses are strongly encouraged to provides alternative implementation loading only the minimum amount of data required for each method.

Since:
2.1
Version:
$Id: CoverageStack.java 17672 2006-01-19 00:25:55Z desruisseaux $
Author:
Martin Desruisseaux

Field Summary
protected  org.opengis.coverage.Coverage coverage
          The wrapped coverage, or if not yet loaded.
protected  NumberRange range
          Minimum and maximum z values for this element, or if not yet determined.
 
Constructor Summary
CoverageStack.Adapter(org.opengis.coverage.Coverage coverage, NumberRange range)
          Constructs a new adapter for the specified coverage and z values.
 
Method Summary
 org.opengis.coverage.Coverage getCoverage(IIOListeners listeners)
          Returns the coverage.
 org.opengis.spatialschema.geometry.Envelope getEnvelope()
          Returns the coverage envelope.
 org.opengis.coverage.grid.GridGeometry getGridGeometry()
          Returns the coverage grid geometry.
 java.lang.String getName()
          Returns the coverage name.
 org.opengis.coverage.SampleDimension[] getSampleDimensions()
          Returns the sample dimension for the coverage.
 NumberRange getZRange()
          Returns the minimum and maximum z values for the coverage.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

coverage

protected org.opengis.coverage.Coverage coverage
The wrapped coverage, or if not yet loaded. If null, the loading must be performed by the getCoverage(org.geotools.image.io.IIOListeners) method.


range

protected NumberRange range
Minimum and maximum z values for this element, or if not yet determined. If , the range must be computed by the getZRange() method.

Constructor Detail

CoverageStack.Adapter

public CoverageStack.Adapter(org.opengis.coverage.Coverage coverage,
                             NumberRange range)
Constructs a new adapter for the specified coverage and z values.

Parameters:
coverage - The coverage to wrap. Can be only if this constructor is invoked from a sub-class constructor.
range - The minimum and maximum z values for this element, or to infers it from the last dimension in the coverage's envelope.
Method Detail

getName

public java.lang.String getName()
                         throws java.io.IOException
Returns the coverage name. The default implementation delegates to the underlying coverage if it is an instance of AbstractCoverage.

Specified by:
getName in interface CoverageStack.Element
Throws:
java.io.IOException

getZRange

public NumberRange getZRange()
                      throws java.io.IOException
Returns the minimum and maximum z values for the coverage. If the range was not explicitly specified to the constructor, then the default implementation infers it from the last dimension in the coverage's envelope.

Specified by:
getZRange in interface CoverageStack.Element
Throws:
java.io.IOException - if an I/O operation was required but failed.

getEnvelope

public org.opengis.spatialschema.geometry.Envelope getEnvelope()
                                                        throws java.io.IOException
Returns the coverage envelope. The default implementation delegates to the underlying coverage.

Specified by:
getEnvelope in interface CoverageStack.Element
Throws:
java.io.IOException - if an I/O operation was required but failed.

getGridGeometry

public org.opengis.coverage.grid.GridGeometry getGridGeometry()
                                                       throws java.io.IOException
Returns the coverage grid geometry. The default implementation delegates to the underlying coverage if it is an instance of GridCoverage.

Specified by:
getGridGeometry in interface CoverageStack.Element
Throws:
java.io.IOException - if an I/O operation was required but failed.

getSampleDimensions

public org.opengis.coverage.SampleDimension[] getSampleDimensions()
                                                           throws java.io.IOException
Returns the sample dimension for the coverage. The default implementation delegates to the underlying coverage.

Specified by:
getSampleDimensions in interface CoverageStack.Element
Throws:
java.io.IOException - if an I/O operation was required but failed.

getCoverage

public org.opengis.coverage.Coverage getCoverage(IIOListeners listeners)
                                          throws java.io.IOException
Returns the coverage. Implementors can overrides this method if they want to load coverage only when first needed. However, they are strongly encouraged to override all other methods as well in order to load the minimum amount of data, since all default implementations invoke .

Specified by:
getCoverage in interface CoverageStack.Element
Parameters:
listeners - Listeners to register to the image I/O reader, if such a reader is going to be used.
Throws:
java.io.IOException - if a data loading was required but failed.


Copyright © GeoTools. All Rights Reserved.