org.geotools.referencing.piecewise
Class DefaultPiecewiseTransform1DElement

Object
  extended by DefaultDomainElement1D
      extended by DefaultPiecewiseTransform1DElement
All Implemented Interfaces:
Serializable, Comparable<DomainElement1D>, DomainElement1D, PiecewiseTransform1DElement, MathTransform, MathTransform1D
Direct Known Subclasses:
DefaultLinearPiecewiseTransform1DElement

public class DefaultPiecewiseTransform1DElement
extends DefaultDomainElement1D
implements PiecewiseTransform1DElement

Convenience implementation of the DefaultPiecewiseTransform1DElement .

Author:
Simone Giannecchini, GeoSolutions
See Also:
Serialized Form

Constructor Summary
protected DefaultPiecewiseTransform1DElement(CharSequence name, NumberRange<? extends Number> valueRange)
          Protected constructor for DomainElement1Ds that want to build their transform later on.
protected DefaultPiecewiseTransform1DElement(CharSequence name, NumberRange<? extends Number> valueRange, MathTransform1D transform)
          Public constructor for building a DomainElement1D which applies the specified transformation on the values that fall into its definition range.
 
Method Summary
static DefaultPiecewiseTransform1DElement create(CharSequence name)
          Creates a pass-through DefaultPiecewiseTransform1DElement.
static DefaultPiecewiseTransform1DElement create(CharSequence name, NumberRange<? extends Number> valueRange)
          Creates a pass-through DefaultPiecewiseTransform1DElement.
static DefaultPiecewiseTransform1DElement create(CharSequence name, NumberRange<? extends Number> inRange, byte value)
          Builds up a DefaultPiecewiseTransform1DElement which maps a range to a constant value.
static DefaultPiecewiseTransform1DElement create(CharSequence name, NumberRange<? extends Number> inRange, double value)
          Builds up a DefaultPiecewiseTransform1DElement which maps a range to a constant value.
static DefaultPiecewiseTransform1DElement create(CharSequence name, NumberRange<? extends Number> inRange, int value)
          Builds up a DefaultPiecewiseTransform1DElement which maps a range to a constant value.
static DefaultPiecewiseTransform1DElement create(CharSequence name, NumberRange<? extends Number> inRange, NumberRange<? extends Number> outRange)
          Constructor.
static DefaultPiecewiseTransform1DElement create(String string, NumberRange<? extends Number> range, MathTransform1D mathTransform1D)
           
 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 obj)
          Implementation of Object.equals(Object) for DomainElement1Ds.
protected  Class<?> getEquivalenceClass()
           
 int getSourceDimensions()
          Gets the dimension of input points.
 int getTargetDimensions()
          Gets the dimension of output points.
protected  MathTransform1D getTransform()
          Getter for the underlying MathTransform1D .
 int hashCode()
          Returns a hash value for this domain element.
 MathTransform1D inverse()
          Creates the inverse transform of this object.
 boolean isIdentity()
          Tests whether this transform does not move any points.
protected  void setInverse(MathTransform1D mathTransform)
           
protected  void setTransform(MathTransform1D transform)
           
 String toString()
           
 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 DefaultDomainElement1D
compareTo, contains, contains, contains, getInputMaximum, getInputMinimum, getName, getRange, isInputMaximumInfinite, isInputMaximumNaN, isInputMinimumInfinite, isInputMinimumNaN
 
Methods inherited from class Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface DomainElement1D
contains, contains, contains, getName, getRange
 
Methods inherited from interface Comparable
compareTo
 

Constructor Detail

DefaultPiecewiseTransform1DElement

protected DefaultPiecewiseTransform1DElement(CharSequence name,
                                             NumberRange<? extends Number> valueRange)
                                      throws IllegalArgumentException
Protected constructor for DomainElement1Ds that want to build their transform later on.

Parameters:
name - for this DomainElement1D.
valueRange - for this DomainElement1D.
Throws:
IllegalArgumentException

DefaultPiecewiseTransform1DElement

protected DefaultPiecewiseTransform1DElement(CharSequence name,
                                             NumberRange<? extends Number> valueRange,
                                             MathTransform1D transform)
                                      throws IllegalArgumentException
Public constructor for building a DomainElement1D which applies the specified transformation on the values that fall into its definition range.

Parameters:
name - for this DomainElement1D.
valueRange - for this DomainElement1D.
transform - for this DomainElement1D.
Throws:
IllegalArgumentException
Method Detail

create

public static DefaultPiecewiseTransform1DElement create(CharSequence name,
                                                        NumberRange<? extends Number> inRange,
                                                        double value)
Builds up a DefaultPiecewiseTransform1DElement which maps a range to a constant value.

Parameters:
name - for this DomainElement1D
inRange - for this DomainElement1D
outVal - for this DefaultLinearPiecewiseTransform1DElement
Throws:
IllegalArgumentException - in case the input values are illegal.

create

public static DefaultPiecewiseTransform1DElement create(CharSequence name,
                                                        NumberRange<? extends Number> inRange,
                                                        byte value)
Builds up a DefaultPiecewiseTransform1DElement which maps a range to a constant value.

Parameters:
name - for this DomainElement1D
inRange - for this DomainElement1D
outVal - for this DefaultLinearPiecewiseTransform1DElement
Throws:
IllegalArgumentException - in case the input values are illegal.

create

public static DefaultPiecewiseTransform1DElement create(CharSequence name,
                                                        NumberRange<? extends Number> inRange,
                                                        int value)
Builds up a DefaultPiecewiseTransform1DElement which maps a range to a constant value.

Parameters:
name - for this DomainElement1D
inRange - for this DomainElement1D
outVal - for this DefaultLinearPiecewiseTransform1DElement
Throws:
IllegalArgumentException - in case the input values are illegal.

create

public static DefaultPiecewiseTransform1DElement create(CharSequence name,
                                                        NumberRange<? extends Number> inRange,
                                                        NumberRange<? extends Number> outRange)
Constructor.

Parameters:
name - for this DefaultLinearPiecewiseTransform1DElement.
inRange - for this DefaultLinearPiecewiseTransform1DElement.
outRange - for this DefaultLinearPiecewiseTransform1DElement.

create

public static DefaultPiecewiseTransform1DElement create(CharSequence name)
                                                 throws IllegalArgumentException
Creates a pass-through DefaultPiecewiseTransform1DElement.

Parameters:
name - for this DomainElement1D.
Throws:
IllegalArgumentException

create

public static DefaultPiecewiseTransform1DElement create(CharSequence name,
                                                        NumberRange<? extends Number> valueRange)
                                                 throws IllegalArgumentException
Creates a pass-through DefaultPiecewiseTransform1DElement.

Parameters:
name - for this DomainElement1D.
valueRange - for this DomainElement1D.
Throws:
IllegalArgumentException

toWKT

public String toWKT()
             throws UnsupportedOperationException
Returns a Well Known Text (WKT) for this object. This operation may fails if an object is too complex for the WKT format capability.

Specified by:
toWKT in interface MathTransform
Returns:
The Well Know Text for this object.
Throws:
UnsupportedOperationException - If this object can't be formatted as WKT. XXX Not yet implemented.

getTransform

protected MathTransform1D getTransform()
Getter for the underlying MathTransform1D .

Returns:
the underlying MathTransform1D .
UML property:
name="transform"

transform

public double transform(double value)
                 throws TransformException
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 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.

transform

public DirectPosition transform(DirectPosition ptSrc,
                                DirectPosition ptDst)
                         throws TransformException
Transforms the specified ptSrc and stores the result in ptDst.

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:
TransformException - if the point 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.

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.

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.

setInverse

protected void setInverse(MathTransform1D mathTransform)
Parameters:
mathTransform -
UML property:
name="inverse"

setTransform

protected void setTransform(MathTransform1D transform)
Parameters:
transform -
UML property:
name="transform"

equals

public boolean equals(Object obj)
Description copied from class: DefaultDomainElement1D
Implementation of Object.equals(Object) for DomainElement1Ds.

Two DefaultDomainElement1Ds are considered to be equal if they have the same inputr range and the same name.

Specified by:
equals in interface DomainElement1D
Overrides:
equals in class DefaultDomainElement1D
Parameters:
obj - the reference object with which to compare.
Returns:
true if this object is the same as the obj argument; false otherwise.
See Also:
Object.equals(Object)

toString

public String toString()
Overrides:
toString in class DefaultDomainElement1D

getEquivalenceClass

protected Class<?> getEquivalenceClass()
Overrides:
getEquivalenceClass in class DefaultDomainElement1D

hashCode

public int hashCode()
Description copied from class: DefaultDomainElement1D
Returns a hash value for this domain element. This value need not remain consistent between different implementations of the same class.

Overrides:
hashCode in class DefaultDomainElement1D

create

public static DefaultPiecewiseTransform1DElement create(String string,
                                                        NumberRange<? extends Number> range,
                                                        MathTransform1D mathTransform1D)


Copyright © 1996-2014 Geotools. All Rights Reserved.