org.geotools.referencing.piecewise
Class DefaultPiecewiseTransform1D<T extends DefaultPiecewiseTransform1DElement>

Object
  extended by AbstractCollection<E>
      extended by AbstractList<E>
          extended by DefaultDomain1D<T>
              extended by DefaultPiecewiseTransform1D<T>
All Implemented Interfaces:
Iterable<T>, Collection<T>, List<T>, Domain1D<T>, PiecewiseTransform1D<T>, MathTransform, MathTransform1D

public class DefaultPiecewiseTransform1D<T extends DefaultPiecewiseTransform1DElement>
extends DefaultDomain1D<T>
implements PiecewiseTransform1D<T>

Convenience implementation of the PiecewiseTransform1D interface which subclass the DefaultDomain1D class in order to provide a suitable framework to handle a list of PiecewiseTransform1DElement s.

Author:
Simone Giannecchini, GeoSolutions

Field Summary
 
Fields inherited from class AbstractList
modCount
 
Constructor Summary
DefaultPiecewiseTransform1D(T[] domainElements)
           
DefaultPiecewiseTransform1D(T[] domainElements, double defaultValue)
           
 
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.
 boolean equals(Object object)
          Compares the specified object with this domain element list for equality.
 double getDefaultValue()
          The default value which will be returned when asked to transform a value outside the valid domain elements.
protected  Class<?> getEquivalenceClass()
           
 int getSourceDimensions()
          Gets the dimension of input points, which is 1.
 int getTargetDimensions()
          Gets the dimension of output points, which is 1.
 boolean hasDefaultValue()
          Indicates whether or not this PiecewiseTransform1D has a default value which will be returned when asked to transform a value outside the valid domain elements.
 int hashCode()
           
 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[] 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.
 
Methods inherited from class DefaultDomain1D
findDomainElement, get, getApproximateDomainRange, getMain, getMinimums, getName, hasGaps, size, toArray
 
Methods inherited from class AbstractList
add, add, addAll, clear, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, removeRange, set, subList
 
Methods inherited from class AbstractCollection
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toString
 
Methods inherited from class Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface Domain1D
findDomainElement, getApproximateDomainRange, getName, hasGaps
 
Methods inherited from interface List
add, add, addAll, addAll, clear, contains, containsAll, get, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, retainAll, set, size, subList, toArray, toArray
 

Constructor Detail

DefaultPiecewiseTransform1D

public DefaultPiecewiseTransform1D(T[] domainElements,
                                   double defaultValue)

DefaultPiecewiseTransform1D

public DefaultPiecewiseTransform1D(T[] domainElements)
Method Detail

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 TransformException
Gets the derivative of this transform at a point.

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:
TransformException - if the derivative can't be evaluated at the specified point.

derivative

public double derivative(double value)
                  throws TransformException
Gets the derivative of this function at a 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.

getSourceDimensions

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

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

getTargetDimensions

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

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()
             throws UnsupportedOperationException
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.
Throws:
UnsupportedOperationException - If this object can't be formatted as WKT.

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[] srcPts,
                      int srcOff,
                      double[] dstPts,
                      int dstOff,
                      int numPts)
               throws TransformException
Transforms a list of coordinate point ordinal values.

Specified by:
transform in interface MathTransform
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 than srcPts.
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 to this.

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 interface MathTransform
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 than srcPts.
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 to this.

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 interface MathTransform
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 to this.

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 interface MathTransform
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 to this.

hasDefaultValue

public boolean hasDefaultValue()
Description copied from interface: PiecewiseTransform1D
Indicates whether or not this PiecewiseTransform1D has a default value which will be returned when asked to transform a value outside the valid domain elements.

Specified by:
hasDefaultValue in interface PiecewiseTransform1D<T extends DefaultPiecewiseTransform1DElement>
Returns:
a boolean to indicate whether or not this PiecewiseTransform1D has a default value.

getDefaultValue

public double getDefaultValue()
Description copied from interface: PiecewiseTransform1D
The default value which will be returned when asked to transform a value outside the valid domain elements.

In case PiecewiseTransform1D.hasDefaultValue() return false this value has no meaning.

Specified by:
getDefaultValue in interface PiecewiseTransform1D<T extends DefaultPiecewiseTransform1DElement>
Returns:
UML property:
name="defaultValue"

hashCode

public int hashCode()
Specified by:
hashCode in interface Collection<T extends DefaultPiecewiseTransform1DElement>
Specified by:
hashCode in interface List<T extends DefaultPiecewiseTransform1DElement>
Overrides:
hashCode in class DefaultDomain1D<T extends DefaultPiecewiseTransform1DElement>

equals

public boolean equals(Object object)
Description copied from class: DefaultDomain1D
Compares the specified object with this domain element list for equality. If the two objects are instances of the DefaultDomain1D class, then the test check for the equality of the single elements.

Specified by:
equals in interface Collection<T extends DefaultPiecewiseTransform1DElement>
Specified by:
equals in interface List<T extends DefaultPiecewiseTransform1DElement>
Overrides:
equals in class DefaultDomain1D<T extends DefaultPiecewiseTransform1DElement>

getEquivalenceClass

protected Class<?> getEquivalenceClass()
Overrides:
getEquivalenceClass in class DefaultDomain1D<T extends DefaultPiecewiseTransform1DElement>


Copyright © 1996-2014 Geotools. All Rights Reserved.