Package org.opengis.test
Class ToleranceModifiers
- Object
-
- ToleranceModifiers
-
public final class ToleranceModifiers extends Object
A factory of variousToleranceModifier
implementations.- Since:
- 3.1
-
-
Field Summary
Fields Modifier and Type Field Description static double
NAUTICAL_MILE
The standard length of one nautical mile, which is 1852.0 metres.
-
Method Summary
Modifier and Type Method Description static ToleranceModifier
concatenate(ToleranceModifier first, ToleranceModifier second)
Returns a concatenation of two existing modifiers.static ToleranceModifier
geographic(int λDimension, int φDimension)
Converts λ and φ tolerance values from metres to degrees before comparing geographic coordinates.static ToleranceModifier[]
getImplementationSpecific(MathTransform transform)
Returns all implementation-specific modifiers found on the classpath for the given math transform.static ToleranceModifier
maximum(ToleranceModifier... modifiers)
Returns a modifier which will return the maximal tolerance threshold of all the given modifiers for each dimension.static ToleranceModifier
projection(int λDimension, int φDimension)
Converts λ and φ tolerance values from metres to degrees before comparing the result of an inverse projection.static ToleranceModifier
scale(Set<CalculationType> types, double... factors)
Multiplies tolerance values by the given factors.
-
-
-
Field Detail
-
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:
- Constant Field Values
-
-
Method Detail
-
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 (φ) 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.- Parameters:
\u03bbDimension
- the dimension of longitude ordinate values (typically 0 or 1).\u03c6Dimension
- the dimension of latitude ordinate values (typically 0 or 1).- Returns:
- a tolerance modifier suitable for comparing geographic coordinates.
- See Also:
ToleranceModifier.GEOGRAPHIC
,ToleranceModifier.GEOGRAPHIC_φλ
-
projection
public static ToleranceModifier projection(int λDimension, int φDimension)
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(int, int)
if and only if theCalculationType
isINVERSE_TRANSFORM
. For all other cases, the modifier does nothing.- Parameters:
\u03bbDimension
- the dimension of longitude ordinate values (typically 0 or 1).\u03c6Dimension
- the dimension of latitude ordinate values (typically 0 or 1).- Returns:
- a tolerance modifier suitable for comparing projected coordinates.
- See Also:
ToleranceModifier.PROJECTION
,ToleranceModifier.PROJECTION_FROM_φλ
-
scale
public static ToleranceModifier scale(Set<CalculationType> types, double... factors)
Multiplies tolerance values by the given factors. For every dimension i, this modifier multipliestolerance[i]
byfactors[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 givenmodifiers
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, ornull
.second
- the second modifier, ornull
.- Returns:
- the concatenation of the two given identifiers, or
null
if both identifiers arenull
.
-
getImplementationSpecific
public static ToleranceModifier[] getImplementationSpecific(MathTransform transform)
Returns all implementation-specific modifiers found on the classpath for the given math transform. Implementors can modify the tolerance threshold for particular math transforms using theImplementationDetails
interface.- Parameters:
transform
- the transform for which to get implementation-specific modifiers.- Returns:
- all implementation-specific modifiers found, or an empty array if none.
- See Also:
ImplementationDetails.tolerance(MathTransform)
-
-