deegree 2.2 (2008/12/22 11:33 build-3038-official)

org.deegree.crs.transformations
Class CRSTransformation

java.lang.Object
  extended by org.deegree.crs.Identifiable
      extended by org.deegree.crs.transformations.CRSTransformation
Direct Known Subclasses:
ConcatenatedTransform, GeocentricTransform, MatrixTransform, ProjectionTransform

public abstract class CRSTransformation
extends Identifiable

The change of coordinates from one CRS to another CRS based on different datum is 'currently' only possible via a coordinate Transformation.

The transformation parameters could only be derived empirically by a set of points common to both coordinate reference systems it means by identical points. Choice, allocation, number and the quality of coordinates of the points affect extensive the results and the accuracy. Therefore different realizations for transformations from one datum to another exist.

Version:
$Revision:$, $Date:$
Author:
Rutger Bezema, last edited by: $Author:$

Field Summary
(package private)  boolean isInverse
           
 
Constructor Summary
CRSTransformation(CoordinateSystem sourceCRS, CoordinateSystem targetCRS)
          Creates a CRSTransformation with following identifier and name: FROM_id1_TO_id2.
CRSTransformation(CoordinateSystem source, CoordinateSystem target, String identifier)
          This constructor creates takes the id.
CRSTransformation(CoordinateSystem sourceCRS, CoordinateSystem targetCRS, String[] identifiers)
           
CRSTransformation(CoordinateSystem sourceCRS, CoordinateSystem targetCRS, String[] identifiers, String[] names, String[] versions, String[] descriptions, String[] areasOfUse)
           
CRSTransformation(CoordinateSystem sourceCRS, CoordinateSystem targetCRS, String identifier, String name, String version, String description, String areaOfUse)
           
 
Method Summary
 boolean areInverse(CRSTransformation other)
          Checks if this transformation is the inverse of the other transformation, which means, this.sourceCRS equals other.targetCRS && this.targetCRS == other.sourceCRS.
protected static String createFromTo(String from, String to)
          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 coords 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 comes from the sourceCRS and must be transformed to the targetCRS.
 javax.vecmath.Point3d doTransform(javax.vecmath.Point3d coordinate)
          Transforms a single point3d (by calling the doTransform( List).
 CoordinateSystem getSourceCRS()
           
 int getSourceDimension()
           
 CoordinateSystem getTargetCRS()
           
 int getTargetDimension()
           
 String getTransformationName()
           
 StringBuilder getTransformationPath(StringBuilder sb)
           
 void inverse()
          Call this method to indicate the transform should be inverse (or not).
abstract  boolean isIdentity()
           
 boolean isInverseTransform()
           
 
Methods inherited from class org.deegree.crs.Identifiable
checkForNullObject, checkForNullObject, getAreaOfUse, getAreasOfUse, getDescription, getDescriptions, getIdAndName, getIdentifier, getIdentifiers, getName, getNames, getVersion, getVersions, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

isInverse

boolean isInverse
Constructor Detail

CRSTransformation

public CRSTransformation(CoordinateSystem sourceCRS,
                         CoordinateSystem targetCRS,
                         String[] identifiers)
Parameters:
sourceCRS -
targetCRS -
identifiers -

CRSTransformation

public CRSTransformation(CoordinateSystem sourceCRS,
                         CoordinateSystem targetCRS,
                         String[] identifiers,
                         String[] names,
                         String[] versions,
                         String[] descriptions,
                         String[] areasOfUse)
Parameters:
sourceCRS -
targetCRS -
identifiers -
names -
versions -
descriptions -
areasOfUse -

CRSTransformation

public CRSTransformation(CoordinateSystem sourceCRS,
                         CoordinateSystem targetCRS,
                         String identifier,
                         String name,
                         String version,
                         String description,
                         String areaOfUse)
Parameters:
sourceCRS -
targetCRS -
identifier -
name -
version -
description -
areaOfUse -

CRSTransformation

public CRSTransformation(CoordinateSystem source,
                         CoordinateSystem target,
                         String identifier)
This constructor creates takes the id. Name, Version, description and areaOfUse are set to null.

Parameters:
source - the geographic crs.
target - the geocentric crs.
identifier -

CRSTransformation

public CRSTransformation(CoordinateSystem sourceCRS,
                         CoordinateSystem targetCRS)
Creates a CRSTransformation with following identifier and name: FROM_id1_TO_id2. The name will be generated the same way (with getName() instead). And version, description and areaOfUse set to 'Unkown'.

Parameters:
sourceCRS -
targetCRS -
Method Detail

createFromTo

protected static String createFromTo(String from,
                                     String to)
Little helper function to create a temporary id or name.

Parameters:
from - containing the value (id or name) of the 'from' coourdinateSystem
to - containing the value (id or name) of the 'to' coourdinateSystem
Returns:
a following string "FROM_fromValue_TO_toValue".

doTransform

public abstract List<javax.vecmath.Point3d> doTransform(List<javax.vecmath.Point3d> srcPts)
Do a transformation, e.g. the incoming data comes from the sourceCRS and must be transformed to the targetCRS.

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

doTransform

public void doTransform(double[] srcCoords,
                        int startPositionSrc,
                        double[] destCoords,
                        int startPositionDest,
                        int lastCoord)
                 throws TransformationException
Wraps the incoming coords 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 coords 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') coords.
startPositionSrc - the position to start reading the coords from the source array (0 is the first).
destCoords - the array which will receive the tranformed coords.
startPositionDest - the index of the destCoords array to put the results, if the result will exceed the arraylength, the array will be enlarged to hold the transformed coords.
lastCoord - the index of the last coord (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 coords are not kongruent 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)
Transforms a single point3d (by calling the doTransform( List).

Parameters:
coordinate - to transform, if null null will be returned.
Returns:
the transformed coordinate.

isIdentity

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

isInverseTransform

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

inverse

public void inverse()
Call this method to indicate the transform should be inverse (or not).


getTransformationName

public String getTransformationName()
Returns:
a representation of this transformations name.

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(CRSTransformation 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 eachothers 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.

deegree 2.2 (2008/12/22 11:33 build-3038-official)

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