Class ToleranceModifiers

Object
ToleranceModifiers

public final class ToleranceModifiers extends Object
A factory of various ToleranceModifier implementations.
Since:
3.1
  • Field Details

    • NAUTICAL_MILE

      public static final double NAUTICAL_MILE
      The standard length of one nautical mile, which is 1852.0 metres. This is the length of about one minute of arc of latitude along any meridian. This distance is used by geographic tolerance modifiers for converting linear units to angular units.
      See Also:
  • Method Details

    • geographic

      public static ToleranceModifier geographic(int λDimension, int φDimension)
      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.
      Parameters:
      λDimension - the dimension of longitude coordinate values (typically 0 or 1).
      φDimension - the dimension of latitude coordinate values (typically 0 or 1).
      Returns:
      a tolerance modifier suitable for comparing geographic coordinates.
      See Also:
    • projection

      public static ToleranceModifier projection(int λDimension, int φDimension)
      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(int, int) if and only if the CalculationType is INVERSE_TRANSFORM. For all other cases, the modifier does nothing.

      Parameters:
      λDimension - the dimension of longitude coordinate values (typically 0 or 1).
      φDimension - the dimension of latitude coordinate values (typically 0 or 1).
      Returns:
      a tolerance modifier suitable for comparing projected coordinates.
      See Also:
    • scale

      public static ToleranceModifier scale(Set<CalculationType> types, double... factors)
      Multiplies tolerance values by the given factors. For every dimension i, this modifier multiplies tolerance[i] by factors[i].

      If the tolerance array is longer than the factors array, all extra tolerance values are left unchanged. If the tolerance array is shorter than the factors array, the extra factors values are ignored.

      Parameters:
      types - the calculation types for which to apply the given scale factors.
      factors - the factors by which to multiply the tolerance values.
      Returns:
      a tolerance modifier that scale the tolerance thresholds, or null if the given set or array is empty or all the given scale factors are equals to 1.
    • maximum

      public static ToleranceModifier maximum(ToleranceModifier... modifiers)
      Returns a modifier which will return the maximal tolerance threshold of all the given modifiers for each dimension.
      Parameters:
      modifiers - the modifiers to iterate over.
      Returns:
      a filter for the maximal tolerance threshold of all the given modifiers, or null if the given modifiers array is empty.
    • concatenate

      public static ToleranceModifier concatenate(ToleranceModifier first, ToleranceModifier second)
      Returns a concatenation of two existing modifiers. The tolerance threshold are first adjusted according the first modifier, then the result is given to the second modifier for an additional adjustment.
      Parameters:
      first - the first modifier, or null.
      second - the second modifier, or null.
      Returns:
      the concatenation of the two given identifiers, or null if both identifiers are null.