org.deegree_impl.model.cv
Class CV_Coverage_Impl

java.lang.Object
  extended byorg.deegree_impl.model.cv.CV_Coverage_Impl
All Implemented Interfaces:
CV_Coverage, java.rmi.Remote, java.io.Serializable
Direct Known Subclasses:
GC_GridCoverage_Impl, ImageGridCoverage

public class CV_Coverage_Impl
extends java.lang.Object
implements CV_Coverage, java.io.Serializable

Provides access to an OpenGIS coverage. The essential property of coverage is to be able to generate a value for any point within its domain. How coverage is represented internally is not a concern. For example consider the following different internal representations of coverage:

  1. A coverage may be represented by a set of polygons which exhaustively tile a plane (that is each point on the plane falls in precisely one polygon). The value returned by the coverage for a point is the value of an attribute of the polygon that contains the point.
  2. A coverage may be represented by a grid of values. The value returned by the coverage for a point is that of the grid value whose location is nearest the point.
  3. Coverage may be represented by a mathematical function. The value returned by the coverage for a point is just the return value of the function when supplied the coordinates of the point as arguments.
  4. Coverage may be represented by combination of these. For example, coverage may be represented by a combination of mathematical functions valid over a set of polynomials.
A coverage has a corresponding CV_SampleDimension for each sample dimension in the coverage.

Since:
1.00
Version:
1.00
See Also:
Serialized Form

Field Summary
private  CS_CoordinateSystem crs
           
protected  CVDescriptor descriptor
           
protected  java.lang.String[] dimensionNames
           
protected  PT_Envelope envelope
           
protected  java.util.HashMap metadata
           
protected  int numSources
           
protected  CV_SampleDimension[] sampleDimensions
           
 
Constructor Summary
CV_Coverage_Impl(CS_CoordinateSystem crs)
          initialzies a simple, enpty CV_Coverage just with a CRS
CV_Coverage_Impl(CVDescriptor descriptor)
          initialzies a simple CV_Coverage
 
Method Summary
 java.lang.Object evaluate(PT_CoordinatePoint point)
          Return the value vector for a given point in the coverage.
 boolean[] evaluateAsBoolean(PT_CoordinatePoint point)
          Return a sequence of Boolean values for a given point in the coverage.
 byte[] evaluateAsByte(PT_CoordinatePoint point)
          Return a sequence of unsigned byte values for a given point in the coverage.
 double[] evaluateAsDouble(PT_CoordinatePoint point)
          Return a sequence of double values for a given point in the coverage.
 int[] evaluateAsInteger(PT_CoordinatePoint point)
          Return a sequence of integer values for a given point in the coverage.
 CS_CoordinateSystem getCoordinateSystem()
          This specifies the coordinate system used when accessing a coverage or grid coverage with the evaluate methods.
 java.lang.String[] getDimensionNames()
          The names of each dimension in the coverage.
 PT_Envelope getEnvelope()
          The bounding box for the coverage domain in coordinate system coordinates.
 java.lang.String[] getMetadataNames()
          List of metadata keywords for a coverage.
 java.lang.String getMetadataValue(java.lang.String name)
          Retrieve the metadata value for a given metadata name.
 int getNumSampleDimensions()
          The number of sample dimensions in the coverage.
 int getNumSources()
          Number of grid coverages which the grid coverage was derived from.
 CV_SampleDimension getSampleDimension(int index)
          Retrieve sample dimension information for the coverage.
 GC_GridCoverage getSource(int sourceDataIndex)
          Returns the source data for a grid coverage.
private static java.util.ArrayList getTiles(GM_Envelope boundingBox, double scale, Level level, java.util.ArrayList list)
          recursive method for selecting all Tiles that matches the submitted conditions.
private static java.util.ArrayList getTiles(GM_Envelope boundingBox, Tile tile, java.util.ArrayList list)
          recursive method for selecting all Tiles that matches the submitted conditions.
protected static Tile[] getTiles(Level level, GM_Envelope boundingBox, double scale)
          return all Tiles that matches the bounding box and the scale.
private static java.util.ArrayList getTilesByDir(GM_Envelope boundingBox, double scale, Level level, java.util.ArrayList list)
           
 void setSampleDimension(CV_SampleDimension[] sampleDimensions)
          sets the sample dimensions for the coverage
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

crs

private CS_CoordinateSystem crs

descriptor

protected CVDescriptor descriptor

dimensionNames

protected java.lang.String[] dimensionNames

envelope

protected PT_Envelope envelope

metadata

protected java.util.HashMap metadata

numSources

protected int numSources

sampleDimensions

protected CV_SampleDimension[] sampleDimensions
Constructor Detail

CV_Coverage_Impl

public CV_Coverage_Impl(CVDescriptor descriptor)
initialzies a simple CV_Coverage

Parameters:
descriptor - containing a description of the coverage

CV_Coverage_Impl

public CV_Coverage_Impl(CS_CoordinateSystem crs)
initialzies a simple, enpty CV_Coverage just with a CRS

Parameters:
crs - coordinate reference system of the coverage
Method Detail

evaluate

public java.lang.Object evaluate(PT_CoordinatePoint point)
                          throws java.rmi.RemoteException
Return the value vector for a given point in the coverage. A value for each sample dimension is included in the vector. The default interpolation type used when accessing grid values for points which fall between grid cells is nearest neighbor. The coordinate system of the point is the same as the grid coverage coordinate system (specified by the getCoordinateSystem()).

Specified by:
evaluate in interface CV_Coverage
Parameters:
point - Point at which to find the grid values.
Returns:
the value vector for a given point in the coverage.
Throws:
java.rmi.RemoteException - if a remote method call failed.

evaluateAsBoolean

public boolean[] evaluateAsBoolean(PT_CoordinatePoint point)
                            throws java.rmi.RemoteException
Return a sequence of Boolean values for a given point in the coverage. A value for each sample dimension is included in the sequence. The default interpolation type used when accessing grid values for points which fall between grid cells is nearest neighbor. The coordinate system of the point is the same as the grid coverage coordinate system.

Specified by:
evaluateAsBoolean in interface CV_Coverage
Parameters:
point - Point at which to find the coverage values.
Returns:
a sequence of Boolean values for a given point in the coverage.
Throws:
java.rmi.RemoteException - if a remote method call failed.

evaluateAsByte

public byte[] evaluateAsByte(PT_CoordinatePoint point)
                      throws java.rmi.RemoteException
Return a sequence of unsigned byte values for a given point in the coverage. A value for each sample dimension is included in the sequence. The default interpolation type used when accessing grid values for points which fall between grid cells is nearest neighbor. The coordinate system of the point is the same as the grid coverage coordinate system.

Specified by:
evaluateAsByte in interface CV_Coverage
Parameters:
point - Point at which to find the coverage values.
Returns:
a sequence of unsigned byte values for a given point in the coverage.
Throws:
java.rmi.RemoteException - if a remote method call failed.

evaluateAsDouble

public double[] evaluateAsDouble(PT_CoordinatePoint point)
                          throws java.rmi.RemoteException
Return a sequence of double values for a given point in the coverage. A value for each sample dimension is included in the sequence. The default interpolation type used when accessing grid values for points which fall between grid cells is nearest neighbor. The coordinate system of the point is the same as the grid coverage coordinate system.

Specified by:
evaluateAsDouble in interface CV_Coverage
Parameters:
point - Point at which to find the grid values.
Returns:
a sequence of double values for a given point in the coverage.
Throws:
java.rmi.RemoteException - if a remote method call failed.

evaluateAsInteger

public int[] evaluateAsInteger(PT_CoordinatePoint point)
                        throws java.rmi.RemoteException
Return a sequence of integer values for a given point in the coverage. A value for each sample dimension is included in the sequence. The default interpolation type used when accessing grid values for points which fall between grid cells is nearest neighbor. The coordinate system of the point is the same as the grid coverage coordinate system.

Specified by:
evaluateAsInteger in interface CV_Coverage
Parameters:
point - Point at which to find the grid values.
Returns:
a sequence of integer values for a given point in the coverage.
Throws:
java.rmi.RemoteException - if a remote method call failed.

getCoordinateSystem

public CS_CoordinateSystem getCoordinateSystem()
                                        throws java.rmi.RemoteException
This specifies the coordinate system used when accessing a coverage or grid coverage with the evaluate methods. It is also the coordinate system of the coordinates used with the math transform (see gridToCoordinateSystem). This coordinate system is usually different than the grid coordinate system of the grid. grid coverage can be accessed (re-projected) with new coordinate system with the GP_GridCoverageProcessor component. In this case, a new instance of a grid coverage is created.

Note: If a coverage does not have an associated coordinate system, the returned value will be null. The gridToCoordinateSystem) attribute should also be null if the coordinate system is null.

Specified by:
getCoordinateSystem in interface CV_Coverage
Returns:
the coordinate system used when accessing a coverage or grid coverage with the evaluate methods.
Throws:
java.rmi.RemoteException - if a remote method call failed.

getDimensionNames

public java.lang.String[] getDimensionNames()
                                     throws java.rmi.RemoteException
The names of each dimension in the coverage. Typically these names are x, y, z and t. The number of items in the sequence is the number of dimensions in the coverage. Grid coverages are typically 2D (x, y) while other coverages may be 3D (x, y, z) or 4D (x, y, z, t). The number of dimensions of the coverage is the number of entries in the list of dimension names.

Specified by:
getDimensionNames in interface CV_Coverage
Returns:
the names of each dimension in the coverage.
Throws:
java.rmi.RemoteException - if a remote method call failed.

getEnvelope

public PT_Envelope getEnvelope()
                        throws java.rmi.RemoteException
The bounding box for the coverage domain in coordinate system coordinates. For grid coverages, the grid cells are centered on each grid coordinate. The envelope for a 2-D grid coverage includes the following corner positions.
 (Minimum row - 0.5, Minimum column - 0.5) for the minimum coordinates
 (Maximum row - 0.5, Maximum column - 0.5) for the maximum coordinates
 
If a grid coverage does not have any associated coordinate system, the minimum and maximum coordinate points for the envelope will be empty sequences.

Specified by:
getEnvelope in interface CV_Coverage
Returns:
the bounding box for the coverage domain in coordinate system coordinates.
Throws:
java.rmi.RemoteException - if a remote method call failed.

getMetadataNames

public java.lang.String[] getMetadataNames()
                                    throws java.rmi.RemoteException
List of metadata keywords for a coverage. If no metadata is available, the sequence will be empty.

Specified by:
getMetadataNames in interface CV_Coverage
Returns:
the list of metadata keywords for a coverage.
Throws:
java.rmi.RemoteException - if a remote method call failed.

getMetadataValue

public java.lang.String getMetadataValue(java.lang.String name)
                                  throws java.rmi.RemoteException
Retrieve the metadata value for a given metadata name.

Specified by:
getMetadataValue in interface CV_Coverage
Parameters:
name - Metadata keyword for which to retrieve data.
Returns:
the metadata value for a given metadata name.
Throws:
java.rmi.RemoteException - if a remote method call failed.

getNumSampleDimensions

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

Specified by:
getNumSampleDimensions in interface CV_Coverage
Returns:
the number of sample dimensions in the coverage.
Throws:
java.rmi.RemoteException - if a remote method call failed.

getNumSources

public int getNumSources()
                  throws java.rmi.RemoteException
Number of grid coverages which the grid coverage was derived from. This implementation specification does not include interfaces for creating collections of coverages therefore this value will usually be one indicating an adapted grid coverage, or zero indicating a raw grid coverage.

Specified by:
getNumSources in interface CV_Coverage
Returns:
the number of grid coverages which the grid coverage was derived from.
Throws:
java.rmi.RemoteException - if a remote method call failed.

getSampleDimension

public CV_SampleDimension getSampleDimension(int index)
                                      throws java.rmi.RemoteException
Retrieve sample dimension information for the coverage. For a grid coverage a sample dimension is a band. The sample dimension information include such things as description, data type of the value (bit, byte, integer...), the no data values, minimum and maximum values and a color table if one is associated with the dimension. A coverage must have at least one sample dimension.

Specified by:
getSampleDimension in interface CV_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.rmi.RemoteException - if a remote method call failed.

setSampleDimension

public void setSampleDimension(CV_SampleDimension[] sampleDimensions)
sets the sample dimensions for the coverage

Parameters:
sampleDimensions - Sample dimensions for the coverage

getSource

public GC_GridCoverage getSource(int sourceDataIndex)
                          throws java.rmi.RemoteException
Returns the source data for a grid coverage. If the GC_GridCoverage was produced from an underlying dataset (by createFromName or createFromSubName for instance) the getNumSources() method should returns zero, and this method should not be called. If the GC_GridCoverage} was produced using {link org.opengis.gp.GP_GridCoverageProcessor} then it should return the source grid coverage of the one used as input to GP_GridCoverageProcessor. In general the source() method is intended to return the original GC_GridCoverage on which it depends. This is intended to allow applications to establish what GC_GridCoverages will be affected when others are updated, as well as to trace back to the "raw data".

Specified by:
getSource in interface CV_Coverage
Parameters:
sourceDataIndex - Source grid coverage index. Indexes start at 0.
Returns:
the source data for a grid coverage.
Throws:
java.rmi.RemoteException - if a remote method call failed.

getTiles

protected static Tile[] getTiles(Level level,
                                 GM_Envelope boundingBox,
                                 double scale)
                          throws CoverageCreationException
return all Tiles that matches the bounding box and the scale.

Throws:
CoverageCreationException

getTilesByDir

private static java.util.ArrayList getTilesByDir(GM_Envelope boundingBox,
                                                 double scale,
                                                 Level level,
                                                 java.util.ArrayList list)
                                          throws CoverageCreationException
Parameters:
boundingBox -
scale -
level -
list -
Returns:
Throws:
CoverageCreationException

getTiles

private static java.util.ArrayList getTiles(GM_Envelope boundingBox,
                                            double scale,
                                            Level level,
                                            java.util.ArrayList list)
recursive method for selecting all Tiles that matches the submitted conditions.

Parameters:
boundingBox -
scale -
level -
list -
Returns:

getTiles

private static java.util.ArrayList getTiles(GM_Envelope boundingBox,
                                            Tile tile,
                                            java.util.ArrayList list)
recursive method for selecting all Tiles that matches the submitted conditions.