Class NTV2SubGrid
- java.lang.Object
-
- org.openstreetmap.josm.data.projection.datum.NTV2SubGrid
-
- All Implemented Interfaces:
java.io.Serializable
public class NTV2SubGrid extends java.lang.Object implements java.io.Serializable
Models the NTv2 Sub Grid within a Grid Shift File.- Since:
- 2507
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.Stringcreatedprivate float[]latAccuracyprivate doublelatIntervalprivate intlatRowCountprivate float[]latShiftprivate float[]lonAccuracyprivate intlonColumnCountprivate doublelonIntervalprivate float[]lonShiftprivate doublemaxLatprivate doublemaxLonprivate doubleminLatprivate doubleminLonprivate intnodeCountprivate java.lang.StringparentSubGridNameprivate static longserialVersionUIDprivate NTV2SubGrid[]subGridprivate java.lang.StringsubGridNameprivate java.lang.Stringupdated
-
Constructor Summary
Constructors Constructor Description NTV2SubGrid(java.io.InputStream in, boolean bigEndian, boolean loadAccuracy)Construct a Sub Grid from an InputStream, loading the node data into arrays in this object.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetDetails()Returns textual details about the sub grid.doublegetMaxLat()Get maximum latitude valuedoublegetMaxLon()Get maximum longitude valuedoublegetMinLat()Get minimum latitude valuedoublegetMinLon()Get minimum longitude valueintgetNodeCount()Returns the node count.java.lang.StringgetParentSubGridName()Returns the parent sub grid name.intgetSubGridCount()Returns the sub grid count.NTV2SubGridgetSubGridForCoord(double lon, double lat)Tests if a specified coordinate is within this Sub Grid or one of its Sub Grids.java.lang.StringgetSubGridName()Returns the sub grid name.private static doubleinterpolate(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 MelbournevoidinterpolateGridShift(NTV2GridShift gs)Interpolate shift and accuracy values for a coordinate in the 'from' datum of the GridShiftFile.private booleanisCoordWithin(double lon, double lat)Tests if a specified coordinate is within this Sub Grid.private static voidreadBytes(java.io.InputStream in, byte[] b)voidsetSubGridArray(NTV2SubGrid... subGrid)Set an array of Sub Grids of this sub gridjava.lang.StringtoString()
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
subGridName
private final java.lang.String subGridName
-
parentSubGridName
private final java.lang.String parentSubGridName
-
created
private final java.lang.String created
-
updated
private final java.lang.String updated
-
minLat
private final double minLat
-
maxLat
private final double maxLat
-
minLon
private final double minLon
-
maxLon
private final double maxLon
-
latInterval
private final double latInterval
-
lonInterval
private final double lonInterval
-
nodeCount
private final int nodeCount
-
lonColumnCount
private final int lonColumnCount
-
latRowCount
private final int latRowCount
-
latShift
private final float[] latShift
-
lonShift
private final float[] lonShift
-
latAccuracy
private float[] latAccuracy
-
lonAccuracy
private float[] lonAccuracy
-
subGrid
private NTV2SubGrid[] subGrid
-
-
Constructor Detail
-
NTV2SubGrid
public NTV2SubGrid(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 InputStreambigEndian- is the file bigEndian?loadAccuracy- is the node Accuracy data to be loaded?- Throws:
java.io.IOException- if any I/O error occurs
-
-
Method Detail
-
readBytes
private static void readBytes(java.io.InputStream in, byte[] b) throws java.io.IOException
- Throws:
java.io.IOException
-
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 Secondslat- 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 Secondslat- 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 nodeb- value at the B nodec- value at the C noded- value at the D nodex- Longitude factory- 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 MelbourneThis 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
-
getParentSubGridName
public java.lang.String getParentSubGridName()
Returns the parent sub grid name.- Returns:
- the parent sub grid name
-
getSubGridName
public java.lang.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
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
getDetails
public java.lang.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
-
-