NASA World Wind

gov.nasa.worldwind.retrieve
Class BulkRetrievalThread

java.lang.Object
  extended by java.lang.Thread
      extended by gov.nasa.worldwind.retrieve.BulkRetrievalThread
All Implemented Interfaces:
Runnable
Direct Known Subclasses:
BasicElevationModelBulkDownloader, BasicTiledImageLayerBulkDownloader, PlaceNameLayerBulkDownloader

public abstract class BulkRetrievalThread
extends Thread

Retrieves data for a BulkRetrievable.


Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
 
Field Summary
protected  FileStore fileStore
           
protected  Progress progress
           
protected  double resolution
           
protected  BulkRetrievable retrievable
           
protected  int RETRIEVAL_SERVICE_POLL_DELAY
           
protected  EventListenerList retrievalListeners
           
protected  Sector sector
           
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
BulkRetrievalThread(BulkRetrievable retrievable, Sector sector, double resolution, FileStore fileStore, BulkRetrievalListener listener)
          Construct a thread that attempts to download to a specified FileStore a retrievable's data for a given Sector and resolution.
 
Method Summary
 void addRetrievalListener(BulkRetrievalListener listener)
           
protected  void callRetrievalListeners(BulkRetrievalEvent event)
           
 FileStore getFileStore()
          Get the file store.
 Progress getProgress()
          Get a Progress instance providing information about this task progress.
 double getResolution()
          Get the requested resolution.
 BulkRetrievable getRetrievable()
          Get the BulkRetrievable instance for which this thread acts.
 Sector getSector()
          Get the requested Sector.
protected  boolean hasRetrievalListeners()
           
 void removeRetrievalListener(BulkRetrievalListener listener)
           
abstract  void run()
           
 
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

fileStore

protected final FileStore fileStore

progress

protected final Progress progress

resolution

protected final double resolution

retrievable

protected final BulkRetrievable retrievable

RETRIEVAL_SERVICE_POLL_DELAY

protected int RETRIEVAL_SERVICE_POLL_DELAY

retrievalListeners

protected EventListenerList retrievalListeners

sector

protected final Sector sector
Constructor Detail

BulkRetrievalThread

public BulkRetrievalThread(BulkRetrievable retrievable,
                           Sector sector,
                           double resolution,
                           FileStore fileStore,
                           BulkRetrievalListener listener)
Construct a thread that attempts to download to a specified FileStore a retrievable's data for a given Sector and resolution.

This method creates and starts a thread to perform the download. A reference to the thread is returned. To create a downloader that has not been started, construct a BasicElevationModelBulkDownloader.

Note that the target resolution must be provided in radians of latitude per texel, which is the resolution in meters divided by the globe radius.

Parameters:
retrievable - the retrievable to retrieve data for.
sector - the sector of interest.
resolution - the target resolution, provided in radians of latitude per texel.
fileStore - the file store to examine.
listener - an optional retrieval listener. May be null.
Throws:
IllegalArgumentException - if either the retrievable, sector or file store are null, or the resolution is less than or equal to zero.
Method Detail

addRetrievalListener

public void addRetrievalListener(BulkRetrievalListener listener)

callRetrievalListeners

protected void callRetrievalListeners(BulkRetrievalEvent event)

getFileStore

public FileStore getFileStore()
Get the file store.

Returns:
the file store associated with this downloader.

getProgress

public Progress getProgress()
Get a Progress instance providing information about this task progress.

Returns:
a Progress instance providing information about this task progress.

getResolution

public double getResolution()
Get the requested resolution.

Returns:
the requested resolution.

getRetrievable

public BulkRetrievable getRetrievable()
Get the BulkRetrievable instance for which this thread acts.

Returns:
the BulkRetrievable instance.

getSector

public Sector getSector()
Get the requested Sector.

Returns:
the requested Sector.

hasRetrievalListeners

protected boolean hasRetrievalListeners()

removeRetrievalListener

public void removeRetrievalListener(BulkRetrievalListener listener)

run

public abstract void run()
Specified by:
run in interface Runnable
Overrides:
run in class Thread

NASA World Wind