|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
ObjectAffineTransform
XAffineTransform
AffineTransform2D
@Immutable public class AffineTransform2D
Transforms two-dimensional coordinate points using an affine transform. This class both
extends AffineTransform and implements MathTransform2D, so it can be
used as a bridge between Java2D and the referencing module. Note that this bridge role
involve a tricky issue with the equals method, hopefully to occur only
in exceptional corner cases.
See any of the following providers for a list of programmatic parameters:
ProjectiveTransform,
Serialized Form
| referencing/geotk-referencing (download) | View source code for this class |
| 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 | |
|---|---|
AffineTransform2D(AffineTransform transform)
Constructs a new affine transform with the same coefficient than the specified transform. |
|
AffineTransform2D(double m00,
double m10,
double m01,
double m11,
double m02,
double m12)
Constructs a new AffineTransform2D from 6 values representing the 6 specifiable
entries of the 3×3 transformation matrix. |
|
| Method Summary | |
|---|---|
protected void |
checkPermission()
Throws an UnsupportedOperationException when a mutable method
is invoked, since AffineTransform2D must be immutable. |
AffineTransform |
clone()
Returns a new affine transform which is a modifiable copy of this transform. |
Shape |
createTransformedShape(Shape shape)
Transforms the specified shape. |
Matrix |
derivative(DirectPosition point)
Gets the derivative of this transform at a point. |
Matrix |
derivative(Point2D point)
Gets the derivative of this transform at a point. |
boolean |
equals(Object object)
Compares this affine transform with the given object for equality. |
boolean |
equals(Object object,
ComparisonMode mode)
Compares this affine transform with the given object for equality. |
String |
formatWKT(Formatter formatter)
Format the inner part of a Well Known Text (WKT) element. |
Matrix |
getMatrix()
Returns this transform as an affine transform matrix. |
ParameterDescriptorGroup |
getParameterDescriptors()
Returns the parameter descriptors for this math transform. |
ParameterValueGroup |
getParameterValues()
Returns the matrix elements as a group of parameters values. |
int |
getSourceDimensions()
Gets the dimension of input points, which is fixed to 2. |
int |
getTargetDimensions()
Gets the dimension of output points, which is fixed to 2. |
MathTransform2D |
inverse()
Creates the inverse transform of this object. |
String |
toString()
Returns the WKT representation of this transform. |
String |
toWKT()
Returns the WKT for this transform. |
DirectPosition |
transform(DirectPosition ptSrc,
DirectPosition ptDst)
Transforms the specified ptSrc and stores the result in ptDst. |
| Methods inherited from class Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface MathTransform2D |
|---|
transform |
| Methods inherited from interface LinearTransform |
|---|
isIdentity |
| Methods inherited from interface MathTransform |
|---|
isIdentity, transform, transform, transform, transform |
| Constructor Detail |
|---|
public AffineTransform2D(AffineTransform transform)
transform - The affine transform to copy.
public AffineTransform2D(double m00,
double m10,
double m01,
double m11,
double m02,
double m12)
AffineTransform2D from 6 values representing the 6 specifiable
entries of the 3×3 transformation matrix. Those values are given unchanged to the
super
class constructor.
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 Detail |
|---|
protected final void checkPermission()
throws UnsupportedOperationException
UnsupportedOperationException when a mutable method
is invoked, since AffineTransform2D must be immutable.
checkPermission in class XAffineTransformUnsupportedOperationException - Always thrown.public ParameterDescriptorGroup getParameterDescriptors()
getParameterDescriptors in interface Parameterizednull.OperationMethod.getParameters()public ParameterValueGroup getParameterValues()
getParameterValues in interface Parameterizednull.
Since this method returns a copy of the parameter values, any change to
a value will have no effect on this math transform.SingleOperation.getParameterValues()public final int getSourceDimensions()
getSourceDimensions in interface MathTransformpublic final int getTargetDimensions()
getTargetDimensions in interface MathTransform
public DirectPosition transform(DirectPosition ptSrc,
DirectPosition ptDst)
ptSrc and stores the result in ptDst.
transform in interface MathTransformpublic Shape createTransformedShape(Shape shape)
Rectangle2D.
createTransformedShape in interface MathTransform2DcreateTransformedShape in class AffineTransformshape - Shape to transform.
shape if this transform is the identity transform.public Matrix getMatrix()
getMatrix in interface LinearTransformpublic Matrix derivative(Point2D point)
derivative in interface MathTransform2Dpublic Matrix derivative(DirectPosition point)
derivative in interface MathTransform
public MathTransform2D inverse()
throws NoninvertibleTransformException
inverse in interface MathTransforminverse in interface MathTransform2DNoninvertibleTransformException - if this transform can't be inverted.
public boolean equals(Object object,
ComparisonMode mode)
LinearTransform
interface, except for the following case: if the given mode is ComparisonMode.STRICT,
then this method delegates to equals(Object). The later method has different rules
than the ones documented in the LinearTransform interface, because of the
AffineTransform inheritance.
equals in interface LinearTransformequals in interface LenientComparableobject - The object to compare to this.mode - The strictness level of the comparison.
true if both objects are equal.public boolean equals(Object object)
AffineTransform.equals(Object) with one additional
rule: if the other object is also an instance of AffineTransform2D, then the two
objects must be of the exact same class.
Most Geotk implementations require that the objects being compared are unconditionally of
the same class in order to be considered equal. However many JDK implementations, including
AffineTransform, do not have this requirement. Consequently the above condition
(i.e. require the same class only if the given object is an AffineTransform2D or
a subclass) is necessary in order to preserve the symmetricity contract of
Object.equals(java.lang.Object).
A side-effect of this implementation is that the transitivity contract of
Object.equals(Object) may be broken is some corner cases. This contract said:
Assuming that a, b and c are instances ofa.equals(b)andb.equals(c)impliesa.equals(c)
AffineTransform (where "instance of T" means T or any
subclass of T), then the transitivity contract is broken if and only if
exactly two of those objects are instance of AffineTransform2D and those two
objects are not of the same class. Note that this implies that at least one subclass
of AffineTransform2D is used.
In the vast majority of cases, the transitivity contract is not broken
and the users can ignore this documentation. The transitivity contract is typically not
broken either because we usually don't subclass AffineTransform2D, or because we
don't mix AffineTransform with AffineTransform2D subclasses in the same
collection.
This special case exists in order to allow developers to attach additional information to
their own subclass of AffineTransform2D, and still distinguish their specialized
subclass from ordinary affine transforms in a pool of MathTransform instances. The
main application is the Equirectangular
map projection, which can be simplified to an affine transform but still needs to remember
the projection parameters.
equals in interface LenientComparableequals in class AffineTransformobject - The object to compare with this affine transform for equality.
true if the given object is of appropriate class (as explained in the
above documentation) and the affine transform coefficients are the same.public AffineTransform clone()
AffineTransform, not
AffineTransform2D, because the later is unmodifiable and cloning it make little
sense.
clone in class AffineTransformpublic String formatWKT(Formatter formatter)
formatWKT in interface Formattableformatter - The formatter to use.
public String toWKT()
toWKT in interface MathTransformpublic String toString()
toString in class AffineTransform
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||