Package org.opengis.test
Interface ToleranceModifier
-
public interface ToleranceModifier
Modifies the tolerance threshold before to compare a calculated value against its expected value. When aTestCase
is run, GeoAPI performs the following steps:- Scan every
ImplementationDetails
on the classpath and invoke theirtolerance(…)
method for theMathTransform
being tested. - For each non-null
ToleranceModifier
, invoke theadjust(…)
method. The first given argument will be the default tolerance thresholds computed by theTestCase
being run. Implementation can modify those tolerances in an arbitrary number of dimensions.
- 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
- Scan every
-
-
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)
-
GEOGRAPHIC_φλ
static final ToleranceModifier GEOGRAPHIC_φλ
Converts φ and λ tolerance values from metres to degrees before comparing geographic coordinates. This modifier is identical to theGEOGRAPHIC
tolerance modifier, except that φ and λ axes are interchanged. This is the most common modifier used when testingGeographicCRS
instances created from the EPSG database.- See Also:
ToleranceModifiers.geographic(int, int)
-
PROJECTION
static final ToleranceModifier PROJECTION
Converts λ and φ tolerance values from metres to degrees before comparing the result of an inverse 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 theCalculationType
isINVERSE_TRANSFORM
. For all other cases, the modifier does nothing.- See Also:
ToleranceModifiers.projection(int, int)
-
PROJECTION_FROM_φλ
static final ToleranceModifier PROJECTION_FROM_φλ
Converts φ and λ tolerance values from metres to degrees before comparing the result of an inverse projection. This modifier is identical to thePROJECTION
tolerance modifier, except that φ and λ axes are interchanged. This is the most common modifier used when testingProjectedCRS
instances created from the EPSG database.- See Also:
ToleranceModifiers.projection(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 theTestCase
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.
-
-