Class MathTransformProxy
- Object
-
- MathTransformProxy
-
- All Implemented Interfaces:
Serializable
,MathTransform
- Direct Known Subclasses:
MathTransformProvider.Delegate
public class MathTransformProxy extends Object implements MathTransform, Serializable
A math transform which delegates part of its work to an other math transform. This is used as a starting point for subclass wanting to modifies only some aspect of an existing math transform, or to attach additional informations to it. The default implementation delegates all method calls to the underlying transform. Subclasses typically override some of those methods.This class is serializable if the underlying transform is serializable too.
- Since:
- 2.2
- Author:
- Martin Desruisseaux (IRD)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description MathTransform
transform
The math transform on which to delegate the work.
-
Constructor Summary
Constructors Modifier Constructor Description protected
MathTransformProxy(MathTransform transform)
Creates a new proxy which delegates its work to the specified math transform.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Matrix
derivative(Position point)
Gets the derivative of this transform at a point.boolean
equals(Object object)
Compares the specified object with this inverse math transform for equality.int
getSourceDimensions()
Gets the dimension of input points.int
getTargetDimensions()
Gets the dimension of output points.int
hashCode()
Returns a hash code value for this math transform.MathTransform
inverse()
Returns the inverse of this math transform.boolean
isIdentity()
Tests whether this transform does not move any points.String
toString()
Returns a string representation for this transform.String
toWKT()
Returns a Well Known Text (WKT) for this transform.void
transform(double[] srcPts, int srcOff, double[] dstPts, int dstOff, int numPts)
Transforms a list of coordinate point ordinal values.void
transform(double[] srcPts, int srcOff, float[] dstPts, int dstOff, int numPts)
Transforms a list of coordinate point ordinal values.void
transform(float[] srcPts, int srcOff, double[] dstPts, int dstOff, int numPts)
Transforms a list of coordinate point ordinal values.void
transform(float[] srcPts, int srcOff, float[] dstPts, int dstOff, int numPts)
Transforms a list of coordinate point ordinal values.Position
transform(Position ptSrc, Position ptDst)
Transforms the specifiedptSrc
and stores the result inptDst
.
-
-
-
Field Detail
-
transform
public final MathTransform transform
The math transform on which to delegate the work.
-
-
Constructor Detail
-
MathTransformProxy
protected MathTransformProxy(MathTransform transform)
Creates a new proxy which delegates its work to the specified math transform.- Parameters:
transform
- The transform on which to delegate the work.
-
-
Method Detail
-
getSourceDimensions
public int getSourceDimensions()
Gets the dimension of input points.- Specified by:
getSourceDimensions
in interfaceMathTransform
- Returns:
- The dimension of input points.
-
getTargetDimensions
public int getTargetDimensions()
Gets the dimension of output points.- Specified by:
getTargetDimensions
in interfaceMathTransform
- Returns:
- The dimension of output points.
-
transform
public Position transform(Position ptSrc, Position ptDst) throws MismatchedDimensionException, TransformException
Transforms the specifiedptSrc
and stores the result inptDst
.- Specified by:
transform
in interfaceMathTransform
- Parameters:
ptSrc
- the specified coordinate point to be transformed.ptDst
- the specified coordinate point that stores the result of transformingptSrc
, ornull
.- Returns:
- the coordinate point after transforming
ptSrc
and storing the result inptDst
, or a newly created point ifptDst
was null. - Throws:
MismatchedDimensionException
- ifptSrc
orptDst
doesn't have the expected dimension.TransformException
- if the point can't be transformed.
-
transform
public void transform(double[] srcPts, int srcOff, double[] dstPts, int dstOff, int numPts) throws TransformException
Transforms a list of coordinate point ordinal values.- Specified by:
transform
in interfaceMathTransform
- Parameters:
srcPts
- the array containing the source point coordinates.srcOff
- the offset to the first point to be transformed in the source array.dstPts
- the array into which the transformed point coordinates are returned. May be the same thansrcPts
.dstOff
- the offset to the location of the first transformed point that is stored in the destination array.numPts
- 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 tothis
.
-
transform
public void transform(float[] srcPts, int srcOff, float[] dstPts, int dstOff, int numPts) throws TransformException
Transforms a list of coordinate point ordinal values.- Specified by:
transform
in interfaceMathTransform
- Parameters:
srcPts
- the array containing the source point coordinates.srcOff
- the offset to the first point to be transformed in the source array.dstPts
- the array into which the transformed point coordinates are returned. May be the same thansrcPts
.dstOff
- the offset to the location of the first transformed point that is stored in the destination array.numPts
- 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 tothis
.
-
transform
public void transform(float[] srcPts, int srcOff, double[] dstPts, int dstOff, int numPts) throws TransformException
Transforms a list of coordinate point ordinal values.- Specified by:
transform
in interfaceMathTransform
- Parameters:
srcPts
- the array containing the source point coordinates.srcOff
- the offset to the first point to be transformed in the source array.dstPts
- the array into which the transformed point coordinates are returned.dstOff
- the offset to the location of the first transformed point that is stored in the destination array.numPts
- 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 tothis
.
-
transform
public void transform(double[] srcPts, int srcOff, float[] dstPts, int dstOff, int numPts) throws TransformException
Transforms a list of coordinate point ordinal values.- Specified by:
transform
in interfaceMathTransform
- Parameters:
srcPts
- the array containing the source point coordinates.srcOff
- the offset to the first point to be transformed in the source array.dstPts
- the array into which the transformed point coordinates are returned.dstOff
- the offset to the location of the first transformed point that is stored in the destination array.numPts
- 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 tothis
.
-
derivative
public Matrix derivative(Position point) throws TransformException
Gets the derivative of this transform at a point.- Specified by:
derivative
in interfaceMathTransform
- 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:
TransformException
- if the derivative can't be evaluated at the specified point.
-
inverse
public MathTransform inverse() throws NoninvertibleTransformException
Returns the inverse of this math transform.- Specified by:
inverse
in interfaceMathTransform
- Returns:
- The inverse transform.
- Throws:
NoninvertibleTransformException
- if the transform can't be inversed.
-
isIdentity
public boolean isIdentity()
Tests whether this transform does not move any points.- Specified by:
isIdentity
in interfaceMathTransform
- Returns:
true
if thisMathTransform
is an identity transform;false
otherwise.
-
toWKT
public String toWKT() throws UnsupportedOperationException
Returns a Well Known Text (WKT) for this transform.- Specified by:
toWKT
in interfaceMathTransform
- Returns:
- The Well Known Text (WKT) for this object.
- Throws:
UnsupportedOperationException
- If this object can't be formatted as WKT.
-
toString
public String toString()
Returns a string representation for this transform.
-
equals
public boolean equals(Object object)
Compares the specified object with this inverse math transform for equality.
-
-