org.geotools.coverage
Class SpatioTemporalCoverage3D

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

public class SpatioTemporalCoverage3D
extends AbstractCoverage

Convenience view of an other coverage with x, y and time axis. This class provides evaluate methods in two versions: the usual one expecting a complete direct position, and an other one expecting the spatial position and the date as separated arguments. This class will detects by itself which dimension is the time axis. It will also tries to uses the Point2D's x value for east or west direction, and the y value for north or south direction. The dimension mapping can be examined with the toSourceDimension(int) method.

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

Since:
2.1
Version:
$Id: SpatioTemporalCoverage3D.java 30643 2008-06-12 18:27:03Z acuster $
Author:
Martin Desruisseaux (IRD)
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.geotools.coverage.AbstractCoverage
crs
 
Fields inherited from class javax.media.jai.PropertySourceImpl
cachedPropertyNames, properties, propertySources
 
Constructor Summary
SpatioTemporalCoverage3D(java.lang.CharSequence name, org.opengis.coverage.Coverage coverage)
          Constructs a new coverage.
 
Method Summary
 java.lang.Object evaluate(org.opengis.geometry.DirectPosition coord)
          Returns the value vector for a given point in the coverage.
 boolean[] evaluate(org.opengis.geometry.DirectPosition coord, boolean[] dest)
          Returns a sequence of boolean values for a given point in the coverage.
 byte[] evaluate(org.opengis.geometry.DirectPosition coord, byte[] dest)
          Returns a sequence of byte values for a given point in the coverage.
 double[] evaluate(org.opengis.geometry.DirectPosition coord, double[] dest)
          Returns a sequence of double values for a given point in the coverage.
 float[] evaluate(org.opengis.geometry.DirectPosition coord, float[] dest)
          Returns a sequence of float values for a given point in the coverage.
 int[] evaluate(org.opengis.geometry.DirectPosition coord, int[] dest)
          Returns a sequence of integer values for a given point in the coverage.
 boolean[] evaluate(java.awt.geom.Point2D point, java.util.Date time, boolean[] dest)
          Returns a sequence of boolean values for a given point in the coverage.
 byte[] evaluate(java.awt.geom.Point2D point, java.util.Date time, byte[] dest)
          Returns a sequence of byte values for a given point in the coverage.
 double[] evaluate(java.awt.geom.Point2D point, java.util.Date time, double[] dest)
          Returns a sequence of double values for a given point in the coverage.
 float[] evaluate(java.awt.geom.Point2D point, java.util.Date time, float[] dest)
          Returns a sequence of float values for a given point in the coverage.
 int[] evaluate(java.awt.geom.Point2D point, java.util.Date time, int[] dest)
          Returns a sequence of integer values for a given point in the coverage.
protected  java.awt.geom.Dimension2D getDefaultPixelSize()
          Returns the default pixel size for images to be produced by getRenderableImage(Date).
 org.opengis.metadata.extent.GeographicBoundingBox getGeographicBoundingBox()
          Returns the envelope geographic bounding box.
 GridCoverage2D getGridCoverage2D(java.util.Date time)
          Returns a 2 dimensional grid coverage for the given date.
 int getNumSampleDimensions()
          The number of sample dimensions in the coverage.
 java.awt.image.renderable.RenderableImage getRenderableImage(java.util.Date date)
          Returns 2D view of this grid coverage at the given date.
 org.opengis.coverage.SampleDimension getSampleDimension(int index)
          Retrieve sample dimension information for the coverage.
 javax.media.jai.util.Range getTimeRange()
          Returns the envelope time range.
 org.opengis.coverage.Coverage getWrappedCoverage()
          Returns the coverage specified at construction time.
 java.util.Date toDate(org.opengis.geometry.DirectPosition position)
          Returns the date for the specified direct position.
 org.opengis.geometry.DirectPosition toDirectPosition(java.awt.geom.Point2D point, java.util.Date date)
          Returns a coordinate point for the given spatial position and date.
 java.awt.geom.Point2D toPoint2D(org.opengis.geometry.DirectPosition position)
          Returns the spatial coordinate for the specified direct position.
 int toSourceDimension(int dimension)
          Returns the dimension in the wrapped coverage for the specified dimension in this coverage.
 
Methods inherited from class org.geotools.coverage.AbstractCoverage
dispose, evaluate, evaluateInverse, find, find, getCommonPointRule, getCoordinateReferenceSystem, getDimension, getDomainElements, getDomainExtents, getEnvelope, getLocale, getName, getRangeElements, getRangeType, getRenderableImage, getSources, list, select, show, 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
 

Constructor Detail

SpatioTemporalCoverage3D

public SpatioTemporalCoverage3D(java.lang.CharSequence name,
                                org.opengis.coverage.Coverage coverage)
                         throws java.lang.IllegalArgumentException
Constructs a new coverage. The coordinate reference system will be the same than the wrapped coverage, which must be three dimensional. This CRS must have a temporal component.

Parameters:
name - The name for this coverage, or null for the same than coverage.
coverage - The source coverage.
Throws:
java.lang.IllegalArgumentException - if the coverage CRS doesn't have a temporal component.
Method Detail

getWrappedCoverage

public final org.opengis.coverage.Coverage getWrappedCoverage()
Returns the coverage specified at construction time.

Since:
2.2

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 index is out of bounds.

getGeographicBoundingBox

public org.opengis.metadata.extent.GeographicBoundingBox getGeographicBoundingBox()
                                                                           throws org.opengis.referencing.operation.TransformException
Returns the envelope geographic bounding box. The bounding box coordinates uses the WGS84 CRS.

Returns:
The geographic bounding box.
Throws:
org.opengis.referencing.operation.TransformException - if the envelope can't be transformed.

getTimeRange

public javax.media.jai.util.Range getTimeRange()
Returns the envelope time range. The returned range contains Date objects.


toSourceDimension

public final int toSourceDimension(int dimension)
Returns the dimension in the wrapped coverage for the specified dimension in this coverage. The evaluate(Point2D, Date) methods expect ordinates in the (xyt) order. The evaluate(DirectPosition) methods and the wrapped coverage way uses a different order.

Parameters:
dimension - A dimension in this coverage: 0 for x, 1 for y or 2 for t.
Returns:
The corresponding dimension in the wrapped coverage.
See Also:
toDate(org.opengis.geometry.DirectPosition), toPoint2D(org.opengis.geometry.DirectPosition), toDirectPosition(java.awt.geom.Point2D, java.util.Date)

toDirectPosition

public final org.opengis.geometry.DirectPosition toDirectPosition(java.awt.geom.Point2D point,
                                                                  java.util.Date date)
Returns a coordinate point for the given spatial position and date.

Parameters:
point - The spatial position.
date - The date.
Returns:
The coordinate point.
Since:
2.2
See Also:
toDate(org.opengis.geometry.DirectPosition), toPoint2D(org.opengis.geometry.DirectPosition)

toDate

public final java.util.Date toDate(org.opengis.geometry.DirectPosition position)
Returns the date for the specified direct position. This method (together with toPoint2D) is the converse of toDirectPosition.

Parameters:
position - The direct position, as computed by toDirectPosition.
Returns:
The date.
Since:
2.2
See Also:
toPoint2D(org.opengis.geometry.DirectPosition), toDirectPosition(java.awt.geom.Point2D, java.util.Date)

toPoint2D

public final java.awt.geom.Point2D toPoint2D(org.opengis.geometry.DirectPosition position)
Returns the spatial coordinate for the specified direct position. This method (together with toDate) is the converse of toDirectPosition.

Parameters:
position - The direct position, as computed by toDirectPosition.
Returns:
The spatial coordinate.
Since:
2.2
See Also:
toDate(org.opengis.geometry.DirectPosition), toDirectPosition(java.awt.geom.Point2D, java.util.Date)

evaluate

public final boolean[] evaluate(java.awt.geom.Point2D point,
                                java.util.Date time,
                                boolean[] dest)
                         throws org.opengis.coverage.CannotEvaluateException
Returns a sequence of boolean values for a given point in the coverage.

Parameters:
point - The coordinate point where to evaluate.
time - The date where to evaluate.
dest - An array in which to store values, or null to create a new array.
Returns:
The dest array, or a newly created array if dest was null.
Throws:
PointOutsideCoverageException - if point or time is outside coverage.
org.opengis.coverage.CannotEvaluateException - if the computation failed for some other reason.

evaluate

public final byte[] evaluate(java.awt.geom.Point2D point,
                             java.util.Date time,
                             byte[] dest)
                      throws org.opengis.coverage.CannotEvaluateException
Returns a sequence of byte values for a given point in the coverage.

Parameters:
point - The coordinate point where to evaluate.
time - The date where to evaluate.
dest - An array in which to store values, or null to create a new array.
Returns:
The dest array, or a newly created array if dest was null.
Throws:
PointOutsideCoverageException - if point or time is outside coverage.
org.opengis.coverage.CannotEvaluateException - if the computation failed for some other reason.

evaluate

public final int[] evaluate(java.awt.geom.Point2D point,
                            java.util.Date time,
                            int[] dest)
                     throws org.opengis.coverage.CannotEvaluateException
Returns a sequence of integer values for a given point in the coverage.

Parameters:
point - The coordinate point where to evaluate.
time - The date where to evaluate.
dest - An array in which to store values, or null to create a new array.
Returns:
The dest array, or a newly created array if dest was null.
Throws:
PointOutsideCoverageException - if point or time is outside coverage.
org.opengis.coverage.CannotEvaluateException - if the computation failed for some other reason.

evaluate

public final float[] evaluate(java.awt.geom.Point2D point,
                              java.util.Date time,
                              float[] dest)
                       throws org.opengis.coverage.CannotEvaluateException
Returns a sequence of float values for a given point in the coverage.

Parameters:
point - The coordinate point where to evaluate.
time - The date where to evaluate.
dest - An array in which to store values, or null to create a new array.
Returns:
The dest array, or a newly created array if dest was null.
Throws:
PointOutsideCoverageException - if point or time is outside coverage.
org.opengis.coverage.CannotEvaluateException - if the computation failed for some other reason.

evaluate

public final double[] evaluate(java.awt.geom.Point2D point,
                               java.util.Date time,
                               double[] dest)
                        throws org.opengis.coverage.CannotEvaluateException
Returns a sequence of double values for a given point in the coverage.

Parameters:
point - The coordinate point where to evaluate.
time - The date where to evaluate.
dest - An array in which to store values, or null to create a new array.
Returns:
The dest array, or a newly created array if dest was null.
Throws:
PointOutsideCoverageException - if point or time is outside coverage.
org.opengis.coverage.CannotEvaluateException - if the computation failed for some other reason.

evaluate

public final java.lang.Object evaluate(org.opengis.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 coord is outside coverage.
org.opengis.coverage.CannotEvaluateException - if the computation failed for some other reason.

evaluate

public final boolean[] evaluate(org.opengis.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 null to create a new array.
Returns:
The dest array, or a newly created array if dest was null.
Throws:
org.opengis.coverage.PointOutsideCoverageException - if the evaluation failed because the input point has invalid coordinates.
org.opengis.coverage.CannotEvaluateException - if the values can't be computed at the specified coordinate for an other reason. It may be thrown if the coverage data type can't be converted to boolean by an identity or widening conversion. Subclasses may relax this constraint if appropriate.

evaluate

public final byte[] evaluate(org.opengis.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 null to create a new array.
Returns:
The dest array, or a newly created array if dest was null.
Throws:
org.opengis.coverage.PointOutsideCoverageException - if the evaluation failed because the input point has invalid coordinates.
org.opengis.coverage.CannotEvaluateException - if the values can't be computed at the specified coordinate for an other reason. It may be thrown if the coverage data type can't be converted to byte by an identity or widening conversion. Subclasses may relax this constraint if appropriate.

evaluate

public final int[] evaluate(org.opengis.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 null to create a new array.
Returns:
The dest array, or a newly created array if dest was null.
Throws:
org.opengis.coverage.PointOutsideCoverageException - if the evaluation failed because the input point has invalid coordinates.
org.opengis.coverage.CannotEvaluateException - if the values can't be computed at the specified coordinate for an other reason. It may be thrown if the coverage data type can't be converted to int by an identity or widening conversion. Subclasses may relax this constraint if appropriate.

evaluate

public final float[] evaluate(org.opengis.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 null to create a new array.
Returns:
The dest array, or a newly created array if dest was null.
Throws:
org.opengis.coverage.PointOutsideCoverageException - if the evaluation failed because the input point has invalid coordinates.
org.opengis.coverage.CannotEvaluateException - if the values can't be computed at the specified coordinate for an other reason. It may be thrown if the coverage data type can't be converted to float by an identity or widening conversion. Subclasses may relax this constraint if appropriate.

evaluate

public final double[] evaluate(org.opengis.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 null to create a new array.
Returns:
The dest array, or a newly created array if dest was null.
Throws:
org.opengis.coverage.PointOutsideCoverageException - if the evaluation failed because the input point has invalid coordinates.
org.opengis.coverage.CannotEvaluateException - if the values can't be computed at the specified coordinate for an other reason. It may be thrown if the coverage data type can't be converted to double by an identity or widening conversion. Subclasses may relax this constraint if appropriate.

getGridCoverage2D

public GridCoverage2D getGridCoverage2D(java.util.Date time)
                                 throws org.opengis.coverage.CannotEvaluateException
Returns a 2 dimensional grid coverage for the given date. The grid geometry will be computed in order to produces image with the default pixel size, if any.

Parameters:
time - The date where to evaluate.
Returns:
The grid coverage at the specified time, or null if the requested date fall in a hole in the data.
Throws:
PointOutsideCoverageException - if time is outside coverage.
org.opengis.coverage.CannotEvaluateException - if the computation failed for some other reason.
See Also:
getRenderableImage(Date), RenderableImage.createDefaultRendering()

getRenderableImage

public java.awt.image.renderable.RenderableImage getRenderableImage(java.util.Date date)
Returns 2D view of this grid coverage at the given date. For images produced by the default rendering, the size will be computed from the default pixel size, if any.

Parameters:
date - The date where to evaluate the images.
Returns:
The renderable image.

getDefaultPixelSize

protected java.awt.geom.Dimension2D getDefaultPixelSize()
Returns the default pixel size for images to be produced by getRenderableImage(Date). This method is invoked by RenderableImage.createDefaultRendering() for computing a default image size. The default implementation for this method always returns null. Subclasses should overrides this method in order to provides a pixel size better suited to their data.

Returns:
The default pixel size, or null if no default is provided.


Copyright © 1996-2010 Geotools. All Rights Reserved.