Class ParameterizedAffine

All Implemented Interfaces:
Serializable, Cloneable, LinearTransform2D, Parameterized, LinearTransform, LenientComparable, org.opengis.referencing.operation.MathTransform, org.opengis.referencing.operation.MathTransform2D

public final class ParameterizedAffine extends AffineTransform2D
An affine transform that remember the parameters used for its construction. Those parameters may be very different than the usual affine transform parameters. For example, an Equirectangular projection can be expressed as an affine transform. In such case, the same affine transform can be described by two equivalent set of parameters:
  • The "elt_0_0", "elt_0_1", etc. parameters inherited from the parent class.
  • The "semi_major", "semi_minor", etc. parameters which, when used with the Equirectangular operation method, produced this affine transform.
This ParameterizedAffine class can be used when we want to describe this affine transform by the Equirectangular set of parameters instead of the generic Affine set of parameters. In such case, we must give a reference to an object able to provide those parameters.
Since:
0.6
Version:
0.6
See Also:
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      For cross-version compatibility.
      See Also:
    • parameters

      private final org.opengis.parameter.ParameterValueGroup parameters
      The (presumed immutable) parameters used for creating this transform.
    • isDefinitive

      private final boolean isDefinitive
      true if parameters provides an accurate description of this transform, or false if this transform may be different than the one described by the parameters. This field may be false for example after an Equirectangular projection has been concatenated with other affine transforms for unit conversions, axis swapping, etc.
  • Constructor Details

    • ParameterizedAffine

      public ParameterizedAffine(AffineTransform transform, org.opengis.parameter.ParameterValueGroup parameters, boolean isDefinitive)
      Creates a new transform from the given affine and parameters.
      Parameters:
      transform - the affine transform to copy.
      parameters - the parameters to remember. It is caller's responsibility to provide an immutable instance.
      isDefinitive - true if parameters provides an accurate description of transform, or false if the transform may be different than the one described by parameters.
  • Method Details

    • newTransform

      public org.opengis.referencing.operation.MathTransform newTransform(org.opengis.referencing.operation.MathTransform transform)
      Returns the given transform associated to the same parameters than this ParameterizedAffine, if possible. If the given transform is not affine, then it is returned unchanged.
      Parameters:
      transform - the transform to be at least partially described by parameters.
      Returns:
      a copy of the given affine transform associated to the parameter of this object, or the given transform unchanged if it was not affine.
    • getParameterDescriptors

      public org.opengis.parameter.ParameterDescriptorGroup getParameterDescriptors()
      Returns the parameter descriptors for this map projection.
      Specified by:
      getParameterDescriptors in interface Parameterized
      Overrides:
      getParameterDescriptors in class AffineTransform2D
      Returns:
      the map projection parameters if they are an accurate description of this transform, or the generic affine parameters in case of doubt.
    • getParameterValues

      public org.opengis.parameter.ParameterValueGroup getParameterValues()
      Returns the parameter values for this map projection.

      Hack: this method normally returns the matrix parameters in case of doubt. However, if Semaphores.ENCLOSED_IN_OPERATION is set, then this method returns the map projection parameters even if they are not a complete description of this math transform. This internal hack shall be used only by AbstractCoordinateOperation.

      Use case of above hack: consider an "Equidistant Cylindrical (Spherical)" map projection from a GeographiCRS base using (latitude, longitude) axis order. We need to concatenate an affine transform performing the axis swapping before the actual map projection. The concatenated transform is part of SingleOperation, which is itself part of ProjecteCRS. Consequently, we have two conflicting needs:

      • If this method is queried from a SingleOperation instance (usually indirectly as part of a ProjectedCRS), then we want to return the "Equidistant Cylindrical (Spherical)" map projection parameters without bothering about axis swapping, because the latter is described by the Axis["…"] elements in the enclosing ProjectedCRS instance.
      • But if this MathTransform is formatted directly (not as a component of ProjectedCRS), then we want to format it as a matrix, otherwise the users would have no way to see that an axis swapping has been applied.
      The Semaphores.ENCLOSED_IN_OPERATION flag is SIS internal mechanism for distinguish the two above-cited cases.
      Specified by:
      getParameterValues in interface Parameterized
      Overrides:
      getParameterValues in class AffineTransform2D
      Returns:
      the map projection parameters if they are an accurate description of this transform, or the generic affine parameters in case of doubt.
    • equals

      public boolean equals(Object object)
      Compares this affine transform with the given object for equality. Parameters are compared only if the other object is also an instance of ParameterizedAffine in order to preserve the AffineTransform.equals(Object) symmetricity contract.
      Specified by:
      equals in interface LenientComparable
      Overrides:
      equals in class AffineTransform2D
      Parameters:
      object - the object to compare with this transform for equality.
      Returns:
      true if the given object is of appropriate class (as explained in the AffineTransform2D.equals(Object) documentation) and the coefficients are the same.
      See Also: