Package org.apache.sis.coverage.grid
Class EvaluatorWrapper
java.lang.Object
org.apache.sis.coverage.grid.EvaluatorWrapper
- All Implemented Interfaces:
Function<org.opengis.geometry.DirectPosition,
,double[]> BandedCoverage.Evaluator
,GridCoverage.Evaluator
- Direct Known Subclasses:
ConvertedGridCoverage.SampleConverter
An evaluator which delegates all operations to another evaluator.
The default implementation of all methods except
GridCoverage.Evaluator.getCoverage()
delegates to the source evaluator.- Since:
- 1.3
- Version:
- 1.3
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final GridCoverage.Evaluator
The evaluator provided by source coverage. -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new evaluator wrapper. -
Method Summary
Modifier and TypeMethodDescriptiondouble[]
apply
(org.opengis.geometry.DirectPosition point) Returns a sequence of double values for a given point in the coverage.Returns the default slice where to perform evaluation, or an empty map if unspecified.boolean
Returns whether to returnnull
instead of throwing an exception if a point is outside coverage bounds.boolean
Returnstrue
if this evaluator is allowed to wraparound coordinates that are outside the grid.void
setDefaultSlice
(Map<Integer, Long> slice) Sets the default slice where to perform evaluation when the points do not have enough dimensions.void
setNullIfOutside
(boolean flag) Specifies whether to returnnull
instead of throwing an exception if a point is outside coverage bounds.void
setWraparoundEnabled
(boolean allow) Specifies whether this evaluator is allowed to wraparound coordinates that are outside the grid.toGridCoordinates
(org.opengis.geometry.DirectPosition point) Converts the specified geospatial position to grid coordinates.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.apache.sis.coverage.grid.GridCoverage.Evaluator
getCoverage
-
Field Details
-
source
The evaluator provided by source coverage. This is where all operations are delegated.
-
-
Constructor Details
-
EvaluatorWrapper
EvaluatorWrapper(GridCoverage.Evaluator source) Creates a new evaluator wrapper.- Parameters:
source
- the evaluator to wrap.
-
-
Method Details
-
isNullIfOutside
public boolean isNullIfOutside()Returns whether to returnnull
instead of throwing an exception if a point is outside coverage bounds.- Specified by:
isNullIfOutside
in interfaceBandedCoverage.Evaluator
- Returns:
- whether
BandedCoverage.Evaluator.apply(DirectPosition)
returnnull
for points outside coverage bounds.
-
setNullIfOutside
public void setNullIfOutside(boolean flag) Specifies whether to returnnull
instead of throwing an exception if a point is outside coverage bounds.- Specified by:
setNullIfOutside
in interfaceBandedCoverage.Evaluator
- Parameters:
flag
- whetherBandedCoverage.Evaluator.apply(DirectPosition)
should usenull
return value instead ofPointOutsideCoverageException
for signaling that a point is outside coverage bounds.
-
isWraparoundEnabled
public boolean isWraparoundEnabled()Returnstrue
if this evaluator is allowed to wraparound coordinates that are outside the grid.- Specified by:
isWraparoundEnabled
in interfaceBandedCoverage.Evaluator
- Returns:
true
if this evaluator may wraparound coordinates that are outside the coverage.
-
setWraparoundEnabled
public void setWraparoundEnabled(boolean allow) Specifies whether this evaluator is allowed to wraparound coordinates that are outside the grid.- Specified by:
setWraparoundEnabled
in interfaceBandedCoverage.Evaluator
- Parameters:
allow
- whether to allow wraparound of coordinates that are outside the coverage.
-
getDefaultSlice
Returns the default slice where to perform evaluation, or an empty map if unspecified. This method should be overridden if this evaluator has been created for a coverage with a different grid geometry than the coverage of the wrapped evaluator.- Specified by:
getDefaultSlice
in interfaceGridCoverage.Evaluator
- Returns:
- the default slice where to perform evaluation, or an empty map if unspecified.
-
setDefaultSlice
Sets the default slice where to perform evaluation when the points do not have enough dimensions. This method should be overridden if this evaluator has been created for a coverage with a different grid geometry than the coverage of the wrapped evaluator.- Specified by:
setDefaultSlice
in interfaceGridCoverage.Evaluator
- Parameters:
slice
- the default slice where to perform evaluation, or an empty map if none.- See Also:
-
toGridCoordinates
public FractionalGridCoordinates toGridCoordinates(org.opengis.geometry.DirectPosition point) throws org.opengis.referencing.operation.TransformException Converts the specified geospatial position to grid coordinates. This method should be overridden if this evaluator has been created for a coverage with a different grid geometry than the coverage of the wrapped evaluator.- Specified by:
toGridCoordinates
in interfaceGridCoverage.Evaluator
- Parameters:
point
- geospatial coordinates (in arbitrary CRS) to transform to grid coordinates.- Returns:
- the grid coordinates for the given geospatial coordinates.
- Throws:
org.opengis.referencing.operation.TransformException
- if the given coordinates cannot be transformed.- See Also:
-
apply
Returns a sequence of double values for a given point in the coverage. This method should be overridden if this evaluator is for a coverage doing some on-the-fly conversion of sample values.- Specified by:
apply
in interfaceBandedCoverage.Evaluator
- Specified by:
apply
in interfaceFunction<org.opengis.geometry.DirectPosition,
double[]> - Parameters:
point
- the position 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:
CannotEvaluateException
- if the values cannot be computed.
-