public class InterpolatedTransform extends DatumShiftTransform
DatumShiftGrid.getTranslationDimensions()
.
transform
methods of this InterpolatedTransform
class.
Translation vectors are stored in the datum shift grid at the specified grid indices. If the grid indices are non-integer values, then the translations are interpolated using a bilinear interpolation. If the grid indices are outside the grid domain ([0 … width-2] × [0 … height-2] where width and height are the number of columns and rows in the grid), then the translations are extrapolated. The translation is finally added to the input coordinates.
The input and output coordinates can have any number of dimensions, provided that they are the same than the number of translation dimensions. However current implementation uses only the two first dimensions for interpolations in the grid.
DatumShiftGrid
,
LocalizationGridBuilder
,
Serialized FormDefined in the sis-referencing
module
Modifier | Constructor and Description |
---|---|
protected |
InterpolatedTransform(DatumShiftGrid<T,T> grid)
Creates a transform for the given interpolation grid.
|
Modifier and Type | Method and Description |
---|---|
protected int |
computeHashCode()
Computes a hash value for this transform.
|
static <T extends Quantity<T>> |
createGeodeticTransformation(MathTransformFactory factory,
DatumShiftGrid<T,T> grid)
Creates a transformation between two geodetic CRS.
|
boolean |
equals(Object object,
ComparisonMode mode)
Compares the specified object with this math transform for equality.
|
int |
getSourceDimensions()
Returns the number of input dimensions.
|
int |
getTargetDimensions()
Returns the number of target dimensions.
|
MathTransform |
inverse()
Returns the inverse of this interpolated transform.
|
Matrix |
transform(double[] srcPts,
int srcOff,
double[] dstPts,
int dstOff,
boolean derivate)
Applies the datum shift on a coordinate and optionally returns the derivative at that location.
|
void |
transform(double[] srcPts,
int srcOff,
double[] dstPts,
int dstOff,
int numPts)
Transforms an arbitrary amount of coordinates.
|
getContextualParameters, getParameterValues
derivative, equals, formatTo, getParameterDescriptors, hashCode, isIdentity, transform, transform, transform, transform, tryConcatenate
print, toString, toString, toWKT
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
toWKT
protected InterpolatedTransform(DatumShiftGrid<T,T> grid) throws NoninvertibleMatrixException
InterpolatedTransform
class works with ordinate values in units of grid cell
For example input coordinate (4,5) is the position of the center of the cell at grid index (4,5).
The output units are the same than the input units.
For converting geodetic coordinates, InterpolatedTransform
instances need to be concatenated
with the following affine transforms:
InterpolatedTransform
for converting the geodetic coordinates into grid coordinates.InterpolatedTransform
for converting grid coordinates into geodetic coordinates.InterpolatedTransform
construction,
the full conversion chain including the above affine transforms can be created by
DatumShiftTransform.getContextualParameters().completeTransform(factory, this)}
.T
- dimension of the coordinate and the translation unit.grid
- the grid of datum shifts from source to target datum.NoninvertibleMatrixException
- if the conversion from geodetic coordinates
to grid indices can not be inverted.createGeodeticTransformation(MathTransformFactory, DatumShiftGrid)
public static <T extends Quantity<T>> MathTransform createGeodeticTransformation(MathTransformFactory factory, DatumShiftGrid<T,T> grid) throws FactoryException
InterpolatedTransform
instance with the steps needed for converting values between
geodetic and grid coordinates.
DatumShiftGrid.getCoordinateUnit()
:
Unit.getSystemUnit()
.T
- dimension of the coordinate and the translation unit.factory
- the factory to use for creating the transform.grid
- the grid of datum shifts from source to target datum.
The DatumShiftGrid.interpolateInCell(…)
method shall compute translations from source to target as
ratio of offsets divided by cell sizes.FactoryException
- if an error occurred while creating a transform.public final int getSourceDimensions()
DatumShiftGrid.getTranslationDimensions()
.getSourceDimensions
in interface MathTransform
getSourceDimensions
in class AbstractMathTransform
DefaultOperationMethod.getSourceDimensions()
public final int getTargetDimensions()
DatumShiftGrid.getTranslationDimensions()
.getTargetDimensions
in interface MathTransform
getTargetDimensions
in class AbstractMathTransform
DefaultOperationMethod.getTargetDimensions()
public Matrix transform(double[] srcPts, int srcOff, double[] dstPts, int dstOff, boolean derivate) throws TransformException
transform
in class AbstractMathTransform
srcPts
- the array containing the source coordinate (can not be null
).srcOff
- the offset to the point to be transformed in the source array.dstPts
- the array into which the transformed coordinate is returned. May be the same than srcPts
.
May be null
if only the derivative matrix is desired.dstOff
- the offset to the location of the transformed point that is stored in the destination array.derivate
- true
for computing the derivative, or false
if not needed.null
if the derivate
argument is false
.TransformException
- if the point can not be transformed or
if a problem occurred while calculating the derivative.AbstractMathTransform.derivative(DirectPosition)
,
AbstractMathTransform.transform(DirectPosition, DirectPosition)
,
MathTransforms.derivativeAndTransform(MathTransform, double[], int, double[], int)
public void transform(double[] srcPts, int srcOff, double[] dstPts, int dstOff, int numPts) throws TransformException
transform
in interface MathTransform
transform
in class AbstractMathTransform
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.TransformException
- if a point can not be transformed.public MathTransform inverse()
inverse
in interface MathTransform
inverse
in class AbstractMathTransform
protected int computeHashCode()
AbstractMathTransform.hashCode()
when first needed.computeHashCode
in class DatumShiftTransform
public boolean equals(Object object, ComparisonMode mode)
equals
in interface LenientComparable
equals
in class DatumShiftTransform
object
- the object to compare with this transform.mode
- the strictness level of the comparison. Default to STRICT
.true
if the given object is considered equals to this math transform.Utilities.deepEquals(Object, Object, ComparisonMode)
Copyright © 2010–2017 The Apache Software Foundation. All rights reserved.