Class Transform2D

java.lang.Object
org.gvsig.fmap.geom.jts.transform.Transform2D
All Implemented Interfaces:
org.gvsig.fmap.geom.transform.Transform

public class Transform2D extends Object implements org.gvsig.fmap.geom.transform.Transform
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final double
    The constant used for testing results.
    protected double
     
    protected double
     
    protected double
     
    protected double
     
    protected double
     
    protected double
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new AffineTransform2D, initialized with Identity.
    Transform2D(double[] coefs)
    Creates a new Affine Transform by directly specifying the coefficients, in the order m00, m01, m02, m10, m11, m12 (different order of java.awt.geom.AffineTransform).
    Transform2D(double xx, double yx, double tx, double xy, double yy, double ty)
     
    Creates a new transform from a java AWT transform.
  • Method Summary

    Modifier and Type
    Method
    Description
    double[][]
    Returns the 3x3 square matrix representing the transform.
    Returns this transform as an instance of java AWT AffineTransform.
    org.gvsig.fmap.geom.transform.Transform
    chain(org.gvsig.fmap.geom.transform.Transform other)
    Returns the affine transform created by applying first this affine transform, then the affine transform given by that.
     
    double[]
    Returns coefficients of the transform in a linear array of 6 double.
    org.gvsig.fmap.geom.transform.Transform
    concatenate(org.gvsig.fmap.geom.transform.Transform other)
    Returns the affine transform created by applying first the affine transform given by other, then this affine transform.
    boolean
     
    org.gvsig.fmap.geom.transform.Transform
    Returns the inverse transform.
    boolean
    Tests if this affine transform is direct, i.e. the sign of the determinant of the associated matrix is positive.
    boolean
    Tests is this affine transform is equal to the identity transform.
    boolean
    Tests if this affine transform is an isometry, i.e. is equivalent to a compound of translations, rotations and reflections.
    boolean
    Tests if this affine transform is a motion, i.e. is composed only of rotations and translations.
    boolean
    Tests if this affine transform is a similarity.
    org.gvsig.fmap.geom.transform.Transform
    preConcatenate(org.gvsig.fmap.geom.transform.Transform other)
    Return the affine transform created by applying first this affine transform, then the affine transform given by that.
    Displays the coefficients of the transform, row by row.
    org.gvsig.fmap.geom.primitive.Point
    transform(org.gvsig.fmap.geom.primitive.Point p)
    Computes the coordinates of the transformed point.
    org.gvsig.fmap.geom.primitive.Point[]
    transform(org.gvsig.fmap.geom.primitive.Point[] src, org.gvsig.fmap.geom.primitive.Point[] dst)
     

    Methods inherited from class java.lang.Object

    finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • ACCURACY

      public static final double ACCURACY
      The constant used for testing results.
      See Also:
    • m00

      protected double m00
    • m01

      protected double m01
    • m02

      protected double m02
    • m10

      protected double m10
    • m11

      protected double m11
    • m12

      protected double m12
  • Constructor Details

    • Transform2D

      public Transform2D()
      Creates a new AffineTransform2D, initialized with Identity.
    • Transform2D

      public Transform2D(AffineTransform transform)
      Creates a new transform from a java AWT transform.
      Parameters:
      transform -
    • Transform2D

      public Transform2D(double[] coefs)
      Creates a new Affine Transform by directly specifying the coefficients, in the order m00, m01, m02, m10, m11, m12 (different order of java.awt.geom.AffineTransform).
      Parameters:
      coefs -
    • Transform2D

      public Transform2D(double xx, double yx, double tx, double xy, double yy, double ty)
  • Method Details

    • coefficients

      public double[] coefficients()
      Returns coefficients of the transform in a linear array of 6 double.
      Returns:
    • affineMatrix

      public double[][] affineMatrix()
      Returns the 3x3 square matrix representing the transform.
      Returns:
      the 3x3 affine transform representing the matrix
    • asAwtTransform

      public AffineTransform asAwtTransform()
      Returns this transform as an instance of java AWT AffineTransform.
      Returns:
    • concatenate

      public org.gvsig.fmap.geom.transform.Transform concatenate(org.gvsig.fmap.geom.transform.Transform other)
      Returns the affine transform created by applying first the affine transform given by other, then this affine transform. This is the equivalent method of the 'concatenate' method in java.awt.geom.AffineTransform.
      Specified by:
      concatenate in interface org.gvsig.fmap.geom.transform.Transform
      Parameters:
      other - the transform to apply first
      Returns:
      the composition this * that
    • chain

      public org.gvsig.fmap.geom.transform.Transform chain(org.gvsig.fmap.geom.transform.Transform other)
      Returns the affine transform created by applying first this affine transform, then the affine transform given by that. This the equivalent method of the 'preConcatenate' method in java.awt.geom.AffineTransform.
       shape = shape.transform(T1.chain(T2).chain(T3));
       
      is equivalent to the sequence:
       shape = shape.transform(T1);
       shape = shape.transform(T2);
       shape = shape.transform(T3);
       
      Parameters:
      other - the transform to apply in a second step
      Returns:
      the composition that * this
    • preConcatenate

      public org.gvsig.fmap.geom.transform.Transform preConcatenate(org.gvsig.fmap.geom.transform.Transform other)
      Return the affine transform created by applying first this affine transform, then the affine transform given by that. This the equivalent method of the 'preConcatenate' method in java.awt.geom.AffineTransform.
      Specified by:
      preConcatenate in interface org.gvsig.fmap.geom.transform.Transform
      Parameters:
      other - the transform to apply in a second step
      Returns:
      the composition that * this
    • isSimilarity

      public boolean isSimilarity()
      Tests if this affine transform is a similarity.
      Returns:
    • isMotion

      public boolean isMotion()
      Tests if this affine transform is a motion, i.e. is composed only of rotations and translations.
      Returns:
    • isIsometry

      public boolean isIsometry()
      Tests if this affine transform is an isometry, i.e. is equivalent to a compound of translations, rotations and reflections. Isometry keeps area of shapes unchanged, but can change orientation (direct or indirect).
      Returns:
      true in case of isometry.
    • isDirect

      public boolean isDirect()
      Tests if this affine transform is direct, i.e. the sign of the determinant of the associated matrix is positive. Direct transforms preserve the orientation of transformed shapes.
      Returns:
    • isIdentity

      public boolean isIdentity()
      Tests is this affine transform is equal to the identity transform.
      Specified by:
      isIdentity in interface org.gvsig.fmap.geom.transform.Transform
      Returns:
      true if this transform is the identity transform
    • inverse

      public org.gvsig.fmap.geom.transform.Transform inverse()
      Returns the inverse transform. If the transform is not invertible, throws a new NonInvertibleTransformException.
      Specified by:
      inverse in interface org.gvsig.fmap.geom.transform.Transform
      Returns:
    • transform

      public org.gvsig.fmap.geom.primitive.Point transform(org.gvsig.fmap.geom.primitive.Point p)
      Computes the coordinates of the transformed point.
      Specified by:
      transform in interface org.gvsig.fmap.geom.transform.Transform
      Parameters:
      p -
      Returns:
    • transform

      public org.gvsig.fmap.geom.primitive.Point[] transform(org.gvsig.fmap.geom.primitive.Point[] src, org.gvsig.fmap.geom.primitive.Point[] dst)
      Specified by:
      transform in interface org.gvsig.fmap.geom.transform.Transform
    • toString

      public String toString()
      Displays the coefficients of the transform, row by row.
      Overrides:
      toString in class Object
      Returns:
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • clone

      public Transform2D clone()
      Overrides:
      clone in class Object