NASA World Wind

gov.nasa.worldwind.data
Class TiledRasterProducer

java.lang.Object
  extended by gov.nasa.worldwind.avlist.AVListImpl
      extended by gov.nasa.worldwind.WWObjectImpl
          extended by gov.nasa.worldwind.data.AbstractDataStoreProducer
              extended by gov.nasa.worldwind.data.TiledRasterProducer
All Implemented Interfaces:
AVList, DataStoreProducer, MessageListener, WWObject, PropertyChangeListener, EventListener
Direct Known Subclasses:
TiledElevationProducer, TiledImageProducer

public abstract class TiledRasterProducer
extends AbstractDataStoreProducer


Nested Class Summary
 
Nested classes/interfaces inherited from class gov.nasa.worldwind.data.AbstractDataStoreProducer
AbstractDataStoreProducer.SourceInfo
 
Field Summary
 
Fields inherited from class gov.nasa.worldwind.data.AbstractDataStoreProducer
productionParams
 
Constructor Summary
TiledRasterProducer()
           
TiledRasterProducer(MemoryCache cache, int writeThreadPoolSize)
           
 
Method Summary
protected  void assembleDataRasters()
           
protected  void assembleDataSource(Object source, AVList params)
           
protected  void calculateTileCount(LevelSet levelSet, AVList params)
           
protected  Sector computeBoundingSector(Iterable<? extends DataRaster> rasters)
           
protected  LatLon computeDesiredTileDelta(Sector sector)
           
protected  int computeNumLevels(LatLon levelZeroDelta, LatLon lastLevelDelta)
           
protected  LatLon computeRasterPixelSize(DataRaster raster)
           
protected  LatLon computeRasterTileDelta(int tileWidth, int tileHeight, Iterable<? extends DataRaster> rasters)
           
protected  LatLon computeSmallestPixelSize(Iterable<? extends DataRaster> rasters)
           
protected abstract  Document createConfigDoc(AVList params)
          Returns a configuration document which describes the tiled data produced by this TiledRasterProducer.
protected abstract  DataRaster createDataRaster(int width, int height, Sector sector, AVList params)
           
protected static MemoryCache createDefaultCache()
           
protected  ExecutorService createDefaultTileWriteService(int threadPoolSize)
           
protected  Tile[] createSubTiles(Tile tile, Level nextLevel)
           
protected  DataRaster createTileRaster(LevelSet levelSet, Tile tile, AVList params)
           
protected  void doStartProduction(AVList parameters)
           
protected  DataRaster drawDataSources(LevelSet levelSet, Tile tile, Iterable<DataRaster> dataRasters, AVList params)
           
protected  DataRaster drawDescendants(LevelSet levelSet, Tile tile, AVList params)
           
protected  int extractMaxLevelLimit(AVList params, int maxNumOfLevels)
          Extracts a maximum level limit from the AVList if the AVList contains AVKey.TILED_RASTER_PRODUCER_LIMIT_MAX_LEVEL.
protected  Object findWriterFor(DataRaster raster, String formatSuffix, File destination, DataRasterWriter[] writers)
           
protected  MemoryCache getCache()
           
protected  File getConfigFileInstallLocation(AVList params)
          Returns the location of the configuration file which describes the tiled data produced by this TiledRasterProducer.
protected abstract  DataRasterReader[] getDataRasterReaders()
           
 Iterable<DataRaster> getDataRasters()
           
protected abstract  DataRasterWriter[] getDataRasterWriters()
           
 String getDataSourceDescription()
           
protected  DataRasterReaderFactory getReaderFactory()
           
protected  Semaphore getTileWriteSemaphore()
           
protected  ExecutorService getTileWriteService()
           
protected  void initLevelSetParameters(AVList params)
           
protected abstract  void initProductionParameters(AVList params)
           
protected  void installConfigFile(AVList params)
          Installs the configuration file which describes the tiled data produced by this TiledRasterProducer.
protected  void installLevelSet(LevelSet levelSet, AVList params)
           
protected  File installLocationFor(AVList params)
           
protected  Object installLocationForTile(AVList installParams, Tile tile)
           
protected  void installTileRaster(Tile tile, DataRaster tileRaster, AVList params)
           
protected  void installTileRasterComplete()
           
protected  void installTileRasterLater(LevelSet levelSet, Tile tile, DataRaster tileRaster, AVList params)
           
protected  boolean isDataSetLarge(Iterable<? extends DataRaster> rasters, int largeThreshold)
           
protected  boolean isFinalLevel(LevelSet levelSet, int levelNumber, AVList params)
           
protected  boolean isWithinLatLonLimits(Sector sector, LatLon tileDelta, LatLon tileOrigin)
           
 void removeProductionState()
           
protected  void startProgress()
           
protected  void updateProgress()
           
protected  String validateProductionParameters(AVList parameters)
           
protected  void waitForInstallTileTasks()
           
 
Methods inherited from class gov.nasa.worldwind.data.AbstractDataStoreProducer
acceptsDataSource, containsDataSource, getDataSourceList, getDataSources, getProductionParameters, getProductionResults, getProductionResultsList, getStoreParameters, isStopped, offerAllDataSources, offerDataSource, removeAllDataSources, removeDataSource, setStoreParameters, startProduction, stopProduction, validateDataSource
 
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, getRestorableStateForAVPair, getStringValue, getStringValue, getStringValue, getValue, getValues, hasKey, removeKey, removePropertyChangeListener, removePropertyChangeListener, setValue, setValues
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface gov.nasa.worldwind.avlist.AVList
addPropertyChangeListener, addPropertyChangeListener, clearList, copy, firePropertyChange, firePropertyChange, getEntries, getStringValue, getValue, getValues, hasKey, removeKey, removePropertyChangeListener, removePropertyChangeListener, setValue, setValues
 
Methods inherited from interface java.beans.PropertyChangeListener
propertyChange
 
Methods inherited from interface gov.nasa.worldwind.event.MessageListener
onMessage
 

Constructor Detail

TiledRasterProducer

public TiledRasterProducer()

TiledRasterProducer

public TiledRasterProducer(MemoryCache cache,
                           int writeThreadPoolSize)
Method Detail

assembleDataRasters

protected void assembleDataRasters()
                            throws Exception
Throws:
Exception

assembleDataSource

protected void assembleDataSource(Object source,
                                  AVList params)
                           throws Exception
Throws:
Exception

calculateTileCount

protected void calculateTileCount(LevelSet levelSet,
                                  AVList params)

computeBoundingSector

protected Sector computeBoundingSector(Iterable<? extends DataRaster> rasters)

computeDesiredTileDelta

protected LatLon computeDesiredTileDelta(Sector sector)

computeNumLevels

protected int computeNumLevels(LatLon levelZeroDelta,
                               LatLon lastLevelDelta)

computeRasterPixelSize

protected LatLon computeRasterPixelSize(DataRaster raster)

computeRasterTileDelta

protected LatLon computeRasterTileDelta(int tileWidth,
                                        int tileHeight,
                                        Iterable<? extends DataRaster> rasters)

computeSmallestPixelSize

protected LatLon computeSmallestPixelSize(Iterable<? extends DataRaster> rasters)

createConfigDoc

protected abstract Document createConfigDoc(AVList params)
Returns a configuration document which describes the tiled data produced by this TiledRasterProducer. The document's contents are derived from the specified parameter list, and depend on the concrete subclass' implementation. This returns null if the parameter list is null, or if the configuration document cannot be created for any reason.

Parameters:
params - the parameters which describe the configuration document's contents.
Returns:
the configuration document, or null if the parameter list is null or does not contain the required parameters.

createDataRaster

protected abstract DataRaster createDataRaster(int width,
                                               int height,
                                               Sector sector,
                                               AVList params)

createDefaultCache

protected static MemoryCache createDefaultCache()

createDefaultTileWriteService

protected ExecutorService createDefaultTileWriteService(int threadPoolSize)

createSubTiles

protected Tile[] createSubTiles(Tile tile,
                                Level nextLevel)

createTileRaster

protected DataRaster createTileRaster(LevelSet levelSet,
                                      Tile tile,
                                      AVList params)
                               throws IOException
Throws:
IOException

doStartProduction

protected void doStartProduction(AVList parameters)
                          throws Exception
Specified by:
doStartProduction in class AbstractDataStoreProducer
Throws:
Exception

drawDataSources

protected DataRaster drawDataSources(LevelSet levelSet,
                                     Tile tile,
                                     Iterable<DataRaster> dataRasters,
                                     AVList params)
                              throws IOException
Throws:
IOException

drawDescendants

protected DataRaster drawDescendants(LevelSet levelSet,
                                     Tile tile,
                                     AVList params)
                              throws IOException
Throws:
IOException

extractMaxLevelLimit

protected int extractMaxLevelLimit(AVList params,
                                   int maxNumOfLevels)
Extracts a maximum level limit from the AVList if the AVList contains AVKey.TILED_RASTER_PRODUCER_LIMIT_MAX_LEVEL. This method requires maxNumOfLevels - the actual maximum numbers of levels. The AVKey.TILED_RASTER_PRODUCER_LIMIT_MAX_LEVEL could specify multiple things: If the value of the AVKey.TILED_RASTER_PRODUCER_LIMIT_MAX_LEVEL is "Auto" (as String), the calculated limit of levels will be 70% of the actual maximum numbers of levels maxNumOfLevels. If the type of the value of the AVKey.TILED_RASTER_PRODUCER_LIMIT_MAX_LEVEL is Integer, it should contain an integer number between 0 (for level 0 only) and the actual maximum numbers of levels maxNumOfLevels. It is also possible to specify the limit as percents, in this case the type of the AVKey.TILED_RASTER_PRODUCER_LIMIT_MAX_LEVEL value must be "String", have a numeric value as text and the "%" percent sign in the end. Examples: "100%", "25%", "50%", etc. Value of AVKey.TILED_RASTER_PRODUCER_LIMIT_MAX_LEVEL could be a numeric string (for example, "3"), or Integer. The value will be correctly extracted and compared with the maxNumOfLevels. Valid values must be smaller or equal to maxNumOfLevels.

Parameters:
params - AVList that may contain AVKey.TILED_RASTER_PRODUCER_LIMIT_MAX_LEVEL property
maxNumOfLevels - The actual maximum numbers of levels
Returns:
A limit of numbers of levels that should producer generate.

findWriterFor

protected Object findWriterFor(DataRaster raster,
                               String formatSuffix,
                               File destination,
                               DataRasterWriter[] writers)

getCache

protected MemoryCache getCache()

getConfigFileInstallLocation

protected File getConfigFileInstallLocation(AVList params)
Returns the location of the configuration file which describes the tiled data produced by this TiledRasterProducer. The install location is derived from the specified parameter list. This returns null if the parameter list is null, or if it does not contain any of the following keys:
Key
AVKey.FILE_STORE_LOCATION
AVKey.DATA_CACHE_NAME
AVKey.DATASET_NAME

Parameters:
params - the parameters which describe the install location.
Returns:
the configuration file install location, or null if the parameter list is null or does not contain the required parameters.

getDataRasterReaders

protected abstract DataRasterReader[] getDataRasterReaders()

getDataRasters

public Iterable<DataRaster> getDataRasters()

getDataRasterWriters

protected abstract DataRasterWriter[] getDataRasterWriters()

getDataSourceDescription

public String getDataSourceDescription()

getReaderFactory

protected DataRasterReaderFactory getReaderFactory()

getTileWriteSemaphore

protected Semaphore getTileWriteSemaphore()

getTileWriteService

protected ExecutorService getTileWriteService()

initLevelSetParameters

protected void initLevelSetParameters(AVList params)

initProductionParameters

protected abstract void initProductionParameters(AVList params)

installConfigFile

protected void installConfigFile(AVList params)
                          throws Exception
Installs the configuration file which describes the tiled data produced by this TiledRasterProducer. The install location, configuration filename, and configuration file contents are derived from the specified parameter list. This throws an exception if the configuration file cannot be installed for any reason.

The parameter list must contain at least the following keys:

Key
AVKey.FILE_STORE_LOCATION
AVKey.DATA_CACHE_NAME
AVKey.DATASET_NAME

Parameters:
params - the parameters which describe the install location, the configuration filename, and the configuration file contents.
Throws:
Exception - if the configuration file cannot be installed for any reason.
IllegalArgumentException - if the parameter list is null.

installLevelSet

protected void installLevelSet(LevelSet levelSet,
                               AVList params)
                        throws IOException
Throws:
IOException

installLocationFor

protected File installLocationFor(AVList params)

installLocationForTile

protected Object installLocationForTile(AVList installParams,
                                        Tile tile)

installTileRaster

protected void installTileRaster(Tile tile,
                                 DataRaster tileRaster,
                                 AVList params)
                          throws IOException
Throws:
IOException

installTileRasterComplete

protected void installTileRasterComplete()

installTileRasterLater

protected void installTileRasterLater(LevelSet levelSet,
                                      Tile tile,
                                      DataRaster tileRaster,
                                      AVList params)

isDataSetLarge

protected boolean isDataSetLarge(Iterable<? extends DataRaster> rasters,
                                 int largeThreshold)

isFinalLevel

protected boolean isFinalLevel(LevelSet levelSet,
                               int levelNumber,
                               AVList params)

isWithinLatLonLimits

protected boolean isWithinLatLonLimits(Sector sector,
                                       LatLon tileDelta,
                                       LatLon tileOrigin)

removeProductionState

public void removeProductionState()
Specified by:
removeProductionState in interface DataStoreProducer
Overrides:
removeProductionState in class AbstractDataStoreProducer

startProgress

protected void startProgress()

updateProgress

protected void updateProgress()

validateProductionParameters

protected String validateProductionParameters(AVList parameters)
Specified by:
validateProductionParameters in class AbstractDataStoreProducer

waitForInstallTileTasks

protected void waitForInstallTileTasks()

NASA World Wind