org.cip4.jdflib.datatypes
Class JDFMatrix

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<E>
          extended by java.util.Vector<Object>
              extended by org.cip4.jdflib.datatypes.JDFNumList
                  extended by org.cip4.jdflib.datatypes.JDFMatrix
All Implemented Interfaces:
Serializable, Cloneable, Iterable<Object>, Collection<Object>, List<Object>, RandomAccess, JDFBaseDataTypes

public class JDFMatrix
extends JDFNumList

This class represents a transformation matrix consisting of 6 transformation values a, b, c, d, tx, ty all values are double values. The matrix looks like:

  [ x']   [  a  b  tx  ] [ x ]   [ m00x + m01y + m02 ]
  [ y'] = [  c  d  ty  ] [ y ] = [ m10x + m11y + m12 ]
  [ 1 ]   [  0  0  1   ] [ 1 ]   [         1         ]
 

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.cip4.jdflib.datatypes.JDFBaseDataTypes
JDFBaseDataTypes.EnumFitsValue
 
Field Summary
static JDFMatrix unitMatrix
           
 
Fields inherited from class java.util.Vector
capacityIncrement, elementCount, elementData
 
Fields inherited from class java.util.AbstractList
modCount
 
Fields inherited from interface org.cip4.jdflib.datatypes.JDFBaseDataTypes
EPSILON, MAX_CMYK_COLOR, MAX_LAB_COLOR, MAX_MATRIX_DIMENSION, MAX_RECTANGLE_DIMENSION, MAX_RGB_COLOR, MAX_SHAPE_DIMENSION, MAX_XY_DIMENSION
 
Constructor Summary
JDFMatrix()
          constructs a matrix with all values set to 0.0 Double
JDFMatrix(double degrees, double x, double y)
          constructs a matrix with all values set via arotation and a shift
JDFMatrix(double a, double b, double c, double d, double tx, double ty)
          constructs a new JDFMatrix with the given double values
JDFMatrix(JDFElement.EnumOrientation orientation, double w, double h)
          constructs a matrix with all values set via an enumerated orientation
JDFMatrix(JDFMatrix nl)
          constructs a rectangle with all values set via a JDFNumberList
JDFMatrix(JDFNumList nl)
          constructs a rectangle with all values set via a JDFNumberList
JDFMatrix(String s)
          constructs a matrix with all values set via a String
JDFMatrix(Vector v)
          Deprecated. use typesafe constructors
 
Method Summary
 void concat(JDFMatrix m)
          concatinates this with m
static JDFMatrix createMatrix(String s)
          factory for JDFXYPair that silently returns null in case of illegal strings
 boolean equals(Object other)
          equals - returns true if both JDFMatrices are equal, otherwise false
 double getA()
          getA - returns the first coordinate
 AffineTransform getAffineTransform()
          getAffineTransform -
 double getB()
          getB - returns the second coordinate
 double getC()
          getC - returns the third coordinate
 double getD()
          getD - returns the fourth coordinate
 double getTx()
          getTx - returns the tx coordinate
 double getTy()
          getTy - returns the ty coordinate
 int hashCode()
          hashCode complements equals() to fulfill the equals/hashCode contract
 boolean isValid()
          isValid - true if the size of the vector is 6 and all instances are Double types
 void rotate(double degrees)
          rotate this by degrees degrees CouterClockwise
 void setA(double p_a)
          setA - sets the first coordinate
 void setAffineTransform(AffineTransform affineTrans)
          setAffineTransform -
 void setB(double p_b)
          setB - sets the second coordinate
 void setC(double p_c)
          setC - sets the third coordinate
 void setD(double p_d)
          setD - sets the fourth coordinate
 void setTx(double p_tx)
          setTx - sets the tx coordinate
 void setTy(double p_ty)
          setTy - sets the ty coordinate
 void shift(double tx, double ty)
          shifts Tx and Ty by the amount specified
 void shift(JDFXYPair point)
          shift this matrix by an xypair
 
Methods inherited from class org.cip4.jdflib.datatypes.JDFNumList
abs, clone, contains, containsAll, copyNumList, doubleAt, elementAt, getDoubleList, getIntArray, getString, getString, isValidString, matches, removeElementAt, replaceElementAt, scale, scaleFromCM, scaleFromMM, scaleToCM, scaleToMM, set, setString, subtract, toString, unify
 
Methods inherited from class java.util.Vector
add, add, addAll, addAll, addElement, capacity, clear, contains, containsAll, copyInto, elements, ensureCapacity, firstElement, get, indexOf, indexOf, insertElementAt, isEmpty, lastElement, lastIndexOf, lastIndexOf, remove, remove, removeAll, removeAllElements, removeElement, removeRange, retainAll, set, setElementAt, setSize, size, subList, toArray, toArray, trimToSize
 
Methods inherited from class java.util.AbstractList
iterator, listIterator, listIterator
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
iterator, listIterator, listIterator
 

Field Detail

unitMatrix

public static final JDFMatrix unitMatrix
Constructor Detail

JDFMatrix

public JDFMatrix()
constructs a matrix with all values set to 0.0 Double


JDFMatrix

@Deprecated
public JDFMatrix(Vector v)
          throws DataFormatException
Deprecated. use typesafe constructors

constructs a matrix with all values set via a Vector of Double objects

Parameters:
Vector - v - the given Vector
Throws:
DataFormatException - - if the Vector has not a valid format

JDFMatrix

public JDFMatrix(double degrees,
                 double x,
                 double y)
constructs a matrix with all values set via arotation and a shift

Parameters:
degrees - - the rotation in degrees
x - the X shift
y - the Y shift
Throws:
DataFormatException - - if the Vector has not a valid format

JDFMatrix

public JDFMatrix(JDFElement.EnumOrientation orientation,
                 double w,
                 double h)
constructs a matrix with all values set via an enumerated orientation

Parameters:
orientation - - the named orientation
w - the width of the unrotated object to transform
h - the height of the unrotated object to transform
Throws:
DataFormatException - - if the Vector has not a valid format

JDFMatrix

public JDFMatrix(String s)
          throws DataFormatException
constructs a matrix with all values set via a String

Parameters:
s - the given String
Throws:
DataFormatException - - if the String has not a valid format

JDFMatrix

public JDFMatrix(JDFNumList nl)
          throws DataFormatException
constructs a rectangle with all values set via a JDFNumberList

Parameters:
nl - the given number list
Throws:
DataFormatException - - if the JDFNumberList has not a valid format

JDFMatrix

public JDFMatrix(JDFMatrix nl)
constructs a rectangle with all values set via a JDFNumberList

Parameters:
nl - the given number list

JDFMatrix

public JDFMatrix(double a,
                 double b,
                 double c,
                 double d,
                 double tx,
                 double ty)
constructs a new JDFMatrix with the given double values

Parameters:
a - position 01 of the transformation matrix
b - position 02 of the transformation matrix
c - position 10 of the transformation matrix
d - position 11 of the transformation matrix
tx - position 03 of the transformation matrix
ty - position 13 of the transformation matrix
Method Detail

createMatrix

public static JDFMatrix createMatrix(String s)
factory for JDFXYPair that silently returns null in case of illegal strings

Parameters:
s - the string to parse
Returns:
the JDFXYPair, null if s is not compatible

isValid

public boolean isValid()
                throws DataFormatException
isValid - true if the size of the vector is 6 and all instances are Double types

Specified by:
isValid in class JDFNumList
Returns:
boolean - true if all instances are Double or Integer types
Throws:
DataFormatException - - if the Vector has not a valid format

getA

public double getA()
getA - returns the first coordinate

Returns:
the first coordinate

setA

public void setA(double p_a)
setA - sets the first coordinate

Parameters:
p_a - the first coordinate

getB

public double getB()
getB - returns the second coordinate

Returns:
double - the second coordinate

setB

public void setB(double p_b)
setB - sets the second coordinate

Parameters:
p_b - the first coordinate

getC

public double getC()
getC - returns the third coordinate

Returns:
double - the third coordinate

setC

public void setC(double p_c)
setC - sets the third coordinate

Parameters:
p_c - the third coordinate

getD

public double getD()
getD - returns the fourth coordinate

Returns:
double - the fourth coordinate

setD

public void setD(double p_d)
setD - sets the fourth coordinate

Parameters:
p_d - the fourth coordinate

getTx

public double getTx()
getTx - returns the tx coordinate

Returns:
double - the tx coordinate

setTx

public void setTx(double p_tx)
setTx - sets the tx coordinate

Parameters:
p_tx - the tx coordinate

getTy

public double getTy()
getTy - returns the ty coordinate

Returns:
double - the ty coordinate

setTy

public void setTy(double p_ty)
setTy - sets the ty coordinate

Parameters:
p_ty - the ty coordinate

equals

public boolean equals(Object other)
equals - returns true if both JDFMatrices are equal, otherwise false

Specified by:
equals in interface Collection<Object>
Specified by:
equals in interface List<Object>
Overrides:
equals in class JDFNumList
Returns:
boolean - true if equal otherwise false

hashCode

public int hashCode()
hashCode complements equals() to fulfill the equals/hashCode contract

Specified by:
hashCode in interface Collection<Object>
Specified by:
hashCode in interface List<Object>
Overrides:
hashCode in class JDFNumList

getAffineTransform

public AffineTransform getAffineTransform()
getAffineTransform -

Returns:
AffineTransform

setAffineTransform

public void setAffineTransform(AffineTransform affineTrans)
setAffineTransform -

Parameters:
affineTrans - matrix to be stored

shift

public void shift(double tx,
                  double ty)
shifts Tx and Ty by the amount specified

Parameters:
tx - shift in x direction
ty - shift in y direction

rotate

public void rotate(double degrees)
rotate this by degrees degrees CouterClockwise

Parameters:
degrees - the degrees to rotate by in counterclockwise direction

concat

public void concat(JDFMatrix m)
concatinates this with m

Parameters:
m - the matrix to concatinate

shift

public void shift(JDFXYPair point)
shift this matrix by an xypair

Parameters:
point - the point to shift by


Copyright © 2013. All Rights Reserved.