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.EvaluatorThe 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.booleanReturns whether to returnnullinstead of throwing an exception if a point is outside coverage bounds.booleanReturnstrueif this evaluator is allowed to wraparound coordinates that are outside the grid.voidsetDefaultSlice(Map<Integer, Long> slice) Sets the default slice where to perform evaluation when the points do not have enough dimensions.voidsetNullIfOutside(boolean flag) Specifies whether to returnnullinstead of throwing an exception if a point is outside coverage bounds.voidsetWraparoundEnabled(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, waitMethods 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 returnnullinstead of throwing an exception if a point is outside coverage bounds.- Specified by:
isNullIfOutsidein interfaceBandedCoverage.Evaluator- Returns:
- whether
BandedCoverage.Evaluator.apply(DirectPosition)returnnullfor points outside coverage bounds.
-
setNullIfOutside
public void setNullIfOutside(boolean flag) Specifies whether to returnnullinstead of throwing an exception if a point is outside coverage bounds.- Specified by:
setNullIfOutsidein interfaceBandedCoverage.Evaluator- Parameters:
flag- whetherBandedCoverage.Evaluator.apply(DirectPosition)should usenullreturn value instead ofPointOutsideCoverageExceptionfor signaling that a point is outside coverage bounds.
-
isWraparoundEnabled
public boolean isWraparoundEnabled()Returnstrueif this evaluator is allowed to wraparound coordinates that are outside the grid.- Specified by:
isWraparoundEnabledin interfaceBandedCoverage.Evaluator- Returns:
trueif 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:
setWraparoundEnabledin 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:
getDefaultSlicein 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:
setDefaultSlicein 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:
toGridCoordinatesin 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:
applyin interfaceBandedCoverage.Evaluator- Specified by:
applyin interfaceFunction<org.opengis.geometry.DirectPosition,double[]> - Parameters:
point- the position where to evaluate.- Returns:
- the sample values at the specified point, or
nullif 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.
-