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 long
Serial 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
ConstructorsModifierConstructorDescriptionprotected
Constructs 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 specifiedAffineTransform
object. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
Checks if the caller is allowed to change thisAffineTransform
state.final void
Checks for permission before concatenating this transform.final void
invert()
Checks for permission before inverting this transform.final void
Checks for permission before concatenating this transform.final void
quadrantRotate
(int numquadrants) Checks for permission before rotating this transform.final void
quadrantRotate
(int numquadrants, double anchorx, double anchory) Checks for permission before rotating this transform.final void
rotate
(double theta) Checks for permission before rotating this transform.final void
rotate
(double vecx, double vecy) Checks for permission before rotating this transform.final void
rotate
(double theta, double anchorx, double anchory) Checks for permission before rotating this transform.final void
rotate
(double vecx, double vecy, double anchorx, double anchory) Checks for permission before rotating this transform.final void
scale
(double sx, double sy) Checks for permission before scaling this transform.final void
Checks for permission before setting this transform.final void
setToQuadrantRotation
(int numquadrants) Checks for permission before setting this transform.final void
setToQuadrantRotation
(int numquadrants, double anchorx, double anchory) Checks for permission before setting this transform.final void
setToRotation
(double theta) Checks for permission before setting this transform.final void
setToRotation
(double vecx, double vecy) Checks for permission before setting this transform.final void
setToRotation
(double theta, double anchorx, double anchory) Checks for permission before setting this transform.final void
setToRotation
(double vecx, double vecy, double anchorx, double anchory) Checks for permission before setting this transform.final void
setToScale
(double sx, double sy) Checks for permission before setting this transform.final void
setToShear
(double shx, double shy) Checks for permission before setting this transform.final void
setToTranslation
(double tx, double ty) Checks for permission before setting this transform.final void
setTransform
(double m00, double m10, double m01, double m11, double m02, double m12) Checks for permission before setting this transform.final void
Checks for permission before setting this transform.final void
shear
(double shx, double shy) Checks for permission before shearing this transform.final void
translate
(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 specifiedAffineTransform
object.- 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 thisAffineTransform
state. If this method is defined to thrown an exception in all case (which is the default), then thisAffineTransform
is immutable.An
ImmutableAffineTransform
may 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:
translate
in classAffineTransform
-
rotate
public final void rotate(double theta) Checks for permission before rotating this transform.- Overrides:
rotate
in classAffineTransform
-
rotate
public final void rotate(double theta, double anchorx, double anchory) Checks for permission before rotating this transform.- Overrides:
rotate
in classAffineTransform
-
rotate
public final void rotate(double vecx, double vecy) Checks for permission before rotating this transform.- Overrides:
rotate
in classAffineTransform
-
rotate
public final void rotate(double vecx, double vecy, double anchorx, double anchory) Checks for permission before rotating this transform.- Overrides:
rotate
in classAffineTransform
-
quadrantRotate
public final void quadrantRotate(int numquadrants) Checks for permission before rotating this transform.- Overrides:
quadrantRotate
in classAffineTransform
-
quadrantRotate
public final void quadrantRotate(int numquadrants, double anchorx, double anchory) Checks for permission before rotating this transform.- Overrides:
quadrantRotate
in classAffineTransform
-
scale
public final void scale(double sx, double sy) Checks for permission before scaling this transform.- Overrides:
scale
in classAffineTransform
-
shear
public final void shear(double shx, double shy) Checks for permission before shearing this transform.- Overrides:
shear
in classAffineTransform
-
setToIdentity
public final void setToIdentity()Checks for permission before setting this transform.- Overrides:
setToIdentity
in classAffineTransform
-
setToTranslation
public final void setToTranslation(double tx, double ty) Checks for permission before setting this transform.- Overrides:
setToTranslation
in classAffineTransform
-
setToRotation
public final void setToRotation(double theta) Checks for permission before setting this transform.- Overrides:
setToRotation
in classAffineTransform
-
setToRotation
public final void setToRotation(double theta, double anchorx, double anchory) Checks for permission before setting this transform.- Overrides:
setToRotation
in classAffineTransform
-
setToRotation
public final void setToRotation(double vecx, double vecy) Checks for permission before setting this transform.- Overrides:
setToRotation
in classAffineTransform
-
setToRotation
public final void setToRotation(double vecx, double vecy, double anchorx, double anchory) Checks for permission before setting this transform.- Overrides:
setToRotation
in classAffineTransform
-
setToQuadrantRotation
public final void setToQuadrantRotation(int numquadrants) Checks for permission before setting this transform.- Overrides:
setToQuadrantRotation
in classAffineTransform
-
setToQuadrantRotation
public final void setToQuadrantRotation(int numquadrants, double anchorx, double anchory) Checks for permission before setting this transform.- Overrides:
setToQuadrantRotation
in classAffineTransform
-
setToScale
public final void setToScale(double sx, double sy) Checks for permission before setting this transform.- Overrides:
setToScale
in classAffineTransform
-
setToShear
public final void setToShear(double shx, double shy) Checks for permission before setting this transform.- Overrides:
setToShear
in classAffineTransform
-
setTransform
Checks for permission before setting this transform.- Overrides:
setTransform
in 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:
setTransform
in classAffineTransform
-
concatenate
Checks for permission before concatenating this transform.- Overrides:
concatenate
in classAffineTransform
-
preConcatenate
Checks for permission before concatenating this transform.- Overrides:
preConcatenate
in classAffineTransform
-
invert
Checks for permission before inverting this transform.- Overrides:
invert
in classAffineTransform
- Throws:
NoninvertibleTransformException
- if the matrix cannot be inverted.
-