org.deegree.cs.transformations
Class Transformation

java.lang.Object
  extended by org.deegree.cs.CRSIdentifiable
      extended by org.deegree.cs.transformations.Transformation
All Implemented Interfaces:
Object, TypedObjectNode, CRSResource
Direct Known Subclasses:
AbstractTransformation, AxisFlipTransformation, ConcatenatedTransform, DirectTransform, GeocentricTransform, Helmert, IdentityTransform, MatrixTransform, NotSupportedTransformation, NTv2Transformation, PolynomialTransformation, ProjectionTransform

public abstract class Transformation
extends CRSIdentifiable

The Transformation class supplies the most basic method interface for any given transformation. The change of coordinates from one CRS to another CRS based on different datum is 'currently' only possible via a coordinate Transformation.

The derivation of transformation parameters can be done empirically or analytically.

The quality (accuracy) of an empirical derivation strongly depends on the chosen reference points, there allocation, and their number. Therefore different realizations for transformations from one datum to another exist. *

An analytic derivation is precise but mostly too complex to evaluate.

Version:
$Revision: 29642 $, $Date: 2011-02-11 13:59:33 +0100 (Fri, 11 Feb 2011) $
Author:
Rutger Bezema, last edited by: $Author: lbuesching $

Constructor Summary
Transformation(ICRS sourceCRS, ICRS targetCRS, CRSResource id)
           
 
Method Summary
 boolean areInverse(Transformation other)
          Checks if this transformation is the inverse of the other transformation, which means, this.sourceCRS equals other.targetCRS && this.targetCRS == other.sourceCRS.
 boolean canTransform(ICRS sourceCRS, ICRS targetCRS)
           
 boolean contains(ICRS crs)
          Returns true if this Transformation transforms over the given crs.
 Transformation copyTransformation(CRSResource newId)
           
static String createFromTo(String source, String dest)
          Little helper function to create a temporary id or name.
 void doTransform(double[] srcOrdinates, int startPositionSrc, double[] destOrdinates, int startPositionDest, int length)
          Wraps the incoming coordinates into a List and calls the doTransform(List).
abstract  List<javax.vecmath.Point3d> doTransform(List<javax.vecmath.Point3d> srcPts)
          Do a transformation, e.g. the incoming data will be transformed into other coordinates.
 javax.vecmath.Point3d doTransform(javax.vecmath.Point3d coordinate)
          Transforms a single point3d (by calling the doTransform( List).
 boolean equalOnCRS(Transformation other)
          Returns true if the source and target of this transformation equal the source and target of the given transformation.
 boolean equals(Object other)
           
abstract  String getImplementationName()
           
 ICRS getSourceCRS()
           
 int getSourceDimension()
           
 ICRS getTargetCRS()
           
 int getTargetDimension()
           
 String getTransformationName()
           
 StringBuilder getTransformationPath(StringBuilder sb)
           
 void inverse()
          This method flags the transformation about it's state.
abstract  boolean isIdentity()
           
 boolean isInverseTransform()
           
 void setSourceCRS(ICRS newSource)
           
 
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, hashCode, 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

Transformation

public Transformation(ICRS sourceCRS,
                      ICRS targetCRS,
                      CRSResource id)
Parameters:
sourceCRS -
targetCRS -
id - an identifiable instance containing information about this transformation
Method Detail

getImplementationName

public abstract String getImplementationName()
Returns:
the name of the transformation.

doTransform

public abstract List<javax.vecmath.Point3d> doTransform(List<javax.vecmath.Point3d> srcPts)
                                                 throws TransformationException
Do a transformation, e.g. the incoming data will be transformed into other coordinates.

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
Throws:
TransformationException - if a transform could not be calculated.

isIdentity

public abstract boolean isIdentity()
Returns:
true if this transformation doesn't transform the incoming points. (e.g. is the id. matrix)

createFromTo

public static String createFromTo(String source,
                                  String dest)
Little helper function to create a temporary id or name.

Parameters:
source - containing the value (id or name) of the 'src' coourdinateSystem
dest - containing the value (id or name) of the 'dest' coourdinateSystem
Returns:
a following string "_SRC_fromValue_DEST_toValue".

doTransform

public void doTransform(double[] srcOrdinates,
                        int startPositionSrc,
                        double[] destOrdinates,
                        int startPositionDest,
                        int length)
                 throws TransformationException
Wraps the incoming coordinates into a List and calls the doTransform(List). The source array will be read according to the dimension of the source CRS getSourceDimension() and the target coordinates will be put according to the dimension of the targetCRS getTargetDimension(). If the sourceDim < 2 or > 3 a transformation exception will be thrown.

Parameters:
srcOrdinates - the array holding the source ('original') coordinates.
startPositionSrc - the position to start reading the coordinates from the source array (0 is the first).
destOrdinates - the array which will receive the transformed coordinates.
startPositionDest - the index of the destCoords array to put the results, if the result will exceed the array.length, the array will be enlarged to hold the transformed coordinates.
length - the number of source ordinates to transform
Throws:
TransformationException - If the sourceDim < 2 or soureDim > 3;
IllegalArgumentException - if
  • the srcCoords is null
  • the startPositionSrc > srcCoords.length
  • the lastCoord > startPositionSrc
  • the number of source coordinates are not congruent with the source dimension
  • the lastCoord < startCoordSrc
  • the source or target dimension < 2 or > 3

doTransform

public javax.vecmath.Point3d doTransform(javax.vecmath.Point3d coordinate)
                                  throws TransformationException
Transforms a single point3d (by calling the doTransform( List).

Parameters:
coordinate - to transform, if null null will be returned.
Returns:
the transformed coordinate.
Throws:
TransformationException - if the coordinate could not be transformed from the sourceCRS to the targetCRS.

isInverseTransform

public boolean isInverseTransform()
Returns:
true if the doInverseTransform method should be called, false otherwise.

inverse

public void inverse()
This method flags the transformation about it's state. If this transformation was inverse calling this method will result in a forward transformation and vice versa.


getTransformationName

public String getTransformationName()
Returns:
a representation of this transformations name, including the 'Forward' or 'Inverse' modifier.

getSourceCRS

public final ICRS getSourceCRS()
Returns:
the sourceCRS.

getTargetCRS

public final ICRS getTargetCRS()
Returns:
the targetCRS.

getSourceDimension

public int getSourceDimension()
Returns:
the dimension of the source ICoordinateSystem.

getTargetDimension

public int getTargetDimension()
Returns:
the dimension of the target ICoordinateSystem.

areInverse

public boolean areInverse(Transformation other)
Checks if this transformation is the inverse of the other transformation, which means, this.sourceCRS equals other.targetCRS && this.targetCRS == other.sourceCRS. If Both transformations are identity this method also returns true.

Parameters:
other - the transformation to check
Returns:
true if this and the other transformation are each others inverse.

getTransformationPath

public final StringBuilder getTransformationPath(StringBuilder sb)
Parameters:
sb - to add the transformation chain to, if null a new StringBuilder will be created.
Returns:
the given StringBuilder (or a new instance) with the appended transformation steps.

equalOnCRS

public boolean equalOnCRS(Transformation other)
Returns true if the source and target of this transformation equal the source and target of the given transformation.

Parameters:
other - transformation to check against
Returns:
true if the source and target coordinate systems of this transformation equal the source and target coordinate systems of the given transformation.

contains

public boolean contains(ICRS crs)
Returns true if this Transformation transforms over the given crs.

Parameters:
crs - to check for
Returns:
true if the given crs is used in this transformation.

setSourceCRS

public void setSourceCRS(ICRS newSource)
Parameters:
newSource - to be used as the new source coordinate system.

canTransform

public boolean canTransform(ICRS sourceCRS,
                            ICRS targetCRS)
Parameters:
sourceCRS - from which ordinates will be transformed
targetCRS - to which ordinates will be transformed.
Returns:
true if this transformation can transform from the given source CRS to the target CRS.

equals

public boolean equals(Object other)
Overrides:
equals in class CRSIdentifiable

copyTransformation

public Transformation copyTransformation(CRSResource newId)


Copyright © 2011. All Rights Reserved.