org.geotools.referencing.operation.transform
Class LinearTransform1D

java.lang.Object
  extended by org.geotools.referencing.wkt.Formattable
      extended by org.geotools.referencing.operation.transform.AbstractMathTransform
          extended by org.geotools.referencing.operation.transform.LinearTransform1D
All Implemented Interfaces:
java.io.Serializable, LinearTransform, org.opengis.referencing.operation.MathTransform, org.opengis.referencing.operation.MathTransform1D

public class LinearTransform1D
extends AbstractMathTransform
implements org.opengis.referencing.operation.MathTransform1D, LinearTransform, java.io.Serializable

A one dimensional, linear transform. Input values x are converted into output values y using the following equation:

y  =  offset + scale×x

This class is the same as a 2×2 affine transform. However, this specialized LinearTransform1D class is faster. It is defined there because extensively used by GridCoverage2D.

Since:
2.0
Version:
$Id: LinearTransform1D.java 30641 2008-06-12 17:42:27Z acuster $
Author:
Martin Desruisseaux (IRD)
See Also:
LogarithmicTransform1D, ExponentialTransform1D, Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class org.geotools.referencing.operation.transform.AbstractMathTransform
AbstractMathTransform.Inverse
 
Field Summary
static LinearTransform1D IDENTITY
          The identity transform.
 double offset
          The value to add to input values.
 double scale
          The value which is multiplied to input values.
 
Fields inherited from class org.geotools.referencing.wkt.Formattable
SINGLE_LINE
 
Constructor Summary
protected LinearTransform1D(double scale, double offset)
          Constructs a new linear transform.
 
Method Summary
static LinearTransform1D create(double scale, double offset)
          Constructs a new linear transform.
 org.opengis.referencing.operation.Matrix derivative(org.opengis.geometry.DirectPosition point)
          Gets the derivative of this transform at a point.
 double derivative(double value)
          Gets the derivative of this function at a value.
 boolean equals(java.lang.Object object)
          Compares the specified object with this math transform for equality.
 org.opengis.referencing.operation.Matrix getMatrix()
          Returns this transform as an affine transform matrix.
 org.opengis.parameter.ParameterDescriptorGroup getParameterDescriptors()
          Returns the parameter descriptors for this math transform.
 org.opengis.parameter.ParameterValueGroup getParameterValues()
          Returns the matrix elements as a group of parameters values.
 int getSourceDimensions()
          Gets the dimension of input points, which is 1.
 int getTargetDimensions()
          Gets the dimension of output points, which is 1.
 int hashCode()
          Returns a hash value for this transform.
 org.opengis.referencing.operation.MathTransform1D inverse()
          Creates the inverse transform of this object.
 boolean isIdentity()
          Tests whether this transform does not move any points.
 boolean isIdentity(double tolerance)
          Tests whether this transform does not move any points by using the provided tolerance.
 double transform(double value)
          Transforms the specified value.
 void transform(double[] 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.
 
Methods inherited from class org.geotools.referencing.operation.transform.AbstractMathTransform
createTransformedShape, derivative, ensureNonNull, formatWKT, getName, needCopy, rollLongitude, transform, transform, transform, transform
 
Methods inherited from class org.geotools.referencing.wkt.Formattable
cleanupThreadLocals, toString, toWKT, toWKT, toWKT
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.opengis.referencing.operation.MathTransform
toWKT, transform, transform, transform
 

Field Detail

IDENTITY

public static final LinearTransform1D IDENTITY
The identity transform.


scale

public final double scale
The value which is multiplied to input values.


offset

public final double offset
The value to add to input values.

Constructor Detail

LinearTransform1D

protected LinearTransform1D(double scale,
                            double offset)
Constructs a new linear transform. This constructor is provided for subclasses only. Instances should be created using the factory method, which may returns optimized implementations for some particular argument values.

Parameters:
scale - The scale term in the linear equation.
offset - The offset term in the linear equation.
Method Detail

create

public static LinearTransform1D create(double scale,
                                       double offset)
Constructs a new linear transform.

Parameters:
scale - The scale term in the linear equation.
offset - The offset term in the linear equation.

getParameterDescriptors

public org.opengis.parameter.ParameterDescriptorGroup getParameterDescriptors()
Returns the parameter descriptors for this math transform.

Overrides:
getParameterDescriptors in class AbstractMathTransform
Returns:
The parameter descriptors for this math transform, or null.
See Also:
OperationMethod.getParameters()

getParameterValues

public org.opengis.parameter.ParameterValueGroup getParameterValues()
Returns the matrix elements as a group of parameters values. The number of parameters depends on the matrix size. Only matrix elements different from their default value will be included in this group.

Overrides:
getParameterValues in class AbstractMathTransform
Returns:
A copy of the parameter values for this math transform.
See Also:
Operation.getParameterValues()

getSourceDimensions

public int getSourceDimensions()
Gets the dimension of input points, which is 1.

Specified by:
getSourceDimensions in interface org.opengis.referencing.operation.MathTransform
Specified by:
getSourceDimensions in class AbstractMathTransform

getTargetDimensions

public int getTargetDimensions()
Gets the dimension of output points, which is 1.

Specified by:
getTargetDimensions in interface org.opengis.referencing.operation.MathTransform
Specified by:
getTargetDimensions in class AbstractMathTransform

getMatrix

public org.opengis.referencing.operation.Matrix getMatrix()
Returns this transform as an affine transform matrix.

Specified by:
getMatrix in interface LinearTransform
Returns:
A copy of the underlying matrix.

inverse

public org.opengis.referencing.operation.MathTransform1D inverse()
                                                          throws org.opengis.referencing.operation.NoninvertibleTransformException
Creates the inverse transform of this object.

Specified by:
inverse in interface org.opengis.referencing.operation.MathTransform
Specified by:
inverse in interface org.opengis.referencing.operation.MathTransform1D
Overrides:
inverse in class AbstractMathTransform
Throws:
org.opengis.referencing.operation.NoninvertibleTransformException

isIdentity

public boolean isIdentity()
Tests whether this transform does not move any points.

Specified by:
isIdentity in interface org.opengis.referencing.operation.MathTransform
Overrides:
isIdentity in class AbstractMathTransform

isIdentity

public boolean isIdentity(double tolerance)
Tests whether this transform does not move any points by using the provided tolerance. This method work in the same way than XMatrix.isIdentity(double).

Specified by:
isIdentity in interface LinearTransform
Parameters:
tolerance - The tolerance factor.
Returns:
true if this transform is the identity one
Since:
2.3.1

derivative

public org.opengis.referencing.operation.Matrix derivative(org.opengis.geometry.DirectPosition point)
                                                    throws org.opengis.referencing.operation.TransformException
Gets the derivative of this transform at a point. This implementation is different from the default AbstractMathTransform.derivative(java.awt.geom.Point2D) implementation in that no coordinate point is required and Double.NaN may be a legal output value for some users.

Specified by:
derivative in interface org.opengis.referencing.operation.MathTransform
Overrides:
derivative in class AbstractMathTransform
Parameters:
point - The coordinate point where to evaluate the derivative.
Returns:
The derivative at the specified point (never null).
Throws:
org.opengis.referencing.operation.TransformException - if the derivative can't be evaluated at the specified point.

derivative

public double derivative(double value)
Gets the derivative of this function at a value.

Specified by:
derivative in interface org.opengis.referencing.operation.MathTransform1D

transform

public double transform(double value)
Transforms the specified value.

Specified by:
transform in interface org.opengis.referencing.operation.MathTransform1D

transform

public void transform(float[] srcPts,
                      int srcOff,
                      float[] dstPts,
                      int dstOff,
                      int numPts)
Transforms a list of coordinate point ordinal values.

Specified by:
transform in interface org.opengis.referencing.operation.MathTransform
Overrides:
transform in class AbstractMathTransform

transform

public void transform(double[] srcPts,
                      int srcOff,
                      double[] dstPts,
                      int dstOff,
                      int numPts)
Transforms a list of coordinate point ordinal values.

Specified by:
transform in interface org.opengis.referencing.operation.MathTransform

hashCode

public int hashCode()
Returns a hash value for this transform. This value need not remain consistent between different implementations of the same class.

Overrides:
hashCode in class AbstractMathTransform

equals

public boolean equals(java.lang.Object object)
Compares the specified object with this math transform for equality.

Overrides:
equals in class AbstractMathTransform
Parameters:
object - The object to compare with this transform.
Returns:
true if the given object is a transform of the same class and if, given identical source position, the transformed position would be the equals.


Copyright © 1996-2010 Geotools. All Rights Reserved.