NASA World Wind

gov.nasa.worldwind.layers
Class BasicTiledImageLayer

java.lang.Object
  extended by gov.nasa.worldwind.avlist.AVListImpl
      extended by gov.nasa.worldwind.WWObjectImpl
          extended by gov.nasa.worldwind.layers.AbstractLayer
              extended by gov.nasa.worldwind.layers.TiledImageLayer
                  extended by gov.nasa.worldwind.layers.BasicTiledImageLayer
All Implemented Interfaces:
AVList, Disposable, MessageListener, Layer, Restorable, BulkRetrievable, WWObject, PropertyChangeListener, EventListener
Direct Known Subclasses:
LocalRasterServerLayer, MSVirtualEarthLayer, USGSDigitalOrtho, USGSUrbanAreaOrtho, WMSTiledImageLayer

public class BasicTiledImageLayer
extends TiledImageLayer
implements BulkRetrievable


Nested Class Summary
protected static class BasicTiledImageLayer.DownloadPostProcessor
           
protected static class BasicTiledImageLayer.RequestTask
           
 
Nested classes/interfaces inherited from class gov.nasa.worldwind.layers.TiledImageLayer
TiledImageLayer.CompositionRetrievalPostProcessor, TiledImageLayer.LevelComparer
 
Field Summary
protected  Object fileLock
           
protected static int RESOURCE_ID_OGC_CAPABILITIES
           
 
Fields inherited from class gov.nasa.worldwind.layers.TiledImageLayer
atMaxResolution, currentResourceTile, currentTiles, detailHint, detailHintOrigin, drawBoundingVolumes, drawTileBoundaries, forceLevelZeroLoads, levelComparer, levels, levelZeroLoaded, requestQ, retainLevelZeroTiles, supportedImageFormats, textureFormat, tileCountName, topLevels, useMipMaps, useTransparentTextures
 
Constructor Summary
BasicTiledImageLayer(AVList params)
           
BasicTiledImageLayer(Document dom, AVList params)
           
BasicTiledImageLayer(Element domElement, AVList params)
           
BasicTiledImageLayer(LevelSet levelSet)
           
BasicTiledImageLayer(String restorableStateInXml)
           
 
Method Summary
protected  void addTileToCache(TextureTile tile)
           
protected  Document createConfigurationDocument(AVList params)
           
protected  BasicTiledImageLayer.DownloadPostProcessor createDownloadPostProcessor(TextureTile tile)
           
protected  BasicTiledImageLayer.RequestTask createRequestTask(TextureTile tile)
           
protected  void doGetRestorableState(RestorableSupport rs, RestorableSupport.StateObject context)
           
protected  void doRestoreState(RestorableSupport rs, RestorableSupport.StateObject context)
           
protected  void doRestoreStateForObject(RestorableSupport rs, RestorableSupport.StateObject so)
           
protected  void doWriteConfigurationParams(FileStore fileStore, String fileName, AVList params)
           
protected  void forceTextureLoad(TextureTile tile)
           
protected  AVList getConfigurationParams(AVList params)
           
 long getEstimatedMissingDataSize(Sector sector, double resolution)
          Get the estimated size in bytes of the imagery not in the World Wind file cache for the given sector and resolution.
 long getEstimatedMissingDataSize(Sector sector, double resolution, FileStore fileStore)
          Get the estimated size in bytes of the imagery not in a specified file store for a specified sector and resolution.
protected static AVList getParamsFromDocument(Element domElement, AVList params)
           
 String getRestorableState()
          Returns an XML document string describing the object's state.
 void getRestorableStateForAVPair(String key, Object value, RestorableSupport rs, RestorableSupport.StateObject context)
           
protected  void initFromOGCCapabilitiesResource(WMSCapabilities caps, AVList params)
          Initializes this Layer's expiry time property from the specified WMS Capabilities document and parameter list describing the WMS layer names associated with this Layer.
protected  boolean isRetrieveResources()
          Returns a boolean value indicating if this Layer should retrieve any non-tile resources, either online or in the local filesystem, and initialize itself using those resources.
protected  boolean isTextureFileExpired(TextureTile tile, URL textureURL, FileStore fileStore)
           
protected  boolean loadTexture(TextureTile tile, URL textureURL)
           
 BulkRetrievalThread makeLocal(Sector sector, double resolution, BulkRetrievalListener listener)
          Start a new BulkRetrievalThread that downloads all imagery for a given sector and resolution to the current World Wind file cache, without downloading imagery that is already in the cache.
 BulkRetrievalThread makeLocal(Sector sector, double resolution, FileStore fileStore, BulkRetrievalListener listener)
          Start a new BulkRetrievalThread that downloads all imagery for a given sector and resolution to a specified FileStore, without downloading imagery that is already in the file store.
protected  boolean needsConfigurationFile(FileStore fileStore, String fileName, AVList params, boolean removeIfExpired)
           
protected  TextureData readTexture(URL url, String textureFormat, boolean useMipMaps)
          Reads and returns the texture data at the specified URL, optionally converting it to the specified format and generating mip-maps.
protected  void requestTexture(DrawContext dc, TextureTile tile)
           
protected static AVList restorableStateToParams(String stateInXml)
           
 void restoreState(String stateInXml)
          Restores the object's state to what is described in the specified XML document string.
protected static void restoreStateForParams(RestorableSupport rs, RestorableSupport.StateObject context, AVList params)
           
protected  void retrieveLocalTexture(TextureTile tile, BasicTiledImageLayer.DownloadPostProcessor postProcessor)
           
protected  void retrieveRemoteTexture(TextureTile tile, BasicTiledImageLayer.DownloadPostProcessor postProcessor)
           
protected  String retrieveResources()
          Retrieves any non-tile resources associated with this Layer, either online or in the local filesystem, and initializes properties of this Layer using those resources.
protected  void retrieveTexture(TextureTile tile, BasicTiledImageLayer.DownloadPostProcessor postProcessor)
           
protected static void setFallbacks(AVList params)
           
protected  void startResourceRetrieval()
          Starts retrieving non-tile resources associated with this Layer in a non-rendering thread.
protected  void writeConfigurationFile(FileStore fileStore)
           
protected  void writeConfigurationParams(FileStore fileStore, AVList params)
           
 
Methods inherited from class gov.nasa.worldwind.layers.TiledImageLayer
addTile, addTileOrDescendants, addTileToCurrent, assembleTiles, atMaxLevel, checkTextureExpiration, composeImageForSector, computeLevelForResolution, computeReferencePoint, countImagesInSector, countImagesInSector, createTiledImageLayerConfigDocument, createTiledImageLayerConfigElements, createTopLevelTiles, doRender, downloadImage, draw, drawBoundingVolumes, drawTileIDs, getAvailableImageFormats, getDefaultImageFormat, getDetailFactor, getDetailHint, getImage, getLegacyTiledImageLayerConfigParams, getLevels, getMaxEffectiveAltitude, getMinEffectiveAltitude, getReferencePoint, getRequestQ, getTextureFormat, getTiledImageLayerConfigParams, getTilesInSector, getTopLevels, getValue, isAtMaxResolution, isDrawBoundingVolumes, isDrawTileBoundaries, isDrawTileIDs, isForceLevelZeroLoads, isImageFormatAvailable, isLayerInView, isMultiResolution, isRetainLevelZeroTiles, isTileVisible, isUseMipMaps, isUseTransparentTextures, loadAllTopLevelTextures, meetsRenderCriteria, needToSplit, render, requestImage, retrieveLocalImage, retrieveRemoteImage, sendRequests, setAvailableImageFormats, setBlendingFunction, setDetailHint, setDrawBoundingVolumes, setDrawTileBoundaries, setDrawTileIDs, setExpiryTime, setForceLevelZeroLoads, setName, setRetainLevelZeroTiles, setTextureFormat, setUseMipMaps, setUseTransparentTextures, setValue
 
Methods inherited from class gov.nasa.worldwind.layers.AbstractLayer
createLayerConfigElements, dispose, doPick, doPreRender, getDataFileStore, getExpiryTime, getLayerConfigParams, getMaxActiveAltitude, getMinActiveAltitude, getName, getOpacity, getScale, getScreenCredit, isEnabled, isLayerActive, isLayerConfigDocument, isNetworkRetrievalEnabled, isPickEnabled, pick, preRender, setDataFileStore, setEnabled, setMaxActiveAltitude, setMinActiveAltitude, setNetworkRetrievalEnabled, setOpacity, setPickEnabled, setScreenCredit, toString
 
Methods inherited from class gov.nasa.worldwind.WWObjectImpl
onMessage, propertyChange
 
Methods inherited from class gov.nasa.worldwind.avlist.AVListImpl
addPropertyChangeListener, addPropertyChangeListener, clearList, copy, firePropertyChange, firePropertyChange, getBooleanValue, getBooleanValue, getChangeSupport, getDoubleValue, getDoubleValue, getEntries, getIntegerValue, getIntegerValue, getLongValue, getLongValue, getStringValue, getStringValue, getStringValue, getValues, hasKey, removeKey, removePropertyChangeListener, removePropertyChangeListener, setValues
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface gov.nasa.worldwind.retrieve.BulkRetrievable
getName
 
Methods inherited from interface gov.nasa.worldwind.avlist.AVList
addPropertyChangeListener, addPropertyChangeListener, clearList, copy, firePropertyChange, firePropertyChange, getEntries, getStringValue, getValues, hasKey, removeKey, removePropertyChangeListener, removePropertyChangeListener, setValues
 
Methods inherited from interface java.beans.PropertyChangeListener
propertyChange
 
Methods inherited from interface gov.nasa.worldwind.event.MessageListener
onMessage
 

Field Detail

fileLock

protected final Object fileLock

RESOURCE_ID_OGC_CAPABILITIES

protected static final int RESOURCE_ID_OGC_CAPABILITIES
See Also:
Constant Field Values
Constructor Detail

BasicTiledImageLayer

public BasicTiledImageLayer(AVList params)

BasicTiledImageLayer

public BasicTiledImageLayer(Document dom,
                            AVList params)

BasicTiledImageLayer

public BasicTiledImageLayer(Element domElement,
                            AVList params)

BasicTiledImageLayer

public BasicTiledImageLayer(LevelSet levelSet)

BasicTiledImageLayer

public BasicTiledImageLayer(String restorableStateInXml)
Method Detail

addTileToCache

protected void addTileToCache(TextureTile tile)

createConfigurationDocument

protected Document createConfigurationDocument(AVList params)

createDownloadPostProcessor

protected BasicTiledImageLayer.DownloadPostProcessor createDownloadPostProcessor(TextureTile tile)

createRequestTask

protected BasicTiledImageLayer.RequestTask createRequestTask(TextureTile tile)

doGetRestorableState

protected void doGetRestorableState(RestorableSupport rs,
                                    RestorableSupport.StateObject context)

doRestoreState

protected void doRestoreState(RestorableSupport rs,
                              RestorableSupport.StateObject context)

doRestoreStateForObject

protected void doRestoreStateForObject(RestorableSupport rs,
                                       RestorableSupport.StateObject so)

doWriteConfigurationParams

protected void doWriteConfigurationParams(FileStore fileStore,
                                          String fileName,
                                          AVList params)

forceTextureLoad

protected void forceTextureLoad(TextureTile tile)
Specified by:
forceTextureLoad in class TiledImageLayer

getConfigurationParams

protected AVList getConfigurationParams(AVList params)

getEstimatedMissingDataSize

public long getEstimatedMissingDataSize(Sector sector,
                                        double resolution)
Get the estimated size in bytes of the imagery not in the World Wind file cache for the given sector and resolution.

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.

Specified by:
getEstimatedMissingDataSize in interface BulkRetrievable
Parameters:
sector - the sector to estimate.
resolution - the target resolution, provided in radians of latitude per texel.
Returns:
the estimated size in bytes of the missing imagery.
Throws:
IllegalArgumentException - if the sector is null or the resolution is less than zero.

getEstimatedMissingDataSize

public long getEstimatedMissingDataSize(Sector sector,
                                        double resolution,
                                        FileStore fileStore)
Get the estimated size in bytes of the imagery not in a specified file store for a specified sector and resolution.

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.

Specified by:
getEstimatedMissingDataSize in interface BulkRetrievable
Parameters:
sector - the sector to estimate.
resolution - the target resolution, provided in radians of latitude per texel.
fileStore - the file store to examine. If null the current World Wind file cache is used.
Returns:
the estimated size in byte of the missing imagery.
Throws:
IllegalArgumentException - if the sector is null or the resolution is less than zero.

getParamsFromDocument

protected static AVList getParamsFromDocument(Element domElement,
                                              AVList params)

getRestorableState

public String getRestorableState()
Description copied from interface: Restorable
Returns an XML document string describing the object's state. This state can be restored later by calling restoreState and passing the XML document.

Specified by:
getRestorableState in interface Restorable
Overrides:
getRestorableState in class AbstractLayer
Returns:
an XML document string describing the object's state.

getRestorableStateForAVPair

public void getRestorableStateForAVPair(String key,
                                        Object value,
                                        RestorableSupport rs,
                                        RestorableSupport.StateObject context)
Overrides:
getRestorableStateForAVPair in class AVListImpl

initFromOGCCapabilitiesResource

protected void initFromOGCCapabilitiesResource(WMSCapabilities caps,
                                               AVList params)
Initializes this Layer's expiry time property from the specified WMS Capabilities document and parameter list describing the WMS layer names associated with this Layer. This method is thread safe; it synchronizes changes to this Layer by wrapping the appropriate method calls in SwingUtilities.invokeLater(Runnable).

Parameters:
caps - the WMS Capabilities document retrieved from this Layer's WMS server.
params - the parameter list describing the WMS layer names associated with this Layer.
Throws:
IllegalArgumentException - if either the Capabilities or the parameter list is null.

isRetrieveResources

protected boolean isRetrieveResources()
Returns a boolean value indicating if this Layer should retrieve any non-tile resources, either online or in the local filesystem, and initialize itself using those resources.

Returns:
true if this Layer should retrieve any non-tile resources, and false otherwise.

isTextureFileExpired

protected boolean isTextureFileExpired(TextureTile tile,
                                       URL textureURL,
                                       FileStore fileStore)

loadTexture

protected boolean loadTexture(TextureTile tile,
                              URL textureURL)

makeLocal

public BulkRetrievalThread makeLocal(Sector sector,
                                     double resolution,
                                     BulkRetrievalListener listener)
Start a new BulkRetrievalThread that downloads all imagery for a given sector and resolution to the current World Wind file cache, without downloading imagery that is already in the cache.

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 BasicTiledImageLayerBulkDownloader.

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.

Specified by:
makeLocal in interface BulkRetrievable
Parameters:
sector - the sector to download imagery for.
resolution - the target resolution, provided in radians of latitude per texel.
listener - an optional retrieval listener. May be null.
Returns:
the BulkRetrievalThread executing the retrieval or null if the specified sector does not intersect the layer bounding sector.
Throws:
IllegalArgumentException - if the sector is null or the resolution is less than zero.
See Also:
BasicTiledImageLayerBulkDownloader

makeLocal

public BulkRetrievalThread makeLocal(Sector sector,
                                     double resolution,
                                     FileStore fileStore,
                                     BulkRetrievalListener listener)
Start a new BulkRetrievalThread that downloads all imagery for a given sector and resolution to a specified FileStore, without downloading imagery that is already in the file store.

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 BasicTiledImageLayerBulkDownloader.

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.

Specified by:
makeLocal in interface BulkRetrievable
Parameters:
sector - the sector to download data for.
resolution - the target resolution, provided in radians of latitude per texel.
fileStore - the file store in which to place the downloaded imagery. If null the current World Wind file cache is used.
listener - an optional retrieval listener. May be null.
Returns:
the BulkRetrievalThread executing the retrieval or null if the specified sector does not intersect the layer bounding sector.
Throws:
IllegalArgumentException - if the sector is null or the resolution is less than zero.
See Also:
BasicTiledImageLayerBulkDownloader

needsConfigurationFile

protected boolean needsConfigurationFile(FileStore fileStore,
                                         String fileName,
                                         AVList params,
                                         boolean removeIfExpired)

readTexture

protected TextureData readTexture(URL url,
                                  String textureFormat,
                                  boolean useMipMaps)
Reads and returns the texture data at the specified URL, optionally converting it to the specified format and generating mip-maps. If textureFormat is a recognized mime type, this returns the texture data in the specified format. Otherwise, this returns the texture data in its native format. If useMipMaps is true, this generates mip maps for any non-DDS texture data, and uses any mip-maps contained in DDS texture data.

Supported texture formats are as follows:

Parameters:
url - the URL referencing the texture data to read.
textureFormat - the texture data format to return.
useMipMaps - true to generate mip-maps for the texture data or use mip maps already in the texture data, and false to read the texture data without generating or using mip-maps.
Returns:
TextureData the texture data from the specified URL, in the specified format and with mip-maps.

requestTexture

protected void requestTexture(DrawContext dc,
                              TextureTile tile)
Specified by:
requestTexture in class TiledImageLayer

restorableStateToParams

protected static AVList restorableStateToParams(String stateInXml)

restoreState

public void restoreState(String stateInXml)
Description copied from interface: Restorable
Restores the object's state to what is described in the specified XML document string.

Specified by:
restoreState in interface Restorable
Overrides:
restoreState in class AbstractLayer
Parameters:
stateInXml - an XML document string describing an object's state.

restoreStateForParams

protected static void restoreStateForParams(RestorableSupport rs,
                                            RestorableSupport.StateObject context,
                                            AVList params)

retrieveLocalTexture

protected void retrieveLocalTexture(TextureTile tile,
                                    BasicTiledImageLayer.DownloadPostProcessor postProcessor)

retrieveRemoteTexture

protected void retrieveRemoteTexture(TextureTile tile,
                                     BasicTiledImageLayer.DownloadPostProcessor postProcessor)

retrieveResources

protected String retrieveResources()
Retrieves any non-tile resources associated with this Layer, either online or in the local filesystem, and initializes properties of this Layer using those resources. This returns a key indicating the retrieval state: AVKey.RETRIEVAL_STATE_SUCCESSFUL indicates the retrieval succeeded, AVKey.RETRIEVAL_STATE_ERROR indicates the retrieval failed with errors, and null indicates the retrieval state is unknown. This method may invoke blocking I/O operations, and therefore should not be executed from the rendering thread.

Returns:
AVKey.RETRIEVAL_STATE_SUCCESSFUL if the retrieval succeeded, AVKey.RETRIEVAL_STATE_ERROR if the retrieval failed with errors, and null if the retrieval state is unknown.

retrieveTexture

protected void retrieveTexture(TextureTile tile,
                               BasicTiledImageLayer.DownloadPostProcessor postProcessor)

setFallbacks

protected static void setFallbacks(AVList params)

startResourceRetrieval

protected void startResourceRetrieval()
Starts retrieving non-tile resources associated with this Layer in a non-rendering thread.


writeConfigurationFile

protected void writeConfigurationFile(FileStore fileStore)

writeConfigurationParams

protected void writeConfigurationParams(FileStore fileStore,
                                        AVList params)

NASA World Wind