public abstract class AbstractCoverage extends PropertySourceImpl implements Coverage
Modifier and Type | Class and Description |
---|---|
protected class |
AbstractCoverage.Renderable
A view of a coverage as a renderable image.
|
Modifier and Type | Field and Description |
---|---|
protected CoordinateReferenceSystem |
crs
The coordinate reference system, or
null if there is none. |
Modifier | Constructor and Description |
---|---|
protected |
AbstractCoverage(CharSequence name,
CoordinateReferenceSystem crs,
PropertySource propertySource,
Map<?,?> properties)
Constructs a coverage using the specified coordinate reference system.
|
protected |
AbstractCoverage(CharSequence name,
Coverage coverage)
Constructs a new coverage with the same parameters than the specified coverage.
|
Modifier and Type | Method and Description |
---|---|
boolean |
dispose(boolean force)
Provides a hint that a coverage will no longer be accessed from a reference in user space.
|
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.
|
Set<Record> |
evaluate(DirectPosition p,
Collection<String> list)
Returns a set of records of feature attribute values for the specified direct position.
|
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.
|
CoordinateReferenceSystem |
getCoordinateReferenceSystem()
Returns the coordinate reference system to which the objects in its domain are referenced.
|
int |
getDimension()
Returns the dimension of this coverage.
|
Envelope |
getEnvelope()
Returns the bounding box for the coverage domain in coordinate reference system coordinates.
|
Locale |
getLocale()
Returns the default locale for logging, error messages, etc.
|
InternationalString |
getName()
Returns the coverage name, or
null if none. |
RecordType |
getRangeType()
Describes the range of the coverage.
|
RenderableImage |
getRenderableImage(int xAxis,
int yAxis)
Returns 2D view of this grid coverage as a renderable image.
|
List<? extends Coverage> |
getSources()
Returns the source data for a coverage.
|
void |
show()
Displays this coverage in a windows.
|
void |
show(String title)
Display this coverage in a windows.
|
void |
show(String title,
int xAxis,
int yAxis)
Display this coverage in a windows.
|
String |
toString()
Returns a string representation of this coverage.
|
getProperties, getProperty, getPropertyClass, getPropertyNames, getPropertyNames
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
evaluate, getNumSampleDimensions, getSampleDimension
protected final CoordinateReferenceSystem crs
null
if there is none.protected AbstractCoverage(CharSequence name, CoordinateReferenceSystem crs, PropertySource propertySource, Map<?,?> properties)
null
, then the subclasses must override getDimension()
.name
- The coverage name, or null
if none.crs
- The coordinate reference system. This specifies the CRS 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 AbstractCoverage
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
.protected AbstractCoverage(CharSequence name, Coverage coverage)
Note: This constructor keeps a strong reference to the source coverage
(through PropertySourceImpl
).
name
- The name for this coverage, or null
for the same than coverage
.coverage
- The source coverage.public InternationalString getName()
null
if none. The default implementation returns the
name specified at construction time.null
.public final int getDimension()
crs.getCoordinateSystem().getDimension()
.public CoordinateReferenceSystem getCoordinateReferenceSystem()
evaluate(...)
methods. This coordinate reference system is usually different than coordinate
system of the grid. It is the target coordinate reference system of the gridToCRS
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.
getCoordinateReferenceSystem
in interface Coverage
evaluate(...)
methods.GeneralGridGeometry.getGridToCRS()
public Envelope getEnvelope()
null
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.
The default implementation returns the domain of validity of the CRS, if there is one.(Minimum row - 0.5, Minimum column - 0.5) for the minimum coordinates (Maximum row - 0.5, Maximum column - 0.5) for the maximum coordinates
getEnvelope
in interface Coverage
public RecordType getRangeType()
RecordType
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.
getRangeType
in interface Coverage
public Set<Record> evaluate(DirectPosition p, Collection<String> list)
list
is a sequence of feature attribute names each of which identifies a
field of the range type. If list
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 in
list
. 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.
public boolean[] evaluate(DirectPosition coord, boolean[] dest) throws PointOutsideCoverageException, CannotEvaluateException
evaluate
in interface Coverage
coord
- The coordinate point where to evaluate.dest
- An array in which to store values, or null
to create a new array.dest
array, or a newly created array if dest
was null.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.public byte[] evaluate(DirectPosition coord, byte[] dest) throws PointOutsideCoverageException, CannotEvaluateException
evaluate
in interface Coverage
coord
- The coordinate point where to evaluate.dest
- An array in which to store values, or null
to create a new array.dest
array, or a newly created array if dest
was null.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.public int[] evaluate(DirectPosition coord, int[] dest) throws PointOutsideCoverageException, CannotEvaluateException
evaluate
in interface Coverage
coord
- The coordinate point where to evaluate.dest
- An array in which to store values, or null
to create a new array.dest
array, or a newly created array if dest
was null.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.Raster.getPixel(int, int, int[])
public float[] evaluate(DirectPosition coord, float[] dest) throws PointOutsideCoverageException, CannotEvaluateException
evaluate
in interface Coverage
coord
- The coordinate point where to evaluate.dest
- An array in which to store values, or null
to create a new array.dest
array, or a newly created array if dest
was null.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.Raster.getPixel(int, int, float[])
public double[] evaluate(DirectPosition coord, double[] dest) throws PointOutsideCoverageException, CannotEvaluateException
evaluate
in interface Coverage
coord
- The coordinate point where to evaluate.dest
- An array in which to store values, or null
to create a new array.dest
array, or a newly created array if dest
was null.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.Raster.getPixel(int, int, double[])
public RenderableImage getRenderableImage(int xAxis, int yAxis)
getRenderableImage
in interface Coverage
xAxis
- Dimension to use for the x display axis.yAxis
- Dimension to use for the y display axis.public void show(String title, int xAxis, int yAxis)
title
- The window title, or null
for default value.xAxis
- Dimension to use for the x display axis.yAxis
- Dimension to use for the y display axis.public void show(String title)
title
- The window title, or null
for default value.public void show()
public List<? extends Coverage> getSources()
getSources
in interface Coverage
public Locale getLocale()
public String toString()
public boolean dispose(boolean force)
dispose
are
undefined, except if this method returned false
.
This method can work in a conservative mode or a forced mode,
determined by the force
argument:
If force
is false
(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 returns true
if it disposed all resources, or false
if this method vetoed against the
disposal. In the later case, this coverage can still be used.
If force
is true
, then this method processes inconditionnally and
returns always true
. 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.
force
- true
for forcing an inconditionnal disposal, or false
for
performing a conservative disposal. The recommanded value is false
.true
if this method disposed at least some resources, or false
if
this method vetoed against the disposal.PlanarImage.dispose()
Copyright © 1996–2019 Geotools. All rights reserved.