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

abstract class EvaluatorWrapper extends Object implements GridCoverage.Evaluator
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 Details

    • source

      private final GridCoverage.Evaluator 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 return null instead of throwing an exception if a point is outside coverage bounds.
      Specified by:
      isNullIfOutside in interface BandedCoverage.Evaluator
      Returns:
      whether BandedCoverage.Evaluator.apply(DirectPosition) return null for points outside coverage bounds.
    • setNullIfOutside

      public void setNullIfOutside(boolean flag)
      Specifies whether to return null instead of throwing an exception if a point is outside coverage bounds.
      Specified by:
      setNullIfOutside in interface BandedCoverage.Evaluator
      Parameters:
      flag - whether BandedCoverage.Evaluator.apply(DirectPosition) should use null return value instead of PointOutsideCoverageException for signaling that a point is outside coverage bounds.
    • isWraparoundEnabled

      public boolean isWraparoundEnabled()
      Returns true if this evaluator is allowed to wraparound coordinates that are outside the grid.
      Specified by:
      isWraparoundEnabled in interface BandedCoverage.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 interface BandedCoverage.Evaluator
      Parameters:
      allow - whether to allow wraparound of coordinates that are outside the coverage.
    • getDefaultSlice

      public Map<Integer,Long> 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 interface GridCoverage.Evaluator
      Returns:
      the default slice where to perform evaluation, or an empty map if unspecified.
    • setDefaultSlice

      public void setDefaultSlice(Map<Integer,Long> slice)
      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 interface GridCoverage.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 interface GridCoverage.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

      public double[] apply(org.opengis.geometry.DirectPosition point) throws CannotEvaluateException
      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 interface BandedCoverage.Evaluator
      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:
      CannotEvaluateException - if the values cannot be computed.