Class DefaultMathTransformFactory.Context
Object
Context
- All Implemented Interfaces:
- Serializable
- Enclosing class:
- DefaultMathTransformFactory
Source and target coordinate systems for which a new parameterized transform is going to be used.
 
DefaultMathTransformFactory uses this information for:
 - Completing some parameters if they were not provided. In particular, the source ellipsoid can be used for providing values for the "semi_major"and"semi_minor"parameters in map projections.
- Swapping and scaling axes if the source or the target coordinate systems are not normalized.
OperationMethod,
 for example "Longitude rotation" (EPSG:9601) for changing the prime meridian.
 Scope
Instances of this class should be short-lived (they exist only the time needed for creating aMathTransform)
 and should not be shared (because they provide no immutability guarantees).
 This class is not thread-safe.- Since:
- 0.7
- See Also:
Defined in the sis-referencing module
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionReturns the parameter values used for the math transform creation, including the parameters completed by the factory.Returns the names of parameters that have been inferred from the context.Returns the matrix that represent the affine transform to concatenate before or after the parameterized transform.Returns the operation method used for the math transform creation.Returns the source coordinate system, ornullif unspecified.Returns the ellipsoid of the source ellipsoidal coordinate system, ornullif it does not apply.Returns the target coordinate system, ornullif unspecified.Returns the ellipsoid of the target ellipsoidal coordinate system, ornullif it does not apply.voidsetSource(GeodeticCRS crs) Sets the source coordinate system and related ellipsoid to the components of given CRS.voidSets the source coordinate system to the given value.voidsetSource(EllipsoidalCS cs, Ellipsoid ellipsoid) Deprecated.voidsetTarget(GeodeticCRS crs) Sets the target coordinate system and related ellipsoid to the components of given CRS.voidSets the target coordinate system to the given value.voidsetTarget(EllipsoidalCS cs, Ellipsoid ellipsoid) Deprecated.Replaced bysetTarget(GeodeticCRS).Returns a string representation of this context for debugging purposes.
- 
Constructor Details- 
Contextpublic Context()Creates a new context with all properties initialized tonull.
 
- 
- 
Method Details- 
setSourceSets the source coordinate system to the given value. The source ellipsoid is unconditionally set tonull.- Parameters:
- cs- the coordinate system to set as the source (can be- null).
 
- 
setSourceDeprecated.Replaced bysetSource(GeodeticCRS).Sets the source coordinate system and its associated ellipsoid to the given value.Design note: ellipsoidal coordinate systems and ellipsoids are associated indirectly, through a geodetic CRS. However, this method expects those two components to be given explicitly instead of inferring them from aCoordinateReferenceSystemfor making clear thatMathTransformFactorydoes not perform any geodetic datum analysis. For coordinate operations that take datum changes in account (including change of prime meridian), seeDefaultCoordinateOperationFactory. This policy helps to enforce a separation of concerns.- Parameters:
- cs- the coordinate system to set as the source, or- null.
- ellipsoid- the ellipsoid associated to the given coordinate system, or- null.
 
- 
setSourceSets the source coordinate system and related ellipsoid to the components of given CRS. TheEllipsoid, fetched from the geodetic datum, is often used together with anEllipsoidalCS, 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
 
- 
setTargetSets the target coordinate system to the given value. The target ellipsoid is unconditionally set tonull.- Parameters:
- cs- the coordinate system to set as the target (can be- null).
 
- 
setTargetDeprecated.Replaced bysetTarget(GeodeticCRS).Sets the target coordinate system and its associated ellipsoid to the given value.Design note: seesetSource(EllipsoidalCS, Ellipsoid).- Parameters:
- cs- the coordinate system to set as the source, or- null.
- ellipsoid- the ellipsoid associated to the given coordinate system, or- null.
 
- 
setTargetSets the target coordinate system and related ellipsoid to the components of given CRS. TheEllipsoid, fetched from the geodetic datum, is often used together with anEllipsoidalCS, 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
 
- 
getSourceCSReturns the source coordinate system, ornullif unspecified.- Returns:
- the source coordinate system, or null.
 
- 
getSourceEllipsoidReturns the ellipsoid of the source ellipsoidal coordinate system, ornullif it does not apply. This information is valid only ifgetSourceCS()returns an instance ofEllipsoidalCS.- Returns:
- the ellipsoid of the source ellipsoidal coordinate system, or nullif it does not apply.
 
- 
getTargetCSReturns the target coordinate system, ornullif unspecified.- Returns:
- the target coordinate system, or null.
 
- 
getTargetEllipsoidReturns the ellipsoid of the target ellipsoidal coordinate system, ornullif it does not apply. This information is valid only ifgetTargetCS()returns an instance ofEllipsoidalCS.- Returns:
- the ellipsoid of the target ellipsoidal coordinate system, or nullif it does not apply.
 
- 
getMatrixReturns the matrix that represent the affine transform to concatenate before or after the parameterized transform. Theroleargument specifies which matrix is desired:- NORMALIZATIONfor the conversion from the source coordinate system to a 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.
- DENORMALIZATIONfor 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_NORMALIZATIONand- INVERSE_DENORMALIZATIONare also supported but rarely used.
 DefaultMathTransformFactory.swapAndScaleAxes(MathTransform, Context). Users an 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 nullif thisContexthas no information about the coordinate system.
- Throws:
- FactoryException- if an error occurred while computing the matrix.
- See Also:
 
- 
getMethodUsedReturns the operation method used for the math transform creation. This is the same information thanDefaultMathTransformFactory.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
- See Also:
 
- 
getContextualParametersReturns 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 bygetCompletedParameters().Associated boolean valuesThe associated boolean in the map tells whether the named parameter value is really contextual. The boolean isFALSEif the user explicitly specified a value in the parameters given to theDefaultMathTransformFactory.createParameterizedTransform(ParameterValueGroup, Context)method, and that value is different than the value inferred from the context. Such inconsistencies are also logged atLevel.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 isTRUE.MutabilityThe returned map is modifiable for making easier for callers to amend the contextual information. This map is not used byContextexcept for information purposes (e.g. intoString()). In particular, modifications of this map have no incidence on the createdMathTransform.- Returns:
- names of parameters inferred from context.
- Since:
- 1.3
 
- 
getCompletedParametersReturns the parameter values used for the math transform creation, including the parameters completed by the factory. The parameters inferred from the context are listed bygetContextualParameters().- Returns:
- the parameter values used by the factory.
- Throws:
- IllegalStateException- if- DefaultMathTransformFactory.createParameterizedTransform(ParameterValueGroup, Context)has not yet been invoked.
 
- 
toStringReturns a string representation of this context for debugging purposes. Current implementation write the name of source/target coordinate systems and ellipsoids. If contextual parameters have already been inferred, then their names are appended with inconsistent parameters (if any) written on a separated line.
 
- 
setSource(GeodeticCRS).