Class Interpolator2D

  • All Implemented Interfaces:
    Serializable, PropertySource, Coverage, GridCoverage

    public final class Interpolator2D
    extends GridCoverage2D
    A grid coverage using an interpolation for evaluating points. This interpolator is not used for nearest-neighbor interpolation (use the plain GridCoverage2D class for that). It should work for other kinds of interpolation however.
    Since:
    2.2
    Author:
    Martin Desruisseaux (IRD)
    See Also:
    Serialized Form
    • Field Detail

      • source

        protected final GridCoverage2D source
        The source grid coverage which was specified at construction time (never null).
      • DEFAULT_BORDER_EXTENDER_TYPE

        public static int DEFAULT_BORDER_EXTENDER_TYPE
        Default BorderExtender is BorderExtenderCopy.
    • Method Detail

      • create

        public static GridCoverage2D create​(GridCoverage2D coverage)
        Constructs a new interpolator using default interpolations.
        Parameters:
        coverage - The coverage to interpolate.
      • create

        public static GridCoverage2D create​(GridCoverage2D coverage,
                                            Interpolation interpolation)
        Constructs a new interpolator for a single interpolation.
        Parameters:
        coverage - The coverage to interpolate.
        interpolation - The interpolation to use.
      • create

        public static GridCoverage2D create​(GridCoverage2D coverage,
                                            Interpolation[] interpolations)
        Constructs a new interpolator for an interpolation and its fallbacks. The fallbacks are used if the primary interpolation failed because of NaN values in the interpolated point neighbor.
        Parameters:
        coverage - The coverage to interpolate.
        interpolations - The interpolation to use and its fallback (if any).
      • create

        public static GridCoverage2D create​(GridCoverage2D coverage,
                                            Interpolation[] interpolations,
                                            BorderExtender be)
        Constructs a new interpolator for an interpolation and its fallbacks. The fallbacks are used if the primary interpolation failed because of NaN values in the interpolated point neighbor.
        Parameters:
        coverage - The coverage to interpolate.
        interpolations - The interpolation to use and its fallback (if any).
      • getInterpolations

        public Interpolation[] getInterpolations()
        Returns interpolations. The first array's element is the interpolation for this grid coverage. Other elements (if any) are fallbacks.
      • getInterpolation

        public Interpolation getInterpolation()
        Returns the primary interpolation used by this Interpolator2D.
        Overrides:
        getInterpolation in class GridCoverage2D
        Returns:
        The interpolation.
      • evaluate

        public int[] evaluate​(Point2D coord,
                              int[] dest)
                       throws CannotEvaluateException
        Returns a sequence of integer values for a given two-dimensional point in the coverage.
        Overrides:
        evaluate in class GridCoverage2D
        Parameters:
        coord - The coordinate point where to evaluate.
        dest - An array in which to store values, or null.
        Returns:
        An array containing values.
        Throws:
        CannotEvaluateException - if the values can't be computed at the specified coordinate. More specifically, PointOutsideCoverageException is thrown if the evaluation failed because the input point has invalid coordinates.
      • evaluate

        public float[] evaluate​(Point2D coord,
                                float[] dest)
                         throws CannotEvaluateException
        Returns a sequence of float values for a given two-dimensional point in the coverage.
        Overrides:
        evaluate in class GridCoverage2D
        Parameters:
        coord - The coordinate point where to evaluate.
        dest - An array in which to store values, or null.
        Returns:
        An array containing values.
        Throws:
        CannotEvaluateException - if the values can't be computed at the specified coordinate. More specifically, PointOutsideCoverageException is thrown if the evaluation failed because the input point has invalid coordinates.
      • evaluate

        public double[] evaluate​(Point2D coord,
                                 double[] dest)
                          throws CannotEvaluateException
        Returns a sequence of double values for a given two-dimensional point in the coverage.
        Overrides:
        evaluate in class GridCoverage2D
        Parameters:
        coord - The coordinate point where to evaluate.
        dest - An array in which to store values, or null.
        Returns:
        An array containing values.
        Throws:
        CannotEvaluateException - if the values can't be computed at the specified coordinate. More specifically, PointOutsideCoverageException is thrown if the evaluation failed because the input point has invalid coordinates.