org.deegree.cs.transformations.coordinate
Class MatrixTransform

java.lang.Object
  extended by org.deegree.cs.CRSIdentifiable
      extended by org.deegree.cs.transformations.Transformation
          extended by org.deegree.cs.transformations.coordinate.MatrixTransform
All Implemented Interfaces:
Object, TypedObjectNode, CRSResource

public class MatrixTransform
extends Transformation

The MatrixTransform class allows transformations using matrices. Although technically n × m matrices are possible, at the moment only 2 × 2, 3 × 3 and 4 × 4 matrices are supported.

Version:
$Revision: 30120 $, $Date: 2011-03-22 10:04:15 +0100 (Tue, 22 Mar 2011) $
Author:
Rutger Bezema, last edited by: $Author: aschmitz $

Constructor Summary
MatrixTransform(ICRS source, ICRS target, javax.vecmath.GMatrix matrix)
          Construct a transform.
MatrixTransform(ICRS source, ICRS target, javax.vecmath.GMatrix matrix, CRSResource id)
          Construct a transform.
MatrixTransform(ICRS source, ICRS target, javax.vecmath.Matrix3d matrix)
          Construct a 3d transform.
MatrixTransform(ICRS source, ICRS target, javax.vecmath.Matrix3d matrix, CRSResource id)
          Construct a 3d transform.
MatrixTransform(ICRS source, ICRS target, javax.vecmath.Matrix4d matrix)
          Construct a 4d transform.
MatrixTransform(ICRS source, ICRS target, javax.vecmath.Matrix4d matrix, CRSResource id)
          Construct a 4d transform.
MatrixTransform(ICRS source, ICRS target, javax.vecmath.Matrix4d matrix, String transformationName)
          Construct a 4d transform.
MatrixTransform(ICRS source, ICRS target, javax.vecmath.Matrix4d matrix, String transformationName, CRSResource id)
          Construct a 4d transform.
 
Method Summary
static Transformation createAllignMatrixTransform(ICRS sourceCRS, ICRS targetCRS)
          Create a swap matrix to align the axis of the given coordinate systems and create a tranformation for the result.
static MatrixTransform createMatrixTransform(ICRS sourceCRS, ICRS targetCRS, Matrix matrix)
          Creates a Matrix transform from a matrix.
 List<javax.vecmath.Point3d> doTransform(List<javax.vecmath.Point3d> srcPts)
          Do a transformation, e.g. the incoming data will be transformed into other coordinates.
 boolean equals(Object object)
           
 int getDimSource()
           
 int getDimTarget()
           
 String getImplementationName()
           
 javax.vecmath.GMatrix getMatrix()
           
 int hashCode()
          Implementation as proposed by Joshua Block in Effective Java (Addison-Wesley 2001), which supplies an even distribution and is relatively fast.
 boolean isIdentity()
           
 
Methods inherited from class org.deegree.cs.transformations.Transformation
areInverse, canTransform, contains, copyTransformation, createFromTo, doTransform, doTransform, equalOnCRS, getSourceCRS, getSourceDimension, getTargetCRS, getTargetDimension, getTransformationName, getTransformationPath, inverse, isInverseTransform, setSourceCRS
 
Methods inherited from class org.deegree.cs.CRSIdentifiable
addAreaOfUse, addName, checkForNullObject, checkForNullObject, checkForNullObject, getAreaOfUse, getAreaOfUseBBox, getAreasOfUse, getCode, getCodeAndName, getCodes, getDescription, getDescriptions, getId, getName, getNames, getOrignalCodeStrings, getVersion, getVersions, hasCode, hasId, hasIdOrName, setDefaultAreaOfUse, setDefaultDescription, setDefaultId, setDefaultName, setDefaultVersion, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MatrixTransform

public MatrixTransform(ICRS source,
                       ICRS target,
                       javax.vecmath.GMatrix matrix,
                       CRSResource id)
Construct a transform.

Parameters:
source - the source coordinate system
target - the target coordinate system.
matrix -
id - an identifiable instance containing information about this transformation

MatrixTransform

public MatrixTransform(ICRS source,
                       ICRS target,
                       javax.vecmath.GMatrix matrix)
Construct a transform.

Parameters:
source - the source coordinate system
target - the target coordinate system.
matrix -

MatrixTransform

public MatrixTransform(ICRS source,
                       ICRS target,
                       javax.vecmath.Matrix3d matrix,
                       CRSResource id)
Construct a 3d transform.

Parameters:
source - the source coordinate system
target - the target coordinate system.
matrix -
id - an identifiable instance containing information about this transformation

MatrixTransform

public MatrixTransform(ICRS source,
                       ICRS target,
                       javax.vecmath.Matrix3d matrix)
Construct a 3d transform.

Parameters:
source - the source coordinate system
target - the target coordinate system.
matrix -

MatrixTransform

public MatrixTransform(ICRS source,
                       ICRS target,
                       javax.vecmath.Matrix4d matrix,
                       CRSResource id)
Construct a 4d transform.

Parameters:
source - the source coordinate system
target - the target coordinate system.
matrix -
id - an identifiable instance containing information about this transformation

MatrixTransform

public MatrixTransform(ICRS source,
                       ICRS target,
                       javax.vecmath.Matrix4d matrix)
Construct a 4d transform.

Parameters:
source - the source coordinate system
target - the target coordinate system.
matrix -

MatrixTransform

public MatrixTransform(ICRS source,
                       ICRS target,
                       javax.vecmath.Matrix4d matrix,
                       String transformationName,
                       CRSResource id)
Construct a 4d transform.

Parameters:
source - the source coordinate system
target - the target coordinate system.
matrix -
transformationName - the 'optional' name of the transformation, which is useful to specify the 'helmert' transformation.
id - an identifiable instance containing information about this transformation

MatrixTransform

public MatrixTransform(ICRS source,
                       ICRS target,
                       javax.vecmath.Matrix4d matrix,
                       String transformationName)
Construct a 4d transform.

Parameters:
source - the source coordinate system
target - the target coordinate system.
matrix -
transformationName - the 'optional' name of the transformation, which is useful to specify the 'helmert' transformation.
Method Detail

doTransform

public List<javax.vecmath.Point3d> doTransform(List<javax.vecmath.Point3d> srcPts)
Description copied from class: Transformation
Do a transformation, e.g. the incoming data will be transformed into other coordinates.

Specified by:
doTransform in class Transformation
Parameters:
srcPts - the points which must be transformed, expected are following values either, long_1, lat_1, height_1, long_2, lat_2, height_2. or long_1, lat_1, long_2, lat_2
Returns:
the transformed points

getDimSource

public int getDimSource()
Returns:
the dimension of input points.

getDimTarget

public int getDimTarget()
Returns:
the dimension of output points.

isIdentity

public boolean isIdentity()
Specified by:
isIdentity in class Transformation
Returns:
true if this transformation holds an identity matrix (e.g. doesn't transform at all).

equals

public boolean equals(Object object)
Overrides:
equals in class Transformation

hashCode

public int hashCode()
Implementation as proposed by Joshua Block in Effective Java (Addison-Wesley 2001), which supplies an even distribution and is relatively fast. It is created from field f as follows:

Combining the hash code(s) computed above: result = 37 * result + code;

Overrides:
hashCode in class CRSIdentifiable
Returns:
(int) ( result >>> 32 ) ^ (int) result;
See Also:
Object.hashCode()

getMatrix

public final javax.vecmath.GMatrix getMatrix()
Returns:
the matrix.

getImplementationName

public String getImplementationName()
Specified by:
getImplementationName in class Transformation
Returns:
the name of the transformation.

createMatrixTransform

public static MatrixTransform createMatrixTransform(ICRS sourceCRS,
                                                    ICRS targetCRS,
                                                    Matrix matrix)
                                             throws TransformationException
Creates a Matrix transform from a matrix.

Parameters:
sourceCRS - used as the CRS for transforming ordinates on the matrix
targetCRS - used as the result CRS after transforming ordinates on the matrix
matrix - The matrix used to define the affine transform.
Returns:
A MatrixTransform mapping incoming ordinates given in the sourceCRS to the targetCRS.
Throws:
TransformationException - if the matrix is not affine.

createAllignMatrixTransform

public static Transformation createAllignMatrixTransform(ICRS sourceCRS,
                                                         ICRS targetCRS)
                                                  throws TransformationException
Create a swap matrix to align the axis of the given coordinate systems and create a tranformation for the result.

Parameters:
sourceCRS - used as the CRS for transforming ordinates on the matrix
targetCRS - used as the result CRS after transforming ordinates on the matrix
Returns:
an axis aligned matrix transform, or null if the source and/or target are null or no transformation is needed.
Throws:
TransformationException - if the matrix could not be created or the result is not affine.


Copyright © 2011. All Rights Reserved.