NASA World Wind

gov.nasa.worldwind.terrain
Class BasicElevationModelBulkDownloader

java.lang.Object
  extended by java.lang.Thread
      extended by gov.nasa.worldwind.retrieve.BulkRetrievalThread
          extended by gov.nasa.worldwind.terrain.BasicElevationModelBulkDownloader
All Implemented Interfaces:
java.lang.Runnable

public class BasicElevationModelBulkDownloader
extends BulkRetrievalThread

Downloads elevation data not currently available in the World Wind file cache or a specified FileStore. The class derives from Thread and is meant to operate in its own thread.

The sector and resolution associated with the downloader are specified during construction and are final.


Nested Class Summary
protected  class BasicElevationModelBulkDownloader.BulkDownloadPostProcessor
           
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
protected static long DEFAULT_AVERAGE_FILE_SIZE
           
protected  BasicElevationModel elevationModel
           
protected  int level
           
protected static int MAX_TILE_COUNT_PER_REGION
           
protected  java.util.ArrayList<Tile> missingTiles
           
 
Fields inherited from class gov.nasa.worldwind.retrieve.BulkRetrievalThread
fileStore, progress, resolution, retrievable, RETRIEVAL_SERVICE_POLL_DELAY, sector
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
BasicElevationModelBulkDownloader(BasicElevationModel elevationModel, Sector sector, double resolution)
          Constructs a downloader to retrieve elevations not currently available in the World Wind file cache.
BasicElevationModelBulkDownloader(BasicElevationModel elevationModel, Sector sector, double resolution, FileStore fileStore)
          Constructs a downloader to retrieve elevations not currently available in a specified file store.
 
Method Summary
protected static long computeAverageTileSize(java.io.File dir)
           
protected  int computeLevelForResolution(Sector sector, double resolution)
           
protected  Sector[] computeRegions(Sector sector, int levelNumber, int maxCount)
           
protected  int countMissingTiles()
           
protected  int countTilesInSector(Sector sector, int levelNumber)
           
protected  long estimateAverageTileSize()
           
protected  long getEstimatedMissingDataSize()
           
protected  java.util.ArrayList<Tile> getMissingTilesInSector(Sector sector, int levelNumber)
           
protected  Tile[][] getTilesInSector(Sector sector, int levelNumber)
           
protected  boolean isTileLocalOrAbsent(Tile tile)
           
protected  void removeAbsentTile(Tile tile)
           
protected  void removeRetrievedTile(Tile tile)
           
 void run()
           
protected  void submitMissingTilesRequests()
           
 
Methods inherited from class gov.nasa.worldwind.retrieve.BulkRetrievalThread
getFileStore, getProgress, getResolution, getRetrievable, getSector
 
Methods inherited from class java.lang.Thread
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, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_AVERAGE_FILE_SIZE

protected static final long DEFAULT_AVERAGE_FILE_SIZE
See Also:
Constant Field Values

elevationModel

protected final BasicElevationModel elevationModel

level

protected final int level

MAX_TILE_COUNT_PER_REGION

protected static final int MAX_TILE_COUNT_PER_REGION
See Also:
Constant Field Values

missingTiles

protected java.util.ArrayList<Tile> missingTiles
Constructor Detail

BasicElevationModelBulkDownloader

public BasicElevationModelBulkDownloader(BasicElevationModel elevationModel,
                                         Sector sector,
                                         double resolution)
Constructs a downloader to retrieve elevations not currently available in the World Wind file cache.

The thread returned is not started during construction, the caller must start the thread.

Parameters:
elevationModel - the elevation model for which to download elevations.
sector - the sector to download data for. This value is final.
resolution - the target resolution, provided in radians of latitude per texel. This value is final.
Throws:
java.lang.IllegalArgumentException - if either the elevation model or sector are null, or the resolution is less than zero.

BasicElevationModelBulkDownloader

public BasicElevationModelBulkDownloader(BasicElevationModel elevationModel,
                                         Sector sector,
                                         double resolution,
                                         FileStore fileStore)
Constructs a downloader to retrieve elevations not currently available in a specified file store.

The thread returned is not started during construction, the caller must start the thread.

Parameters:
elevationModel - the elevation model for which to download elevations.
sector - the sector to download data for. This value is final.
resolution - the target resolution, provided in radians of latitude per texel. This value is final.
fileStore - the file store in which to place the downloaded elevations.
Throws:
java.lang.IllegalArgumentException - if either the elevation model, the sector or file store are null, or the resolution is less than zero.
Method Detail

computeAverageTileSize

protected static long computeAverageTileSize(java.io.File dir)

computeLevelForResolution

protected int computeLevelForResolution(Sector sector,
                                        double resolution)

computeRegions

protected Sector[] computeRegions(Sector sector,
                                  int levelNumber,
                                  int maxCount)

countMissingTiles

protected int countMissingTiles()
                         throws java.lang.InterruptedException
Throws:
java.lang.InterruptedException

countTilesInSector

protected int countTilesInSector(Sector sector,
                                 int levelNumber)

estimateAverageTileSize

protected long estimateAverageTileSize()

getEstimatedMissingDataSize

protected long getEstimatedMissingDataSize()

getMissingTilesInSector

protected java.util.ArrayList<Tile> getMissingTilesInSector(Sector sector,
                                                            int levelNumber)
                                                     throws java.lang.InterruptedException
Throws:
java.lang.InterruptedException

getTilesInSector

protected Tile[][] getTilesInSector(Sector sector,
                                    int levelNumber)

isTileLocalOrAbsent

protected boolean isTileLocalOrAbsent(Tile tile)

removeAbsentTile

protected void removeAbsentTile(Tile tile)

removeRetrievedTile

protected void removeRetrievedTile(Tile tile)

run

public void run()
Specified by:
run in interface java.lang.Runnable
Specified by:
run in class BulkRetrievalThread

submitMissingTilesRequests

protected void submitMissingTilesRequests()
                                   throws java.lang.InterruptedException
Throws:
java.lang.InterruptedException

NASA World Wind