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.layer.dted
Class DTEDFrame

    java.lang.Object
      com.bbn.openmap.layer.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 it's data, and also maintains an array of images (DTEDFrameSubframe) that represent views of the elevation posts.

Field Summary
`static int` | `ACC_SIZE`
`static int` | `ACC_SR_SIZE`
`protected BinaryFile` | `binFile` The binary buffered file to read the data from the file.
`DTEDFrameColorTable` | `colorTable` The colortable used to create the images.
`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.
`int` | `number_horiz_subframes` The frame image is divided into 200x200 pixel subframes, with a leftover frame at the end.
`int` | `number_vert_subframes` The frame image is divided into 200x200 pixel subframes, with a leftover frame at the end.
`protected java.lang.String` | `path` The path to the frame, including the frame name.
`DTEDFrameSubframeInfo` | `subframeInfo` The subframe presentation attributes.
`DTEDFrameSubframe[][]` | `subframes` The image array for the subframes.
`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.
`DTEDFrame(java.lang.String filePath, DTEDFrameColorTable cTable, DTEDFrameSubframeInfo info)` Constructor with colortable and presentation information.
`DTEDFrame(java.lang.String filePath, DTEDFrameColorTable cTable, DTEDFrameSubframeInfo info, 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.
`DTEDFrameColorTable` | `getColorTable()`
`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.
`OMRaster` | `getOMRaster(DTEDFrameSubframeInfo dfsi, DTEDFrameColorTable colortable, EqualArc proj)` If you just want to get an image for the DTEDFrame, then call this.
`OMRaster` | `getOMRaster(EqualArc proj)` If you just want to get an image for the DTEDFrame, then call this.
`OMRaster` | `getSubframeOMRaster(DTEDFrameSubframeInfo dfsi, DTEDFrameColorTable colortable)` Return the subframe image as described in the DTEDFrameSubframeInfo.
`void` | `initSubframes(int numHorizSubframes, int numVertSubframes)` Sets the subframe array.
`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 boolean` | `read_data_record(int lon_index)` Reads one longitude line of posts.
`protected boolean` | `read_data_records()` Read all the elevation posts, at one time.
`protected void` | `read(BinaryFile binFile, boolean readWholeFile)` Reads the DTED frame file.
`protected boolean` | `reopen()` If the BinaryBufferedFile was closed, this method attempts to reopen it.
`void` | `setColorTable(DTEDFrameColorTable c_Table)`

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.

### colorTable

    public DTEDFrameColorTable colorTable

  The colortable used to create the images.

### subframeInfo

    public DTEDFrameSubframeInfo subframeInfo

  The subframe presentation attributes.

### frame_is_valid

    public boolean frame_is_valid

  Validity flag for the quality of the data file.

### number_horiz_subframes

    public int number_horiz_subframes

  The frame image is divided into 200x200 pixel subframes, with a leftover frame at the end. This is how many horizontal subframes there are.

### number_vert_subframes

    public int number_vert_subframes

  The frame image is divided into 200x200 pixel subframes, with a leftover frame at the end. This is how many vertical subframes there are.

### subframes

    public DTEDFrameSubframe[][] subframes

  The image array for the subframes.

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,
                     DTEDFrameColorTable cTable,
                     DTEDFrameSubframeInfo info)

  Constructor with colortable and presentation information.

Parameters:
  `filePath` - complete path to the DTED frame.
  `cTable` - the colortable to use for the images.
  `info` - presentation parameters.

### 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.

### DTEDFrame

    public DTEDFrame(java.lang.String filePath,
                     DTEDFrameColorTable cTable,
                     DTEDFrameSubframeInfo info,
                     boolean readWholeFile)

  Constructor with colortable and presentation information.

Parameters:
  `filePath` - complete path to the DTED frame.
  `cTable` - the colortable to use for the images.
  `info` - presentation parameters.
  `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

### setColorTable

    public void setColorTable(DTEDFrameColorTable c_Table)

### getColorTable

    public DTEDFrameColorTable getColorTable()

### 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.

### read_data_record

    protected boolean read_data_record(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

### read_data_records

    protected boolean read_data_records()

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

  Returns:
    true if the elevation columns were read.

### initSubframes

    public void initSubframes(int numHorizSubframes,
                              int numVertSubframes)

  Sets the subframe array. Blows away any images that may already be there.

### 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.

### getOMRaster

    public OMRaster getOMRaster(DTEDFrameSubframeInfo dfsi,
                                DTEDFrameColorTable colortable,
                                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. In the DTEDFrameSubframeInfo, you need to set the color type and all the parameters that are assiociated with the rendering parameters. The projection parameters of the DFSI (image height, width, pixel intervals) will be set in this method based on the projection. If you want a different sized image, scale the thing you get back from this method, or change the scale of the projection that is passed in. Calling this method will cause the DTEDFrame subframe cache to reset itself to hold one subframe covering the entire frame. Just so you know.

  Parameters:
    `dfsi` - the DTEDFrameSubframeInfo describing the subframe.
    `colortable` - the colortable to use when building the image.
    `proj` - EqualArc projection to use to create image.
  Returns:
    raster image to display in OpenMap.

### getSubframeOMRaster

    public OMRaster getSubframeOMRaster(DTEDFrameSubframeInfo dfsi,
                                        DTEDFrameColorTable colortable)

  Return the subframe image as described in the DTEDFrameSubframeInfo. This is called by the DTEDCacheHandler, which has in turn set the DTEDFrameSubframeInfo parameters to match the projection parameters. This turns out to be kinda important.

  Parameters:
    `dfsi` - the DTEDFrameSubframeInfo describing the subframe.
    `colortable` - the colortable to use when building the 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