NASA World Wind

gov.nasa.worldwind.terrain
Class BasicElevationModel

java.lang.Object
  extended by gov.nasa.worldwind.avlist.AVListImpl
      extended by gov.nasa.worldwind.WWObjectImpl
          extended by gov.nasa.worldwind.terrain.AbstractElevationModel
              extended by gov.nasa.worldwind.terrain.BasicElevationModel
All Implemented Interfaces:
AVList, Disposable, MessageListener, ElevationModel, Restorable, BulkRetrievable, WWObject, PropertyChangeListener, EventListener
Direct Known Subclasses:
LocalRasterServerElevationModel, WMSBasicElevationModel

public class BasicElevationModel
extends AbstractElevationModel
implements BulkRetrievable


Nested Class Summary
protected static class BasicElevationModel.DownloadPostProcessor
           
protected static class BasicElevationModel.Elevations
          Internal class to hold collections of elevation tiles that provide elevations for a specific sector.
protected static class BasicElevationModel.ElevationTile
           
protected static class BasicElevationModel.RequestTask
           
 
Field Summary
protected  double detailHint
           
protected  String elevationDataByteOrder
           
protected  String elevationDataType
           
protected  BufferWrapper extremes
           
protected  int extremesLevel
           
protected  MemoryCache extremesLookupCache
           
protected  Object fileLock
           
protected  LevelSet levels
           
protected  ConcurrentHashMap<TileKey,BasicElevationModel.ElevationTile> levelZeroTiles
           
protected  double maxElevation
           
protected  MemoryCache memoryCache
           
protected  double minElevation
           
protected static int RESOURCE_ID_OGC_CAPABILITIES
           
 
Fields inherited from class gov.nasa.worldwind.terrain.AbstractElevationModel
dataFileStore, enabled, expiryTime, missingDataFlag, missingDataValue, networkRetrievalEnabled
 
Constructor Summary
BasicElevationModel(AVList params)
           
BasicElevationModel(Document dom, AVList params)
           
BasicElevationModel(Element domElement, AVList params)
           
BasicElevationModel(String restorableStateInXml)
           
 
Method Summary
protected  void addTileToCache(BasicElevationModel.ElevationTile tile, BufferWrapper elevations)
           
protected  boolean areElevationsInMemory(TileKey key)
           
protected  void checkElevationExpiration(BasicElevationModel.ElevationTile tile)
           
protected  void checkElevationExpiration(Iterable<? extends BasicElevationModel.ElevationTile> tiles)
           
protected  double[] computeExtremeElevations(Sector sector)
           
 boolean contains(Angle latitude, Angle longitude)
          Indicates whether a specified location is within the elevation model's domain.
protected static ByteBuffer convertImageToElevations(ByteBuffer buffer, String contentType)
           
static Document createBasicElevationModelConfigDocument(AVList params)
          Creates a configuration document for a BasicElevationModel described by the specified params.
static Element createBasicElevationModelConfigElements(AVList params, Element context)
          Appends BasicElevationModel configuration parameters as elements to the specified context.
protected  Document createConfigurationDocument(AVList params)
           
protected  MemoryCache createMemoryCache(String cacheName)
           
protected  BasicElevationModel.ElevationTile createTile(TileKey key)
           
protected  void determineExtremes(double value, double[] extremes)
           
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 downloadElevations(Tile tile)
           
protected  void downloadElevations(Tile tile, BasicElevationModel.DownloadPostProcessor postProcessor)
           
protected  void doWriteConfigurationParams(FileStore fileStore, String fileName, AVList params)
           
 ByteBuffer generateExtremeElevations(int levelNumber)
           
static AVList getBasicElevationModelConfigParams(Element domElement, AVList params)
          Parses BasicElevationModel parameters from a specified DOM document.
 double getBestResolution(Sector sector)
          Indicates the best resolution attainable for a specified sector.
protected  AVList getConfigurationParams(AVList params)
           
 double getDetailHint(Sector sector)
          Returns the detail hint associated with the specified sector.
 String getElevationDataByteOrder()
           
 String getElevationDataType()
           
protected  BasicElevationModel.Elevations getElevations(Sector requestedSector, LevelSet levelSet, int targetLevelNumber)
           
 double getElevations(Sector sector, List<? extends LatLon> latlons, double targetResolution, double[] buffer)
          Returns the elevations of a collection of locations.
protected  double getElevations(Sector sector, List<? extends LatLon> latlons, double targetResolution, double[] buffer, boolean mapMissingData)
           
 long getEstimatedMissingDataSize(Sector sector, double resolution)
          Get the estimated size in bytes of the elevations 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 elevations not in a specified file store for the given sector and resolution.
 double[] getExtremeElevations(Angle latitude, Angle longitude)
          Returns the minimum and maximum elevations at a specified location.
 double[] getExtremeElevations(Sector sector)
          Returns the minimum and maximum elevations within a specified sector of the elevation model.
protected  BufferWrapper getExtremes()
           
protected  int getExtremesLevel()
           
protected  MemoryCache getExtremesLookupCache()
          Returns the memory cache used to cache extreme elevation computations, initializing the cache if it doesn't yet exist.
 LevelSet getLevels()
           
protected  Map<TileKey,BasicElevationModel.ElevationTile> getLevelZeroTiles()
           
 double getLocalDataAvailability(Sector requestedSector, Double targetResolution)
          Returns the proportion of this elevation model's data that is local -- in the computer's data cache or installed data filestore -- for a specified sector and target resolution.
 double getMaxElevation()
          Returns the maximum elevation contained in the elevation model.
protected  MemoryCache getMemoryCache()
           
 double getMinElevation()
          Returns the minimum elevation contained in the elevation model.
 String getRestorableState()
          Returns an XML document string describing the object's state.
 void getRestorableStateForAVPair(String key, Object value, RestorableSupport rs, RestorableSupport.StateObject context)
           
protected  Level getTargetLevel(Sector sector, double targetSize)
           
protected  BasicElevationModel.ElevationTile getTileFromMemory(TileKey tileKey)
           
 double getUnmappedElevation(Angle latitude, Angle longitude)
          Returns the elevation at a specified location, but without replacing missing data with the elevation model's missing data replacement value.
 double getUnmappedElevations(Sector sector, List<? extends LatLon> latlons, double targetResolution, double[] buffer)
          Returns the elevations of a collection of locations.
 Object getValue(String key)
          Returns the value for a specified key.
protected  void initFromOGCCapabilitiesResource(WMSCapabilities caps, AVList params)
          Initializes this ElevationModel's expiry time property from the specified WMS Capabilities document and parameter list describing the WMS layer names associated with this ElevationModel.
 int intersects(Sector sector)
          Indicates whether the elevation model covers a specified sector either partially or fully.
protected  boolean isFileExpired(Tile tile, URL fileURL, FileStore fileStore)
           
protected  boolean isRetrieveResources()
          Returns a boolean value indicating if this ElevationModel should retrieve any non-tile resources, either online or in the local filesystem, and initialize itself using those resources.
protected  boolean isTileLocalOrAbsent(Tile tile)
           
protected  boolean loadElevations(BasicElevationModel.ElevationTile tile, URL url)
           
 void loadExtremeElevations(String extremesFileName)
           
protected  double lookupElevation(Angle latitude, Angle longitude, BasicElevationModel.ElevationTile tile)
           
 BulkRetrievalThread makeLocal(Sector sector, double resolution, BulkRetrievalListener listener)
          Start a new BulkRetrievalThread that downloads all elevations for a given sector and resolution to the current World Wind file cache, without downloading imagery already in the cache.
 BulkRetrievalThread makeLocal(Sector sector, double resolution, FileStore fileStore, BulkRetrievalListener listener)
          Start a new BulkRetrievalThread that downloads all elevations for a given sector and resolution to a specified file store, without downloading imagery already in the file store.
protected  boolean needsConfigurationFile(FileStore fileStore, String fileName, AVList params, boolean removeIfExpired)
           
protected  BufferWrapper readElevations(URL url)
           
protected  void requestTile(TileKey key)
           
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 retrieveElevations(Tile tile, BasicElevationModel.DownloadPostProcessor postProcessor)
           
protected  void retrieveLocalElevations(Tile tile, BasicElevationModel.DownloadPostProcessor postProcessor)
           
protected  void retrieveRemoteElevations(Tile tile, BasicElevationModel.DownloadPostProcessor postProcessor)
           
protected  String retrieveResources()
          Retrieves any non-tile resources associated with this ElevationModel, either online or in the local filesystem, and initializes properties of this ElevationModel using those resources.
 void setByteOrder(String byteOrder)
           
 void setDetailHint(double hint)
           
 void setElevationDataType(String dataType)
           
 void setExpiryTime(long expiryTime)
          Specifies the time of the elevation models's most recent dataset update, beyond which cached data is invalid.
protected static void setFallbacks(AVList params)
           
 Object setValue(String key, Object value)
          Adds a key/value pair to the list.
protected  void startResourceRetrieval()
          Starts retrieving non-tile resources associated with this model in a non-rendering thread.
protected  void writeConfigurationFile(FileStore fileStore)
           
protected  void writeConfigurationParams(AVList params, FileStore fileStore)
           
 
Methods inherited from class gov.nasa.worldwind.terrain.AbstractElevationModel
composeElevations, createElevationModelConfigElements, dispose, getDataFileStore, getElevation, getElevationModelConfigParams, getExpiryTime, getMissingDataReplacement, getMissingDataSignal, getName, isElevationModelConfigDocument, isEnabled, isNetworkRetrievalEnabled, isTransparentValue, setDataFileStore, setEnabled, setMissingDataReplacement, setMissingDataSignal, setName, setNetworkRetrievalEnabled, 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

detailHint

protected double detailHint

elevationDataByteOrder

protected String elevationDataByteOrder

elevationDataType

protected String elevationDataType

extremes

protected BufferWrapper extremes

extremesLevel

protected int extremesLevel

extremesLookupCache

protected MemoryCache extremesLookupCache

fileLock

protected final Object fileLock

levels

protected final LevelSet levels

levelZeroTiles

protected ConcurrentHashMap<TileKey,BasicElevationModel.ElevationTile> levelZeroTiles

maxElevation

protected final double maxElevation

memoryCache

protected MemoryCache memoryCache

minElevation

protected final double minElevation

RESOURCE_ID_OGC_CAPABILITIES

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

BasicElevationModel

public BasicElevationModel(AVList params)

BasicElevationModel

public BasicElevationModel(Document dom,
                           AVList params)

BasicElevationModel

public BasicElevationModel(Element domElement,
                           AVList params)

BasicElevationModel

public BasicElevationModel(String restorableStateInXml)
Method Detail

addTileToCache

protected void addTileToCache(BasicElevationModel.ElevationTile tile,
                              BufferWrapper elevations)

areElevationsInMemory

protected boolean areElevationsInMemory(TileKey key)

checkElevationExpiration

protected void checkElevationExpiration(BasicElevationModel.ElevationTile tile)

checkElevationExpiration

protected void checkElevationExpiration(Iterable<? extends BasicElevationModel.ElevationTile> tiles)

computeExtremeElevations

protected double[] computeExtremeElevations(Sector sector)

contains

public boolean contains(Angle latitude,
                        Angle longitude)
Description copied from interface: ElevationModel
Indicates whether a specified location is within the elevation model's domain.

Specified by:
contains in interface ElevationModel
Parameters:
latitude - the latitude of the location in question.
longitude - the longitude of the location in question.
Returns:
true if the location is within the elevation model's domain, otherwise false.

convertImageToElevations

protected static ByteBuffer convertImageToElevations(ByteBuffer buffer,
                                                     String contentType)
                                              throws IOException
Throws:
IOException

createBasicElevationModelConfigDocument

public static Document createBasicElevationModelConfigDocument(AVList params)
Creates a configuration document for a BasicElevationModel described by the specified params. The returned document may be used as a construction parameter to BasicElevationModel.

Parameters:
params - parameters describing a BasicElevationModel.
Returns:
a configuration document for the BasicElevationModel.

createBasicElevationModelConfigElements

public static Element createBasicElevationModelConfigElements(AVList params,
                                                              Element context)
Appends BasicElevationModel configuration parameters as elements to the specified context. This appends elements for the following parameters:
ParameterElement PathType
AVKey.SERVICE_NAMEService/@serviceNameString
AVKey.IMAGE_FORMATImageFormatString
AVKey.AVAILABLE_IMAGE_FORMATSAvailableImageFormats/ImageFormatString array
AVKey.DATA_TYPEDataType/@typeString
AVKey.BYTE_ORDERByteOrderDataType/@byteOrder
AVKey.ELEVATION_EXTREMES_FILEExtremeElevations/FileNameString
AVKey.ELEVATION_MAXExtremeElevations/@maxDouble
AVKey.ELEVATION_MINExtremeElevations/@minDouble
This also writes common elevation model and LevelSet configuration parameters by invoking AbstractElevationModel.createElevationModelConfigElements(gov.nasa.worldwind.avlist.AVList, org.w3c.dom.Element) and DataConfigurationUtils.createLevelSetConfigElements(gov.nasa.worldwind.avlist.AVList, org.w3c.dom.Element).

Parameters:
params - the key-value pairs which define the BasicElevationModel configuration parameters.
context - the XML document root on which to append BasicElevationModel configuration elements.
Returns:
a reference to context.
Throws:
IllegalArgumentException - if either the parameters or the context are null.

createConfigurationDocument

protected Document createConfigurationDocument(AVList params)

createMemoryCache

protected MemoryCache createMemoryCache(String cacheName)

createTile

protected BasicElevationModel.ElevationTile createTile(TileKey key)

determineExtremes

protected void determineExtremes(double value,
                                 double[] extremes)

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)

downloadElevations

protected void downloadElevations(Tile tile)

downloadElevations

protected void downloadElevations(Tile tile,
                                  BasicElevationModel.DownloadPostProcessor postProcessor)

doWriteConfigurationParams

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

generateExtremeElevations

public ByteBuffer generateExtremeElevations(int levelNumber)

getBasicElevationModelConfigParams

public static AVList getBasicElevationModelConfigParams(Element domElement,
                                                        AVList params)
Parses BasicElevationModel parameters from a specified DOM document. This writes output as key-value pairs to params. If a parameter from the XML document already exists in params, that parameter is ignored. Supported key and parameter names are:
ParameterElement PathType
AVKey.SERVICE_NAMEService/@serviceNameString
AVKey.IMAGE_FORMATImageFormatString
AVKey.AVAILABLE_IMAGE_FORMATSAvailableImageFormats/ImageFormatString array
AVKey.DATA_TYPEDataType/@typeString
AVKey.BYTE_ORDERDataType/@byteOrderString
AVKey.ELEVATION_EXTREMES_FILEExtremeElevations/FileNameString
AVKey.ELEVATION_MAXExtremeElevations/@maxDouble
AVKey.ELEVATION_MINExtremeElevations/@minDouble
This also parses common elevation model and LevelSet configuration parameters by invoking AbstractElevationModel.getElevationModelConfigParams(org.w3c.dom.Element, gov.nasa.worldwind.avlist.AVList) and DataConfigurationUtils.getLevelSetConfigParams(org.w3c.dom.Element, gov.nasa.worldwind.avlist.AVList).

Parameters:
domElement - the XML document root to parse for BasicElevationModel configuration parameters.
params - the output key-value pairs which recieve the BasicElevationModel configuration parameters. A null reference is permitted.
Returns:
a reference to params, or a new AVList if params is null.
Throws:
IllegalArgumentException - if the document is null.

getBestResolution

public double getBestResolution(Sector sector)
Description copied from interface: ElevationModel
Indicates the best resolution attainable for a specified sector.

Specified by:
getBestResolution in interface ElevationModel
Parameters:
sector - the sector in question. If null, the elevation model's best overall resolution is returned. This is the best attainable at some locations but not necessarily at all locations.
Returns:
the best resolution attainable for the specified sector, in radians, or Double.MAX_VALUE if the sector does not intersect the elevation model.

getConfigurationParams

protected AVList getConfigurationParams(AVList params)

getDetailHint

public double getDetailHint(Sector sector)
Description copied from interface: ElevationModel
Returns the detail hint associated with the specified sector. If the elevation model does not have any detail hint for the sector, this method returns zero.

Specified by:
getDetailHint in interface ElevationModel
Overrides:
getDetailHint in class AbstractElevationModel
Parameters:
sector - the sector in question.
Returns:
The detail hint corresponding to the specified sector.

getElevationDataByteOrder

public String getElevationDataByteOrder()

getElevationDataType

public String getElevationDataType()

getElevations

protected BasicElevationModel.Elevations getElevations(Sector requestedSector,
                                                       LevelSet levelSet,
                                                       int targetLevelNumber)

getElevations

public double getElevations(Sector sector,
                            List<? extends LatLon> latlons,
                            double targetResolution,
                            double[] buffer)
Description copied from interface: ElevationModel
Returns the elevations of a collection of locations. Replaces any elevation values corresponding to the missing data signal with the elevation model's missing data replacement value. If a location within the elevation model's coverage area cannot currently be determined, the elevation model's minimum extreme elevation for that location is returned in the output buffer. If a location is outside the elevation model's coverage area, the output buffer for that location is not modified; it retains the buffer's original value.

Specified by:
getElevations in interface ElevationModel
Parameters:
sector - the sector in question.
latlons - the locations to return elevations for. If a location is null, the output buffer for that location is not modified.
targetResolution - the desired horizontal resolution, in radians, of the raster or other elevation sample from which elevations are drawn. (To compute radians from a distance, divide the distance by the radius of the globe, ensuring that both the distance and the radius are in the same units.)
buffer - an array in which to place the returned elevations. The array must be pre-allocated and contain at least as many elements as the list of locations.
Returns:
the resolution achieved, in radians, or Double.MAX_VALUE if individual elevations cannot be determined for all of the locations.
See Also:
ElevationModel.setMissingDataSignal(double)

getElevations

protected double getElevations(Sector sector,
                               List<? extends LatLon> latlons,
                               double targetResolution,
                               double[] buffer,
                               boolean mapMissingData)

getEstimatedMissingDataSize

public long getEstimatedMissingDataSize(Sector sector,
                                        double resolution)
Get the estimated size in bytes of the elevations 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 elevations.
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 elevations not in a specified file store 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.
fileStore - the file store to examine. If null the current World Wind file cache is used.
Returns:
the estimated size in bytes of the missing elevations.
Throws:
IllegalArgumentException - if the sector is null or the resolution is less than zero.

getExtremeElevations

public double[] getExtremeElevations(Angle latitude,
                                     Angle longitude)
Description copied from interface: ElevationModel
Returns the minimum and maximum elevations at a specified location.

Specified by:
getExtremeElevations in interface ElevationModel
Parameters:
latitude - the latitude of the location in question.
longitude - the longitude of the location in question.
Returns:
A two-element double array indicating, respectively, the minimum and maximum elevations at the specified location. These values are the global minimum and maximum if the local minimum and maximum values are currently unknown.

getExtremeElevations

public double[] getExtremeElevations(Sector sector)
Description copied from interface: ElevationModel
Returns the minimum and maximum elevations within a specified sector of the elevation model.

Specified by:
getExtremeElevations in interface ElevationModel
Parameters:
sector - the sector in question.
Returns:
A two-element double array indicating, respectively, the sector's minimum and maximum elevations. These elements are the global minimum and maximum if the local minimum and maximum values are currently unknown.

getExtremes

protected BufferWrapper getExtremes()

getExtremesLevel

protected int getExtremesLevel()

getExtremesLookupCache

protected MemoryCache getExtremesLookupCache()
Returns the memory cache used to cache extreme elevation computations, initializing the cache if it doesn't yet exist. This is an instance level cache: each instance of BasicElevationModel has its own instance of an extreme elevations lookup cache.

Returns:
the memory cache associated with the extreme elevations computations.

getLevels

public LevelSet getLevels()

getLevelZeroTiles

protected Map<TileKey,BasicElevationModel.ElevationTile> getLevelZeroTiles()

getLocalDataAvailability

public double getLocalDataAvailability(Sector requestedSector,
                                       Double targetResolution)
Description copied from interface: ElevationModel
Returns the proportion of this elevation model's data that is local -- in the computer's data cache or installed data filestore -- for a specified sector and target resolution.

Specified by:
getLocalDataAvailability in interface ElevationModel
Overrides:
getLocalDataAvailability in class AbstractElevationModel
Parameters:
requestedSector - the sector of interest.
targetResolution - the desired horizontal resolution, in radians, of the raster or other elevation sample from which elevations are drawn. (To compute radians from a distance, divide the distance by the radius of the globe, ensuring that both the distance and the radius are in the same units.) Specify null to use this elevation model's best resolution.
Returns:
the fraction of the data that is local. A value of 1.0 indicates that all the data is available.

getMaxElevation

public double getMaxElevation()
Description copied from interface: ElevationModel
Returns the maximum elevation contained in the elevation model. When the elevation model is associated with a globe, this value is the elevation of the highest point on the globe.

Specified by:
getMaxElevation in interface ElevationModel
Returns:
The maximum elevation of the elevation model.

getMemoryCache

protected MemoryCache getMemoryCache()

getMinElevation

public double getMinElevation()
Description copied from interface: ElevationModel
Returns the minimum elevation contained in the elevation model. When associated with a globe, this value is the elevation of the lowest point on the globe. It may be negative, indicating a value below mean surface level. (Sea level in the case of Earth.)

Specified by:
getMinElevation in interface ElevationModel
Returns:
The minimum elevation of the model.

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 AbstractElevationModel
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

getTargetLevel

protected Level getTargetLevel(Sector sector,
                               double targetSize)

getTileFromMemory

protected BasicElevationModel.ElevationTile getTileFromMemory(TileKey tileKey)

getUnmappedElevation

public double getUnmappedElevation(Angle latitude,
                                   Angle longitude)
Description copied from interface: ElevationModel
Returns the elevation at a specified location, but without replacing missing data with the elevation model's missing data replacement value. When a missing data signal is found, the signal value is returned, not the replacement value.

Specified by:
getUnmappedElevation in interface ElevationModel
Parameters:
latitude - the latitude of the location for which to return the elevation.
longitude - the longitude of the location for which to return the elevation.
Returns:
the elevation at the specified location, or the elevation model's missing data signal. If no data is currently in memory for the location, and the location is within the elevation model's coverage area, the elevation model's minimum elevation at that location is returned.

getUnmappedElevations

public double getUnmappedElevations(Sector sector,
                                    List<? extends LatLon> latlons,
                                    double targetResolution,
                                    double[] buffer)
Description copied from interface: ElevationModel
Returns the elevations of a collection of locations. Does not replace any elevation values corresponding to the missing data signal with the elevation model's missing data replacement value. If a location within the elevation model's coverage area cannot currently be determined, the elevation model's minimum extreme elevation for that location is returned in the output buffer. If a location is outside the elevation model's coverage area, the output buffer for that location is not modified; it retains the buffer's original value.

Specified by:
getUnmappedElevations in interface ElevationModel
Parameters:
sector - the sector in question.
latlons - the locations to return elevations for. If a location is null, the output buffer for that location is not modified.
targetResolution - the desired horizontal resolution, in radians, of the raster or other elevation sample from which elevations are drawn. (To compute radians from a distance, divide the distance by the radius of the globe, ensuring that both the distance and the radius are in the same units.)
buffer - an array in which to place the returned elevations. The array must be pre-allocated and contain at least as many elements as the list of locations.
Returns:
the resolution achieved, in radians, or Double.MAX_VALUE if individual elevations cannot be determined for all of the locations.
See Also:
ElevationModel.setMissingDataSignal(double)

getValue

public Object getValue(String key)
Description copied from interface: AVList
Returns the value for a specified key.

Specified by:
getValue in interface AVList
Overrides:
getValue in class AVListImpl
Parameters:
key - the attribute name. May not be null.
Returns:
the attribute value if one exists in the collection, otherwise null.

initFromOGCCapabilitiesResource

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

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

intersects

public int intersects(Sector sector)
Description copied from interface: ElevationModel
Indicates whether the elevation model covers a specified sector either partially or fully.

Specified by:
intersects in interface ElevationModel
Parameters:
sector - the sector in question.
Returns:
0 if the elevation model fully contains the sector, 1 if the elevation model intersects the sector but does not fully contain it, or -1 if the sector does not intersect the elevation model.

isFileExpired

protected boolean isFileExpired(Tile tile,
                                URL fileURL,
                                FileStore fileStore)

isRetrieveResources

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

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

isTileLocalOrAbsent

protected boolean isTileLocalOrAbsent(Tile tile)

loadElevations

protected boolean loadElevations(BasicElevationModel.ElevationTile tile,
                                 URL url)
                          throws IOException
Throws:
IOException

loadExtremeElevations

public void loadExtremeElevations(String extremesFileName)

lookupElevation

protected double lookupElevation(Angle latitude,
                                 Angle longitude,
                                 BasicElevationModel.ElevationTile tile)

makeLocal

public BulkRetrievalThread makeLocal(Sector sector,
                                     double resolution,
                                     BulkRetrievalListener listener)
Start a new BulkRetrievalThread that downloads all elevations for a given sector and resolution to the current World Wind file cache, without downloading imagery 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 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.

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.
listener - an optional retrieval listener. May be null.
Returns:
the BulkRetrievalThread executing the retrieval or null if the specified sector does not intersect the elevation model bounding sector.
Throws:
IllegalArgumentException - if the sector is null or the resolution is less than zero.
See Also:
BasicElevationModelBulkDownloader

makeLocal

public BulkRetrievalThread makeLocal(Sector sector,
                                     double resolution,
                                     FileStore fileStore,
                                     BulkRetrievalListener listener)
Start a new BulkRetrievalThread that downloads all elevations for a given sector and resolution to a specified file store, without downloading imagery 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 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.

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 elevations. 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 elevation model bounding sector.
Throws:
IllegalArgumentException - if the sector is null or the resolution is less than zero.
See Also:
BasicElevationModelBulkDownloader

needsConfigurationFile

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

readElevations

protected BufferWrapper readElevations(URL url)
                                throws IOException
Throws:
IOException

requestTile

protected void requestTile(TileKey key)

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 AbstractElevationModel
Parameters:
stateInXml - an XML document string describing an object's state.

restoreStateForParams

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

retrieveElevations

protected void retrieveElevations(Tile tile,
                                  BasicElevationModel.DownloadPostProcessor postProcessor)

retrieveLocalElevations

protected void retrieveLocalElevations(Tile tile,
                                       BasicElevationModel.DownloadPostProcessor postProcessor)

retrieveRemoteElevations

protected void retrieveRemoteElevations(Tile tile,
                                        BasicElevationModel.DownloadPostProcessor postProcessor)

retrieveResources

protected String retrieveResources()
Retrieves any non-tile resources associated with this ElevationModel, either online or in the local filesystem, and initializes properties of this ElevationModel 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.

setByteOrder

public void setByteOrder(String byteOrder)

setDetailHint

public void setDetailHint(double hint)

setElevationDataType

public void setElevationDataType(String dataType)

setExpiryTime

public void setExpiryTime(long expiryTime)
Specifies the time of the elevation models's most recent dataset update, beyond which cached data is invalid. If greater than zero, the model ignores and eliminates any in-memory or on-disk cached data older than the time specified, and requests new information from the data source. If zero, the default, the model applies any expiry times associated with its individual levels, but only for on-disk cached data. In-memory cached data is expired only when the expiry time is specified with this method and is greater than zero. This method also overwrites the expiry times of the model's individual levels if the value specified to the method is greater than zero.

Specified by:
setExpiryTime in interface ElevationModel
Overrides:
setExpiryTime in class AbstractElevationModel
Parameters:
expiryTime - the expiry time of any cached data, expressed as a number of milliseconds beyond the epoch. The default expiry time is zero.
See Also:
for a description of milliseconds beyond the epoch.

setFallbacks

protected static void setFallbacks(AVList params)

setValue

public Object setValue(String key,
                       Object value)
Description copied from interface: AVList
Adds a key/value pair to the list. Replaces an existing key/value pair if the list already contains the key.

Specified by:
setValue in interface AVList
Overrides:
setValue in class AVListImpl
Parameters:
key - the attribute name. May not be null.
value - the attribute value. May be null, in which case any existing value for the key is removed from the collection.
Returns:
previous value associated with specified key, or null if there was no mapping for key. A null return can also indicate that the map previously associated null with the specified key, if the implementation supports null values.

startResourceRetrieval

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


writeConfigurationFile

protected void writeConfigurationFile(FileStore fileStore)

writeConfigurationParams

protected void writeConfigurationParams(AVList params,
                                        FileStore fileStore)

NASA World Wind