Interface BandedCoverage.Evaluator

All Superinterfaces:
Function<org.opengis.geometry.DirectPosition,double[]>
All Known Subinterfaces:
GridCoverage.Evaluator
All Known Implementing Classes:
BufferedGridCoverage.CellAccessor, ConvertedGridCoverage.SampleConverter, DefaultEvaluator, EvaluatorWrapper, GridCoverage2D.PixelAccessor
Enclosing class:
BandedCoverage

public static interface BandedCoverage.Evaluator extends Function<org.opengis.geometry.DirectPosition,double[]>
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 of Evaluator should be created for each thread that need to compute sample values.
Since:
1.1
Version:
1.3
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    double[]
    apply(org.opengis.geometry.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 return null instead of throwing an exception if a point is outside coverage bounds.
    boolean
    Returns true if this evaluator is allowed to wraparound coordinates that are outside the coverage.
    void
    setNullIfOutside(boolean flag)
    Sets whether to return null 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 coverage.

    Methods inherited from interface java.util.function.Function

    andThen, compose
  • Method Details

    • getCoverage

      BandedCoverage getCoverage()
      Returns the coverage from which this evaluator is computing sample values. This is the coverage on which the BandedCoverage.evaluator() method has been invoked.
      Returns:
      the source of sample values for this evaluator.
    • isNullIfOutside

      boolean isNullIfOutside()
      Returns whether to return null instead of throwing an exception if a point is outside coverage bounds. The default value is false, which means that the default apply(DirectPosition) behavior is to throw PointOutsideCoverageException for points outside bounds.
      Returns:
      whether apply(DirectPosition) return null for points outside coverage bounds.
    • setNullIfOutside

      void setNullIfOutside(boolean flag)
      Sets whether to return null instead of throwing an exception if a point is outside coverage bounds. The default value is false. Setting this flag to true 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 - whether apply(DirectPosition) should use null return value instead of PointOutsideCoverageException for signaling that a point is outside coverage bounds.
    • isWraparoundEnabled

      boolean isWraparoundEnabled()
      Returns true if this evaluator is allowed to wraparound coordinates that are outside the coverage. The initial value is false. This method may continue to return false even after a call to setWraparoundEnabled(true) if no wraparound axis has been found in the coverage CRS, or if automatic wraparound is not supported.
      Returns:
      true if this evaluator may wraparound coordinates that are outside the coverage.
      Since:
      1.3
    • setWraparoundEnabled

      void setWraparoundEnabled(boolean allow)
      Specifies whether this evaluator is allowed to wraparound coordinates that are outside the coverage. If true and if a given coordinate is outside the coverage, then this evaluator may translate the point along a wraparound axis in an attempt to get the point inside the coverage. For example, if the coverage CRS has a longitude axis, then the evaluator may translate the longitude value by a multiple of 360°.
      Parameters:
      allow - whether to allow wraparound of coordinates that are outside the coverage.
      Since:
      1.3
    • apply

      double[] apply(org.opengis.geometry.DirectPosition point) throws CannotEvaluateException
      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 interface Function<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:
      PointOutsideCoverageException - if the evaluation failed because the input point has invalid coordinates and the isNullIfOutside() flag is false.
      CannotEvaluateException - if the values cannot be computed at the specified coordinates for another reason. For example, this exception may be thrown if the coverage data type cannot be converted to double by an identity or widening conversion.