com.bbn.openmap.layer.dted
Class DTEDCoverageManager

java.lang.Object
  |
  +--com.bbn.openmap.layer.dted.DTEDCoverageManager

public class DTEDCoverageManager
extends java.lang.Object

A DTEDCoverageManager knows how to look at DTED data and figure out what coverage is available. When it is constructed, it needs to know where the data is located, and where it can look for a coverage summary file. If a coverage summary file is not available, it will create one after looking at the data. Using the file is soooo much faster. The coverage manager also takes a URL of a coverage file, but assumes that the file is there. If it isn't, then it falls back on it's behavior of looking for a local summary file, and then to the data itself, to come up with coverage.


Field Summary
static java.lang.String defaultLevel0ColorString
          The default line color for level 0.
static java.lang.String defaultLevel1ColorString
          The default line color for level 1.
static java.lang.String defaultLevel2ColorString
          The default line color for level 2.
protected  boolean fillRects
          Flag to fill the coverage rectangles.
protected  java.awt.Paint level0Color
          The color to outline the shapes for level 0.
protected  boolean[][] level0Frames
          The array of coverage for level 0 data.
protected  java.awt.Paint level1Color
          The color to outline the shapes for level 1.
protected  boolean[][] level1Frames
          The array of coverage for level 1 data.
protected  java.awt.Paint level2Color
          The color to outline the shapes for level 2.
protected  boolean[][] level2Frames
          The array of coverage for level 2 data.
protected  int opaqueness
          A setting for how transparent to make the images.
protected  ProgressSupport progressSupport
           
 
Constructor Summary
DTEDCoverageManager(java.lang.String[] paths, java.lang.String[] paths2, java.lang.String coverageURL, java.lang.String coverageFile)
           
 
Method Summary
 void addProgressListener(ProgressListener list)
          Add a ProgressListener that will display build progress.
 void checkOutCoverage(java.lang.String[] paths, java.lang.String[] paths2)
          The method that cycles through all the paths, looking for the frames.
 void clearProgressListeners()
          Clear all progress listeners.
protected  byte[] convertBooleansToBytes(boolean[] row)
          Convert the booleans to write out to bytes.
protected  boolean[] convertBytesToBooleans(byte[] row)
          Convert the bytes read in to the file to the booleans used in the coverage arrays.
protected  void fireProgressUpdate(int type, java.lang.String task, int frameNumber, int totalFrames)
          Fire an build update to progress listeners.
 OMGraphicList[] getCoverageRects(int startx, int starty, int endx, int endy, int LineType)
          Method looks at the coverage arrays, and returns the applicable rectangles representing the frame coverages.
 OMGraphicList[] getCoverageRects(Projection proj)
          Method organizes the query based on the projection, and returns the applicable rectangles representing the frame coverages.
 boolean readCoverageFile(java.lang.String coverage)
          Read in the coverage file, which is basically three byte[180][360] written out to file.
protected  boolean readCoverageFile(java.lang.String urlCov, java.lang.String coverage)
          Read in the coverage file, which is basically three byte[180][360] written out to file.
 void removeProgressListener(ProgressListener list)
          Remove a ProgressListener that displayed build progress.
 void setPaint(java.awt.Paint lev0Color, java.awt.Paint lev1Color, java.awt.Paint lev2Color, int opaque, boolean fillRectangles)
          Set the color arraignment for the rectangles.
 void writeCoverageFile(java.lang.String covFilename)
          Write the coverage summary to a file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

defaultLevel0ColorString

public static final java.lang.String defaultLevel0ColorString
The default line color for level 0.

See Also:
Constant Field Values

defaultLevel1ColorString

public static final java.lang.String defaultLevel1ColorString
The default line color for level 1.

See Also:
Constant Field Values

defaultLevel2ColorString

public static final java.lang.String defaultLevel2ColorString
The default line color for level 2.

See Also:
Constant Field Values

level0Color

protected java.awt.Paint level0Color
The color to outline the shapes for level 0.


level1Color

protected java.awt.Paint level1Color
The color to outline the shapes for level 1.


level2Color

protected java.awt.Paint level2Color
The color to outline the shapes for level 2.


opaqueness

protected int opaqueness
A setting for how transparent to make the images. The default is 255, which is totally opaque.


fillRects

protected boolean fillRects
Flag to fill the coverage rectangles.


level0Frames

protected boolean[][] level0Frames
The array of coverage for level 0 data.


level1Frames

protected boolean[][] level1Frames
The array of coverage for level 1 data.


level2Frames

protected boolean[][] level2Frames
The array of coverage for level 2 data.


progressSupport

protected ProgressSupport progressSupport
Constructor Detail

DTEDCoverageManager

public DTEDCoverageManager(java.lang.String[] paths,
                           java.lang.String[] paths2,
                           java.lang.String coverageURL,
                           java.lang.String coverageFile)
Method Detail

setPaint

public void setPaint(java.awt.Paint lev0Color,
                     java.awt.Paint lev1Color,
                     java.awt.Paint lev2Color,
                     int opaque,
                     boolean fillRectangles)
Set the color arraignment for the rectangles. Opaqueness is not supported in JDK 1.1, so this doesn't really mean anything. It's a hook for later.

Parameters:
lev0Color - Paint for level 0 frame rectangles.
lev1Color - Paint for level 1 frame rectangles.
lev2Color - Paint for level 2 frame rectangles.
opaque - how transparent the frames should be if they are filled.
fillRectangles - whether to fill the rectangles with Paint.

checkOutCoverage

public void checkOutCoverage(java.lang.String[] paths,
                             java.lang.String[] paths2)
The method that cycles through all the paths, looking for the frames. This takes time, so it's only done when a coverage file can't be found.

Parameters:
paths - paths to the level 0 and 1 dted root directory.
paths2 - paths to the level 2 dted root directory.

getCoverageRects

public OMGraphicList[] getCoverageRects(Projection proj)
Method organizes the query based on the projection, and returns the applicable rectangles representing the frame coverages. If the coverage spans over the dateline, then two queries are performed, one for each side of the dateline.

Parameters:
proj - the projection of the screen
Returns:
an array of lists, one for each level of dted data.

getCoverageRects

public OMGraphicList[] getCoverageRects(int startx,
                                        int starty,
                                        int endx,
                                        int endy,
                                        int LineType)
Method looks at the coverage arrays, and returns the applicable rectangles representing the frame coverages.

Parameters:
startx - the western-most longitude.
starty - the southern-most latitude.
endx - the eastern-most longitude.
endy - the northern-most latitude.
LineType - the type of line to use on the rectangles - Cylindrical projections can use straight lines, but other projections should use Rhumb lines.
Returns:
an array of lists, one for each level of dted data.

readCoverageFile

public boolean readCoverageFile(java.lang.String coverage)
Read in the coverage file, which is basically three byte[180][360] written out to file. These are converted to booleans.

Parameters:
coverage - the path to the file.
Returns:
whether the file was read! True means yes.

readCoverageFile

protected boolean readCoverageFile(java.lang.String urlCov,
                                   java.lang.String coverage)
Read in the coverage file, which is basically three byte[180][360] written out to file. These are converted to booleans.

Parameters:
urlCov - an url to a coverage file, if available. Should be null if not used.
coverage - the path to the file.
Returns:
whether the file was read! True means yes.

convertBytesToBooleans

protected boolean[] convertBytesToBooleans(byte[] row)
Convert the bytes read in to the file to the booleans used in the coverage arrays.

Parameters:
row - array of bytes
Returns:
array of booleans

convertBooleansToBytes

protected byte[] convertBooleansToBytes(boolean[] row)
Convert the booleans to write out to bytes.

Parameters:
row - the input array of booleans
Returns:
an array of bytes.

writeCoverageFile

public void writeCoverageFile(java.lang.String covFilename)
Write the coverage summary to a file.

Parameters:
covFilename - the file name to write the arrays into.

addProgressListener

public void addProgressListener(ProgressListener list)
Add a ProgressListener that will display build progress.


removeProgressListener

public void removeProgressListener(ProgressListener list)
Remove a ProgressListener that displayed build progress.


clearProgressListeners

public void clearProgressListeners()
Clear all progress listeners.


fireProgressUpdate

protected void fireProgressUpdate(int type,
                                  java.lang.String task,
                                  int frameNumber,
                                  int totalFrames)
Fire an build update to progress listeners.

Parameters:
frameNumber - the current frame count
totalFrames - the total number of frames.


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