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

class AbstractSingleOperation extends AbstractCoordinateOperation implements org.opengis.referencing.operation.SingleOperation, Parameterized
Shared implementation for 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 Details

  • 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 if AbstractSingleOperation 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 interface org.opengis.referencing.operation.SingleOperation
      Overrides:
      getMethod in class AbstractCoordinateOperation
      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 the 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.
      Specified by:
      getParameterDescriptors in interface Parameterized
      Overrides:
      getParameterDescriptors in class AbstractCoordinateOperation
      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:
      Specified by:
      getParameterValues in interface Parameterized
      Specified by:
      getParameterValues in interface org.opengis.referencing.operation.SingleOperation
      Overrides:
      getParameterValues in class AbstractCoordinateOperation
      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, after method has been initialized.

      If ignore is non-null, then parameters associated to Boolean.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 in definition such as OGC aliases (those information are often missing in method if the latter is not a MathTransformProvider). But on the other hand, definition may contain contextual parameters (ellipsoid semi-axis lengths) which are unknown to method and would cause an InvalidParameterValueException if we try to set them. We could replace method, but if the latter was created from EPSG database it also contains metadata not present in definition descriptor. The compromise applied in this method is to keep method as provided by user, also keep definition descriptor as supplied even if it is different than method 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, or null if none.
      ignore - parameters to hide when the associated value is Boolean.TRUE, or null for no filtering. This map may be modified in-place.
    • equals

      public boolean equals(Object object, ComparisonMode mode)
      Compares this coordinate operation with the specified object for equality. If the mode argument is ComparisonMode.STRICT or BY_CONTRACT, then all available properties are compared including the domain of validity and the scope.
      Specified by:
      equals in interface LenientComparable
      Overrides:
      equals in class AbstractCoordinateOperation
      Parameters:
      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.
      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 their ParameterValueGroup wrapper, because GML is defined that way. The ParameterValueGroup 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. See DefaultOperationMethod.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 a ParameterValueGroup, unless the given descriptors was already a ParameterValueGroup.
      See Also:
    • afterUnmarshal

      final void afterUnmarshal(Unmarshaller unmarshaller, Object parent)
      Overrides:
      afterUnmarshal in class AbstractCoordinateOperation
      See Also: