Class NTv2Transform
- Object
-
- Formattable
-
- AbstractMathTransform
-
- NTv2Transform
-
- All Implemented Interfaces:
Serializable
,MathTransform
,MathTransform2D
public class NTv2Transform extends AbstractMathTransform implements MathTransform2D, Serializable
The "NTv2" coordinate transformation method (EPSG:9615).This transformation depends on an external resource (the NTv2 grid file). If the file is not available, a
recoverable NoSuchIdentifierException
will be thrown on instantiation.- Author:
- Oscar Fonts
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
NTv2Transform.Provider
TheNTv2Transform
provider.
-
Field Summary
Fields Modifier and Type Field Description protected static Logger
LOGGER
Logger-
Fields inherited from class Formattable
SINGLE_LINE
-
-
Constructor Summary
Constructors Constructor Description NTv2Transform(URI file)
Constructs aNTv2Transform
from the specified grid shift file.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object object)
Compares the specified object with this one for equality.ParameterValueGroup
getParameterValues()
Returns the parameter values for this math transform.int
getSourceDimensions()
Gets the dimension of input points.int
getTargetDimensions()
Gets the dimension of output points.int
hashCode()
Returns a hash value for this transform.MathTransform2D
inverse()
Returns the inverse of this transform.void
inverseTransform(double[] srcPts, int srcOff, double[] dstPts, int dstOff, int numPts)
Inverse transform.void
transform(double[] srcPts, int srcOff, double[] dstPts, int dstOff, int numPts)
Transforms a list of coordinate point ordinal values.-
Methods inherited from class AbstractMathTransform
createTransformedShape, derivative, derivative, ensureNonNull, formatWKT, getName, getParameterDescriptors, isIdentity, needCopy, normalizeAngle, rollLongitude, transform, transform, transform, transform, transform
-
Methods inherited from class Formattable
cleanupThreadLocals, toString, toWKT, toWKT, toWKT, toWKT
-
Methods inherited from interface MathTransform
derivative, isIdentity, toWKT, transform, transform, transform, transform
-
Methods inherited from interface MathTransform2D
createTransformedShape, derivative, transform
-
-
-
-
Field Detail
-
LOGGER
protected static final Logger LOGGER
Logger
-
-
Constructor Detail
-
NTv2Transform
public NTv2Transform(URI file) throws NoSuchIdentifierException
Constructs aNTv2Transform
from the specified grid shift file.This constructor checks for grid shift file availability, but doesn't actually load the full grid into memory to preserve resources.
- Parameters:
file
- NTv2 grid file name- Throws:
NoSuchIdentifierException
- if the grid is not available.
-
-
Method Detail
-
hashCode
public int hashCode()
Returns a hash value for this transform.- Overrides:
hashCode
in classAbstractMathTransform
-
equals
public boolean equals(Object object)
Compares the specified object with this one for equality. Checks ifobject
isthis
same instance, or a NTv2Transform with the same parameter values.- Overrides:
equals
in classAbstractMathTransform
- Parameters:
object
- The object to compare with this transform.- Returns:
true
if the given object isthis
, or a NTv2Transform with same parameter values, which would mean that given identical source position, the transformed position would be the same.
-
inverse
public MathTransform2D inverse()
Returns the inverse of this transform.- Specified by:
inverse
in interfaceMathTransform
- Specified by:
inverse
in interfaceMathTransform2D
- Overrides:
inverse
in classAbstractMathTransform
- Returns:
- the inverse of this transform
-
transform
public void transform(double[] srcPts, int srcOff, double[] dstPts, int dstOff, int numPts) throws TransformException
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 interfaceMathTransform
- 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 thansrcPts
.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 an IO error occurs reading the grid file.
-
inverseTransform
public void inverseTransform(double[] srcPts, int srcOff, double[] dstPts, int dstOff, int numPts) throws TransformException
Inverse transform. Seetransform(double[], int, double[], int, int)
- 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 thansrcPts
.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 an IO error occurs reading the grid file.
-
getSourceDimensions
public int getSourceDimensions()
Description copied from class:AbstractMathTransform
Gets the dimension of input points.- Specified by:
getSourceDimensions
in interfaceMathTransform
- Specified by:
getSourceDimensions
in classAbstractMathTransform
- Returns:
- The dimension of input points.
-
getTargetDimensions
public int getTargetDimensions()
Description copied from class:AbstractMathTransform
Gets the dimension of output points.- Specified by:
getTargetDimensions
in interfaceMathTransform
- Specified by:
getTargetDimensions
in classAbstractMathTransform
- Returns:
- The dimension of output points.
-
getParameterValues
public ParameterValueGroup getParameterValues()
Returns the parameter values for this math transform.- Overrides:
getParameterValues
in classAbstractMathTransform
- Returns:
- A copy of the parameter values for this math transform.
- See Also:
Operation.getParameterValues()
-
-