org.ka2ddo.yaac.srtm
Class SRTMTileManager

java.lang.Object
  extended by org.ka2ddo.yaac.srtm.SRTMTileManager

public class SRTMTileManager
extends java.lang.Object

This class manages an in-memory cache of SRTMTile objects, as well as providing I/O code to fetch new tiles from the USGS website.


Constructor Summary
SRTMTileManager()
           
 
Method Summary
 void flushFileCache()
          Clear cached pointers to tile files.
 short getElevation(double latitude, double longitude)
          Get the SRTM elevation at the specified lat/lon coordinates.
 int getEstimatedCacheSize()
          Get an estimate of the amount of memory used by the SRTM tile cache.
static SRTMTileManager getInstance()
          Get the reference to the singleton SRTMTileManager object.
 SRTMTile getTile(double latitude, double longitude)
          Get a SRTMTile object for the 1-degree by 1-degree region of the planet requested.
 SRTMTile getTile(int latitude, int longitude)
          Get a SRTMTile object for the 1-degree by 1-degree region of the planet requested.
static void loadPrecompiledTiles(double radius, double lat, double lon, boolean hiRes)
          Download SRTM1 or SRTM3 tiles from the US Geological Survey's website to cover a specified region of the planet.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SRTMTileManager

public SRTMTileManager()
Method Detail

getInstance

public static SRTMTileManager getInstance()
Get the reference to the singleton SRTMTileManager object.

Returns:
SRTMTileManager instance

getTile

public SRTMTile getTile(int latitude,
                        int longitude)
Get a SRTMTile object for the 1-degree by 1-degree region of the planet requested.

Parameters:
latitude - int latitude in millionths of degrees North
longitude - int longitude in millionths of degrees East
Returns:
SRTMTile object containing elevation data for the specified latitude/longitude

getTile

public SRTMTile getTile(double latitude,
                        double longitude)
Get a SRTMTile object for the 1-degree by 1-degree region of the planet requested.

Parameters:
latitude - double latitude in fractional degrees North
longitude - double longitude in fractional degrees East
Returns:
SRTMTile object containing elevation data for the specified latitude/longitude

getElevation

public short getElevation(double latitude,
                          double longitude)
Get the SRTM elevation at the specified lat/lon coordinates.

Parameters:
latitude - double latitude in fractional degrees North
longitude - double longitude in fractional degrees East
Returns:
elevation at the tile pixel for the specified coordinates, or NO_CELL if there is no tile for the specified coordinates

flushFileCache

public void flushFileCache()
Clear cached pointers to tile files. This is called when the configuration dialog changes the tile root directory path.


getEstimatedCacheSize

public int getEstimatedCacheSize()
Get an estimate of the amount of memory used by the SRTM tile cache.

Returns:
estimated byte count used by tiles in memory

loadPrecompiledTiles

public static void loadPrecompiledTiles(double radius,
                                        double lat,
                                        double lon,
                                        boolean hiRes)
Download SRTM1 or SRTM3 tiles from the US Geological Survey's website to cover a specified region of the planet.

Parameters:
radius - radius to cover in kilometers
lat - center latitude of region to download in fractional degrees North
lon - center longitude of region to download in fractional degrees East
hiRes - boolean true if 1-arc-second tiles should be downloaded where available