public class DefaultConversion extends AbstractCoordinateOperation implements Conversion
This coordinate operation contains an operation method, usually with associated parameter values. In the SIS implementation, the parameter values can be either inferred from the math transform or explicitely provided at construction time in a defining conversion (see below).
OperationMethod
instances are generally created for a pair of existing source
and target CRS. But Conversion
instances without those information may exist
temporarily while creating a derived or
projected CRS.
Those defining conversions have no source and target CRS since those elements are provided by the
derived or projected CRS themselves. This class provides a constructor for such defining conversions.
After the source and target CRS become known, we can invoke the specialize(…)
method for
creating a math transform from the parameters,
instantiate a new Conversion
of a more specific type
(ConicProjection
,
CylindricalProjection
or
PlanarProjection
) if possible,
and assign the source and target CRS to it.
Conversion
instances created using only SIS factories and static constants can be shared
by many objects and passed between threads without synchronization.DefaultTransformation
,
Serialized FormDefined in the sis-referencing
module
DEPRECATED_KEY, LOCALE_KEY
COORDINATE_OPERATION_ACCURACY_KEY, DOMAIN_OF_VALIDITY_KEY, OPERATION_VERSION_KEY, SCOPE_KEY
ALIAS_KEY, IDENTIFIERS_KEY, NAME_KEY, REMARKS_KEY
Modifier | Constructor and Description |
---|---|
protected |
DefaultConversion(Conversion operation)
Creates a new coordinate operation with the same values than the specified one.
|
|
DefaultConversion(Map<String,?> properties,
CoordinateReferenceSystem sourceCRS,
CoordinateReferenceSystem targetCRS,
CoordinateReferenceSystem interpolationCRS,
OperationMethod method,
MathTransform transform)
Creates a coordinate conversion from the given properties.
|
|
DefaultConversion(Map<String,?> properties,
OperationMethod method,
MathTransform transform,
ParameterValueGroup parameters)
Creates a defining conversion from the given transform and/or parameters.
|
Modifier and Type | Method and Description |
---|---|
static DefaultConversion |
castOrCopy(Conversion object)
Returns a SIS coordinate operation implementation with the values of the given arbitrary implementation.
|
boolean |
equals(Object object,
ComparisonMode mode)
Compares this coordinate operation with the specified object for equality.
|
Class<? extends Conversion> |
getInterface()
Returns the GeoAPI interface implemented by this class.
|
OperationMethod |
getMethod()
Returns a description of the operation method, including a list of expected parameter names.
|
ParameterDescriptorGroup |
getParameterDescriptors()
Returns a description of the parameters.
|
ParameterValueGroup |
getParameterValues()
Returns the parameter values.
|
<T extends Conversion> |
specialize(Class<T> baseType,
CoordinateReferenceSystem sourceCRS,
CoordinateReferenceSystem targetCRS,
MathTransformFactory factory)
Returns a specialization of this conversion with a more specific type, source and target CRS.
|
castOrCopy, computeHashCode, formatTo, getCoordinateOperationAccuracy, getDomainOfValidity, getInterpolationCRS, getLinearAccuracy, getMathTransform, getOperationVersion, getScope, getSourceCRS, getTargetCRS, getWrapAroundChanges, isDefiningConversion
castOrCopy, equals, getAlias, getDescription, getIdentifiers, getName, getRemarks, hashCode, isDeprecated, isHeuristicMatchForName
print, toString, toString, toWKT
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getOperationVersion, getSourceCRS, getTargetCRS
getMethod, getParameterValues
getCoordinateOperationAccuracy, getDomainOfValidity, getMathTransform, getScope
getAlias, getIdentifiers, getName, getRemarks, toWKT
public DefaultConversion(Map<String,?> properties, CoordinateReferenceSystem sourceCRS, CoordinateReferenceSystem targetCRS, CoordinateReferenceSystem interpolationCRS, OperationMethod method, MathTransform transform)
Property name | Value type | Returned by |
---|---|---|
"name" | Identifier or String |
AbstractIdentifiedObject.getName() |
"identifiers" | Identifier (optionally as array) |
AbstractIdentifiedObject.getIdentifiers() |
"domainOfValidity" | Extent |
AbstractCoordinateOperation.getDomainOfValidity() |
sourceCRS
and targetCRS
should use the same datum. If the datum is not the same, then the coordinate operation
should probably be a transformation instead.
However Apache SIS does not enforce that condition, but we encourage users to follow it.
The reason why SIS is tolerant is because some gray areas may exist about whether an operation
should be considered as a conversion or a transformation.
DefaultConversion
instances
with different source and target datum, it does not accept to use such instances for
derived CRS construction.properties
- the properties to be given to the identified object.sourceCRS
- the source CRS.targetCRS
- the target CRS, which shall use a datum equals (ignoring metadata) to the source CRS datum.interpolationCRS
- the CRS of additional coordinates needed for the operation, or null
if none.method
- the coordinate operation method (mandatory in all cases).transform
- transform from positions in the source CRS to positions in the target CRS.public DefaultConversion(Map<String,?> properties, OperationMethod method, MathTransform transform, ParameterValueGroup parameters)
The properties
map given in argument follows the same rules than for the
above constructor.
transform
or parameters
argument must be non-null.
If the caller supplies a transform
argument, then it shall be a transform expecting
normalized input coordinates
and producing normalized output coordinates. See AxesConvention
for more information about what Apache SIS means by "normalized".
If the caller can not yet supply a MathTransform
, then (s)he shall supply the parameter values needed
for creating that transform, with the possible omission of "semi_major"
and "semi_minor"
values.
The semi-major and semi-minor parameter values will be set automatically when the
specialize(…)
method will be invoked.
If both the transform
and parameters
arguments are non-null, then the later should describes
the parameters used for creating the transform. Those parameters will be stored for information purpose and can
be given back by the getParameterValues()
method.
properties
- the properties to be given to the identified object.method
- the operation method.transform
- transform from positions in the source CRS to positions in the target CRS, or null
.parameters
- the transform
parameter values, or null
.DefaultMathTransformFactory.swapAndScaleAxes(MathTransform, DefaultMathTransformFactory.Context)
protected DefaultConversion(Conversion operation)
This constructor performs a shallow copy, i.e. the properties are not cloned.
operation
- the coordinate operation to copy.castOrCopy(Conversion)
public static DefaultConversion castOrCopy(Conversion object)
null
, then this method returns null
.Conversion
,
Projection
,
CylindricalProjection
,
ConicProjection
or
PlanarProjection
,
then this method delegates to the castOrCopy(…)
method of the corresponding SIS subclass.
Note that if the given object implements more than one of the above-cited interfaces,
then the castOrCopy(…)
method to be used is unspecified.DefaultConversion
, then it is returned unchanged.DefaultConversion
instance is created using the
copy constructor
and returned. Note that this is a shallow copy operation, since the other
properties contained in the given object are not recursively copied.object
- the object to get as a SIS implementation, or null
if none.null
if the argument was null.public Class<? extends Conversion> getInterface()
Conversion.class
.
Subclasses implementing a more specific GeoAPI interface shall override this method.getInterface
in class AbstractCoordinateOperation
public <T extends Conversion> T specialize(Class<T> baseType, CoordinateReferenceSystem sourceCRS, CoordinateReferenceSystem targetCRS, MathTransformFactory factory) throws FactoryException
specialize(…)
method is typically invoked on defining conversion instances,
when more information become available about the conversion to create.
The given baseType
argument can be one of the following values:
Conversion.class
Projection.class
CylindricalProjection.class
ConicProjection.class
PlanarProjection.class
specialize(…)
method returns a conversion which implement at least the given baseType
interface, but may also implement a more specific GeoAPI interface if specialize(…)
has been able
to infer the type from this operation method.T
- compile-time type of the baseType
argument.baseType
- the base GeoAPI interface to be implemented by the conversion to return.sourceCRS
- the source CRS.targetCRS
- the target CRS.factory
- the factory to use for creating a transform from the parameters or for performing axis changes.ClassCastException
- if a contradiction is found between the given baseType
,
the defining conversion type and
the method operation type.MismatchedDatumException
- if the given CRS do not use the same datum than the source and target CRS
of this conversion.FactoryException
- if the creation of a MathTransform
from the parameter values, or a change of axis order or units
failed.DefaultMathTransformFactory.createParameterizedTransform(ParameterValueGroup, DefaultMathTransformFactory.Context)
public OperationMethod getMethod()
getMethod
in interface SingleOperation
public ParameterDescriptorGroup getParameterDescriptors()
MathTransform
or from the OperationMethod
)
should be very similar. If they differ, it should be only in minor details like remarks, default
values or units of measurement.getParameterDescriptors
in interface Parameterized
DefaultOperationMethod.getParameters()
,
AbstractMathTransform.getParameterDescriptors()
public ParameterValueGroup getParameterValues()
UnsupportedImplementationException
.getParameterValues
in interface Parameterized
getParameterValues
in interface SingleOperation
UnsupportedOperationException
- if the parameter values can not be determined
for the current math transform implementation.AbstractMathTransform.getParameterValues()
public boolean equals(Object object, ComparisonMode mode)
mode
argument
is ComparisonMode.STRICT
or BY_CONTRACT
, then all available
properties are compared including the domain of validity and the
scope.equals
in interface LenientComparable
equals
in class AbstractCoordinateOperation
object
- the object to compare to this
.mode
- STRICT
for performing a strict comparison, or
IGNORE_METADATA
for ignoring properties
that do not make a difference in the numerical results of coordinate operations.true
if both objects are equal for the given comparison mode.AbstractIdentifiedObject.computeHashCode()
,
Utilities.deepEquals(Object, Object, ComparisonMode)
Copyright © 2010–2017 The Apache Software Foundation. All rights reserved.