Package gov.nasa.worldwind.terrain
Class AbstractElevationModel
- java.lang.Object
-
- gov.nasa.worldwind.avlist.AVListImpl
-
- gov.nasa.worldwind.WWObjectImpl
-
- gov.nasa.worldwind.terrain.AbstractElevationModel
-
- All Implemented Interfaces:
AVList,Disposable,MessageListener,ElevationModel,Restorable,WWObject,java.beans.PropertyChangeListener,java.util.EventListener
- Direct Known Subclasses:
BasicElevationModel,BathymetryFilterElevationModel,CompoundElevationModel,LocalElevationModel,ZeroElevationModel
public abstract class AbstractElevationModel extends WWObjectImpl implements ElevationModel
-
-
Field Summary
Fields Modifier and Type Field Description protected FileStoredataFileStoreprotected booleanenabledprotected longexpiryTimeprotected doublemissingDataFlagprotected doublemissingDataValueprotected booleannetworkRetrievalEnabled
-
Constructor Summary
Constructors Constructor Description AbstractElevationModel()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcomposeElevations(Sector sector, java.util.List<? extends LatLon> latlons, int tileWidth, double[] buffer)Determines the elevations at specified locations within a specifiedSector.static org.w3c.dom.ElementcreateElevationModelConfigElements(AVList params, org.w3c.dom.Element context)Appends elevation model configuration parameters as elements to the specified context.voiddispose()Disposes of any internal resources allocated by the object.double[]getBestResolutions(Sector sector)FileStoregetDataFileStore()doublegetDetailHint(Sector sector)Returns the detail hint associated with the specified sector.doublegetElevation(Angle latitude, Angle longitude)Returns the elevation at a specified location.static AVListgetElevationModelConfigParams(org.w3c.dom.Element domElement, AVList params)Parses elevation model configuration parameters from the specified DOM document.double[]getElevations(Sector sector, java.util.List<? extends LatLon> latLons, double[] targetResolutions, double[] elevations)Returns the elevations of a collection of locations.longgetExpiryTime()Returns the current expiry time.doublegetLocalDataAvailability(Sector sector, java.lang.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.doublegetMissingDataReplacement()Returns the elevation used for missing values in the elevation model.doublegetMissingDataSignal()Returns the current missing-data signal.java.lang.StringgetName()Returns the elevation model's name.java.lang.StringgetRestorableState()Returns an XML document string describing the object's state.double[]getUnmappedElevations(Sector sector, java.util.List<? extends LatLon> latLons, double[] targetResolutions, double[] elevations)Returns the elevations of a collection of locations.doublegetUnmappedLocalSourceElevation(Angle latitude, Angle longitude)Returns the elevation for this elevation model's highest level of detail if the source file for that level and the specified location exists in the local elevation cache on disk.static booleanisElevationModelConfigDocument(org.w3c.dom.Element domElement)Returns true if a specified DOM document is an ElevationModel configuration document, and false otherwise.booleanisEnabled()Indicates whether this elevation model is used or ignored.booleanisNetworkRetrievalEnabled()Indicates whether the elevation model is allowed to retrieve data from the network.protected booleanisTransparentValue(java.lang.Double value)voidrestoreState(java.lang.String stateInXml)Restores the object's state to what is described in the specified XML document string.voidsetDataFileStore(FileStore dataFileStore)voidsetEnabled(boolean enabled)Indicates whether this elevation model is used or ignored.voidsetExpiryTime(long expiryTime)Specifies the time of the elevation model's most recent dataset update.voidsetMissingDataReplacement(double missingDataValue)Specifies the elevation used for missing values in the elevation model.voidsetMissingDataSignal(double missingDataFlag)Specifies the value used to identify missing data in an elevation model.voidsetName(java.lang.String name)Set the elevation model's name.voidsetNetworkRetrievalEnabled(boolean enabled)Controls whether the elevation model is allowed to retrieve data from the network.java.lang.StringtoString()-
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, getClass, hashCode, notify, notifyAll, 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 gov.nasa.worldwind.globes.ElevationModel
contains, getBestResolution, getElevations, getExtremeElevations, getExtremeElevations, getMaxElevation, getMinElevation, getUnmappedElevation, getUnmappedElevations, intersects, isExtremesCachingEnabled, setExtremesCachingEnabled
-
Methods inherited from interface gov.nasa.worldwind.event.MessageListener
onMessage
-
-
-
-
Field Detail
-
dataFileStore
protected FileStore dataFileStore
-
missingDataFlag
protected double missingDataFlag
-
missingDataValue
protected double missingDataValue
-
networkRetrievalEnabled
protected boolean networkRetrievalEnabled
-
expiryTime
protected long expiryTime
-
enabled
protected boolean enabled
-
-
Method Detail
-
dispose
public void dispose()
Description copied from interface:DisposableDisposes of any internal resources allocated by the object.- Specified by:
disposein interfaceDisposable
-
getName
public java.lang.String getName()
Description copied from interface:ElevationModelReturns the elevation model's name.- Specified by:
getNamein interfaceElevationModel- Returns:
- the elevation model's name.
- See Also:
ElevationModel.setName(String)
-
setName
public void setName(java.lang.String name)
Description copied from interface:ElevationModelSet 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:
setNamein interfaceElevationModel- Parameters:
name- the name to give the elevation model.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
isNetworkRetrievalEnabled
public boolean isNetworkRetrievalEnabled()
Description copied from interface:ElevationModelIndicates 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:
isNetworkRetrievalEnabledin interfaceElevationModel- Returns:
trueif the elevation model is enabled to retrieve network data, elsefalse.
-
setNetworkRetrievalEnabled
public void setNetworkRetrievalEnabled(boolean enabled)
Description copied from interface:ElevationModelControls 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:
setNetworkRetrievalEnabledin interfaceElevationModel- Parameters:
enabled-trueif network retrieval is allowed, elsefalse.
-
getExpiryTime
public long getExpiryTime()
Description copied from interface:ElevationModelReturns the current expiry time.- Specified by:
getExpiryTimein interfaceElevationModel- Returns:
- the current expiry time.
- See Also:
ElevationModel.setExpiryTime(long)
-
setExpiryTime
public void setExpiryTime(long expiryTime)
Description copied from interface:ElevationModelSpecifies 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:
setExpiryTimein interfaceElevationModel- 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.
-
setEnabled
public void setEnabled(boolean enabled)
Description copied from interface:ElevationModelIndicates whether this elevation model is used or ignored.- Specified by:
setEnabledin interfaceElevationModel- Parameters:
enabled- true if this elevation model is used, otherwise false.
-
isEnabled
public boolean isEnabled()
Description copied from interface:ElevationModelIndicates whether this elevation model is used or ignored.- Specified by:
isEnabledin interfaceElevationModel- Returns:
- true if this elevation model is used, otherwise false.
-
getMissingDataSignal
public double getMissingDataSignal()
Description copied from interface:ElevationModelReturns the current missing-data signal.- Specified by:
getMissingDataSignalin interfaceElevationModel- Returns:
- the missing-data signal.
- See Also:
ElevationModel.getMissingDataReplacement()
-
setMissingDataSignal
public void setMissingDataSignal(double missingDataFlag)
Description copied from interface:ElevationModelSpecifies the value used to identify missing data in an elevation model. Locations with this elevation value are assigned the missing-data replacement value, specified byElevationModel.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:
setMissingDataSignalin interfaceElevationModel- Parameters:
missingDataFlag- the missing-data signal value. The default is -Double.MAX_VALUE.- See Also:
ElevationModel.setMissingDataReplacement(double),ElevationModel.getMissingDataSignal()
-
getMissingDataReplacement
public double getMissingDataReplacement()
Description copied from interface:ElevationModelReturns the elevation used for missing values in the elevation model.- Specified by:
getMissingDataReplacementin interfaceElevationModel- Returns:
- the value that indicates that no data is available at a location.
- See Also:
ElevationModel.setMissingDataSignal(double),ElevationModel.getMissingDataSignal()
-
setMissingDataReplacement
public void setMissingDataReplacement(double missingDataValue)
Description copied from interface:ElevationModelSpecifies the elevation used for missing values in the elevation model.- Specified by:
setMissingDataReplacementin interfaceElevationModel- Parameters:
missingDataValue- the value that indicates that no data is available at a location.- See Also:
ElevationModel.setMissingDataSignal(double)
-
getDetailHint
public double getDetailHint(Sector sector)
Description copied from interface:ElevationModelReturns 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:
getDetailHintin interfaceElevationModel- Parameters:
sector- the sector in question.- Returns:
- The detail hint corresponding to the specified sector.
-
getDataFileStore
public FileStore getDataFileStore()
-
setDataFileStore
public void setDataFileStore(FileStore dataFileStore)
-
getElevation
public double getElevation(Angle latitude, Angle longitude)
Description copied from interface:ElevationModelReturns 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:
getElevationin interfaceElevationModel- 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)
-
getElevations
public double[] getElevations(Sector sector, java.util.List<? extends LatLon> latLons, double[] targetResolutions, double[] elevations)
Description copied from interface:ElevationModelReturns 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:
getElevationsin interfaceElevationModel- 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.targetResolutions- 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.) This is an array to enable specification of a target resolution per elevation model forCompoundElevationModel. The entries must be in the same order as the elevations inCompoundElevationModel.elevations- 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 resolutions achieved, in radians, which will be
Double.MAX_VALUEif individual elevations cannot be determined for all of the locations. The entries are in the same order as the elevations inCompoundElevationModel. - See Also:
ElevationModel.setMissingDataSignal(double)
-
getUnmappedElevations
public double[] getUnmappedElevations(Sector sector, java.util.List<? extends LatLon> latLons, double[] targetResolutions, double[] elevations)
Description copied from interface:ElevationModelReturns 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:
getUnmappedElevationsin interfaceElevationModel- 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.targetResolutions- 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.) This is an array to enable specification of a target resolution per elevation model forCompoundElevationModel. The entries must be in the same order as the elevations inCompoundElevationModel.elevations- 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 resolutions achieved, in radians, which will be
Double.MAX_VALUEif individual elevations cannot be determined for all of the locations. The entries are in the same order as the elevations inCompoundElevationModel. - See Also:
ElevationModel.setMissingDataSignal(double)
-
getBestResolutions
public double[] getBestResolutions(Sector sector)
- Specified by:
getBestResolutionsin interfaceElevationModel
-
getRestorableState
public java.lang.String getRestorableState()
Description copied from interface:RestorableReturns an XML document string describing the object's state. This state can be restored later by callingrestoreStateand passing the XML document.- Specified by:
getRestorableStatein interfaceRestorable- Returns:
- an XML document string describing the object's state.
-
restoreState
public void restoreState(java.lang.String stateInXml)
Description copied from interface:RestorableRestores the object's state to what is described in the specified XML document string.- Specified by:
restoreStatein interfaceRestorable- Parameters:
stateInXml- an XML document string describing an object's state.
-
composeElevations
public void composeElevations(Sector sector, java.util.List<? extends LatLon> latlons, int tileWidth, double[] buffer) throws java.lang.Exception
Description copied from interface:ElevationModelDetermines the elevations at specified locations within a specifiedSector.- Specified by:
composeElevationsin interfaceElevationModel- 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 thelatlonsargument.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:
java.lang.Exception- if the method fails. Different elevation models may fail for different reasons.java.lang.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.
-
isTransparentValue
protected boolean isTransparentValue(java.lang.Double value)
-
isElevationModelConfigDocument
public static boolean isElevationModelConfigDocument(org.w3c.dom.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:
java.lang.IllegalArgumentException- if document is null.
-
createElevationModelConfigElements
public static org.w3c.dom.Element createElevationModelConfigElements(AVList params, org.w3c.dom.Element context)
Appends elevation model configuration parameters as elements to the specified context. This appends elements for the following parameters:Parameters Parameter Element Path Type AVKey.DISPLAY_NAMEDisplayName String AVKey.NETWORK_RETRIEVAL_ENABLEDNetworkRetrievalEnabled Boolean AVKey.MISSING_DATA_SIGNALMissingData/@signal Double AVKey.MISSING_DATA_REPLACEMENTMissingData/@replacement Double AVKey.DETAIL_HINTDataDetailHint Double - 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:
java.lang.IllegalArgumentException- if either the parameters or the context are null.
-
getElevationModelConfigParams
public static AVList getElevationModelConfigParams(org.w3c.dom.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:Parameters Parameter Element Path Type AVKey.DISPLAY_NAMEDisplayName String AVKey.NETWORK_RETRIEVAL_ENABLEDNetworkRetrievalEnabled Boolean AVKey.MISSING_DATA_SIGNALMissingData/@signal Double AVKey.MISSING_DATA_REPLACEMENTMissingData/@replacement Double AVKey.DETAIL_HINTDataDetailHint Double - 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:
java.lang.IllegalArgumentException- if the document is null.
-
getLocalDataAvailability
public double getLocalDataAvailability(Sector sector, java.lang.Double targetResolution)
Description copied from interface:ElevationModelReturns 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:
getLocalDataAvailabilityin interfaceElevationModel- 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.
-
getUnmappedLocalSourceElevation
public double getUnmappedLocalSourceElevation(Angle latitude, Angle longitude)
Description copied from interface:ElevationModelReturns the elevation for this elevation model's highest level of detail if the source file for that level and the specified location exists in the local elevation cache on disk. This method is useful only when an elevation dataset has been pre-cached.- Specified by:
getUnmappedLocalSourceElevationin interfaceElevationModel- Parameters:
latitude- The latitude of the location whose elevation is desired.longitude- The longitude of the location whose elevation is desired.- Returns:
- The elevation at the specified location, if that location is contained in this elevation model and the
source file for the highest-resolution elevation at that location exists in the current disk cache. Otherwise
this elevation model's missing data signal is returned (see
ElevationModel.getMissingDataSignal()).
-
-