|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
ObjectFormattable
AbstractMathTransform
public abstract class AbstractMathTransform
Provides a default implementation for most methods required by the
MathTransform interface. AbstractMathTransform
provides a convenient base class from which other transform classes
can be easily derived. In addition, AbstractMathTransform
implements methods required by the MathTransform2D interface,
but does not implements MathTransform2D.
Subclasses must declare implements MathTransform2D
themself if they know to maps two-dimensional coordinate systems.
modules/library/referencing (gt2-referencing.jar) (Maven report) (SVN head)| Nested Class Summary | |
|---|---|
protected class |
AbstractMathTransform.Inverse
Default implementation for inverse math transform. |
| Constructor Summary | |
|---|---|
protected |
AbstractMathTransform()
Constructs a math transform. |
| Method Summary | |
|---|---|
Shape |
createTransformedShape(Shape shape)
Transform the specified shape. |
Matrix |
derivative(DirectPosition point)
Gets the derivative of this transform at a point. |
Matrix |
derivative(Point2D point)
Gets the derivative of this transform at a point. |
protected static void |
ensureNonNull(String name,
Object object)
Makes sure that an argument is non-null. |
boolean |
equals(Object object)
Compares the specified object with this math transform for equality. |
protected String |
formatWKT(Formatter formatter)
Format the inner part of a Well Known Text (WKT) element. |
ParameterDescriptorGroup |
getParameterDescriptors()
Returns the parameter descriptors for this math transform, or null if unknow. |
ParameterValueGroup |
getParameterValues()
Returns the parameter values for this math transform, or null if unknow. |
abstract int |
getSourceDimensions()
Gets the dimension of input points. |
abstract int |
getTargetDimensions()
Gets the dimension of output points. |
int |
hashCode()
Returns a hash value for this transform. |
MathTransform |
inverse()
Creates the inverse transform of this object. |
boolean |
isIdentity()
Tests whether this transform does not move any points. |
protected static boolean |
needCopy(int srcOff,
int dimSource,
int dstOff,
int dimTarget,
int numPts)
Checks if source coordinates need to be copied before to apply the transformation. |
protected static double |
rollLongitude(double x)
Ensures that the specified longitude stay within ±π radians. |
DirectPosition |
transform(DirectPosition ptSrc,
DirectPosition ptDst)
Transforms the specified ptSrc and stores the result
in ptDst. |
void |
transform(float[] srcPts,
int srcOff,
float[] dstPts,
int dstOff,
int numPts)
Transforms a list of coordinate point ordinal values. |
Point2D |
transform(Point2D ptSrc,
Point2D ptDst)
Transforms the specified ptSrc and stores the result in ptDst. |
| Methods inherited from class Formattable |
|---|
toString, toWKT, toWKT, toWKT |
| Methods inherited from class Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface MathTransform |
|---|
toWKT, transform |
| Constructor Detail |
|---|
protected AbstractMathTransform()
| Method Detail |
|---|
public abstract int getSourceDimensions()
getSourceDimensions in interface MathTransformpublic abstract int getTargetDimensions()
getTargetDimensions in interface MathTransformpublic ParameterDescriptorGroup getParameterDescriptors()
null if unknow.
This method is similar to OperationMethod.getParameters(), except that
MathTransform returns parameters in standard units (usually
meters or decimal degrees).
null.OperationMethod.getParameters()public ParameterValueGroup getParameterValues()
null if unknow.
This method is similar to Operation.getParameterValues(), except that
MathTransform returns parameters in standard units (usually
meters or decimal degrees).
Since this method returns a copy of the parameter values, any change to a value
will have no effect on this math transform.
null.Operation.getParameterValues()public boolean isIdentity()
false.
isIdentity in interface MathTransform
public Point2D transform(Point2D ptSrc,
Point2D ptDst)
throws TransformException
ptSrc and stores the result in ptDst.
The default implementation invokes MathTransform.transform(double[],int,double[],int,int)
using a temporary array of doubles.
ptSrc - the specified coordinate point to be transformed.ptDst - the specified coordinate point that stores the result of transforming
ptSrc, or null.
ptSrc and storing the result in
ptDst.
MismatchedDimensionException - if this transform doesn't map two-dimensional
coordinate systems.
TransformException - if the point can't be transformed.MathTransform2D.transform(Point2D,Point2D)
public DirectPosition transform(DirectPosition ptSrc,
DirectPosition ptDst)
throws TransformException
ptSrc and stores the result
in ptDst. The default implementation invokes
MathTransform.transform(double[],int,double[],int,int).
transform in interface MathTransformTransformException
public void transform(float[] srcPts,
int srcOff,
float[] dstPts,
int dstOff,
int numPts)
throws TransformException
MathTransform.transform(double[],int,double[],int,int) using a temporary array
of doubles.
transform in interface MathTransformTransformException
public Shape createTransformedShape(Shape shape)
throws TransformException
shape - Shape to transform.
shape if this transform is the identity transform.
IllegalStateException - if this transform doesn't map 2D coordinate systems.
TransformException - if a transform failed.MathTransform2D.createTransformedShape(Shape)
public Matrix derivative(Point2D point)
throws TransformException
MathTransform2D interface
should override this method. Other subclasses should override
derivative(DirectPosition) instead.
point - The coordinate point where to evaluate the derivative.
MismatchedDimensionException - if the input dimension is not 2.
TransformException - if the derivative can't be evaluated at the specified point.MathTransform2D.derivative(Point2D)
public Matrix derivative(DirectPosition point)
throws TransformException
point has a valid dimension. Next, it try to delegate
the work to an other method:
derivative(Point2D).MathTransform1D, then this
method delegates the work to derivative(double).TransformException is thrown.
derivative in interface MathTransformpoint - The coordinate point where to evaluate the derivative.
null).
NullPointerException - if the derivative dependents on coordinate
and point is null.
MismatchedDimensionException - if point doesn't have
the expected dimension.
TransformException - if the derivative can't be evaluated at the
specified point.
public MathTransform inverse()
throws NoninvertibleTransformException
this if this transform is an identity
transform, and throws a NoninvertibleTransformException otherwise. Subclasses
should override this method.
inverse in interface MathTransformNoninvertibleTransformExceptionpublic int hashCode()
hashCode in class Objectpublic boolean equals(Object object)
object is an instance
of the same class than this and use the same parameter descriptor.
Subclasses should override this method in order to compare internal fields.
equals in class Objectprotected String formatWKT(Formatter formatter)
getParameterValues(). The parameter group name is used as the math
transform name.
formatWKT in class Formattableformatter - The formatter to use.
"PARAM_MT" in the default implementation.Formattable.toWKT(),
Formattable.toString()
protected static void ensureNonNull(String name,
Object object)
throws IllegalArgumentException
name - Argument name.object - User argument.
InvalidParameterValueException - if object is null.
IllegalArgumentException
protected static boolean needCopy(int srcOff,
int dimSource,
int dstOff,
int dimTarget,
int numPts)
transform(...) method implementation.
This method make the following assumptions:
public void transform(double[] srcPts, int srcOff, double[] dstPts, int dstOff, int numPts) { if (srcPts==dstPts && needCopy(srcOff, 2, dstOff, 3, numPts) { final double[] old = srcPts; srcPts = new double[numPts*2]; System.arraycopy(old, srcOff, srcPts, 0, srcPts.length); srcOff = 0; } }
protected static double rollLongitude(double x)
x - The longitude in radians.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||