Interface ToleranceModifier


  • public interface ToleranceModifier
    Modifies the tolerance threshold before to compare a calculated value against its expected value. When a TestCase is run, GeoAPI performs the following steps:
    • Scan every ImplementationDetails on the classpath and invoke their tolerance(…) method for the MathTransform being tested.
    • For each non-null ToleranceModifier, invoke the adjust(…) method. The first given argument will be the default tolerance thresholds computed by the TestCase being run. Implementation can modify those tolerances in an arbitrary number of dimensions.
    Different implementations are available for different cases. For example:
    • Allowing a greater tolerance threshold along the vertical axis compared to the horizontal axis.
    • In a geographic CRS, ignoring offsets of 360° in longitude.
    • In a geographic CRS, ignoring the longitude value if the latitude is at a pole.
    Since:
    3.1
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static ToleranceModifier GEOGRAPHIC
      Converts λ and φ tolerance values from metres to degrees before comparing geographic coordinates.
      static ToleranceModifier GEOGRAPHIC_φλ
      Converts φ and λ tolerance values from metres to degrees before comparing geographic coordinates.
      static ToleranceModifier PROJECTION
      Converts λ and φ tolerance values from metres to degrees before comparing the result of an inverse projection.
      static ToleranceModifier PROJECTION_FROM_φλ
      Converts φ and λ tolerance values from metres to degrees before comparing the result of an inverse projection.
      static ToleranceModifier RELATIVE
      Makes the tolerance values relative to the ordinate values being compared.
    • Method Summary

      Modifier and Type Method Description
      void adjust​(double[] tolerance, DirectPosition coordinate, CalculationType mode)
      Adjusts the tolerance threshold for comparing the given coordinate along each dimensions.
    • Field Detail

      • GEOGRAPHIC

        static final ToleranceModifier GEOGRAPHIC
        Converts λ and φ tolerance values from metres to degrees before comparing geographic coordinates. The tolerance for the longitude (λ) and latitude (φ) ordinate values are converted from metres to degrees using the standard length of one nautical mile (1852.0 metres per minute of angle). Next, the λ tolerance is adjusted according the distance of the φ ordinate value to the pole. In the extreme case where the coordinate to compare is located at a pole, then the tolerance is 360° in longitude values.

        This modifier assumes that geographic coordinates are expressed in decimal degrees in (longitude, latitude) order, as documented in the parameterized transform contructor.

        See Also:
        ToleranceModifiers.geographic(int, int)
      • RELATIVE

        static final ToleranceModifier RELATIVE
        Makes the tolerance values relative to the ordinate values being compared. For each dimension, this modifier multiplies the tolerance threshold by the ordinate value and ensure that the result is not lower than the original threshold (in order to allow comparisons of values close to zero):
        tolerance[i] = max(tolerance[i], tolerance[i] × ordinate[i])
    • Method Detail

      • adjust

        void adjust​(double[] tolerance,
                    DirectPosition coordinate,
                    CalculationType mode)
        Adjusts the tolerance threshold for comparing the given coordinate along each dimensions.
        Parameters:
        tolerance - the default tolerance threshold determined by the TestCase being run. This array can be modified in-place.
        coordinate - the coordinate being compared, in the target CRS.
        mode - Indicates if the coordinate being compared is the result of a direct or inverse transform, or if strict equality is requested.