org.geotools.coverage
Class SpatioTemporalCoverage3D

Object
  extended by PropertySourceImpl
      extended by AbstractCoverage
          extended by SpatioTemporalCoverage3D
All Implemented Interfaces:
Serializable, PropertySource, 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
Author:
Martin Desruisseaux (IRD)
See Also:
Serialized Form
Module:

Field Summary
 
Fields inherited from class AbstractCoverage
crs
 
Fields inherited from class PropertySourceImpl
cachedPropertyNames, properties, propertySources
 
Constructor Summary
SpatioTemporalCoverage3D(CharSequence name, Coverage coverage)
          Constructs a new coverage.
 
Method Summary
 Object evaluate(DirectPosition coord)
          Returns the value vector for a given point in the coverage.
 boolean[] evaluate(DirectPosition coord, boolean[] dest)
          Returns a sequence of boolean values for a given point in the coverage.
 byte[] evaluate(DirectPosition coord, byte[] dest)
          Returns a sequence of byte values for a given point in the coverage.
 double[] evaluate(DirectPosition coord, double[] dest)
          Returns a sequence of double values for a given point in the coverage.
 float[] evaluate(DirectPosition coord, float[] dest)
          Returns a sequence of float values for a given point in the coverage.
 int[] evaluate(DirectPosition coord, int[] dest)
          Returns a sequence of integer values for a given point in the coverage.
 boolean[] evaluate(Point2D point, Date time, boolean[] dest)
          Returns a sequence of boolean values for a given point in the coverage.
 byte[] evaluate(Point2D point, Date time, byte[] dest)
          Returns a sequence of byte values for a given point in the coverage.
 double[] evaluate(Point2D point, Date time, double[] dest)
          Returns a sequence of double values for a given point in the coverage.
 float[] evaluate(Point2D point, Date time, float[] dest)
          Returns a sequence of float values for a given point in the coverage.
 int[] evaluate(Point2D point, Date time, int[] dest)
          Returns a sequence of integer values for a given point in the coverage.
protected  Dimension2D getDefaultPixelSize()
          Returns the default pixel size for images to be produced by getRenderableImage(Date).
 GeographicBoundingBox getGeographicBoundingBox()
          Returns the envelope geographic bounding box.
 GridCoverage2D getGridCoverage2D(Date time)
          Returns a 2 dimensional grid coverage for the given date.
 int getNumSampleDimensions()
          The number of sample dimensions in the coverage.
 RenderableImage getRenderableImage(Date date)
          Returns 2D view of this grid coverage at the given date.
 SampleDimension getSampleDimension(int index)
          Retrieve sample dimension information for the coverage.
 Range getTimeRange()
          Returns the envelope time range.
 Coverage getWrappedCoverage()
          Returns the coverage specified at construction time.
 Date toDate(DirectPosition position)
          Returns the date for the specified direct position.
 DirectPosition toDirectPosition(Point2D point, Date date)
          Returns a coordinate point for the given spatial position and date.
 Point2D toPoint2D(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 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 PropertySourceImpl
getProperties, getProperty, getPropertyClass, getPropertyNames, getPropertyNames
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SpatioTemporalCoverage3D

public SpatioTemporalCoverage3D(CharSequence name,
                                Coverage coverage)
                         throws 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:
IllegalArgumentException - if the coverage CRS doesn't have a temporal component.
Method Detail

getWrappedCoverage

public final 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 SampleDimension getSampleDimension(int index)
                                   throws 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:
IndexOutOfBoundsException - if index is out of bounds.

getGeographicBoundingBox

public GeographicBoundingBox getGeographicBoundingBox()
                                               throws TransformException
Returns the envelope geographic bounding box. The bounding box coordinates uses the WGS84 CRS.

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

getTimeRange

public 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 DirectPosition toDirectPosition(Point2D point,
                                             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 Date toDate(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 Point2D toPoint2D(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(Point2D point,
                                Date time,
                                boolean[] dest)
                         throws 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.
CannotEvaluateException - if the computation failed for some other reason.

evaluate

public final byte[] evaluate(Point2D point,
                             Date time,
                             byte[] dest)
                      throws 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.
CannotEvaluateException - if the computation failed for some other reason.

evaluate

public final int[] evaluate(Point2D point,
                            Date time,
                            int[] dest)
                     throws 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.
CannotEvaluateException - if the computation failed for some other reason.

evaluate

public final float[] evaluate(Point2D point,
                              Date time,
                              float[] dest)
                       throws 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.
CannotEvaluateException - if the computation failed for some other reason.

evaluate

public final double[] evaluate(Point2D point,
                               Date time,
                               double[] dest)
                        throws 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.
CannotEvaluateException - if the computation failed for some other reason.

evaluate

public final Object evaluate(DirectPosition coord)
                      throws 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.
CannotEvaluateException - if the computation failed for some other reason.

evaluate

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

Specified by:
evaluate in interface 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:
PointOutsideCoverageException - if the evaluation failed because the input point has invalid coordinates.
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(DirectPosition coord,
                             byte[] dest)
                      throws CannotEvaluateException
Returns a sequence of byte values for a given point in the coverage.

Specified by:
evaluate in interface 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:
PointOutsideCoverageException - if the evaluation failed because the input point has invalid coordinates.
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(DirectPosition coord,
                            int[] dest)
                     throws CannotEvaluateException
Returns a sequence of integer values for a given point in the coverage.

Specified by:
evaluate in interface 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:
PointOutsideCoverageException - if the evaluation failed because the input point has invalid coordinates.
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(DirectPosition coord,
                              float[] dest)
                       throws CannotEvaluateException
Returns a sequence of float values for a given point in the coverage.

Specified by:
evaluate in interface 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:
PointOutsideCoverageException - if the evaluation failed because the input point has invalid coordinates.
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(DirectPosition coord,
                               double[] dest)
                        throws CannotEvaluateException
Returns a sequence of double values for a given point in the coverage.

Specified by:
evaluate in interface 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:
PointOutsideCoverageException - if the evaluation failed because the input point has invalid coordinates.
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(Date time)
                                 throws 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.
CannotEvaluateException - if the computation failed for some other reason.
See Also:
getRenderableImage(Date), RenderableImage.createDefaultRendering()

getRenderableImage

public RenderableImage getRenderableImage(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 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-2009 Geotools. All Rights Reserved.