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 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 final ToleranceModifier
    Converts λ and φ tolerance values from metres to degrees before comparing geographic coordinates.
    static final ToleranceModifier
    Converts φ and λ tolerance values from metres to degrees before comparing geographic coordinates.
    static final ToleranceModifier
    Converts λ and φ tolerance values from metres to degrees before comparing the result of an reverse projection.
    static final ToleranceModifier
    Converts φ and λ tolerance values from metres to degrees before comparing the result of an reverse projection.
    static final ToleranceModifier
    Makes the tolerance values relative to the coordinate 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 Details

    • GEOGRAPHIC

      static final ToleranceModifier GEOGRAPHIC
      Converts λ and φ tolerance values from metres to degrees before comparing geographic coordinates. The tolerance for the longitude (λ) and latitude (φ) coordinate 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 φ coordinate 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:
    • GEOGRAPHIC_φλ

      static final ToleranceModifier GEOGRAPHIC_φλ
      Converts φ and λ tolerance values from metres to degrees before comparing geographic coordinates. This modifier is identical to the GEOGRAPHIC tolerance modifier, except that φ and λ axes are interchanged. This is the most common modifier used when testing GeographicCRS instances created from the EPSG database.
      See Also:
    • PROJECTION

      static final ToleranceModifier PROJECTION
      Converts λ and φ tolerance values from metres to degrees before comparing the result of an reverse projection. For forward projections and all other calculations, the tolerance values are left unchanged.

      The modifier performs the work documented in GEOGRAPHIC if and only if the CalculationType is INVERSE_TRANSFORM. For all other cases, the modifier does nothing.

      See Also:
    • PROJECTION_FROM_φλ

      static final ToleranceModifier PROJECTION_FROM_φλ
      Converts φ and λ tolerance values from metres to degrees before comparing the result of an reverse projection. This modifier is identical to the PROJECTION tolerance modifier, except that φ and λ axes are interchanged. This is the most common modifier used when testing ProjectedCRS instances created from the EPSG database.
      See Also:
    • RELATIVE

      static final ToleranceModifier RELATIVE
      Makes the tolerance values relative to the coordinate values being compared. For each dimension, this modifier multiplies the tolerance threshold by the coordinate 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] × coordinate[i])
  • Method Details

    • 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.