Class DefaultOperationMethod

All Implemented Interfaces:
Serializable, IdentifiedObject, OperationMethod, PROJFormattable
Direct Known Subclasses:
MathTransformProvider

public class DefaultOperationMethod extends AbstractIdentifiedObject implements OperationMethod, PROJFormattable
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:
  • Field Details

    • sourceDimensions

      protected final int sourceDimensions
      Number of dimensions in the source CRS of this operation method.
    • targetDimensions

      protected final int targetDimensions
      Number of dimensions in the target CRS of this operation method.
  • Constructor Details

    • 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 or InternationalString   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, or null if none.
  • Method Details

    • 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 interface OperationMethod
      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 interface OperationMethod
      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 interface OperationMethod
      Returns:
      The dimension of target CRS.
    • getParameters

      public ParameterDescriptorGroup getParameters()
      Returns the set of parameters.
      Specified by:
      getParameters in interface OperationMethod
      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. If compareMetadata is true, then all available properties are compared including formula.
      Overrides:
      equals in class AbstractIdentifiedObject
      Parameters:
      object - The object to compare to this.
      compareMetadata - true for performing a strict comparaison, or false 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 class AbstractIdentifiedObject
      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 class Formattable
      Parameters:
      formatter - The formatter to use.
      Returns:
      The WKT element name.
      See Also:
    • 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, or null.
      transform - The math transform to compare to the operation method, or null.
      Throws:
      MismatchedDimensionException - if the number of dimensions are incompatibles.
    • formatPROJ

      public String formatPROJ(PROJFormatter formatter)
      Description copied from interface: PROJFormattable
      Format the inner part of a PROJFormattable object.

      This method is automatically invoked by PROJFormatter.append(PROJFormattable).

      For example for a element (DefaultOperationMethod) of type Projection, the formatter will invoke this method to prepend the "+proj=" String for completing the PROJ String before appending the Projection Name (e.g. lcc for a Lambert Conformal Conic)

      Specified by:
      formatPROJ in interface PROJFormattable
      Parameters:
      formatter - The PROJFormatter to use.
      Returns:
      The proj String of the PROJ element type if any. (e.g. +ellps= for named ellipsoids, +datum= for named datums).