Package org.apache.sis.coverage
Interface BandedCoverage.Evaluator
- All Superinterfaces:
Function<DirectPosition,
double[]>
- All Known Implementing Classes:
GridEvaluator
- Enclosing class:
BandedCoverage
Computes or interpolates values of sample dimensions at given positions.
Values are computed by calls to
apply(DirectPosition)
and are returned as double[]
.
Multi-threading
Evaluators are not thread-safe. An instance ofEvaluator
should be created
for each thread that need to compute sample values.- Since:
- 1.1
- See Also:
Defined in the sis-feature
module
-
Method Summary
Modifier and TypeMethodDescriptiondouble[]
apply
(DirectPosition point) Returns a sequence of double values for a given point in the coverage.Returns the coverage from which this evaluator is computing sample values.boolean
Returns whether to returnnull
instead of throwing an exception if a point is outside coverage bounds.void
setNullIfOutside
(boolean flag) Sets whether to returnnull
instead of throwing an exception if a point is outside coverage bounds.
-
Method Details
-
getCoverage
BandedCoverage getCoverage()Returns the coverage from which this evaluator is computing sample values.- Returns:
- the source of sample values for this evaluator.
-
isNullIfOutside
boolean isNullIfOutside()Returns whether to returnnull
instead of throwing an exception if a point is outside coverage bounds. The default value isfalse
, which means that the defaultapply(DirectPosition)
behavior is to throwPointOutsideCoverageException
for points outside bounds.- Returns:
- whether
apply(DirectPosition)
returnnull
for points outside coverage bounds.
-
setNullIfOutside
void setNullIfOutside(boolean flag) Sets whether to returnnull
instead of throwing an exception if a point is outside coverage bounds. The default value isfalse
. Setting this flag totrue
may improve performances if the caller expects that many points will be outside coverage bounds, since it reduces the amount of exceptions to be thrown.- Parameters:
flag
- whetherapply(DirectPosition)
should usenull
return value instead ofPointOutsideCoverageException
for signaling that a point is outside coverage bounds.
-
apply
Returns a sequence of double values for a given point in the coverage. The CRS of the given point may be any coordinate reference system; coordinate conversions will be applied as needed. If the CRS of the point is undefined, then it is assumed to be the coverage CRS. The returned sequence includes a value for each sample dimension.- Specified by:
apply
in interfaceFunction<DirectPosition,
double[]> - Parameters:
point
- the coordinate point where to evaluate.- Returns:
- the sample values at the specified point, or
null
if the point is outside the coverage. For performance reason, this method may return the same array on every method call by overwriting previous values. Callers should not assume that the array content stay valid for a long time. - Throws:
PointOutsideCoverageException
- if the evaluation failed because the input point has invalid coordinates and theisNullIfOutside()
flag isfalse
.CannotEvaluateException
- if the values can not be computed at the specified coordinates for another reason. For example this exception may be thrown if the coverage data type can not be converted todouble
by an identity or widening conversion.
-