Class NTV2SubGrid

    • Constructor Detail

      • NTV2SubGrid

        public NTV2SubGrid​(InputStream in,
                           boolean bigEndian,
                           boolean loadAccuracy)
                    throws 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:
        IOException - if any I/O error occurs
    • Method Detail

      • getSubGridForCoord

        public NTV2SubGrid 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
      • isCoordWithin

        private boolean isCoordWithin​(double lon,
                                      double lat)
        Tests if a specified coordinate is within this Sub Grid. A coordinate on either outer edge (maximum Latitude or maximum Longitude) is deemed to be outside the grid.
        Parameters:
        lon - Longitude in Positive West Seconds
        lat - Latitude in Seconds
        Returns:
        true or false
      • interpolate

        private static double interpolate​(float a,
                                          float b,
                                          float c,
                                          float d,
                                          double x,
                                          double y)
        Bi-Linear interpolation of four nearest node values as described in 'GDAit Software Architecture Manual' produced by the Geomatics Department of the University of Melbourne
        Parameters:
        a - value at the A node
        b - value at the B node
        c - value at the C node
        d - value at the D node
        x - Longitude factor
        y - Latitude factor
        Returns:
        interpolated value
      • interpolateGridShift

        public void interpolateGridShift​(NTV2GridShift gs)
        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
      • getSubGridName

        public String getSubGridName()
        Returns the sub grid name.
        Returns:
        the sub grid name
      • getNodeCount

        public int getNodeCount()
        Returns the node count.
        Returns:
        the node count
      • getSubGridCount

        public int getSubGridCount()
        Returns the sub grid count.
        Returns:
        the sub grid count
      • setSubGridArray

        public void setSubGridArray​(NTV2SubGrid... subGrid)
        Set an array of Sub Grids of this sub grid
        Parameters:
        subGrid - subgrids
      • getDetails

        public String getDetails()
        Returns textual details about the sub grid.
        Returns:
        textual details about the sub grid
      • getMaxLat

        public double getMaxLat()
        Get maximum latitude value
        Returns:
        maximum latitude
      • getMaxLon

        public double getMaxLon()
        Get maximum longitude value
        Returns:
        maximum longitude
      • getMinLat

        public double getMinLat()
        Get minimum latitude value
        Returns:
        minimum latitude
      • getMinLon

        public double getMinLon()
        Get minimum longitude value
        Returns:
        minimum longitude