public class Dt2FileWatcher
extends java.lang.Thread
Modifier and Type | Class and Description |
---|---|
static interface |
Dt2FileWatcher.Listener
DTED files updated
|
Constructor and Description |
---|
Dt2FileWatcher(MapView mapView,
java.util.List<java.io.File> rootDirs) |
Modifier and Type | Method and Description |
---|---|
void |
addListener(Dt2FileWatcher.Listener l) |
boolean |
delete(int level,
java.io.File file)
Delete all DTED files given a level
|
boolean |
delete(int level,
java.lang.String path)
Delete all DTED files given a level
|
void |
dispose() |
java.util.BitSet |
getCoverage(int level)
Get coverage set for a specific DTED level
|
static int |
getCoverageIndex(int latitude,
int longitude)
Get the coverage set index given a latitude and longitude
|
java.util.BitSet[] |
getCoverages()
Get all coverage sets
|
int |
getFileCount()
Get the total file count in all DTED directories
|
int |
getFileCount(int level,
java.lang.String dir)
Get file count in directory
|
java.util.List<java.lang.String> |
getFiles(int level,
java.lang.String dir)
Get a list of files within a cached directory
This is faster than calling
File.listFiles() |
java.util.List<java.io.File> |
getFiles(java.lang.String path)
Get corresponding file on each root given a relative path
|
java.util.BitSet |
getFullCoverage()
Get a coverage set for all DTED levels
|
static Dt2FileWatcher |
getInstance() |
static java.lang.String |
getRelativePath(java.io.File file)
Get a relative path given a file (excludes /atak/ directory)
|
static java.lang.String |
getRelativePath(int level,
double lat,
double lng)
Get the file path relative to the "DTED" directory for a given
latitude and longitude
i.e.
|
java.util.List<java.io.File> |
getRootDirs()
Get a list of all DTED root directories
|
void |
refreshCache(java.io.File file)
Refresh the cache for a specific DTED file
|
void |
refreshCache(java.lang.String path,
boolean exists)
Refresh the cache for a specific DTED file
|
void |
removeListener(Dt2FileWatcher.Listener l) |
void |
run() |
void |
scan()
Perform a DTED file scan
NOTE: Do NOT call this on the main thread - this method can take several
seconds to finish
|
void |
start() |
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, stop, stop, suspend, toString, yield
public Dt2FileWatcher(MapView mapView, java.util.List<java.io.File> rootDirs)
public static Dt2FileWatcher getInstance()
public void start()
start
in class java.lang.Thread
public void dispose()
public void run()
run
in interface java.lang.Runnable
run
in class java.lang.Thread
public java.util.List<java.io.File> getRootDirs()
public java.util.List<java.io.File> getFiles(java.lang.String path)
path
- Relative pathpublic java.util.BitSet getCoverage(int level)
level
- DTED level (0 thru 3)public java.util.BitSet[] getCoverages()
public java.util.BitSet getFullCoverage()
public static int getCoverageIndex(int latitude, int longitude)
latitude
- Latitudelongitude
- Longitudepublic static java.lang.String getRelativePath(int level, double lat, double lng)
level
- DTED resolution levellat
- Latitude in degreeslng
- Longitude in degreespublic static java.lang.String getRelativePath(java.io.File file)
file
- Filepublic void refreshCache(java.lang.String path, boolean exists)
path
- Relative path to DTED fileexists
- True if the file existspublic void refreshCache(java.io.File file)
file
- DTED filepublic int getFileCount()
public java.util.List<java.lang.String> getFiles(int level, java.lang.String dir)
File.listFiles()
level
- DTED leveldir
- File directorypublic int getFileCount(int level, java.lang.String dir)
level
- DTED leveldir
- Directorypublic boolean delete(int level, java.io.File file)
level
- Level (-1 to delete all)file
- File/directory to delete frompublic boolean delete(int level, java.lang.String path)
level
- Level (-1 to delete all)path
- Relative file/directory path to delete frompublic void scan()
public void addListener(Dt2FileWatcher.Listener l)
public void removeListener(Dt2FileWatcher.Listener l)