Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.bbn.openmap.dataAccess.dted
Class DTEDFrame

    java.lang.Object
      com.bbn.openmap.dataAccess.dted.DTEDFrame

All Implemented Interfaces:
  Closable

public class DTEDFrame
extends java.lang.Object
implements Closable

The DTEDFrame is the representation of the DTED (Digital Terrain Elevation Data) data from a single dted data file. It keeps track of all the attribute information of its data. It can return an OMGrid object that can be configured to create a visual representation of the data, depending on what OMGridGenerators are used on the OMGrid object.

Field Summary
`DTEDFrameACC` | `acc` Accuracy description section of the file.
`static int` | `ACC_SIZE`
`static int` | `ACC_SR_SIZE`
`protected BinaryFile` | `binFile` The binary buffered file to read the data from the file.
`DTEDFrameDSI` | `dsi` Data set indentification section of the file.
`static int` | `DSI_SIZE`
`protected short[][]` | `elevations` The array of elevation posts.
`boolean` | `frame_is_valid` Validity flag for the quality of the data file.
`protected java.lang.String` | `path` The path to the frame, including the frame name.
`DTEDFrameUHL` | `uhl` User header label section of the file.
`static int` | `UHL_SIZE`

Constructor Summary
`DTEDFrame(java.lang.String filePath)` Simplest constructor.
`DTEDFrame(java.lang.String filePath, boolean readWholeFile)` Constructor with colortable and presentation information.

Method Summary
`boolean` | `close(boolean done)` Part of the Closable interface.
`void` | `dispose()` This must get called to break a reference cycle that prevents the garbage collection of frames.
`int` | `elevationAt(float lat, float lon)` The elevation at the closest SW post to the given lat/lon.
`short[][]` | `getElevations(float ullat, float ullon, float lrlat, float lrlon)` Return a two dimensional array of posts between lat lons.
`short[][]` | `getElevations(int startx, int starty, int endx, int endy)` Return a two dimensional array of posts between lat lons.
`int[]` | `getIndexesFromLatLons(float ullat, float ullon, float lrlat, float lrlon)` Return an index of ints representing the starting x, y and ending x, y of elevation posts given a lat lon box.
`OMGrid` | `getOMGrid()`
`OMRaster` | `getOMRaster(EqualArc proj)` If you just want to get an image for the DTEDFrame, then call this.
`int` | `interpElevationAt(float lat, float lon)` Interpolated elevation at a given lat/lon - should be more precise than elevationAt(), but that depends on the resolution of the data.
`static void` | `main(java.lang.String[] args)`
`protected void` | `read(BinaryFile binFile, boolean readWholeFile)` Reads the DTED frame file.
`protected boolean` | `readDataRecord(int lon_index)` Reads one longitude line of posts.
`protected boolean` | `readDataRecords()` Read all the elevation posts, at one time.
`protected boolean` | `reopen()` If the BinaryBufferedFile was closed, this method attempts to reopen it.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### UHL_SIZE

    public static final int UHL_SIZE

See Also:
  Constant Field Values

### DSI_SIZE

    public static final int DSI_SIZE

See Also:
  Constant Field Values

### ACC_SIZE

    public static final int ACC_SIZE

See Also:
  Constant Field Values

### ACC_SR_SIZE

    public static final int ACC_SR_SIZE

See Also:
  Constant Field Values

### binFile

    protected BinaryFile binFile

  The binary buffered file to read the data from the file.

### path

    protected java.lang.String path

  The path to the frame, including the frame name.

### elevations

    protected short[][] elevations

  The array of elevation posts. Note: the 0 index of the array in both directions is in the lower left corner of the matrix. As you increase indexes in both dimensions, you go up-right.

### dsi

    public DTEDFrameDSI dsi

  Data set indentification section of the file.

### uhl

    public DTEDFrameUHL uhl

  User header label section of the file.

### acc

    public DTEDFrameACC acc

  Accuracy description section of the file.

### frame_is_valid

    public boolean frame_is_valid

  Validity flag for the quality of the data file.

Constructor Detail

### DTEDFrame

    public DTEDFrame(java.lang.String filePath)

  Simplest constructor.

Parameters:
  `filePath` - complete path to the DTED frame.

### DTEDFrame

    public DTEDFrame(java.lang.String filePath,
                     boolean readWholeFile)

  Constructor with colortable and presentation information.

Parameters:
  `filePath` - complete path to the DTED frame.
  `readWholeFile` - If true, all of the elevation data will be read at load time. If false, elevation post data will be read in per longitude column depending on the need. False is recommended for DTEd level 1 and 2.

Method Detail

### read

    protected void read(BinaryFile binFile,
                        boolean readWholeFile)

  Reads the DTED frame file. Assumes that the File f is valid/exists.

  Parameters:
    `binFile` - the binary buffere file opened on the DTED frame file
    `readWholeFile` - flag controlling whether all the row data is read at this time. Otherwise, the rows are read as needed.

### dispose

    public void dispose()

  This must get called to break a reference cycle that prevents the garbage collection of frames.

### close

    public boolean close(boolean done)

  Part of the Closable interface. Closes the BinaryFile pointer, because someone else needs another file open, and the system needs a file pointer. Sets the binFile variable to null.

  Specified by:
    `close` in interface `Closable`
  Parameters:
    `done` - `true` indicates that this is a permanent closure. `false` indicates that the object may be used again later, as this is only an attempt to temporarily reclaim resources
  Returns:
    `true` indicates the object is still usable. `false` indicates that the object is now unusable, and any references to it should be released so the garbage collector can do its job.

### reopen

    protected boolean reopen()

  If the BinaryBufferedFile was closed, this method attempts to reopen it.

  Returns:
    true if the opening was successful.

### elevationAt

    public int elevationAt(float lat,
                           float lon)

  The elevation at the closest SW post to the given lat/lon. This is just a go-to-the-closest-post solution.

  Parameters:
    `lat` - latitude in decimal degrees.
    `lon` - longitude in decimal degrees.
  Returns:
    elevation at lat/lon in meters.

### interpElevationAt

    public int interpElevationAt(float lat,
                                 float lon)

  Interpolated elevation at a given lat/lon - should be more precise than elevationAt(), but that depends on the resolution of the data.

  Parameters:
    `lat` - latitude in decimal degrees.
    `lon` - longitude in decimal degrees.
  Returns:
    elevation at lat/lon in meters.

### getIndexesFromLatLons

    public int[] getIndexesFromLatLons(float ullat,
                                       float ullon,
                                       float lrlat,
                                       float lrlon)

  Return an index of ints representing the starting x, y and ending x, y of elevation posts given a lat lon box. It does check to make sure that the upper lat is larger than the lower, and left lon is less than the right.

  Parameters:
    `ullat` - upper latitude in decimal degrees.
    `ullon` - left longitude in decimal degrees.
    `lrlat` - lower latitude in decimal degrees.
    `lrlon` - right longitude in decimal degrees.
  Returns:
    int[4] array of start x, start y, end x, and end y.

### getElevations

    public short[][] getElevations(float ullat,
                                   float ullon,
                                   float lrlat,
                                   float lrlon)

  Return a two dimensional array of posts between lat lons.

  Parameters:
    `ullat` - upper latitude in decimal degrees.
    `ullon` - left longitude in decimal degrees.
    `lrlat` - lower latitude in decimal degrees.
    `lrlon` - right longitude in decimal degrees.
  Returns:
    array of elevations in meters. The spacing of the posts depends on the DTED level.

### getElevations

    public short[][] getElevations(int startx,
                                   int starty,
                                   int endx,
                                   int endy)

  Return a two dimensional array of posts between lat lons. Assumes that the indexes are checked to not exceed their bounds as defined in the file. getIndexesFromLatLons() checks this.

  Parameters:
    `startx` - starting index (left) of the greater matrix to make the left side of the returned matrix.
    `starty` - starting index (lower) of the greater matrix to make the bottom side of the returned matrix.
    `endx` - ending index (right) of the greater matrix to make the left side of the returned matrix.
    `endy` - ending index (top) of the greater matrix to make the top side of the returned matrix.
  Returns:
    array of elevations in meters. The spacing of the posts depends on the DTED level.

### readDataRecord

    protected boolean readDataRecord(int lon_index)

  Reads one longitude line of posts. Assumes that the binFile is valid.

  Returns:
    true if the column of data was successfully read

### readDataRecords

    protected boolean readDataRecords()

  Read all the elevation posts, at one time. Assumes that the file is open and ready.

  Returns:
    true if the elevation columns were read.

### getOMGrid

    public OMGrid getOMGrid()

### getOMRaster

    public OMRaster getOMRaster(EqualArc proj)

  If you just want to get an image for the DTEDFrame, then call this. One OMRaster for the entire DTEDFrame will be returned, with the default rendering parameters (Colored shading) and the default colortable. Use the other getOMRaster method if you want something different. This method actually calls that other method, so read the documentation for that as well.

  Parameters:
    `proj` - EqualArc projection to use to create image.
  Returns:
    raster image to display in OpenMap.

### main

    public static void main(java.lang.String[] args)

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright (C) BBNT Solutions LLC; See http://openmap.bbn.com/ for details