Class AffineTransform2D
- Object
-
- AffineTransform
-
- XAffineTransform
-
- AffineTransform2D
-
- All Implemented Interfaces:
Serializable,Cloneable,MathTransform,MathTransform2D,Cloneable,LinearTransform,Formattable
public class AffineTransform2D extends XAffineTransform implements MathTransform2D, LinearTransform, Formattable, Cloneable
Transforms two-dimensional coordinate points using an affine transform. This class both extendsAffineTransformand implementsMathTransform2D, so it can be used as a bridge between Java2D and the referencing module.- Since:
- 2.5
- Author:
- Martin Desruisseaux (IRD)
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class 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
Constructors Constructor Description AffineTransform2D(double m00, double m10, double m01, double m11, double m02, double m12)Constructs a newAffineTransform2Dfrom 6 values representing the 6 specifiable entries of the 3×3 transformation matrix.AffineTransform2D(AffineTransform transform)Constructs a new affine transform with the same coefficient than the specified transform.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcheckPermission()Throws anUnsupportedOperationExceptionwhen a mutable method is invoked, sinceAffineTransform2Dmust be immutable.AffineTransformclone()Returns a new affine transform which is a modifiable copy of this transform.ShapecreateTransformedShape(Shape shape)Transforms the specified shape.Matrixderivative(Point2D point)Gets the derivative of this transform at a point.Matrixderivative(Position point)Gets the derivative of this transform at a point.booleanequals(Object obj)StringformatWKT(Formatter formatter)Format the inner part of a Well Known Text (WKT) element.MatrixgetMatrix()Returns this transform as an affine transform matrix.ParameterValueGroupgetParameterValues()Returns the matrix elements as a group of parameters values.intgetSourceDimensions()Gets the dimension of input points, which is fixed to 2.intgetTargetDimensions()Gets the dimension of output points, which is fixed to 2.MathTransform2Dinverse()Creates the inverse transform of this object.StringtoString()Returns the WKT representation of this transform.StringtoWKT()Returns the WKT for this transform.Positiontransform(Position ptSrc, Position ptDst)Transforms the specifiedptSrcand stores the result inptDst.-
Methods inherited from class XAffineTransform
concatenate, getFlip, getRotation, getScale, getScaleInstance, getScaleX0, getScaleY0, getSwapXY, inverseDeltaTransform, inverseTransform, isIdentity, isIdentity, preConcatenate, rotate, rotate, round, scale, setToIdentity, setToRotation, setToRotation, setToScale, setToShear, setToTranslation, setTransform, setTransform, shear, transform, transform, translate
-
Methods inherited from class 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, invert, isIdentity, quadrantRotate, quadrantRotate, rotate, rotate, setToQuadrantRotation, setToQuadrantRotation, setToRotation, setToRotation, transform, transform, transform, transform, transform, transform
-
Methods inherited from interface LinearTransform
isIdentity
-
Methods inherited from interface MathTransform
isIdentity, transform, transform, transform, transform
-
Methods inherited from interface MathTransform2D
transform
-
-
-
-
Constructor Detail
-
AffineTransform2D
public AffineTransform2D(AffineTransform transform)
Constructs a new affine transform with the same coefficient than the specified transform.
-
AffineTransform2D
public AffineTransform2D(double m00, double m10, double m01, double m11, double m02, double m12)Constructs a newAffineTransform2Dfrom 6 values representing the 6 specifiable entries of the 3×3 transformation matrix. Those values are given unchanged to thesuper class constructor.- Since:
- 2.5
-
-
Method Detail
-
checkPermission
protected final void checkPermission() throws UnsupportedOperationExceptionThrows anUnsupportedOperationExceptionwhen a mutable method is invoked, sinceAffineTransform2Dmust be immutable.- Overrides:
checkPermissionin classXAffineTransform- Throws:
UnsupportedOperationException- if this affine transform is immutable.
-
getParameterValues
public ParameterValueGroup getParameterValues()
Returns the matrix elements as a group of parameters values. The number of parameters depends on the matrix size. Only matrix elements different from their default value will be included in this group.- Returns:
- A copy of the parameter values for this math transform.
-
getSourceDimensions
public final int getSourceDimensions()
Gets the dimension of input points, which is fixed to 2.- Specified by:
getSourceDimensionsin interfaceMathTransform- Returns:
- The dimension of input points.
-
getTargetDimensions
public final int getTargetDimensions()
Gets the dimension of output points, which is fixed to 2.- Specified by:
getTargetDimensionsin interfaceMathTransform- Returns:
- The dimension of output points.
-
transform
public Position transform(Position ptSrc, Position ptDst)
Transforms the specifiedptSrcand stores the result inptDst.- Specified by:
transformin interfaceMathTransform- Parameters:
ptSrc- the specified coordinate point to be transformed.ptDst- the specified coordinate point that stores the result of transformingptSrc, ornull.- Returns:
- the coordinate point after transforming
ptSrcand storing the result inptDst, or a newly created point ifptDstwas null.
-
createTransformedShape
public Shape createTransformedShape(Shape shape)
Transforms the specified shape.- Specified by:
createTransformedShapein interfaceMathTransform2D- Overrides:
createTransformedShapein classAffineTransform- Parameters:
shape- Shape to transform.- Returns:
- Transformed shape, or
shapeif this transform is the identity transform.
-
getMatrix
public Matrix getMatrix()
Returns this transform as an affine transform matrix.- Specified by:
getMatrixin interfaceLinearTransform- Returns:
- A copy of the underlying matrix.
-
derivative
public Matrix derivative(Point2D point)
Gets the derivative of this transform at a point. For an affine transform, the derivative is the same everywhere.- Specified by:
derivativein interfaceMathTransform2D- Parameters:
point- The coordinate point where to evaluate the derivative. Null value is accepted only if the derivative is the same everywhere. For example affine transform accept null value since they produces identical derivative no matter the coordinate value. But most map projection will requires a non-null value.- Returns:
- The derivative at the specified point as a 2×2 matrix. This method never returns an internal object: changing the matrix will not change the state of this math transform.
-
derivative
public Matrix derivative(Position point)
Gets the derivative of this transform at a point. For an affine transform, the derivative is the same everywhere.- Specified by:
derivativein interfaceMathTransform- Parameters:
point- The coordinate point where to evaluate the derivative. Null value is accepted only if the derivative is the same everywhere. For example affine transform accept null value since they produces identical derivative no matter the coordinate value. But most map projection will requires a non-null value.- Returns:
- The derivative at the specified point (never
null). This method never returns an internal object: changing the matrix will not change the state of this math transform.
-
inverse
public MathTransform2D inverse() throws NoninvertibleTransformException
Creates the inverse transform of this object.- Specified by:
inversein interfaceMathTransform- Specified by:
inversein interfaceMathTransform2D- Returns:
- The inverse transform.
- Throws:
NoninvertibleTransformException- if this transform can't be inverted.
-
clone
public AffineTransform clone()
Returns a new affine transform which is a modifiable copy of this transform. We override this method because it is defined in the super-class. However this implementation do not returns a newAffineTransform2Dinstance because the later is unmodifiable, which make exact cloning useless.- Specified by:
clonein interfaceCloneable- Overrides:
clonein classAffineTransform- Returns:
- A copy of this object.
- See Also:
Object.clone()
-
formatWKT
public String formatWKT(Formatter formatter)
Format the inner part of a Well Known Text (WKT) element.- Specified by:
formatWKTin interfaceFormattable- Parameters:
formatter- The formatter to use.- Returns:
- The WKT element name.
- See Also:
Formattable.formatWKT(Formatter)
-
toWKT
public String toWKT()
Returns the WKT for this transform.- Specified by:
toWKTin interfaceMathTransform- Returns:
- The Well Known Text (WKT) for this object.
-
toString
public String toString()
Returns the WKT representation of this transform.- Overrides:
toStringin classAffineTransform
-
equals
public boolean equals(Object obj)
- Overrides:
equalsin classAffineTransform
-
-