Class ImmutableAffineTransform
java.lang.Object
java.awt.geom.AffineTransform
org.apache.sis.internal.referencing.j2d.ImmutableAffineTransform
- All Implemented Interfaces:
Serializable,Cloneable
- Direct Known Subclasses:
AffineTransform2D
Overrides all mutable
AffineTransform methods in order to check for permission
before changing the transform state. If checkPermission() is defined to always
throw an exception (which is the default), then AffineTransform is immutable.- Since:
- 0.5
- Version:
- 1.2
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final longSerial number for inter-operability with different versions.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
ConstructorsModifierConstructorDescriptionprotectedConstructs an identity affine transform.ImmutableAffineTransform(double[] elements) Constructs a new transform from an array of values representing either the 4 non-translation entries or the 6 specifiable entries of the 3×3 matrix.ImmutableAffineTransform(double m00, double m10, double m01, double m11, double m02, double m12) Constructs a new transform from 6 values representing the 6 specifiable entries of the 3×3 transformation matrix.Constructs a new transform that is a copy of the specifiedAffineTransformobject. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidChecks if the caller is allowed to change thisAffineTransformstate.final voidChecks for permission before concatenating this transform.final voidinvert()Checks for permission before inverting this transform.final voidChecks for permission before concatenating this transform.final voidquadrantRotate(int numquadrants) Checks for permission before rotating this transform.final voidquadrantRotate(int numquadrants, double anchorx, double anchory) Checks for permission before rotating this transform.final voidrotate(double theta) Checks for permission before rotating this transform.final voidrotate(double vecx, double vecy) Checks for permission before rotating this transform.final voidrotate(double theta, double anchorx, double anchory) Checks for permission before rotating this transform.final voidrotate(double vecx, double vecy, double anchorx, double anchory) Checks for permission before rotating this transform.final voidscale(double sx, double sy) Checks for permission before scaling this transform.final voidChecks for permission before setting this transform.final voidsetToQuadrantRotation(int numquadrants) Checks for permission before setting this transform.final voidsetToQuadrantRotation(int numquadrants, double anchorx, double anchory) Checks for permission before setting this transform.final voidsetToRotation(double theta) Checks for permission before setting this transform.final voidsetToRotation(double vecx, double vecy) Checks for permission before setting this transform.final voidsetToRotation(double theta, double anchorx, double anchory) Checks for permission before setting this transform.final voidsetToRotation(double vecx, double vecy, double anchorx, double anchory) Checks for permission before setting this transform.final voidsetToScale(double sx, double sy) Checks for permission before setting this transform.final voidsetToShear(double shx, double shy) Checks for permission before setting this transform.final voidsetToTranslation(double tx, double ty) Checks for permission before setting this transform.final voidsetTransform(double m00, double m10, double m01, double m11, double m02, double m12) Checks for permission before setting this transform.final voidChecks for permission before setting this transform.final voidshear(double shx, double shy) Checks for permission before shearing this transform.final voidtranslate(double tx, double ty) Checks for permission before translating this transform.Methods inherited from class java.awt.geom.AffineTransform
clone, createInverse, createTransformedShape, deltaTransform, deltaTransform, equals, getDeterminant, getMatrix, getQuadrantRotateInstance, getQuadrantRotateInstance, getRotateInstance, getRotateInstance, getRotateInstance, getRotateInstance, getScaleInstance, getScaleX, getScaleY, getShearInstance, getShearX, getShearY, getTranslateInstance, getTranslateX, getTranslateY, getType, hashCode, inverseTransform, inverseTransform, isIdentity, toString, transform, transform, transform, transform, transform, transform
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDSerial number for inter-operability with different versions.- See Also:
-
-
Constructor Details
-
ImmutableAffineTransform
protected ImmutableAffineTransform()Constructs an identity affine transform. This is for subclasses usage only, for subclasses that override thecheckPermission()method. -
ImmutableAffineTransform
Constructs a new transform that is a copy of the specifiedAffineTransformobject.- Parameters:
tr- the affine transform to copy.
-
ImmutableAffineTransform
public ImmutableAffineTransform(double[] elements) Constructs a new transform from an array of values representing either the 4 non-translation entries or the 6 specifiable entries of the 3×3 matrix.- Parameters:
elements- the matrix elements in an array of length 4 or 6.
-
ImmutableAffineTransform
public ImmutableAffineTransform(double m00, double m10, double m01, double m11, double m02, double m12) Constructs a new transform from 6 values representing the 6 specifiable entries of the 3×3 transformation matrix. Those values are given unchanged to the super class constructor.- Parameters:
m00- the X coordinate scaling.m10- the Y coordinate shearing.m01- the X coordinate shearing.m11- the Y coordinate scaling.m02- the X coordinate translation.m12- the Y coordinate translation.
-
-
Method Details
-
checkPermission
Checks if the caller is allowed to change thisAffineTransformstate. If this method is defined to thrown an exception in all case (which is the default), then thisAffineTransformis immutable.An
ImmutableAffineTransformmay be temporary mutable at construction time, but shall be back to immutable state before the instance is given to the user.- Throws:
UnsupportedOperationException- if this affine transform is immutable.
-
translate
public final void translate(double tx, double ty) Checks for permission before translating this transform.- Overrides:
translatein classAffineTransform
-
rotate
public final void rotate(double theta) Checks for permission before rotating this transform.- Overrides:
rotatein classAffineTransform
-
rotate
public final void rotate(double theta, double anchorx, double anchory) Checks for permission before rotating this transform.- Overrides:
rotatein classAffineTransform
-
rotate
public final void rotate(double vecx, double vecy) Checks for permission before rotating this transform.- Overrides:
rotatein classAffineTransform
-
rotate
public final void rotate(double vecx, double vecy, double anchorx, double anchory) Checks for permission before rotating this transform.- Overrides:
rotatein classAffineTransform
-
quadrantRotate
public final void quadrantRotate(int numquadrants) Checks for permission before rotating this transform.- Overrides:
quadrantRotatein classAffineTransform
-
quadrantRotate
public final void quadrantRotate(int numquadrants, double anchorx, double anchory) Checks for permission before rotating this transform.- Overrides:
quadrantRotatein classAffineTransform
-
scale
public final void scale(double sx, double sy) Checks for permission before scaling this transform.- Overrides:
scalein classAffineTransform
-
shear
public final void shear(double shx, double shy) Checks for permission before shearing this transform.- Overrides:
shearin classAffineTransform
-
setToIdentity
public final void setToIdentity()Checks for permission before setting this transform.- Overrides:
setToIdentityin classAffineTransform
-
setToTranslation
public final void setToTranslation(double tx, double ty) Checks for permission before setting this transform.- Overrides:
setToTranslationin classAffineTransform
-
setToRotation
public final void setToRotation(double theta) Checks for permission before setting this transform.- Overrides:
setToRotationin classAffineTransform
-
setToRotation
public final void setToRotation(double theta, double anchorx, double anchory) Checks for permission before setting this transform.- Overrides:
setToRotationin classAffineTransform
-
setToRotation
public final void setToRotation(double vecx, double vecy) Checks for permission before setting this transform.- Overrides:
setToRotationin classAffineTransform
-
setToRotation
public final void setToRotation(double vecx, double vecy, double anchorx, double anchory) Checks for permission before setting this transform.- Overrides:
setToRotationin classAffineTransform
-
setToQuadrantRotation
public final void setToQuadrantRotation(int numquadrants) Checks for permission before setting this transform.- Overrides:
setToQuadrantRotationin classAffineTransform
-
setToQuadrantRotation
public final void setToQuadrantRotation(int numquadrants, double anchorx, double anchory) Checks for permission before setting this transform.- Overrides:
setToQuadrantRotationin classAffineTransform
-
setToScale
public final void setToScale(double sx, double sy) Checks for permission before setting this transform.- Overrides:
setToScalein classAffineTransform
-
setToShear
public final void setToShear(double shx, double shy) Checks for permission before setting this transform.- Overrides:
setToShearin classAffineTransform
-
setTransform
Checks for permission before setting this transform.- Overrides:
setTransformin classAffineTransform
-
setTransform
public final void setTransform(double m00, double m10, double m01, double m11, double m02, double m12) Checks for permission before setting this transform.- Overrides:
setTransformin classAffineTransform
-
concatenate
Checks for permission before concatenating this transform.- Overrides:
concatenatein classAffineTransform
-
preConcatenate
Checks for permission before concatenating this transform.- Overrides:
preConcatenatein classAffineTransform
-
invert
Checks for permission before inverting this transform.- Overrides:
invertin classAffineTransform- Throws:
NoninvertibleTransformException- if the matrix cannot be inverted.
-