Class AbstractCoverage
- All Implemented Interfaces:
Serializable
,PropertySource
,Coverage
- Direct Known Subclasses:
AbstractGridCoverage
- 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.
- 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.
- 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.
- 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.
- Since:
- 2.1
- Author:
- Martin Desruisseaux (IRD)
- See Also:
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final CoordinateReferenceSystem
The coordinate reference system, ornull
if there is none.Fields inherited from class PropertySourceImpl
cachedPropertyNames, properties, propertySources
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
AbstractCoverage
(CharSequence name, Coverage coverage) Constructs a new coverage with the same parameters than the specified coverage.protected
AbstractCoverage
(CharSequence name, CoordinateReferenceSystem crs, PropertySource propertySource, Map<?, ?> properties) Constructs a coverage using the specified coordinate reference system. -
Method Summary
Modifier and TypeMethodDescriptionboolean
dispose
(boolean force) Provides a hint that a coverage will no longer be accessed from a reference in user space.boolean[]
Returns a sequence of boolean values for a given point in the coverage.byte[]
Returns a sequence of byte values for a given point in the coverage.double[]
Returns a sequence of double values for a given point in the coverage.float[]
Returns a sequence of float values for a given point in the coverage.int[]
Returns a sequence of integer values for a given point in the coverage.evaluate
(Position p, Collection<String> list) Returns a set of records of feature attribute values for the specified direct position.Returns the coordinate reference system to which the objects in its domain are referenced.final int
Returns the dimension of this coverage.Returns the bounding box for the coverage domain in coordinate reference system coordinates.Returns the default locale for logging, error messages, etc..getName()
Returns the coverage name, ornull
if none.Describes the range of the coverage.getRenderableImage
(int xAxis, int yAxis) Returns 2D view of this grid coverage as a renderable image.Returns the source data for a coverage.void
show()
Displays this coverage in a windows.void
Display this coverage in a windows.void
Display this coverage in a windows.toString()
Returns a string representation of this coverage.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 Coverage
evaluate, getNumSampleDimensions, getSampleDimension
-
Field Details
-
crs
The coordinate reference system, ornull
if there is none.
-
-
Constructor Details
-
AbstractCoverage
protected AbstractCoverage(CharSequence name, CoordinateReferenceSystem crs, PropertySource propertySource, Map<?, ?> properties) Constructs a coverage using the specified coordinate reference system. If the coordinate reference system isnull
, then the subclasses must overridegetDimension()
.- Parameters:
name
- The coverage name, ornull
if none.crs
- The coordinate reference system. This specifies the CRS used when accessing a coverage or grid coverage with theevaluate(...)
methods.propertySource
- The source for this coverage, ornull
if none. Source may be (but is not limited to) aPlanarImage
or an otherAbstractCoverage
object.properties
- The set of properties for this coverage, ornull
if there is none. Keys areString
objects (CaselessStringKey
are accepted as well), while values may be anyObject
.
-
AbstractCoverage
Constructs a new coverage with the same parameters than the specified coverage.Note: This constructor keeps a strong reference to the source coverage (through
PropertySourceImpl
).- Parameters:
name
- The name for this coverage, ornull
for the same thancoverage
.coverage
- The source coverage.
-
-
Method Details
-
getName
Returns the coverage name, ornull
if none. The default implementation returns the name specified at construction time.- Returns:
- The coverage name, or
null
.
-
getDimension
public final int getDimension()Returns the dimension of this coverage. This is a shortcut forcrs.getCoordinateSystem().getDimension()
.- Returns:
- The dimension of this coverage.
-
getCoordinateReferenceSystem
Returns the coordinate reference system to which the objects in its domain are referenced. This is the CRS used when accessing a coverage or grid coverage with theevaluate(...)
methods. This coordinate reference system is usually different than coordinate system of the grid. It is the target coordinate reference system of thegridToCRS
math transform.Grid coverage can be accessed (re-projected) with new coordinate reference system with the
GridCoverageProcessor
component. In this case, a new instance of a grid coverage is created.- Specified by:
getCoordinateReferenceSystem
in interfaceCoverage
- Returns:
- The coordinate reference system used when accessing a coverage or grid coverage with the
evaluate(...)
methods. - See Also:
-
getEnvelope
Returns the bounding box for the coverage domain in coordinate reference system coordinates. May benull
if this coverage has no associated coordinate reference system. 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
- Specified by:
getEnvelope
in interfaceCoverage
- Returns:
- The bounding box for the coverage domain in coordinate system coordinates.
-
getRangeType
Describes the range of the coverage. It consists of a list of attribute name/data type pairs. A simple list is the most common form of range type, butRecordType
can be used recursively to describe more complex structures. The range type for a specific coverage shall be specified in an application schema.This method is not yet implemented.
- Specified by:
getRangeType
in interfaceCoverage
- Returns:
- The coverage range.
- Since:
- 2.3
-
evaluate
Returns a set of records of feature attribute values for the specified direct position. The parameterlist
is a sequence of feature attribute names each of which identifies a field of the range type. Iflist
is null, the operation shall return a value for every field of the range type. Otherwise, it shall return a value for each field included inlist
. If the direct position passed is not in the domain of the coverage, then an exception is thrown. If the input direct position falls within two or more geometric objects within the domain, the operation shall return records of feature attribute values computed according to the common point rule.NOTE: Normally, the operation will return a single record of feature attribute values.
This method is not yet implemented.
-
evaluate
public boolean[] evaluate(Position coord, boolean[] dest) throws PointOutsideCoverageException, CannotEvaluateException Returns 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, but it can be changed by some subclasses. The CRS of the point is the same as the grid coverage coordinate reference system.- Specified by:
evaluate
in interfaceCoverage
- Parameters:
coord
- The coordinate point where to evaluate.dest
- An array in which to store values, ornull
to create a new array.- Returns:
- The
dest
array, or a newly created array ifdest
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 toboolean
by an identity or widening conversion. Subclasses may relax this constraint if appropriate.
-
evaluate
public byte[] evaluate(Position coord, byte[] dest) throws PointOutsideCoverageException, CannotEvaluateException Returns a sequence of 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, but it can be changed by some subclasses. The CRS of the point is the same as the grid coverage coordinate reference system.- Specified by:
evaluate
in interfaceCoverage
- Parameters:
coord
- The coordinate point where to evaluate.dest
- An array in which to store values, ornull
to create a new array.- Returns:
- The
dest
array, or a newly created array ifdest
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 tobyte
by an identity or widening conversion. Subclasses may relax this constraint if appropriate.
-
evaluate
public int[] evaluate(Position coord, int[] dest) throws PointOutsideCoverageException, CannotEvaluateException Returns 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, but it can be changed by some subclasses. The CRS of the point is the same as the grid coverage coordinate reference system.- Specified by:
evaluate
in interfaceCoverage
- Parameters:
coord
- The coordinate point where to evaluate.dest
- An array in which to store values, ornull
to create a new array.- Returns:
- The
dest
array, or a newly created array ifdest
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 toint
by an identity or widening conversion. Subclasses may relax this constraint if appropriate.- See Also:
-
evaluate
public float[] evaluate(Position coord, float[] dest) throws PointOutsideCoverageException, CannotEvaluateException Returns a sequence of float 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, but it can be changed by some subclasses. The CRS of the point is the same as the grid coverage coordinate reference system.- Specified by:
evaluate
in interfaceCoverage
- Parameters:
coord
- The coordinate point where to evaluate.dest
- An array in which to store values, ornull
to create a new array.- Returns:
- The
dest
array, or a newly created array ifdest
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 tofloat
by an identity or widening conversion. Subclasses may relax this constraint if appropriate.- See Also:
-
evaluate
public double[] evaluate(Position coord, double[] dest) throws PointOutsideCoverageException, CannotEvaluateException Returns 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, but it can be changed by some subclasses. The CRS of the point is the same as the grid coverage coordinate reference system.- Specified by:
evaluate
in interfaceCoverage
- Parameters:
coord
- The coordinate point where to evaluate.dest
- An array in which to store values, ornull
to create a new array.- Returns:
- The
dest
array, or a newly created array ifdest
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 todouble
by an identity or widening conversion. Subclasses may relax this constraint if appropriate.- See Also:
-
getRenderableImage
Returns 2D view of this grid coverage as a renderable image. This method allows interoperability with Java2D.- Specified by:
getRenderableImage
in interfaceCoverage
- Parameters:
xAxis
- Dimension to use for the x display axis.yAxis
- Dimension to use for the y display axis.- Returns:
- A 2D view of this grid coverage as a renderable image.
-
show
Display this coverage in a windows. This convenience method is used for debugging purpose. The exact appareance of the windows and the tools provided may changes in future versions.- Parameters:
title
- The window title, ornull
for default value.xAxis
- Dimension to use for the x display axis.yAxis
- Dimension to use for the y display axis.- Since:
- 2.3
-
show
Display this coverage in a windows. This convenience method is used for debugging purpose. The exact appareance of the windows and the tools provided may changes in future versions.- Parameters:
title
- The window title, ornull
for default value.- Since:
- 2.3
-
show
public void show()Displays this coverage in a windows. This convenience method is used for debugging purpose. The exact appareance of the windows and the tools provided may changes in future versions. -
getSources
Returns the source data for a coverage. The default implementation returns an empty list.- Specified by:
getSources
in interfaceCoverage
- Returns:
- The list of sources data for a coverage.
-
getLocale
Returns the default locale for logging, error messages, etc..- Returns:
- The default locale for logging and error message.
-
toString
Returns a string representation of this coverage. This string is for debugging purpose only and may change in future version. -
dispose
public boolean dispose(boolean force) Provides a hint that a coverage will no longer be accessed from a reference in user space. This can be used as a hint in situations where waiting for garbage collection would be overly conservative. The results of referencing a coverage after a call todispose
are undefined, except if this method returnedfalse
.This method can work in a conservative mode or a forced mode, determined by the
force
argument:-
If
force
isfalse
(the recommanded value), this method may process only under some conditions. For example a grid coverage may dispose its planar image only if it has no sinks. This method returnstrue
if it disposed all resources, orfalse
if this method vetoed against the disposal. In the later case, this coverage can still be used. -
If
force
istrue
, then this method processes inconditionnally and returns alwaystrue
. This is a more risky behavior.
The conservative mode (
force = false
) performs its safety checks on a best-effort basis, with no guarantees. Therefore, it would be wrong to write a program that depended on the safety checks for its correctness. In case of doubt about whatever this coverage still in use or not, it is safer to rely on the garbage collector.- Parameters:
force
-true
for forcing an inconditionnal disposal, orfalse
for performing a conservative disposal. The recommanded value isfalse
.- Returns:
true
if this method disposed at least some resources, orfalse
if this method vetoed against the disposal.- Since:
- 2.4
- See Also:
-
PlanarImage.dispose()
-
-