Class AbstractSingleOperation
- All Implemented Interfaces:
Serializable
,Formattable
,Parameterized
,Deprecable
,LenientComparable
,org.opengis.referencing.IdentifiedObject
,org.opengis.referencing.operation.CoordinateOperation
,org.opengis.referencing.operation.SingleOperation
- Direct Known Subclasses:
DefaultConversion
,DefaultTransformation
DefaultConversion
and DefaultTransformation
.
Does not need to be public, as users should handle only conversions or transformations.
Note: this class is not strictly equivalent to <gml:AbstractSingleOperationType>
because the GML schema does not define the method and parameters in this base class. Instead, they
repeat those two elements in the <gml:Conversion>
and <gml:Transformation>
subtypes.
Another difference is that SIS does not use AbstractSingleOperation
as the base class of
DefaultPassThroughOperation
.
- Since:
- 0.6
- Version:
- 1.3
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate org.opengis.referencing.operation.OperationMethod
The operation method.(package private) org.opengis.parameter.ParameterValueGroup
The parameter values, ornull
for inferring it from the math transform.private static final long
Serial number for inter-operability with different versions.Fields inherited from class org.apache.sis.referencing.operation.AbstractCoordinateOperation
coordinateOperationAccuracy, domainOfValidity, sourceCRS, targetCRS, transform
Fields inherited from class org.apache.sis.referencing.AbstractIdentifiedObject
DEPRECATED_KEY, LOCALE_KEY
Fields inherited from interface org.opengis.referencing.operation.CoordinateOperation
COORDINATE_OPERATION_ACCURACY_KEY, DOMAIN_OF_VALIDITY_KEY, OPERATION_VERSION_KEY, SCOPE_KEY
Fields inherited from interface org.opengis.referencing.IdentifiedObject
ALIAS_KEY, IDENTIFIERS_KEY, NAME_KEY, REMARKS_KEY
-
Constructor Summary
ConstructorsModifierConstructorDescription(package private)
Constructs a new object in which every attributes are set to a null value.AbstractSingleOperation
(Map<String, ?> properties, org.opengis.referencing.crs.CoordinateReferenceSystem sourceCRS, org.opengis.referencing.crs.CoordinateReferenceSystem targetCRS, org.opengis.referencing.crs.CoordinateReferenceSystem interpolationCRS, org.opengis.referencing.operation.OperationMethod method, org.opengis.referencing.operation.MathTransform transform) Creates a coordinate operation from the given properties.(package private)
AbstractSingleOperation
(Map<String, ?> properties, org.opengis.referencing.operation.OperationMethod method) Creates a new coordinate operation initialized from the given properties.protected
AbstractSingleOperation
(org.opengis.referencing.operation.SingleOperation operation) Creates a new coordinate operation with the same values than the specified one. -
Method Summary
Modifier and TypeMethodDescription(package private) final void
afterUnmarshal
(Unmarshaller unmarshaller, Object parent) Invoked by JAXB after unmarshalling.boolean
equals
(Object object, ComparisonMode mode) Compares this coordinate operation with the specified object for equality.org.opengis.referencing.operation.OperationMethod
Returns a description of the operation method, including a list of expected parameter names.org.opengis.parameter.ParameterDescriptorGroup
Returns a description of the parameters.private org.opengis.parameter.GeneralParameterValue[]
Invoked by JAXB for getting the parameters to marshal.org.opengis.parameter.ParameterValueGroup
Returns the parameter values.private void
setMethod
(org.opengis.referencing.operation.OperationMethod value) Invoked by JAXB at unmarshalling time.private void
setParameters
(org.opengis.parameter.GeneralParameterValue[] values) Invoked by JAXB for setting the unmarshalled parameters.(package private) final void
setParameterValues
(org.opengis.parameter.ParameterValueGroup definition, Map<String, Boolean> ignore) Sets the parameter values to a copy of given parameters, making sure that the parameters are compatible with the ones expected by the operation method.Methods inherited from class org.apache.sis.referencing.operation.AbstractCoordinateOperation
castOrCopy, checkDimensions, computeHashCode, computeTransientFields, formatTo, getCoordinateOperationAccuracy, getDomainOfValidity, getInterface, getInterpolationCRS, getInterpolationCRS, getLinearAccuracy, getMathTransform, getOperationVersion, getParameterDescriptors, getScope, getSourceCRS, getTargetCRS, getWrapAroundChanges, isDefiningConversion
Methods inherited from class org.apache.sis.referencing.AbstractIdentifiedObject
castOrCopy, equals, formatTo, getAlias, getDescription, getIdentifiers, getName, getRemarks, hashCode, isDeprecated, isHeuristicMatchForName
Methods inherited from class org.apache.sis.io.wkt.FormattableObject
print, toString, toString, toWKT
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.opengis.referencing.operation.CoordinateOperation
getCoordinateOperationAccuracy, getDomainOfValidity, getMathTransform, getOperationVersion, getScope, getSourceCRS, getTargetCRS
Methods inherited from interface org.opengis.referencing.IdentifiedObject
getAlias, getIdentifiers, getName, getRemarks, toWKT
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDSerial number for inter-operability with different versions.- See Also:
-
method
private org.opengis.referencing.operation.OperationMethod methodThe operation method.Consider this field as final! This field is modified only at unmarshalling time by
setMethod(OperationMethod)
.- See Also:
-
parameters
org.opengis.parameter.ParameterValueGroup parametersThe parameter values, ornull
for inferring it from the math transform.Consider this field as final! This field is non-final only for the convenience of constructors and for initialization at XML unmarshalling time by
setParameters(GeneralParameterValue[])
.- See Also:
-
-
Constructor Details
-
AbstractSingleOperation
public AbstractSingleOperation(Map<String, ?> properties, org.opengis.referencing.crs.CoordinateReferenceSystem sourceCRS, org.opengis.referencing.crs.CoordinateReferenceSystem targetCRS, org.opengis.referencing.crs.CoordinateReferenceSystem interpolationCRS, org.opengis.referencing.operation.OperationMethod method, org.opengis.referencing.operation.MathTransform transform) Creates a coordinate operation from the given properties. This constructor would be public ifAbstractSingleOperation
was public. -
AbstractSingleOperation
AbstractSingleOperation(Map<String, ?> properties, org.opengis.referencing.operation.OperationMethod method) Creates a new coordinate operation initialized from the given properties. It is caller's responsibility to set the following fields: -
AbstractSingleOperation
protected AbstractSingleOperation(org.opengis.referencing.operation.SingleOperation operation) Creates a new coordinate operation with the same values than the specified one. This copy constructor provides a way to convert an arbitrary implementation into a SIS 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:
operation
- the coordinate operation to copy.
-
AbstractSingleOperation
AbstractSingleOperation()Constructs a new object in which every attributes are set to a null value. This is not a valid object. This constructor is strictly reserved to JAXB, which will assign values to the fields using reflection.
-
-
Method Details
-
getMethod
public org.opengis.referencing.operation.OperationMethod getMethod()Returns a description of the operation method, including a list of expected parameter names. The returned object does not contains any parameter value.- Specified by:
getMethod
in interfaceorg.opengis.referencing.operation.SingleOperation
- Overrides:
getMethod
in classAbstractCoordinateOperation
- Returns:
- a description of the operation method.
-
getParameterDescriptors
public org.opengis.parameter.ParameterDescriptorGroup getParameterDescriptors()Returns a description of the parameters. The default implementation performs the following choice:- If parameter values were specified explicitly at construction time, then the descriptor of those parameters is returned.
- Otherwise if this method can infer the parameter descriptor from the math transform, then that descriptor is returned.
- Otherwise fallback on the method parameters.
Note: the two parameter descriptions (from theMathTransform
or from theOperationMethod
) should be very similar. If they differ, it should be only in minor details like remarks, default values or units of measurement.- Specified by:
getParameterDescriptors
in interfaceParameterized
- Overrides:
getParameterDescriptors
in classAbstractCoordinateOperation
- Returns:
- a description of the parameters.
- See Also:
-
getParameterValues
public org.opengis.parameter.ParameterValueGroup getParameterValues()Returns the parameter values. The default implementation performs the following choice:- If parameter values were specified explicitly at construction time, then they are returned as an unmodifiable parameter group.
- Otherwise if this method can infer the parameter values from the math transform, then those parameters are returned.
- Otherwise throw
UnsupportedImplementationException
.
- Specified by:
getParameterValues
in interfaceParameterized
- Specified by:
getParameterValues
in interfaceorg.opengis.referencing.operation.SingleOperation
- Overrides:
getParameterValues
in classAbstractCoordinateOperation
- Returns:
- the parameter values.
- Throws:
UnsupportedOperationException
- if the parameter values cannot be determined for the current math transform implementation.- See Also:
-
setParameterValues
final void setParameterValues(org.opengis.parameter.ParameterValueGroup definition, Map<String, Boolean> ignore) Sets the parameter values to a copy of given parameters, making sure that the parameters are compatible with the ones expected by the operation method. This method should be invoked by constructors only, aftermethod
has been initialized.If
ignore
is non-null, then parameters associated toBoolean.TRUE
may be hidden. This situation happens when this operation has been initialized from a defining conversion and the caller refined the parameters using information provided by the math transform factory. On one hand, we want to take advantage of additional information present indefinition
such as OGC aliases (those information are often missing inmethod
if the latter is not aMathTransformProvider
). But on the other hand,definition
may contain contextual parameters (ellipsoid semi-axis lengths) which are unknown tomethod
and would cause anInvalidParameterValueException
if we try to set them. We could replacemethod
, but if the latter was created from EPSG database it also contains metadata not present indefinition
descriptor. The compromise applied in this method is to keepmethod
as provided by user, also keepdefinition
descriptor as supplied even if it is different thanmethod
descriptor, but hide (not remove) parameters that are known to be redundant with information that can be inferred from the context.- Parameters:
definition
- the parameter to set, ornull
if none.ignore
- parameters to hide when the associated value isBoolean.TRUE
, ornull
for no filtering. This map may be modified in-place.
-
equals
Compares this coordinate operation with the specified object for equality. If themode
argument isComparisonMode.STRICT
orBY_CONTRACT
, then all available properties are compared including the domain of validity and the scope.- Specified by:
equals
in interfaceLenientComparable
- Overrides:
equals
in classAbstractCoordinateOperation
- Parameters:
object
- the object to compare tothis
.mode
-STRICT
for performing a strict comparison, orIGNORE_METADATA
for ignoring properties that do not make a difference in the numerical results of coordinate operations.- Returns:
true
if both objects are equal for the given comparison mode.- See Also:
-
setMethod
private void setMethod(org.opengis.referencing.operation.OperationMethod value) Invoked by JAXB at unmarshalling time.- See Also:
-
getParameters
private org.opengis.parameter.GeneralParameterValue[] getParameters()Invoked by JAXB for getting the parameters to marshal. This method usually marshals the sequence of parameters without theirParameterValueGroup
wrapper, because GML is defined that way. TheParameterValueGroup
wrapper is a GeoAPI addition done for allowing usage of its methods as a convenience (e.g.ParameterValueGroup.parameter(String)
).However, it could happen that the user really wanted to specify a
ParameterValueGroup
as the sole<gml:parameterValue>
element. We currently have no easy way to distinguish those cases. SeeDefaultOperationMethod.getDescriptors()
for more discussion.- See Also:
-
setParameters
private void setParameters(org.opengis.parameter.GeneralParameterValue[] values) Invoked by JAXB for setting the unmarshalled parameters. This method wraps the given parameters in aParameterValueGroup
, unless the given descriptors was already aParameterValueGroup
.- See Also:
-
afterUnmarshal
Invoked by JAXB after unmarshalling. This method needs information provided by:- Overrides:
afterUnmarshal
in classAbstractCoordinateOperation
- See Also:
-