|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.bbn.openmap.util.cacheHandler.CacheHandler com.bbn.openmap.layer.dted.DTEDFrameCache
public class DTEDFrameCache
The DTEDFrameCache is an object that retrieves DTED paths, frames or elevation values, given a latitude, longitude and dted level. It maintains a collection of the frames it has already used for quicker access later. The size of the cache is user-determined, and the cache also relies on user provided paths to the dted directory, which is the top level directory in a dted file structure. The paths are provided in a String array, so you can have data in different places on a system, including a CDROM drive.
Field Summary | |
---|---|
protected java.lang.String[] |
dtedDirPaths
An array of strings representing data directory paths. |
static java.lang.String |
DTEDFrameCacheSizeProperty
|
static java.lang.String |
DTEDPathsProperty
|
static int |
MAX_DTED_LEVEL
The maximum DTED level to check for data, given a lat/lon and a path to a dted data directory. |
static int |
NO_DATA
The elevation value returned if there is no data at a lat/lon. |
protected int |
numXSubframes
Number of subframes used by each frame. |
protected int |
numYSubframes
Number of subframes used by each frame. |
protected java.lang.String |
propertyPrefix
|
Fields inherited from class com.bbn.openmap.util.cacheHandler.CacheHandler |
---|
DEFAULT_MAX_CACHE_SIZE, logger, logicalClock, objs |
Fields inherited from interface com.bbn.openmap.PropertyConsumer |
---|
EditorProperty, initPropertiesProperty, LabelEditorProperty, ScopedEditorProperty |
Constructor Summary | |
---|---|
DTEDFrameCache()
|
|
DTEDFrameCache(java.lang.String[] dtedPaths,
int max_size)
Create the cache with paths to search for frames, and the maximum number of frames to keep on hand. |
Method Summary | |
---|---|
java.lang.String |
findFileName(double lat,
double lon,
int level)
A utility to find the path to a dted file, given a lat, lon and a dted level. |
protected java.lang.String |
findFileName(java.lang.String[] searchPaths,
java.lang.String partialFile)
Method to check the searchPaths for a file. |
DTEDSubframedFrame |
get(double lat,
double lon,
int level)
Return The Dted Frame, Given A Lat, Lon And Dted Level. |
int |
getElevation(float lat,
float lon)
Return the elevation of a lat/lon point, in meters. |
short[][] |
getElevations(EqualArc proj,
int dtedLevel)
Return the two-dimensional matrix of elevation posts (heights) representing coverage of a given geographical rectangle. |
short[][] |
getElevations(float ullat,
float ullon,
float lrlat,
float lrlon,
int dtedLevel)
Return the two-dimensional matrix of elevation posts (heights) representing coverage of a given geographical rectangle. |
protected short[][] |
getElevations(float ullat,
float ullon,
float lrlat,
float lrlon,
int dtedLevel,
DTEDSubframedFrame refFrame)
Return the two-dimensional matrix of elevation posts (heights) representing coverage of a given geographical rectangle. |
java.util.Properties |
getProperties(java.util.Properties props)
PropertyConsumer method. |
java.util.Properties |
getPropertyInfo(java.util.Properties props)
PropertyConsumer method. |
java.lang.String |
getPropertyPrefix()
PropertyConsumer method. |
CacheObject |
load(java.lang.Object key)
Load a dted frame into the cache, based on the path of the frame as a key. |
static void |
main(java.lang.String[] args)
|
void |
resizeCache(int max_size)
This version of resizeCache is for screen size changes, where the number of frames kept on hand in the cache must change, but the images themselves don't have to because the pixel/posting spacing hasn't changed in the projection. |
void |
resizeCache(int max_size,
int num_x_subframes,
int num_y_subframes)
This version of resizeCache is for projection changes, where the post/pixel spacing of the images has changed, and the images need to be rebuilt. |
void |
setDtedDirPaths(java.lang.String[] paths)
Set the data paths. |
void |
setProperties(java.util.Properties props)
PropertyConsumer method. |
void |
setProperties(java.lang.String prefix,
java.util.Properties props)
PropertyConsumer method. |
void |
setPropertyPrefix(java.lang.String prefix)
PropertyConsumer method. |
Methods inherited from class com.bbn.openmap.util.cacheHandler.CacheHandler |
---|
clear, get, getCacheSize, listIterator, replaceLeastUsed, resetCache, resetCache, searchCache |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int NO_DATA
public static final int MAX_DTED_LEVEL
protected java.lang.String[] dtedDirPaths
protected int numXSubframes
protected int numYSubframes
public static final java.lang.String DTEDPathsProperty
public static final java.lang.String DTEDFrameCacheSizeProperty
protected java.lang.String propertyPrefix
Constructor Detail |
---|
public DTEDFrameCache()
public DTEDFrameCache(java.lang.String[] dtedPaths, int max_size)
dtedPaths
- path to the level 0 and level 1 dted directoriesmax_size
- max number of frames to keep in the cache..Method Detail |
---|
public void setDtedDirPaths(java.lang.String[] paths)
paths
- paths to the dted level 0 and 1 directories.public java.lang.String findFileName(double lat, double lon, int level)
lat
- latitude of pointlon
- longitude of pointlevel
- the dted level wanted (0, 1, 2, 3)
protected java.lang.String findFileName(java.lang.String[] searchPaths, java.lang.String partialFile)
searchPaths
- an array of dted root directoriespartialFile
- the relative pathname of a dted frame file from the
dted root.
public DTEDSubframedFrame get(double lat, double lon, int level)
lat
- latitude of pointlon
- longitude of pointlevel
- the dted level wanted (0, 1, 2)
public CacheObject load(java.lang.Object key)
load
in class CacheHandler
key
- complete path to the frame, as a string.
public void resizeCache(int max_size, int num_x_subframes, int num_y_subframes)
max_size
- the maximum number of frames in the cache.num_x_subframes
- the number of horizontal subframes in each frame.num_y_subframes
- the number of vertical subframes in each frame.public void resizeCache(int max_size)
max_size
- the new size of the cache.public int getElevation(float lat, float lon)
lat
- in decimal degrees.lon
- in decimal degrees.
public short[][] getElevations(EqualArc proj, int dtedLevel)
proj
- the projection describing the wanted areadtedLevel
- the DTED level (0, 1, 2) to be used, which describes the
geographicsal spacing between the posts.
public short[][] getElevations(float ullat, float ullon, float lrlat, float lrlon, int dtedLevel)
ullat
- upper latitude, in decimal degreesullon
- left longitude, in decimal degreeslrlat
- lower latitude, in decimal degreeslrlon
- right longitude, in decimal degreesdtedLevel
- the DTED level (0, 1, 2) to be used, which describes the
geographicsal spacing between the posts.protected short[][] getElevations(float ullat, float ullon, float lrlat, float lrlon, int dtedLevel, DTEDSubframedFrame refFrame)
This method is slightly different that the one above, because it includes a input variable DTEDFrame. There is an inherent problem in the algorithm if some of the DTED frames are missing. It's too difficult to calculate the size of the return array if you don't know that any frames are available. So, you should always use the method above, which calls this method with a null refFrame. If some of the DTED frames are missing, then this method is called recursively, with a frame to use for calculating post spacings at the right time.
ullat
- upper latitude, in decimal degreesullon
- left longitude, in decimal degreeslrlat
- lower latitude, in decimal degreeslrlon
- right longitude, in decimal degreesdtedLevel
- the DTED level (0, 1, 2) to be used, which describes the
geographicsal spacing between the posts.refFrame
- DTEDFrame used to calculate measurements.
public void setPropertyPrefix(java.lang.String prefix)
setPropertyPrefix
in interface PropertyConsumer
prefix
- the prefix String.public java.lang.String getPropertyPrefix()
getPropertyPrefix
in interface PropertyConsumer
public void setProperties(java.util.Properties props)
setProperties
in interface PropertyConsumer
props
- a properties object that the PropertyConsumer
can use to retrieve expected properties it can use for
configuration.public void setProperties(java.lang.String prefix, java.util.Properties props)
setProperties
in interface PropertyConsumer
prefix
- a String used by the PropertyConsumer to prepend
to each property value it wants to look up -
setList.getProperty(prefix.propertyKey). If the prefix
had already been set, then the prefix passed in should
replace that previous value.props
- a Properties object that the PropertyConsumer
can use to retrieve expected properties it can use for
configuration.public java.util.Properties getProperties(java.util.Properties props)
getProperties
in interface PropertyConsumer
props
- a Properties object to load the PropertyConsumer
properties into. If getList equals null, then a new
Properties object should be created.
public java.util.Properties getPropertyInfo(java.util.Properties props)
getPropertyInfo
in interface PropertyConsumer
props
- a Properties object to load the PropertyConsumer
properties into. If getList equals null, then a new
Properties object should be created.
public static void main(java.lang.String[] args)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |