org.geotools.coverage
Class SpatioTemporalCoverage3D

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

public class SpatioTemporalCoverage3D
extends AbstractCoverage

Convenience view of an other coverage with x, y and time axis. This class provides 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 '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 for each thread.

Since:
2.1
Version:
$Id: SpatioTemporalCoverage3D.java 17672 2006-01-19 00:25:55Z desruisseaux $
Author:
Martin Desruisseaux
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.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.
 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.spatialschema.geometry.DirectPosition position)
          Returns the date for the specified direct position.
 org.opengis.spatialschema.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.spatialschema.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, getCoordinateReferenceSystem, getDimension, getDimensionNames, getDimensionNames, getEnvelope, 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
 

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 for the same than .
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 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 methods expect ordinates in the (xyt) order. The 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.spatialschema.geometry.DirectPosition), toPoint2D(org.opengis.spatialschema.geometry.DirectPosition), toDirectPosition(java.awt.geom.Point2D, java.util.Date)

toDirectPosition

public final org.opengis.spatialschema.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.spatialschema.geometry.DirectPosition), toPoint2D(org.opengis.spatialschema.geometry.DirectPosition)

toDate

public final java.util.Date toDate(org.opengis.spatialschema.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.spatialschema.geometry.DirectPosition), toDirectPosition(java.awt.geom.Point2D, java.util.Date)

toPoint2D

public final java.awt.geom.Point2D toPoint2D(org.opengis.spatialschema.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.spatialschema.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 to create a new array.
Returns:
The array, or a newly created array if was null.
Throws:
PointOutsideCoverageException - if or 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 to create a new array.
Returns:
The array, or a newly created array if was null.
Throws:
PointOutsideCoverageException - if or 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 to create a new array.
Returns:
The array, or a newly created array if was null.
Throws:
PointOutsideCoverageException - if or 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 to create a new array.
Returns:
The array, or a newly created array if was null.
Throws:
PointOutsideCoverageException - if or 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 to create a new array.
Returns:
The array, or a newly created array if was null.
Throws:
PointOutsideCoverageException - if or is outside coverage.
org.opengis.coverage.CannotEvaluateException - if the computation failed for some other reason.

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.

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 if the requested date fall in a hole in the data.
Throws:
PointOutsideCoverageException - if is outside coverage.
org.opengis.coverage.CannotEvaluateException - if the computation failed for some other reason.
See Also:
getRenderableImage(Date), RenderableImage.createDefaultRendering()
To Do:
Find some way to avoid the cast in the statement.

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 . Subclasses should overrides this method in order to provides a pixel size better suited to their data.

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


Copyright © GeoTools. All Rights Reserved.