org.geotools.referencing.piecewise
Class MathTransform1DAdapter

Object
  extended by MathTransform1DAdapter
All Implemented Interfaces:
MathTransform, MathTransform1D

public class MathTransform1DAdapter
extends Object
implements MathTransform1D

Adapter class for MathTransform1D.

Simple adapter for MathTransform1D it provides some convenience methods for implementors.

Note that it throw an UnsupportedOperationException for the operations that must be implemented by implementors, namely:

  1. transform methods
  2. inverse methods
  3. derivative methods

Author:
Simone Giannecchini, GeoSolutions.

Constructor Summary
MathTransform1DAdapter()
           
 
Method Summary
 Matrix derivative(DirectPosition point)
          Gets the derivative of this transform at a point.
 double derivative(double value)
          Gets the derivative of this function at a value.
 int getSourceDimensions()
          Gets the dimension of input points.
 int getTargetDimensions()
          Gets the dimension of output points.
 MathTransform1D inverse()
          Creates the inverse transform of this object.
 boolean isIdentity()
          Tests whether this transform does not move any points.
 String toWKT()
          Returns a Well Known Text (WKT) for this object.
 DirectPosition transform(DirectPosition ptSrc, DirectPosition ptDst)
          Transforms the specified ptSrc and stores the result in ptDst.
 double transform(double value)
          Transforms the specified value.
 void transform(double[] arg0, int arg1, double[] arg2, int arg3, int arg4)
          Transforms a list of coordinate point ordinal values.
 void transform(double[] arg0, int arg1, float[] arg2, int arg3, int arg4)
          Transforms a list of coordinate point ordinal values.
 void transform(float[] arg0, int arg1, double[] arg2, int arg3, int arg4)
          Transforms a list of coordinate point ordinal values.
 void transform(float[] arg0, int arg1, float[] arg2, int arg3, int arg4)
          Transforms a list of coordinate point ordinal values.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MathTransform1DAdapter

public MathTransform1DAdapter()
Method Detail

derivative

public double derivative(double value)
                  throws TransformException
Description copied from interface: MathTransform1D
Gets the derivative of this function at a value. The derivative is the 1×1 matrix of the non-translating portion of the approximate affine map at the value.

Specified by:
derivative in interface MathTransform1D
Parameters:
value - The value where to evaluate the derivative.
Returns:
The derivative at the specified point.
Throws:
TransformException - if the derivative can't be evaluated at the specified point.

transform

public double transform(double value)
                 throws TransformException
Description copied from interface: MathTransform1D
Transforms the specified value.

Specified by:
transform in interface MathTransform1D
Parameters:
value - The value to transform.
Returns:
the transformed value.
Throws:
TransformException - if the value can't be transformed.

derivative

public Matrix derivative(DirectPosition point)
                  throws MismatchedDimensionException,
                         TransformException
Description copied from interface: MathTransform
Gets the derivative of this transform at a point. The derivative is the matrix of the non-translating portion of the approximate affine map at the point. The matrix will have dimensions corresponding to the source and target coordinate systems. If the input dimension is M, and the output dimension is N, then the matrix will have size N×M. The elements of the matrix {en,m : n=0..(N-1)} form a vector in the output space which is parallel to the displacement caused by a small change in the m'th ordinate in the input space.

For example, if the input dimension is 4 and the output dimension is 3, then a small displacement (x0, x1, x2, x3) in the input space will result in a displacement (y0, y1, y2) in the output space computed as below (en,m are the matrix's elements):

 [ y0 ]     [ e00  e01  e02  e03 ] [ x0 ]
 [ y1 ]  =  [ e10  e11  e12  e13 ] [ x1 ]
 [ y2 ]     [ e20  e21  e22  e23 ] [ x2 ]
                                   [ x3 ]
 

Specified by:
derivative in interface MathTransform
Parameters:
point - The coordinate point where to evaluate the derivative. Null value is accepted only if the derivative is the same everywhere. For example affine transform accept null value since they produces identical derivative no matter the coordinate value. But most map projection will requires a non-null value.
Returns:
The derivative at the specified point (never null). This method never returns an internal object: changing the matrix will not change the state of this math transform.
Throws:
MismatchedDimensionException - if point doesn't have the expected dimension.
TransformException - if the derivative can't be evaluated at the specified point.

getSourceDimensions

public int getSourceDimensions()
Description copied from interface: MathTransform
Gets the dimension of input points.

Specified by:
getSourceDimensions in interface MathTransform
Returns:
The dimension of input points.

getTargetDimensions

public int getTargetDimensions()
Description copied from interface: MathTransform
Gets the dimension of output points.

Specified by:
getTargetDimensions in interface MathTransform
Returns:
The dimension of output points.

inverse

public MathTransform1D inverse()
                        throws NoninvertibleTransformException
Description copied from interface: MathTransform1D
Creates the inverse transform of this object.

Specified by:
inverse in interface MathTransform
Specified by:
inverse in interface MathTransform1D
Returns:
The inverse transform.
Throws:
NoninvertibleTransformException - if the transform can't be inversed.

isIdentity

public boolean isIdentity()
Description copied from interface: MathTransform
Tests whether this transform does not move any points.

Specified by:
isIdentity in interface MathTransform
Returns:
true if this MathTransform is an identity transform; false otherwise.

toWKT

public String toWKT()
Description copied from interface: MathTransform
Returns a Well Known Text (WKT) for this object. Well know text are defined in extended Backus Naur form. This operation may fails if an object is too complex for the WKT format capability.

Specified by:
toWKT in interface MathTransform
Returns:
The Well Known Text (WKT) for this object.

transform

public DirectPosition transform(DirectPosition ptSrc,
                                DirectPosition ptDst)
                         throws MismatchedDimensionException,
                                TransformException
Description copied from interface: MathTransform
Transforms the specified ptSrc and stores the result in ptDst. If ptDst is null, a new DirectPosition object is allocated and then the result of the transformation is stored in this object. In either case, ptDst, which contains the transformed point, is returned for convenience. If ptSrc and ptDst are the same object, the input point is correctly overwritten with the transformed point.

Specified by:
transform in interface MathTransform
Parameters:
ptSrc - the specified coordinate point to be transformed.
ptDst - the specified coordinate point that stores the result of transforming ptSrc, or null.
Returns:
the coordinate point after transforming ptSrc and storing the result in ptDst, or a newly created point if ptDst was null.
Throws:
MismatchedDimensionException - if ptSrc or ptDst doesn't have the expected dimension.
TransformException - if the point can't be transformed.

transform

public void transform(double[] arg0,
                      int arg1,
                      double[] arg2,
                      int arg3,
                      int arg4)
               throws TransformException
Description copied from interface: MathTransform
Transforms a list of coordinate point ordinal values. This method is provided for efficiently transforming many points. The supplied array of ordinal values will contain packed ordinal values. For example, if the source dimension is 3, then the ordinals will be packed in this order: (x0,y0,z0, x1,y1,z1 ...).

Specified by:
transform in interface MathTransform
Parameters:
arg0 - the array containing the source point coordinates.
arg1 - the offset to the first point to be transformed in the source array.
arg2 - the array into which the transformed point coordinates are returned. May be the same than srcPts.
arg3 - the offset to the location of the first transformed point that is stored in the destination array.
arg4 - the number of point objects to be transformed.
Throws:
TransformException - if a point can't be transformed. Some implementations will stop at the first failure, wile some other implementations will fill the untransformable points with NaN values, continue and throw the exception only at end. Implementations that fall in the later case should set the last completed transform to this.

transform

public void transform(float[] arg0,
                      int arg1,
                      float[] arg2,
                      int arg3,
                      int arg4)
               throws TransformException
Description copied from interface: MathTransform
Transforms a list of coordinate point ordinal values. This method is provided for efficiently transforming many points. The supplied array of ordinal values will contain packed ordinal values. For example, if the source dimension is 3, then the ordinals will be packed in this order: (x0,y0,z0, x1,y1,z1 ...).

Specified by:
transform in interface MathTransform
Parameters:
arg0 - the array containing the source point coordinates.
arg1 - the offset to the first point to be transformed in the source array.
arg2 - the array into which the transformed point coordinates are returned. May be the same than srcPts.
arg3 - the offset to the location of the first transformed point that is stored in the destination array.
arg4 - the number of point objects to be transformed.
Throws:
TransformException - if a point can't be transformed. Some implementations will stop at the first failure, wile some other implementations will fill the untransformable points with NaN values, continue and throw the exception only at end. Implementations that fall in the later case should set the last completed transform to this.

transform

public void transform(float[] arg0,
                      int arg1,
                      double[] arg2,
                      int arg3,
                      int arg4)
               throws TransformException
Description copied from interface: MathTransform
Transforms a list of coordinate point ordinal values. This method is provided for efficiently transforming many points. The supplied array of ordinal values will contain packed ordinal values. For example, if the source dimension is 3, then the ordinals will be packed in this order: (x0,y0,z0, x1,y1,z1 ...).

Specified by:
transform in interface MathTransform
Parameters:
arg0 - the array containing the source point coordinates.
arg1 - the offset to the first point to be transformed in the source array.
arg2 - the array into which the transformed point coordinates are returned.
arg3 - the offset to the location of the first transformed point that is stored in the destination array.
arg4 - the number of point objects to be transformed.
Throws:
TransformException - if a point can't be transformed. Some implementations will stop at the first failure, wile some other implementations will fill the untransformable points with NaN values, continue and throw the exception only at end. Implementations that fall in the later case should set the last completed transform to this.

transform

public void transform(double[] arg0,
                      int arg1,
                      float[] arg2,
                      int arg3,
                      int arg4)
               throws TransformException
Description copied from interface: MathTransform
Transforms a list of coordinate point ordinal values. This method is provided for efficiently transforming many points. The supplied array of ordinal values will contain packed ordinal values. For example, if the source dimension is 3, then the ordinals will be packed in this order: (x0,y0,z0, x1,y1,z1 ...).

Specified by:
transform in interface MathTransform
Parameters:
arg0 - the array containing the source point coordinates.
arg1 - the offset to the first point to be transformed in the source array.
arg2 - the array into which the transformed point coordinates are returned.
arg3 - the offset to the location of the first transformed point that is stored in the destination array.
arg4 - the number of point objects to be transformed.
Throws:
TransformException - if a point can't be transformed. Some implementations will stop at the first failure, wile some other implementations will fill the untransformable points with NaN values, continue and throw the exception only at end. Implementations that fall in the later case should set the last completed transform to this.


Copyright © 1996-2014 Geotools. All Rights Reserved.