org.cts.op.transformation
Class NTv2GridShiftTransformation

java.lang.Object
  extended by org.cts.IdentifiableComponent
      extended by org.cts.op.AbstractCoordinateOperation
          extended by org.cts.op.transformation.NTv2GridShiftTransformation
All Implemented Interfaces:
Identifiable, CoordinateOperation

public class NTv2GridShiftTransformation
extends AbstractCoordinateOperation

Geographic Offset by Interpolation of Gridded Data.

The relationship between some geographical 2D coordinate reference systems is available through gridded data sets of latitude and longitude offsets.

Author:
Michaƫl Michaud

Field Summary
static int LOW_MEMORY
           
static int SPEED
           
 
Fields inherited from class org.cts.op.AbstractCoordinateOperation
precision
 
Fields inherited from interface org.cts.Identifiable
DEFAULT, LOCAL, UNKNOWN
 
Constructor Summary
NTv2GridShiftTransformation(URL ntv2_gridFile)
          NTv2GridShiftTransformation constructor.
NTv2GridShiftTransformation(URL ntv2_gridFile, double precision)
          NTv2GridShiftTransformation constructor.
 
Method Summary
static NTv2GridShiftTransformation createNTv2GridShiftTransformation(String ntv2_gridName)
          Create a NTv2GridShiftTransformation from the name of the file that defined it.
 String getFromDatum()
          Return the short name of the datum from which the nadgrids transformation must be used.
 String getToDatum()
          Return the short name of the datum toward which the nadgrids transformation must be used.
 CoordinateOperation inverse()
          Creates the inverse CoordinateOperation.
 boolean isLoaded()
          Return whether the grid shift file used by this transformation is loaded or not.
 void loadGridShiftFile()
          Load the grid file that will be used to transform the coordinates.
 boolean setMode(int mode)
          Set the mode to access the grid shift file.
 String toString()
          Returns this Geocentric translation as a String.
 double[] transform(double[] coord)
          Shift geographic coordinates (in decimal degrees) by an offset interpolated in a grid.
 void unload()
          Unload the grid shift file used by this transformation.
 
Methods inherited from class org.cts.op.AbstractCoordinateOperation
getPrecision
 
Methods inherited from class org.cts.IdentifiableComponent
addAlias, addRemark, equals, getAliases, getAuthorityKey, getAuthorityName, getCode, getComponent, getIdentifier, getName, getRemarks, getShortName, hashCode, setIdentifier, setRemarks, setShortName
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.cts.Identifiable
addAlias, addRemark, getAliases, getAuthorityKey, getAuthorityName, getCode, getName, getRemarks, getShortName, setRemarks, setShortName
 

Field Detail

SPEED

public static final int SPEED
See Also:
Constant Field Values

LOW_MEMORY

public static final int LOW_MEMORY
See Also:
Constant Field Values
Constructor Detail

NTv2GridShiftTransformation

public NTv2GridShiftTransformation(URL ntv2_gridFile,
                                   double precision)
NTv2GridShiftTransformation constructor.

Parameters:
ntv2_gridFile - file containing the description of the NTv2 grid
precision - mean precision of the geodetic transformation

NTv2GridShiftTransformation

public NTv2GridShiftTransformation(URL ntv2_gridFile)
NTv2GridShiftTransformation constructor.

Parameters:
ntv2_gridFile - file containing the description of the NTv2 grid
Method Detail

createNTv2GridShiftTransformation

public static NTv2GridShiftTransformation createNTv2GridShiftTransformation(String ntv2_gridName)
                                                                     throws URISyntaxException,
                                                                            MalformedURLException,
                                                                            NullPointerException
Create a NTv2GridShiftTransformation from the name of the file that defined it.

Parameters:
ntv2_gridName - the name of the file that defined the wanted grid transformation (for instance : ntf_r93.gsb).
Throws:
URISyntaxException
MalformedURLException
NullPointerException

transform

public double[] transform(double[] coord)
                   throws IllegalCoordinateException
Shift geographic coordinates (in decimal degrees) by an offset interpolated in a grid.

Specified by:
transform in interface CoordinateOperation
Specified by:
transform in class AbstractCoordinateOperation
Parameters:
coord - coordinate to shift
Returns:
a double array containing the output coordinate
Throws:
IllegalCoordinateException - if coord is not compatible with this CoordinateOperation.

inverse

public CoordinateOperation inverse()
                            throws NonInvertibleOperationException
Creates the inverse CoordinateOperation.

Specified by:
inverse in interface CoordinateOperation
Overrides:
inverse in class AbstractCoordinateOperation
Throws:
NonInvertibleOperationException

loadGridShiftFile

public void loadGridShiftFile()
                       throws IOException
Load the grid file that will be used to transform the coordinates.

Throws:
IOException

isLoaded

public boolean isLoaded()
Return whether the grid shift file used by this transformation is loaded or not.


unload

public void unload()
            throws IOException
Unload the grid shift file used by this transformation.

Throws:
IOException

setMode

public boolean setMode(int mode)
                throws IOException
Set the mode to access the grid shift file. If mode = 0 (SPEED), it will use an InputStream, if mode = 1 (LOW_MEMORY), it will use a RandomAccessFile. If the parameter mode is different from 0 or 1 or if it is equal to the current mode, this method will have no effect and return false.

Parameters:
mode - an integer representing a mode to access to grid shift file (see description above)
Returns:
true if a new mode has been set, false if not.
Throws:
IOException

toString

public String toString()
Returns this Geocentric translation as a String.

Overrides:
toString in class IdentifiableComponent

getFromDatum

public String getFromDatum()
Return the short name of the datum from which the nadgrids transformation must be used.


getToDatum

public String getToDatum()
Return the short name of the datum toward which the nadgrids transformation must be used.



Copyright © 2014 IRSTV CNRS-FR-2488. All Rights Reserved.