org.geotoolkit.referencing.operation
Class DefaultOperationMethod

Object
  extended by FormattableObject
      extended by AbstractIdentifiedObject
          extended by DefaultOperationMethod
All Implemented Interfaces:
Serializable, Formattable, LenientComparable, IdentifiedObject, OperationMethod
Direct Known Subclasses:
MathTransformProvider

@Immutable
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.0
Version:
3.18
Author:
Martin Desruisseaux (IRD, Geomatys)
See Also:
DefaultSingleOperation, Serialized Form
Module:
referencing/geotk-referencing (download)    View source code for this class

Field Summary
protected  Integer sourceDimension
          Number of dimensions in the source CRS of this operation method.
protected  Integer targetDimension
          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 FormattableObject
EPSG, GEOTIFF, INTERNAL, OGC, SINGLE_LINE
 
Fields inherited from interface OperationMethod
FORMULA_KEY
 
Fields inherited from interface IdentifiedObject
ALIAS_KEY, IDENTIFIERS_KEY, NAME_KEY, REMARKS_KEY
 
Constructor Summary
DefaultOperationMethod(Map<String,?> properties, Integer sourceDimension, Integer targetDimension, 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, Integer sourceDimension, Integer targetDimension)
          Constructs a new operation method with the same values than the specified one except the dimensions.
 
Method Summary
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.
protected  int computeHashCode()
          Computes a hash value for this identified object.
 boolean equals(Object object, ComparisonMode mode)
          Compares this operation method with the specified object for equality.
 String formatWKT(Formatter formatter)
          Formats the inner part of a Well Known Text (WKT) element.
 Formula getFormula()
          Formula(s) or procedure used by this operation method.
 ParameterDescriptorGroup getParameters()
          Returns the set of parameters.
 Integer getSourceDimensions()
          Number of dimensions in the source CRS of this operation method.
 Integer getTargetDimensions()
          Number of dimensions in the target CRS of this operation method.
 
Methods inherited from class AbstractIdentifiedObject
equals, equals, equals, equals, getAlias, getIdentifier, getIdentifier, getIdentifiers, getName, getName, getName, getProperties, getProperties, getRemarks, hashCode, nameMatches, nameMatches, nameMatches
 
Methods inherited from class FormattableObject
getDefaultIndentation, print, setDefaultIndentation, toString, toWKT, toWKT, toWKT
 
Methods inherited from class Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface IdentifiedObject
getAlias, getIdentifiers, getName, getRemarks, toWKT
 

Field Detail

sourceDimension

protected final Integer sourceDimension
Number of dimensions in the source CRS of this operation method. May be null if this method can work with any number of source dimensions (e.g. Affine Transform).


targetDimension

protected final Integer targetDimension
Number of dimensions in the target CRS of this operation method. May be null if this method can work with any number of target dimensions (e.g. Affine Transform).

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 Geotk 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,
                              Integer sourceDimension,
                              Integer targetDimension)
Constructs a new operation method with the same values than the specified one except the dimensions. The source and target dimensions may be null if this method can work with any number of dimensions (e.g. Affine Transform).

Parameters:
method - The operation method to copy.
sourceDimension - Number of dimensions in the source CRS of this operation method.
targetDimension - Number of dimensions in the target CRS of this operation method.

DefaultOperationMethod

public DefaultOperationMethod(Map<String,?> properties,
                              Integer sourceDimension,
                              Integer targetDimension,
                              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"   Formula, Citation or CharSequence   getFormula()

The source and target dimensions may be null if this method can work with any number of dimensions (e.g. Affine Transform).

Parameters:
properties - Set of properties. Should contains at least "name".
sourceDimension - Number of dimensions in the source CRS of this operation method.
targetDimension - Number of dimensions in the target CRS of this operation method.
parameters - The set of parameters, or null if none.
Method Detail

getFormula

public Formula 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

getSourceDimensions

public Integer getSourceDimensions()
Number of dimensions in the source CRS of this operation method. May be null if unknown, as in an Affine Transform.

Specified by:
getSourceDimensions in interface OperationMethod

getTargetDimensions

public Integer getTargetDimensions()
Number of dimensions in the target CRS of this operation method. May be null if unknown, as in an Affine Transform.

Specified by:
getTargetDimensions in interface OperationMethod

getParameters

public ParameterDescriptorGroup getParameters()
Returns the set of parameters.

Specified by:
getParameters in interface OperationMethod

equals

public boolean equals(Object object,
                      ComparisonMode mode)
Compares this operation method with the specified object for equality. If the mode argument value is STRICT or BY_CONTRACT, then all available properties are compared including the formula.

Specified by:
equals in interface LenientComparable
Overrides:
equals in class AbstractIdentifiedObject
Parameters:
object - The object to compare to this.
mode - STRICT for performing a strict comparison, or IGNORE_METADATA for comparing only properties relevant to transformations.
Returns:
true if both objects are equal.

computeHashCode

protected int computeHashCode()
Computes a hash value for this identified object. This method is invoked by AbstractIdentifiedObject.hashCode() when first needed.

Implementation specific feature
In the Geotk implementation, the name, identifiers and remarks are not used for hash code computation. Consequently two identified objects will return the same hash value if they are equal in the sense of equals(…, ComparisonMode.IGNORE_METADATA). This feature allows users to implement metadata-insensitive HashMap.

Overrides:
computeHashCode in class AbstractIdentifiedObject
Returns:
The hash code value. This value may change between different execution of the Geotk library.

formatWKT

public String formatWKT(Formatter formatter)
Formats the inner part of a Well Known Text (WKT) element.

Specified by:
formatWKT in interface Formattable
Overrides:
formatWKT in class FormattableObject
Parameters:
formatter - The formatter to use.
Returns:
The WKT element name.
See Also:
FormattableObject.toWKT(), FormattableObject.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, or null.
transform - The math transform to compare to the operation method, or null.
Throws:
MismatchedDimensionException - if the number of dimensions are incompatibles.
TODO:
The check for ConcatenatedTransform and PassThroughTransform works only for Geotk implementations.


Copyright © 2009-2011 Geotoolkit.org. All Rights Reserved.