Class ParameterizedAffine
java.lang.Object
java.awt.geom.AffineTransform
org.apache.sis.internal.referencing.j2d.ImmutableAffineTransform
org.apache.sis.internal.referencing.j2d.AffineTransform2D
org.apache.sis.internal.referencing.j2d.ParameterizedAffine
- All Implemented Interfaces:
Serializable
,Cloneable
,LinearTransform2D
,Parameterized
,LinearTransform
,LenientComparable
,org.opengis.referencing.operation.MathTransform
,org.opengis.referencing.operation.MathTransform2D
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.
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 Summary
FieldsModifier and TypeFieldDescriptionprivate final boolean
true
ifparameters
provides an accurate description of this transform, orfalse
if this transform may be different than the one described by the parameters.private final org.opengis.parameter.ParameterValueGroup
The (presumed immutable) parameters used for creating this transform.private static final long
For cross-version compatibility.Fields inherited from class java.awt.geom.AffineTransform
TYPE_FLIP, TYPE_GENERAL_ROTATION, TYPE_GENERAL_SCALE, TYPE_GENERAL_TRANSFORM, TYPE_IDENTITY, TYPE_MASK_ROTATION, TYPE_MASK_SCALE, TYPE_QUADRANT_ROTATION, TYPE_TRANSLATION, TYPE_UNIFORM_SCALE
-
Constructor Summary
ConstructorsConstructorDescriptionParameterizedAffine
(AffineTransform transform, org.opengis.parameter.ParameterValueGroup parameters, boolean isDefinitive) Creates a new transform from the given affine and parameters. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Compares this affine transform with the given object for equality.org.opengis.parameter.ParameterDescriptorGroup
Returns the parameter descriptors for this map projection.org.opengis.parameter.ParameterValueGroup
Returns the parameter values for this map projection.org.opengis.referencing.operation.MathTransform
newTransform
(org.opengis.referencing.operation.MathTransform transform) Returns the given transform associated to the same parameters than thisParameterizedAffine
, if possible.Methods inherited from class org.apache.sis.internal.referencing.j2d.AffineTransform2D
checkPermission, clone, createTransformedShape, derivative, derivative, equals, freeze, getMatrix, getSourceDimensions, getTargetDimensions, inverse, isAffine, toString, toWKT, transform
Methods inherited from class org.apache.sis.internal.referencing.j2d.ImmutableAffineTransform
concatenate, invert, preConcatenate, quadrantRotate, quadrantRotate, rotate, rotate, rotate, rotate, scale, setToIdentity, setToQuadrantRotation, setToQuadrantRotation, setToRotation, setToRotation, setToRotation, setToRotation, setToScale, setToShear, setToTranslation, setTransform, setTransform, shear, translate
Methods inherited from class java.awt.geom.AffineTransform
createInverse, deltaTransform, deltaTransform, getDeterminant, getMatrix, getQuadrantRotateInstance, getQuadrantRotateInstance, getRotateInstance, getRotateInstance, getRotateInstance, getRotateInstance, getScaleInstance, getScaleX, getScaleY, getShearInstance, getShearX, getShearY, getTranslateInstance, getTranslateX, getTranslateY, getType, hashCode, inverseTransform, inverseTransform, isIdentity, transform, transform, transform, transform, transform, transform
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.apache.sis.referencing.operation.transform.LinearTransform
deltaTransform
Methods inherited from interface org.opengis.referencing.operation.MathTransform
isIdentity, transform, transform, transform, transform
Methods inherited from interface org.opengis.referencing.operation.MathTransform2D
transform
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDFor cross-version compatibility.- See Also:
-
parameters
private final org.opengis.parameter.ParameterValueGroup parametersThe (presumed immutable) parameters used for creating this transform. -
isDefinitive
private final boolean isDefinitivetrue
ifparameters
provides an accurate description of this transform, orfalse
if this transform may be different than the one described by the parameters. This field may befalse
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
ifparameters
provides an accurate description oftransform
, orfalse
if the transform may be different than the one described byparameters
.
-
-
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 thisParameterizedAffine
, if possible. If the given transform is not affine, then it is returned unchanged.- Parameters:
transform
- the transform to be at least partially described byparameters
.- 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 interfaceParameterized
- Overrides:
getParameterDescriptors
in classAffineTransform2D
- 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 byAbstractCoordinateOperation
.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 ofSingleOperation
, which is itself part ofProjecteCRS
. Consequently, we have two conflicting needs:- If this method is queried from a
SingleOperation
instance (usually indirectly as part of aProjectedCRS
), then we want to return the "Equidistant Cylindrical (Spherical)" map projection parameters without bothering about axis swapping, because the latter is described by theAxis["…"]
elements in the enclosingProjectedCRS
instance. - But if this
MathTransform
is formatted directly (not as a component ofProjectedCRS
), 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.
Semaphores.ENCLOSED_IN_OPERATION
flag is SIS internal mechanism for distinguish the two above-cited cases.- Specified by:
getParameterValues
in interfaceParameterized
- Overrides:
getParameterValues
in classAffineTransform2D
- Returns:
- the map projection parameters if they are an accurate description of this transform, or the generic affine parameters in case of doubt.
- If this method is queried from a
-
equals
Compares this affine transform with the given object for equality. Parameters are compared only if the other object is also an instance ofParameterizedAffine
in order to preserve theAffineTransform.equals(Object)
symmetricity contract.- Specified by:
equals
in interfaceLenientComparable
- Overrides:
equals
in classAffineTransform2D
- Parameters:
object
- the object to compare with this transform for equality.- Returns:
true
if the given object is of appropriate class (as explained in theAffineTransform2D.equals(Object)
documentation) and the coefficients are the same.- See Also:
-