Class BasicTiledImageLayer
- java.lang.Object
-
- gov.nasa.worldwind.avlist.AVListImpl
-
- gov.nasa.worldwind.WWObjectImpl
-
- gov.nasa.worldwind.layers.AbstractLayer
-
- gov.nasa.worldwind.layers.TiledImageLayer
-
- gov.nasa.worldwind.layers.BasicTiledImageLayer
-
- All Implemented Interfaces:
AVList
,Disposable
,MessageListener
,Layer
,Restorable
,BulkRetrievable
,WWObject
,java.beans.PropertyChangeListener
,java.util.EventListener
- Direct Known Subclasses:
LocalRasterServerLayer
,MSVirtualEarthLayer
,USGSDigitalOrtho
,USGSUrbanAreaOrtho
,WMSTiledImageLayer
public class BasicTiledImageLayer extends TiledImageLayer implements BulkRetrievable
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description 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
Fields Modifier and Type Field Description protected java.lang.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
Constructors Constructor Description BasicTiledImageLayer(AVList params)
BasicTiledImageLayer(LevelSet levelSet)
BasicTiledImageLayer(java.lang.String restorableStateInXml)
BasicTiledImageLayer(org.w3c.dom.Document dom, AVList params)
BasicTiledImageLayer(org.w3c.dom.Element domElement, AVList params)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addTileToCache(TextureTile tile)
protected org.w3c.dom.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, java.lang.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 WorldWind 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(org.w3c.dom.Element domElement, AVList params)
java.lang.String
getRestorableState()
Returns an XML document string describing the object's state.void
getRestorableStateForAVPair(java.lang.String key, java.lang.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, java.net.URL textureURL, FileStore fileStore)
protected boolean
loadTexture(TextureTile tile, java.net.URL textureURL)
BulkRetrievalThread
makeLocal(Sector sector, double resolution, FileStore fileStore, BulkRetrievalListener listener)
Start a newBulkRetrievalThread
that downloads all imagery for a given sector and resolution to a specifiedFileStore
, without downloading imagery that is already in the file store.BulkRetrievalThread
makeLocal(Sector sector, double resolution, BulkRetrievalListener listener)
Start a newBulkRetrievalThread
that downloads all imagery for a given sector and resolution to the current WorldWind file cache, without downloading imagery that is already in the cache.protected boolean
needsConfigurationFile(FileStore fileStore, java.lang.String fileName, AVList params, boolean removeIfExpired)
protected com.jogamp.opengl.util.texture.TextureData
readTexture(java.net.URL url, java.lang.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(java.lang.String stateInXml)
void
restoreState(java.lang.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 java.lang.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, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
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 gov.nasa.worldwind.retrieve.BulkRetrievable
getName
-
Methods inherited from interface gov.nasa.worldwind.event.MessageListener
onMessage
-
-
-
-
Field Detail
-
fileLock
protected final java.lang.Object fileLock
-
RESOURCE_ID_OGC_CAPABILITIES
protected static final int RESOURCE_ID_OGC_CAPABILITIES
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
BasicTiledImageLayer
public BasicTiledImageLayer(LevelSet levelSet)
-
BasicTiledImageLayer
public BasicTiledImageLayer(AVList params)
-
BasicTiledImageLayer
public BasicTiledImageLayer(org.w3c.dom.Document dom, AVList params)
-
BasicTiledImageLayer
public BasicTiledImageLayer(org.w3c.dom.Element domElement, AVList params)
-
BasicTiledImageLayer
public BasicTiledImageLayer(java.lang.String restorableStateInXml)
-
-
Method Detail
-
getParamsFromDocument
protected static AVList getParamsFromDocument(org.w3c.dom.Element domElement, AVList params)
-
setFallbacks
protected static void setFallbacks(AVList params)
-
forceTextureLoad
protected void forceTextureLoad(TextureTile tile)
- Specified by:
forceTextureLoad
in classTiledImageLayer
-
requestTexture
protected void requestTexture(DrawContext dc, TextureTile tile)
- Specified by:
requestTexture
in classTiledImageLayer
-
createRequestTask
protected BasicTiledImageLayer.RequestTask createRequestTask(TextureTile tile)
-
isTextureFileExpired
protected boolean isTextureFileExpired(TextureTile tile, java.net.URL textureURL, FileStore fileStore)
-
loadTexture
protected boolean loadTexture(TextureTile tile, java.net.URL textureURL)
-
readTexture
protected com.jogamp.opengl.util.texture.TextureData readTexture(java.net.URL url, java.lang.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. IftextureFormat
is a recognized mime type, this returns the texture data in the specified format. Otherwise, this returns the texture data in its native format. IfuseMipMaps
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:
image/dds
- Returns DDS texture data, converting the data to DDS if necessary. If the data is already in DDS format it's returned as-is.
- 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.
-
addTileToCache
protected void addTileToCache(TextureTile tile)
-
makeLocal
public BulkRetrievalThread makeLocal(Sector sector, double resolution, BulkRetrievalListener listener)
Start a newBulkRetrievalThread
that downloads all imagery for a given sector and resolution to the current WorldWind 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 interfaceBulkRetrievable
- 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 ornull
if the specified sector does not intersect the layer bounding sector. - Throws:
java.lang.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 newBulkRetrievalThread
that downloads all imagery for a given sector and resolution to a specifiedFileStore
, 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 interfaceBulkRetrievable
- 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 WorldWind file cache is used.listener
- an optional retrieval listener. May be null.- Returns:
- the
BulkRetrievalThread
executing the retrieval ornull
if the specified sector does not intersect the layer bounding sector. - Throws:
java.lang.IllegalArgumentException
- if the sector is null or the resolution is less than zero.- See Also:
BasicTiledImageLayerBulkDownloader
-
getEstimatedMissingDataSize
public long getEstimatedMissingDataSize(Sector sector, double resolution)
Get the estimated size in bytes of the imagery not in the WorldWind 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 interfaceBulkRetrievable
- 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:
java.lang.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 interfaceBulkRetrievable
- 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 WorldWind file cache is used.- Returns:
- the estimated size in byte of the missing imagery.
- Throws:
java.lang.IllegalArgumentException
- if the sector is null or the resolution is less than zero.
-
retrieveTexture
protected void retrieveTexture(TextureTile tile, BasicTiledImageLayer.DownloadPostProcessor postProcessor)
-
retrieveLocalTexture
protected void retrieveLocalTexture(TextureTile tile, BasicTiledImageLayer.DownloadPostProcessor postProcessor)
-
retrieveRemoteTexture
protected void retrieveRemoteTexture(TextureTile tile, BasicTiledImageLayer.DownloadPostProcessor postProcessor)
-
createDownloadPostProcessor
protected BasicTiledImageLayer.DownloadPostProcessor createDownloadPostProcessor(TextureTile tile)
-
retrieveResources
protected java.lang.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, andnull
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, andnull
if the retrieval state is unknown.
-
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 inSwingUtilities.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:
java.lang.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, andfalse
otherwise.
-
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)
-
doWriteConfigurationParams
protected void doWriteConfigurationParams(FileStore fileStore, java.lang.String fileName, AVList params)
-
needsConfigurationFile
protected boolean needsConfigurationFile(FileStore fileStore, java.lang.String fileName, AVList params, boolean removeIfExpired)
-
createConfigurationDocument
protected org.w3c.dom.Document createConfigurationDocument(AVList params)
-
getRestorableState
public java.lang.String getRestorableState()
Description copied from interface:Restorable
Returns an XML document string describing the object's state. This state can be restored later by callingrestoreState
and passing the XML document.- Specified by:
getRestorableState
in interfaceRestorable
- Overrides:
getRestorableState
in classAbstractLayer
- Returns:
- an XML document string describing the object's state.
-
restoreState
public void restoreState(java.lang.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 interfaceRestorable
- Overrides:
restoreState
in classAbstractLayer
- Parameters:
stateInXml
- an XML document string describing an object's state.
-
doGetRestorableState
protected void doGetRestorableState(RestorableSupport rs, RestorableSupport.StateObject context)
-
getRestorableStateForAVPair
public void getRestorableStateForAVPair(java.lang.String key, java.lang.Object value, RestorableSupport rs, RestorableSupport.StateObject context)
- Overrides:
getRestorableStateForAVPair
in classAVListImpl
-
doRestoreState
protected void doRestoreState(RestorableSupport rs, RestorableSupport.StateObject context)
-
doRestoreStateForObject
protected void doRestoreStateForObject(RestorableSupport rs, RestorableSupport.StateObject so)
-
restorableStateToParams
protected static AVList restorableStateToParams(java.lang.String stateInXml)
-
restoreStateForParams
protected static void restoreStateForParams(RestorableSupport rs, RestorableSupport.StateObject context, AVList params)
-
-