public class DefaultOperationMethod extends AbstractIdentifiedObject implements OperationMethod
OperationMethod
is a kind of metadata: it does not perform any coordinate operation (e.g. map projection) by itself, but
tells us what is needed in order to perform such operation.
The most important parts of an OperationMethod
are its name and its
group of parameter descriptors. The parameter descriptors do not contain
any value, but tell us what are the expected parameters, together with their units of measurement.
DefaultOperationMethod(MathTransform)
constructor can not infer them.OperationMethod
describes parameters without providing any value (except sometime default values).
When values have been assigned to parameters, the result is a SingleOperation
.
Note that there is different kinds of SingleOperation
depending on the nature and accuracy of the
coordinate operation. See getOperationType()
for more information.
The interface performing the actual work of taking coordinates in the
source CRS and calculating the new coordinates in the
target CRS is MathTransform
.
In order to allow Apache SIS to instantiate those MathTransform
s from given parameter values,
DefaultOperationMethod
subclasses should implement the
MathTransformProvider
interface.
MathTransformProvider
implementations to be used with
DefaultMathTransformFactory
.DefaultConversion
,
DefaultTransformation
,
MathTransformProvider
,
Serialized FormDefined in the sis-referencing
module
DEPRECATED_KEY, LOCALE_KEY
FORMULA_KEY
ALIAS_KEY, IDENTIFIERS_KEY, NAME_KEY, REMARKS_KEY
Modifier | Constructor and Description |
---|---|
|
DefaultOperationMethod(Map<String,?> properties,
Integer sourceDimensions,
Integer 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.
|
protected |
DefaultOperationMethod(OperationMethod method)
Creates a new operation method with the same values than the specified one.
|
Modifier and Type | Method and Description |
---|---|
static DefaultOperationMethod |
castOrCopy(OperationMethod object)
Returns a SIS operation method implementation with the same values than the given arbitrary implementation.
|
protected long |
computeHashCode()
Invoked by
hashCode() for computing the hash code when first needed. |
boolean |
equals(Object object,
ComparisonMode mode)
Compares this operation method with the specified object for equality.
|
protected String |
formatTo(Formatter formatter)
Formats this operation as a Well Known Text
Method[…] element. |
Formula |
getFormula()
Formula(s) or procedure used by this operation method.
|
Class<? extends OperationMethod> |
getInterface()
Returns the GeoAPI interface implemented by this class.
|
Class<? extends SingleOperation> |
getOperationType()
Returns the base interface of the
CoordinateOperation instances that use this 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.
|
OperationMethod |
redimension(int sourceDimensions,
int targetDimensions)
Returns this operation method with different dimensions, if we are allowed to change dimensionality.
|
static OperationMethod |
redimension(OperationMethod method,
int sourceDimensions,
int targetDimensions)
Returns an operation method with different dimensions, if we are allowed to change dimensionality.
|
castOrCopy, equals, getAlias, getDescription, getIdentifiers, getName, getRemarks, hashCode, isDeprecated, isHeuristicMatchForName
print, toString, toString, toWKT
getAlias, getIdentifiers, getName, getRemarks, toWKT
public DefaultOperationMethod(Map<String,?> properties, Integer sourceDimensions, Integer targetDimensions, ParameterDescriptorGroup parameters)
Property name | Value type | Returned by |
---|---|---|
"formula" | Formula , Citation or CharSequence |
getFormula() |
Defined in parent classes (reminder) | ||
"name" | Identifier or String |
AbstractIdentifiedObject.getName() |
"alias" | GenericName or CharSequence (optionally as array) |
AbstractIdentifiedObject.getAlias() |
"identifiers" | Identifier (optionally as array) |
AbstractIdentifiedObject.getIdentifiers() |
"remarks" | InternationalString or String |
AbstractIdentifiedObject.getRemarks() |
null
if this method can work
with any number of dimensions (e.g. Affine Transform).properties
- Set of properties. Shall contain at least "name"
.sourceDimensions
- Number of dimensions in the source CRS of this operation method, or null
.targetDimensions
- Number of dimensions in the target CRS of this operation method, or null
.parameters
- Description of parameters expected by this operation.public DefaultOperationMethod(MathTransform transform)
transform
- The math transform to describe.protected DefaultOperationMethod(OperationMethod method)
This constructor performs a shallow copy, i.e. the properties are not cloned.
method
- The operation method to copy.castOrCopy(OperationMethod)
public static DefaultOperationMethod castOrCopy(OperationMethod object)
null
, then null
is returned.
Otherwise if the given object is already a SIS implementation, then the given object is returned unchanged.
Otherwise a new SIS implementation is created and initialized to the attribute values of the given object.object
- The object to get as a SIS implementation, or null
if none.null
if the argument was null.public static OperationMethod redimension(OperationMethod method, int sourceDimensions, int targetDimensions)
OperationMethod
dimensionality may occur in two contexts:
MathTransform
instance has been created.
Example: Affine conversion.redimension(…)
implementation performs the following choice:
DefaultOperationMethod
, then delegate to
redimension(int, int)
in order to allow subclasses to defines their own policy.
For example the Molodensky method needs to override.null
, then
set that dimension to the given value in a new OperationMethod
.IllegalArgumentException
.method
- The operation method to redimension, or null
.sourceDimensions
- The desired number of input dimensions.targetDimensions
- The desired number of output dimensions.null
if the given method was null,
or method
if no change is needed.IllegalArgumentException
- if the given dimensions are illegal for the given operation method.public OperationMethod redimension(int sourceDimensions, int targetDimensions)
redimension(OperationMethod, int, int)
for more information.
The default implementation performs the following choice: for each dimension (source and target):
null
, then
set that dimension to the given value in a new OperationMethod
.IllegalArgumentException
.sourceDimensions
- The desired number of input dimensions.targetDimensions
- The desired number of output dimensions.this
if no change is needed.IllegalArgumentException
- if the given dimensions are illegal for this operation method.public Class<? extends OperationMethod> getInterface()
OperationMethod.class
.
OperationMethod
sub-interface. Overriding possibility is left mostly for implementors who wish to extend GeoAPI with their
own set of interfaces.getInterface
in class AbstractIdentifiedObject
OperationMethod.class
or a user-defined sub-interface.public Class<? extends SingleOperation> getOperationType()
CoordinateOperation
instances that use this method.
The base CoordinateOperation
interface is usually one of the following subtypes:
Transformation
if the coordinate operation has some errors (typically of a few metres) because of the empirical process by
which the operation parameters were determined. Those errors do not depend on the floating point precision
or the accuracy of the implementation algorithm.Conversion
if the coordinate operation is theoretically of infinite precision, ignoring the limitations of floating
point arithmetic (including rounding errors) and the approximations implied by finite series expansions.Projection
if the coordinate operation is a conversion (as defined above) converting geodetic latitudes and longitudes
to plane (map) coordinates. This type can optionally be refined with one of the
CylindricalProjection
,
ConicProjection
or
PlanarProjection
subtypes.getOperationType()
can conservatively return the base type.
The default implementation returns SingleOperation.class
,
which is the most conservative return value.DefaultMathTransformFactory.getAvailableMethods(Class)
public Formula getFormula()
getFormula
in interface OperationMethod
null
if unknown.DefaultFormula
,
MathTransformProvider
public Integer getSourceDimensions()
getSourceDimensions
in interface OperationMethod
null
if unknown.AbstractMathTransform.getSourceDimensions()
public Integer getTargetDimensions()
getTargetDimensions
in interface OperationMethod
null
if unknown.AbstractMathTransform.getTargetDimensions()
public ParameterDescriptorGroup getParameters()
DefaultOperationMethod(MathTransform)
constructor has been unable to infer it
or if this OperationMethod
has been read from an incomplete GML document.getParameters
in interface OperationMethod
null
if unknown.AbstractSingleOperation.getParameterDescriptors()
,
AbstractSingleOperation.getParameterValues()
public boolean equals(Object object, ComparisonMode mode)
mode
argument value is STRICT
or
BY_CONTRACT
, then all available properties
are compared including the formula.equals
in interface LenientComparable
equals
in class AbstractIdentifiedObject
object
- The object to compare to this
.mode
- STRICT
for performing a strict comparison, or
IGNORE_METADATA
for comparing only properties
relevant to transformations.true
if both objects are equal.AbstractIdentifiedObject.computeHashCode()
,
Utilities.deepEquals(Object, Object, ComparisonMode)
protected long computeHashCode()
hashCode()
for computing the hash code when first needed.
See AbstractIdentifiedObject.computeHashCode()
for more information.computeHashCode
in class AbstractIdentifiedObject
protected String formatTo(Formatter formatter)
Method[…]
element.formatTo
in class AbstractIdentifiedObject
formatter
- The formatter where to format the inner content of this WKT element."Method"
(WKT 2) or "Projection"
(WKT 1).Copyright © 2010–2015 The Apache Software Foundation. All rights reserved.