Class DefaultOperationMethod
- Object
-
- Formattable
-
- AbstractIdentifiedObject
-
- DefaultOperationMethod
-
- All Implemented Interfaces:
Serializable
,IdentifiedObject
,OperationMethod
- Direct Known Subclasses:
MathTransformProvider
public class DefaultOperationMethod extends AbstractIdentifiedObject implements OperationMethod
Definition of an algorithm used to perform a coordinate operation. Most operation methods use a number of operation parameters, although some coordinate conversions use none. Each coordinate operation using the method assigns values to these parameters.- Since:
- 2.1
- Author:
- Martin Desruisseaux (IRD)
- See Also:
DefaultOperation
, Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected int
sourceDimensions
Number of dimensions in the source CRS of this operation method.protected int
targetDimensions
Number of dimensions in the target CRS of this operation method.-
Fields inherited from class AbstractIdentifiedObject
EMPTY_ALIAS_ARRAY, EMPTY_IDENTIFIER_ARRAY, IDENTIFIER_COMPARATOR, NAME_COMPARATOR, REMARKS_COMPARATOR
-
Fields inherited from class Formattable
SINGLE_LINE
-
Fields inherited from interface IdentifiedObject
ALIAS_KEY, IDENTIFIERS_KEY, NAME_KEY, REMARKS_KEY
-
Fields inherited from interface OperationMethod
FORMULA_KEY
-
-
Constructor Summary
Constructors Constructor Description DefaultOperationMethod(Map<String,?> properties, int sourceDimensions, int targetDimensions, ParameterDescriptorGroup parameters)
Constructs an operation method from a set of properties and a descriptor group.DefaultOperationMethod(MathTransform transform)
Convenience constructor that creates an operation method from a math transform.DefaultOperationMethod(OperationMethod method)
Constructs a new operation method with the same values than the specified one.DefaultOperationMethod(OperationMethod method, int sourceDimensions, int targetDimensions)
Constructs a new operation method with the same values than the specified one except the dimensions.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static void
checkDimensions(OperationMethod method, MathTransform transform)
Checks if an operation method and a math transform have a compatible number of source and target dimensions.boolean
equals(AbstractIdentifiedObject object, boolean compareMetadata)
Compare this operation method with the specified object for equality.protected String
formatWKT(Formatter formatter)
Format the inner part of a Well Known Text (WKT) element.InternationalString
getFormula()
Formula(s) or procedure used by this operation method.ParameterDescriptorGroup
getParameters()
Returns the set of parameters.int
getSourceDimensions()
Number of dimensions in the source CRS of this operation method.int
getTargetDimensions()
Number of dimensions in the target CRS of this operation method.int
hashCode()
Returns a hash code value for this operation method.-
Methods inherited from class AbstractIdentifiedObject
asSet, ensureAngularUnit, ensureLinearUnit, ensureNonNull, ensureNonNull, ensureTimeUnit, equals, equals, equals, equals, getAlias, getIdentifier, getIdentifier, getIdentifiers, getName, getName, getName, getProperties, getProperties, getRemarks, nameMatches, nameMatches, nameMatches
-
Methods inherited from class Formattable
cleanupThreadLocals, toString, toWKT, toWKT, toWKT, toWKT
-
Methods inherited from interface IdentifiedObject
getAlias, getIdentifiers, getName, getRemarks, toWKT
-
-
-
-
Constructor Detail
-
DefaultOperationMethod
public DefaultOperationMethod(MathTransform transform)
Convenience constructor that creates an operation method from a math transform. The information provided in the newly created object are approximative, and usually acceptable only as a fallback when no other information are available.- Parameters:
transform
- The math transform to describe.
-
DefaultOperationMethod
public DefaultOperationMethod(OperationMethod method)
Constructs a new operation method with the same values than the specified one. This copy constructor provides a way to wrap an arbitrary implementation into a Geotools one or a user-defined one (as a subclass), usually in order to leverage some implementation-specific API. This constructor performs a shallow copy, i.e. the properties are not cloned.- Parameters:
method
- The operation method to copy.
-
DefaultOperationMethod
public DefaultOperationMethod(OperationMethod method, int sourceDimensions, int targetDimensions)
Constructs a new operation method with the same values than the specified one except the dimensions.- Parameters:
method
- The operation method to copy.sourceDimensions
- Number of dimensions in the source CRS of this operation method.targetDimensions
- Number of dimensions in the target CRS of this operation method.
-
DefaultOperationMethod
public DefaultOperationMethod(Map<String,?> properties, int sourceDimensions, int targetDimensions, ParameterDescriptorGroup parameters)
Constructs an operation method from a set of properties and a descriptor group. The properties given in argument follow the same rules than for the super-class constructor. Additionally, the following properties are understood by this construtor:
Property name Value type Value given to "formula"
String
orInternationalString
getFormula()
- Parameters:
properties
- Set of properties. Should contains at least"name"
.sourceDimensions
- Number of dimensions in the source CRS of this operation method.targetDimensions
- Number of dimensions in the target CRS of this operation method.parameters
- The set of parameters, ornull
if none.
-
-
Method Detail
-
getFormula
public InternationalString getFormula()
Formula(s) or procedure used by this operation method. This may be a reference to a publication. Note that the operation method may not be analytic, in which case this attribute references or contains the procedure, not an analytic formula.- Specified by:
getFormula
in interfaceOperationMethod
- Returns:
- The formula used by this method.
-
getSourceDimensions
public int getSourceDimensions()
Number of dimensions in the source CRS of this operation method.- Specified by:
getSourceDimensions
in interfaceOperationMethod
- Returns:
- The dimension of source CRS.
-
getTargetDimensions
public int getTargetDimensions()
Number of dimensions in the target CRS of this operation method.- Specified by:
getTargetDimensions
in interfaceOperationMethod
- Returns:
- The dimension of target CRS.
-
getParameters
public ParameterDescriptorGroup getParameters()
Returns the set of parameters.- Specified by:
getParameters
in interfaceOperationMethod
- Returns:
- The parameters, or an empty group if none.
-
equals
public boolean equals(AbstractIdentifiedObject object, boolean compareMetadata)
Compare this operation method with the specified object for equality. IfcompareMetadata
istrue
, then all available properties are compared including formula.- Overrides:
equals
in classAbstractIdentifiedObject
- Parameters:
object
- The object to compare tothis
.compareMetadata
-true
for performing a strict comparaison, orfalse
for comparing only properties relevant to transformations.- Returns:
true
if both objects are equal.
-
hashCode
public int hashCode()
Returns a hash code value for this operation method.- Overrides:
hashCode
in classAbstractIdentifiedObject
- Returns:
- The hash code value. This value doesn't need to be the same in past or future versions of this class.
-
formatWKT
protected String formatWKT(Formatter formatter)
Format the inner part of a Well Known Text (WKT) element.- Overrides:
formatWKT
in classFormattable
- Parameters:
formatter
- The formatter to use.- Returns:
- The WKT element name.
- See Also:
Formattable.toWKT()
,Formattable.toString()
-
checkDimensions
public static void checkDimensions(OperationMethod method, MathTransform transform) throws MismatchedDimensionException
Checks if an operation method and a math transform have a compatible number of source and target dimensions. In the particular case of a pass through transform with more dimension than the expected number, the check will rather be performed against the sub transform.This convenience method is provided for argument checking.
- Parameters:
method
- The operation method to compare to the math transform, ornull
.transform
- The math transform to compare to the operation method, ornull
.- Throws:
MismatchedDimensionException
- if the number of dimensions are incompatibles.
-
-