org.geotools.coverage
Class TransformedCoverage

java.lang.Object
  extended byjavax.media.jai.PropertySourceImpl
      extended byorg.geotools.coverage.AbstractCoverage
          extended byorg.geotools.coverage.TransformedCoverage
All Implemented Interfaces:
org.opengis.coverage.Coverage, javax.media.jai.PropertySource, java.io.Serializable

public class TransformedCoverage
extends AbstractCoverage

A coverage wrapping an other one with a different coordinate reference system. The coordinate transformation is applied on the fly every time an method is invoked. It may be efficient if few points are queried, but become ineficient if a large amount of points is queried. In the later case, consider reprojecting the whole grid coverage instead.

Note: This class is not thread safe for performance reasons. If desired, users should create one instance of for each thread.

Since:
2.1
Version:
$Id: TransformedCoverage.java 17672 2006-01-19 00:25:55Z desruisseaux $
Author:
Martin Desruisseaux
See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class org.geotools.coverage.AbstractCoverage
AbstractCoverage.Renderable
 
Field Summary
protected  org.opengis.coverage.Coverage coverage
          The wrapped coverage.
 
Fields inherited from class org.geotools.coverage.AbstractCoverage
crs
 
Fields inherited from class javax.media.jai.PropertySourceImpl
cachedPropertyNames, properties, propertySources
 
Constructor Summary
protected TransformedCoverage(java.lang.CharSequence name, org.opengis.referencing.crs.CoordinateReferenceSystem crs, org.opengis.coverage.Coverage coverage)
          Creates a new coverage wrapping the specified one.
 
Method Summary
 java.lang.Object evaluate(org.opengis.spatialschema.geometry.DirectPosition coord)
          Returns the value vector for a given point in the coverage.
 boolean[] evaluate(org.opengis.spatialschema.geometry.DirectPosition coord, boolean[] dest)
          Returns a sequence of boolean values for a given point in the coverage.
 byte[] evaluate(org.opengis.spatialschema.geometry.DirectPosition coord, byte[] dest)
          Returns a sequence of byte values for a given point in the coverage.
 double[] evaluate(org.opengis.spatialschema.geometry.DirectPosition coord, double[] dest)
          Returns a sequence of double values for a given point in the coverage.
 float[] evaluate(org.opengis.spatialschema.geometry.DirectPosition coord, float[] dest)
          Returns a sequence of float values for a given point in the coverage.
 int[] evaluate(org.opengis.spatialschema.geometry.DirectPosition coord, int[] dest)
          Returns a sequence of integer values for a given point in the coverage.
 org.opengis.spatialschema.geometry.Envelope getEnvelope()
          Returns the envelope.
 int getNumSampleDimensions()
          The number of sample dimensions in the coverage.
 org.opengis.coverage.SampleDimension getSampleDimension(int index)
          Retrieve sample dimension information for the coverage.
static org.opengis.coverage.Coverage reproject(java.lang.CharSequence name, org.opengis.referencing.crs.CoordinateReferenceSystem crs, org.opengis.coverage.Coverage coverage)
          Creates a new coverage wrapping the specified one with a different CRS.
 
Methods inherited from class org.geotools.coverage.AbstractCoverage
dispose, getCoordinateReferenceSystem, getDimension, getDimensionNames, getDimensionNames, getLocale, getMetadataNames, getMetadataValue, getName, getRenderableImage, getSources, show, show, toString
 
Methods inherited from class javax.media.jai.PropertySourceImpl
getProperties, getProperty, getPropertyClass, getPropertyNames, getPropertyNames
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

coverage

protected final org.opengis.coverage.Coverage coverage
The wrapped coverage.

Constructor Detail

TransformedCoverage

protected TransformedCoverage(java.lang.CharSequence name,
                              org.opengis.referencing.crs.CoordinateReferenceSystem crs,
                              org.opengis.coverage.Coverage coverage)
                       throws org.opengis.referencing.FactoryException
Creates a new coverage wrapping the specified one.

Parameters:
name - The name for this new coverage.
crs - The crs for this coverage.
coverage - The coverage to wraps.
Throws:
org.opengis.referencing.FactoryException - if no transformation can be found from the coverage CRS to the specified CRS.
Method Detail

reproject

public static org.opengis.coverage.Coverage reproject(java.lang.CharSequence name,
                                                      org.opengis.referencing.crs.CoordinateReferenceSystem crs,
                                                      org.opengis.coverage.Coverage coverage)
                                               throws org.opengis.referencing.FactoryException
Creates a new coverage wrapping the specified one with a different CRS. If the specified coverage already uses the specified CRS (or an equivalent one), it is returned unchanged.

Parameters:
name - The name for this new coverage.
crs - The crs for this coverage.
coverage - The coverage to wraps.
Returns:
A coverage using the specified CRS.
Throws:
org.opengis.referencing.FactoryException - if no transformation can be found from the coverage CRS to the specified CRS.

getNumSampleDimensions

public int getNumSampleDimensions()
The number of sample dimensions in the coverage. For grid coverages, a sample dimension is a band.

Returns:
The number of sample dimensions in the coverage.

getSampleDimension

public org.opengis.coverage.SampleDimension getSampleDimension(int index)
                                                        throws java.lang.IndexOutOfBoundsException
Retrieve sample dimension information for the coverage.

Parameters:
index - Index for sample dimension to retrieve. Indices are numbered 0 to (n-1).
Returns:
Sample dimension information for the coverage.
Throws:
java.lang.IndexOutOfBoundsException - if is out of bounds.

getEnvelope

public org.opengis.spatialschema.geometry.Envelope getEnvelope()
Returns the envelope.

Specified by:
getEnvelope in interface org.opengis.coverage.Coverage
Overrides:
getEnvelope in class AbstractCoverage
Returns:
The bounding box for the coverage domain in coordinate system coordinates.

evaluate

public final java.lang.Object evaluate(org.opengis.spatialschema.geometry.DirectPosition coord)
                                throws org.opengis.coverage.CannotEvaluateException
Returns the value vector for a given point in the coverage.

Parameters:
coord - The coordinate point where to evaluate.
Throws:
PointOutsideCoverageException - if is outside coverage.
org.opengis.coverage.CannotEvaluateException - if the computation failed for some other reason.

evaluate

public final boolean[] evaluate(org.opengis.spatialschema.geometry.DirectPosition coord,
                                boolean[] dest)
                         throws org.opengis.coverage.CannotEvaluateException
Returns a sequence of boolean values for a given point in the coverage.

Specified by:
evaluate in interface org.opengis.coverage.Coverage
Overrides:
evaluate in class AbstractCoverage
Parameters:
coord - The coordinate point where to evaluate.
dest - An array in which to store values, or to create a new array.
Returns:
The array, or a newly created array if was null.
Throws:
org.opengis.coverage.CannotEvaluateException - if the values can't be computed at the specified coordinate. More specifically, PointOutsideCoverageException is thrown if the evaluation failed because the input point has invalid coordinates. This exception may also be throws if the coverage data type can't be converted to by an identity or widening conversion. Subclasses may relax this constraint if appropriate.

evaluate

public final byte[] evaluate(org.opengis.spatialschema.geometry.DirectPosition coord,
                             byte[] dest)
                      throws org.opengis.coverage.CannotEvaluateException
Returns a sequence of byte values for a given point in the coverage.

Specified by:
evaluate in interface org.opengis.coverage.Coverage
Overrides:
evaluate in class AbstractCoverage
Parameters:
coord - The coordinate point where to evaluate.
dest - An array in which to store values, or to create a new array.
Returns:
The array, or a newly created array if was null.
Throws:
org.opengis.coverage.CannotEvaluateException - if the values can't be computed at the specified coordinate. More specifically, PointOutsideCoverageException is thrown if the evaluation failed because the input point has invalid coordinates. This exception may also be throws if the coverage data type can't be converted to by an identity or widening conversion. Subclasses may relax this constraint if appropriate.

evaluate

public final int[] evaluate(org.opengis.spatialschema.geometry.DirectPosition coord,
                            int[] dest)
                     throws org.opengis.coverage.CannotEvaluateException
Returns a sequence of integer values for a given point in the coverage.

Specified by:
evaluate in interface org.opengis.coverage.Coverage
Overrides:
evaluate in class AbstractCoverage
Parameters:
coord - The coordinate point where to evaluate.
dest - An array in which to store values, or to create a new array.
Returns:
The array, or a newly created array if was null.
Throws:
org.opengis.coverage.CannotEvaluateException - if the values can't be computed at the specified coordinate. More specifically, PointOutsideCoverageException is thrown if the evaluation failed because the input point has invalid coordinates. This exception may also be throws if the coverage data type can't be converted to by an identity or widening conversion. Subclasses may relax this constraint if appropriate.

evaluate

public final float[] evaluate(org.opengis.spatialschema.geometry.DirectPosition coord,
                              float[] dest)
                       throws org.opengis.coverage.CannotEvaluateException
Returns a sequence of float values for a given point in the coverage.

Specified by:
evaluate in interface org.opengis.coverage.Coverage
Overrides:
evaluate in class AbstractCoverage
Parameters:
coord - The coordinate point where to evaluate.
dest - An array in which to store values, or to create a new array.
Returns:
The array, or a newly created array if was null.
Throws:
org.opengis.coverage.CannotEvaluateException - if the values can't be computed at the specified coordinate. More specifically, PointOutsideCoverageException is thrown if the evaluation failed because the input point has invalid coordinates. This exception may also be throws if the coverage data type can't be converted to by an identity or widening conversion. Subclasses may relax this constraint if appropriate.

evaluate

public final double[] evaluate(org.opengis.spatialschema.geometry.DirectPosition coord,
                               double[] dest)
                        throws org.opengis.coverage.CannotEvaluateException
Returns a sequence of double values for a given point in the coverage.

Specified by:
evaluate in interface org.opengis.coverage.Coverage
Overrides:
evaluate in class AbstractCoverage
Parameters:
coord - The coordinate point where to evaluate.
dest - An array in which to store values, or to create a new array.
Returns:
The array, or a newly created array if was null.
Throws:
org.opengis.coverage.CannotEvaluateException - if the values can't be computed at the specified coordinate. More specifically, PointOutsideCoverageException is thrown if the evaluation failed because the input point has invalid coordinates. This exception may also be throws if the coverage data type can't be converted to by an identity or widening conversion. Subclasses may relax this constraint if appropriate.


Copyright © GeoTools. All Rights Reserved.