|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.bbn.openmap.util.cacheHandler.CacheHandler
com.bbn.openmap.dataAccess.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 determined by startup settings.
The DTEDFrameCache can be placed in the MapHandler, where other objects can share it in order to all use the same DTED data. It can be configured with properties:
frameCache.cacheSize=40
frameCache.directoryHandlers=dteddir1 dteddir2
frameCache.dteddir1.translator=com.bbn.openmap.dataAccess.dted.StandardDTEDNameTranslator
frameCache.dteddir1.path=/data/dted
frameCache.dteddir2.translator=com.bbn.openmap.dataAccess.dted.StandardDTEDNameTranslator
frameCache.dteddir2.path=/data/dted
A DTEDDirectoryHandler needs to be specified for each DTED directory you want
to use. If a translator isn't specified in the properties for a directory
handler, the StandardDTEDNameTranslator will be used. If you have DTED data
that doesn't conform to the naming conventions specified in the Military
Standard, you can use a different DTEDNameTranslator instead for your
particular directory handler.
| Field Summary | |
|---|---|
int |
DEFAULT_CACHE_SIZE
|
protected java.util.Vector |
directories
|
static java.lang.String |
DTEDDirectoryHandlerProperty
|
static java.lang.String |
DTEDFrameCacheSizeProperty
|
protected int |
highestResLevel
|
static int |
NO_DATA
The elevation value returned if there is no data at a lat/lon (-32767). |
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(int max_size)
Create the cache with paths to search for frames, and the maximum number of frames to keep on hand. |
|
| Method Summary | |
|---|---|
void |
addDTEDDirectoryHandler(DTEDDirectoryHandler handler)
Add a DTED DirectoryHandler to be used for the DTEDFrameCache. |
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. |
DTEDFrame |
get(double lat,
double lon,
int level)
Return The DTED Frame, Given A Lat, Lon And DTED Level. |
java.util.Vector |
getDTEDDirectoryHandlers()
Get the Vector of DTEDDirectoryHandlers used by the DTEDFrameCache. |
int |
getElevation(float lat,
float lon)
Return the elevation of a lat/lon point, in meters. |
int |
getElevation(float lat,
float lon,
int level)
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,
DTEDFrame refFrame)
Return the two-dimensional matrix of elevation posts (heights) representing coverage of a given geographical rectangle. |
int |
getHighestResLevel()
|
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 |
removeDTEDDirectoryHandler(DTEDDirectoryHandler handler)
Remove a DTED DirectoryHandler from the list used for the DTEDFrameCache. |
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 |
setDTEDDirectoryHandlers(java.util.Vector handlers)
Set the Vector of DTEDDirectoryHandlers used by the DTEDFrameCache. |
void |
setHighestResLevel(int highestResLevel)
|
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 java.lang.String DTEDDirectoryHandlerProperty
public static final java.lang.String DTEDFrameCacheSizeProperty
public int DEFAULT_CACHE_SIZE
protected java.lang.String propertyPrefix
protected java.util.Vector directories
protected int highestResLevel
| Constructor Detail |
|---|
public DTEDFrameCache()
public DTEDFrameCache(int max_size)
max_size - max number of frames to keep in the cache..| Method Detail |
|---|
public void addDTEDDirectoryHandler(DTEDDirectoryHandler handler)
public void removeDTEDDirectoryHandler(DTEDDirectoryHandler handler)
public java.util.Vector getDTEDDirectoryHandlers()
public void setDTEDDirectoryHandlers(java.util.Vector handlers)
public java.lang.String findFileName(double lat,
double lon,
int level)
lat - latitude of pointlon - longitude of pointlevel - the dted level wanted (0, 1)
public DTEDFrame 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 CacheHandlerkey - complete path to the frame, String.
public void resizeCache(int max_size)
max_size - the new size of the cache.public int getHighestResLevel()
public void setHighestResLevel(int highestResLevel)
public int getElevation(float lat,
float lon)
lat - in decimal degrees.lon - in decimal degrees.
public int getElevation(float lat,
float lon,
int level)
lat - in decimal degrees.lon - in decimal degrees.level - the dted level.
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,
DTEDFrame 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 PropertyConsumerprefix - the prefix String.public java.lang.String getPropertyPrefix()
getPropertyPrefix in interface PropertyConsumerpublic void setProperties(java.util.Properties props)
setProperties in interface PropertyConsumerprops - 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 PropertyConsumerprefix - 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 PropertyConsumerprops - 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 PropertyConsumerprops - 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 | |||||||||