au.com.objectix.jgridshift
Class SubGrid

java.lang.Object
  extended byau.com.objectix.jgridshift.SubGrid
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable

public class SubGrid
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable

Models the NTv2 Sub Grid within a Grid Shift File

Author:
Peter Yuill
See Also:
Serialized Form

Constructor Summary
SubGrid(java.io.InputStream in, boolean bigEndian, boolean loadAccuracy)
          Construct a Sub Grid from an InputStream, loading the node data into arrays in this object.
SubGrid(java.io.RandomAccessFile raf, long subGridOffset, boolean bigEndian)
          Construct a Sub Grid from a RandomAccessFile.
 
Method Summary
 java.lang.Object clone()
          Make a deep clone of this Sub Grid
 java.lang.String getDetails()
           
 double getMaxLat()
           
 double getMaxLon()
           
 double getMinLat()
           
 double getMinLon()
           
 int getNodeCount()
           
 java.lang.String getParentSubGridName()
           
 SubGrid getSubGrid(int index)
           
 int getSubGridCount()
           
 SubGrid getSubGridForCoord(double lon, double lat)
          Tests if a specified coordinate is within this Sub Grid or one of its Sub Grids.
 java.lang.String getSubGridName()
           
 GridShift interpolateGridShift(GridShift gs)
          Interpolate shift and accuracy values for a coordinate in the 'from' datum of the GridShiftFile.
 void setSubGridArray(SubGrid[] subGrid)
          Set an array of Sub Grids of this sub grid
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SubGrid

public SubGrid(java.io.InputStream in,
               boolean bigEndian,
               boolean loadAccuracy)
        throws java.io.IOException
Construct a Sub Grid from an InputStream, loading the node data into arrays in this object.

Parameters:
in - GridShiftFile InputStream
bigEndian - is the file bigEndian?
loadAccuracy - is the node Accuracy data to be loaded?
Throws:
java.lang.Exception
java.io.IOException

SubGrid

public SubGrid(java.io.RandomAccessFile raf,
               long subGridOffset,
               boolean bigEndian)
        throws java.io.IOException
Construct a Sub Grid from a RandomAccessFile. Only the headers are loaded into this object, the node data is accessed directly from the RandomAccessFile.

Parameters:
bigEndian - is the file bigEndian?
Throws:
java.lang.Exception
java.io.IOException
Method Detail

getSubGridForCoord

public SubGrid getSubGridForCoord(double lon,
                                  double lat)
Tests if a specified coordinate is within this Sub Grid or one of its Sub Grids. If the coordinate is outside this Sub Grid, null is returned. If the coordinate is within this Sub Grid, but not within any of its Sub Grids, this Sub Grid is returned. If the coordinate is within one of this Sub Grid's Sub Grids, the method is called recursively on the child Sub Grid.

Parameters:
lon - Longitude in Positive West Seconds
lat - Latitude in Seconds
Returns:
the Sub Grid containing the Coordinate or null

interpolateGridShift

public GridShift interpolateGridShift(GridShift gs)
                               throws java.io.IOException
Interpolate shift and accuracy values for a coordinate in the 'from' datum of the GridShiftFile. The algorithm is described in 'GDAit Software Architecture Manual' produced by the Geomatics Department of the University of Melbourne

This method is thread safe for both memory based and file based node data.

Parameters:
gs - GridShift object containing the coordinate to shift and the shift values
Returns:
the GridShift object supplied, with values updated.
Throws:
java.io.IOException

getParentSubGridName

public java.lang.String getParentSubGridName()

getSubGridName

public java.lang.String getSubGridName()

getNodeCount

public int getNodeCount()

getSubGridCount

public int getSubGridCount()

getSubGrid

public SubGrid getSubGrid(int index)

setSubGridArray

public void setSubGridArray(SubGrid[] subGrid)
Set an array of Sub Grids of this sub grid

Parameters:
subGrid -

toString

public java.lang.String toString()

getDetails

public java.lang.String getDetails()

clone

public java.lang.Object clone()
Make a deep clone of this Sub Grid


getMaxLat

public double getMaxLat()
Returns:

getMaxLon

public double getMaxLon()
Returns:

getMinLat

public double getMinLat()
Returns:

getMinLon

public double getMinLon()
Returns: