ilog.views.maps.srs.coordtrans
Class IlvFittedTransform

java.lang.Object
  extended by ilog.views.maps.srs.coordtrans.IlvFittedTransform
All Implemented Interfaces:
IlvPersistentObject, IlvMathTransform

public class IlvFittedTransform
extends Object
implements IlvMathTransform, IlvPersistentObject

A transformation that transforms coordinates using a polynomial transform between two sets of points. The coefficients of the polynomial whose degree can be specified are computed using least square fitting algorithm. This transformation includes an optimization for polynomial of degree up to 4.

Since:
JViews 5.5

Constructor Summary
IlvFittedTransform(IlvCoordinate[] sourcePoints, IlvCoordinate[] destinationPoints, int degree)
          Creates a new 2D polynomial transform.
IlvFittedTransform(IlvFittedTransform source)
          Creates a new fitted transform which is a copy of the specified transformation.
IlvFittedTransform(IlvInputStream stream)
          Reads an IlvFittedTransform from the specified input stream.
 
Method Summary
static IlvFittedTransform CreateTransform(IlvCoordinate UL, IlvCoordinate LR, IlvCoordinateTransformation transform, int degree, double controlPointModifier)
          Creates an interpolation function for the specified coordinate transformation, for the area of interest which corners are specified.
 Iterator getDestinationPoints()
          Returns an iterator over the destination points.
 IlvMathTransform getInverse()
          Returns the inverse transformation of this transformation.
 int getSourceDimension()
          The dimension of source coordinates.
 Iterator getSourcePoints()
          Returns an iterator over the source points.
 int getTargetDimension()
          The dimension of target coordinates.
 boolean isIdentity()
          Returns true if this transformation is an identity.
 IlvCoordinate[] transform(IlvCoordinate[] sourceCP, IlvCoordinate[] targetCP)
          Transforms the specified array of points, and stores the result in the specified coordinate array.
 IlvCoordinate transform(IlvCoordinate sourceCP, IlvCoordinate targetCP)
          Transforms the specified source point, and stores the result in the specified coordinate.
 void write(IlvOutputStream stream)
          Writes this transformation to the specified output stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IlvFittedTransform

public IlvFittedTransform(IlvCoordinate[] sourcePoints,
                          IlvCoordinate[] destinationPoints,
                          int degree)
Creates a new 2D polynomial transform. The number of points needed to find a polynomial of specified degree is (degree + 2)*(degree + 1)/2. For example:

Parameters:
sourcePoints - The source points.
destinationPoints - The points to fit.
degree - The degree of the interpolation.
Throws:
IllegalArgumentException - If the number of points does not allow for a polynomial of degree degree to be found.

IlvFittedTransform

public IlvFittedTransform(IlvFittedTransform source)
Creates a new fitted transform which is a copy of the specified transformation.

Parameters:
source - The source transform

IlvFittedTransform

public IlvFittedTransform(IlvInputStream stream)
                   throws IlvReadFileException
Reads an IlvFittedTransform from the specified input stream.

Parameters:
stream - The IlvInputStream.
Throws:
IlvReadFileException - if the transformation cannot be read from the input stream.
Method Detail

write

public void write(IlvOutputStream stream)
           throws IOException
Writes this transformation to the specified output stream.

Specified by:
write in interface IlvPersistentObject
Parameters:
stream - The IlvOutputStream.
Throws:
Java.io.IOException - If an error occurs.
IOException - thrown when an exception occurs during the write operation for this object.

getSourceDimension

public int getSourceDimension()
The dimension of source coordinates.

Specified by:
getSourceDimension in interface IlvMathTransform
Returns:
2

getTargetDimension

public int getTargetDimension()
The dimension of target coordinates.

Specified by:
getTargetDimension in interface IlvMathTransform
Returns:
2

transform

public IlvCoordinate transform(IlvCoordinate sourceCP,
                               IlvCoordinate targetCP)
                        throws IlvCoordinateTransformationException
Transforms the specified source point, and stores the result in the specified coordinate. If the target coordinate is null, a new coordinate is created and returned.

Specified by:
transform in interface IlvMathTransform
Throws:
IlvCoordinateTransformationException

transform

public IlvCoordinate[] transform(IlvCoordinate[] sourceCP,
                                 IlvCoordinate[] targetCP)
                          throws IlvCoordinateTransformationException
Transforms the specified array of points, and stores the result in the specified coordinate array. If the target coordinate array is null, a new array of coordinates is created and returned.

Specified by:
transform in interface IlvMathTransform
Throws:
IlvCoordinateTransformationException

getInverse

public IlvMathTransform getInverse()
Returns the inverse transformation of this transformation.

Specified by:
getInverse in interface IlvMathTransform

isIdentity

public boolean isIdentity()
Returns true if this transformation is an identity.

Specified by:
isIdentity in interface IlvMathTransform
Returns:
true if this transformation is an identity.

getSourcePoints

public Iterator getSourcePoints()
Returns an iterator over the source points. Each individual source point can be retrieved by the following code:
IlvCoordinate[] sources = new IlvCoordinate[numPoints];
        IlvCoordinate[] dest = new IlvCoordinate[numPoints];

 for (Iterator i = transform.getSourcePoints(); i.hasNext() ; ) {
    IlvCoordinate c = (IlvCoordinate)i.next();
 }
 

Returns:
An iterator over the source points.

getDestinationPoints

public Iterator getDestinationPoints()
Returns an iterator over the destination points. Each individual destination point can be retrieved by the following code:
 for (Iterator i = transform.getDestinationPoints(); i.hasNext() ; ) {
    IlvCoordinate c = (IlvCoordinate)i.next();
 }
 

Returns:
An iterator over the destination points.

CreateTransform

public static IlvFittedTransform CreateTransform(IlvCoordinate UL,
                                                 IlvCoordinate LR,
                                                 IlvCoordinateTransformation transform,
                                                 int degree,
                                                 double controlPointModifier)
                                          throws IlvCoordinateTransformationException
Creates an interpolation function for the specified coordinate transformation, for the area of interest which corners are specified. The controlPointModifier parameter allows to specify a modifier to the number of points for the specified degree (example, 1.20 means use 20% more points that the theoretical number of points needed for a polynomial of degree degree).

Parameters:
UL - The upper left coordinate of the area of interest, expressed in the source coordinate system.
LR - The lower right coordinate of the area of interest, expressed in the source coordinate system.
transform - The transformation to interpolate.
degree - The degree of the interpolation function.
controlPointModifier - The modifier to the number of control points used. This must be greater than 1.
Returns:
The interpolation transform.
Throws:
IlvCoordinateTransformationException - if some points could not be transformed.


Copyright © 1996-2007 ILOG S.A. All rights reserved.   Documentation homepage.