| java.lang.Object java.awt.geom.AffineTransform org.geotools.referencing.operation.matrix.XAffineTransform
All known Subclasses: org.geotools.referencing.operation.transform.AffineTransform2D,
XAffineTransform | abstract public class XAffineTransform extends AffineTransform (Code) | | Utility methods for affine transforms. This class provides two kind of services:
A set of public static methods working on any
AffineTransform .
An abstract base class that override all mutable
AffineTransform methods
in order to check for permission before changing the transform's state.
If
XAffineTransform.checkPermission is defined to always throw an exception,
then
XAffineTransform is immutable.
since: 2.3 version: $Id: XAffineTransform.java 26030 2007-06-26 14:55:47Z desruisseaux $ author: Martin Desruisseaux author: Simone Giannecchini |
Field Summary | |
final public static double | EPS Tolerance value for floating point comparisons. |
Constructor Summary | |
protected | XAffineTransform(AffineTransform tr) Constructs a new
XAffineTransform that is a
copy of the specified
AffineTransform object. |
Method Summary | |
abstract protected void | checkPermission() Check if the caller is allowed to change this
XAffineTransform state. | public void | concatenate(AffineTransform Tx) Check for
before concatenating this transform. | public static int | getFlip(AffineTransform tr) Returns
-1 if one axis has been flipped,
+1 if no axis has been flipped,
or 0 if unknown. | public static double | getRotation(AffineTransform tr) Returns an estimation of the rotation angle in radians. | public static double | getScale(AffineTransform tr) Returns a global scale factor for the specified affine transform. | public static AffineTransform | getScaleInstance(double sx, double sy, double x, double y) Returns an affine transform representing a zoom carried out around a
central point (x, y). | public static double | getScaleX0(AffineTransform tr) Returns the magnitude of scale factor x by cancelling the
effect of eventual flip and rotation. | public static double | getScaleY0(AffineTransform tr) Returns the magnitude of scale factor y by cancelling the
effect of eventual flip and rotation. | public static int | getSwapXY(AffineTransform tr) Returns an estimation about whatever the specified transform swaps x
and y axis. | public static Point2D | inverseDeltaTransform(AffineTransform transform, Point2D source, Point2D dest) Calculates the inverse affine transform of a point without without
applying the translation components.
Parameters: transform - Affine transform to use. Parameters: source - Point to transform. | public static Rectangle2D | inverseTransform(AffineTransform transform, Rectangle2D bounds, Rectangle2D dest) Returns a rectangle which entirely contains the inverse
transform of
bounds . | public boolean | isIdentity(double tolerance) Check whether or not this
XAffineTransform is the identity by
using the provided
tolerance .
Parameters: tolerance - The tolerance to use for this check. | public static boolean | isIdentity(AffineTransform tr, double tolerance) Returns
true if the specified affine transform is an identity transform up to the
specified tolerance. | public void | preConcatenate(AffineTransform Tx) Check for
before concatenating this transform. | public void | rotate(double theta) Check for
before rotating this transform. | public void | rotate(double theta, double x, double y) Check for
before rotating this transform. | public static void | round(AffineTransform tr) Checks whether the matrix coefficients are close to whole numbers.
If this is the case, these coefficients will be rounded up to the
nearest whole numbers. | public static void | round(AffineTransform tr, double tolerance) Checks whether the matrix coefficients are close to whole numbers.
If this is the case, these coefficients will be rounded up to the
nearest whole numbers. | public void | scale(double sx, double sy) Check for
before scaling this transform. | public void | setToIdentity() Check for
before setting this transform. | public void | setToRotation(double theta) Check for
before setting this transform. | public void | setToRotation(double theta, double x, double y) Check for
before setting this transform. | public void | setToScale(double sx, double sy) Check for
before setting this transform. | public void | setToShear(double shx, double shy) Check for
before setting this transform. | public void | setToTranslation(double tx, double ty) Check for
before setting this transform. | public void | setTransform(AffineTransform Tx) Check for
before setting this transform. | public void | setTransform(double m00, double m10, double m01, double m11, double m02, double m12) Check for
before setting this transform. | public void | shear(double shx, double shy) Check for
before shearing this transform. | public static Rectangle2D | transform(AffineTransform transform, Rectangle2D bounds, Rectangle2D dest) Returns a rectangle which entirely contains the direct
transform of
bounds . | public void | translate(double tx, double ty) Check for
before translating this transform. |
XAffineTransform | protected XAffineTransform(AffineTransform tr)(Code) | | Constructs a new
XAffineTransform that is a
copy of the specified
AffineTransform object.
|
checkPermission | abstract protected void checkPermission()(Code) | | Check if the caller is allowed to change this
XAffineTransform state.
If this method is defined to thrown an exception in all case, then this
XAffineTransform is immutable.
|
concatenate | public void concatenate(AffineTransform Tx)(Code) | | Check for
before concatenating this transform.
|
getFlip | public static int getFlip(AffineTransform tr)(Code) | | Returns
-1 if one axis has been flipped,
+1 if no axis has been flipped,
or 0 if unknown. A flipped axis in an axis with direction reversed (typically the
y axis). This method assumes that the specified affine transform is built
from arbitrary translations, scales or rotations, but no shear. Note that it is not
possible to determine which of the x or y axis has been flipped.
This method can be used in order to set the sign of a scale according the flipping state.
The example below choose to apply the sign on the y scale, but this is an
arbitrary (while common) choice:
double scaleX0 = getScaleX0(transform);
double scaleY0 = getScaleY0(transform);
int flip = getFlip(transform);
if (flip != 0) {
scaleY0 *= flip;
// ... continue the process here.
}
This method is similar to the following code, except that this method
distinguish between "unflipped" and "unknow" states.
boolean flipped = (tr.
&
) != 0;
|
getRotation | public static double getRotation(AffineTransform tr)(Code) | | Returns an estimation of the rotation angle in radians. This method assumes that the
specified affine transform is built from arbitrary translations, scales or rotations,
but no shear. If a flip has been applied, then this method assumes that the flipped
axis is the y one in source CRS space. For a grid to
world CRS transform, this is the row number in grid coordinates.
Parameters: tr - The affine transform to inspect. An estimation of the rotation angle in radians, or Double.NaN NaNif the angle can not be estimated. |
getScaleInstance | public static AffineTransform getScaleInstance(double sx, double sy, double x, double y)(Code) | | Returns an affine transform representing a zoom carried out around a
central point (x, y). The transforms will leave
the specified (x, y) coordinate unchanged.
Parameters: sx - Scale along x axis. Parameters: sy - Scale along y axis. Parameters: x - x coordinates of the central point. Parameters: y - y coordinates of the central point. Affine transform of a zoom which leaves the(x,y) coordinate unchanged. |
getScaleX0 | public static double getScaleX0(AffineTransform tr)(Code) | | Returns the magnitude of scale factor x by cancelling the
effect of eventual flip and rotation. This factor is calculated by
.
|
getScaleY0 | public static double getScaleY0(AffineTransform tr)(Code) | | Returns the magnitude of scale factor y by cancelling the
effect of eventual flip and rotation. This factor is calculated by
.
|
getSwapXY | public static int getSwapXY(AffineTransform tr)(Code) | | Returns an estimation about whatever the specified transform swaps x
and y axis. This method assumes that the specified affine transform
is built from arbitrary translations, scales or rotations, but no shear. It
returns
+1 if the (x, y) axis order seems to be
preserved,
-1 if the transform seems to swap axis to the (y,
x) axis order, or
0 if this method can not make a decision.
|
inverseDeltaTransform | public static Point2D inverseDeltaTransform(AffineTransform transform, Point2D source, Point2D dest) throws NoninvertibleTransformException(Code) | | Calculates the inverse affine transform of a point without without
applying the translation components.
Parameters: transform - Affine transform to use. Parameters: source - Point to transform. This rectangle will not be modified. Parameters: dest - Point in which to place the result. If null , anew point will be created. The inverse transform of the source point. throws: NoninvertibleTransformException - if the affine transform can't be inverted. |
inverseTransform | public static Rectangle2D inverseTransform(AffineTransform transform, Rectangle2D bounds, Rectangle2D dest) throws NoninvertibleTransformException(Code) | | Returns a rectangle which entirely contains the inverse
transform of
bounds . This operation is equivalent to:
.
(bounds).
Parameters: transform - Affine transform to use. Parameters: bounds - Rectangle to transform. This rectangle will not be modified. Parameters: dest - Rectangle in which to place the result. If null, a newrectangle will be created. The inverse transform of the bounds rectangle. throws: NoninvertibleTransformException - if the affine transform can't be inverted. |
isIdentity | public boolean isIdentity(double tolerance)(Code) | | Check whether or not this
XAffineTransform is the identity by
using the provided
tolerance .
Parameters: tolerance - The tolerance to use for this check. true if the transform is identity, false otherwise. since: 2.3.1 |
isIdentity | public static boolean isIdentity(AffineTransform tr, double tolerance)(Code) | | Returns
true if the specified affine transform is an identity transform up to the
specified tolerance. This method is equivalent to computing the difference between this
matrix and an identity matrix (as created by
AffineTransform.AffineTransformnew AffineTransform() ) and returning
true if and only if all differences are
smaller than or equal to
tolerance .
This method is used for working around rounding error in affine transforms resulting
from a computation, as in the example below:
[ 1.0000000000000000001 0.0 0.0 ]
[ 0.0 0.999999999999999999999 0.0 ]
[ 0.0 0.0 1.0 ]
Parameters: tr - The affine transform to be checked for identity. Parameters: tolerance - The tolerance value to use when checking for identity.return true if this tranformation is close enough to theidentity, false otherwise. since: 2.3.1 |
preConcatenate | public void preConcatenate(AffineTransform Tx)(Code) | | Check for
before concatenating this transform.
|
rotate | public void rotate(double theta)(Code) | | Check for
before rotating this transform.
|
rotate | public void rotate(double theta, double x, double y)(Code) | | Check for
before rotating this transform.
|
round | public static void round(AffineTransform tr)(Code) | | Checks whether the matrix coefficients are close to whole numbers.
If this is the case, these coefficients will be rounded up to the
nearest whole numbers. This rounding up is useful, for example, for
speeding up image displays. Above all, it is efficient when we know that
a matrix has a chance of being close to the similarity matrix.
It is crucial to note that this method uses a default rounding threshold
whose value is held by the field
XAffineTransform.EPS which is
.
XAffineTransform.round(AffineTransform,double) |
round | public static void round(AffineTransform tr, double tolerance)(Code) | | Checks whether the matrix coefficients are close to whole numbers.
If this is the case, these coefficients will be rounded up to the
nearest whole numbers. This rounding up is useful, for example, for
speeding up image displays. Above all, it is efficient when we know that
a matrix has a chance of being close to the similarity matrix.
Parameters: tr - The matrix to round. Rounding will be applied in place. Parameters: tolerance - The maximal departure from integers in order to allow rounding.It is typically a small number like 1E-6 . since: 2.3.1 |
scale | public void scale(double sx, double sy)(Code) | | Check for
before scaling this transform.
|
setToIdentity | public void setToIdentity()(Code) | | Check for
before setting this transform.
|
setToRotation | public void setToRotation(double theta)(Code) | | Check for
before setting this transform.
|
setToRotation | public void setToRotation(double theta, double x, double y)(Code) | | Check for
before setting this transform.
|
setToScale | public void setToScale(double sx, double sy)(Code) | | Check for
before setting this transform.
|
setToShear | public void setToShear(double shx, double shy)(Code) | | Check for
before setting this transform.
|
setToTranslation | public void setToTranslation(double tx, double ty)(Code) | | Check for
before setting this transform.
|
setTransform | public void setTransform(double m00, double m10, double m01, double m11, double m02, double m12)(Code) | | Check for
before setting this transform.
|
shear | public void shear(double shx, double shy)(Code) | | Check for
before shearing this transform.
|
transform | public static Rectangle2D transform(AffineTransform transform, Rectangle2D bounds, Rectangle2D dest)(Code) | | Returns a rectangle which entirely contains the direct
transform of
bounds . This operation is equivalent to:
(bounds).
Parameters: transform - Affine transform to use. Parameters: bounds - Rectangle to transform. This rectangle will not be modified. Parameters: dest - Rectangle in which to place the result. If null, a newrectangle will be created. The direct transform of the bounds rectangle. |
translate | public void translate(double tx, double ty)(Code) | | Check for
before translating this transform.
|
Methods inherited from java.awt.geom.AffineTransform | public Object clone()(Code)(Java Doc) public void concatenate(AffineTransform Tx)(Code)(Java Doc) public AffineTransform createInverse() throws NoninvertibleTransformException(Code)(Java Doc) public Shape createTransformedShape(Shape pSrc)(Code)(Java Doc) public Point2D deltaTransform(Point2D ptSrc, Point2D ptDst)(Code)(Java Doc) public void deltaTransform(double[] srcPts, int srcOff, double[] dstPts, int dstOff, int numPts)(Code)(Java Doc) public boolean equals(Object obj)(Code)(Java Doc) public double getDeterminant()(Code)(Java Doc) public void getMatrix(double[] flatmatrix)(Code)(Java Doc) public static AffineTransform getQuadrantRotateInstance(int numquadrants)(Code)(Java Doc) public static AffineTransform getQuadrantRotateInstance(int numquadrants, double anchorx, double anchory)(Code)(Java Doc) public static AffineTransform getRotateInstance(double theta)(Code)(Java Doc) public static AffineTransform getRotateInstance(double theta, double anchorx, double anchory)(Code)(Java Doc) public static AffineTransform getRotateInstance(double vecx, double vecy)(Code)(Java Doc) public static AffineTransform getRotateInstance(double vecx, double vecy, double anchorx, double anchory)(Code)(Java Doc) public static AffineTransform getScaleInstance(double sx, double sy)(Code)(Java Doc) public double getScaleX()(Code)(Java Doc) public double getScaleY()(Code)(Java Doc) public static AffineTransform getShearInstance(double shx, double shy)(Code)(Java Doc) public double getShearX()(Code)(Java Doc) public double getShearY()(Code)(Java Doc) public static AffineTransform getTranslateInstance(double tx, double ty)(Code)(Java Doc) public double getTranslateX()(Code)(Java Doc) public double getTranslateY()(Code)(Java Doc) public int getType()(Code)(Java Doc) public int hashCode()(Code)(Java Doc) public Point2D inverseTransform(Point2D ptSrc, Point2D ptDst) throws NoninvertibleTransformException(Code)(Java Doc) public void inverseTransform(double[] srcPts, int srcOff, double[] dstPts, int dstOff, int numPts) throws NoninvertibleTransformException(Code)(Java Doc) public void invert() throws NoninvertibleTransformException(Code)(Java Doc) public boolean isIdentity()(Code)(Java Doc) public void preConcatenate(AffineTransform Tx)(Code)(Java Doc) public void quadrantRotate(int numquadrants)(Code)(Java Doc) public void quadrantRotate(int numquadrants, double anchorx, double anchory)(Code)(Java Doc) public void rotate(double theta)(Code)(Java Doc) public void rotate(double theta, double anchorx, double anchory)(Code)(Java Doc) public void rotate(double vecx, double vecy)(Code)(Java Doc) public void rotate(double vecx, double vecy, double anchorx, double anchory)(Code)(Java Doc) public void scale(double sx, double sy)(Code)(Java Doc) public void setToIdentity()(Code)(Java Doc) public void setToQuadrantRotation(int numquadrants)(Code)(Java Doc) public void setToQuadrantRotation(int numquadrants, double anchorx, double anchory)(Code)(Java Doc) public void setToRotation(double theta)(Code)(Java Doc) public void setToRotation(double theta, double anchorx, double anchory)(Code)(Java Doc) public void setToRotation(double vecx, double vecy)(Code)(Java Doc) public void setToRotation(double vecx, double vecy, double anchorx, double anchory)(Code)(Java Doc) public void setToScale(double sx, double sy)(Code)(Java Doc) public void setToShear(double shx, double shy)(Code)(Java Doc) public void setToTranslation(double tx, double ty)(Code)(Java Doc) public void setTransform(AffineTransform Tx)(Code)(Java Doc) public void setTransform(double m00, double m10, double m01, double m11, double m02, double m12)(Code)(Java Doc) public void shear(double shx, double shy)(Code)(Java Doc) public String toString()(Code)(Java Doc) public Point2D transform(Point2D ptSrc, Point2D ptDst)(Code)(Java Doc) public void transform(Point2D[] ptSrc, int srcOff, Point2D[] ptDst, int dstOff, int numPts)(Code)(Java Doc) public void transform(float[] srcPts, int srcOff, float[] dstPts, int dstOff, int numPts)(Code)(Java Doc) public void transform(double[] srcPts, int srcOff, double[] dstPts, int dstOff, int numPts)(Code)(Java Doc) public void transform(float[] srcPts, int srcOff, double[] dstPts, int dstOff, int numPts)(Code)(Java Doc) public void transform(double[] srcPts, int srcOff, float[] dstPts, int dstOff, int numPts)(Code)(Java Doc) public void translate(double tx, double ty)(Code)(Java Doc)
|
|
|