NASA World Wind

gov.nasa.worldwind.terrain
Class AbstractElevationModel

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

public abstract class AbstractElevationModel
extends WWObjectImpl
implements ElevationModel


Field Summary
protected  FileStore dataFileStore
           
protected  boolean enabled
           
protected  long expiryTime
           
protected  double missingDataFlag
           
protected  double missingDataValue
           
protected  boolean networkRetrievalEnabled
           
 
Constructor Summary
AbstractElevationModel()
           
 
Method Summary
 void composeElevations(Sector sector, List<? extends LatLon> latlons, int tileWidth, double[] buffer)
          Determines the elevations at specified locations within a specified Sector.
static Element createElevationModelConfigElements(AVList params, Element context)
          Appends elevation model configuration parameters as elements to the specified context.
 void dispose()
          Disposes of any internal resources allocated by the object.
 FileStore getDataFileStore()
           
 double getDetailHint(Sector sector)
          Returns the detail hint associated with the specified sector.
 double getElevation(Angle latitude, Angle longitude)
          Returns the elevation at a specified location.
static AVList getElevationModelConfigParams(Element domElement, AVList params)
          Parses elevation model configuration parameters from the specified DOM document.
 long getExpiryTime()
          Returns the current expiry time.
 double getLocalDataAvailability(Sector sector, 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 getMissingDataReplacement()
          Returns the elevation used for missing values in the elevation model.
 double getMissingDataSignal()
          Returns the current missing-data signal.
 String getName()
          Returns the elevation model's name.
 String getRestorableState()
          Returns an XML document string describing the object's state.
static boolean isElevationModelConfigDocument(Element domElement)
          Returns true if a specified DOM document is an ElevationModel configuration document, and false otherwise.
 boolean isEnabled()
          Indicates whether this elevation model is used or ignored.
 boolean isNetworkRetrievalEnabled()
          Indicates whether the elevation model is allowed to retrieve data from the network.
protected  boolean isTransparentValue(Double value)
           
 void restoreState(String stateInXml)
          Restores the object's state to what is described in the specified XML document string.
 void setDataFileStore(FileStore dataFileStore)
           
 void setEnabled(boolean enabled)
          Indicates whether this elevation model is used or ignored.
 void setExpiryTime(long expiryTime)
          Specifies the time of the elevation model's most recent dataset update.
 void setMissingDataReplacement(double missingDataValue)
          Specifies the elevation used for missing values in the elevation model.
 void setMissingDataSignal(double missingDataFlag)
          Specifies the value used to identify missing data in an elevation model.
 void setName(String name)
          Set the elevation model's name.
 void setNetworkRetrievalEnabled(boolean enabled)
          Controls whether the elevation model is allowed to retrieve data from the network.
 String 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, 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, wait, wait, wait
 
Methods inherited from interface gov.nasa.worldwind.globes.ElevationModel
contains, getBestResolution, getElevations, getExtremeElevations, getExtremeElevations, getMaxElevation, getMinElevation, getUnmappedElevation, getUnmappedElevations, intersects
 
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
 

Field Detail

dataFileStore

protected FileStore dataFileStore

enabled

protected boolean enabled

expiryTime

protected long expiryTime

missingDataFlag

protected double missingDataFlag

missingDataValue

protected double missingDataValue

networkRetrievalEnabled

protected boolean networkRetrievalEnabled
Constructor Detail

AbstractElevationModel

public AbstractElevationModel()
Method Detail

composeElevations

public void composeElevations(Sector sector,
                              List<? extends LatLon> latlons,
                              int tileWidth,
                              double[] buffer)
                       throws Exception
Description copied from interface: ElevationModel
Determines the elevations at specified locations within a specified Sector.

Specified by:
composeElevations in interface ElevationModel
Parameters:
sector - the sector containing the locations.
latlons - the locations for which to return elevations.
tileWidth - the number of locations that comprise one row in the latlons argument.
buffer - a buffer in which to put the elevations. The buffer must have at least as many elements as the number of specified locations.
Throws:
Exception - if the method fails. Different elevation models may fail for different reasons.
IllegalArgumentException - if either the sector, list of locations or buffer is null, if the buffer size is not at least as large as the location list, or the tile width is greater than the locations list length or less than 1.

createElevationModelConfigElements

public static Element createElevationModelConfigElements(AVList params,
                                                         Element context)
Appends elevation model configuration parameters as elements to the specified context. This appends elements for the following parameters:
ParameterElement PathType
AVKey.DISPLAY_NAMEDisplayNameString
AVKey.NETWORK_RETRIEVAL_ENABLEDNetworkRetrievalEnabledBoolean
AVKey.MISSING_DATA_SIGNALMissingData/@signalDouble
AVKey.MISSING_DATA_REPLACEMENTMissingData/@replacementDouble
AVKey.DETAIL_HINTDataDetailHintDouble

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

dispose

public void dispose()
Description copied from interface: Disposable
Disposes of any internal resources allocated by the object.

Specified by:
dispose in interface Disposable

getDataFileStore

public FileStore getDataFileStore()

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
Parameters:
sector - the sector in question.
Returns:
The detail hint corresponding to the specified sector.

getElevation

public double getElevation(Angle latitude,
                           Angle longitude)
Description copied from interface: ElevationModel
Returns the elevation at a specified location. If the elevation at the specified location is the elevation model's missing data signal, or if the location specified is outside the elevation model's coverage area, the elevation model's missing data replacement value is returned.

The elevation returned from this method is the best available in memory. If no elevation is in memory, the elevation model's minimum extreme elevation at the location is returned. Local disk caches are not consulted.

Specified by:
getElevation in interface ElevationModel
Parameters:
latitude - the latitude of the location in question.
longitude - the longitude of the location in question.
Returns:
The elevation corresponding to the specified location, or the elevation model's missing-data replacement value if there is no elevation for the given location.
See Also:
ElevationModel.setMissingDataSignal(double), ElevationModel.getUnmappedElevation(gov.nasa.worldwind.geom.Angle, gov.nasa.worldwind.geom.Angle)

getElevationModelConfigParams

public static AVList getElevationModelConfigParams(Element domElement,
                                                   AVList params)
Parses elevation model configuration parameters from the 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 parameters are:
ParameterElement PathType
AVKey.DISPLAY_NAMEDisplayNameString
AVKey.NETWORK_RETRIEVAL_ENABLEDNetworkRetrievalEnabledBoolean
AVKey.MISSING_DATA_SIGNALMissingData/@signalDouble
AVKey.MISSING_DATA_REPLACEMENTMissingData/@replacementDouble
AVKey.DETAIL_HINTDataDetailHintDouble

Parameters:
domElement - the XML document root to parse for elevation model configuration elements.
params - the output key-value pairs which recieve the elevation model 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.

getExpiryTime

public long getExpiryTime()
Description copied from interface: ElevationModel
Returns the current expiry time.

Specified by:
getExpiryTime in interface ElevationModel
Returns:
the current expiry time.
See Also:
ElevationModel.setExpiryTime(long)

getLocalDataAvailability

public double getLocalDataAvailability(Sector sector,
                                       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
Parameters:
sector - 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.

getMissingDataReplacement

public double getMissingDataReplacement()
Description copied from interface: ElevationModel
Returns the elevation used for missing values in the elevation model.

Specified by:
getMissingDataReplacement in interface ElevationModel
Returns:
the value that indicates that no data is available at a location.
See Also:
ElevationModel.setMissingDataSignal(double), ElevationModel.getMissingDataSignal()

getMissingDataSignal

public double getMissingDataSignal()
Description copied from interface: ElevationModel
Returns the current missing-data signal.

Specified by:
getMissingDataSignal in interface ElevationModel
Returns:
the missing-data signal.
See Also:
ElevationModel.getMissingDataReplacement()

getName

public String getName()
Description copied from interface: ElevationModel
Returns the elevation model's name.

Specified by:
getName in interface ElevationModel
Returns:
the elevation model's name.
See Also:
ElevationModel.setName(String)

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
Returns:
an XML document string describing the object's state.

isElevationModelConfigDocument

public static boolean isElevationModelConfigDocument(Element domElement)
Returns true if a specified DOM document is an ElevationModel configuration document, and false otherwise.

Parameters:
domElement - the DOM document in question.
Returns:
true if the document is an ElevationModel configuration document; false otherwise.
Throws:
IllegalArgumentException - if document is null.

isEnabled

public boolean isEnabled()
Description copied from interface: ElevationModel
Indicates whether this elevation model is used or ignored.

Specified by:
isEnabled in interface ElevationModel
Returns:
true if this elevation model is used, otherwise false.

isNetworkRetrievalEnabled

public boolean isNetworkRetrievalEnabled()
Description copied from interface: ElevationModel
Indicates whether the elevation model is allowed to retrieve data from the network. Some elevation models have no need to retrieve data from the network. This flag is meaningless for such elevation models.

Specified by:
isNetworkRetrievalEnabled in interface ElevationModel
Returns:
true if the elevation model is enabled to retrieve network data, else false.

isTransparentValue

protected boolean isTransparentValue(Double value)

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

setDataFileStore

public void setDataFileStore(FileStore dataFileStore)

setEnabled

public void setEnabled(boolean enabled)
Description copied from interface: ElevationModel
Indicates whether this elevation model is used or ignored.

Specified by:
setEnabled in interface ElevationModel
Parameters:
enabled - true if this elevation model is used, otherwise false.

setExpiryTime

public void setExpiryTime(long expiryTime)
Description copied from interface: ElevationModel
Specifies the time of the elevation model's most recent dataset update. If greater than zero, the model ignores and eliminates any previously cached data older than the time specified, and requests new information from the data source. If zero, the model uses any expiry times intrinsic to the model, typically initialized at model construction. The default expiry time is 0, thereby enabling a model's intrinsic expiration criteria.

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

setMissingDataReplacement

public void setMissingDataReplacement(double missingDataValue)
Description copied from interface: ElevationModel
Specifies the elevation used for missing values in the elevation model.

Specified by:
setMissingDataReplacement in interface ElevationModel
Parameters:
missingDataValue - the value that indicates that no data is available at a location.
See Also:
ElevationModel.setMissingDataSignal(double)

setMissingDataSignal

public void setMissingDataSignal(double missingDataFlag)
Description copied from interface: ElevationModel
Specifies the value used to identify missing data in an elevation model. Locations with this elevation value are assigned the missing-data replacement value, specified by ElevationModel.setMissingDataReplacement(double).

The missing-data value is often specified by the metadata of the data set, in which case the elevation model automatically defines that value to be the missing-data signal. When the missing-data signal is not specified in the metadata, the application may specify it via this method.

Specified by:
setMissingDataSignal in interface ElevationModel
Parameters:
missingDataFlag - the missing-data signal value. The default is -Double.MAX_VALUE.
See Also:
ElevationModel.setMissingDataReplacement(double), ElevationModel.getMissingDataSignal()

setName

public void setName(String name)
Description copied from interface: ElevationModel
Set the elevation model's name. The name is a convenience attribute typically used to identify the elevation model in user interfaces. By default, an elevation model has no name.

Specified by:
setName in interface ElevationModel
Parameters:
name - the name to give the elevation model.

setNetworkRetrievalEnabled

public void setNetworkRetrievalEnabled(boolean enabled)
Description copied from interface: ElevationModel
Controls whether the elevation model is allowed to retrieve data from the network. Some elevation models have no need for data from the network. This flag may be set but is meaningless for such elevation models.

Specified by:
setNetworkRetrievalEnabled in interface ElevationModel
Parameters:
enabled - true if network retrieval is allowed, else false.

toString

public String toString()
Overrides:
toString in class Object

NASA World Wind