deegree 2.3 (2010/04/09 10:10 build-4-official)

org.deegree.crs.transformations
Class Transformation

java.lang.Object
  extended by org.deegree.crs.Identifiable
      extended by org.deegree.crs.transformations.Transformation
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
CRSTransformation, Helmert, PolynomialTransformation

public abstract class Transformation
extends Identifiable
implements Serializable

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: 18195 $, $Date: 2009-06-18 17:55:39 +0200 (Do, 18. Jun 2009) $
Author:
Rutger Bezema, last edited by: $Author: mschneider $
See Also:
Serialized Form

Constructor Summary
Transformation(CoordinateSystem sourceCRS, CoordinateSystem targetCRS, Identifiable 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.
static String createFromTo(String source, String dest)
          Little helper function to create a temporary id or name.
 void doTransform(double[] srcCoords, int startPositionSrc, double[] destCoords, int startPositionDest, int lastCoord)
          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).
abstract  String getImplementationName()
           
 CoordinateSystem getSourceCRS()
           
 int getSourceDimension()
           
 CoordinateSystem 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(CoordinateSystem newSource)
           
 
Methods inherited from class org.deegree.crs.Identifiable
checkForNullObject, checkForNullObject, checkForNullObject, equals, getAreaOfUse, getAreaOfUseBBox, getAreasOfUse, getDescription, getDescriptions, getIdAndName, getIdentifier, getIdentifiers, getName, getNames, getVersion, getVersions, hasID, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Transformation

public Transformation(CoordinateSystem sourceCRS,
                      CoordinateSystem targetCRS,
                      Identifiable 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[] srcCoords,
                        int startPositionSrc,
                        double[] destCoords,
                        int startPositionDest,
                        int lastCoord)
                 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:
srcCoords - the array holding the source ('original') coordinates.
startPositionSrc - the position to start reading the coordinates from the source array (0 is the first).
destCoords - 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.
lastCoord - the index of the last coordinate (normally length-1)
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 CoordinateSystem getSourceCRS()
Returns:
the sourceCRS.

getTargetCRS

public final CoordinateSystem getTargetCRS()
Returns:
the targetCRS.

getSourceDimension

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

getTargetDimension

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

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.

setSourceCRS

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

deegree 2.3 (2010/04/09 10:10 build-4-official)

an open source project founded by lat/lon, Bonn, Germany.
For more information visit: http://www.deegree.org