org.geotools.coverage.grid
Class AbstractGridCoverage

Object
  extended by PropertySourceImpl
      extended by AbstractCoverage
          extended by AbstractGridCoverage
All Implemented Interfaces:
Serializable, PropertySource, Coverage, GridCoverage
Direct Known Subclasses:
GridCoverage2D

public abstract class AbstractGridCoverage
extends AbstractCoverage
implements GridCoverage

Base class for Geotools implementation of grid coverage.

Since:
2.1
Author:
Martin Desruisseaux (IRD)
See Also:
Serialized Form
Module:
modules/library/coverage (gt-coverage.jar)

Nested Class Summary
 
Nested classes/interfaces inherited from class AbstractCoverage
AbstractCoverage.Renderable
 
Field Summary
static Logger LOGGER
          The logger for grid coverage operations.
 
Fields inherited from class AbstractCoverage
crs
 
Fields inherited from class PropertySourceImpl
cachedPropertyNames, properties, propertySources
 
Constructor Summary
protected AbstractGridCoverage(CharSequence name, CoordinateReferenceSystem crs, GridCoverage[] sources, PropertySource propertySource, Map<?,?> properties)
          Constructs a grid coverage with sources.
protected AbstractGridCoverage(CharSequence name, CoordinateReferenceSystem crs, PropertySource propertySource, Map<?,?> properties)
          Constructs a grid coverage using the specified coordinate reference system.
protected AbstractGridCoverage(CharSequence name, GridCoverage coverage)
          Constructs a new coverage with the same parameters than the specified coverage.
 
Method Summary
protected  String formatEvaluateError(DirectPosition point, boolean outside)
          Constructs an error message for a position that can not be evaluated.
protected  String formatEvaluateError(Point2D point, boolean outside)
          Constructs an error message for a point that can not be evaluated.
 boolean[] getDataBlock(GridRange range, boolean[] destination)
          Deprecated. We should use some higher level construct instead (multi-dimensional array or something similar).
 byte[] getDataBlock(GridRange range, byte[] destination)
          Deprecated. We should use some higher level construct instead (multi-dimensional array or something similar).
 double[] getDataBlock(GridRange range, double[] destination)
          Deprecated. We should use some higher level construct instead (multi-dimensional array or something similar).
 float[] getDataBlock(GridRange range, float[] destination)
          Deprecated. We should use some higher level construct instead (multi-dimensional array or something similar).
 int[] getDataBlock(GridRange range, int[] destination)
          Deprecated. We should use some higher level construct instead (multi-dimensional array or something similar).
 short[] getDataBlock(GridRange range, short[] destination)
          Deprecated. We should use some higher level construct instead (multi-dimensional array or something similar).
 GridPacking getGridPacking()
          Deprecated. Not yet implemented, and maybe will never be implemented.
 int getNumOverviews()
          Returns the number of predetermined overviews for the grid.
 GridCoverage getOverview(int index)
          Returns a pre-calculated overview for a grid coverage.
 GridGeometry getOverviewGridGeometry(int index)
          Returns the grid geometry for an overview.
 byte[] getPackedDataBlock(GridRange range)
          Deprecated. We should use some higher level construct instead (multi-dimensional array or something similar).
 List<GridCoverage> getSources()
          Returns the source data for a grid coverage.
 boolean isDataEditable()
          Returns true if grid data can be edited.
 void setDataBlock(GridRange gridRange, boolean[] values)
          Deprecated. We should use some higher level construct instead (multi-dimensional array or something similar).
 void setDataBlock(GridRange gridRange, byte[] values)
          Deprecated. We should use some higher level construct instead (multi-dimensional array or something similar).
 void setDataBlock(GridRange gridRange, double[] values)
          Deprecated. We should use some higher level construct instead (multi-dimensional array or something similar).
 void setDataBlock(GridRange gridRange, float[] values)
          Deprecated. We should use some higher level construct instead (multi-dimensional array or something similar).
 void setDataBlock(GridRange gridRange, int[] values)
          Deprecated. We should use some higher level construct instead (multi-dimensional array or something similar).
 void setDataBlock(GridRange gridRange, short[] values)
          Deprecated. We should use some higher level construct instead (multi-dimensional array or something similar).
 void setPackedDataBlock(GridRange gridRange, byte[] values)
          Deprecated. This operation can hardly be implemented efficiently in Java with a byte[] argument type, since we can't easily cast an array of byte[] to an array of arbitrary type.
 
Methods inherited from class AbstractCoverage
dispose, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluateInverse, find, find, getCommonPointRule, getCoordinateReferenceSystem, getDimension, getDomainElements, getDomainExtents, getEnvelope, getLocale, getName, getRangeElements, getRangeType, getRenderableImage, 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
 
Methods inherited from interface GridCoverage
getGridGeometry, getOptimalDataBlockSizes
 
Methods inherited from interface Coverage
evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluateInverse, find, find, getCommonPointRule, getCoordinateReferenceSystem, getDomainElements, getDomainExtents, getEnvelope, getNumSampleDimensions, getRangeElements, getRangeType, getRenderableImage, getSampleDimension, list, select
 

Field Detail

LOGGER

public static final Logger LOGGER
The logger for grid coverage operations.

Constructor Detail

AbstractGridCoverage

protected AbstractGridCoverage(CharSequence name,
                               CoordinateReferenceSystem crs,
                               PropertySource propertySource,
                               Map<?,?> properties)
Constructs a grid coverage using the specified coordinate reference system. If the coordinate reference system is null, then the subclasses must override AbstractCoverage.getDimension().

Parameters:
name - The grid coverage name.
crs - The coordinate reference system. This specifies the coordinate system used when accessing a coverage or grid coverage with the evaluate(...) methods.
propertySource - The source for this coverage, or null if none. Source may be (but is not limited to) a PlanarImage or an other AbstractGridCoverage object.
properties - The set of properties for this coverage, or null if there is none. Keys are String objects (CaselessStringKey are accepted as well), while values may be any Object.

AbstractGridCoverage

protected AbstractGridCoverage(CharSequence name,
                               CoordinateReferenceSystem crs,
                               GridCoverage[] sources,
                               PropertySource propertySource,
                               Map<?,?> properties)
Constructs a grid coverage with sources. Arguments are the same than for the previous constructor, with an additional sources argument.

Parameters:
name - The grid coverage name.
crs - The coordinate reference system.
sources - The sources for a grid coverage, or null if none.
propertySource - The source for properties for this coverage, or null if none.
properties - Set of additional properties for this coverage, or null if there is none.

AbstractGridCoverage

protected AbstractGridCoverage(CharSequence name,
                               GridCoverage coverage)
Constructs a new coverage with the same parameters than the specified coverage.

Parameters:
name - The name for this coverage, or null for the same than coverage.
coverage - The source coverage.
Method Detail

getSources

public List<GridCoverage> getSources()
Returns the source data for a grid coverage. If the GridCoverage was produced from an underlying dataset, the returned list is an empty list. If the GridCoverage was produced using org.opengis.coverage.grid.GridCoverageProcessor, then it should return the source grid coverage of the one used as input to GridCoverageProcessor. In general the getSources() method is intended to return the original GridCoverage on which it depends. This is intended to allow applications to establish what GridCoverages will be affected when others are updated, as well as to trace back to the "raw data".

Specified by:
getSources in interface Coverage
Specified by:
getSources in interface GridCoverage
Overrides:
getSources in class AbstractCoverage

isDataEditable

public boolean isDataEditable()
Returns true if grid data can be edited. The default implementation returns false.

Specified by:
isDataEditable in interface GridCoverage

getNumOverviews

public int getNumOverviews()
Returns the number of predetermined overviews for the grid. The default implementation returns 0.

Specified by:
getNumOverviews in interface GridCoverage

getOverviewGridGeometry

public GridGeometry getOverviewGridGeometry(int index)
                                     throws IndexOutOfBoundsException
Returns the grid geometry for an overview. The default implementation always throws an exception, since the default number of overviews is 0.

Specified by:
getOverviewGridGeometry in interface GridCoverage
Throws:
IndexOutOfBoundsException - if the specified index is out of bounds.

getOverview

public GridCoverage getOverview(int index)
                         throws IndexOutOfBoundsException
Returns a pre-calculated overview for a grid coverage. The default implementation always throws an exception, since the default number of overviews is 0.

Specified by:
getOverview in interface GridCoverage
Throws:
IndexOutOfBoundsException - if the specified index is out of bounds.

getGridPacking

public GridPacking getGridPacking()
Deprecated. Not yet implemented, and maybe will never be implemented.

Returns information for the packing of grid coverage values. The default implementation throws an UnsupportedOperationException. We don't know at this time if and when this method will be implemented, since the API is going to change when we will shift to ISO 19123.

Specified by:
getGridPacking in interface GridCoverage

getPackedDataBlock

@Deprecated
public byte[] getPackedDataBlock(GridRange range)
                          throws InvalidRangeException
Deprecated. We should use some higher level construct instead (multi-dimensional array or something similar).

Returns a block of grid coverage data for all sample dimensions. The default implementation throws an UnsupportedOperationException. We don't know at this time if and when this method will be implemented, since the API is going to change when we will shift to ISO 19123.

Specified by:
getPackedDataBlock in interface GridCoverage
Throws:
InvalidRangeException

getDataBlock

@Deprecated
public boolean[] getDataBlock(GridRange range,
                                         boolean[] destination)
                       throws InvalidRangeException,
                              ArrayIndexOutOfBoundsException
Deprecated. We should use some higher level construct instead (multi-dimensional array or something similar).

Returns a sequence of byte values for a block. The default implementation throws an UnsupportedOperationException. We don't know at this time if and when this method will be implemented, since the API is going to change when we will shift to ISO 19123.

Specified by:
getDataBlock in interface GridCoverage
Throws:
InvalidRangeException
ArrayIndexOutOfBoundsException

getDataBlock

@Deprecated
public byte[] getDataBlock(GridRange range,
                                      byte[] destination)
                    throws InvalidRangeException,
                           ArrayIndexOutOfBoundsException
Deprecated. We should use some higher level construct instead (multi-dimensional array or something similar).

Returns a sequence of byte values for a block. The default implementation throws an UnsupportedOperationException. We don't know at this time if and when this method will be implemented, since the API is going to change when we will shift to ISO 19123.

Specified by:
getDataBlock in interface GridCoverage
Throws:
InvalidRangeException
ArrayIndexOutOfBoundsException

getDataBlock

@Deprecated
public short[] getDataBlock(GridRange range,
                                       short[] destination)
                     throws InvalidRangeException,
                            ArrayIndexOutOfBoundsException
Deprecated. We should use some higher level construct instead (multi-dimensional array or something similar).

Returns a sequence of short values for a block. The default implementation throws an UnsupportedOperationException. We don't know at this time if and when this method will be implemented, since the API is going to change when we will shift to ISO 19123.

Specified by:
getDataBlock in interface GridCoverage
Throws:
InvalidRangeException
ArrayIndexOutOfBoundsException

getDataBlock

@Deprecated
public int[] getDataBlock(GridRange range,
                                     int[] destination)
                   throws InvalidRangeException,
                          ArrayIndexOutOfBoundsException
Deprecated. We should use some higher level construct instead (multi-dimensional array or something similar).

Returns a sequence of integer values for a block. The default implementation throws an UnsupportedOperationException. We don't know at this time if and when this method will be implemented, since the API is going to change when we will shift to ISO 19123.

Specified by:
getDataBlock in interface GridCoverage
Throws:
InvalidRangeException
ArrayIndexOutOfBoundsException

getDataBlock

@Deprecated
public float[] getDataBlock(GridRange range,
                                       float[] destination)
                     throws InvalidRangeException,
                            ArrayIndexOutOfBoundsException
Deprecated. We should use some higher level construct instead (multi-dimensional array or something similar).

Returns a sequence of float values for a block. The default implementation throws an UnsupportedOperationException. We don't know at this time if and when this method will be implemented, since the API is going to change when we will shift to ISO 19123.

Specified by:
getDataBlock in interface GridCoverage
Throws:
InvalidRangeException
ArrayIndexOutOfBoundsException

getDataBlock

@Deprecated
public double[] getDataBlock(GridRange range,
                                        double[] destination)
                      throws InvalidRangeException,
                             ArrayIndexOutOfBoundsException
Deprecated. We should use some higher level construct instead (multi-dimensional array or something similar).

Returns a sequence of double values for a block. The default implementation throws an UnsupportedOperationException. We don't know at this time if and when this method will be implemented, since the API is going to change when we will shift to ISO 19123.

Specified by:
getDataBlock in interface GridCoverage
Throws:
InvalidRangeException
ArrayIndexOutOfBoundsException

setDataBlock

@Deprecated
public void setDataBlock(GridRange gridRange,
                                    boolean[] values)
                  throws InvalidRangeException,
                         GridNotEditableException,
                         ArrayIndexOutOfBoundsException
Deprecated. We should use some higher level construct instead (multi-dimensional array or something similar).

Set a block of values for all sample dimensions. The default implementation always throws an exception, since this grid coverage is not editable by default.

Specified by:
setDataBlock in interface GridCoverage
Throws:
InvalidRangeException
GridNotEditableException
ArrayIndexOutOfBoundsException

setDataBlock

@Deprecated
public void setDataBlock(GridRange gridRange,
                                    byte[] values)
                  throws InvalidRangeException,
                         GridNotEditableException,
                         ArrayIndexOutOfBoundsException
Deprecated. We should use some higher level construct instead (multi-dimensional array or something similar).

Set a block of values for all sample dimensions. The default implementation always throws an exception, since this grid coverage is not editable by default.

Specified by:
setDataBlock in interface GridCoverage
Throws:
InvalidRangeException
GridNotEditableException
ArrayIndexOutOfBoundsException

setDataBlock

@Deprecated
public void setDataBlock(GridRange gridRange,
                                    short[] values)
                  throws InvalidRangeException,
                         GridNotEditableException,
                         ArrayIndexOutOfBoundsException
Deprecated. We should use some higher level construct instead (multi-dimensional array or something similar).

Set a block of values for all sample dimensions. The default implementation always throws an exception, since this grid coverage is not editable by default.

Specified by:
setDataBlock in interface GridCoverage
Throws:
InvalidRangeException
GridNotEditableException
ArrayIndexOutOfBoundsException

setDataBlock

@Deprecated
public void setDataBlock(GridRange gridRange,
                                    int[] values)
                  throws InvalidRangeException,
                         GridNotEditableException,
                         ArrayIndexOutOfBoundsException
Deprecated. We should use some higher level construct instead (multi-dimensional array or something similar).

Set a block of values for all sample dimensions. The default implementation always throws an exception, since this grid coverage is not editable by default.

Specified by:
setDataBlock in interface GridCoverage
Throws:
InvalidRangeException
GridNotEditableException
ArrayIndexOutOfBoundsException

setDataBlock

@Deprecated
public void setDataBlock(GridRange gridRange,
                                    float[] values)
                  throws InvalidRangeException,
                         GridNotEditableException,
                         ArrayIndexOutOfBoundsException
Deprecated. We should use some higher level construct instead (multi-dimensional array or something similar).

Set a block of values for all sample dimensions. The default implementation always throws an exception, since this grid coverage is not editable by default.

Specified by:
setDataBlock in interface GridCoverage
Throws:
InvalidRangeException
GridNotEditableException
ArrayIndexOutOfBoundsException

setDataBlock

@Deprecated
public void setDataBlock(GridRange gridRange,
                                    double[] values)
                  throws InvalidRangeException,
                         GridNotEditableException,
                         ArrayIndexOutOfBoundsException
Deprecated. We should use some higher level construct instead (multi-dimensional array or something similar).

Set a block of values for all sample dimensions. The default implementation always throws an exception, since this grid coverage is not editable by default.

Specified by:
setDataBlock in interface GridCoverage
Throws:
InvalidRangeException
GridNotEditableException
ArrayIndexOutOfBoundsException

setPackedDataBlock

@Deprecated
public void setPackedDataBlock(GridRange gridRange,
                                          byte[] values)
                        throws InvalidRangeException,
                               GridNotEditableException,
                               ArrayIndexOutOfBoundsException
Deprecated. This operation can hardly be implemented efficiently in Java with a byte[] argument type, since we can't easily cast an array of byte[] to an array of arbitrary type.

Set a block of values for all sample dimensions. The default implementation always throws an exception, since this grid coverage is not editable by default.

Throws:
InvalidRangeException
GridNotEditableException
ArrayIndexOutOfBoundsException

formatEvaluateError

protected String formatEvaluateError(Point2D point,
                                     boolean outside)
Constructs an error message for a point that can not be evaluated. This is used for formatting error messages.

Parameters:
point - The coordinate point to format.
outside - true if the evaluation failed because the given point is outside the coverage, or false if it failed for an other (unknown) reason.
Returns:
An error message.
Since:
2.5

formatEvaluateError

protected String formatEvaluateError(DirectPosition point,
                                     boolean outside)
Constructs an error message for a position that can not be evaluated. This is used for formatting error messages.

Parameters:
point - The coordinate point to format.
outside - true if the evaluation failed because the given point is outside the coverage, or false if it failed for an other (unknown) reason.
Returns:
An error message.
Since:
2.5


Copyright © 1996-2010 Geotools. All Rights Reserved.