|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.openstreetmap.josm.data.projection.datum.NTV2GridShiftFile
public class NTV2GridShiftFile
Models the NTv2 format Grid Shift File and exposes methods to shift coordinate values using the Sub Grids contained in the file.
The principal reference for the alogrithms used is the 'GDAit Software Architecture Manual' produced by the Geomatics Department of the University of Melbourne
This library reads binary NTv2 Grid Shift files in Big Endian (Canadian standard) or Little Endian (Australian Standard) format. The older 'Australian' binary format is not supported, only the official Canadian format, which is now also used for the national Australian Grid.
Grid Shift files can be read as InputStreams or RandomAccessFiles. Loading an InputStream places all the required node information (accuracy data is optional) into heap based Java arrays. This is the highest perfomance option, and is useful for large volume transformations. Non-file data sources (eg using an SQL Blob) are also supported through InputStream. The RandonAccessFile option has a much smaller memory footprint as only the Sub Grid headers are stored in memory, but transformation is slower because the file must be read a number of times for each transformation.
Coordinates may be shifted Forward (ie from and to the Datums specified in the Grid Shift File header) or Reverse. The reverse transformation uses an iterative approach to approximate the Grid Shift, as the precise transformation is based on 'from' datum coordinates.
Coordinates may be specified either in Seconds using Positive West Longitude (the original NTv2 arrangement) or in decimal Degrees using Positive East Longitude.
Field Summary | |
---|---|
private java.lang.String |
fromEllipsoid
|
private double |
fromSemiMajorAxis
|
private double |
fromSemiMinorAxis
|
private NTV2SubGrid |
lastSubGrid
|
private int |
overviewHeaderCount
|
private java.lang.String |
overviewHeaderCountId
|
private java.lang.String |
shiftType
|
private int |
subGridCount
|
private int |
subGridHeaderCount
|
private java.lang.String |
toEllipsoid
|
private NTV2SubGrid[] |
topLevelSubGrid
|
private double |
toSemiMajorAxis
|
private double |
toSemiMinorAxis
|
private java.lang.String |
version
|
Constructor Summary | |
---|---|
NTV2GridShiftFile()
|
Method Summary | |
---|---|
private NTV2SubGrid[] |
createSubGridTree(NTV2SubGrid[] subGrid)
Create a tree of Sub Grids by adding each Sub Grid to its parent (where it has one), and returning an array of the top level Sub Grids |
java.lang.String |
getFromEllipsoid()
|
private NTV2SubGrid |
getSubGrid(double lon,
double lat)
Find the finest SubGrid containing the coordinate, specified in Positive West Seconds |
NTV2SubGrid[] |
getSubGridTree()
Get a copy of the SubGrid tree for this file. |
java.lang.String |
getToEllipsoid()
|
boolean |
gridShiftForward(NTV2GridShift gs)
Shift a coordinate in the Forward direction of the Grid Shift File. |
boolean |
gridShiftReverse(NTV2GridShift gs)
Shift a coordinate in the Reverse direction of the Grid Shift File. |
boolean |
isLoaded()
|
void |
loadGridShiftFile(java.io.InputStream in,
boolean loadAccuracy)
Load a Grid Shift File from an InputStream. |
java.lang.String |
toString()
|
void |
unload()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private java.lang.String overviewHeaderCountId
private int overviewHeaderCount
private int subGridHeaderCount
private int subGridCount
private java.lang.String shiftType
private java.lang.String version
private java.lang.String fromEllipsoid
private java.lang.String toEllipsoid
private double fromSemiMajorAxis
private double fromSemiMinorAxis
private double toSemiMajorAxis
private double toSemiMinorAxis
private NTV2SubGrid[] topLevelSubGrid
private NTV2SubGrid lastSubGrid
Constructor Detail |
---|
public NTV2GridShiftFile()
Method Detail |
---|
public void loadGridShiftFile(java.io.InputStream in, boolean loadAccuracy) throws java.io.IOException
The InputStream is closed by this method.
in
- Grid Shift File InputStreamloadAccuracy
- is Accuracy data to be loaded as well as shift data?
java.lang.Exception
java.io.IOException
private NTV2SubGrid[] createSubGridTree(NTV2SubGrid[] subGrid)
subGrid
- an array of all Sub Grids
public boolean gridShiftForward(NTV2GridShift gs)
gs
- A GridShift object containing the coordinate to shift
java.io.IOException
public boolean gridShiftReverse(NTV2GridShift gs)
gs
- A GridShift object containing the coordinate to shift
java.io.IOException
private NTV2SubGrid getSubGrid(double lon, double lat)
lon
- Longitude in Positive West Secondslat
- Latitude in Seconds
public boolean isLoaded()
public void unload()
public java.lang.String toString()
toString
in class java.lang.Object
public NTV2SubGrid[] getSubGridTree()
public java.lang.String getFromEllipsoid()
public java.lang.String getToEllipsoid()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |