NASA World Wind

gov.nasa.worldwind.layers.placename
Class PlaceNameLayerBulkDownloader

java.lang.Object
  extended by java.lang.Thread
      extended by gov.nasa.worldwind.retrieve.BulkRetrievalThread
          extended by gov.nasa.worldwind.layers.placename.PlaceNameLayerBulkDownloader
All Implemented Interfaces:
java.lang.Runnable

public class PlaceNameLayerBulkDownloader
extends BulkRetrievalThread

Downloads placenames 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 PlaceNameLayerBulkDownloader.BulkDownloadPostProcessor
           
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
protected static long AVG_TILE_SIZE
           
protected  PlaceNameLayer layer
           
protected  int MAX_TILE_COUNT_PER_REGION
           
protected  java.util.ArrayList<PlaceNameLayer.Tile> missingTiles
           
protected  long pollDelay
           
 
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
PlaceNameLayerBulkDownloader(PlaceNameLayer layer, Sector sector, double resolution)
          Constructs a downloader to retrieve placenames not currently available in the World Wind file cache.
PlaceNameLayerBulkDownloader(PlaceNameLayer layer, Sector sector, double resolution, FileStore fileStore)
          Constructs a downloader to retrieve placenames not currently available in a specified file store and places it there.
 
Method Summary
protected  int estimateNumberTilesinSector(PlaceNameLayer.NavigationTile tile, Sector searchSector)
           
protected  long getEstimatedMissingDataSize()
           
protected  int getMissingTilesCountEstimate(Sector sector, double resolution)
           
protected  java.util.ArrayList<PlaceNameLayer.Tile> getMissingTilesInSector(Sector sector)
           
protected  boolean isTileLocalOrAbsent(PlaceNameLayer.Tile tile)
           
protected  java.util.List<PlaceNameLayer.NavigationTile> navTilesVisible(PlaceNameLayer.NavigationTile tile, Sector sector)
           
protected  void removeRetrievedTile(PlaceNameLayer.Tile tile)
           
 void run()
           
protected  void submitMissingTilesRequests()
           
protected  void transferMissingTiles(java.util.ArrayList<PlaceNameLayer.Tile> source, java.util.ArrayList<PlaceNameLayer.Tile> destination, int maxCount)
           
 
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

AVG_TILE_SIZE

protected static final long AVG_TILE_SIZE
See Also:
Constant Field Values

layer

protected final PlaceNameLayer layer

MAX_TILE_COUNT_PER_REGION

protected int MAX_TILE_COUNT_PER_REGION

missingTiles

protected java.util.ArrayList<PlaceNameLayer.Tile> missingTiles

pollDelay

protected long pollDelay
Constructor Detail

PlaceNameLayerBulkDownloader

public PlaceNameLayerBulkDownloader(PlaceNameLayer layer,
                                    Sector sector,
                                    double resolution)
Constructs a downloader to retrieve placenames not currently available in the World Wind file cache.

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

Parameters:
layer - the layer for which to download placenames.
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 layer or sector are null, or the resolution is less than zero.

PlaceNameLayerBulkDownloader

public PlaceNameLayerBulkDownloader(PlaceNameLayer layer,
                                    Sector sector,
                                    double resolution,
                                    FileStore fileStore)
Constructs a downloader to retrieve placenames not currently available in a specified file store and places it there.

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

Parameters:
layer - the layer for which to download placenames.
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 layer, the sector or file store are null, or the resolution is less than zero.
Method Detail

estimateNumberTilesinSector

protected int estimateNumberTilesinSector(PlaceNameLayer.NavigationTile tile,
                                          Sector searchSector)

getEstimatedMissingDataSize

protected long getEstimatedMissingDataSize()

getMissingTilesCountEstimate

protected int getMissingTilesCountEstimate(Sector sector,
                                           double resolution)

getMissingTilesInSector

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

isTileLocalOrAbsent

protected boolean isTileLocalOrAbsent(PlaceNameLayer.Tile tile)

navTilesVisible

protected java.util.List<PlaceNameLayer.NavigationTile> navTilesVisible(PlaceNameLayer.NavigationTile tile,
                                                                        Sector sector)

removeRetrievedTile

protected void removeRetrievedTile(PlaceNameLayer.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

transferMissingTiles

protected void transferMissingTiles(java.util.ArrayList<PlaceNameLayer.Tile> source,
                                    java.util.ArrayList<PlaceNameLayer.Tile> destination,
                                    int maxCount)

NASA World Wind