# Class DefaultMathTransformFactory.Context

Object
Context

All Implemented Interfaces:
  `Serializable`, `MathTransformProvider​.Context`

Enclosing class:
  `DefaultMathTransformFactory`

@Deprecated(since="1.5", forRemoval=true) public static class DefaultMathTransformFactory.Context extends Object implements MathTransformProvider.Context, Serializable
Deprecated, for removal: This API element is subject to removal in a future version.
Replaced by `DefaultMathTransformFactory​.builder(String)`.
Source and target coordinate systems for which a new parameterized transform is going to be used.

Since:
  0.7
See Also:
  - Serialized Form

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `Context()`
  Deprecated, for removal: This API element is subject to removal in a future version.
  Creates a new context with all properties initialized to `null`.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `ParameterValueGroup`
  `getCompletedParameters()`
  Deprecated, for removal: This API element is subject to removal in a future version.
  Replaced by `MathTransformProvider​.Context​.getCompletedParameters()`.
  `Map<String,Boolean>`
  `getContextualParameters()`
  Deprecated, for removal: This API element is subject to removal in a future version.
  Replaced by `MathTransformProvider​.Context​.getContextualParameters()`.
  `Matrix`
  `getMatrix(ContextualParameters​.MatrixRole role)`
  Deprecated, for removal: This API element is subject to removal in a future version.
  Returns the matrix that represent the affine transform to concatenate before or after the parameterized transform.
  `OperationMethod`
  `getMethodUsed()`
  Deprecated, for removal: This API element is subject to removal in a future version.
  Replaced by `MathTransformBuilder​.getMethod()`.
  `CoordinateSystem`
  `getSourceCS()`
  Deprecated, for removal: This API element is subject to removal in a future version.
  Returns the source coordinate system, or `null` if unspecified.
  `Ellipsoid`
  `getSourceEllipsoid()`
  Deprecated, for removal: This API element is subject to removal in a future version.
  Returns the ellipsoid used together with the source coordinate system, or `null` if none.
  `CoordinateSystem`
  `getTargetCS()`
  Deprecated, for removal: This API element is subject to removal in a future version.
  Returns the target coordinate system, or `null` if unspecified.
  `Ellipsoid`
  `getTargetEllipsoid()`
  Deprecated, for removal: This API element is subject to removal in a future version.
  Returns the ellipsoid used together with the target coordinate system, or `null` if none.
  `void`
  `setSource(GeodeticCRS crs)`
  Deprecated, for removal: This API element is subject to removal in a future version.
  Replaced by `MathTransformBuilder​.setSourceAxes(CoordinateSystem, Ellipsoid)`.
  `void`
  `setSource(CoordinateSystem cs)`
  Deprecated, for removal: This API element is subject to removal in a future version.
  Replaced by `MathTransformBuilder​.setSourceAxes(CoordinateSystem, Ellipsoid)`.
  `void`
  `setTarget(GeodeticCRS crs)`
  Deprecated, for removal: This API element is subject to removal in a future version.
  Replaced by `MathTransformBuilder​.setTargetAxes(CoordinateSystem, Ellipsoid)`.
  `void`
  `setTarget(CoordinateSystem cs)`
  Deprecated, for removal: This API element is subject to removal in a future version.
  Replaced by `MathTransformBuilder​.setTargetAxes(CoordinateSystem, Ellipsoid)`.
  `String`
  `toString()`
  Deprecated, for removal: This API element is subject to removal in a future version.
  Returns a string representation of this context for debugging purposes.

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

  ### Methods inherited from interface MathTransformProvider.Context

  `getFactory, getSourceCSType, getSourceDimensions, getTargetCSType, getTargetDimensions`

- ## Constructor Details

  - ### Context

    public Context()
    Deprecated, for removal: This API element is subject to removal in a future version.
    Creates a new context with all properties initialized to `null`.

- ## Method Details

  - ### setSource

    @Deprecated(since="1.5", forRemoval=true) public void setSource(CoordinateSystem cs)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Replaced by `MathTransformBuilder​.setSourceAxes(CoordinateSystem, Ellipsoid)`.
    Sets the source coordinate system to the given value. The source ellipsoid is unconditionally set to `null`.
    Parameters:
      `cs` - the coordinate system to set as the source (can be `null`).

  - ### setSource

    @Deprecated(since="1.5", forRemoval=true) public void setSource(GeodeticCRS crs)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Replaced by `MathTransformBuilder​.setSourceAxes(CoordinateSystem, Ellipsoid)`.
    Sets the source coordinate system and related ellipsoid to the components of given CRS. The `Ellipsoid`, fetched from the geodetic reference frame, is often used together with an `EllipsoidalCS`, but not necessarily. The geodetic CRS may also be associated with a spherical or Cartesian coordinate system, and the ellipsoid information may still be needed even with those non-ellipsoidal coordinate systems.

    This method is not for datum shifts. All datum information other than the ellipsoid are ignored.

    Parameters:
      `crs` - the coordinate system and ellipsoid to set as the source, or `null`.
    Since:
      1.3

  - ### setTarget

    @Deprecated(since="1.5", forRemoval=true) public void setTarget(CoordinateSystem cs)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Replaced by `MathTransformBuilder​.setTargetAxes(CoordinateSystem, Ellipsoid)`.
    Sets the target coordinate system to the given value. The target ellipsoid is unconditionally set to `null`.
    Parameters:
      `cs` - the coordinate system to set as the target (can be `null`).

  - ### setTarget

    @Deprecated(since="1.5", forRemoval=true) public void setTarget(GeodeticCRS crs)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Replaced by `MathTransformBuilder​.setTargetAxes(CoordinateSystem, Ellipsoid)`.
    Sets the target coordinate system and related ellipsoid to the components of given CRS. The `Ellipsoid`, fetched from the geodetic reference frame, is often used together with an `EllipsoidalCS`, but not necessarily. The geodetic CRS may also be associated with a spherical or Cartesian coordinate system, and the ellipsoid information may still be needed even with those non-ellipsoidal coordinate systems.

    This method is not for datum shifts. All datum information other than the ellipsoid are ignored.

    Parameters:
      `crs` - the coordinate system and ellipsoid to set as the target, or `null`.
    Since:
      1.3

  - ### getSourceCS

    public CoordinateSystem getSourceCS()
    Deprecated, for removal: This API element is subject to removal in a future version.
    Returns the source coordinate system, or `null` if unspecified.
    Returns:
      the source coordinate system, or `null`.

  - ### getSourceEllipsoid

    public Ellipsoid getSourceEllipsoid()
    Deprecated, for removal: This API element is subject to removal in a future version.
    Returns the ellipsoid used together with the source coordinate system, or `null` if none.
    Returns:
      the ellipsoid used together with the source coordinate system, or `null` if none.

  - ### getTargetCS

    public CoordinateSystem getTargetCS()
    Deprecated, for removal: This API element is subject to removal in a future version.
    Returns the target coordinate system, or `null` if unspecified.
    Returns:
      the target coordinate system, or `null`.

  - ### getTargetEllipsoid

    public Ellipsoid getTargetEllipsoid()
    Deprecated, for removal: This API element is subject to removal in a future version.
    Returns the ellipsoid used together with the target coordinate system, or `null` if none.
    Returns:
      the ellipsoid used together with the target coordinate system, or `null` if none.

  - ### getMatrix

    public Matrix getMatrix(ContextualParameters.MatrixRole role) throws FactoryException
    Deprecated, for removal: This API element is subject to removal in a future version.
    Returns the matrix that represent the affine transform to concatenate before or after the parameterized transform. The `role` argument specifies which matrix is desired:
    - `NORMALIZATION` for the conversion from the source coordinate system to a
      invalid reference

          normalized

      coordinate system, usually with (longitude, latitude) axis order in degrees or (easting, northing) in metres. This normalization needs to be applied before the parameterized transform.
    - `DENORMALIZATION` for the conversion from a normalized coordinate system to the target coordinate system, for example with (latitude, longitude) axis order. This denormalization needs to be applied after the parameterized transform.
    - `INVERSE_NORMALIZATION` and `INVERSE_DENORMALIZATION` are also supported but rarely used.
    This method is invoked by `DefaultMathTransformFactory​.swapAndScaleAxes(MathTransform, Context)`. Users can override this method if they need to customize the normalization process.
    Parameters:
      `role` - whether the normalization or denormalization matrix is desired.
    Returns:
      the requested matrix, or `null` if this `Context` has no information about the coordinate system.
    Throws:
      `FactoryException` - if an error occurred while computing the matrix.
    See Also:
      - `DefaultMathTransformFactory​.createAffineTransform(Matrix)`
      - `DefaultMathTransformFactory​.createParameterizedTransform(ParameterValueGroup, Context)`

  - ### getMethodUsed

    @Deprecated(since="1.5", forRemoval=true) public OperationMethod getMethodUsed()
    Deprecated, for removal: This API element is subject to removal in a future version.
    Replaced by `MathTransformBuilder​.getMethod()`.
    Returns the operation method used for the math transform creation. This is the same information as `DefaultMathTransformFactory​.getLastMethodUsed()` but more stable (not affected by transforms created with other contexts).
    Returns:
      the operation method used by the factory.
    Throws:
      `IllegalStateException` - if `DefaultMathTransformFactory​.createParameterizedTransform(ParameterValueGroup, Context)` has not yet been invoked.
    Since:
      1.3

  - ### getContextualParameters

    @Deprecated(since="1.5", forRemoval=true) public Map<String,Boolean> getContextualParameters()
    Deprecated, for removal: This API element is subject to removal in a future version.
    Replaced by `MathTransformProvider​.Context​.getContextualParameters()`.
    Returns the names of parameters that have been inferred from the context. The set of keys can contain any of `"dim"`, `"semi_major"`, `"semi_minor"`, `"src_semi_major"`, `"src_semi_minor"`, `"tgt_semi_major"`, `"tgt_semi_minor"` and/or `"inverse_flattening"`, depending on the operation method used. The parameters named in that set are included in the parameters returned by `getCompletedParameters()`.

    #### Associated Boolean values

    The associated Boolean in the map tells whether the named parameter value is really contextual. The Boolean is `FALSE` if the user explicitly specified a value in the parameters given to the `DefaultMathTransformFactory​.createParameterizedTransform(ParameterValueGroup, Context)` method, and that value is different than the value inferred from the context. Such inconsistencies are also logged at `Level​.WARNING`. In all other cases (no value specified by the user, or a value was specified but is consistent with the context), the associated Boolean in the map is `TRUE`.
    Specified by:
      `getContextualParameters` in interface `MathTransformProvider​.Context`
    Returns:
      names of parameters inferred from context.
    Since:
      1.3

  - ### getCompletedParameters

    @Deprecated(since="1.5", forRemoval=true) public ParameterValueGroup getCompletedParameters()
    Deprecated, for removal: This API element is subject to removal in a future version.
    Replaced by `MathTransformProvider​.Context​.getCompletedParameters()`.
    Returns the parameter values used for the math transform creation, including the parameters completed by the factory. This is the union of `parameters` with `getContextualParameters()`. The completed parameters may only have additional parameters compared to the user-supplied parameters. Parameter values that were explicitly set by the user are not overwritten.

    After this method has been invoked, the

    invalid reference

        setSourceAxes(…)

    and
    invalid reference

        setTargetAxes(…)

    methods can no longer be invoked.
    Specified by:
      `getCompletedParameters` in interface `MathTransformProvider​.Context`
    Returns:
      the parameter values used by the factory.

  - ### toString

    public String toString()
    Deprecated, for removal: This API element is subject to removal in a future version.
    Returns a string representation of this context for debugging purposes. The current implementation writes the name of source/target coordinate systems and ellipsoids. If the contextual parameters have already been inferred, then their names are appended with inconsistent parameters (if any) written on a separated line.
    Overrides:
      `toString` in class `Object`
    Returns:
      a string representation of this context.